Skip to content

Commit

Permalink
Merge branch 'main' of github.com:immutable/zkevm-bridge-contracts in…
Browse files Browse the repository at this point in the history
…to smr-1813-withdraw-erc20s
  • Loading branch information
Benjimmutable committed Nov 2, 2023
2 parents eb1c5bc + 0b76195 commit 024b4d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ yarn run execute evm/call-contract local Ethereum Polygon deposit
source .env
cast call --rpc-url $CHILD_RPC_URL "0x3b39f73D7De57Ed2Fe85C0F30374D839dc625b93" "balanceOf(address)(uint256)" "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
```
(Note: This assumed your address if the one associated with the above-specified private key)
(Note: This assumes your address is the one associated with the above-specified private key)
11 changes: 0 additions & 11 deletions src/child/ChildAxelarBridgeAdaptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ contract ChildAxelarBridgeAdaptor is
/**
* @notice Initializes the contract.
* @param _childBridge Address of the child bridge contract.
* @dev Always sets the rootBridgeAdaptor to whatever the rootERC20BridgeAdaptor of the bridge contract is.
*/
function initialize(string memory _rootChain, address _childBridge, address _gasService) external initializer {
if (_childBridge == address(0)) {
Expand All @@ -43,16 +42,6 @@ contract ChildAxelarBridgeAdaptor is
rootBridgeAdaptor = childBridge.rootERC20BridgeAdaptor();
}

// TODO tests for this
// TODO does this need to be permissioned?
/**
* @notice Sets the root bridge adaptor address.
* @dev Always sets it to whatever the rootERC20BridgeAdaptor of the bridge contract is.
*/
function setRootBridgeAdaptor() external {
rootBridgeAdaptor = childBridge.rootERC20BridgeAdaptor();
}

/**
* TODO
*/
Expand Down
18 changes: 6 additions & 12 deletions src/root/RootAxelarBridgeAdaptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {IRootERC20Bridge} from "../interfaces/root/IRootERC20Bridge.sol";

/**
* @notice RootAxelarBridgeAdaptor is a bridge adaptor that allows the RootERC20Bridge to communicate with the Axelar Gateway.
* @dev This is not an upgradeable contract, because it is trivial to deploy a new one if needed.
*/
contract RootAxelarBridgeAdaptor is
Initializable,
Expand All @@ -36,7 +35,11 @@ contract RootAxelarBridgeAdaptor is
mapping(uint256 => string) public chainIdToChainName;

/**
* @dev Always sets it to whatever the childBridgeAdaptor of the bridge contract is.
* @notice Initilization function for RootAxelarBridgeAdaptor.
* @param _rootBridge Address of root bridge contract.
* @param _childChain Name of child chain.
* @param _axelarGateway Address of Axelar Gateway contract.
* @param _gasService Address of Axelar Gas Service contract.
*/
function initialize(address _rootBridge, string memory _childChain, address _axelarGateway, address _gasService)
public
Expand All @@ -53,15 +56,6 @@ contract RootAxelarBridgeAdaptor is
childChain = _childChain;
axelarGateway = IAxelarGateway(_axelarGateway);
gasService = IAxelarGasService(_gasService);
childBridgeAdaptor = IRootERC20Bridge(rootBridge).childBridgeAdaptor();
}

/**
* @notice Sets the child bridge adaptor address.
* @dev Always sets it to whatever the childBridgeAdaptor of the bridge contract is.
*/
function setChildBridgeAdaptor() external {
childBridgeAdaptor = IRootERC20Bridge(rootBridge).childBridgeAdaptor();
}

/**
Expand All @@ -77,7 +71,7 @@ contract RootAxelarBridgeAdaptor is
}

// Load from storage.
string memory _childBridgeAdaptor = childBridgeAdaptor;
string memory _childBridgeAdaptor = IRootERC20Bridge(rootBridge).childBridgeAdaptor();
string memory _childChain = childChain;

// TODO For `sender` (first param), should likely be refundRecipient (and in which case refundRecipient should be renamed to sender and used as refund recipient)
Expand Down
2 changes: 0 additions & 2 deletions test/unit/root/RootAxelarBridgeAdaptor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ contract RootAxelarBridgeAdaptorTest is Test, IRootAxelarBridgeAdaptorEvents, IR
axelarAdaptor.initialize(
address(stubRootBridge), CHILD_CHAIN_NAME, address(mockAxelarGateway), address(axelarGasService)
);
axelarAdaptor.setChildBridgeAdaptor();
vm.deal(address(stubRootBridge), 99999999999);
}

function test_Constructor() public {
assertEq(axelarAdaptor.rootBridge(), address(stubRootBridge), "rootBridge not set");
assertEq(axelarAdaptor.childBridgeAdaptor(), childBridgeAdaptor, "childBridgeAdaptor not set");
assertEq(axelarAdaptor.childChain(), CHILD_CHAIN_NAME, "childChain not set");
assertEq(address(axelarAdaptor.axelarGateway()), address(mockAxelarGateway), "axelarGateway not set");
assertEq(address(axelarAdaptor.gasService()), address(axelarGasService), "axelarGasService not set");
Expand Down

0 comments on commit 024b4d9

Please sign in to comment.