Skip to content

Commit

Permalink
updated deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
asardon committed Jan 13, 2023
1 parent 8bf42c9 commit ddfd959
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
33 changes: 31 additions & 2 deletions scripts/5_deploy_rpl_usdc_v_1_1.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
async function main() {
/*
const [deployer] = await ethers.getSigners();
console.log(`Deploying from address ${deployer.address}`)
*/
// Create a Frame connection
const ethProvider = require('eth-provider')
const frame = ethProvider('frame')

// pool parameters
const BASE = ethers.BigNumber.from("10").pow("18")
const ONE_USDC = ethers.BigNumber.from("1000000")
const ONE_DAY = ethers.BigNumber.from("86400");
const ONE_YEAR = ethers.BigNumber.from(60*60*24*365)
const ONE_DAY = ethers.BigNumber.from(60*60*24)
const tenor = ONE_DAY.mul(180)
const poolConfig = {
tenor: tenor,
Expand All @@ -18,10 +24,13 @@ async function main() {
baseAggrBucketSize: 100,
creatorFee: BASE.mul(10).div(10000)
}
console.log("poolConfig", poolConfig)

// get contract
const Pool = await ethers.getContractFactory("TestPoolRethWeth_v_1_1")
const Pool = await ethers.getContractFactory("PoolRplUsdc_v_1_1")

// deploy pool
/*
const pool = await Pool.deploy(
poolConfig.tenor,
poolConfig.maxLoanPerColl,
Expand All @@ -36,6 +45,26 @@ async function main() {
await pool.deployed()
console.log(`Deployed to address ${pool.address}`)
*/

const deployTx = await Pool.getDeployTransaction(
poolConfig.tenor,
poolConfig.maxLoanPerColl,
poolConfig.r1,
poolConfig.r2,
poolConfig.liquidityBnd1,
poolConfig.liquidityBnd2,
poolConfig.minLoan,
poolConfig.baseAggrBucketSize,
poolConfig.creatorFee
);

// Set `deployTx.from` to current Frame account
deployTx.from = (await frame.request({ method: 'eth_requestAccounts' }))[0]

// Sign and send the transaction using Frame
await frame.request({ method: 'eth_sendTransaction', params: [deployTx] })

}

main()
Expand Down
7 changes: 4 additions & 3 deletions scripts/5_deploy_rpl_usdc_v_1_1_arguments.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// verfied using hardhat verify:
// npx hardhat verify --constructor-args "scripts/5_deploy_reth_weth_v_1_1_arguments.js" ... --contract "contracts/pools/rpl-usdc/PoolRplUsdc_v_1_1.sol:PoolRplUsdc_v_1_1" --network mainnet
// npx hardhat verify --constructor-args "scripts/5_deploy_rpl_usdc_v_1_1_arguments.js" 0x331C54fD17A54dCdDb0215b9f02390cef7c7eE8F --contract "contracts/pools/rpl-usdc/PoolRplUsdc_v_1_1.sol:PoolRplUsdc_v_1_1" --network mainnet

const BASE = ethers.BigNumber.from("10").pow("18")
const ONE_USDC = ethers.BigNumber.from("1000000")
const ONE_DAY = ethers.BigNumber.from("86400");
const ONE_YEAR = ethers.BigNumber.from(60*60*24*365)
const ONE_DAY = ethers.BigNumber.from(60*60*24)
const tenor = ONE_DAY.mul(180)
const poolConfig = {
tenor: tenor,
Expand All @@ -27,4 +28,4 @@ module.exports = [
poolConfig.minLoan,
poolConfig.baseAggrBucketSize,
poolConfig.creatorFee
];
];

0 comments on commit ddfd959

Please sign in to comment.