Skip to content

Commit

Permalink
Update deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
SigismundSchlomo committed Oct 3, 2024
1 parent 740a71e commit effaa10
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"deploy_government": "hardhat run scripts/ecosystem/government/deploy.ts --network dev",
"deploy_liquid_staking": "hardhat run scripts/ecosystem/liquid_staking/deploy.ts --network dev",
"deploy_token_staking": "hardhat run scripts/ecosystem/token_staking/deploy.ts --network dev",

"deploy_hbr_token": "hardhat run scripts/ecosystem/deploy_hbr.ts --network dev",
"create_hbr_amb_pool": "hardhat run scripts/ecosystem/create_hbr_amb_pool.ts --network dev",

"sourcify:dev": "hardhat sourcify --network dev",
"sourcify:test": "hardhat sourcify --network test",
Expand Down
61 changes: 61 additions & 0 deletions scripts/ecosystem/token_staking/create_hbr_amb.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { ethers } from "hardhat";
import { wrapProviderToError } from "../../../src/utils/AmbErrorProvider";
import { loadDeployment } from "@airdao/deployments/deploying";

import {
LimitedTokenPool
} from "../../../typechain-types";

const BILLIION = 1_000_000_000;

async function main() {
const { chainId } = await ethers.provider.getNetwork();

const [deployer] = await ethers.getSigners();
wrapProviderToError(deployer.provider!);

const hbrToken = loadDeployment("HBRToken", chainId, deployer);

const poolsManager = loadDeployment("TokenPoolsManager", chainId, deployer);

const mainConfig: LimitedTokenPool.MainConfigStruct = {
name: "HBR-AMB",
limitsMultiplierToken: hbrToken.address,
profitableToken: ethers.constants.AddressZero,
rewardToken: ethers.constants.AddressZero,
rewardTokenPrice: 1,
interest: 0.1 * BILLIION,
interestRate: 24 * 60 * 60,
};

const createTx = poolsManager.createLimitedTokenPool(mainConfig);
const createReceipt = await createTx.wait();
console.log("createReceipt", createReceipt);

const limitsConfig: LimitedTokenPool.LimitsConfigStruct = {
minDepositValue: 1,
minStakeValue: 1,
fastUnstakePenalty: 0,
unstakeLockPeriod: 24 * 60 * 60,
stakeLockPeriod: 24 * 60 * 60,
maxTotalStakeValue: 1 * BILLIION,
maxStakePerUserValue: 0.01 * BILLIION,
stakeLimitsMultiplier: 10,
};

const configureLimitsTx = poolsManager.configureLimitedTokenPoolLimits("HBR-AMB", limitsConfig);
const configureLimitsReceipt = await configureLimitsTx.wait();
console.log("configureLimitsReceipt", configureLimitsReceipt);

const poolAddress = await poolsManager.getLimitedTokenPoolAddress("HBR-AMB");
console.log("poolAddress:", poolAddress);
}


if (require.main === module) {
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
}

18 changes: 11 additions & 7 deletions scripts/ecosystem/token_staking/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import {
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_TokenPoolsManagerMultisig, deployer);

Expand All @@ -37,18 +39,20 @@ export async function main() {

console.log("deploying TokenPool Beacon");

const singleSidePoolFactory = await ethers.getContractFactory("SingleSidePool");
const singleSideBeacon = await upgrades.deployBeacon(singleSidePoolFactory);
console.log("SingleSidePool Beacon deployed to:", singleSideBeacon.address);
const tokenPoolFactory = await ethers.getContractFactory("TokenPool");
const tokenPoolBeacon = await upgrades.deployBeacon(tokenPoolFactory);
console.log("TokenPool Beacon deployed to:", tokenPoolBeacon.address);

const doubleSidePoolFactory = await ethers.getContractFactory("DoubleSidePool");
const doubleSideBeacon = await upgrades.deployBeacon(doubleSidePoolFactory);
console.log("DoubleSidePool Beacon deployed to:", doubleSideBeacon.address);
console.log("deploying LimitedTokenPool Beacon");
const limitedTokenPoolFactory = await ethers.getContractFactory("LimitedTokenPool");
const limitedTokenPoolBeacon = await upgrades.deployBeacon(limitedTokenPoolFactory);
console.log("LimitedTokenPool Beacon deployed to:", limitedTokenPoolBeacon.address);

console.log("deploying TokenPoolsManager");
const poolsManager = await deploy<TokenPoolsManager__factory>({
contractName: ContractNames.Ecosystem_TokenPoolsManager,
artifactName: "TokenPoolsManager",
deployArgs: [rewardsBank.address, lockKeeper.address, singleSideBeacon.address, doubleSideBeacon.address],
deployArgs: [rewardsBank.address, lockKeeper.address, tokenPoolBeacon.address, limitedTokenPoolBeacon.address],
signer: deployer,
loadIfAlreadyDeployed: true,
});
Expand Down

0 comments on commit effaa10

Please sign in to comment.