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!: rename axelar gmp executable and axelar gmp executable with token #191

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

pragma solidity ^0.8.0;

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

/**
* @title AxelarGMPExecutable
* @title AxelarExecutable
* @dev Abstract contract to be inherited by contracts that need to execute cross-chain commands via Axelar's Gateway.
* It implements the IAxelarGMPExecutable interface.
* It implements the IAxelarExecutable interface.
*/
abstract contract AxelarGMPExecutable is IAxelarGMPExecutable {
abstract contract AxelarExecutable is IAxelarExecutable {
/// @dev Reference to the Axelar Gateway contract.
address internal immutable gatewayAddress;

Expand Down Expand Up @@ -68,7 +68,7 @@ abstract contract AxelarGMPExecutable is IAxelarGMPExecutable {
* @notice Returns the address of the AxelarGMPGateway contract.
ahramy marked this conversation as resolved.
Show resolved Hide resolved
* @return The Axelar GMP Gateway instance.
ahramy marked this conversation as resolved.
Show resolved Hide resolved
*/
function gateway() public view returns (IAxelarGMPGateway) {
return IAxelarGMPGateway(gatewayAddress);
function gateway() public view returns (IAxelarGateway) {
return IAxelarGateway(gatewayAddress);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

pragma solidity ^0.8.0;

import { IAxelarGMPGatewayWithToken } from '../interfaces/IAxelarGMPGatewayWithToken.sol';
import { IAxelarGMPExecutableWithToken } from '../interfaces/IAxelarGMPExecutableWithToken.sol';
import { AxelarGMPExecutable } from './AxelarGMPExecutable.sol';
import { IAxelarGatewayWithToken } from '../interfaces/IAxelarGatewayWithToken.sol';
import { IAxelarExecutableWithToken } from '../interfaces/IAxelarExecutableWithToken.sol';
import { AxelarExecutable } from './AxelarExecutable.sol';

/**
* @title AxelarGMPExecutableWithToken
* @title AxelarExecutableWithToken
* @dev Abstract contract to be inherited by contracts that need to execute cross-chain commands involving tokens via Axelar's Gateway.
* It extends AxelarGMPExecutable and implements the IAxelarGMPExecutableWithToken interface.
* It extends AxelarExecutable and implements the IAxelarExecutableWithToken interface.
*/
abstract contract AxelarGMPExecutableWithToken is IAxelarGMPExecutableWithToken, AxelarGMPExecutable {
abstract contract AxelarExecutableWithToken is IAxelarExecutableWithToken, AxelarExecutable {
/**
* @dev Contract constructor that sets the Axelar Gateway With Token address and initializes AxelarGMPExecutable.
* @dev Contract constructor that sets the Axelar Gateway With Token address and initializes AxelarExecutable.
* @param gateway_ The address of the Axelar Gateway With Token contract.
*/
constructor(address gateway_) AxelarGMPExecutable(gateway_) {}
constructor(address gateway_) AxelarExecutable(gateway_) {}

/**
* @notice Executes the cross-chain command with token transfer after validating it with the Axelar Gateway.
Expand Down Expand Up @@ -74,10 +74,10 @@ abstract contract AxelarGMPExecutableWithToken is IAxelarGMPExecutableWithToken,
) internal virtual;

/**
* @notice Returns the address of the IAxelarGMPGatewayWithToken contract.
* @notice Returns the address of the IAxelarGatewayWithToken contract.
* @return The Axelar GMP Gateway with Token instance.
*/
function gatewayWithToken() internal view returns (IAxelarGMPGatewayWithToken) {
return IAxelarGMPGatewayWithToken(gatewayAddress);
function gatewayWithToken() internal view returns (IAxelarGatewayWithToken) {
return IAxelarGatewayWithToken(gatewayAddress);
}
}
16 changes: 8 additions & 8 deletions contracts/express/AxelarExpressExecutable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

pragma solidity ^0.8.0;

import { AxelarGMPExecutable } from '../executable/AxelarGMPExecutable.sol';
import { AxelarGMPExecutableWithToken } from '../executable/AxelarGMPExecutableWithToken.sol';
import { IAxelarGMPExecutable } from '../interfaces/IAxelarGMPExecutable.sol';
import { IAxelarGMPExecutableWithToken } from '../interfaces/IAxelarGMPExecutableWithToken.sol';
import { AxelarExecutable } from '../executable/AxelarExecutable.sol';
import { AxelarExecutableWithToken } from '../executable/AxelarExecutableWithToken.sol';
import { IAxelarExecutable } from '../interfaces/IAxelarExecutable.sol';
import { IAxelarExecutableWithToken } from '../interfaces/IAxelarExecutableWithToken.sol';
import { ExpressExecutorTracker } from './ExpressExecutorTracker.sol';
import { SafeTokenTransferFrom, SafeTokenTransfer } from '../libs/SafeTransfer.sol';
import { IERC20 } from '../interfaces/IERC20.sol';

abstract contract AxelarExpressExecutable is ExpressExecutorTracker, AxelarGMPExecutableWithToken {
abstract contract AxelarExpressExecutable is ExpressExecutorTracker, AxelarExecutableWithToken {
using SafeTokenTransfer for IERC20;
using SafeTokenTransferFrom for IERC20;

constructor(address gateway_) AxelarGMPExecutableWithToken(gateway_) {}
constructor(address gateway_) AxelarExecutableWithToken(gateway_) {}

function execute(
bytes32 commandId,
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) external override(AxelarGMPExecutable, IAxelarGMPExecutable) {
) external override(AxelarExecutable, IAxelarExecutable) {
bytes32 payloadHash = keccak256(payload);

if (!gateway().validateContractCall(commandId, sourceChain, sourceAddress, payloadHash))
Expand All @@ -44,7 +44,7 @@ abstract contract AxelarExpressExecutable is ExpressExecutorTracker, AxelarGMPEx
bytes calldata payload,
string calldata tokenSymbol,
uint256 amount
) external override(AxelarGMPExecutableWithToken, IAxelarGMPExecutableWithToken) {
) external override(AxelarExecutableWithToken, IAxelarExecutableWithToken) {
bytes32 payloadHash = keccak256(payload);
if (
!gatewayWithToken().validateContractCallAndMint(
Expand Down
16 changes: 8 additions & 8 deletions contracts/express/AxelarValuedExpressExecutable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

pragma solidity ^0.8.0;

import { AxelarGMPExecutable } from '../executable/AxelarGMPExecutable.sol';
import { AxelarGMPExecutableWithToken } from '../executable/AxelarGMPExecutableWithToken.sol';
import { IAxelarGMPExecutable } from '../interfaces/IAxelarGMPExecutable.sol';
import { IAxelarGMPExecutableWithToken } from '../interfaces/IAxelarGMPExecutableWithToken.sol';
import { AxelarExecutable } from '../executable/AxelarExecutable.sol';
import { AxelarExecutableWithToken } from '../executable/AxelarExecutableWithToken.sol';
import { IAxelarExecutable } from '../interfaces/IAxelarExecutable.sol';
import { IAxelarExecutableWithToken } from '../interfaces/IAxelarExecutableWithToken.sol';
import { IERC20 } from '../interfaces/IERC20.sol';
import { IAxelarValuedExpressExecutable } from '../interfaces/IAxelarValuedExpressExecutable.sol';
import { SafeTokenTransferFrom, SafeTokenTransfer } from '../libs/SafeTransfer.sol';
Expand All @@ -14,14 +14,14 @@ import { ExpressExecutorTracker } from './ExpressExecutorTracker.sol';

abstract contract AxelarValuedExpressExecutable is
ExpressExecutorTracker,
AxelarGMPExecutableWithToken,
AxelarExecutableWithToken,
IAxelarValuedExpressExecutable
{
using SafeTokenTransfer for IERC20;
using SafeTokenTransferFrom for IERC20;
using SafeNativeTransfer for address payable;

constructor(address gateway_) AxelarGMPExecutableWithToken(gateway_) {}
constructor(address gateway_) AxelarExecutableWithToken(gateway_) {}

// Returns the amount of token that this call is worth. If `tokenAddress` is `0`, then value is in terms of the native token, otherwise it's in terms of the token address.
function contractCallValue(
Expand All @@ -45,7 +45,7 @@ abstract contract AxelarValuedExpressExecutable is
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) external override(AxelarGMPExecutable, IAxelarGMPExecutable) {
) external override(AxelarExecutable, IAxelarExecutable) {
bytes32 payloadHash = keccak256(payload);

if (!gateway().validateContractCall(commandId, sourceChain, sourceAddress, payloadHash))
Expand Down Expand Up @@ -74,7 +74,7 @@ abstract contract AxelarValuedExpressExecutable is
bytes calldata payload,
string calldata tokenSymbol,
uint256 amount
) external override(AxelarGMPExecutableWithToken, IAxelarGMPExecutableWithToken) {
) external override(AxelarExecutableWithToken, IAxelarExecutableWithToken) {
bytes32 payloadHash = keccak256(payload);
if (
!gatewayWithToken().validateContractCallAndMint(
Expand Down
6 changes: 3 additions & 3 deletions contracts/governance/InterchainGovernance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.0;

import { AxelarGMPExecutable } from '../executable/AxelarGMPExecutable.sol';
import { AxelarExecutable } from '../executable/AxelarExecutable.sol';
import { TimeLock } from '../utils/TimeLock.sol';
import { SafeNativeTransfer } from '../libs/SafeNativeTransfer.sol';
import { IInterchainGovernance } from '../interfaces/IInterchainGovernance.sol';
Expand All @@ -13,7 +13,7 @@ import { Caller } from '../utils/Caller.sol';
* @notice This contract handles cross-chain governance actions. It includes functionality
* to create, cancel, and execute governance proposals.
*/
contract InterchainGovernance is AxelarGMPExecutable, TimeLock, Caller, IInterchainGovernance {
contract InterchainGovernance is AxelarExecutable, TimeLock, Caller, IInterchainGovernance {
using SafeNativeTransfer for address;

enum GovernanceCommand {
Expand All @@ -38,7 +38,7 @@ contract InterchainGovernance is AxelarGMPExecutable, TimeLock, Caller, IInterch
string memory governanceChain_,
string memory governanceAddress_,
uint256 minimumTimeDelay
) AxelarGMPExecutable(gateway_) TimeLock(minimumTimeDelay) {
) AxelarExecutable(gateway_) TimeLock(minimumTimeDelay) {
if (bytes(governanceChain_).length == 0 || bytes(governanceAddress_).length == 0) {
revert InvalidAddress();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

pragma solidity ^0.8.0;

import { IAxelarGMPGateway } from './IAxelarGMPGateway.sol';
import { IAxelarGateway } from './IAxelarGateway.sol';

/**
* @title IAxelarGMPExecutable
* @title IAxelarExecutable
* @dev Interface for a contract that is executable by Axelar Gateway's cross-chain message passing.
* It defines a standard interface to execute commands sent from another chain.
*/
interface IAxelarGMPExecutable {
interface IAxelarExecutable {
/**
* @dev Thrown when a function is called with an invalid address.
*/
Expand All @@ -24,7 +24,7 @@ interface IAxelarGMPExecutable {
* @notice Returns the address of the AxelarGMPGateway contract.
* @return The Axelar GMP Gateway contract associated with this executable contract.
*/
function gateway() external view returns (IAxelarGMPGateway);
function gateway() external view returns (IAxelarGateway);

/**
* @notice Executes the specified command sent from another chain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

pragma solidity ^0.8.0;

import { IAxelarGMPExecutable } from './IAxelarGMPExecutable.sol';
import { IAxelarExecutable } from './IAxelarExecutable.sol';

/**
* @title IAxelarGMPExecutableWithToken
* @title IAxelarExecutableWithToken
* @dev Interface for a contract that can execute commands from Axelar Gateway involving token transfers.
* It extends IAxelarGMPExecutable to include token-related functionality.
* It extends IAxelarExecutable to include token-related functionality.
*/
interface IAxelarGMPExecutableWithToken is IAxelarGMPExecutable {
interface IAxelarExecutableWithToken is IAxelarExecutable {
/**
* @notice Executes the specified command sent from another chain and includes a token transfer.
* @dev This function should be implemented to handle incoming commands that include token transfers.
* It will be called by an implementation of `IAxelarGMPGatewayWithToken`.
* It will be called by an implementation of `IAxelarGatewayWithToken`.
* @param commandId The identifier of the command to execute.
* @param sourceChain The name of the source chain from where the command originated.
* @param sourceAddress The address on the source chain that sent the command.
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IAxelarExpressExecutable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

pragma solidity ^0.8.0;

import { IAxelarGMPExecutableWithToken } from './IAxelarGMPExecutableWithToken.sol';
import { IAxelarExecutableWithToken } from './IAxelarExecutableWithToken.sol';

/**
* @title IAxelarExpressExecutable
* @notice Interface for the Axelar Express Executable contract.
*/
interface IAxelarExpressExecutable is IAxelarGMPExecutableWithToken {
interface IAxelarExpressExecutable is IAxelarExecutableWithToken {
// Custom errors
error AlreadyExecuted();
error InsufficientValue();
Expand Down
81 changes: 0 additions & 81 deletions contracts/interfaces/IAxelarGMPGateway.sol

This file was deleted.

Loading
Loading