diff --git a/contracts/optimism/connectors/connext/events.sol b/contracts/optimism/connectors/connext/events.sol index 2a9da14b..a1d7e441 100644 --- a/contracts/optimism/connectors/connext/events.sol +++ b/contracts/optimism/connectors/connext/events.sol @@ -3,12 +3,12 @@ pragma solidity ^0.7.0; contract Events { event LogXCall( - uint32 destination, - address to, - address asset, - address delegate, - uint256 amount, - uint256 slippage, + uint32 destination, + address to, + address asset, + address delegate, + uint256 amount, + uint256 slippage, uint256 getId ); -} \ No newline at end of file +} diff --git a/contracts/optimism/connectors/connext/helpers.sol b/contracts/optimism/connectors/connext/helpers.sol index bc91cc21..5adddd7a 100644 --- a/contracts/optimism/connectors/connext/helpers.sol +++ b/contracts/optimism/connectors/connext/helpers.sol @@ -8,17 +8,20 @@ import { IConnext } from "./interface.sol"; import { IInstaReceiver } from "./interface.sol"; contract Helpers is DSMath, Basic { - /** - * @dev Connext Diamond Address - */ - address internal constant connextAddr = 0x8f7492DE823025b4CfaAB1D34c58963F2af5DEDA; + /** + * @dev Connext Diamond Address + */ + address internal constant connextAddr = + 0x8f7492DE823025b4CfaAB1D34c58963F2af5DEDA; IConnext internal constant connext = IConnext(connextAddr); - /** - * @dev InstaReceiver Address - */ - address internal constant instaReceiverAddr = 0x0000000000000000000000000000000000000000; // TODO: Add InstaReceiver address - IInstaReceiver internal constant instaReceiver = IInstaReceiver(instaReceiverAddr); + /** + * @dev InstaReceiver Address + */ + address internal constant instaReceiverAddr = + 0x0000000000000000000000000000000000000000; // TODO: Add InstaReceiver address + IInstaReceiver internal constant instaReceiver = + IInstaReceiver(instaReceiverAddr); /** * @param destination The destination domain ID. @@ -30,14 +33,14 @@ contract Helpers is DSMath, Basic { * @param callData Encoded calldata to send. */ struct XCallParams { - uint32 destination; - address to; - address asset; - address delegate; - uint256 amount; - uint256 slippage; - uint256 relayerFee; - bytes callData; + uint32 destination; + address to; + address asset; + address delegate; + uint256 amount; + uint256 slippage; + uint256 relayerFee; + bytes callData; } function _xcall(XCallParams memory params) internal { @@ -49,7 +52,7 @@ contract Helpers is DSMath, Basic { ? address(this).balance : params.amount; - // xcall does not take native asset, must wrap + // xcall does not take native asset, must wrap TokenInterface tokenContract = TokenInterface(wethAddr); convertEthToWeth(true, tokenContract, params.amount); @@ -70,11 +73,11 @@ contract Helpers is DSMath, Basic { connext.xcall{ value: params.relayerFee + nativeTokenAmt }( params.destination, params.to, - params.asset, + params.asset, params.delegate, params.amount, params.slippage, params.callData ); } -} \ No newline at end of file +} diff --git a/contracts/optimism/connectors/connext/interface.sol b/contracts/optimism/connectors/connext/interface.sol index 4c8886bd..d3597982 100644 --- a/contracts/optimism/connectors/connext/interface.sol +++ b/contracts/optimism/connectors/connext/interface.sol @@ -2,29 +2,28 @@ pragma solidity ^0.7.0; interface IConnext { - function xcall( - uint32 _destination, - address _to, - address _asset, - address _delegate, - uint256 _amount, - uint256 _slippage, - bytes calldata _callData - ) external payable returns (bytes32); + function xcall( + uint32 _destination, + address _to, + address _asset, + address _delegate, + uint256 _amount, + uint256 _slippage, + bytes calldata _callData + ) external payable returns (bytes32); } interface IInstaReceiver { - function withdraw( - address _asset, - uint256 _amount - ) external returns (bytes memory); + function withdraw(address _asset, uint256 _amount) + external + returns (bytes memory); - function xReceive( - bytes32 _transferId, - uint256 _amount, - address _asset, - address _originSender, - uint32 _origin, - bytes memory _callData - ) external returns (bytes memory); -} \ No newline at end of file + function xReceive( + bytes32 _transferId, + uint256 _amount, + address _asset, + address _originSender, + uint32 _origin, + bytes memory _callData + ) external returns (bytes memory); +} diff --git a/contracts/optimism/connectors/connext/main.sol b/contracts/optimism/connectors/connext/main.sol index b1155002..64b14aca 100644 --- a/contracts/optimism/connectors/connext/main.sol +++ b/contracts/optimism/connectors/connext/main.sol @@ -1,101 +1,48 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.7.0; - pragma experimental ABIEncoderV2; - - - /** - * @title Connext. - * @dev Cross chain bridge. - */ - - - import { TokenInterface, MemoryInterface } from "../../common/interfaces.sol"; - import { Stores } from "../../common/stores.sol"; import "./interface.sol"; - import "./helpers.sol"; - import "./events.sol"; - - - abstract contract ConnextResolver is Helpers { - /** - * @dev Call xcall on Connext. - * @notice Call xcall on Connext. - * @param params XCallParams struct. - * @param getId ID to retrieve amount from last spell. - */ - function xcall(XCallParams memory params, uint256 getId) - external - payable - returns (string memory _eventName, bytes memory _eventParam) - { - params.amount = getUint(getId, params.amount); - TokenInterface tokenContract = TokenInterface(params.asset); - - - - _xcall(params); - - - - _eventName = "LogXCall(uint32,address,address,address,uint256,uint256,uint256)"; - _eventParam = abi.encode( - params.destination, - params.to, - - params.asset, - + params.asset, params.delegate, - params.amount, - params.slippage, - getId - ); - } - } - - - contract ConnectV2ConnextOptimism is ConnextResolver { - string public constant name = "Connext-v1.0"; - -} \ No newline at end of file +}