Skip to content

Commit 56743df

Browse files
d10r0xdavinchee
andauthored
re-deploy avalanche-fuji and deploy eth-sepolia (#1365)
* deploy script adaptations * mumbai: same default gas settings as mainnet to prevent stuck or failing txs * more readable verification output, add verification of SuperToken logic (new deploy method) * remove CFA hook support from deployment script * new fuji deployment * updated metadata dependency * undo mumbai gas changes * add sepolia * bump metadata version * ops scripts bugfix & polish * updated metadata --------- Co-authored-by: 0xdavinchee <[email protected]>
1 parent 932e2e6 commit 56743df

14 files changed

+133
-79
lines changed

.github/workflows/handler.deploy-to-testnets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
network: [eth-goerli, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji]
37+
network: [eth-goerli, eth-sepolia, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji]
3838

3939
steps:
4040
- uses: actions/checkout@v3

.github/workflows/handler.verify-contracts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
network: [eth-goerli, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji, polygon-mainnet, optimism-mainnet, arbitrum-one, avalanche-c, bsc-mainnet, celo-mainnet]
27+
network: [eth-goerli, eth-sepolia, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji, polygon-mainnet, optimism-mainnet, arbitrum-one, avalanche-c, bsc-mainnet, celo-mainnet]
2828

2929
steps:
3030
- uses: actions/checkout@v3

packages/ethereum-contracts/hardhat.config.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(
3131
const chainIds = {
3232
"eth-mainnet": 1,
3333
"eth-goerli": 5,
34+
"eth-sepolia": 11155111,
3435

3536
"xdai-mainnet": 100,
3637

@@ -79,52 +80,56 @@ const config: HardhatUserConfig = {
7980
networks: {
8081
"bsc-mainnet": {
8182
...createNetworkConfig("bsc-mainnet"),
82-
url: process.env.BSC_PROVIDER_URL || "",
83+
url: process.env.BSC_MAINNET_PROVIDER_URL || "",
8384
},
8485
"eth-goerli": {
8586
...createNetworkConfig("eth-goerli"),
86-
url: process.env.GOERLI_PROVIDER_URL || "",
87+
url: process.env.ETH_GOERLI_PROVIDER_URL || "",
8788
},
8889
"xdai-mainnet": {
8990
...createNetworkConfig("xdai-mainnet"),
9091
url: process.env.XDAI_MAINNET_PROVIDER_URL || "",
9192
},
9293
"optimism-mainnet": {
9394
...createNetworkConfig("optimism-mainnet"),
94-
url: process.env.OPMAINNET_PROVIDER_URL || "",
95+
url: process.env.OPTIMISM_MAINNET_PROVIDER_URL || "",
9596
},
9697
"optimism-goerli": {
9798
...createNetworkConfig("optimism-goerli"),
98-
url: process.env.OPGOERLI_PROVIDER_URL || "",
99+
url: process.env.OPTIMISM_GOERLI_PROVIDER_URL || "",
99100
},
100101
"arbitrum-one": {
101102
...createNetworkConfig("arbitrum-one"),
102-
url: process.env.ARBONE_PROVIDER_URL || "",
103+
url: process.env.ARBITRUM_ONE_PROVIDER_URL || "",
103104
},
104105
"arbitrum-goerli": {
105106
...createNetworkConfig("arbitrum-goerli"),
106-
url: process.env.ARBGOERLI_PROVIDER_URL || "",
107+
url: process.env.ARBITRUM_GOERLI_PROVIDER_URL || "",
107108
},
108109
"polygon-mainnet": {
109110
...createNetworkConfig("polygon-mainnet"),
110-
url: process.env.MATIC_PROVIDER_URL || "",
111+
url: process.env.POLYGON_MAINNET_PROVIDER_URL || "",
111112
},
112113
"polygon-mumbai": {
113114
...createNetworkConfig("polygon-mumbai"),
114-
url: process.env.MUMBAI_PROVIDER_URL || "",
115+
url: process.env.POLYGON_MUMBAI_PROVIDER_URL || "",
115116
},
116117
"avalanche-c": {
117118
...createNetworkConfig("avalanche-c"),
118-
url: process.env.AVALANCHE_PROVIDER_URL || "",
119+
url: process.env.AVALANCHE_C_PROVIDER_URL || "",
119120
},
120121
"avalanche-fuji": {
121122
...createNetworkConfig("avalanche-fuji"),
122-
url: process.env.AVALANCHE_PROVIDER_URL || "",
123+
url: process.env.AVALANCHE_FUJI_PROVIDER_URL || "",
123124
},
124125
"celo-mainnet": {
125126
...createNetworkConfig("celo-mainnet"),
126127
url: process.env.CELO_MAINNET_PROVIDER_URL || "",
127128
},
129+
"eth-sepolia": {
130+
...createNetworkConfig("eth-sepolia"),
131+
url: process.env.ETH_SEPOLIA_PROVIDER_URL || "",
132+
},
128133
coverage: {
129134
url: "http://127.0.0.1:8555",
130135
},

packages/ethereum-contracts/ops-scripts/deploy-framework.js

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ async function deployContractIfCodeChanged(
9999
* (overriding env: RELEASE_VERSION)
100100
* @param {string} options.outputFile Name of file where to log addresses of newly deployed contracts
101101
* (overriding env: OUTPUT_FILE)
102-
* @param {Address} options.cfaHookContract Address of the contract to be set up as CFA hooks receiver
103-
* (overriding env: CFA_HOOK_CONTRACT)
104102
*
105103
* Usage: npx truffle exec ops-scripts/deploy-framework.js
106104
*/
@@ -117,7 +115,6 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
117115
appWhiteListing,
118116
protocolReleaseVersion,
119117
outputFile,
120-
cfaHookContract,
121118
} = options;
122119
resetSuperfluidFramework = options.resetSuperfluidFramework;
123120

@@ -126,10 +123,9 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
126123
console.log("reset superfluid framework: ", resetSuperfluidFramework);
127124

128125
outputFile = outputFile || process.env.OUTPUT_FILE;
129-
console.log("output file: ", outputFile);
130-
131-
cfaHookContract = cfaHookContract || process.env.CFA_HOOK_CONTRACT;
132-
console.log("CFA hook contract", cfaHookContract);
126+
if (outputFile !== undefined) {
127+
console.log("output file: ", outputFile);
128+
}
133129

134130
// string to build a list of newly deployed contracts, written to a file if "outputFile" option set
135131
let output = "";
@@ -363,15 +359,10 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
363359

364360
// list CFA v1
365361
const deployCFAv1 = async () => {
366-
// @note Once we have the actual implementation for the hook contract,
367-
// we will need to deploy it and put it here instead of ZERO_ADDRESS
368-
const hookContractAddress = cfaHookContract || ZERO_ADDRESS;
369-
console.log("CFA Hook Contract Address:", hookContractAddress);
370-
371362
const agreement = await web3tx(
372363
ConstantFlowAgreementV1.new,
373364
"ConstantFlowAgreementV1.new"
374-
)(superfluid.address, hookContractAddress);
365+
)(superfluid.address, ZERO_ADDRESS);
375366

376367
console.log("New ConstantFlowAgreementV1 address", agreement.address);
377368
output += `CFA_LOGIC=${agreement.address}\n`;
@@ -532,6 +523,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
532523
[
533524
// See SuperToken constructor parameter
534525
superfluid.address.toLowerCase().slice(2).padStart(64, "0"),
526+
ZERO_ADDRESS.toLowerCase().slice(2).padStart(64, "0"),
535527
]
536528
);
537529
if (cfaNewLogicAddress !== ZERO_ADDRESS)
@@ -691,27 +683,30 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
691683
UUPSProxy.new,
692684
`Create ConstantOutflowNFT proxy`
693685
)();
694-
output += `CONSTANT_OUTFLOW_NFT_ADDRESS=${constantOutflowNFTProxy.address}\n`;
686+
console.log("ConstantOutflowNFT Proxy address", constantOutflowNFTProxy.address);
687+
output += `CONSTANT_OUTFLOW_NFT_PROXY=${constantOutflowNFTProxy.address}\n`;
688+
695689
const constantInflowNFTProxy = await web3tx(
696690
UUPSProxy.new,
697-
`Create ConstantOutflowNFT proxy`
691+
`Create ConstantInflowNFT proxy`
698692
)();
699-
output += `CONSTANT_INFLOW_NFT_ADDRESS=${constantInflowNFTProxy.address}\n`;
693+
console.log("ConstantInflowNFT Proxy address", constantInflowNFTProxy.address);
694+
output += `CONSTANT_INFLOW_NFT_PROXY=${constantInflowNFTProxy.address}\n`;
700695

701696
const constantOutflowNFTLogic = await web3tx(
702697
ConstantOutflowNFT.new,
703698
`ConstantOutflowNFT.new`
704699
)(superfluid.address, constantInflowNFTProxy.address);
705-
output += `CONSTANT_OUTFLOW_NFT_LOGIC_ADDRESS=${constantOutflowNFTLogic.address}\n`;
706-
700+
console.log("ConstantOutflowNFT Logic address", constantOutflowNFTLogic.address);
701+
output += `CONSTANT_OUTFLOW_NFT_LOGIC=${constantOutflowNFTLogic.address}\n`;
707702
await constantOutflowNFTLogic.castrate();
708703

709704
const constantInflowNFTLogic = await web3tx(
710-
ConstantOutflowNFT.new,
711-
`ConstantOutflowNFT.new`
705+
ConstantInflowNFT.new,
706+
`ConstantInflowNFT.new`
712707
)(superfluid.address, constantOutflowNFTProxy.address);
713-
output += `CONSTANT_INFLOW_NFT_LOGIC_ADDRESS=${constantInflowNFTLogic.address}\n`;
714-
708+
console.log("ConstantInflowNFT Logic address", constantInflowNFTLogic.address);
709+
output += `CONSTANT_INFLOW_NFT_LOGIC=${constantInflowNFTLogic.address}\n`;
715710
await constantInflowNFTLogic.castrate();
716711

717712
// set the nft logic addresses (to be consumed by the super token factory logic constructor)
@@ -745,7 +740,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
745740
// set the nft proxy addresses (to be consumed by the super token logic constructor)
746741
cofNFTProxyAddress = constantOutflowNFTProxy.address;
747742
cifNFTProxyAddress = constantInflowNFTProxy.address;
748-
} else {
743+
} else { // nft proxies already exist
749744
const newCOFNFTLogic = await deployContractIfCodeChanged(
750745
web3,
751746
ConstantOutflowNFT,
@@ -757,7 +752,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
757752
ConstantOutflowNFT.new,
758753
"ConstantOutflowNFT.new"
759754
)(superfluid.address, cifNFTProxyAddress);
760-
output += `CONSTANT_OUTFLOW_NFT_LOGIC_ADDRESS=${cofNFTLogic.address}\n`;
755+
output += `CONSTANT_OUTFLOW_NFT_LOGIC=${cofNFTLogic.address}\n`;
761756
// castrate flow nft logic contract
762757
await cofNFTLogic.castrate();
763758
return cofNFTLogic;
@@ -779,7 +774,7 @@ module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
779774
ConstantInflowNFT.new,
780775
"ConstantInflowNFT.new"
781776
)(superfluid.address, cofNFTProxyAddress);
782-
output += `CONSTANT_INFLOW_NFT_LOGIC_ADDRESS=${cifNFTLogic.address}\n`;
777+
output += `CONSTANT_INFLOW_NFT_LOGIC=${cifNFTLogic.address}\n`;
783778
// castrate flow nft logic contract
784779
await cifNFTLogic.castrate();
785780
return cifNFTLogic;

packages/ethereum-contracts/ops-scripts/deploy-test-environment.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ async function takeEvmSnapshot() {
3131
* Usage: npx truffle exec ops-scripts/deploy-test-environment.js : {TOKENS_TO_DEPLOY}
3232
* where TOKENS_TO_DEPLOY is an optional list of token symbols, e.g. TEST1,TEST2.
3333
* For each such token, an underlying ERC20 and a wrapping Super Token will be deployed.
34+
*
35+
* WARNING:
36+
* This script as is can easily overload the connected RPC.
37+
* That is because every invocation of deploy-test-token or deploy-super-token
38+
* creates an instance of SuperfluidSDK.Framework, where each instance seems to
39+
* cause a lot of RPC polling. Those instances seem to not be release until the end of this script.
3440
*/
3541
module.exports = eval(`(${S.toString()})()`)(async function (
3642
args,
@@ -62,7 +68,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
6268
console.log("==== Superfluid framework deployed ========");
6369

6470
for (let i = 0; i < tokens.length; ++i) {
65-
if (tokens[i] !== deploySuperToken) {
71+
if (tokens[i] !== deploySuperToken) { // ???
6672
console.log(`======== Deploying test token ${tokens[i]} ========`);
6773
await deployTestToken(errorHandler, [":", tokens[i]], options);
6874
console.log(`======== Test token ${tokens[i]} deployed ========`);

packages/ethereum-contracts/ops-scripts/info-print-contract-addresses.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const {
1414
* @param {boolean} options.isTruffle Whether the script is used within native truffle framework
1515
* @param {Web3} options.web3 Injected web3 instance
1616
* @param {Address} options.from Address to deploy contracts from
17+
* @param {boolean} options.skipTokens Don't iterate through tokens
18+
* (overriding env: SKIP_TOKENS)
1719
*
1820
* Usage: npx truffle exec ops-scripts/info-print-contract-addresses : {OUTPUT_FILE}
1921
*/
@@ -23,7 +25,11 @@ module.exports = eval(`(${S.toString()})()`)(async function (
2325
) {
2426
let output = "";
2527

26-
let {protocolReleaseVersion} = options;
28+
let {
29+
protocolReleaseVersion,
30+
skipTokens
31+
} = options;
32+
skipTokens = skipTokens || process.env.SKIP_TOKENS;
2733

2834
if (args.length !== 1) {
2935
throw new Error("Wrong number of arguments");
@@ -41,8 +47,8 @@ module.exports = eval(`(${S.toString()})()`)(async function (
4147
const sf = new SuperfluidSDK.Framework({
4248
...extractWeb3Options(options),
4349
version: protocolReleaseVersion,
44-
tokens: config.tokenList,
45-
loadSuperNativeToken: true,
50+
tokens: skipTokens ? [] : config.tokenList,
51+
loadSuperNativeToken: !skipTokens, // defaults to true
4652
additionalContracts: ["UUPSProxiable"],
4753
});
4854
await sf.initialize();
@@ -89,39 +95,41 @@ module.exports = eval(`(${S.toString()})()`)(async function (
8995

9096
const constantOutflowNFTProxyAddress =
9197
await superTokenLogicContract.CONSTANT_OUTFLOW_NFT();
92-
output += `CONSTANT_OUTFLOW_NFT_ADDRESS=${constantOutflowNFTProxyAddress}\n`;
98+
output += `CONSTANT_OUTFLOW_NFT_PROXY=${constantOutflowNFTProxyAddress}\n`;
9399

94100
const constantOutflowNFTLogicAddress = await (
95101
await UUPSProxiable.at(constantOutflowNFTProxyAddress)
96102
).getCodeAddress();
97-
output += `CONSTANT_OUTFLOW_NFT_LOGIC_ADDRESS=${constantOutflowNFTLogicAddress}\n`;
103+
output += `CONSTANT_OUTFLOW_NFT_LOGIC=${constantOutflowNFTLogicAddress}\n`;
98104

99105
const constantInflowNFTProxyAddress =
100106
await superTokenLogicContract.CONSTANT_INFLOW_NFT();
101-
output += `CONSTANT_INFLOW_NFT_ADDRESS=${constantInflowNFTProxyAddress}\n`;
107+
output += `CONSTANT_INFLOW_NFT_PROXY=${constantInflowNFTProxyAddress}\n`;
102108

103109
const constantInflowNFTLogicAddress = await (
104110
await UUPSProxiable.at(constantInflowNFTProxyAddress)
105111
).getCodeAddress();
106-
output += `CONSTANT_INFLOW_NFT_LOGIC_ADDRESS=${constantInflowNFTLogicAddress}\n`;
112+
output += `CONSTANT_INFLOW_NFT_LOGIC=${constantInflowNFTLogicAddress}\n`;
107113

108-
await Promise.all(
109-
config.tokenList.map(async (tokenName) => {
110-
output += `SUPER_TOKEN_${tokenName.toUpperCase()}=${
111-
sf.tokens[tokenName].address
112-
}\n`;
113-
const underlyingTokenSymbol = await sf.tokens[
114-
tokenName
115-
].underlyingToken.symbol.call();
116-
output += `NON_SUPER_TOKEN_${underlyingTokenSymbol.toUpperCase()}=${
117-
sf.tokens[tokenName].underlyingToken.address
114+
if (! skipTokens) {
115+
await Promise.all(
116+
config.tokenList.map(async (tokenName) => {
117+
output += `SUPER_TOKEN_${tokenName.toUpperCase()}=${
118+
sf.tokens[tokenName].address
119+
}\n`;
120+
const underlyingTokenSymbol = await sf.tokens[
121+
tokenName
122+
].underlyingToken.symbol.call();
123+
output += `NON_SUPER_TOKEN_${underlyingTokenSymbol.toUpperCase()}=${
124+
sf.tokens[tokenName].underlyingToken.address
125+
}\n`;
126+
})
127+
);
128+
if (sf.config.nativeTokenSymbol) {
129+
output += `SUPER_TOKEN_NATIVE_COIN=${
130+
sf.tokens[sf.config.nativeTokenSymbol + "x"].address
118131
}\n`;
119-
})
120-
);
121-
if (sf.config.nativeTokenSymbol) {
122-
output += `SUPER_TOKEN_NATIVE_COIN=${
123-
sf.tokens[sf.config.nativeTokenSymbol + "x"].address
124-
}\n`;
132+
}
125133
}
126134

127135
await util.promisify(fs.writeFile)(outputFilename, output);

packages/ethereum-contracts/ops-scripts/libs/getConfig.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ module.exports = function getConfig(chainId) {
4949
patricianPeriod: 3600 * 0.2,
5050
biconomyForwarder: "0x3075b4dc7085C48A14A5A39BBa68F58B19545971",
5151
},
52+
11155111: {
53+
// sepolia
54+
liquidationPeriod: 3600,
55+
patricianPeriod: 3600 * 0.2,
56+
},
5257
4: {
5358
// rinkeby
5459
liquidationPeriod: 3600,
@@ -221,7 +226,7 @@ module.exports = function getConfig(chainId) {
221226
43113: {
222227
// avalanche fuji testnet
223228
data: {
224-
initialBlockNumber: 3220000,
229+
initialBlockNumber: 21012000,
225230
getLogsRange: 50000,
226231
},
227232
},

0 commit comments

Comments
 (0)