Skip to content

Commit

Permalink
Merge pull request #4 from Canto-Network/tk/upgrade-tests
Browse files Browse the repository at this point in the history
test: adding extra tests for cRWA launch sequence
  • Loading branch information
tkkwon1998 authored Oct 13, 2023
2 parents 8d7ddb9 + 29d4df5 commit 3967a0a
Show file tree
Hide file tree
Showing 7 changed files with 341 additions and 564 deletions.
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"rules": {
"quotes": ["error", "double"],
"max-line-length": ["error", 200],
"max-line-length": ["error", 500],
"compiler-version": ["error", "^0.8.0"],
"reason-string": ["warn", { "maxLength": 128 }],
"not-rely-on-block-hash": "off",
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[default]
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: HardhatUserConfig = {
tags: ["Deployment"],
},
canto_livenet: {
url: "",
url: "https://mainnode.plexnode.org:8545",
accounts: [process.env.PRIVATE_KEY],
},
new_testnet: {
Expand Down
45 changes: 25 additions & 20 deletions script/RWA/deployRWA.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,34 @@ const mainnet = {
};

async function main() {
const ComptrollerFactory = await ethers.getContractFactory("Comptroller");
const cRWA = await ethers.getContractFactory("CRWAToken");
const cERC20Delegator = await ethers.getContractFactory("cERC20Delegator");
const ComptrollerFactoryV2 = await ethers.getContractFactory(
"ComptrollerV2"
);
// const cRWA = await ethers.getContractFactory("CRWAToken");
// const cERC20Delegator = await ethers.getContractFactory("CErc20Delegator");

// deploy comptroller with updated max collateral factor
const comptroller = await (await ComptrollerFactory.deploy()).deployed();

// deploy cRWA token and the delegator
const cRWAToken = await (await cRWA.deploy()).deployed();
const cUSYC = await (
await cERC20Delegator.deploy(
mainnet.USYC, // underlying
mainnet.unitroller, // comptroller
mainnet.jumpRateModel, // interest rate model
1, // initial exchange rate
"cUSYC", // name
"cUSYC", // symbol
6, // decimals
"ADMIN", // admin
cRWAToken.address, // implementation
"BYTES" // become implementation data
)
const comptrollerV2 = await (
await ComptrollerFactoryV2.deploy()
).deployed();
console.log("Comptroller deployed to:", comptrollerV2.address);

// // deploy cRWA token and the delegator
// const cRWAToken = await (await cRWA.deploy()).deployed();
// const cUSYC = await (
// await cERC20Delegator.deploy(
// mainnet.USYC, // underlying
// mainnet.unitroller, // comptroller
// mainnet.jumpRateModel, // interest rate model
// 1, // initial exchange rate
// "cUSYC", // name
// "cUSYC", // symbol
// 6, // decimals
// "ADMIN", // admin
// cRWAToken.address, // implementation
// "BYTES" // become implementation data
// )
// ).deployed();
}

main()
Expand Down
117 changes: 65 additions & 52 deletions script/governance/generateCallData.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,75 @@
const {ethers} = require("hardhat");
const {canto} = require("../../config/index");
const { ethers } = require("hardhat");
const { canto } = require("../../config/index");

async function main() {
let abiCoder = ethers.utils.defaultAbiCoder
async function main() {
let abiCoder = ethers.utils.defaultAbiCoder;

// mainnet
let tokens = [
(await deployments.get("CUsdcDelegator")).address, //cUsdc delegator
(await deployments.get("CUsdtDelegator")).address, // cUsdt delegator
(await deployments.get("CNoteUsdcDelegator")).address, //cNoteUsdc Delegator
(await deployments.get("CNoteUsdtDelegator")).address, //cNoteUsdt Delegator
(await deployments.get("CCantoAtomDelegator")).address, //cCantoAtom Delegator
(await deployments.get("CCantoEthDelegator")).address, //cCantoEth Delegator
(await deployments.get("CCantoNoteDelegator")).address //cCantoNote Delegator
]
"0xdE59F060D7ee2b612E7360E6C1B97c4d8289Ca2e", //cUsdc delegator
"0x6b46ba92d7e94FfA658698764f5b8dfD537315A9", // cUsdt delegator
"0xD6a97e43FC885A83E97d599796458A331E580800", //cNoteUsdc Delegator
"0xf0cd6b5cE8A01D1B81F1d8B76643866c5816b49F", //cNoteUsdt Delegator
"0xC0D6574b2fe71eED8Cd305df0DA2323237322557", //cCantoAtom Delegator
"0xb49A395B39A0b410675406bEE7bD06330CB503E3", //cCantoEth Delegator
"0x3C96dCfd875253A37acB3D2B102b6f328349b16B", //cCantoNote Delegator
];

// testnet
// let tokens = [
// "0x8a66C14854221E078678E13d25e3017d4E3Bc912", //cUsdc delegator
// "0xE66e73865308820616bF5197631d6eE07aa1B45D", // cUsdt delegator
// "0xE1AceA9029d52B54b55Fd0d1f08Ba0748a6677Dc", //cNoteUsdc Delegator
// "0xDDF11fE93D64DE9a4513f409799cF170B96182c2", //cNoteUsdt Delegator
// "0xedD97a6303DCed58C31d37fb208F9d0E3734AC8D", //cCantoAtom Delegator
// "0x4CD4165406caf9da02Ca41153662ec9D401F243C", //cCantoEth Delegator
// "0xc5bC2311674FEd327Bf26AfAF457fC6B2Bff9bed" //cCantoNote Delegator
// ]

// epoch 10
let supplySpeeds = [
ethers.utils.parseUnits("0.3", "18"),
ethers.utils.parseUnits("0.3", "18"),
ethers.utils.parseUnits("4", "18"),
ethers.utils.parseUnits("4", "18"),
ethers.utils.parseUnits("16","18"),
ethers.utils.parseUnits("16","18"),
ethers.utils.parseUnits("32", "18")
]
let borrowSpeeds = [
0,
0,
0,
0,
0,
0,
0
]

// reservoir
let reservoir = await ethers.getContractAt("Reservoir", "0xF55b9a38a7937f6554d67bAF7a1aeA7eAF3509CA")
console.log(`Reservoir drip rate: ${await reservoir.dripRate()}`)

let priceOracleAddr = "0xCE1541C1dE95ea8d726b3ead31EdB8A8543915F2";

// console.log(`CUsdc compSupplySpeed: `, (await comptroller.compSupplySpeeds(CUsdc.address)).toBigInt())

data = abiCoder.encode(["address[]", "uint[]", "uint[]"], [tokens, supplySpeeds , borrowSpeeds])
console.log(data)
ethers.utils.parseUnits("0.164", "18"),
ethers.utils.parseUnits("0.164", "18"),
ethers.utils.parseUnits("0.612", "18"),
ethers.utils.parseUnits("0.612", "18"),
ethers.utils.parseUnits("3.429", "18"),
ethers.utils.parseUnits("3.429", "18"),
ethers.utils.parseUnits("8.491", "18"),
];

// let supplySpeeds = [
// ethers.utils.parseUnits("0.3", "18"),
// ethers.utils.parseUnits("0.3", "18"),
// ethers.utils.parseUnits("4", "18"),
// ethers.utils.parseUnits("4", "18"),
// ethers.utils.parseUnits("16","18"),
// ethers.utils.parseUnits("16","18"),
// ethers.utils.parseUnits("32", "18")
// ]
let borrowSpeeds = [0, 0, 0, 0, 0, 0, 0];

// let priceOracleAddr = "0xCE1541C1dE95ea8d726b3ead31EdB8A8543915F2";

data = abiCoder.encode(
["address[]", "uint[]", "uint[]"],
[tokens, supplySpeeds, borrowSpeeds]
);
console.log(data);

// data2 = abiCoder.encode(["address[]"], [["0x00cEe48F9c6fca37852c5bB9FF36b207892879bC"]]);
// console.log(data2);
// send funds to reservoir call data
data = abiCoder.encode(["address","uint256","string"], ["0xF55b9a38a7937f6554d67bAF7a1aeA7eAF3509CA", ethers.utils.parseUnits("32500000", "18"), "CANTO"])
console.log("TreasurySend: ", data)
// data = abiCoder.encode(["address","uint256","string"], ["0xF55b9a38a7937f6554d67bAF7a1aeA7eAF3509CA", ethers.utils.parseUnits("32500000", "18"), "CANTO"])
// console.log("TreasurySend: ", data)

// update comptroller Price Oracle
data = abiCoder.encode(["address"], [priceOracleAddr]);
console.log(`Updating price Oracle data: ${data}`)
// // update comptroller Price Oracle
// data = abiCoder.encode(["address"], [priceOracleAddr]);
// console.log(`Updating price Oracle data: ${data}`)
}



main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Loading

0 comments on commit 3967a0a

Please sign in to comment.