Skip to content

Commit

Permalink
🔨 deploy: fix provider ratio and add setter
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Sep 5, 2024
1 parent ed72d2e commit 69697f9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion deploy/Staking.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { DeployFunction } from "hardhat-deploy/types";
import type { Market, StakedEXA } from "../types";
import transferOwnership from "./.utils/transferOwnership";
import executeOrPropose from "./.utils/executeOrPropose";
import multisigPropose from "./.utils/multisigPropose";
import validateUpgrade from "./.utils/validateUpgrade";
import grantRole from "./.utils/grantRole";
Expand All @@ -25,6 +26,8 @@ const func: DeployFunction = async ({
getNamedAccounts(),
]);

const providerRatio = parseUnits(String(staking.providerRatio));

await validateUpgrade("stEXA", { contract: "StakedEXA", envKey: "STAKED_EXA" }, async (name, opts) =>
deploy(name, {
...opts,
Expand All @@ -47,7 +50,7 @@ const func: DeployFunction = async ({
provider: treasury,
savings,
duration: staking.duration,
providerRatio: parseUnits(String(staking.penaltyThreshold)),
providerRatio,
},
],
},
Expand All @@ -60,6 +63,10 @@ const func: DeployFunction = async ({

const stEXA = await getContract<StakedEXA>("stEXA", await getSigner(deployer));

if ((await stEXA.providerRatio()) !== providerRatio) {
await executeOrPropose(stEXA, "setProviderRatio", [providerRatio]);
}

if (pauser) await grantRole(stEXA, await stEXA.EMERGENCY_ADMIN_ROLE(), pauser.address);
await grantRole(stEXA, await stEXA.PAUSER_ROLE(), multisig);
await transferOwnership(stEXA, deployer, timelock);
Expand Down

0 comments on commit 69697f9

Please sign in to comment.