From ddfd959629711b3dca351e907cff40430c068705 Mon Sep 17 00:00:00 2001 From: asardon Date: Fri, 13 Jan 2023 18:55:35 +0100 Subject: [PATCH] updated deploy script --- scripts/5_deploy_rpl_usdc_v_1_1.js | 33 ++++++++++++++++++-- scripts/5_deploy_rpl_usdc_v_1_1_arguments.js | 7 +++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/scripts/5_deploy_rpl_usdc_v_1_1.js b/scripts/5_deploy_rpl_usdc_v_1_1.js index 49536dd..fecf863 100644 --- a/scripts/5_deploy_rpl_usdc_v_1_1.js +++ b/scripts/5_deploy_rpl_usdc_v_1_1.js @@ -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, @@ -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, @@ -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() diff --git a/scripts/5_deploy_rpl_usdc_v_1_1_arguments.js b/scripts/5_deploy_rpl_usdc_v_1_1_arguments.js index ac5ccd4..8661484 100644 --- a/scripts/5_deploy_rpl_usdc_v_1_1_arguments.js +++ b/scripts/5_deploy_rpl_usdc_v_1_1_arguments.js @@ -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, @@ -27,4 +28,4 @@ module.exports = [ poolConfig.minLoan, poolConfig.baseAggrBucketSize, poolConfig.creatorFee - ]; \ No newline at end of file +]; \ No newline at end of file