mirror of
https://github.com/Instadapp/Gelato-automations.git
synced 2024-07-29 22:28:07 +00:00
change gas cost constants (#89)
* increase debt bridge gas cost constants and premium
This commit is contained in:
parent
76c08575f9
commit
a8877205af
|
@ -2,8 +2,8 @@
|
||||||
pragma solidity 0.7.4;
|
pragma solidity 0.7.4;
|
||||||
|
|
||||||
function GAS_COSTS_FOR_FULL_REFINANCE() pure returns (uint256[4] memory) {
|
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 PREMIUM = 30;
|
||||||
uint256 constant VAULT_CREATION_COST = 150000;
|
uint256 constant VAULT_CREATION_COST = 200000;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
PREMIUM: 20,
|
PREMIUM: 30,
|
||||||
VAULT_CREATION_COST: 150000,
|
VAULT_CREATION_COST: 200000,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,16 +4,16 @@ module.exports = (route, withVaultCreation) => {
|
||||||
let rawGasCost;
|
let rawGasCost;
|
||||||
switch (route) {
|
switch (route) {
|
||||||
case 0:
|
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;
|
break;
|
||||||
case 1:
|
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;
|
break;
|
||||||
case 2:
|
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;
|
break;
|
||||||
case 3:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -77,56 +77,56 @@ describe("FGelatoDebtBridge Unit Tests", function () {
|
||||||
).to.be.revertedWith("FGelatoDebtBridge._getFlashLoanRoute: illiquid");
|
).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);
|
const expectedGasCost = await getGasCost(0, true);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 0)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 0)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(0);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 0)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 0)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(1, true);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 1)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 1)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(1);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 1)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 1)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(2, true);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 2)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 2)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(2);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 2)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 2)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(3, true);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 3)
|
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(true, 3)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(3);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToMaker(false, 3)
|
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);
|
const expectedGasCost = await getGasCost(0);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(0)
|
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(0)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(1);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(1)
|
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(1)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(2);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(2)
|
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(2)
|
||||||
).to.be.equal(expectedGasCost);
|
).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);
|
const expectedGasCost = await getGasCost(3);
|
||||||
expect(
|
expect(
|
||||||
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(3)
|
await fGelatoDebtBridgeMock.getGasCostMakerToCompound(3)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user