Skip to content

sUSDC Token

Overview

Savings USDC (sUSDC) is an ERC-4626 representation of USDC in the Spark USDC Vault. sUSDC allows users to deposit USDC to receive the yield generated by the Sky Savings Rate while still being able to transfer, stake, lend the tokens. Converting between USDC and sUSDC can be done using the ERC4626 interface.

Supported Networks and Token Addresses

NetworkTokenAddress
EthereumsUSDC0xBc65ad17c5C0a2A4D159fa5a503f4992c7B545FE
BasesUSDC0x3128a0F7f0ea68E7B7c9B00AFa7E41045828e858
ArbitrumsUSDC0x940098b108fB7D0a7E374f6eDED7760787464609

Contract Details

Variables

  • name: Savings USDC
  • symbol: sUSDC
  • version: 1
  • decimals: 18
  • totalSupply: An unsigned integer representing the total supply of the token. It keeps track of the total number of tokens in circulation.
  • balanceOf: A mapping that associates an address with its corresponding token balance. It allows for looking up the balance of a specific address.
  • allowance: A nested mapping that associates an owner address with a spender address and their approved token allowance. It allows an owner to specify how many tokens a specific spender is allowed to transfer on their behalf.
  • nonces: A mapping that associates an address with its corresponding permit nonce. It is used for the EIP712 permit functionality, allowing an address to sign permit messages with a unique nonce.

ERC20 token functionality

The contract implements the functions specified in the ERC-20 interface.

  • transfer: Transfers a specified amount of tokens from the caller's address to the specified recipient's address. It returns a boolean value indicating the success of the transfer.
  • transferFrom: Transfers a specified amount of tokens from the from address to the to address. The transfer must be allowed by the from address by calling the approve function or by setting an allowance. It returns a boolean value indicating the success of the transfer.
  • approve: Sets an allowance for a specific spender to spend a certain amount of tokens on behalf of the caller. It returns a boolean value indicating the success of the approval.
  • increaseAllowance: Increases the allowance granted to a specific spender by adding the addedValue to the current allowance. It returns a boolean value indicating the success of the operation.
  • decreaseAllowance: Decreases the allowance granted to a specific spender by subtracting the subtractedValue from the current allowance. It returns a boolean value indicating the success of the operation.

ERC4626 token functionality

The contract implements the functions specified in the ERC-4626 interface.

  • asset: This function returns the address of the underlying asset (USDC) associated with the Savings USDC token.
  • totalAssets: This function returns the total value of assets held by the Savings USDC token, calculated based on the total supply of shares.
  • convertToShares: This function converts the specified amount of assets into the corresponding number of shares based on the current exchange rate.
  • convertToAssets: This function converts the specified number of shares into the corresponding amount of assets based on the current exchange rate.
  • maxDeposit: This function returns the maximum amount of assets that can be deposited into the Savings USDC contract.
  • previewDeposit: This function calculates and returns the number of shares that would be minted for the specified amount of assets upon deposit.
  • deposit: Deposit a specified amount of assets into the Savings USDC contract and receive the corresponding number of shares.
  • maxMint: This function returns the maximum number of shares that can be minted by an address.
  • previewMint: This function calculates and returns the amount of assets that would be minted for the specified number of shares upon minting.
  • mint: Similar to deposit, except here you specify the amount of shares you wish to mint, and the contract will pull the necessary amount of assets from the user wallet.
  • maxWithdraw: This function returns the maximum amount of assets that can be withdrawn by the specified owner address.
  • previewWithdraw: This function calculates and returns the number of shares that would be burned for the specified amount of assets upon withdrawal.
  • withdraw: This function allows the owner to withdraw a specified amount of assets, burns the corresponding number of shares, and transfers the assets to the receiver address.
  • maxRedeem: This function returns the maximum number of shares that can be redeemed by the specified owner address.
  • previewRedeem: This function calculates and returns the amount of assets that would be redeemed for the specified number of shares upon redemption.
  • redeem: This function allows the owner to redeem a specified number of shares, transfers the corresponding amount of assets to the receiver address, and burns the redeemed shares.
  • permit: This function allows the owner to approve a permit for the spender to spend a specific amount of tokens on their behalf, using a signature for authorization.
  • permit: This overloaded version of the permit function accepts the signature parameters (v, r, s) individually instead of a signature byte array.

Referral Code

The deposit and mint functions accept an optional uint16 referral parameter that integrators such as frontends can use to track deposits as originating from them. Such deposits emit a Referral(uint16 indexed referral, address indexed owner, uint256 assets, uint256 shares) event. This referral code is used in the Integration Boost and Improved Accessibility Rewards by Sky.

Upgradeability

The contract uses the ERC-1822 UUPS pattern for upgradeability and the ERC-1967 proxy storage slots standard.

Events emitted

  • Approval: This event is emitted when an approval is set for a specific address. It indicates that the owner has approved the spender to spend a certain amount of tokens.
  • Deposit: This event is emitted when a deposit is made into the Savings USDC contract. It indicates the sender, the owner of the deposited assets, the amount of assets deposited, and the corresponding shares minted.
  • Transfer: This event is emitted when tokens are transferred from one address to another. It indicates the amount of tokens transferred and the addresses involved in the transfer.
  • Withdraw: This event is emitted when a withdrawal is made from the Savings USDC contract. It indicates the sender, the receiver of the withdrawn assets, the owner of the withdrawn shares, the amount of assets withdrawn, and the corresponding shares burned.

Key Mechanisms & Concepts

sUSDC is constantly increasing in value against USDC due to the accumulation of the yield. In order to have a good UX when sending funds, you can use the view function convertToShares which will take USDC as input and output the sUSDC amount.

Gotchas / Integration Concerns

  • No Transfer event at mint/burn

ERC4626 specifies a Deposit and Withdraw event which is more verbose than the ERC20 Transfer event. In the short term this has a negative effect with integrations of dapps as most only register Transfer events, ignoring Deposit and Withdraw. Long term, it makes sense for dapps to consider the richer events and avoid unnecessary gas use for the redundant event.

Additional resources