Test every outcome in the sandbox
The sandbox tools let you reach every outcome in minutes. They work only in the sandbox, with sk_test_ keys; anywhere else every sandbox route answers 422 NOT_AVAILABLE_IN_MODE (never 404).
Test funds
await certa.sandbox.faucet({ customerId }); // test USDC once a day (5 in the hosted sandbox); { eurc: true } adds EURC
Move time forward
await certa.sandbox.advance(lockId, "maturity"); // the lock can settle now
await certa.sandbox.advance(lockId, "grace_end"); // no delivery: the keeper defaults it
Time travel moves the lock's maturity earlier on the sandbox chain. The indexer and keeper then act as they would on the real date: lock.settled after a settle, or lock.defaulted once the grace has passed.
Move the market
await certa.sandbox.moveRate(-500, 600); // -5% for 10 minutes, for your organisation only
A rate move changes the marks of your open locks: the cancel price, the settlement preview and deposit.low. New quotes keep the real rate, because the contract refuses rates far from the oracle.
Expire a quote
await certa.sandbox.expireQuote(quote.id);
await certa.locks.create({ quoteId: quote.id }); // refused: QUOTE_EXPIRED
A test plan
| Outcome | How | Event |
|---|---|---|
| Settled | advance to maturity, then settle | lock.settled |
| Cancelled at a cost | moveRate, then cancel | lock.cancelled |
| Deposit low | a large moveRate against the lock | deposit.low |
| Defaulted | advance to grace_end, do not settle | lock.defaulted |
| Quote expired | expireQuote, then lock | QUOTE_EXPIRED |