Buying
The router call
DarwinRouter.buy(basket, usdIn, minShares, to):
- takes
usdInfUSD from the caller and keeps the fee (0.30%) for Darwin's fee recipient; - sizes the shares with
quoteBuy, which checks the exact cost of the quoted shares with a 0.2% headroom so rounding never makes the buy revert; - buys each component from the reserve at oracle prices (
swapExactOut); - mints the shares to
toand refunds the fUSD not spent; - reverts if fewer than
minShareswould be minted.
The router holds nothing between transactions.
From QoreX
The trade is plain text signed with QoreX's signArbitrary, submitted by Darwin's relayer to the user's Darwin account, which checks the ML-DSA-87 signature with pqcVerify before making the calls:
| Call made by the account | When |
|---|---|
fUSD approve(router, max) | the router's allowance is short |
router buy(basket, usdIn, minShares, account) | always; the shares go to the account itself |
The account needs fUSD in ERC-20 form. When it holds less than usdIn, the app first asks QoreX to sign one MsgSend of the difference (bank-form faucet fUSD) to the relayer, which converts exactly that amount onto the account (MsgConvertCoin, receiver = the account). No EVM window, no grant; the relayer pays the trade's gas.
See How a Trade Works.
Limits
| Limit | Value |
|---|---|
| Per buy | what the reserve holds of each component (the trade card shows it) |
| Minimum | none in the contract; the fee is rounded down |
| Paused baskets | buying is refused (MintIsPaused); selling is not |