tx-sender) into the Heirloom vault contract, increasing the vault’s usdcx-balance. The vault must exist and must not be distributed. The calling address must be the vault owner because only the owner’s vault entry is looked up via tx-sender.
Function signature
Parameters
The amount of USDCx to deposit, denominated in micro-units (the smallest USDCx unit). USDCx has 6 decimal places.
Amount must be greater than zero.
| Human amount | Micro-unit value |
|---|---|
| $1.00 USDC | u1000000 |
| $10.00 USDC | u10000000 |
| $100.00 USDC | u100000000 |
| $1,000.00 USDC | u1000000000 |
Return value
Returns
(ok true) on success. The vault’s usdcx-balance is incremented by amount.Returns
(err uint) on failure. See error codes below.Error codes
| Code | Constant | When returned |
|---|---|---|
| u103 | ERR-VAULT-NOT-FOUND | The calling address has no vault |
| u110 | ERR-VAULT-DISTRIBUTED | The vault has been distributed or cancelled |
| u113 | ERR-NO-BALANCE | amount is zero |
How the transfer works
The function uses Clarity 4’srestrict-assets? with with-ft to enforce the exact transfer amount as a post-condition within the contract itself:
ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.usdcx. Tokens are transferred to current-contract — the vault contract’s own principal.
JavaScript example
postConditionMode: 'allow' is used for the same reason as in deposit-sbtc. The contract enforces the exact transfer amount internally via restrict-assets?, making external post-conditions redundant and potentially conflicting.