Skip to content

Commit

Permalink
add the deleted folder scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Frihat-dev committed Oct 10, 2023
1 parent d78fd46 commit 3a20807
Show file tree
Hide file tree
Showing 11 changed files with 306 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/approve.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '10000000';
const SWAP_FEE = '20000000';
const REDEEM_FEE = '50000000';
const FEE_DENOMITOR = '10000000000';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableSwap = await ethers.getContractFactory("StableSwap");
const wETHAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
const cbETHSwap = await StableSwap.attach('0x6a589DA7D666A903fBf2c78CBd7D38D378edE593');
let txn1 = await cbETHSwap.approve(wETHAddress, '0x3Ea5a52a985091F37555F842A164BE66eCDF1AD1');
console.log(txn1.hash);
let txn2 = await cbETHSwap.approve('0xd994DD0FA5D62306BC2E46B96104E7Fda80Afa62', '0x3Ea5a52a985091F37555F842A164BE66eCDF1AD1');
console.log(txn2.hash);
console.log("Approval compelted");
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
50 changes: 50 additions & 0 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '0';
const SWAP_FEE = '3000000';
const REDEEM_FEE = '10000000';
const FEE_DENOMITOR = '10000000000';
const INITIAL_A = '100';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);

const wETHAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
const stETHAddress = '0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F';
const rETHAddress = '0x178e141a0e3b34152f73ff610437a7bf9b83267a';
const feeAddress = '0x3a4ABb0eE1dE2aCcDFE14b80B4DEe78F983b3dcF';
const yieldAddress = '0xDeEc86988C66618e574ed1eFF2C5CA5745d2916d';

const ConstantExchangeRateProvider = await ethers.getContractFactory("ConstantExchangeRateProvider");
const StableAssetToken = await ethers.getContractFactory("StableAssetToken");
const StableAsset = await ethers.getContractFactory("StableAsset");
const constant = await ConstantExchangeRateProvider.deploy();
const RocketTokenExchangeRateProvider = await ethers.getContractFactory("RocketTokenExchangeRateProvider");
const rate = await upgrades.deployProxy(RocketTokenExchangeRateProvider, [rETHAddress]);
console.log(`constant: ${constant.address}`);
console.log(`rETH Rate: ${rate.address}`);

const poolToken = await upgrades.deployProxy(StableAssetToken, ["Tapio Ether", "tapETH"]);
console.log("poolToken deployed");
console.log(`poolToken: ${poolToken.address}`);

const stETHSwap = await upgrades.deployProxy(StableAsset, [[wETHAddress, stETHAddress], [PRECISION, PRECISION], [MINT_FEE, SWAP_FEE, REDEEM_FEE], feeAddress, yieldAddress, poolToken.address, INITIAL_A, constant.address, 1]);
const rETHSwap = await upgrades.deployProxy(StableAsset, [[wETHAddress, rETHAddress], [PRECISION, PRECISION], [MINT_FEE, SWAP_FEE, REDEEM_FEE], feeAddress, yieldAddress, poolToken.address, INITIAL_A, rate.address, 1]);
console.log(`stETHSwap: ${stETHSwap.address}`);
console.log(`rETHSwap: ${rETHSwap.address}`);

await poolToken.setMinter(stETHSwap.address, true);
await poolToken.setMinter(rETHSwap.address, true);
// await stETHSwap.unpause();
// await cbETHSwap.unpause();
console.log("Approval compelted");
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
20 changes: 20 additions & 0 deletions scripts/deploy_application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ethers, upgrades } from "hardhat";

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAssetApplication = await ethers.getContractFactory("StableAssetApplication");

const wETHAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
const application = await upgrades.deployProxy(StableAssetApplication, [wETHAddress]);

console.log("application deployed");
console.log(`application: ${application.address}`);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
39 changes: 39 additions & 0 deletions scripts/deploy_governance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ethers, upgrades } from "hardhat";

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);

const poolToken = '0xA33a79c5Efadac7c07693c3ce32Acf9a1Fc5A387';
const votingTokenAddress = '0x8d68692bddED1F7e70cC1B4D4C58be3F9902e86A';
const votingEscrowAddress = '0x2b4Db8eb1f6792f253633892862D0799f335c129';
const VotingToken = await ethers.getContractFactory("VotingToken");
const VotingEscrow = await ethers.getContractFactory("VotingEscrow");
const GaugeRewardController = await ethers.getContractFactory("GaugeRewardController");
const GaugeController = await ethers.getContractFactory("GaugeController");


const votingToken = await upgrades.deployProxy(VotingToken, ["Tapio", "TAP"]);
console.log("votingToken deployed");
console.log(`votingToken: ${votingToken.address}`);

const votingEscrow = await upgrades.deployProxy(VotingEscrow, [votingTokenAddress, "vTapio", "vTAP", "v0"]);
console.log("votingEscrow deployed");
console.log(`votingEscrow: ${votingEscrow.address}`);

const gaugeRewardController = await upgrades.deployProxy(GaugeRewardController, [votingTokenAddress, votingEscrowAddress]);
console.log("gaugeRewardController deployed");
console.log(`gaugeRewardController: ${gaugeRewardController.address}`);

const gaugeController = await upgrades.deployProxy(GaugeController, [votingTokenAddress, poolToken, "1000000000000000000000", gaugeRewardController.address]);
console.log("gaugeController deployed");
console.log(`gaugeController: ${gaugeController.address}`);

}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
20 changes: 20 additions & 0 deletions scripts/deploy_reth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ethers, upgrades } from "hardhat";

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const RocketTokenExchangeRateProvider = await ethers.getContractFactory("RocketTokenExchangeRateProvider");

const rETHAddress = '0x178e141a0e3b34152f73ff610437a7bf9b83267a';
const rate = await upgrades.deployProxy(RocketTokenExchangeRateProvider, [rETHAddress]);

console.log("application deployed");
console.log(`cbETH: ${rate.address}`);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
40 changes: 40 additions & 0 deletions scripts/deploy_reth_swap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '10000000';
const SWAP_FEE = '20000000';
const REDEEM_FEE = '50000000';
const FEE_DENOMITOR = '10000000000';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);

const wETHAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
const rETHAddress = '0x178e141a0e3b34152f73ff610437a7bf9b83267a';
const feeAddress = '0x3a4ABb0eE1dE2aCcDFE14b80B4DEe78F983b3dcF';
const yieldAddress = '0xDeEc86988C66618e574ed1eFF2C5CA5745d2916d';
const poolTokenAddress = '0xDFfB1823e24A76e5682e988DF9C4bF53bf3299De';
const exchangeRateProviderAddress = '0x9C3aF1d0b2590d4143AEafF23eF23E6B533fC7c5';

const StableAssetToken = await ethers.getContractFactory("StableAssetToken");
const poolToken = StableAssetToken.attach(poolTokenAddress);

console.log("poolToken deployed");

const StableAsset = await ethers.getContractFactory("StableAsset");

const rETHSwap = await upgrades.deployProxy(StableAsset, [[wETHAddress, rETHAddress], [PRECISION, PRECISION], [MINT_FEE, SWAP_FEE, REDEEM_FEE], feeAddress, yieldAddress, poolToken.address, 100, exchangeRateProviderAddress, 1]);
console.log(`stETHSwap: ${rETHSwap.address}`);

await poolToken.setMinter(rETHSwap.address, true);
await rETHSwap.unpause();
console.log("Approval compelted");
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
22 changes: 22 additions & 0 deletions scripts/mint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '10000000';
const SWAP_FEE = '20000000';
const REDEEM_FEE = '50000000';
const FEE_DENOMITOR = '10000000000';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAssetApplication = await ethers.getContractFactory("StableAssetApplication");
const application = await StableAssetApplication.attach('0x9aabd039fD0bF767Db26293a039998e85Bd31255');
await application.mint('0xd22f46Ba0425066159F828EFA5fFEab4DAeb9fd0', ['1000000000000000', '1000000000000000'], '0', {value: '1000000000000000'});
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
23 changes: 23 additions & 0 deletions scripts/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '10000000';
const SWAP_FEE = '20000000';
const REDEEM_FEE = '50000000';
const FEE_DENOMITOR = '10000000000';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAssetApplication = await ethers.getContractFactory("StableAssetApplication");
const application = StableAssetApplication.attach('0x9aabd039fD0bF767Db26293a039998e85Bd31255');
console.log(`balance: ${await application.getSwapAmountCrossPool('0xd22f46Ba0425066159F828EFA5fFEab4DAeb9fd0', '0x6f07114487BaC63856060f9f1739d66b16DF579b', '0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F', '0xc91960dAaf78B817E3a5064A80D7085CD85DfD04', '200000000000000')}`);

}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
28 changes: 28 additions & 0 deletions scripts/stable_swap_mint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ethers, upgrades } from "hardhat";

const PRECISION = '1';
const MINT_FEE = '10000000';
const SWAP_FEE = '20000000';
const REDEEM_FEE = '50000000';
const FEE_DENOMITOR = '10000000000';

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAsset = await ethers.getContractFactory("StableAsset");
const MockToken = await ethers.getContractFactory("MockToken");
const cbETHSwap = await StableAsset.attach('0xd22f46Ba0425066159F828EFA5fFEab4DAeb9fd0');
const cbETH = await MockToken.attach('0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F');
const wETH = await MockToken.attach('0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6');
await wETH.approve(cbETHSwap.address, '1000000000000000000000000');
await cbETH.approve('0xd22f46Ba0425066159F828EFA5fFEab4DAeb9fd0', '1000000000000000000000000');
let txn2 = await cbETHSwap.mint(['1000000000000000', '1000000000000000'], 0);
console.log(txn2.hash);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
18 changes: 18 additions & 0 deletions scripts/upgrade_application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ethers, upgrades } from "hardhat";

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAssetApplication = await ethers.getContractFactory("StableAssetApplication");

const application = await upgrades.upgradeProxy('0x019270711FF6774a14732F850f9A15008F15c05f', StableAssetApplication);

console.log("application deployed");
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
19 changes: 19 additions & 0 deletions scripts/upgrade_stable_asset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ethers, upgrades } from "hardhat";

async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
const StableAsset = await ethers.getContractFactory("StableAsset");

const swapOne = await upgrades.upgradeProxy('0x52543FE4597230ef59fC8C38D3a682Fa2F0fc026', StableAsset);
const swapTwo = await upgrades.upgradeProxy('0x8589F6Dedae785634f47132193680149d43cfaF3', StableAsset);

console.log("application deployed");
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

0 comments on commit 3a20807

Please sign in to comment.