-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46aa1aa
commit 1e691d7
Showing
5 changed files
with
94 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { ethers, upgrades } from "hardhat"; | ||
import { deploy } from "@airdao/deployments/deploying"; | ||
|
||
import { ContractNames } from "../../../src"; | ||
|
||
import { | ||
LimitedTokenPoolsManager__factory, | ||
RewardsBank__factory, | ||
LockKeeper__factory | ||
} from "../../../typechain-types"; | ||
|
||
import { wrapProviderToError } from "../../../src/utils/AmbErrorProvider"; | ||
import { deployMultisig } from "../../utils/deployMultisig"; | ||
|
||
export async function main() { | ||
const { chainId } = await ethers.provider.getNetwork(); | ||
|
||
const [deployer] = await ethers.getSigners(); | ||
wrapProviderToError(deployer.provider!); | ||
|
||
const multisig = await deployMultisig(ContractNames.Ecosystem_LimitedTokenPoolsManager, deployer); | ||
|
||
const rewardsBank = await deploy<RewardsBank__factory>({ | ||
contractName: ContractNames.Ecosystem_LimitedTokenPoolsManagerRewardsBank, | ||
artifactName: "RewardsBank", | ||
deployArgs: [], | ||
signer: deployer, | ||
loadIfAlreadyDeployed: true, | ||
}); | ||
|
||
const lockKeeper = await deploy<LockKeeper__factory>({ | ||
contractName: ContractNames.LockKeeper, | ||
artifactName: "LockKeeper", | ||
deployArgs: [], | ||
signer: deployer, | ||
loadIfAlreadyDeployed: true, | ||
isUpgradeableProxy: true, | ||
}); | ||
|
||
console.log("deploying LimitedTokenPool Beacon"); | ||
const limitedTokenPoolFactory = await ethers.getContractFactory("LimitedTokenPool"); | ||
const limitedTokenPoolBeacon = await upgrades.deployBeacon(limitedTokenPoolFactory); | ||
await limitedTokenPoolBeacon.deployed(); | ||
console.log("LimitedTokenPool Beacon deployed to:", limitedTokenPoolBeacon.address); | ||
|
||
console.log("deploying TokenPoolsManager"); | ||
const poolsManager = await deploy<LimitedTokenPoolsManager__factory>({ | ||
contractName: ContractNames.Ecosystem_TokenPoolsManager, | ||
artifactName: "TokenPoolsManager", | ||
deployArgs: [rewardsBank.address, lockKeeper.address, limitedTokenPoolBeacon.address], | ||
signer: deployer, | ||
loadIfAlreadyDeployed: true, | ||
}); | ||
|
||
console.log("Grant poolsManager rewardsBank admin roles"); | ||
await (await rewardsBank.grantRole(await rewardsBank.DEFAULT_ADMIN_ROLE(), poolsManager.address)).wait(); | ||
|
||
console.log("Grant multisig rewardsBank admin role"); | ||
await (await rewardsBank.grantRole(await rewardsBank.DEFAULT_ADMIN_ROLE(), multisig.address)).wait(); | ||
|
||
console.log("Grant multisig poolsManager admin role"); | ||
await (await poolsManager.grantRole(await poolsManager.DEFAULT_ADMIN_ROLE(), multisig.address)).wait(); | ||
|
||
if (chainId != 16718) return; // continue only on prod | ||
|
||
console.log("Revoking roles from deployer"); | ||
|
||
console.log("Revoke rewardsBank admin role from deployer"); | ||
await (await rewardsBank.revokeRole(await rewardsBank.DEFAULT_ADMIN_ROLE(), deployer.address)).wait(); | ||
|
||
console.log("Revoke poolsManager admin role from deployer"); | ||
await (await poolsManager.revokeRole(await poolsManager.DEFAULT_ADMIN_ROLE(), deployer.address)).wait(); | ||
|
||
} | ||
|
||
if (require.main === module) { | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters