Skip to content

Commit

Permalink
base-mainnet deployment & tooling improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
d10r authored Jul 20, 2023
1 parent 42864ac commit bac5c12
Show file tree
Hide file tree
Showing 16 changed files with 123 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/automation-contracts/autowrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dotenv": "^16.0.3"
},
"dependencies": {
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"hardhat": "^2.12.4",
"hardhat-deploy": "^0.11.22"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/automation-contracts/scheduler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dotenv": "^16.0.3"
},
"dependencies": {
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"hardhat": "^2.12.4",
"hardhat-deploy": "^0.11.22"
}
Expand Down
23 changes: 14 additions & 9 deletions packages/ethereum-contracts/ops-scripts/deploy-aux-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const BatchLiquidator = artifacts.require("BatchLiquidator");
* - deploy TOGA
* - set TOGA as rewardAddress
* - deploy BatchLiquidator
* - replace governance
*
* @param web3 The web3 instance to be used
* @param from address to use for funding the deployer account
Expand All @@ -33,9 +34,9 @@ const BatchLiquidator = artifacts.require("BatchLiquidator");
* - GOV_PATRICIAN_PERIOD overrides the default value of 30 minutes
* - TOGA_MIN_BOND_DURATION overrides the default value of 7 days
*
* You may also need to set RESOLVER_ADDRESS if not yet set in js-sdk.
* You may also need to set RESOLVER_ADDRESS if not yet set in metadata.
*/
module.exports = eval(`(${S.toString()})()`)(async function (
module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
args,
options = {}
) {
Expand All @@ -49,6 +50,11 @@ module.exports = eval(`(${S.toString()})()`)(async function (
});
await sf.initialize();

const oldGov = await sf.contracts.ISuperfluidGovernance.at(
await sf.host.getGovernance.call()
);
console.log(`previous governance: ${oldGov.address}`);

console.log("deploying production governance...");
const govProxy = await SuperfluidGovernanceIIProxy.new();
console.log("governance proxy deployed at:", govProxy.address);
Expand Down Expand Up @@ -87,13 +93,12 @@ module.exports = eval(`(${S.toString()})()`)(async function (
);
console.log("reward address set to TOGA");

const batchLiquidator = await BatchLiquidator.new();
const batchLiquidator = await BatchLiquidator.new(
sf.host.address,
sf.agreements.cfa.address,
);
console.log("BatchLiquidator deployed at:", batchLiquidator.address);

console.log("");
console.log("LEFT TO BE DONE MANUALLY:");
console.log("replace old governance with new governance:");
console.log(
`gov.replaceGovernance(${sf.host.address}, ${govProxy.address})`
);
await oldGov.replaceGovernance(sf.host.address, govProxy.address);
console.log("replaced governance");
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
output += "IS_TESTNET=1\n";
}
output += `NETWORK_ID=${networkId}\n`;
output += `RESOLVER=${sf.resolver.address}\n`;
output += `SUPERFLUID_LOADER=${sf.loader.address}\n`;
output += `SUPERFLUID_HOST_PROXY=${sf.host.address}\n`;
output += `SUPERFLUID_HOST_LOGIC=${await getCodeAddress(
Expand Down Expand Up @@ -135,5 +136,20 @@ module.exports = eval(`(${S.toString()})()`)(async function (
}
}

// optional periphery contracts

if (config.metadata?.contractsV1?.toga) {
output += `TOGA=${config.metadata.contractsV1.toga}\n`;
}
if (config.metadata?.contractsV1?.batchLiquidator) {
output += `BATCH_LIQUIDATOR=${config.metadata.contractsV1.batchLiquidator}\n`;
}
if (config.metadata?.contractsV1?.flowScheduler) {
output += `FLOW_SCHEDULER=${config.metadata.contractsV1.flowScheduler}\n`;
}
if (config.metadata?.contractsV1?.vestingScheduler) {
output += `VESTING_SCHEDULER=${config.metadata.contractsV1.vestingScheduler}\n`;
}

await util.promisify(fs.writeFile)(outputFilename, output);
});
1 change: 1 addition & 0 deletions packages/ethereum-contracts/ops-scripts/libs/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = function getConfig(chainId) {
},
cfaFwd: sfNw?.contractsV1?.cfaV1Forwarder || "0xcfA132E353cB4E398080B9700609bb008eceB125",
nativeTokenSymbol: sfNw?.nativeTokenSymbol || "ETH",
metadata: sfNw,
resolverAddress: global?.process.env.RESOLVER_ADDRESS || sfNw?.contractsV1?.resolver,
...EXTRA_CONFIG[chainId]
};
Expand Down
3 changes: 2 additions & 1 deletion packages/ethereum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"build:typechain": "tsc -p tsconfig.typechain.json",
"build:dev-scripts": "rm -rf dev-scripts/*.d.ts dev-scripts/*.d.ts.map; tsc -p tsconfig.scripts.json",
"build:contracts-size": "tasks/print-contract-sizes.sh | tee build/contracts-sizes.txt",
"verify-framework": "tasks/etherscan-verify-framework.sh",
"testenv:start": "test/testenv-ctl.sh start",
"testenv:stop": "test/testenv-ctl.sh stop",
"testenv:deploy": "yarn run-truffle exec ops-scripts/deploy-test-environment.js : TEST",
Expand Down Expand Up @@ -86,7 +87,7 @@
},
"devDependencies": {
"@nomiclabs/hardhat-truffle5": "^2.0.7",
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"async": "^3.2.4",
"csv-writer": "^1.6.0",
"ganache-time-traveler": "1.0.16",
Expand Down
26 changes: 25 additions & 1 deletion packages/ethereum-contracts/tasks/etherscan-verify-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ set -x
TRUFFLE_NETWORK=$1
ADDRESSES_VARS=$2

if [ -z "$ADDRESSES_VARS" ]; then
echo "no addresses provided, fetching myself..."
ADDRESSES_VARS="/tmp/$TRUFFLE_NETWORK.addrs"
npx truffle exec --network "$TRUFFLE_NETWORK" ops-scripts/info-print-contract-addresses.js : "$ADDRESSES_VARS" || exit 1
fi

# shellcheck disable=SC1090
source "$ADDRESSES_VARS"

Expand Down Expand Up @@ -115,7 +121,25 @@ mv -f build/contracts/InstantDistributionAgreementV1.json.bak build/contracts/In
if [ -n "$SUPER_TOKEN_NATIVE_COIN" ];then
# special case: verify only the proxy
# it is expected to point to a SuperToken logic contract which is already verified
try_verify SETHProxy@"${SUPER_TOKEN_NATIVE_COIN}"
try_verify SuperToken@"${SUPER_TOKEN_NATIVE_COIN}" --custom-proxy SETHProxy
fi

# optional peripery contracts

if [ -n "$TOGA" ];then
try_verify TOGA@"${TOGA}"
fi

if [ -n "$BATCH_LIQUIDATOR" ];then
try_verify BatchLiquidator@"${BATCH_LIQUIDATOR}"
fi

if [ -n "$FLOW_SCHEDULER" ];then
try_verify FlowScheduler@"${FLOW_SCHEDULER}"
fi

if [ -n "$VESTING_SCHEDULER" ];then
try_verify VestingScheduler@"${VESTING_SCHEDULER}"
fi

set +x
Expand Down
10 changes: 10 additions & 0 deletions packages/ethereum-contracts/test/ops-scripts/deployment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const deployFramework = require("../../ops-scripts/deploy-framework");
const deployTestToken = require("../../ops-scripts/deploy-test-token");
const deploySuperToken = require("../../ops-scripts/deploy-super-token");
const deployTestEnvironment = require("../../ops-scripts/deploy-test-environment");
const deployAuxContracts = require("../../ops-scripts/deploy-aux-contracts");
const {expect} = require("chai");
const Resolver = artifacts.require("Resolver");
const TestToken = artifacts.require("TestToken");
Expand Down Expand Up @@ -502,6 +503,15 @@ contract("Embedded deployment scripts", (accounts) => {
it("ops-scripts/deploy-test-environment.js", async () => {
await deployTestEnvironment(errorHandler, [], deploymentOptions);
});

it("ops-scripts/deploy-aux-contracts.js", async () => {
const resolver = await web3tx(Resolver.new, "Resolver.new")();
process.env.RESOLVER_ADDRESS = resolver.address;

await deployFramework(errorHandler, deploymentOptions);

await deployAuxContracts(errorHandler, deploymentOptions);
});
});

context("Used in non-native truffle environment (web3)", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/js-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"cloc": "sh tasks/cloc.sh"
},
"dependencies": {
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"@truffle/contract": "4.5.23",
"auto-bind": "^4.0.0",
"node-fetch": "^2.6.7"
Expand Down
6 changes: 5 additions & 1 deletion packages/metadata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## Unreleased

## [v1.1.9] - 2023-07-19

- Added `base-mainnet`

## [v1.1.8] - 2023-07-12

### Changed
- Updated Type info of ContractAddresses and NetworkMetaData
- Renamed `zkevm-testnet` => `polygon-zkevm-testnet`
- Renamed `zkevm-testnet` => `polygon-zkevm-testnet`
16 changes: 14 additions & 2 deletions packages/metadata/main/networks/list.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,20 @@ module.exports =
"uppercaseName": "BASE_MAINNET",
"humanReadableName": "Base",
"nativeTokenSymbol": "ETH",
"contractsV1": {},
"startBlockV1": 1,
"nativeTokenWrapper": "0x46fd5cfB4c12D87acD3a13e92BAa53240C661D93",
"contractsV1": {
"resolver": "0x6a214c324553F96F04eFBDd66908685525Da0E0d",
"host": "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74",
"governance": "0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D",
"cfaV1": "0x19ba78B9cDB05A877718841c574325fdB53601bb",
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
"idaV1": "0x66DF3f8e14CF870361378d8F61356D15d9F425C4",
"superTokenFactory": "0xe20B9a38E0c96F61d1bA6b42a61512D56Fea1Eb3",
"superfluidLoader": "0x6B24A6F34ab96267Fef9F8AC9fe6CC104C228127",
"toga": "0xA87F76e99f6C8Ff8996d14f550ceF47f193D9A09",
"batchLiquidator": "0x889ebeCaD5F8C34Fd96023456d0fC5cE54eb74Cb"
},
"startBlockV1": 1000000,
"logsQueryRange": 20000,
"explorer": "https://basescan.org",
"subgraphV1": {
Expand Down
16 changes: 14 additions & 2 deletions packages/metadata/module/networks/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,20 @@ export default
"uppercaseName": "BASE_MAINNET",
"humanReadableName": "Base",
"nativeTokenSymbol": "ETH",
"contractsV1": {},
"startBlockV1": 1,
"nativeTokenWrapper": "0x46fd5cfB4c12D87acD3a13e92BAa53240C661D93",
"contractsV1": {
"resolver": "0x6a214c324553F96F04eFBDd66908685525Da0E0d",
"host": "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74",
"governance": "0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D",
"cfaV1": "0x19ba78B9cDB05A877718841c574325fdB53601bb",
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
"idaV1": "0x66DF3f8e14CF870361378d8F61356D15d9F425C4",
"superTokenFactory": "0xe20B9a38E0c96F61d1bA6b42a61512D56Fea1Eb3",
"superfluidLoader": "0x6B24A6F34ab96267Fef9F8AC9fe6CC104C228127",
"toga": "0xA87F76e99f6C8Ff8996d14f550ceF47f193D9A09",
"batchLiquidator": "0x889ebeCaD5F8C34Fd96023456d0fC5cE54eb74Cb"
},
"startBlockV1": 1000000,
"logsQueryRange": 20000,
"explorer": "https://basescan.org",
"subgraphV1": {
Expand Down
16 changes: 14 additions & 2 deletions packages/metadata/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,20 @@
"uppercaseName": "BASE_MAINNET",
"humanReadableName": "Base",
"nativeTokenSymbol": "ETH",
"contractsV1": {},
"startBlockV1": 1,
"nativeTokenWrapper": "0x46fd5cfB4c12D87acD3a13e92BAa53240C661D93",
"contractsV1": {
"resolver": "0x6a214c324553F96F04eFBDd66908685525Da0E0d",
"host": "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74",
"governance": "0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D",
"cfaV1": "0x19ba78B9cDB05A877718841c574325fdB53601bb",
"cfaV1Forwarder": "0xcfA132E353cB4E398080B9700609bb008eceB125",
"idaV1": "0x66DF3f8e14CF870361378d8F61356D15d9F425C4",
"superTokenFactory": "0xe20B9a38E0c96F61d1bA6b42a61512D56Fea1Eb3",
"superfluidLoader": "0x6B24A6F34ab96267Fef9F8AC9fe6CC104C228127",
"toga": "0xA87F76e99f6C8Ff8996d14f550ceF47f193D9A09",
"batchLiquidator": "0x889ebeCaD5F8C34Fd96023456d0fC5cE54eb74Cb"
},
"startBlockV1": 1000000,
"logsQueryRange": 20000,
"explorer": "https://basescan.org",
"subgraphV1": {
Expand Down
4 changes: 3 additions & 1 deletion packages/metadata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@superfluid-finance/metadata",
"version": "1.1.8",
"version": "1.1.9",
"description": "Superfluid Metadata",
"main": "main/index.cjs",
"module": "module/index.js",
Expand All @@ -16,8 +16,10 @@
},
"scripts": {
"build": "./build.sh && echo '@superfluid-finance/metadata build successfully'",
"bump-version-to": "./bump-version-to.sh $@",
"pre-commit": "if [ ! -z \"$(git status -s .)\" ];then run-s pre-commit:*;else true;fi",
"pre-commit:lint": "yarn lint",
"pre-commit:check": "./compare-committed-against-build.sh",
"lint": "run-s lint:*",
"lint:js-eslint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'",
"fix": "run-s fix:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@superfluid-finance/ethereum-contracts": "1.7.1",
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"browserify": "^17.0.0",
"graphql-request": "^4.3.0",
"lodash": "^4.17.21",
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"mustache": "^4.2.0"
},
"devDependencies": {
"@superfluid-finance/metadata": "1.1.8",
"@superfluid-finance/metadata": "1.1.9",
"coingecko-api": "^1.0.10",
"graphql": "^16.6.0",
"graphql-request": "^5.0.0",
Expand Down

0 comments on commit bac5c12

Please sign in to comment.