Skip to content

Commit

Permalink
Merge pull request #96 from Tapioca-DAO/CU-85ztxzhup-sendFrom
Browse files Browse the repository at this point in the history
CU-85ztxzhqn: triggerSendFrom airdrop amount check
  • Loading branch information
0xRektora authored Sep 21, 2023
2 parents 1ceb717 + e7a6be5 commit 2958800
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions contracts/tOFT/modules/BaseTOFTOptionsModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ contract BaseTOFTOptionsModule is TOFTCommon {
ISendFrom.LzCallParams calldata sendFromData,
ICommonData.IApproval[] calldata approvals
) external payable {
//no allowance check needed because the operation is executed against msg.sender
(, , uint256 airdropAmount, ) = LzLib.decodeAdapterParams(
airdropAdapterParams
);

(amount, ) = _removeDust(amount);
bytes memory lzPayload = abi.encode(
Expand All @@ -53,7 +55,8 @@ contract BaseTOFTOptionsModule is TOFTCommon {
_ld2sd(amount),
sendFromData,
lzEndpoint.getChainId(),
approvals
approvals,
airdropAmount
);

_checkGasLimit(
Expand All @@ -62,6 +65,7 @@ contract BaseTOFTOptionsModule is TOFTCommon {
airdropAdapterParams,
NO_EXTRA_GAS
);

_lzSend(
lzDstChainId,
lzPayload,
Expand Down Expand Up @@ -160,7 +164,8 @@ contract BaseTOFTOptionsModule is TOFTCommon {
uint64 amount,
ISendFrom.LzCallParams memory callParams,
uint16 lzDstChainId,
ICommonData.IApproval[] memory approvals
ICommonData.IApproval[] memory approvals,
uint256 airdropAmount
) = abi.decode(
_payload,
(
Expand All @@ -169,15 +174,16 @@ contract BaseTOFTOptionsModule is TOFTCommon {
uint64,
ISendFrom.LzCallParams,
uint16,
ICommonData.IApproval[]
ICommonData.IApproval[],
uint256
)
);

if (approvals.length > 0) {
_callApproval(approvals);
}

ISendFrom(address(this)).sendFrom{value: address(this).balance}(
ISendFrom(address(this)).sendFrom{value: airdropAmount}(
from,
lzDstChainId,
LzLib.addressToBytes32(from),
Expand Down

0 comments on commit 2958800

Please sign in to comment.