Skip to content

Commit

Permalink
Allow to change WETH symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAmarok committed Dec 5, 2023
1 parent 707b515 commit aa1c6af
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/AxelarHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ contract AxelarHandler is
error NativePaymentFailed();
error WrappingNotEnabled();

bytes public constant DISABLED_SYMBOL =
keccak256(abi.encodePacked("DISABLED"));

bytes32 private _wETHSymbolHash;

string public wETHSymbol;
IAxelarGasService public gasService;

mapping(address => bool) public approved;

bytes32 public constant DISABLED_SYMBOL =
keccak256(abi.encodePacked("DISABLED"));

constructor() {
_disableInitializers();
}
Expand All @@ -64,6 +64,13 @@ contract AxelarHandler is
_wETHSymbolHash = keccak256(abi.encodePacked(wethSymbol));
}

function setWETHSybol(string memory wethSymbol) external {
if (bytes(wethSymbol).length == 0) revert EmptySymbol();

wETHSymbol = wethSymbol;
_wETHSymbolHash = keccak256(abi.encodePacked(wethSymbol));
}

/// @notice Sends native currency to other chains through the axelar gateway.
/// @param destinationChain name of the destination chain.
/// @param destinationAddress address of the destination wallet in string form.
Expand Down Expand Up @@ -306,7 +313,7 @@ contract AxelarHandler is
// If unwrap is set and the token can be unwrapped.
if (
unwrap &&
_wETHSymbolHash != DISABLED_SYMBOL
_wETHSymbolHash != DISABLED_SYMBOL &&
keccak256(abi.encodePacked(tokenSymbol)) == _wETHSymbolHash
) {
// Unwrap native token.
Expand Down

0 comments on commit aa1c6af

Please sign in to comment.