Skip to content
Docs/Developers

Contract architecture

The vault, adapters, gateway and public executor.

Setsuna on Monad · 2 min read

The implementation separates pooled lending, native-asset handling and trading authority. The user-facing docs describe the current contracts; dated engineering notes in the repository preserve earlier versions and test evidence.

Earn contracts#

ContractResponsibility
SetsunaUSDCVaultERC-4626 USDC share vault using the multi-destination core
SetsunaMultiEarnCoreTwo to five immutable adapters, accounting, rate observations and bounded allocation
SetsunaUSDCV2FactoryAtomic four- or five-protocol vault creation
USDCV2VaultDeployerSeparate vault code holder and creator-bound initialization
CurvanceUSDCAdapterFixed direct wsrUSD/USDC lending destination with accrual and cash checks
SetsunaMONVaultTwo-destination WMON lending vault
SetsunaMONGatewayNative MON wrapping, deposit, share redemption and unwrapping

The five-protocol factory entry point is createFiveProtocolVault(). The older createVault() entry point retains four destinations. Neither modifies an already deployed vault.

Adapter boundary#

solidity
function totalAssets() external view returns (uint256);
function availableLiquidity() external view returns (uint256);
function depositCapacity() external view returns (uint256);
function supplyApr(int256 delta) external view returns (uint256);
function sync() external returns (uint256);
function deposit(uint256 assets) external;
function withdraw(uint256 assets) external returns (uint256);

These are interface excerpts. State-changing adapter functions are restricted to the linked vault. The multi-vault additionally reads marketSupply() and marketLiquidity() for its eligibility and exposure checks.

Trading boundary#

SetsunaSpot uses a fixed Kuru route. The app's market swaps no longer go through it: they are signed straight to KyberSwap's router, and limit orders rest on Kuru through each wallet's account from the Spot limit-order factory. SetsunaFactory creates immutable-owner SetsunaAccount instances for Perpl. The account has separate trading-collateral and reserve operations; it is not a general arbitrary-call wallet.

Bridge boundary#

SetsunaBridgeSponsor lets a relayer pay the Monad gas for a user's CCTP V2 transfer out of Monad. The user signs one EIP-3009 ReceiveWithAuthorization on USDC or AUSD with the sponsor as recipient. Its nonce hashes every bridge detail (destination, recipient, fee ceiling, finality, forwarding, swap minimum), so the relayer cannot change any of them. AUSD is swapped to USDC on the Curve pool setsAUSD uses, refusing less than 99.8% of one-for-one, then burned through Circle's TokenMessengerV2. The contract has no owner and holds nothing between transfers. See sponsored bridging.

Verification boundary#

The October 8 five-protocol delivery passed 152 Solidity tests, 18 keeper/configuration tests and a signed browser journey. That historical run included fault injection and fork tests with synthetic funding and simulated time. Those fork suites have since been removed; current contract tests use local mocks, except the bridge sponsor's, which run on a fork of Monad mainnet. Tests substantiate those scenarios, not an independent audit or production guarantee.

Reproduction and source live in contracts/, scripts/ and the repository's engineering docs/ directory. Start with local development.

Documentation
Start exploring
setsuna

Your keys.
Your next move.

Connect to your Setsuna account.

Powered by Mera. A compatible passkey provider is required. Use the same passkey and domain to recover your account.

Powered by Privy. Creates a Monad wallet for your login; you sign every transaction.

or connect a wallet

No browser wallet detected. Open in your wallet’s browser or enable its extension.

Connecting does not move funds. You review transactions before signing.