diff --git a/.DS_Store b/.DS_Store index aa9a9e66..a32cfd1c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/rewarderConfigs.json b/rewarderConfigs.json index cf8fc108..7d876c3e 100644 --- a/rewarderConfigs.json +++ b/rewarderConfigs.json @@ -1 +1 @@ -[{"LPToken":"0xa36df7c571beba7b3fb89f25dfc990eac75f525a","PoolId":33,"RewardTokenDecimals":18},{"LPToken":"0x53b65177803993C84F31AF4aE7E52FEB171b3b84","RewardToken":"0x221292443758F63563a1ed04b547278B05845FCb","CoingeckoRewarderTokenName":"ref-finance","Rewarder":"0xD61a0095E287b899D5A3ADf40e51d97237BBaB6B","PoolId":34,"RewardTokenDecimals":18},{"LPToken":"0x25bED9DDD30c21a698ba0654f8Da0F381CA1A67b","RewardToken":"0xc21Ff01229e982d7c8b8691163B0A3Cb8F357453","RewarderPriceLP":"0xa8CAaf35c0136033294dD286A14051fBf37aed07","Rewarder":"0xE3185567D1C5dcA2483485a1A5BC42fE0740acB3","PoolId":35,"RewardTokenDecimals":24},{"LPToken":"0x044b6b0cd3bb13d2b9057781df4459c66781dce7","RewardToken":"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f","CoingeckoRewarderTokenName":"aurigami","Rewarder":"0xF1469a96be8C82E5D5a9B0010eDeC77BdB319448","PoolId":36,"RewardTokenDecimals":18},{"LPToken":"0x2e5F03c34A771F50C97E8f77EF801C426636e5Cd","isStablePool":true,"RewardToken":"0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","CoingeckoRewarderTokenName":"aurigami","Rewarder":"0x606201CFd3c515F2Ce7F992Af9cdD2162c16bFda","PoolId":37,"RewardTokenDecimals":18},{"LPToken":"0x84b123875F0F36B966d0B6Ca14b31121bd9676AD","RewardToken":"0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","CoingeckoRewarderTokenName":"aurora-near","Rewarder":"0x7b0C1534ba1c2945fED6f906A538a63E5EE3418D","PoolId":38,"RewardTokenDecimals":18}] +[{"LPToken":"0xa36df7c571beba7b3fb89f25dfc990eac75f525a","PoolId":33,"RewardTokenDecimals":18},{"LPToken":"0x53b65177803993C84F31AF4aE7E52FEB171b3b84","RewardToken":"0x221292443758F63563a1ed04b547278B05845FCb","CoingeckoRewarderTokenName":"ref-finance","Rewarder":"0xD61a0095E287b899D5A3ADf40e51d97237BBaB6B","PoolId":34,"RewardTokenDecimals":18},{"LPToken":"0x25bED9DDD30c21a698ba0654f8Da0F381CA1A67b","RewardToken":"0xc21Ff01229e982d7c8b8691163B0A3Cb8F357453","RewarderPriceLP":"0xa8CAaf35c0136033294dD286A14051fBf37aed07","Rewarder":"0xE3185567D1C5dcA2483485a1A5BC42fE0740acB3","PoolId":35,"RewardTokenDecimals":24},{"LPToken":"0x044b6b0cd3bb13d2b9057781df4459c66781dce7","RewardToken":"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f","CoingeckoRewarderTokenName":"aurigami","Rewarder":"0xF1469a96be8C82E5D5a9B0010eDeC77BdB319448","PoolId":36,"RewardTokenDecimals":18},{"LPToken":"0x2e5F03c34A771F50C97E8f77EF801C426636e5Cd","isStablePool":true,"RewardToken":"0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","CoingeckoRewarderTokenName":"aurigami","Rewarder":"0x606201CFd3c515F2Ce7F992Af9cdD2162c16bFda","PoolId":37,"RewardTokenDecimals":18},{"LPToken":"0x84b123875F0F36B966d0B6Ca14b31121bd9676AD","RewardToken":"0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","CoingeckoRewarderTokenName":"aurora-near","Rewarder":"0x7b0C1534ba1c2945fED6f906A538a63E5EE3418D","PoolId":38,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0xe9117ba121bD14944f493C8A4878c97cf499B89e","PoolId":39,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0xAc53B5F702261F1237Eab5Ed0f2D2E6dD211a9ea","PoolId":39,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0xD6Bc4582DF541c51c73310663779151cAfb3FB5C","PoolId":39,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0x70678DeDe869c741AF0a8458adc013d8bFcB658a","PoolId":39,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0xd85E43AE58da621B310049D406f888D56054632C","PoolId":39,"RewardTokenDecimals":18},{"LPToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","RewardToken":"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB","CoingeckoRewarderTokenName":"ethereum","Rewarder":"0x3fe7E1c3a2d67307e0A1BdDF9Fc27B80900C2a47","PoolId":39,"RewardTokenDecimals":18}] diff --git a/scripts/ops/safeDeployRewarder.ts b/scripts/ops/safeDeployRewarder.ts index 87f0a23e..87b73ca9 100644 --- a/scripts/ops/safeDeployRewarder.ts +++ b/scripts/ops/safeDeployRewarder.ts @@ -157,9 +157,11 @@ const proposeAddPoolChefV2 = async ( console.info(JSON.stringify(chefAddArgs)); const nonce = await safeGetNextNonce(); - await chef + console.info("Next nonce is:", nonce); + const tx = await chef .connect(safeSigner) - .add(chefAddArgs[0], chefAddArgs[1]?.toString(), chefAddArgs[2]?.toString(), { nonce }); + .add(chefAddArgs[0], chefAddArgs[1]?.toString(), chefAddArgs[2]?.toString(), { nonce: 34 }); + console.log(tx); console.info("*** USER ACTION REQUIRED ***"); console.info("Go to the Gnosis Safe Web App to confirm the transaction"); diff --git a/scripts/utils/testNonce.ts b/scripts/utils/testNonce.ts new file mode 100644 index 00000000..ce4bcfa0 --- /dev/null +++ b/scripts/utils/testNonce.ts @@ -0,0 +1,56 @@ +import { fetchJson } from "ethers/lib/utils"; +import { auroraChainId, ops } from "../constants"; + +type TransactionResult = { + type?: "TRANSACTION"; + transaction?: { + executionInfo?: { + nonce: number; + }; + }; + conflictType: "None"; +}; + +type SafeClientApiResponse = { + results: [TransactionResult]; +}; + +const safeGetNextNonce = async (chainId: number = auroraChainId, safeAddress: string = ops): Promise => { + const safeClientApiRequestUrl = `https://safe-client.gnosis.io/v1/chains/${chainId}/safes/${safeAddress}/transactions/queued`; + const response: SafeClientApiResponse = await fetchJson(safeClientApiRequestUrl); + const { results } = response; + const queuedTxNonces = results.map(transactionResult => transactionResult?.transaction?.executionInfo?.nonce ?? 0); + + // Use history nonces since no queued txs + if (queuedTxNonces.length === 0) { + const safeClientApiRequestUrl = `https://safe-client.gnosis.io/v1/chains/${chainId}/safes/${safeAddress}/transactions/history`; + const response: SafeClientApiResponse = await fetchJson(safeClientApiRequestUrl); + const { results } = response; + const historyTxNonces = results.map(transactionResult => transactionResult?.transaction?.executionInfo?.nonce ?? 0); + + if (historyTxNonces.length === 0) { + // First transaction on fresh safe so nonce is zero + return 0; + } else { + const latestHistoryNonce = Math.max(...historyTxNonces); + + return latestHistoryNonce + 1; + } + } + + const latestQueuedNonce = Math.max(...queuedTxNonces); + + return latestQueuedNonce + 1; +}; + +async function main() { + const nonce = await safeGetNextNonce(); + console.log(nonce); +} + +main() + .then(() => process.exit(0)) + .catch((error: Error) => { + console.error(error); + process.exit(1); + });