Skip to content

Commit

Permalink
new deployment on testnets
Browse files Browse the repository at this point in the history
  • Loading branch information
d10r committed Oct 2, 2024
1 parent 83f12ea commit 8e36773
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MacroForwarder = artifacts.require("MacroForwarder");
* @param web3 The web3 instance to be used
* @param from address to use for funding the deployer account
*
* Usage: npx truffle exec ops-scripts/deploy-deterministically.js : {CONTRACT NAME} [{NONCE}]
* Usage: npx truffle exec ops-scripts/deploy-deterministically.js : {CONTRACT NAME}
* CONTRACT NAME must be one of SuperfluidLoader, AgreementForwarder
* If NONCE is not defined, 0 is assumed (-> first tx done from the deployer account)
*
Expand All @@ -32,6 +32,7 @@ const MacroForwarder = artifacts.require("MacroForwarder");
* GAS_PRICE: override the estimated gas price
* EST_TX_COST: override the estimated tx cost (amount to be sent to deployer)
* for networks with different cost derivation structure (Optimism)
* NONCE: if NONCE is not defined, 0 is assumed (-> first tx done from the deployer account)
*/
module.exports = eval(`(${S.toString()})()`)(async function (
args,
Expand All @@ -41,18 +42,12 @@ module.exports = eval(`(${S.toString()})()`)(async function (

console.log("======== Deploying deterministically ========");

let nonce = 0;
if (args.length === 2) {
nonce = parseInt(args.pop());
if (nonce < 0) {
console.error("nonce must be >= 0");
process.exit(1);
}
} else if (args.length !== 1) {
if (args.length !== 1) {
throw new Error("Wrong number of arguments");
}
const contractName = args.pop();

const nonce = parseInt(process.env.NONCE) || 0;
const privKey = process.env.DETERMINISTIC_DEPLOYER_PK;
const deployer = web3.eth.accounts.privateKeyToAccount(privKey);
console.log("deployer:", deployer.address);
Expand Down Expand Up @@ -100,10 +95,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (

const deployerTxCnt = await web3.eth.getTransactionCount(deployer.address);
if (nonce !== deployerTxCnt) {
console.error(
`### ERR: requested nonce is ${nonce}, but next usable nonce is ${deployerTxCnt}`
);
process.exit(1);
throw new Error(`### ERR: requested nonce is ${nonce}, but next usable nonce is ${deployerTxCnt}`);
}

const deployerBalance = await web3.eth.getBalance(deployer.address);
Expand Down
12 changes: 9 additions & 3 deletions packages/ethereum-contracts/tasks/deploy-macro-forwarder.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -eu
set -o pipefail

# Usage:
# tasks/deploy-macro-forwarder.sh <network>
Expand All @@ -23,7 +24,7 @@ source .env
set -x

network=$1
expectedContractAddr="0xfD01285b9435bc45C243E5e7F978E288B2912de6"
expectedContractAddr="0xFD0268E33111565dE546af2675351A4b1587F89F"
deployerPk=$MACROFWD_DEPLOYER_PK

tmpfile="/tmp/$(basename "$0").addr"
Expand All @@ -35,13 +36,18 @@ rm "$tmpfile"

echo "deployed to $contractAddr"
if [[ $contractAddr != "$expectedContractAddr" ]]; then
echo "oh no!"
exit
echo "contract address not as expected!"
if [ -z "$SKIP_ADDRESS_CHECK" ]; then
exit
fi
fi

# verify (give it a few seconds to pick up the code)
sleep 5
# allow to fail
set +e
npx truffle run --network "$network" verify MacroForwarder@"$contractAddr"
set -e

# set resolver
ALLOW_UPDATE=1 npx truffle exec --network "$network" ops-scripts/resolver-set-key-value.js : MacroForwarder "$contractAddr"
Expand Down
10 changes: 5 additions & 5 deletions packages/metadata/main/networks/list.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports =
"wrapStrategy": "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d"
},
"existentialNFTCloneFactory": "0xF76529ddEE7AA7890323eCa40C212758DD93B888",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3220000,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -71,7 +71,7 @@ module.exports =
"superfluidLoader": "0x862F59081FC7907F940bE4227b9f485d700E6cdD",
"batchLiquidator": "0x79aE8BF8EE9238d8E848F7dbBF74Ddb3365f6c11",
"existentialNFTCloneFactory": "0x0D1F0d4629B722b4dFabd195c14F12f2095418d9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3322400,
"logsQueryRange": 10000,
Expand Down Expand Up @@ -115,7 +115,7 @@ module.exports =
},
"superfluidLoader": "0x109412E3C84f0539b43d39dB691B08c90f58dC7c",
"batchLiquidator": "0x9539B21cC67844417E80aE168bc28c831E7Ed271",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 6886559,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -164,7 +164,7 @@ module.exports =
"superfluidLoader": "0xe25603df330027d91A0BAcc3e80a7f9e84930FC6",
"batchLiquidator": "0x70bbB7a057A13070dF11d533e8f299357D778637",
"superTokenFactory": "0x87560833d59Be057aFc63cFFa3fc531589Ba428F",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 2823800,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -198,7 +198,7 @@ module.exports =
"superTokenFactory": "0x7447E94Dfe3d804a9f46Bf12838d467c912C8F6C",
"superfluidLoader": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f",
"batchLiquidator": "0x95043eC349476B413eF5c369c4d2454a1a65eaB9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 10604500,
"logsQueryRange": 50000,
Expand Down
10 changes: 5 additions & 5 deletions packages/metadata/module/networks/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default
"wrapStrategy": "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d"
},
"existentialNFTCloneFactory": "0xF76529ddEE7AA7890323eCa40C212758DD93B888",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3220000,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -71,7 +71,7 @@ export default
"superfluidLoader": "0x862F59081FC7907F940bE4227b9f485d700E6cdD",
"batchLiquidator": "0x79aE8BF8EE9238d8E848F7dbBF74Ddb3365f6c11",
"existentialNFTCloneFactory": "0x0D1F0d4629B722b4dFabd195c14F12f2095418d9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3322400,
"logsQueryRange": 10000,
Expand Down Expand Up @@ -115,7 +115,7 @@ export default
},
"superfluidLoader": "0x109412E3C84f0539b43d39dB691B08c90f58dC7c",
"batchLiquidator": "0x9539B21cC67844417E80aE168bc28c831E7Ed271",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 6886559,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -164,7 +164,7 @@ export default
"superfluidLoader": "0xe25603df330027d91A0BAcc3e80a7f9e84930FC6",
"batchLiquidator": "0x70bbB7a057A13070dF11d533e8f299357D778637",
"superTokenFactory": "0x87560833d59Be057aFc63cFFa3fc531589Ba428F",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 2823800,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -198,7 +198,7 @@ export default
"superTokenFactory": "0x7447E94Dfe3d804a9f46Bf12838d467c912C8F6C",
"superfluidLoader": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f",
"batchLiquidator": "0x95043eC349476B413eF5c369c4d2454a1a65eaB9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 10604500,
"logsQueryRange": 50000,
Expand Down
10 changes: 5 additions & 5 deletions packages/metadata/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"wrapStrategy": "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d"
},
"existentialNFTCloneFactory": "0xF76529ddEE7AA7890323eCa40C212758DD93B888",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3220000,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -69,7 +69,7 @@
"superfluidLoader": "0x862F59081FC7907F940bE4227b9f485d700E6cdD",
"batchLiquidator": "0x79aE8BF8EE9238d8E848F7dbBF74Ddb3365f6c11",
"existentialNFTCloneFactory": "0x0D1F0d4629B722b4dFabd195c14F12f2095418d9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 3322400,
"logsQueryRange": 10000,
Expand Down Expand Up @@ -113,7 +113,7 @@
},
"superfluidLoader": "0x109412E3C84f0539b43d39dB691B08c90f58dC7c",
"batchLiquidator": "0x9539B21cC67844417E80aE168bc28c831E7Ed271",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 6886559,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -162,7 +162,7 @@
"superfluidLoader": "0xe25603df330027d91A0BAcc3e80a7f9e84930FC6",
"batchLiquidator": "0x70bbB7a057A13070dF11d533e8f299357D778637",
"superTokenFactory": "0x87560833d59Be057aFc63cFFa3fc531589Ba428F",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 2823800,
"logsQueryRange": 50000,
Expand Down Expand Up @@ -196,7 +196,7 @@
"superTokenFactory": "0x7447E94Dfe3d804a9f46Bf12838d467c912C8F6C",
"superfluidLoader": "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f",
"batchLiquidator": "0x95043eC349476B413eF5c369c4d2454a1a65eaB9",
"macroForwarder": "0xfD01285b9435bc45C243E5e7F978E288B2912de6"
"macroForwarder": "0xFD0268E33111565dE546af2675351A4b1587F89F"
},
"startBlockV1": 10604500,
"logsQueryRange": 50000,
Expand Down

0 comments on commit 8e36773

Please sign in to comment.