Skip to content

Commit

Permalink
Merge pull request #6 from Canto-Network/usyc-support
Browse files Browse the repository at this point in the history
test: Proposals for USYC support
  • Loading branch information
tkkwon1998 authored Oct 15, 2023
2 parents 3967a0a + a8862a6 commit 298377c
Show file tree
Hide file tree
Showing 9 changed files with 716 additions and 432 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", 500],
"max-line-length": ["error", 200],
"compiler-version": ["error", "^0.8.0"],
"reason-string": ["warn", { "maxLength": 128 }],
"not-rely-on-block-hash": "off",
Expand Down
4 changes: 3 additions & 1 deletion script/RWA/deployOracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const mainnet = {
USDC: "0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd",
wCanto: "0x826551890Dc65655a0Aceca109aB11AbDbD7a07B",
NOTE: "0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503",
rwaCtokens: [""],
rwaCtokens: ["0x0355E393cF0cf5486D9CAefB64407b7B1033C2f1"],
};

async function main() {
[dep] = await ethers.getSigners();

const CLMPriceOracleFactory = await ethers.getContractFactory(
"CLMPriceOracle"
);
Expand Down
60 changes: 33 additions & 27 deletions script/RWA/deployRWA.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
const { BigNumber } = require("ethers");
const { ethers, deployments } = require("hardhat");

const mainnet = {
unitroller: "0x5E23dC409Fc2F832f83CEc191E245A191a4bCc5C",
rwaCtokens: [""],
USYC: "", // USYC address (underlying)
jumpRateModel: "", // JumpRateModel address
USYC: "0xFb8255f0De21AcEBf490F1DF6F0BDd48CC1df03B", // USYC address (underlying)
jumpRateModel: "0x9748b6d59fd4C4f087294087bD94b6B9d95B4293", // JumpRateModel address
};

async function main() {
const ComptrollerFactoryV2 = await ethers.getContractFactory(
"ComptrollerV2"
);
// const cRWA = await ethers.getContractFactory("CRWAToken");
// const cERC20Delegator = await ethers.getContractFactory("CErc20Delegator");
[dep] = await ethers.getSigners();
// 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 comptrollerV2 = await (
await ComptrollerFactoryV2.deploy()
).deployed();
console.log("Comptroller deployed to:", comptrollerV2.address);
// // deploy comptroller with updated max collateral factor
// const comptrollerV2 = await (
// await ComptrollerFactoryV2.deploy()
// ).deployed();
// console.log("Comptroller deployed to:", comptrollerV2.address);

// // deploy cRWA token and the delegator
// // deploy cRWA token
// 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();
// console.log("cRWAToken deployed to:", cRWAToken.address);

// deploy delegator
const cUSYC = await (
await cERC20Delegator.deploy(
mainnet.USYC, // underlying
mainnet.unitroller, // comptroller
mainnet.jumpRateModel, // interest rate model
ethers.utils.parseEther("1"), // initial exchange rate
"Collateralized US Yield Coin", // name
"cUSYC", // symbol
6, // decimals
"0x03cf8710BBA14C32232Efe0613fD44b8199995EC", // admin
"0x4eb33355a84c709f85e233035f4f4a5da29921FA", // implementation
0 // become implementation data
)
).deployed();
console.log("cUSYCDelegator deployed to:", cUSYC.address);
}

main()
Expand Down
35 changes: 32 additions & 3 deletions script/governance/generateCallData.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,40 @@ async function main() {

// let priceOracleAddr = "0xCE1541C1dE95ea8d726b3ead31EdB8A8543915F2";

let CLMPriceOracle = "0xEc13678Bf31CA304bed5b7b7e3c71FeD0B450a24";
let cUSYCDelegator = "0x0355E393cF0cf5486D9CAefB64407b7B1033C2f1";

let ctoken = ["0x0355E393cF0cf5486D9CAefB64407b7B1033C2f1"];
let borrowcap = [1];

let data = abiCoder.encode(["address"], [CLMPriceOracle]);
console.log("setOracle: ", data);

data = abiCoder.encode(["address"], [cUSYCDelegator]);
console.log("support cUSYC: ", data);

data = abiCoder.encode(
["address", "uint256"],
[cUSYCDelegator, ethers.utils.parseUnits("0.99", "18")]
);
console.log("setCollateralFactor: ", data);

data = abiCoder.encode(["uint256"], [ethers.utils.parseUnits("1", "18")]);
console.log("setCloseFactor: ", data);

data = abiCoder.encode(
["address[]", "uint[]", "uint[]"],
[tokens, supplySpeeds, borrowSpeeds]
["uint256"],
[ethers.utils.parseUnits("1.01", "18")]
);
console.log(data);
console.log("setLiquidationIncentive: ", data);

data = abiCoder.encode(["address[]", "uint[]"], [ctoken, borrowcap]);
console.log("setBorrowCap: ", data);

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

// data2 = abiCoder.encode(["address[]"], [["0x00cEe48F9c6fca37852c5bB9FF36b207892879bC"]]);
// console.log(data2);
Expand Down
2 changes: 1 addition & 1 deletion src/CTokenInterfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract CTokenStorage {
/**
* @notice Share of seized collateral that is added to reserves
*/
uint public constant protocolSeizeShareMantissa = 2.8e16; //2.8%
uint public constant protocolSeizeShareMantissa = 0; // 0%
}

abstract contract CTokenInterface is CTokenStorage {
Expand Down
Loading

0 comments on commit 298377c

Please sign in to comment.