Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GasService): updated estimation dependency #279

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions contracts/gas-service/AxelarGasService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

re1ro marked this conversation as resolved.
Show resolved Hide resolved
import { IERC20 } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IERC20.sol';
re1ro marked this conversation as resolved.
Show resolved Hide resolved
import { IAxelarGasService } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol';
import { InterchainGasEstimation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/gas-estimation/InterchainGasEstimation.sol';
import { InterchainGasEstimation, GasInfo } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/gas-estimation/InterchainGasEstimation.sol';
milapsheth marked this conversation as resolved.
Show resolved Hide resolved
import { Upgradable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Upgradable.sol';
import { SafeTokenTransfer, SafeTokenTransferFrom } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol';
import { SafeNativeTransfer } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeNativeTransfer.sol';
Expand All @@ -20,8 +20,6 @@ contract AxelarGasService is InterchainGasEstimation, Upgradable, IAxelarGasServ
using SafeTokenTransferFrom for IERC20;
using SafeNativeTransfer for address payable;

error InvalidParams();

address public immutable gasCollector;

/**
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-cgp-solidity",
"version": "6.3.0",
"version": "6.3.1",
re1ro marked this conversation as resolved.
Show resolved Hide resolved
"description": "EVM Smart Contracts for Axelar Network",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/axelarnetwork/axelar-cgp-solidity#readme",
"dependencies": {
"@axelar-network/axelar-gmp-sdk-solidity": "5.7.0"
"@axelar-network/axelar-gmp-sdk-solidity": "5.8.0"
},
"devDependencies": {
"@0xpolygonhermez/zkevm-commonjs": "github:0xpolygonhermez/zkevm-commonjs#v1.0.0",
Expand Down
35 changes: 28 additions & 7 deletions test/gmp/AxelarGasService.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,32 @@ describe('AxelarGasService', () => {
});

describe('Gas Estimation', () => {
const chains = ['ethereum', 'optimism', 'base'];
const chains = ['ethereum', 'optimism', 'arbitrum'];
const gasUpdates = [
[0, '110227069355211', '278470919016084', '3800724', '1395265596'],
[1, '110898281163494', '278128885876991', '3066', '0'],
[1, '123127735536005', '279194214965138', '30593', '0'],
{
gasEstimationType: 0,
l1FeeScalar: 0,
axelarBaseFee: 90000000000,
relativeGasPrice: 50000000000,
relativeBlobBaseFee: 1,
expressFee: 190000000000,
},
{
gasEstimationType: 1,
l1FeeScalar: 1500,
axelarBaseFee: 90000,
relativeGasPrice: 5000,
relativeBlobBaseFee: 0,
expressFee: 190000,
},
{
gasEstimationType: 3,
l1FeeScalar: 0,
axelarBaseFee: 90000,
relativeGasPrice: 5000,
relativeBlobBaseFee: 0,
expressFee: 190000,
},
];

it('should allow the collector to update gas info', async () => {
Expand All @@ -653,15 +674,15 @@ describe('AxelarGasService', () => {

await expect(gasService.connect(ownerWallet).updateGasInfo(chains, gasUpdates))
.to.emit(gasService, 'GasInfoUpdated')
.withArgs(chains[0], gasUpdates[0]);
.withArgs(chains[0], Object.values(gasUpdates[0]));

for (let i = 0; i < chains.length; i++) {
const chain = chains[i];
const gasInfo = gasUpdates[i];

let result = await gasService.getGasInfo(chain);
result = Array.from(result).map((x) => (x.toNumber ? x.toNumber().toString() : x));
expect(result).to.be.deep.equal(gasInfo);
expect(result).to.be.deep.equal(Object.values(gasInfo));
}
});

Expand Down Expand Up @@ -715,7 +736,7 @@ describe('AxelarGasService', () => {
params,
);

expect(gasEstimate).to.be.equal(111288142881657);
expect(gasEstimate).to.be.equal(374600090277);

await expectRevert(
(gasOptions) =>
Expand Down
Loading