Platform: Code4rena
Start Date: 29/07/2022
Pot Size: $50,000 USDC
Total HM: 6
Participants: 75
Period: 5 days
Judge: GalloDaSballo
Total Solo HM: 3
Id: 149
League: ETH
Rank: 14/75
Findings: 2
Award: $195.99
π Selected for report: 0
π Solo Findings: 0
π Selected for report: oyc_109
Also found by: 0x1f8b, 0x52, 0xNazgul, 0xSmartContract, 0xf15ers, 8olidity, Aymen0909, Bnke0x0, CertoraInc, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, IllIllI, JC, Lambda, Noah3o6, NoamYakov, RedOneN, Respx, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, TomJ, Twpony, Waze, Yiko, __141345__, ajtra, apostle0x01, ashiq0x01, asutorufos, bardamu, benbaessler, berndartmueller, bharg4v, bulej93, c3phas, cccz, ch13fd357r0y3r, codexploder, cryptonue, cryptphi, defsec, djxploit, durianSausage, fatherOfBlocks, gogo, hansfriese, horsefacts, ignacio, kyteg, lucacez, mics, rbserver, robee, sashik_eth, simon135, sseefried, tofunmi, xiaoming90
136.7488 USDC - $136.75
receive()
function will lock Ether in contract :-receive() external payable {}
receive() external payable override {}
address(0x0)
when assigning values to address state variables :-https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L37 :
xc20Codehash = codehash_;
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L45 :
xc20Codehash = newCodehash;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L52 :
'AUTH_MODULE = authModule;'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L53 :
TOKEN_DEPLOYER_IMPLEMENTATION = tokenDeployerImplementation;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/deposit-service/DepositBase.sol#L24 :
gateway = gateway_;
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L27 :
gatewayAddress = gatewayAddress_;
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L63 :
payable(msg.sender).transfer(address(this).balance);
IERC20(wrappedTokenAddress).approve(gateway, amount);
IERC20(tokenAddress).approve(gateway, amount);
'IERC20(wrappedTokenAddress).approve(gateway, amount);'
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L320 :
(bool success, ) = address(this).call(abi.encodeWithSelector(commandSelector, params[i], commandId));
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L460#L463 :
function _callERC20Token(address tokenAddress, bytes memory callData) internal returns (bool) { (bool success, bytes memory returnData) = tokenAddress.call(callData); return success && (returnData.length == uint256(0) || abi.decode(returnData, (bool))); }
'(bool success, bytes memory returnData) = tokenAddress.call(abi.encodeWithSelector(IERC20.transfer.selector, receiver, amount));'
(bool success, bytes memory returnData) = tokenAddress.call( abi.encodeWithSelector(IERC20.transferFrom.selector, from, address(this), amount) );
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/deposit-service/DepositBase.sol#L71 :
(bool success, bytes memory returnData) = tokenAddress.call(abi.encodeWithSelector(IERC20.transfer.selector, receiver, amount));
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L95 :
(bool success, bytes memory returnData) = tokenAddress.call(abi.encodeWithSelector(IERC20.transfer.selector, receiver, amount));
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L106#L108 :
(bool success, bytes memory returnData) = tokenAddress.call( abi.encodeWithSelector(IERC20.transferFrom.selector, from, address(this), amount) );
for (uint256 i; i < tokens.length; i++) { address token = tokens[i];
for (uint256 i; i < refundTokens.length; i++) { refundToken = refundTokens[i];
'for (uint256 i; i < accounts.length - 1; ++i) { if (accounts[i] >= accounts[i + 1]) { return false; } }'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L182 :
return _adminEpoch();
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L55#L58 :
revert('NotAxelarToken()'); revert('NotXc20Token()'); revert('AlreadyWrappingAxelarToken()'); revert('AlreadyWrappingXC20Token()');
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L60#L61 :
revert('NotOwner()'); revert('CannotSetMetadata()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L68 :
'revert('NotAxelarToken()');'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L70 :
revert('NotWrappingToken()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L78#L79 :
revert('NotAxelarToken()'); revert('CannotMint()');
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L84#L86 :
revert('NotXc20Token()'); revert('InsufficientBalance()'); revert('CannotBurn()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L98 :
'revert('TransferFailed()');'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L111 :
revert('TransferFailed()');
string.concat()
to be used instead of abi.encodePacked(<str>,<str>)
) :-https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L3 :
pragma solidity 0.8.9;
pragma solidity 0.8.9;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/deposit-service/DepositBase.sol#L3 :
'pragma solidity 0.8.9;'
event
should use three indexed
fields if there are three or more fields) :-` event GasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, address gasToken, uint256 gasFeeAmount, address refundAddress );
event GasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress );
event NativeGasPaidForContractCall( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, uint256 gasFeeAmount, address refundAddress );
event NativeGasPaidForContractCallWithToken( address indexed sourceAddress, string destinationChain, string destinationAddress, bytes32 indexed payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress );
event GasAdded(bytes32 indexed txHash, uint256 indexed logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress);
event NativeGasAdded(bytes32 indexed txHash, uint256 indexed logIndex, uint256 gasFeeAmount, address refundAddress);`
event OperatorshipTransferred(address[] newOperators, uint256[] newWeights, uint256 newThreshold);
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L496 :
bool burnSuccess;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L152#L178 :
` function tokenDailyMintLimit(string memory symbol) public view override returns (uint256) { return getUint(_getTokenDailyMintLimitKey(symbol)); }
function tokenDailyMintAmount(string memory symbol) public view override returns (uint256) { return getUint(_getTokenDailyMintAmountKey(symbol, block.timestamp / 1 days)); }
function allTokensFrozen() external pure override returns (bool) { return false; }
function implementation() public view override returns (address) { return getAddress(KEY_IMPLEMENTATION); }
function tokenAddresses(string memory symbol) public view override returns (address) { return getAddress(_getTokenAddressKey(symbol)); }
function tokenFrozen(string memory) external pure override returns (bool) { return false; }
function isCommandExecuted(bytes32 commandId) public view override returns (bool) { return getBool(_getIsCommandExecutedKey(commandId)); }`
function addressForNativeDeposit( bytes32 salt, address refundAddress, string calldata destinationChain, string calldata destinationAddress ) public view returns (address) {
'function contractId() public pure returns (bytes32) {'
` function wrappedToken() public view returns (address) { return IAxelarGateway(gateway).tokenAddresses(wrappedSymbol()); }
// @dev Converts bytes32 from immutable storage into a string function wrappedSymbol() public view returns (string memory symbol) { bytes32 symbolData = wrappedSymbolBytes;`
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L30#L32 :
'function gateway() public view override returns (IAxelarGateway) { return IAxelarGateway(gatewayAddress); }'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L40#L42 :
' function contractId() public pure returns (bytes32) { return keccak256('xc20-wrapper'); }'
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IDepositBase.sol#L5 :
interface IDepositBase {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L4 :
uint8 internal constant OLD_KEY_RETENTION = 16;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L1 :
// SPDX-License-Identifier: MIT
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IDepositBase.sol#L1 :
// SPDX-License-Identifier: MIT
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/gas-service/AxelarGasService.sol#L1 :
'// SPDX-License-Identifier: MIT'
// SPDX-License-Identifier: MIT
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IAxelarAuth.sol#L1 :
// SPDX-License-Identifier: MIT
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IAxelarGasService.sol#L1 :
// SPDX-License-Identifier: MIT
'// SPDX-License-Identifier: MIT'
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/deposit-service/DepositBase.sol#L1 :
'// SPDX-License-Identifier: MIT'
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L1 :
// SPDX-License-Identifier: MIT
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L1 :
'// SPDX-License-Identifier: MIT'
#0 - re1ro
2022-08-05T02:20:45Z
Dup #2
Dup #3
Dup #4
Dup #3
Good spot
sponsor confirmed
Almost all those functions have code length check in the end tokenAddress.code.length == 0
Only .2
is valid _callERC20Token
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L460#L463
https://github.com/axelarnetwork/axelar-cgp-solidity/pull/138
Not applicable. Those functions are called by out services with a small arrays
Dup #13
Dup #13
Dup #3
You can't index strings without loosing the data
Ack
Those are used in the contract
Dup #3
#1 - GalloDaSballo
2022-08-28T22:09:50Z
L because of DepositService, the one for deposit Receiver is used by WETH
L
L
L
Only applies to this, rest has the check https://github.com/code-423n4/2022-07-axelar/blob/9c4c44b94cddbd48b9baae30051a4e13cbe39539/contracts/AxelarGateway.sol#L460
These are self-inflicted and easily avoidable - NC
Looks invalid
Disagree, descriptions are fine
NC
Disputed in lack of an example of what should be indexed
Disputed
NC
Wrong
4L 3NC
π Selected for report: IllIllI
Also found by: 0x1f8b, 0xNazgul, 0xsam, 8olidity, Aymen0909, Bnke0x0, Chom, CodingNameKiki, Deivitto, Dravee, ElKu, Fitraldys, JC, Lambda, MiloTruck, Noah3o6, NoamYakov, RedOneN, Respx, ReyAdmirado, Rohan16, Rolezn, Ruhum, Sm4rty, TomJ, Tomio, Waze, __141345__, a12jmx, ajtra, ak1, apostle0x01, asutorufos, benbaessler, bharg4v, bulej93, c3phas, defsec, djxploit, durianSausage, erictee, fatherOfBlocks, gerdusx, gogo, kyteg, lucacez, medikko, mics, owenthurm, oyc_109, rbserver, robee, sashik_eth, simon135, tofunmi
59.2384 USDC - $59.24
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L23 :
bytes32 public xc20Codehash;
x = x + y
is cheaper than x += y
:-File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L70 :
totalWeight += newWeights[i];
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L105:
weight += weights[operatorIndex];
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L207 :
for (uint256 i = 0; i < symbols.length; i++) {
for (uint256 i; i < tokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L17 :
for (uint256 i; i < recentOperators.length; ++i) {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L98 :
for (uint256 i = 0; i < signatures.length; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L116 :
for (uint256 i; i < accounts.length - 1; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L207 :
for (uint256 i = 0; i < symbols.length; i++) {
for (uint256 i; i < tokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
for (uint256 i; i < refundTokens.length; i++) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L17 :
for (uint256 i; i < recentOperators.length; ++i) {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L98 :
for (uint256 i = 0; i < signatures.length; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L116 :
for (uint256 i; i < accounts.length - 1; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L195 :
for (uint256 i; i < adminCount; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L292 :
ffor (uint256 i; i < commandsLength; ++i) {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L69 :
for (uint256 i = 0; i < weightsLength; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L182 :
return _adminEpoch();
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L207 :
for (uint256 i = 0; i < symbols.length; i++) {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L98 :
for (uint256 i = 0; i < signatures.length; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L116 :
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L69 :
for (uint256 i = 0; i < weightsLength; ++i) {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L14 :
uint8 internal constant OLD_KEY_RETENTION = 16;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L30#L43 :
`bytes32 internal constant PREFIX_COMMAND_EXECUTED = keccak256('command-executed'); bytes32 internal constant PREFIX_TOKEN_ADDRESS = keccak256('token-address'); bytes32 internal constant PREFIX_TOKEN_TYPE = keccak256('token-type'); bytes32 internal constant PREFIX_CONTRACT_CALL_APPROVED = keccak256('contract-call-approved'); bytes32 internal constant PREFIX_CONTRACT_CALL_APPROVED_WITH_MINT = keccak256('contract-call-approved-with-mint'); bytes32 internal constant PREFIX_TOKEN_DAILY_MINT_LIMIT = keccak256('token-daily-mint-limit'); bytes32 internal constant PREFIX_TOKEN_DAILY_MINT_AMOUNT = keccak256('token-daily-mint-amount');
bytes32 internal constant SELECTOR_BURN_TOKEN = keccak256('burnToken');
bytes32 internal constant SELECTOR_DEPLOY_TOKEN = keccak256('deployToken'); bytes32 internal constant SELECTOR_MINT_TOKEN = keccak256('mintToken'); bytes32 internal constant SELECTOR_APPROVE_CONTRACT_CALL = keccak256('approveContractCall'); bytes32 internal constant SELECTOR_APPROVE_CONTRACT_CALL_WITH_MINT = keccak256('approveContractCallWithMint'); bytes32 internal constant SELECTOR_TRANSFER_OPERATORSHIP = keccak256('transferOperatorship');`
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L55#L58 :
revert('NotAxelarToken()'); revert('NotXc20Token()'); revert('AlreadyWrappingAxelarToken()'); revert('AlreadyWrappingXC20Token()');
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L60#L61 :
revert('NotOwner()'); revert('CannotSetMetadata()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L68 :
'revert('NotAxelarToken()');'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L70 :
revert('NotWrappingToken()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L78#L79 :
revert('NotAxelarToken()'); revert('CannotMint()');
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L84#L86 :
revert('NotXc20Token()'); revert('InsufficientBalance()'); revert('CannotBurn()');
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L98 :
'revert('TransferFailed()');'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L111 :
revert('TransferFailed()');
onlyOwner
is used, the function will revert if a normal user tries to pay the function. Marking the function as payable
will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided.) :-https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L204 :
function setTokenDailyMintLimits(string[] calldata symbols, uint256[] calldata limits) external override onlyAdmin {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L217#L221 :
function upgrade( address newImplementation, bytes32 newImplementationCodeHash, bytes calldata setupParams ) external override onlyAdmin {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L331 :
'function deployToken(bytes calldata params, bytes32) external onlySelf {'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L367 :
function mintToken(bytes calldata params, bytes32) external onlySelf {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L373 :
function burnToken(bytes calldata params, bytes32) external onlySelf {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L397 :
function approveContractCall(bytes calldata params, bytes32 commandId) external onlySelf {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L411 :
'function approveContractCallWithMint(bytes calldata params, bytes32 commandId) external onlySelf {'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L437 :
function transferOperatorship(bytes calldata newOperatorsData, bytes32) external onlySelf {
function collectFees(address payable receiver, address[] calldata tokens) external onlyOwner {
function refund( address payable receiver, address token, uint256 amount ) external onlyOwner {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L47 :
'function transferOperatorship(bytes calldata params) external onlyOwner {'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L44 :
function setXc20Codehash(bytes32 newCodehash) external onlyOwner {
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L48#L53 :
function addWrapping( string calldata symbol, address xc20Token, string memory newName, string memory newSymbol ) external payable onlyOwner {
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L66 :
function removeWrapping(string calldata symbol) external onlyOwner {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L411 :
'function approveContractCallWithMint(bytes calldata params, bytes32 commandId) external onlySelf {'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L437 :
function transferOperatorship(bytes calldata newOperatorsData, bytes32) external onlySelf {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L3 :
pragma solidity 0.8.9;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IDepositBase.sol#L3 :
pragma solidity 0.8.9;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/gas-service/AxelarGasService.sol#L3 :
'pragma solidity 0.8.9;'
pragma solidity 0.8.9;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IAxelarAuth.sol#L3 :
pragma solidity 0.8.9;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/interfaces/IAxelarGasService.sol#L3 :
pragma solidity 0.8.9;
'pragma solidity 0.8.9;'
pragma solidity 0.8.9;
pragma solidity 0.8.9;
pragma solidity 0.8.9;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/deposit-service/DepositBase.sol#L3 :
'pragma solidity 0.8.9;'
pragma solidity 0.8.9;
pragma solidity 0.8.9;
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L3 :
pragma solidity 0.8.9;
File: https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L3 :
'pragma solidity 0.8.9;'
internal
functions only called once can be inlined to save gas :-https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L460 :
function _callERC20Token(address tokenAddress, bytes memory callData) internal returns (bool) {
https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L465#L469 :
function _mintToken( string memory symbol, address account, uint256 amount ) internal {
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L485#L489 :
'function _burnTokenFrom( address sender, string memory symbol, uint256 amount ) internal {'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L539#L557 :
`function _getTokenDailyMintLimitKey(string memory symbol) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_TOKEN_DAILY_MINT_LIMIT, symbol)); }
function _getTokenDailyMintAmountKey(string memory symbol, uint256 day) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(PREFIX_TOKEN_DAILY_MINT_AMOUNT, symbol, day)); } function _getTokenTypeKey(string memory symbol) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_TOKEN_TYPE, symbol)); } function _getTokenAddressKey(string memory symbol) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_TOKEN_ADDRESS, symbol)); } function _getIsCommandExecutedKey(bytes32 commandId) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_COMMAND_EXECUTED, commandId)); }`
5. https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/AxelarGateway.sol#L559#L658 :
` function _getIsContractCallApprovedKey( bytes32 commandId, string memory sourceChain, string memory sourceAddress, address contractAddress, bytes32 payloadHash ) internal pure returns (bytes32) { return keccak256(abi.encode(PREFIX_CONTRACT_CALL_APPROVED, commandId, sourceChain, sourceAddress, contractAddress, payloadHash)); } function _getIsContractCallApprovedWithMintKey( bytes32 commandId, string memory sourceChain, string memory sourceAddress, address contractAddress, bytes32 payloadHash, string memory symbol, uint256 amount ) internal pure returns (bytes32) { return keccak256( abi.encode( PREFIX_CONTRACT_CALL_APPROVED_WITH_MINT, commandId, sourceChain, sourceAddress, contractAddress, payloadHash, symbol, amount ) ); } /********************\ |* Internal Getters *| \********************/ function _getTokenType(string memory symbol) internal view returns (TokenType) { return TokenType(getUint(_getTokenTypeKey(symbol))); } /********************\ |* Internal Setters *| \********************/ function _setTokenDailyMintLimit(string memory symbol, uint256 limit) internal { _setUint(_getTokenDailyMintLimitKey(symbol), limit); emit TokenDailyMintLimitUpdated(symbol, limit); } function _setTokenDailyMintAmount(string memory symbol, uint256 amount) internal { uint256 limit = tokenDailyMintLimit(symbol); if (limit > 0 && amount > limit) revert ExceedDailyMintLimit(symbol); _setUint(_getTokenDailyMintAmountKey(symbol, block.timestamp / 1 days), amount); } function _setTokenType(string memory symbol, TokenType tokenType) internal { _setUint(_getTokenTypeKey(symbol), uint256(tokenType)); } function _setTokenAddress(string memory symbol, address tokenAddress) internal { _setAddress(_getTokenAddressKey(symbol), tokenAddress); } function _setCommandExecuted(bytes32 commandId, bool executed) internal { _setBool(_getIsCommandExecutedKey(commandId), executed); } function _setContractCallApproved( bytes32 commandId, string memory sourceChain, string memory sourceAddress, address contractAddress, bytes32 payloadHash ) internal { _setBool(_getIsContractCallApprovedKey(commandId, sourceChain, sourceAddress, contractAddress, payloadHash), true); } function _setContractCallApprovedWithMint( bytes32 commandId, string memory sourceChain, string memory sourceAddress, address contractAddress, bytes32 payloadHash, string memory symbol, uint256 amount ) internal { _setBool( _getIsContractCallApprovedWithMintKey(commandId, sourceChain, sourceAddress, contractAddress, payloadHash, symbol, amount), true ); } function _setImplementation(address newImplementation) internal { _setAddress(KEY_IMPLEMENTATION, newImplementation); }
}`
function _safeTransfer( address tokenAddress, address receiver, uint256 amount ) internal {
'function _safeTransferFrom( address tokenAddress, address from, uint256 amount ) internal {'
https://github.com/code-423n4/2022-07-axelar/blob/main/xc20/contracts/XC20Wrapper.sol#L20#L21 :
mapping(address => address) public wrapped; mapping(address => address) public unwrapped;
receive() external payable {}
receive() external payable override {}
'constructor(address gateway, string memory wrappedSymbol) DepositBase(gateway, wrappedSymbol) {}'
File: https://github.com/code-423n4/2022-07-axelar/blob/main/contracts/auth/AxelarAuthWeighted.sol#L101 :
for (; operatorIndex < operatorsLength && signer != operators[operatorIndex]; ++operatorIndex) {}
#0 - re1ro
2022-08-05T00:20:36Z
Not applicable. There is setXc20Codehash()
that changes the storage.
Yup. Dup #2
Yup. Dup #2
Yup. Dup #2
Correct. Good spot
Yup. Dup #2
Yup. Dup #7
Yup. Dup #12
Good spot
https://github.com/axelarnetwork/axelar-xc20-wrapper/pull/4
Yup. Dup #7
#10 Dup #3
#11 We prefer cleaner code.
#12 Not applicable. Dup #2
#13 Not applicable. Dup #2
#1 - GalloDaSballo
2022-08-20T22:30:33Z
Contracts are upgradeable, cannot be done
Not true https://twitter.com/GalloDaSballo/status/1543729080926871557
Less than 500 gas saved in total