Skip to content

Commit

Permalink
Uncomment out some LoC
Browse files Browse the repository at this point in the history
  • Loading branch information
RCantu92 committed Apr 4, 2024
1 parent 58c48ad commit b1b2a3b
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions scripts/deployments/stake-delegation.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@ const registerNode = async (name, owner, opts = {}) => {

const reverseRegister = async (contract, name) => {
const reverseResolved = await contract.provider.lookupAddress(contract.address);
// console.log(`\ncontract.signer: ${contract.signer.address}`);
// console.log(`contract.address: ${contract.address} | reverseResolved: ${reverseResolved}`);
if (reverseResolved != name) {
// console.log(`contract.provider.network.ensAddress: ${contract.provider.network.ensAddress} | name: ${name}`);
await contract
.setName(contract.provider.network.ensAddress, name)
.then((tx) => tx.wait())
.catch((e) => DEBUG(e));
// .catch((e) => console.log(e))
}
};

Expand All @@ -87,17 +83,17 @@ async function migrate(config = {}) {
if (config?.force) {
CACHE.clear();
}
// config.childChain = config.childChain ? config.childChain : !!deployEnv.CHILD_CHAIN_MANAGER_PROXY[chainId];
// config.childChainManagerProxy = config.childChainManagerProxy ?? deployEnv.CHILD_CHAIN_MANAGER_PROXY[chainId];
config.childChain = config.childChain ? config.childChain : !!deployEnv.CHILD_CHAIN_MANAGER_PROXY[chainId];
config.childChainManagerProxy = config.childChainManagerProxy ?? deployEnv.CHILD_CHAIN_MANAGER_PROXY[chainId];
config.chainsToDeploy = config.chainsToDeploy ?? ['L1', 'L2'];
const contracts = {};
const slashParams = {};

const hardhatDeployment = chainId === 31337;

const fortaConstructorArgs = [];
// DEBUG('config.childChain', config.childChain);
// DEBUG('config.childChainManagerProxy', config.childChainManagerProxy);
DEBUG('config.childChain', config.childChain);
DEBUG('config.childChainManagerProxy', config.childChainManagerProxy);

// For test compatibility: since we need to mint and FortaBridgedPolygon does not mint(), we base our decision to deploy
// FortaBridgedPolygon is based on the existence of childChainManagerProxy, not childChain
Expand Down Expand Up @@ -153,7 +149,7 @@ async function migrate(config = {}) {
DEBUG(`roles fetched`);

if (!hardhatDeployment) {
// if (!provider.network.ensAddress) {
if (!provider.network.ensAddress) {
contracts.ens = {};

contracts.ens.registry = await ethers.getContractFactory('ENSRegistry', deployer).then((factory) => utils.tryFetchContract('ENSRegistry', [], CACHE));
Expand All @@ -177,31 +173,31 @@ async function migrate(config = {}) {

// ens registration

// if (config.childChain) {
if (config.childChain) {
await Promise.all([
registerNode('staking-subjects.forta.eth', deployer.address, { ...contracts.ens, resolved: contracts.subjectGateway.address, chainId: chainId }),
registerNode('scanner-pools.registries.forta.eth', deployer.address, { ...contracts.ens, resolved: contracts.scannerPools.address, chainId: chainId }),
registerNode('rewards.forta.eth', deployer.address, { ...contracts.ens, resolved: contracts.rewardsDistributor.address, chainId: chainId }),
]);
// }
}

DEBUG('ens configuration');
// } else {
// contracts.ens = {};
// const ensRegistryAddress = await CACHE.get('ens-registry');
// contracts.ens.registry = ensRegistryAddress ? await utils.attach('ENSRegistry', ensRegistryAddress) : null;
// const ensResolverAddress = await CACHE.get('ens-resolver');
// contracts.ens.resolver = ensRegistryAddress ? await utils.attach('PublicResolver', ensResolverAddress) : null;
// }
} else {
contracts.ens = {};
const ensRegistryAddress = await CACHE.get('ens-registry');
contracts.ens.registry = ensRegistryAddress ? await utils.attach('ENSRegistry', ensRegistryAddress) : null;
const ensResolverAddress = await CACHE.get('ens-resolver');
contracts.ens.resolver = ensRegistryAddress ? await utils.attach('PublicResolver', ensResolverAddress) : null;
}
DEBUG('Starting reverse registration...');
var reverseRegisters = [];
// if (config.childChain) {
if (config.childChain) {
reverseRegisters = reverseRegisters.concat([
reverseRegister(contracts.subjectGateway, 'staking-subjects.forta.eth'),
reverseRegister(contracts.scannerPools, 'scanner-pools.registries.forta.eth'),
reverseRegister(contracts.rewardsDistributor, 'rewards.forta.eth'),
]);
// }
}
await Promise.all(reverseRegisters);

DEBUG('reverse registration');
Expand Down

0 comments on commit b1b2a3b

Please sign in to comment.