fix: adjusted gas constants debt bridge

This commit is contained in:
gitpusha 2020-11-28 16:46:31 +01:00 committed by Twin Fish
parent 5e81d8ce75
commit b3600300fa
6 changed files with 10 additions and 11 deletions

View File

@ -95,7 +95,7 @@ contract MockDebtBridgeETHBExecutor {
// console.log("Gas Cost execViaRoute3: %s", gasLeft - gasleft()); // console.log("Gas Cost execViaRoute3: %s", gasLeft - gasleft());
} }
function execViaRoute3AndOpenVAult(TaskReceipt memory _taskReceipt) public { function execViaRoute3AndOpenVault(TaskReceipt memory _taskReceipt) public {
// uint256 gasLeft = gasleft(); // uint256 gasLeft = gasleft();
IGelatoCore(gelatoCore).exec(_taskReceipt); IGelatoCore(gelatoCore).exec(_taskReceipt);
// console.log( // console.log(

View File

@ -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(2519000), 3140500, 3971000, 4345000]; return [uint256(2000000), 2400000, 2850000, 3500000];
} }
uint256 constant PREMIUM = 20; uint256 constant PREMIUM = 20;
uint256 constant VAULT_CREATION_COST = 100000; uint256 constant VAULT_CREATION_COST = 150000;

View File

@ -63,8 +63,7 @@ contract ConditionDestVaultWillBeSafe is GelatoConditionsStandard {
uint256 _destVaultId, uint256 _destVaultId,
string memory _destColType string memory _destColType
) public view returns (string memory) { ) public view returns (string memory) {
uint256 _destVaultId = _destVaultId = _isVaultOwner(_destVaultId, _dsa) ? _destVaultId : 0;
_isVaultOwner(_destVaultId, _dsa) ? _destVaultId : 0;
uint256 wDaiToBorrow = uint256 wDaiToBorrow =
_getRealisedDebt(_getMakerVaultDebt(_fromVaultId)); _getRealisedDebt(_getMakerVaultDebt(_fromVaultId));
uint256 wColToDeposit = uint256 wColToDeposit =

View File

@ -80,7 +80,7 @@ module.exports = async function (
await expect( await expect(
contracts.mockDebtBridgeETHBExecutor contracts.mockDebtBridgeETHBExecutor
.connect(wallets.executor) .connect(wallets.executor)
.execViaRoute3AndOpenVAult(taskReceipt, { .execViaRoute3AndOpenVault(taskReceipt, {
gasPrice: gelatoGasPrice, // Exectutor must use gelatoGasPrice (Chainlink fast gwei) gasPrice: gelatoGasPrice, // Exectutor must use gelatoGasPrice (Chainlink fast gwei)
gasLimit: constants.GAS_LIMIT, gasLimit: constants.GAS_LIMIT,
}) })

View File

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

View File

@ -4,16 +4,16 @@ module.exports = (route, withVaultCreation) => {
let rawGasCost; let rawGasCost;
switch (route) { switch (route) {
case 0: case 0:
rawGasCost = 2519000; // 2290000 * 1,1 // gas left method measure : 2290000 - 2106637 = 183363 | gas reporter : 2290000 - 1789126 = 500874 rawGasCost = 2000000; // 2290000 * 1,1 // gas left method measure : 2290000 - 2106637 = 183363 | gas reporter : 2290000 - 1789126 = 500874
break; break;
case 1: case 1:
rawGasCost = 3140500; // 2855000 * 1,1 // gas left method measure : 2855000 - 2667325 = 187675 | gas reporter : 2855000 - 2244814 = 610186 rawGasCost = 2400000; // 2855000 * 1,1 // gas left method measure : 2855000 - 2667325 = 187675 | gas reporter : 2855000 - 2244814 = 610186
break; break;
case 2: case 2:
rawGasCost = 3971000; // 3610000 * 1,1 // gas left method measure : 3610000 - 3423279 = 186721 | gas reporter : 3610000 - 3031103 = 578897 rawGasCost = 2850000; // 3610000 * 1,1 // gas left method measure : 3610000 - 3423279 = 186721 | gas reporter : 3610000 - 3031103 = 578897
break; break;
case 3: case 3:
rawGasCost = 4345000; // 3950000 * 1,1 // gas left method measure : 3950000 - 3764004 = 185996 | gas reporter : 3950000 - 3313916 = 636084 rawGasCost = 3500000; // 3950000 * 1,1 // gas left method measure : 3950000 - 3764004 = 185996 | gas reporter : 3950000 - 3313916 = 636084
break; break;
default: default:
break; break;