You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objective:
Create a function that escrows assets from the provider to the sender in the Gateway contract as part of the on-ramping process.
Function Parameters:
/**
* @notice Escrowed assets from provider to the sender.
* @param _orderId The ID of the transaction.
* @param _signature The signature of the provider.
* @param _provider The address of the provider.
* @param _senderAddress The address of the sender.
* @param _asset The address of the asset.
* @param _amount The amount to be transferred.
* @return bool the withdrawal is successful.
*/
Requirements:
Functionality:
Implement a function that escrows assets from a provider to a sender’s address.
The function should verify that the provider has staked sufficient assets in the Gateway contract for the escrow.
The assets will be transferred from the provider’s locked balance (staked balance) to the sender as part of the onramping process.
Checks:
Ensure the _signature provided is valid and signed by the provider.
Use ecrecover to validate the signature against the provider’s address.
Sufficient Balance Check:
Ensure the provider has enough staked assets to cover the amount being escrowed.
Use required statements to prevent escrowing more assets than the provider has locked.
Order Validation:
Ensure the _orderId is unique and hasn’t been processed before, preventing double-spending of assets.
Storage:
Keep a record of all processed orders to prevent re-processing. mapping(bytes32 => bool) public processedOrders;
Update the provider’s staked balance after a successful escrow.
Add a nonce to the signature to avoid a replay attack
Optionally, track escrowed balances in another mapping if needed.
Transfer the assets from the provider’s staked balance to the sender’s address.
Event Emission:
Emit an Escrow event upon successful escrow completion. event Escrow(address indexed provider, address indexed sender, uint256 amount, bytes32 orderId);
Return Value:
Return true if the escrow was successful and assets were transferred.
This task ensures the secure transfer of assets from a provider’s staked funds to a sender while checking for sufficient balance, signature validity, and preventing order replay.
The text was updated successfully, but these errors were encountered:
Objective:
Create a function that escrows assets from the provider to the sender in the Gateway contract as part of the on-ramping process.
Function Parameters:
Requirements:
mapping(bytes32 => bool) public processedOrders;
event Escrow(address indexed provider, address indexed sender, uint256 amount, bytes32 orderId);
This task ensures the secure transfer of assets from a provider’s staked funds to a sender while checking for sufficient balance, signature validity, and preventing order replay.
The text was updated successfully, but these errors were encountered: