Surplus Collateral
In addition to paying and receiving surplus collateral in the input/output of swap, mint and burn calls user can directly deposit, withdraw or transfer their surplus collateral balance.
All of these surplus collateral use callpath 0 with specific
Deposits
To deposit surplus collateral, the user should call the following user command:
recv - The address the surplus collateral will be credited
value - The total amount deposited
token - The address of the ERC20 token deposited or
address(0)
for native Ethereum)
Note that deposit will use transferFrom()
in to deposit the surplus collateral, so the user must approve or permit at least value
amount of the token. In the case of native Ethereum, the deposit is collected from msg.value
so the user must attach at least the amount matching the value parameter to the Ethereum transaction.
For EIP-2612 compliant tokens, users can deposit using an off-chain permit signature avoiding the need to approve the DEX contract:
deadline - The deadline for the permit call
v, r, s - The EIP-712 signature to be passed directly to the token contract
Withdraw
To withdraw surplus collateral, the user should call the following user command:
recv - The address the surplus collateral will be sent to
value - The total amount to withdraw from surplus collateral. 0 is treated as a magic value that will withdraw the entire balance.
token - The address of the ERC20 token or
address(0)
for native Ethereum)
Transfer
Users can also bilaterally transfer surplus liquidity between owner addresses:
recv - The address the surplus collateral will be transferred to
value - The total amount to transfer from surplus collateral. 0 is treated as a magic value that will withdraw the entire balance.
token - The address of the ERC20 token or
address(0)
for native Ethereum
Last updated