Skip to content

Commit

Permalink
Add deployment file to update strategist address (#2341)
Browse files Browse the repository at this point in the history
* Add deployment file to update strategist address

* Update fixtures

* Update file

* Better error handling

* Update migrations.json

* Update brownie scripts

* Fix migrations.json

* Fix one AMO test
  • Loading branch information
shahthepro authored Jan 10, 2025
1 parent 79f2ae3 commit 39d5825
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 8 deletions.
2 changes: 2 additions & 0 deletions brownie/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
OETHB_DRIPPER = '0x02f2C609950E90934ce99e58b4d7326aD0d7f8d6'
OETHB_HARVESTER = '0x247872f58f2fF11f9E8f89C1C48e460CfF0c6b29'

OETHB_MULTICHAIN_STRATEGIST = '0x4FF1b9D9ba8558F5EAfCec096318eA0d8b541971'

# Base contracts
WETH_BASE = '0x4200000000000000000000000000000000000006'
BRIDGED_WOETH_BASE = '0xD8724322f44E5c58D7A815F542036fb17DbbF839'
Expand Down
6 changes: 4 additions & 2 deletions brownie/world_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
woeth = load_contract('ERC20', BRIDGED_WOETH_BASE)
veaero = load_contract('veaero', VEAERO_BASE)

base_strategist = brownie.accounts.at(OETHB_STRATEGIST, force=True)
from_strategist = {'from':OETHB_STRATEGIST}
base_old_strategist = brownie.accounts.at(OETHB_STRATEGIST, force=True)
base_strategist = brownie.accounts.at(OETHB_MULTICHAIN_STRATEGIST, force=True)
from_old_strategist = {'from':OETHB_STRATEGIST}
from_strategist = {'from':OETHB_MULTICHAIN_STRATEGIST}

aero_router = load_contract('aerodrome_swap_router', AERODROME_SWAP_ROUTER_BASE)
aero_router2 = load_contract('aerodrome_v2_router', AERODROME_ROUTER2_BASE)
Expand Down
50 changes: 50 additions & 0 deletions contracts/deploy/base/021_multichain_strategist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const { deployOnBaseWithGuardian } = require("../../utils/deploy-l2");
const addresses = require("../../utils/addresses");

const EXECUTOR_ROLE =
"0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63";

module.exports = deployOnBaseWithGuardian(
{
deployName: "021_multichain_strategist",
// useTimelock: false,
},
async ({ ethers }) => {
const cOETHbVaultProxy = await ethers.getContract("OETHBaseVaultProxy");
const cOETHbVault = await ethers.getContractAt(
"IVault",
cOETHbVaultProxy.address
);

const cTimelock = await ethers.getContractAt(
"ITimelockController",
addresses.base.timelock
);

return {
name: "Switch to Multichain Strategist",
actions: [
{
contract: cOETHbVault,
signature: "setStrategistAddr(address)",
args: [addresses.base.multichainStrategist],
},
{
contract: cOETHbVault,
signature: "setTrusteeAddress(address)",
args: [addresses.base.multichainStrategist],
},
{
contract: cTimelock,
signature: "grantRole(bytes32,address)",
args: [EXECUTOR_ROLE, addresses.base.multichainStrategist],
},
{
contract: cTimelock,
signature: "revokeRole(bytes32,address)",
args: [EXECUTOR_ROLE, addresses.base.strategist],
},
],
};
}
);
3 changes: 2 additions & 1 deletion contracts/deployments/base/.migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"017_upgrade_amo": 1728599745,
"018_strategist_as_executor": 1729078818,
"019_async_withdrawals": 1730100488,
"020_upgrade_amo": 1730157451
"020_upgrade_amo": 1730157451,
"021_multichain_strategist": 1736267102
}
5 changes: 5 additions & 0 deletions contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const SONIC_DEPLOYER = MAINNET_DEPLOYER;
const SONIC_GOVERNOR = MAINNET_DEPLOYER;
const SONIC_STRATEGIST = MAINNET_DEPLOYER;

const MULTICHAIN_STRATEGIST = "0x4FF1b9D9ba8558F5EAfCec096318eA0d8b541971";

const mnemonic =
"replace hover unaware super where filter stone fine garlic address matrix basic";

Expand Down Expand Up @@ -364,6 +366,9 @@ module.exports = {
base: BASE_STRATEGIST,
sonic: SONIC_STRATEGIST,
},
multichainStrategistAddr: {
default: MULTICHAIN_STRATEGIST,
},
},
contractSizer: {
alphaSort: true,
Expand Down
6 changes: 3 additions & 3 deletions contracts/test/_fixture-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const defaultBaseFixture = deployments.createFixture(async () => {
const signers = await hre.ethers.getSigners();

const [minter, burner, rafael, nick, clement] = signers.slice(4); // Skip first 4 addresses to avoid conflict
const { governorAddr, strategistAddr, timelockAddr } =
const { governorAddr, multichainStrategistAddr, timelockAddr } =
await getNamedAccounts();
const governor = await ethers.getSigner(isFork ? timelockAddr : governorAddr);
await hhHelpers.setBalance(governorAddr, oethUnits("1")); // Fund governor with some ETH
Expand All @@ -151,8 +151,8 @@ const defaultBaseFixture = deployments.createFixture(async () => {
let strategist;
if (isFork) {
// Impersonate strategist on Fork
strategist = await impersonateAndFund(strategistAddr);
strategist.address = strategistAddr;
strategist = await impersonateAndFund(multichainStrategistAddr);
strategist.address = multichainStrategistAddr;

await impersonateAndFund(governor.address);
await impersonateAndFund(timelock.address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () {
it("Should have the correct initial state", async function () {
// correct pool weth share interval
expect(await aerodromeAmoStrategy.allowedWethShareStart()).to.equal(
oethUnits("0.10")
oethUnits("0.05")
);

expect(await aerodromeAmoStrategy.allowedWethShareEnd()).to.equal(
oethUnits("0.20")
oethUnits("0.15")
);

// correct harvester set
Expand Down
2 changes: 2 additions & 0 deletions contracts/utils/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ addresses.base.governor = "0x92A19381444A001d62cE67BaFF066fA1111d7202";
// 2/8 Multisig
addresses.base.strategist = "0x28bce2eE5775B652D92bB7c2891A89F036619703";
addresses.base.timelock = "0xf817cb3092179083c48c014688D98B72fB61464f";
addresses.base.multichainStrategist =
"0x4FF1b9D9ba8558F5EAfCec096318eA0d8b541971";

// Chainlink: https://data.chain.link/feeds/base/base/woeth-oeth-exchange-rate
addresses.base.BridgedWOETHOracleFeed =
Expand Down
4 changes: 4 additions & 0 deletions contracts/utils/deploy-l2.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ function deployOnBaseWithGuardian(opts, fn) {

const proposal = await fn(tools);

if (!proposal?.actions?.length) {
return;
}

if (useTimelock != false) {
// Using `!= false` because we want to treat `== undefined` as true by default as well
const propDescription = proposal.name || deployName;
Expand Down
2 changes: 2 additions & 0 deletions contracts/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,8 @@ async function handleTransitionGovernance(propDesc, propArgs) {

const opHash = await timelock.hashOperationBatch(...args);

console.log("Proposal Hash", opHash);

if (await timelock.isOperationDone(opHash)) {
// Already executed
return;
Expand Down

0 comments on commit 39d5825

Please sign in to comment.