Skip to content

Commit

Permalink
feat(Executable): adding GMP Express Executable (#17)
Browse files Browse the repository at this point in the history
* fix(ci): upgrading actions

* feature(Upgradable): 2 step ownership transfer

* refactor(test): var names

* feature(Upgradable): 2 step

* chore(npm): version bump

* feat(Executable): new GMP Express Executable (#19)

* feature(executable): GMP Express

* fix(build): copy artifacts

* fix(deployAndInitContractConstant): increasing gas limit

* feat(GMPExpress): permission-less express calls

* fix(ExpressRegistry): using msg.sender

* refactor(SafeTransfer): using SafeTransfer library for IERC20

* refactor(interfaces): removed unused imports

* fix(Express): constructor params validation

* fix(ExpressProxy): token validation

* fix(ExpressExecutable): removing Upgradable from ExpressExecutable

* feat(interfaces): updating the interfaces
  • Loading branch information
re1ro authored Jan 26, 2023
1 parent 882a82d commit f0222fe
Show file tree
Hide file tree
Showing 38 changed files with 1,225 additions and 891 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ contract AxelarExecutable is IAxelarExecutable {
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) external override {
) external {
bytes32 payloadHash = keccak256(payload);

if (!gateway.validateContractCall(commandId, sourceChain, sourceAddress, payloadHash))
revert NotApprovedByGateway();

_execute(sourceChain, sourceAddress, payload);
}

Expand All @@ -33,8 +35,9 @@ contract AxelarExecutable is IAxelarExecutable {
bytes calldata payload,
string calldata tokenSymbol,
uint256 amount
) external override {
) external {
bytes32 payloadHash = keccak256(payload);

if (
!gateway.validateContractCallAndMint(
commandId,
Expand Down
243 changes: 0 additions & 243 deletions contracts/executables/AxelarForecallable.sol

This file was deleted.

55 changes: 55 additions & 0 deletions contracts/express/ExpressExecutable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import { IAxelarGateway } from '../interfaces/IAxelarGateway.sol';
import { IERC20 } from '../interfaces/IERC20.sol';
import { IAxelarExecutable } from '../interfaces/IAxelarExecutable.sol';

abstract contract ExpressExecutable is IAxelarExecutable {
error NotSelf();

IAxelarGateway public immutable gateway;

constructor(address gateway_) {
if (gateway_ == address(0)) revert InvalidAddress();

gateway = IAxelarGateway(gateway_);
}

/// @notice this function is shadowed by the proxy and can be called only internally
function execute(
bytes32,
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) external {
_execute(sourceChain, sourceAddress, payload);
}

/// @notice this function is shadowed by the proxy and can be called only internally
function executeWithToken(
bytes32,
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload,
string calldata tokenSymbol,
uint256 amount
) external {
_executeWithToken(sourceChain, sourceAddress, payload, tokenSymbol, amount);
}

function _execute(
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) internal virtual {}

function _executeWithToken(
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload,
string calldata tokenSymbol,
uint256 amount
) internal virtual {}
}
Loading

0 comments on commit f0222fe

Please sign in to comment.