Skip to content

Commit

Permalink
token owner to Executor (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlcibiadesCleinias authored Jan 29, 2024
1 parent 1802798 commit 77c2de0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
4 changes: 3 additions & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ sequenceDiagram
deployer ->> Executor: grantRole(CANCELLER_ROLE, FluenceMultisig)
deployer ->> Executor: revokeRole(ADMIN_ROLE, deployer)
deployer ->>+ FluenceToken: transfer (balance) to Governor
FluenceToken ->>- Governor: transfer (balance)
FluenceToken ->>- Executor: transfer (balance)
FluenceToken ->> Executor: transferOwnership(Executor)
Note over Governor: Owner: Executor
Note over FluenceToken: Owner: Executor
Note over Executor: Admin Role: [0x0]
Note over Executor: Proposer Role: [Governor]
Note over Executor: Canceller Role: [Governor, FluenceMultisig]
Expand Down
30 changes: 21 additions & 9 deletions contracts/deploy/0007_Governor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const CANCELLER_ROLE = ethers.utils.keccak256(
ethers.utils.toUtf8Bytes("CANCELLER_ROLE")
);
const DEFAULT_ADMIN_ROLE = ethers.utils.hexZeroPad([0], 32);
const DEFAULT_WAIT_CONFIRMATIONS = 1;

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();
Expand Down Expand Up @@ -47,7 +48,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
});

await hre.deployments.execute(
Expand All @@ -56,7 +57,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"grantRole",
RPROPOSER_ROLE,
Expand All @@ -69,7 +70,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"grantRole",
CANCELLER_ROLE,
Expand All @@ -83,7 +84,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"grantRole",
CANCELLER_ROLE,
Expand All @@ -96,13 +97,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"revokeRole",
DEFAULT_ADMIN_ROLE,
deployer
);

// Send all tokens to Executor and announce ownership to Executor.
const balance: BigNumber = await hre.deployments.read(
"FluenceToken",
{
Expand All @@ -119,15 +121,25 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
from: deployer,
log: true,
autoMine: true,
waitConfirmations: 1,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"transfer",
(
await hre.deployments.get("Executor")
).address,
executorAddress,
balance
);
}

await hre.deployments.execute(
"FluenceToken",
{
from: deployer,
log: true,
autoMine: true,
waitConfirmations: DEFAULT_WAIT_CONFIRMATIONS,
},
"transferOwnership",
executorAddress
);
};

export default func;
Expand Down
4 changes: 3 additions & 1 deletion contracts/test/Deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ describe("Deploy script", () => {
expect(await token.totalSupply()).to.eq(
ethers.utils.parseEther(String(config.deployment!.token!.totalSupply))
);

expect(await token.owner()).to.eq(executor.address);
});

it("token balances are correct", async () => {
Expand Down Expand Up @@ -266,7 +268,7 @@ describe("Deploy script", () => {

expect(await token.balanceOf(governor.address)).to.eq(0);

//TODO: veify balancer
// TODO: veify balancer
});

it("executor roles are correct", async () => {
Expand Down

0 comments on commit 77c2de0

Please sign in to comment.