Skip to content

Commit

Permalink
chore: enable cron for testnet gas info updates (#214)
Browse files Browse the repository at this point in the history
* ci: enable chron for testnet gas info updates

* ci: 12hr chron for gas updates

* fix(GasService): making onchainGasVolatilityMultiplier 2 by default

* fix(GasService): fixing optimized gas formula

* style(JS): prettier

* fix(GasService): keeping discounted estimation for testnet

* fix(GasService): updating formula with onchainGasVolatilityMultiplier

* fix(GasService): updating testnet config

* style(JS): prettier
  • Loading branch information
re1ro authored May 1, 2024
1 parent 4931c21 commit 48acddd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 134 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/update-gas-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
- mainnet
- stagenet

schedule:
- cron: '0 */12 * * *'

jobs:
update-gas:
name: 'Update Gas Info'
Expand Down
113 changes: 0 additions & 113 deletions axelar-chains-config/info/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,119 +340,6 @@
"finality": "1",
"approxFinalityWaitTime": 1
},
"polygon": {
"name": "Polygon",
"id": "Polygon",
"axelarId": "Polygon",
"chainId": 80001,
"rpc": "https://polygon-mumbai.g.alchemy.com/v2/Ksd4J1QVWaOJAJJNbr_nzTcJBJU-6uP3",
"tokenSymbol": "MATIC",
"contracts": {
"AxelarGateway": {
"address": "0xBF62ef1486468a6bd26Dd669C06db43dEd5B849B",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"implementation": "0x99B5FA03a5ea4315725c43346e55a6A6fbd94098",
"implementationCodehash": "0xb17ab564df4137d57dc47255a1890c32f98e02529d234d89cb6a8e2e71b2c6a0",
"authModule": "0xE39d7d526DFd7B6D10972708C77ED19c3f2f5625",
"tokenDeployer": "0xb28478319B64f8D47e19A120209A211D902F8b8f",
"deploymentMethod": "create3",
"salt": "AxelarGateway v6.2"
},
"AxelarGasService": {
"salt": "AxelarGasService",
"address": "0xbE406F0189A0B4cf3A05C286473D23791Dd44Cc6",
"implementation": "0x697F0BB8e15958a640EAD2C4D366B11Fc89a4c0e",
"deployer": "0xB8Cd93C83A974649D76B1c19f311f639e62272BC",
"collector": "0x7F83F5cA2AE4206AbFf8a3C3668e88ce5F11C0B5",
"owner": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05"
},
"AxelarDepositService": {
"salt": "AxelarDepositService",
"address": "0xc1DCb196BA862B337Aa23eDA1Cb9503C0801b955",
"implementation": "0xb6241272C569767072e0587098415DF6BA0aaEe9",
"deployer": "0xd55cd98cdE61c3CcE1286F9aF50cDbF16f5dba5b",
"wrappedSymbol": "WMATIC",
"refundIssuer": "0x4f671f34d2d23fec3eE3087E3A0221f8D314D9dF"
},
"ConstAddressDeployer": {
"address": "0x98B2920D53612483F91F12Ed7754E51b4A77919e"
},
"Create3Deployer": {
"salt": "Create3Deployer",
"address": "0x6513Aedb4D1593BA12e50644401D976aebDc90d8",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"deploymentMethod": "create2",
"codehash": "0xf0ad66defbe082df243d4d274e626f557f97579c5c9e19f33d8093d6160808b7",
"predeployCodehash": "0x73fc31262c4bad113c79439fd231281201c7c7d45b50328bd86bccf37684bf92"
},
"InterchainProposalSender": {
"address": "0x1f8A4d195B647647c7dD45650CBd553FD33cCAA6",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"deploymentMethod": "create3",
"salt": "InterchainProposalSender v1.2"
},
"Operators": {
"owner": "0xB8Cd93C83A974649D76B1c19f311f639e62272BC",
"address": "0x7F83F5cA2AE4206AbFf8a3C3668e88ce5F11C0B5",
"deployer": "0xB8Cd93C83A974649D76B1c19f311f639e62272BC",
"deploymentMethod": "create2",
"salt": "Operators"
},
"InterchainGovernance": {
"governanceChain": "Axelarnet",
"governanceAddress": "axelar10d07y265gmmuvt4z0w9aw880jnsr700j7v9daj",
"minimumTimeDelay": 300,
"address": "0xfDF36A30070ea0241d69052ea85ff44Ad0476a66",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"deploymentMethod": "create3",
"codehash": "0xf6e97396f1eaf0f74c057715baab06e5f7b1ef1f53d923dcea512475533033b1",
"predeployCodehash": "0xe2de43b29f2387b6f3575a1b50d566908fc00e03a8d88ad6be74b674a70874d2",
"salt": "InterchainGovernance v5.5"
},
"Multisig": {
"threshold": 2,
"signers": [
"0x15837c1318AB83d99b19392Fd4811813f520d843",
"0x64247a441CeF0b7A46614AC34d046c0fdfe35954",
"0xEE64c8eb48437DbD2D5B8598dc4A3E8a6c8CEaD9"
],
"address": "0xCC940AE49C78F20E3F13F3cF37e996b98Ac3EC68",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"deploymentMethod": "create3",
"codehash": "0x912095d5076ee40a9dd49c0f9d61d61334c47a78c7512852791652baef26c296",
"predeployCodehash": "0x912095d5076ee40a9dd49c0f9d61d61334c47a78c7512852791652baef26c296",
"salt": "Multisig v5.5"
},
"InterchainTokenService": {
"salt": "ITS v1.2.4",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"tokenManagerDeployer": "0x121b0e54Cd7ad2BBCb4c4C9275697978EBaF3653",
"interchainToken": "0x7F9F70Da4af54671a6abAc58e705b5634cac8819",
"interchainTokenDeployer": "0x58667c5f134420Bf6904C7dD01fDDcB4Fea3a760",
"tokenManager": "0x81a0545091864617E7037171FdfcBbdCFE3aeb23",
"tokenHandler": "0x07715674F74c560200c7C95430673180812fCE73",
"implementation": "0x6d59D9360BDAe406614b7E61c53F43a03198A4ef",
"address": "0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C",
"proxySalt": "ITS v1.0.0"
},
"InterchainTokenFactory": {
"salt": "ITS Factory v1.0.0",
"deployer": "0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05",
"implementation": "0xA852412D2d91fE05d790934B6E64C3C351fAB54f",
"address": "0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66"
}
},
"explorer": {
"name": "Polygonscan",
"url": "https://mumbai.polygonscan.com",
"api": "https://api-testnet.polygonscan.com/api"
},
"gasOptions": {
"gasLimit": 8000000
},
"finality": "finalized",
"approxFinalityWaitTime": 5
},
"moonbeam": {
"name": "Moonbeam",
"id": "Moonbeam",
Expand Down
32 changes: 11 additions & 21 deletions evm/gas-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async function getGasUpdates(config, env, chain, destinationChains) {
onchainGasEstimate: {
gasEstimationType = 0,
blobBaseFee = 0,
multiplier: onchainGasVolatilityMultiplier = 1.1,
multiplier: onchainGasVolatilityMultiplier = 1.5,
l1FeeScalar = 0,
} = {},
} = destinationConfig;
Expand All @@ -120,44 +120,34 @@ async function getGasUpdates(config, env, chain, destinationChains) {
return null;
}

let {
const {
destination_native_token: {
symbol: srcSymbol,
token_price: { usd: srcTokenPrice },
decimals: srcTokenDecimals,
},
ethereum_token: {
token_price: { usd: ethPrice },
},
} = sourceFeeData;

let {
const {
base_fee_usd: baseFeeUsd,
destination_express_fee: { total_usd: expressFeeUsd },
destination_native_token: {
symbol: destSymbol,
token_price: { usd: destTokenPrice },
gas_price_in_units: { value: gasPriceInDestToken },
decimals: destTokenDecimals,
},
execute_gas_multiplier: executeGasMultiplier = 1.1,
} = destinationFeeData;

if (srcSymbol === 'ETH' && srcTokenPrice === 100) {
srcTokenPrice = ethPrice;
}

if (destSymbol === 'ETH' && destTokenPrice === 100) {
destTokenPrice = ethPrice;
}

const axelarBaseFee = (parseFloat(baseFeeUsd) / parseFloat(srcTokenPrice)) * Math.pow(10, srcTokenDecimals);
const expressFee = (parseFloat(expressFeeUsd) / parseFloat(srcTokenPrice)) * Math.pow(10, srcTokenDecimals);
const axelarBaseFee =
onchainGasVolatilityMultiplier * (parseFloat(baseFeeUsd) / parseFloat(srcTokenPrice)) * Math.pow(10, srcTokenDecimals);
const expressFee =
onchainGasVolatilityMultiplier * (parseFloat(expressFeeUsd) / parseFloat(srcTokenPrice)) * Math.pow(10, srcTokenDecimals);
const gasPriceRatio = parseFloat(destTokenPrice) / parseFloat(srcTokenPrice);
const relativeGasPrice =
parseFloat(executeGasMultiplier) *
parseFloat(onchainGasVolatilityMultiplier) *
(parseFloat(gasPriceInDestToken) / gasPriceRatio);
const relativeBlobBaseFee = blobBaseFee * gasPriceRatio;
parseFloat(executeGasMultiplier) *
((parseFloat(gasPriceInDestToken) / Math.pow(10, destTokenDecimals)) * gasPriceRatio * Math.pow(10, srcTokenDecimals));
const relativeBlobBaseFee = onchainGasVolatilityMultiplier * blobBaseFee * gasPriceRatio;

const gasInfo = {
gasEstimationType,
Expand Down

0 comments on commit 48acddd

Please sign in to comment.