diff --git a/deployments/mumbai/collateral-config.ts b/deployments/mumbai/collateral-config.ts index f66194a8..b0ec1770 100644 --- a/deployments/mumbai/collateral-config.ts +++ b/deployments/mumbai/collateral-config.ts @@ -6,7 +6,6 @@ const collateralConfig: CollateralConfigMap = { WMATIC: { collateralAddress: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', borrowPool: '0xb1fB649039F829Aa588bAc07411bb2D25A21E446', - mintLimit: utils.parseEther('500000'), oracle: { source: 'MockSapphireOracle', getDeployTx: (signer: Signer) => diff --git a/deployments/polygon/collateral-config.ts b/deployments/polygon/collateral-config.ts index e40300f4..b99f3bb1 100644 --- a/deployments/polygon/collateral-config.ts +++ b/deployments/polygon/collateral-config.ts @@ -6,7 +6,6 @@ const collateralConfig: CollateralConfigMap = { WETH: { collateralAddress: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', borrowPool: '0x59b8a21A0B0cE87E308082Af6fFC4205b5dC932C', - mintLimit: utils.parseEther('500000'), oracle: { source: 'ChainLinkOracle', getDeployTx: (signer: Signer) => @@ -33,6 +32,50 @@ const collateralConfig: CollateralConfigMap = { interestRate: '1547125957', }, }, + 'WETH-B': { + collateralAddress: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + borrowPool: '0x1321f1f1aa541A56C31682c57b80ECfCCd9bB288', + oracle: '0x45e3875E434043670f8760e5e27cF170BE3BAFdf', + borrowRatios: { + highCRatio: utils.parseEther('1.4285714285'), // 70% + lowCRatio: utils.parseEther('1.0526315789'), // 95% LTV + }, + fees: { + liquidatorDiscount: utils.parseEther('0.1'), + poolInterestFee: utils.parseEther('0.5'), + liquidationArcFee: utils.parseEther('0.5'), + borrowFee: utils.parseEther('0.0005'), + }, + limits: { + vaultBorrowMax: utils.parseEther('100000'), + defaultBorrowLimit: 0, + }, + interestSettings: { + interestRate: '937303470', // 3% + }, + }, + 'WETH-C': { + collateralAddress: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + borrowPool: '0x69b37541d1C00c949B530ccd3d23437188767160', + oracle: '0x45e3875E434043670f8760e5e27cF170BE3BAFdf', + borrowRatios: { + highCRatio: utils.parseEther('1.4285714285'), // 70% + lowCRatio: utils.parseEther('1'), // 100% LTV + }, + fees: { + liquidatorDiscount: utils.parseEther('0.1'), + poolInterestFee: utils.parseEther('0.5'), + liquidationArcFee: utils.parseEther('0.5'), + borrowFee: utils.parseEther('0.0005'), + }, + limits: { + vaultBorrowMax: utils.parseEther('100000'), + defaultBorrowLimit: 0, + }, + interestSettings: { + interestRate: '315522921', // 1% + }, + }, }; export default collateralConfig; diff --git a/deployments/polygon/deployed.json b/deployments/polygon/deployed.json index ec3e7f9c..16c4af31 100644 --- a/deployments/polygon/deployed.json +++ b/deployments/polygon/deployed.json @@ -118,5 +118,45 @@ "version": 3, "type": "borrowing", "group": "" + }, + { + "name": "SapphirePoolProxy", + "source": "ArcProxy", + "address": "0x1321f1f1aa541A56C31682c57b80ECfCCd9bB288", + "txn": "0x86d66869ef489ac79389c3e734b030ed89e836f8f18b6823e02e0348810400c7", + "network": "polygon", + "version": 1, + "type": "borrowing", + "group": "B" + }, + { + "name": "SapphireCoreProxy", + "source": "ArcProxy", + "address": "0xE106dDE30B538a0F86146862d131FC6733C6EEe4", + "txn": "0xf8377dd7c5550090185fa42fb8d56de9aba499979a9b379abb89c04baf709a32", + "network": "polygon", + "version": 1, + "type": "borrowing", + "group": "WETH-B" + }, + { + "name": "SapphirePoolProxy", + "source": "ArcProxy", + "address": "0x69b37541d1C00c949B530ccd3d23437188767160", + "txn": "0xcde13415a2351ae894ddc52058e3a9e55f12ecf77b2465147e32e1fdec6a7899", + "network": "polygon", + "version": 1, + "type": "borrowing", + "group": "C" + }, + { + "name": "SapphireCoreProxy", + "source": "ArcProxy", + "address": "0x1990BAbB67C1d297Fde4b3e540e6a32148654F44", + "txn": "0x64fb169bc729185cb3f2bfbcff4d3b7ca796decda632f0caaef8be57f148174f", + "network": "polygon", + "version": 1, + "type": "borrowing", + "group": "WETH-C" } -] \ No newline at end of file +] diff --git a/deployments/types/deploymentTypes.ts b/deployments/types/deploymentTypes.ts index a7d653df..151e05bc 100644 --- a/deployments/types/deploymentTypes.ts +++ b/deployments/types/deploymentTypes.ts @@ -35,12 +35,13 @@ export enum DeploymentType { export interface CoreConfig { collateralAddress: string; borrowPool: string; - mintLimit: BigNumberish; - oracle: { - source: string; - getDeployTx: (signer: Signer) => TransactionRequest; - constructorArguments: unknown[]; - }; + oracle: + | string + | { + source: string; + getDeployTx: (signer: Signer) => TransactionRequest; + constructorArguments: unknown[]; + }; borrowRatios: { highCRatio: BigNumberish; lowCRatio: BigNumberish; diff --git a/tasks/sapphire-tasks/deployments.ts b/tasks/sapphire-tasks/deployments.ts index e568e75c..581d2fbc 100644 --- a/tasks/sapphire-tasks/deployments.ts +++ b/tasks/sapphire-tasks/deployments.ts @@ -298,12 +298,10 @@ task('deploy-sapphire', 'Deploy a Sapphire core') const { collateralAddress } = collatConfig; - const oracleAddress = await _deployOracle( - networkConfig, - signer, - hre, - collatConfig.oracle, - ); + const oracleAddress = + typeof collatConfig.oracle === 'string' + ? collatConfig.oracle + : await _deployOracle(networkConfig, signer, hre, collatConfig.oracle); if (!oracleAddress) { throw red(`The oracle was not deployed!`); @@ -362,10 +360,12 @@ task('deploy-sapphire', 'Deploy a Sapphire core') } console.log(yellow(`Calling core.init() ...\n`)); + // Setting interest rate setter as the deployer, to set it to the ultimate owner or prescribed interest setter later + const tx = await core.init( collateralAddress, oracleAddress, - collatConfig.interestSettings.interestSetter || ultimateOwner, + signer.address, collatConfig.pauseOperator || ultimateOwner, assessorAddress, collatConfig.feeCollector || ultimateOwner, @@ -430,6 +430,20 @@ task('deploy-sapphire', 'Deploy a Sapphire core') await core.setInterestRate(collatConfig.interestSettings.interestRate); console.log(green(`Interest rate successfully set\n`)); } + + if (collatConfig.interestSettings.interestSetter !== signer.address) { + console.log( + yellow( + `Setting interest setter to ${ + collatConfig.interestSettings.interestSetter || ultimateOwner + }\n`, + ), + ); + await core.setInterestSetter( + collatConfig.interestSettings.interestSetter || ultimateOwner, + ); + console.log(green(`Interest setter successfully set\n`)); + } }); task('deploy-borrow-pool') @@ -441,10 +455,17 @@ task('deploy-borrow-pool') 1, types.int, ) + .addOptionalParam('group', 'Group name for the deployment registration') .addFlag('implementationOnly', 'Only deploy the implementation contract') .setAction(async (taskArgs, hre) => { const { network, signer, networkConfig } = await loadDetails(hre); - const { name, symbol, contractVersion, implementationOnly } = taskArgs; + const { + name, + symbol, + contractVersion, + implementationOnly, + group, + } = taskArgs; await pruneDeployments(network, signer.provider); @@ -479,6 +500,7 @@ task('deploy-borrow-pool') ), version: 1, type: DeploymentType.borrowing, + group, }, networkConfig, ); diff --git a/tasks/staking-tasks.ts b/tasks/staking-tasks.ts index 8e0b3351..387138cd 100644 --- a/tasks/staking-tasks.ts +++ b/tasks/staking-tasks.ts @@ -792,12 +792,12 @@ task( 'Prints the amount in wei to be created in the sablier stream', ) .addParam('amount', 'Amount of ARCx to top up in ether') + .addParam('duration', 'Duration of the stream in seconds') .setAction(async (taskArgs) => { - const { amount } = taskArgs; + const { amount, duration } = taskArgs; const targetAmount = utils.parseEther(amount); - const streamDuration = 30 * 24 * 60 * 60; - const streamAmount = targetAmount.div(streamDuration).mul(streamDuration); + const streamAmount = targetAmount.div(duration).mul(duration); console.log(green(`${streamAmount} wei`)); }); diff --git a/test/mainnet_fork/flashLiquidator.test.ts b/test/mainnet_fork/flashLiquidator.test.ts index 703c8b66..f670d814 100644 --- a/test/mainnet_fork/flashLiquidator.test.ts +++ b/test/mainnet_fork/flashLiquidator.test.ts @@ -49,6 +49,7 @@ describe('FlashLiquidator', () => { const coreProxyAddress = loadContract({ network: 'polygon', name: 'SapphireCoreProxy', + group: 'WETH', }).address; arc = SapphireArc.new(signer); await arc.addCores({