Skip to content

Commit

Permalink
feat: transfer requested tokens to the facilitator
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad Ghazi committed Oct 17, 2023
1 parent c532027 commit f014c73
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/AdvancedOrderEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ contract AdvancedOrderEngine is Vault, Ownable2Step, EIP712 {
bytes calldata interactionData
) = facilitatorInteraction.decodeTargetAndCalldata();

// Facilitator is expected to provide us with the token addresses and their corresponding amounts that they require from the vault. // TBD: consider using these returned values for some kinda balances assertion
// Facilitator is expected to provide us with the token addresses and their corresponding amounts that they require from the vault.
// TBD: consider using these returned values for some kinda balances assertion
// TBD: is it alright to assume facilitator will ensure that duplicates addresses are not present in 'tokenAddresses' array?
// considering gas fee will not be paid by the facilitator, so there's no benefit for facilitator to ensure this
// TBD: transfer funds to 'interactionTarget' or no harm in expecting recipient address?
(
address[] memory tokenAddresses,
uint256[] memory tokenAmounts,
Expand All @@ -187,6 +191,14 @@ contract AdvancedOrderEngine is Vault, Ownable2Step, EIP712 {
revert ZeroAddress();
}

// Transferring funds to the address provided by the facilitator
for (uint256 i; i < tokenAddresses.length; ) {
_sendAsset(tokenAddresses[i], tokenAmounts[i], assetsRecipient);
unchecked {
++i;
}
}

IInteractionNotificationReceiver(interactionTarget)
.fillOrderInteraction(
msg.sender,
Expand Down

0 comments on commit f014c73

Please sign in to comment.