mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Remove msg.value xCall
This commit is contained in:
parent
c034cde7b3
commit
6c165009c3
|
|
@ -3,11 +3,11 @@ pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogXCall(
|
event LogXCall(
|
||||||
uint32 destination,
|
uint32 indexed destination,
|
||||||
address to,
|
address to,
|
||||||
address asset,
|
address asset,
|
||||||
address delegate,
|
address delegate,
|
||||||
uint256 amount,
|
uint256 indexed amount,
|
||||||
uint256 slippage,
|
uint256 slippage,
|
||||||
uint256 getId,
|
uint256 getId,
|
||||||
uint256 setId
|
uint256 setId
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@ contract Helpers is DSMath, Basic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param destination The destination domain ID.
|
* @param destination The destination domain ID.
|
||||||
|
* @param to The address to send the bridged assets to.
|
||||||
* @param asset The address of token to be bridged.
|
* @param asset The address of token to be bridged.
|
||||||
* @param delegate Address that can revert or forceLocal on destination.
|
* @param delegate Address that can revert or forceLocal on destination.
|
||||||
* @param amount The amount to transfer.
|
* @param amount The amount to transfer.
|
||||||
* @param slippage Maximum amount of slippage the user will accept in BPS.
|
* @param slippage Maximum amount of slippage the user will accept in BPS.
|
||||||
* @param relayerFee Relayer fee paid in origin native asset.
|
* @param relayerFee Relayer fee paid in origin native asset.
|
||||||
* @param callData Encoded calldata to send.
|
* @param callData Encoded calldata to send.
|
||||||
* @param nativeRelayerFee booleam choice for relayer fee asset selection.
|
|
||||||
*/
|
*/
|
||||||
struct XCallParams {
|
struct XCallParams {
|
||||||
uint32 destination;
|
uint32 destination;
|
||||||
|
|
@ -33,22 +33,9 @@ contract Helpers is DSMath, Basic {
|
||||||
uint256 slippage;
|
uint256 slippage;
|
||||||
uint256 relayerFee;
|
uint256 relayerFee;
|
||||||
bytes callData;
|
bytes callData;
|
||||||
bool nativeRelayerFee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _xcallFeeNativeAsset(XCallParams memory params) internal {
|
function _xcallFeeTransactingAsset(XCallParams memory params) internal {
|
||||||
connext.xcall{ value: params.relayerFee }(
|
|
||||||
params.destination,
|
|
||||||
params.to,
|
|
||||||
params.asset,
|
|
||||||
params.delegate,
|
|
||||||
params.amount,
|
|
||||||
params.slippage,
|
|
||||||
params.callData
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _xcallFeeTransactingAsseet(XCallParams memory params) internal {
|
|
||||||
connext.xcall(
|
connext.xcall(
|
||||||
params.destination,
|
params.destination,
|
||||||
params.to,
|
params.to,
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,7 @@ abstract contract ConnextResolver is Helpers {
|
||||||
params.amount = _amount;
|
params.amount = _amount;
|
||||||
approve(tokenContract, connextAddr, _amount);
|
approve(tokenContract, connextAddr, _amount);
|
||||||
|
|
||||||
/// check if user provided relayerFee under native asset or transacting asset
|
_xcallFeeTransactingAsset(params);
|
||||||
if(params.nativeRelayerFee){
|
|
||||||
_xcallFeeNativeAsset(params);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
_xcallFeeTransactingAsseet(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
setUint(setId, _amount);
|
setUint(setId, _amount);
|
||||||
_eventName = "LogXCall(uint32,address,address,address,uint256,uint256,uint256,uint256)";
|
_eventName = "LogXCall(uint32,address,address,address,uint256,uint256,uint256,uint256)";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user