Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjimmutable committed Nov 1, 2023
1 parent 40c4992 commit ec43e7d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
14 changes: 11 additions & 3 deletions src/child/ChildAxelarBridgeAdaptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ import {IAxelarGasService} from "@axelar-cgp-solidity/contracts/interfaces/IAxel
import {IAxelarGateway} from "@axelar-cgp-solidity/contracts/interfaces/IAxelarGateway.sol";
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import {IChildERC20Bridge} from "../interfaces/child/IChildERC20Bridge.sol";
import {IChildAxelarBridgeAdaptorErrors, IChildAxelarBridgeAdaptorEvents} from "../interfaces/child/IChildAxelarBridgeAdaptor.sol";
import {
IChildAxelarBridgeAdaptorErrors,
IChildAxelarBridgeAdaptorEvents
} from "../interfaces/child/IChildAxelarBridgeAdaptor.sol";
import {IChildERC20BridgeAdaptor} from "../interfaces/child/IChildERC20BridgeAdaptor.sol";

contract ChildAxelarBridgeAdaptor is AxelarExecutable, IChildERC20BridgeAdaptor, Initializable, IChildAxelarBridgeAdaptorErrors,
IChildAxelarBridgeAdaptorEvents {
contract ChildAxelarBridgeAdaptor is
AxelarExecutable,
IChildERC20BridgeAdaptor,
Initializable,
IChildAxelarBridgeAdaptorErrors,
IChildAxelarBridgeAdaptorEvents
{
/// @notice Address of bridge to relay messages to.
IChildERC20Bridge public childBridge;
IAxelarGasService public gasService;
Expand Down
3 changes: 1 addition & 2 deletions src/child/ChildERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ contract ChildERC20Bridge is
}
}


function withdraw(IChildERC20 childToken, uint256 amount) external {
_withdraw(childToken, msg.sender, amount);
}
Expand Down Expand Up @@ -165,7 +164,7 @@ contract ChildERC20Bridge is

// Send the message to the bridge adaptor and up to root chain
bridgeAdaptor.sendMessage{value: msg.value}(payload, msg.sender);

// TODO emit event
emit ChildChainERC20Withdraw(rootToken, address(childToken), msg.sender, receiver, amount);
}
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/child/IChildAxelarBridgeAdaptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ interface IChildAxelarBridgeAdaptorErrors {
interface IChildAxelarBridgeAdaptorEvents {
/// @notice Emitted when an Axelar message is sent to the root chain.
event MapTokenAxelarMessage(string indexed rootChain, string indexed rootBridgeAdaptor, bytes indexed payload);
}
}
8 changes: 7 additions & 1 deletion src/interfaces/child/IChildERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ interface IChildERC20BridgeEvents {
/// @notice Emitted when a map token message is received from the root chain and executed successfully.
event L2TokenMapped(address rootToken, address childToken);

event ChildChainERC20Withdraw(address indexed rootToken, address indexed childToken, address depositor, address indexed receiver, uint256 amount);
event ChildChainERC20Withdraw(
address indexed rootToken,
address indexed childToken,
address depositor,
address indexed receiver,
uint256 amount
);

event ChildChainERC20Deposit(
address indexed rootToken,
Expand Down
12 changes: 12 additions & 0 deletions src/test/child/MockChildAxelarGasService.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.21;

contract MockChildAxelarGasService {
function payNativeGasForContractCall(
address sender,
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
address refundAddress
) external payable {}
}
4 changes: 3 additions & 1 deletion test/integration/child/ChildAxelarBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ contract ChildERC20BridgeIntegrationTest is Test, IChildERC20BridgeEvents, IChil
IMX_TOKEN_ADDRESS
);

childAxelarBridgeAdaptor.initialize(ROOT_CHAIN_NAME, address(childERC20Bridge), address(mockChildAxelarGasService));
childAxelarBridgeAdaptor.initialize(
ROOT_CHAIN_NAME, address(childERC20Bridge), address(mockChildAxelarGasService)
);
}

function test_ChildTokenMap() public {
Expand Down
1 change: 1 addition & 0 deletions test/unit/child/withdrawals/ChildERC20BridgeWithdraw.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit ec43e7d

Please sign in to comment.