dsa-connectors/contracts/optimism/connectors/connext/helpers.sol

49 lines
1.3 KiB
Solidity
Raw Normal View History

2023-03-13 09:00:54 +00:00
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import { TokenInterface } from "../../common/interfaces.sol";
import { DSMath } from "../../common/math.sol";
import { Basic } from "../../common/basic.sol";
import { IConnext } from "./interface.sol";
contract Helpers is DSMath, Basic {
2023-03-13 09:02:29 +00:00
/**
* @dev Connext Diamond Address
*/
address internal constant connextAddr =
0x8f7492DE823025b4CfaAB1D34c58963F2af5DEDA;
2023-03-13 09:00:54 +00:00
IConnext internal constant connext = IConnext(connextAddr);
/**
* @param destination The destination domain ID.
* @param asset The address of token to be bridged.
* @param delegate Address that can revert or forceLocal on destination.
* @param amount The amount to transfer.
* @param slippage Maximum amount of slippage the user will accept in BPS.
* @param relayerFee Relayer fee paid in origin native asset.
* @param callData Encoded calldata to send.
*/
struct XCallParams {
2023-03-13 09:02:29 +00:00
uint32 destination;
address to;
address asset;
address delegate;
uint256 amount;
uint256 slippage;
uint256 relayerFee;
bytes callData;
2023-03-13 09:00:54 +00:00
}
function _xcall(XCallParams memory params) internal {
2023-03-22 01:55:54 +00:00
connext.xcall{ value: params.relayerFee }(
2023-03-13 09:00:54 +00:00
params.destination,
params.to,
2023-03-13 09:02:29 +00:00
params.asset,
2023-03-13 09:00:54 +00:00
params.delegate,
params.amount,
params.slippage,
params.callData
);
}
2023-03-13 09:02:29 +00:00
}