mirror of
https://github.com/Instadapp/dsa-periphery-contract.git
synced 2024-07-29 22:27:13 +00:00
chg: reduce local variables
This commit is contained in:
parent
d298f3ae20
commit
4ca1c65a3e
|
@ -22,7 +22,7 @@ contract InstadappTarget is IXReceiver, InstadappAdapter {
|
||||||
|
|
||||||
/// Events
|
/// Events
|
||||||
/// @dev This event is emitted when the authCast function is called.
|
/// @dev This event is emitted when the authCast function is called.
|
||||||
event AuthCast(bytes32 indexed transferId, address indexed dsaAddress, bool indexed success, address auth, bytes returnedData);
|
event AuthCast(bytes32 indexed transferId, address indexed dsaAddress, bool indexed success, bytes authcastCallData, bytes returnedData);
|
||||||
|
|
||||||
/// Modifiers
|
/// Modifiers
|
||||||
/// @dev This modifier is used to ensure that only the Connext contract can call the function.
|
/// @dev This modifier is used to ensure that only the Connext contract can call the function.
|
||||||
|
@ -40,9 +40,9 @@ contract InstadappTarget is IXReceiver, InstadappAdapter {
|
||||||
/// Public functions
|
/// Public functions
|
||||||
/// @dev This function is used to receive funds from Connext and forward them to DSA.
|
/// @dev This function is used to receive funds from Connext and forward them to DSA.
|
||||||
/// Then it forwards the call to authCast function.
|
/// Then it forwards the call to authCast function.
|
||||||
|
/// @param _transferId The id of the transfer.
|
||||||
/// @param _amount The amount of funds that will be received.
|
/// @param _amount The amount of funds that will be received.
|
||||||
/// @param _asset The address of the asset that will be received.
|
/// @param _asset The address of the asset that will be received.
|
||||||
/// @param _transferId The id of the transfer.
|
|
||||||
/// @param _callData The data that will be sent to the targets.
|
/// @param _callData The data that will be sent to the targets.
|
||||||
function xReceive(
|
function xReceive(
|
||||||
bytes32 _transferId,
|
bytes32 _transferId,
|
||||||
|
@ -54,19 +54,10 @@ contract InstadappTarget is IXReceiver, InstadappAdapter {
|
||||||
) external onlyConnext returns (bytes memory) {
|
) external onlyConnext returns (bytes memory) {
|
||||||
// Decode signed calldata
|
// Decode signed calldata
|
||||||
// dsaAddress: address of DSA contract
|
// dsaAddress: address of DSA contract
|
||||||
// auth: address of Authority, which whitelisted at dsaContract.
|
|
||||||
// signature: signature is signed by the auth includes the castData with salt.
|
|
||||||
// castData: CastData required for execution at destination
|
|
||||||
// salt: salt for Signature Replay Protection, which is unique to each signature signed by auth.
|
|
||||||
// deadline: deadline for the cast to be valid
|
|
||||||
(
|
(
|
||||||
address dsaAddress,
|
address dsaAddress,
|
||||||
address auth,
|
bytes memory _authcastCallData
|
||||||
bytes memory _signature,
|
) = abi.decode(_callData, (address, bytes));
|
||||||
CastData memory _castData,
|
|
||||||
bytes32 salt,
|
|
||||||
uint256 deadline
|
|
||||||
) = abi.decode(_callData, (address, address, bytes, CastData, bytes32, uint256));
|
|
||||||
|
|
||||||
// verify the dsaAddress
|
// verify the dsaAddress
|
||||||
require(dsaAddress != address(0), "!invalidFallback");
|
require(dsaAddress != address(0), "!invalidFallback");
|
||||||
|
@ -78,17 +69,13 @@ contract InstadappTarget is IXReceiver, InstadappAdapter {
|
||||||
// calling via encodeWithSignature as alternative to try/catch
|
// calling via encodeWithSignature as alternative to try/catch
|
||||||
(bool success, bytes memory returnedData) = address(this).call(
|
(bool success, bytes memory returnedData) = address(this).call(
|
||||||
abi.encodeWithSignature(
|
abi.encodeWithSignature(
|
||||||
"authCast(address,address,bytes,CastData,bytes32,uint256)",
|
"authCast(address,bytes)",
|
||||||
dsaAddress,
|
dsaAddress,
|
||||||
auth,
|
_authcastCallData
|
||||||
_signature,
|
|
||||||
_castData,
|
|
||||||
salt,
|
|
||||||
deadline
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
emit AuthCast(_transferId, dsaAddress, success, auth, returnedData);
|
emit AuthCast(_transferId, dsaAddress, success, _authcastCallData, returnedData);
|
||||||
|
|
||||||
return returnedData;
|
return returnedData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user