From a8877205afbc7062a443256d8553aea7ede5856a Mon Sep 17 00:00:00 2001 From: Twin Fish Date: Mon, 30 Nov 2020 11:13:40 +0100 Subject: [PATCH] change gas cost constants (#89) * increase debt bridge gas cost constants and premium --- contracts/constants/CDebtBridge.sol | 6 ++--- .../full/helpers/constants/costs.js | 4 ++-- .../full/helpers/services/getGasCost.js | 8 +++---- .../functions/0_FGelatoDebtBridge.test.js | 24 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/contracts/constants/CDebtBridge.sol b/contracts/constants/CDebtBridge.sol index 564d3ef..dc43b47 100644 --- a/contracts/constants/CDebtBridge.sol +++ b/contracts/constants/CDebtBridge.sol @@ -2,8 +2,8 @@ pragma solidity 0.7.4; function GAS_COSTS_FOR_FULL_REFINANCE() pure returns (uint256[4] memory) { - return [uint256(2000000), 2400000, 2850000, 3500000]; + return [uint256(2519000), 3140500, 3971000, 4345000]; } -uint256 constant PREMIUM = 20; -uint256 constant VAULT_CREATION_COST = 150000; +uint256 constant PREMIUM = 30; +uint256 constant VAULT_CREATION_COST = 200000; diff --git a/test/integration/debt_bridge/from_maker/full/helpers/constants/costs.js b/test/integration/debt_bridge/from_maker/full/helpers/constants/costs.js index 3cd2a33..40ff28e 100644 --- a/test/integration/debt_bridge/from_maker/full/helpers/constants/costs.js +++ b/test/integration/debt_bridge/from_maker/full/helpers/constants/costs.js @@ -1,4 +1,4 @@ module.exports = { - PREMIUM: 20, - VAULT_CREATION_COST: 150000, + PREMIUM: 30, + VAULT_CREATION_COST: 200000, }; diff --git a/test/integration/debt_bridge/from_maker/full/helpers/services/getGasCost.js b/test/integration/debt_bridge/from_maker/full/helpers/services/getGasCost.js index 8c2d350..d57c443 100644 --- a/test/integration/debt_bridge/from_maker/full/helpers/services/getGasCost.js +++ b/test/integration/debt_bridge/from_maker/full/helpers/services/getGasCost.js @@ -4,16 +4,16 @@ module.exports = (route, withVaultCreation) => { let rawGasCost; switch (route) { case 0: - rawGasCost = 2000000; // 2290000 * 1,1 // gas left method measure : 2290000 - 2106637 = 183363 | gas reporter : 2290000 - 1789126 = 500874 + rawGasCost = 2519000; // 2290000 * 1,1 // gas left method measure : 2290000 - 2106637 = 183363 | gas reporter : 2290000 - 1789126 = 500874 break; case 1: - rawGasCost = 2400000; // 2855000 * 1,1 // gas left method measure : 2855000 - 2667325 = 187675 | gas reporter : 2855000 - 2244814 = 610186 + rawGasCost = 3140500; // 2855000 * 1,1 // gas left method measure : 2855000 - 2667325 = 187675 | gas reporter : 2855000 - 2244814 = 610186 break; case 2: - rawGasCost = 2850000; // 3610000 * 1,1 // gas left method measure : 3610000 - 3423279 = 186721 | gas reporter : 3610000 - 3031103 = 578897 + rawGasCost = 3971000; // 3610000 * 1,1 // gas left method measure : 3610000 - 3423279 = 186721 | gas reporter : 3610000 - 3031103 = 578897 break; case 3: - rawGasCost = 3500000; // 3950000 * 1,1 // gas left method measure : 3950000 - 3764004 = 185996 | gas reporter : 3950000 - 3313916 = 636084 + rawGasCost = 4345000; // 3950000 * 1,1 // gas left method measure : 3950000 - 3764004 = 185996 | gas reporter : 3950000 - 3313916 = 636084 break; default: break; diff --git a/test/unit/functions/0_FGelatoDebtBridge.test.js b/test/unit/functions/0_FGelatoDebtBridge.test.js index f80fd20..c86abd8 100644 --- a/test/unit/functions/0_FGelatoDebtBridge.test.js +++ b/test/unit/functions/0_FGelatoDebtBridge.test.js @@ -77,56 +77,56 @@ describe("FGelatoDebtBridge Unit Tests", function () { ).to.be.revertedWith("FGelatoDebtBridge._getFlashLoanRoute: illiquid"); }); - it("getGasCostMakerToMaker should return 3142800 gas limit for route 0 (Dydx) and new vault", async function () { + it("getGasCostMakerToMaker should return 3534700 gas limit for route 0 (Dydx) and new vault", async function () { const expectedGasCost = await getGasCost(0, true); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 0) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 3022800 gas limit for route 0 (Dydx)", async function () { + it("getGasCostMakerToMaker should return 3274700 gas limit for route 0 (Dydx)", async function () { const expectedGasCost = await getGasCost(0); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 0) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 3888600 gas limit for route 1 (maker) and new vault", async function () { + it("getGasCostMakerToMaker should return 4342650 gas limit for route 1 (maker) and new vault", async function () { const expectedGasCost = await getGasCost(1, true); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 1) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 3768600 gas limit for route 1 (maker)", async function () { + it("getGasCostMakerToMaker should return 4082650 gas limit for route 1 (maker)", async function () { const expectedGasCost = await getGasCost(1); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 1) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 4885200 gas limit for route 2 (compound) and new vault", async function () { + it("getGasCostMakerToMaker should return 5422300 gas limit for route 2 (compound) and new vault", async function () { const expectedGasCost = await getGasCost(2, true); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 2) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 4765200 gas limit for route 2 (compound)", async function () { + it("getGasCostMakerToMaker should return 5162300 gas limit for route 2 (compound)", async function () { const expectedGasCost = await getGasCost(2); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 2) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 5334000 gas limit for route 3 (aave) and new vault", async function () { + it("getGasCostMakerToMaker should return 5908500 gas limit for route 3 (aave) and new vault", async function () { const expectedGasCost = await getGasCost(3, true); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 3) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToMaker should return 5214000 gas limit for route 3 (aave)", async function () { + it("getGasCostMakerToMaker should return 5648500 gas limit for route 3 (aave)", async function () { const expectedGasCost = await getGasCost(3); expect( await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 3) @@ -141,28 +141,28 @@ describe("FGelatoDebtBridge Unit Tests", function () { ); }); - it("getGasCostMakerToCompound should return 3022800 gas limit for route 0 (Dydx)", async function () { + it("getGasCostMakerToCompound should return 3274700 gas limit for route 0 (Dydx)", async function () { const expectedGasCost = await getGasCost(0); expect( await fGelatoDebtBridgeMock.getGasCostMakerToCompound(0) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToCompound should return 3768600 gas limit for route 1 (Maker)", async function () { + it("getGasCostMakerToCompound should return 4082650 gas limit for route 1 (Maker)", async function () { const expectedGasCost = await getGasCost(1); expect( await fGelatoDebtBridgeMock.getGasCostMakerToCompound(1) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToCompound should return 4765200 gas limit for route 2 (Compound)", async function () { + it("getGasCostMakerToCompound should return 5162300 gas limit for route 2 (Compound)", async function () { const expectedGasCost = await getGasCost(2); expect( await fGelatoDebtBridgeMock.getGasCostMakerToCompound(2) ).to.be.equal(expectedGasCost); }); - it("getGasCostMakerToCompound should return 5214000 gas limit for route 3 (Aave)", async function () { + it("getGasCostMakerToCompound should return 5648500 gas limit for route 3 (Aave)", async function () { const expectedGasCost = await getGasCost(3); expect( await fGelatoDebtBridgeMock.getGasCostMakerToCompound(3)