Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OPS-SCRIPTS] smol fixes done for 1.9.1 rollout #1911

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions packages/ethereum-contracts/ops-scripts/deploy-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,16 +835,15 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
agreementsToUpdate.push(idaNewLogicAddress);
}
// deploy new GDA logic
const gdaAddr = await (await UUPSProxiable.at(
await superfluid.getAgreementClass.call(GDAv1_TYPE)
)).getCodeAddress();
const gdaProxyAddr = await superfluid.getAgreementClass.call(GDAv1_TYPE);
const gdaLogicAddr = await (await UUPSProxiable.at(gdaProxyAddr)).getCodeAddress();
const superfluidPoolBeaconAddr = await (
await GeneralDistributionAgreementV1.at(gdaAddr)
await GeneralDistributionAgreementV1.at(gdaProxyAddr)
).superfluidPoolBeacon.call();
const gdaNewLogicAddress = await deployContractIfCodeChanged(
web3,
GeneralDistributionAgreementV1,
gdaAddr,
gdaLogicAddr,
async () => (await deployGDAv1(superfluidPoolBeaconAddr)).address,
[
superfluidConstructorParam,
Expand Down Expand Up @@ -1095,13 +1094,13 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const constantOutflowNFTLogic = await deployNFTContract(
ConstantOutflowNFT,
"ConstantOutflowNFT",
"CONSTANT_OUTFLOW_NFT",
"CONSTANT_OUTFLOW_NFT_LOGIC",
[superfluid.address, cfaAddr, gdaAddr, constantInflowNFTProxy.address]
);
const constantInflowNFTLogic = await deployNFTContract(
ConstantInflowNFT,
"ConstantInflowNFT",
"CONSTANT_INFLOW_NFT",
"CONSTANT_INFLOW_NFT_LOGIC",
[superfluid.address, cfaAddr, gdaAddr, constantOutflowNFTProxy.address]
);

Expand Down Expand Up @@ -1149,7 +1148,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const cofNFTLogic = await deployNFTContract(
ConstantOutflowNFT,
"ConstantOutflowNFT",
"CONSTANT_OUTFLOW_NFT",
"CONSTANT_OUTFLOW_NFT_LOGIC",
[superfluid.address, cfaAddr, gdaAddr, cifNFTProxyAddress]
);
// @note we set the cofNFTLogicAddress to be passed to SuperTokenFactoryLogic here
Expand All @@ -1168,7 +1167,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const cifNFTLogic = await deployNFTContract(
ConstantInflowNFT,
"ConstantInflowNFT",
"CONSTANT_INFLOW_NFT",
"CONSTANT_INFLOW_NFT_LOGIC",
[superfluid.address, cfaAddr, gdaAddr, cofNFTProxyAddress]
);
// @note we set the cifNFTLogicAddress to be passed to SuperTokenFactoryLogic here
Expand Down Expand Up @@ -1207,13 +1206,13 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const poolAdminNFTLogic = await deployNFTContract(
PoolAdminNFT,
"PoolAdminNFT",
"POOL_ADMIN_NFT",
"POOL_ADMIN_NFT_LOGIC",
[superfluid.address, gdaAddr]
);
const poolMemberNFTLogic = await deployNFTContract(
PoolMemberNFT,
"PoolMemberNFT",
"POOL_MEMBER_NFT",
"POOL_MEMBER_NFT_LOGIC",
[superfluid.address, gdaAddr]
);

Expand Down Expand Up @@ -1258,7 +1257,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const poolAdminNFTLogic = await deployNFTContract(
PoolAdminNFT,
"PoolAdminNFT",
"POOL_ADMIN_NFT",
"POOL_ADMIN_NFT_LOGIC",
[superfluid.address, gdaAddr]
);
// @note we set the poolAdminNFTLogicAddress to be passed to SuperTokenFactoryLogic here
Expand All @@ -1276,7 +1275,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
const poolMemberNFTLogic = await deployNFTContract(
PoolMemberNFT,
"PoolMemberNFT",
"POOL_MEMBER_NFT",
"POOL_MEMBER_NFT_LOGIC",
[superfluid.address, gdaAddr]
);
// @note we set the poolMemberNFTLogicAddress to be passed to SuperTokenFactoryLogic here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
additionalContracts: [
"Ownable",
"IMultiSigWallet",
"ISafe",
"SuperfluidGovernanceBase",
"Resolver",
"UUPSProxiable",
Expand All @@ -85,17 +86,18 @@ module.exports = eval(`(${S.toString()})()`)(async function (
const canonicalSuperTokenLogic = await getCanonicalSuperTokenLogic(sf);
console.log(`current canonical super token logic: ${canonicalSuperTokenLogic}`);

const newSuperTokenLogic = superTokenLogic !== undefined ?
superTokenLogic :
canonicalSuperTokenLogic;

console.log("SuperToken logic to update to:", newSuperTokenLogic);

let tokensToBeUpgraded = (args.length === 1 && args[0] === "ALL") ?
await getTokensToBeUpgraded(sf, canonicalSuperTokenLogic, skipTokens) :
await getTokensToBeUpgraded(sf, newSuperTokenLogic, skipTokens) :
Array.from(args);

console.log(`${tokensToBeUpgraded.length} tokens to be upgraded`);

const superTokenLogicAddr = superTokenLogic !== undefined ?
superTokenLogic :
canonicalSuperTokenLogic;

console.log("SuperToken logic to update to:", superTokenLogicAddr);

if (tokensToBeUpgraded.length > 0) {
console.log(`${tokensToBeUpgraded.length} tokens to be upgraded`);
Expand All @@ -117,7 +119,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
if (!dryRun) {
// a non-canonical logic address can be provided in an extra array (batchUpdateSuperTokenLogic is overloaded)
const govAction = superTokenLogic !== undefined ?
(gov) => gov.batchUpdateSuperTokenLogic(sf.host.address, batch, [...new Array(batch.length)].map(e => superTokenLogicAddr)) :
(gov) => gov.batchUpdateSuperTokenLogic(sf.host.address, batch, [...new Array(batch.length)].map(e => newSuperTokenLogic)) :
(gov) => gov.batchUpdateSuperTokenLogic(sf.host.address, batch)

await sendGovernanceAction(sf, govAction);
Expand Down Expand Up @@ -159,7 +161,7 @@ async function getCanonicalSuperTokenLogic(sf) {
// - not being a proxy or not having a logic address
// - already pointing to the latest logic
// - in the skip list (e.g. because not managed by SF gov)
async function getTokensToBeUpgraded(sf, canonicalSuperTokenLogic, skipList) {
async function getTokensToBeUpgraded(sf, newSuperTokenLogic, skipList) {
const maxItems = parseInt(process.env.MAX_ITEMS) || 1000;
const skipItems = parseInt(process.env.SKIP_ITEMS) || 0;

Expand Down Expand Up @@ -211,18 +213,29 @@ async function getTokensToBeUpgraded(sf, canonicalSuperTokenLogic, skipList) {
console.log(
`[SKIP] SuperToken@${superToken.address} (${symbol}) is likely an uninitalized proxy`
);
} else if (canonicalSuperTokenLogic !== superTokenLogic) {
} else if (newSuperTokenLogic !== superTokenLogic) {
if (!pastSuperTokenLogics.map(e => e.toLowerCase()).includes(superTokenLogic.toLowerCase())) {
// if the previous logic isn't in our list of past canonical supertoken logics, we skip it
// it likely means we don't have upgradability ownership
console.log(
`!!! [SKIP] SuperToken@${superToken.address} (${symbol}) alien previous logic ${superTokenLogic} - please manually check!`
);
} else {
console.log(
`SuperToken@${superToken.address} (${symbol}) logic needs upgrade from ${superTokenLogic}`
);
return superTokenAddress;
try {
const adminAddr = await superToken.getAdmin();
if (adminAddr !== ZERO_ADDRESS) {
console.warn(
`!!! [SKIP] SuperToken@${superToken.address} admin override set to ${adminAddr}`
);
} else {
console.log(
`SuperToken@${superToken.address} (${symbol}) logic needs upgrade from ${superTokenLogic}`
);
return superTokenAddress;
}
} catch(err) {
console.log("### failed to get admin addr:", err.message);
}
}
} else {
console.log(
Expand All @@ -234,19 +247,7 @@ async function getTokensToBeUpgraded(sf, canonicalSuperTokenLogic, skipList) {
`??? [SKIP] SuperToken@${superToken.address} failed to be queried, probably not UUPSProxiable`
);
}

try {
const adminAddr = await superToken.getAdmin();
if (adminAddr !== ZERO_ADDRESS) {
console.warn(
`!!! [SKIP] SuperToken@${superToken.address} admin override set to ${adminAddr}`
);
}
} catch(err) {
// TODO: enable logging once we expect this to exist
//console.log("### failed to get admin addr:", err.message);
}
}
)).filter((i) => typeof i !== "undefined")
.filter((item) => !skipList.map(e => e.toLowerCase()).includes(item.toLowerCase()));
}
}
4 changes: 2 additions & 2 deletions packages/js-sdk/src/Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = class Framework {
contractLoader: this._options.contractLoader,
networkId: this.networkId,
// copy of ethereum-contracts/ops-scripts/libs/common.js:getGasConfig()
gasConfig: (networkId) => {
gasConfig: ((networkId) => {
let gasConfig = {};

const networkConfig = Object.values(truffleConfig.networks)
Expand Down Expand Up @@ -123,7 +123,7 @@ module.exports = class Framework {
}

return gasConfig;
},
})(this.networkId),
});

const resolverAddress =
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"pretest": "yarn testenv:start",
"test": "hardhat test --tsconfig \"tsconfig.test.json\"",
"dev": "nodemon -e ts -x yarn test",
"clean": "rm -rf node_modules; rm -rf dist; rm -rf src/typechain-types; rm -rf src/typechain; rm -rf src/abi; find . -type f -name '*.generated.ts' -exec rm {} +",
"test-coverage": "nyc --reporter=html --reporter=lcov --reporter=json yarn test",
"posttest": "yarn testenv:stop",
"check-updates": "ncu --target minor --dep prod,dev",
Expand Down
Loading