Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DelegatedManager MigrationUtils and sample BED Migration [SIM-216] #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions ethereum/deploy/003_bed_manager_migrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import "module-alias/register";

import { HardhatRuntimeEnvironment as HRE } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";

import {
findDependency,
getCurrentStage,
stageAlreadyFinished,
trackFinishedStage,
} from "@utils/index";

import { DEPENDENCY } from "../deployments/utils/dependencies";
import {ManagerMigrator} from "@utils/managerMigrationUtils";

const {
BED,
BED_OPERATOR_V1,
BED_METHODOLOGIST,
BED_FEE_EXTENSION_V1
} = DEPENDENCY;

const CURRENT_STAGE = getCurrentStage(__filename);

const func: DeployFunction = trackFinishedStage(CURRENT_STAGE, async function (hre: HRE) {
const migrator = new ManagerMigrator(hre.ethers.provider);
await migrator.initialize(hre);

const bed = await findDependency(BED);
const bedOperator = await findDependency(BED_OPERATOR_V1);
const bedMethodologist = await findDependency(BED_METHODOLOGIST);
const bedFeeExtension = await findDependency(BED_FEE_EXTENSION_V1);

await migrator.impersonateMultisigs([bedOperator, bedMethodologist]);

// Transfer SetToken managership to a multisig. Before this step, methodologist can be added
// to the operator multisig or a dedicated multisig could be created to manage the transition.
// Methodologist would sign both sides of this setManager() mutual upgrade tx and be a
// co-signer for all other txs.

// Assume for the moment operator will be the transitionalManager and also have the
// DelegatedManager operator role.
const transitionalManager = bedOperator;
const delegatedOperators = [bedOperator];

await migrator.transferSetToTransitionalManager(
transitionalManager,
bed
);

await migrator.createDelegatedManager(
transitionalManager,
bed,
bedOperator,
bedMethodologist,
delegatedOperators
);

// Cache DelegatedManager address (we need this for the final transfer)
const delegatedManager = await migrator.getDelegatedManagerAddress(bed);

// Initializes DelegatedManager and inherits existing FeeSplitExtension settings for
// `operatorFeeSplit` and `operatorFeeRecipient`. In practice, executors will need to fetch
// the new delegated manager address by querying the factory before running factory.initialize()
await migrator.initializeManager(
transitionalManager,
bedFeeExtension,
bed
);

await migrator.transferSetToDelegatedManager(
transitionalManager,
delegatedManager,
bed
);
});

func.skip = stageAlreadyFinished(CURRENT_STAGE);

export default func;
80 changes: 79 additions & 1 deletion ethereum/deployments/outputs/1-production.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"network_key": "1-production",
"human_friendly_name": "main-net-production",
"network_id": 1,
"last_deployment_stage": 3
"last_deployment_stage": 4
},
"addresses": {
"ManagerCore": "0x7a397B3ed39E84C6181e47309CE940574290f4e7",
Expand Down Expand Up @@ -85,6 +85,84 @@
"id": "0xd293f491d8dc0fcacfce7cc9ae8a64099f092ad623fd18e28f79633f66f67157",
"timestamp": 1648697282613,
"description": "Transfer ManagerCore ownership to Multisig"
},
"7": {
"id": null,
"timestamp": null,
"data": "0xd0ebdbe7000000000000000000000000186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"description": "BED.BaseManager.setManager(): set 0x186b0a2b5028916fa237bb5b11a9841dbd8567b5 as temporary SetToken manager",
"contractName": "BaseManager",
"to": "0x5E6898eE65EDd36F76571DB4171B4ebdEab5262C",
"from": "0x186b0A2B5028916Fa237bb5B11A9841Dbd8567B5",
"params": {
"newManager": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5"
}
},
"8": {
"id": null,
"timestamp": null,
"data": "0x983ac4490000000000000000000000002af1df3ab0ab157e1e2ad8f88a7d04fbea0c7dc6000000000000000000000000186b0a2b5028916fa237bb5b11a9841dbd8567b5000000000000000000000000f26d1bb347a59f6c283c53156519cc1b1abaca5100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000186b0a2b5028916fa237bb5b11a9841dbd8567b500000000000000000000000000000000000000000000000000000000000000030000000000000000000000001494ca1f11d487c2bbe4543e90080aeba4ba3c2b0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000300000000000000000000000005c5c57e5e75fc8ead83fe06ebe4acc471fb294800000000000000000000000000dd1d0a8acf768700c009cb5e54bbb5b69200710000000000000000000000001f52ba34eb80cbd48b9f3dad43ffb4cb6d0fccf5",
"description": "BED.DelegatedManagerFactory.createManager(): create new DelegatedManager",
"contractName": "DELEGATED_MANAGER_FACTORY",
"to": "0x5132044c71b98315bDD5D8E6900bcf93EB2EbeC0",
"from": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"params": {
"setToken": "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6",
"owner": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"methodologist": "0xf26d1bb347a59f6c283c53156519cc1b1abaca51",
"operators": [
"0x186b0a2b5028916fa237bb5b11a9841dbd8567b5"
],
"assets": [
"0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b",
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
],
"extensions": [
"0x05C5c57E5E75FC8EaD83FE06ebe4aCc471Fb2948",
"0x00DD1D0A8acF768700c009CB5E54BBb5b6920071",
"0x1F52bA34eb80cBD48b9f3Dad43FFB4Cb6D0FCCF5"
]
}
},
"9": {
"id": null,
"timestamp": null,
"data": "0xad8238220000000000000000000000002af1df3ab0ab157e1e2ad8f88a7d04fbea0c7dc600000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000069bdb276a17dd90f9d3a545944ccb20e593ae8e300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000300000000000000000000000005c5c57e5e75fc8ead83fe06ebe4acc471fb294800000000000000000000000000dd1d0a8acf768700c009cb5e54bbb5b69200710000000000000000000000001f52ba34eb80cbd48b9f3dad43ffb4cb6d0fccf50000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000000000000000000000",
"description": "BED.DelegatedManagerFactory.initialize(): initialize new DelegatedManager",
"contractName": "DELEGATED_MANAGER_FACTORY",
"to": "0x5132044c71b98315bDD5D8E6900bcf93EB2EbeC0",
"from": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"params": {
"setToken": "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6",
"ownerFeeSplit": {
"type": "BigNumber",
"hex": "0x06f05b59d3b20000"
},
"ownerFeeRecipient": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"extensions": [
"0x05C5c57E5E75FC8EaD83FE06ebe4aCc471Fb2948",
"0x00DD1D0A8acF768700c009CB5E54BBb5b6920071",
"0x1F52bA34eb80cBD48b9f3Dad43FFB4Cb6D0FCCF5"
],
"initializeBytecode": [
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
]
}
},
"10": {
"id": null,
"timestamp": null,
"data": "0xd0ebdbe7000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"description": "BED.SetToken.setManager(): set 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as final SetToken manager",
"contractName": "BaseManager",
"to": "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6",
"from": "0x186b0a2b5028916fa237bb5b11a9841dbd8567b5",
"params": {
"newManager": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
}
}
80 changes: 79 additions & 1 deletion ethereum/deployments/outputs/1-staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"network_key": "1-staging",
"human_friendly_name": "main-net-staging",
"network_id": 1,
"last_deployment_stage": 3
"last_deployment_stage": 4
},
"addresses": {
"ExchangeIssuanceZeroEx": "0x939eD0665f6CC78882C0ef451d2636110FEA87fe",
Expand Down Expand Up @@ -95,6 +95,84 @@
"id": "0xf1dc847c5ca60e8dbc170ca8672ffb5d30cbd4d42c37a573c7cae9a1e3fe1fcb",
"timestamp": 1648694500282,
"description": "Initialized ManagerCore with DelegatedManagerFactory, IssuanceExtension, StreamingFeeSplitExtension, and TradeExtension"
},
"7": {
"id": null,
"timestamp": null,
"data": "0xd0ebdbe700000000000000000000000068170278804fc18481aecfb497d63a9b11dc692f",
"description": "BED.BaseManager.setManager(): set 0x68170278804fc18481aecfb497d63a9b11dc692f as temporary SetToken manager",
"contractName": "BaseManager",
"to": "0xe337794481879179838413b581FFaBA8356A9C8B",
"from": "0x68170278804Fc18481aECfB497D63A9b11DC692F",
"params": {
"newManager": "0x68170278804fc18481aecfb497d63a9b11dc692f"
}
},
"8": {
"id": null,
"timestamp": null,
"data": "0x983ac44900000000000000000000000068ad048fa2e1bcafa690ce257b69a13f5a79a51400000000000000000000000068170278804fc18481aecfb497d63a9b11dc692f00000000000000000000000069bdb276a17dd90f9d3a545944ccb20e593ae8e300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000100000000000000000000000068170278804fc18481aecfb497d63a9b11dc692f00000000000000000000000000000000000000000000000000000000000000030000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000001494ca1f11d487c2bbe4543e90080aeba4ba3c2b0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000fc4e27bdb739a6e2aada6c8764860bec6f4288ee000000000000000000000000ea2f360529dfb5a3423ec84d44482673c28960e5000000000000000000000000946735c0b0c47dd74a38eae96e75e0eff5bfb93e",
"description": "BED.DelegatedManagerFactory.createManager(): create new DelegatedManager",
"contractName": "DELEGATED_MANAGER_FACTORY",
"to": "0x55cC794247Ec45db9A1D5B0F26055B7B729F19D2",
"from": "0x68170278804fc18481aecfb497d63a9b11dc692f",
"params": {
"setToken": "0x68aD048fA2e1bcaFa690Ce257b69A13f5A79a514",
"owner": "0x68170278804fc18481aecfb497d63a9b11dc692f",
"methodologist": "0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3",
"operators": [
"0x68170278804fc18481aecfb497d63a9b11dc692f"
],
"assets": [
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b"
],
"extensions": [
"0xFc4E27bDb739A6e2AAdA6c8764860bec6F4288Ee",
"0xEa2F360529dFB5A3423ec84D44482673C28960e5",
"0x946735c0B0C47dd74a38eAe96E75E0eFF5BFB93E"
]
}
},
"9": {
"id": null,
"timestamp": null,
"data": "0xad82382200000000000000000000000068ad048fa2e1bcafa690ce257b69a13f5a79a51400000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000069bdb276a17dd90f9d3a545944ccb20e593ae8e300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000fc4e27bdb739a6e2aada6c8764860bec6f4288ee000000000000000000000000ea2f360529dfb5a3423ec84d44482673c28960e5000000000000000000000000946735c0b0c47dd74a38eae96e75e0eff5bfb93e0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024de2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000000000000000000000",
"description": "BED.DelegatedManagerFactory.initialize(): initialize new DelegatedManager",
"contractName": "DELEGATED_MANAGER_FACTORY",
"to": "0x55cC794247Ec45db9A1D5B0F26055B7B729F19D2",
"from": "0x68170278804fc18481aecfb497d63a9b11dc692f",
"params": {
"setToken": "0x68aD048fA2e1bcaFa690Ce257b69A13f5A79a514",
"ownerFeeSplit": {
"type": "BigNumber",
"hex": "0x06f05b59d3b20000"
},
"ownerFeeRecipient": "0x68170278804fc18481aecfb497d63a9b11dc692f",
"extensions": [
"0xFc4E27bDb739A6e2AAdA6c8764860bec6F4288Ee",
"0xEa2F360529dFB5A3423ec84D44482673C28960e5",
"0x946735c0B0C47dd74a38eAe96E75E0eFF5BFB93E"
],
"initializeBytecode": [
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"0xde2236bd000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
]
}
},
"10": {
"id": null,
"timestamp": null,
"data": "0xd0ebdbe7000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"description": "BED.SetToken.setManager(): set 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as final SetToken manager",
"contractName": "BaseManager",
"to": "0x68aD048fA2e1bcaFa690Ce257b69A13f5A79a514",
"from": "0x68170278804fc18481aecfb497d63a9b11dc692f",
"params": {
"newManager": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
}
}
Loading