change gas cost constants (#89)

* increase debt bridge gas cost constants and premium
This commit is contained in:
Twin Fish 2020-11-30 11:13:40 +01:00 committed by GitHub
parent 76c08575f9
commit a8877205af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 21 deletions

View File

@ -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;

View File

@ -1,4 +1,4 @@
module.exports = {
PREMIUM: 20,
VAULT_CREATION_COST: 150000,
PREMIUM: 30,
VAULT_CREATION_COST: 200000,
};

View File

@ -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;

View File

@ -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)