Back to Contract Explorer
WithdrawalIntentFacet
managementImplements the 24-hour withdrawal intent system. This anti-flash-loan mechanism requires users to declare their withdrawal 24 hours before executing it.
Functions (4)
Usage Example
typescript
const tokenId = keccak256(encodePacked(["string"], ["USDC"]));
const amount = 500n * 10n ** 6n; // 500 USDC
// Step 1: Create intent (starts 24h timer)
await walletClient.writeContract({
address: loanAddress,
abi: withdrawalIntentFacetAbi,
functionName: "createWithdrawalIntent",
args: [tokenId, amount],
});
// Step 2: Wait 24 hours...
// Step 3: Fulfill the withdrawal
await walletClient.writeContract({
address: loanAddress,
abi: withdrawalIntentFacetAbi,
functionName: "fulfillWithdrawalIntent",
args: [tokenId],
});