AI agent documentation index: llms.txt. Raw markdown for any page is available by appending .md to the URL. Full content snapshot: llms-full.txt.
llms.txt — complete Cartesi documentation index. Append .md to any page URL for raw Markdown (e.g. /cartesi-rollups/2.0/development/building-an-application.md).
Skip to main content

UsdWithdrawalOutputBuilder

UsdWithdrawalOutputBuilder is a concrete IWithdrawalOutputBuilder for applications whose accounts drive denominates a single ERC-20 token. It is a stateless contract fixed to one token at construction; deploy one per token with the factory.

For each account it produces a DelegateCallVoucher that delegate-calls a shared SafeERC20Transfer contract to move balance of the token to the account owner.

Functions

constructor()

constructor(ISafeERC20Transfer safeErc20Transfer, IERC20 usd)

Parameters

NameTypeDescription
safeErc20TransferISafeERC20TransferThe shared safe-transfer contract used as the delegate-call destination
usdIERC20The ERC-20 token this builder denominates withdrawals in

token()

function token() external view override returns (IERC20)

Get the ERC-20 token used to generate withdrawal outputs.

Return Values

NameTypeDescription
[0]IERC20The configured token

buildWithdrawalOutput()

function buildWithdrawalOutput(address, bytes calldata account)
external
view
override
returns (bytes memory output)

Decode account as (address user, uint256 balance) and return a DelegateCallVoucher that, when executed by the application, calls SafeERC20Transfer.safeTransfer(token, user, balance).

Parameters

NameTypeDescription
accountbytesThe account, decoded via LibUsdAccount.decode into (user, balance)

Return Values

NameTypeDescription
outputbytesAn ABI-encoded DelegateCallVoucher(destination, payload) where destination is the SafeERC20Transfer contract and payload is safeTransfer(token, user, balance)

Raises AccountTooShort if the account cannot be decoded.

We use cookies to ensure that we give you the best experience on our website. By using the website, you agree to the use of cookies.