Selling
The router call
DarwinRouter.sell(basket, shares, minUsdOut, to):
- takes the shares from the caller (it needs an allowance);
- redeems them in kind: the basket pays
shares × balanceᵢ / supplyof each component; - sells each component to the reserve at oracle prices;
- keeps the fee (0.30%) and pays the rest in fUSD to
to; - reverts if less than
minUsdOutwould be paid.
From QoreX
Like a buy: one text signed in QoreX, checked on chain by the user's Darwin account. The account approves the router for the basket token if needed, then calls sell(basket, shares, minUsdOut, account). The fUSD lands on the account; Portfolio's Withdraw X fUSD to QoreX returns it to the QoreX wallet in bank form, with one more signed message.
Shares bought before Darwin accounts sit on the user's EVM twin and are sold through the original path (EVM window, grant, authz MsgExec). See QoreX & the Relayer.
Redeeming in kind, without the router
DarwinBasket.redeem(shares, to) pays the holder's share of every component directly. It needs no oracle, no curator, no admin and no relayer, and it cannot be paused. The app does not offer it as a button; the contract allows it for anyone.