# Smart contracts

***

## EVM contracts

{% tabs %}
{% tab title="Ethereum Mainnet" %}

* AllowlistV3 Proxy - <https://etherscan.io/address/0x02f1fa8b196d21c7b733eb2700b825611d8a38e5>
* USTB Token Proxy - <https://etherscan.io/address/0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e>
* USCC Token Proxy - <https://etherscan.io/address/0x14d60e7fdc0d71d8611742720e4c50e7a974020c>
* USTB RedemptionIdle Proxy - <https://etherscan.io/address/0x4c21b7577c8fe8b0b0669165ee7c8f67fa1454cf>
* Superstate USTB Continuous Price Oracle - <https://etherscan.io/address/0xe4fa682f94610ccd170680cc3b045d77d9e528a8>
* Chainlink USTB Oracle - <https://etherscan.io/address/0x289B5036cd942e619E1Ee48670F98d214E745AAC>
* Chainlink USCC Oracle - [https://etherscan.io/address/0xAfFd8F5578E8590665de561bdE9E7BAdb99300d9](<https://etherscan.io/address/0xAfFd8F5578E8590665de561bdE9E7BAdb99300d9&#xA;>)
  {% endtab %}

{% tab title="Sepolia Testnet" %}

* AllowlistV3 Proxy - <https://sepolia.etherscan.io/address/0x4b056c23abf9a4c94ec10821b731ced73601a845>
* USTB Token Proxy -<https://sepolia.etherscan.io/address/0x39727692cF58137Bd8c401eFE87Cc8A190D62ead>
* USCC Token Proxy - <https://sepolia.etherscan.io/address/0xebba0e36545903f64291c4ba6d2c3b51c57a812e>
* USTB RedemptionIdle Proxy - <https://sepolia.etherscan.io/address/0xd33d340cdbef8e879c827199bd7d9705b21e18c9>
* Superstate USTB Continuous Price Oracle - <https://sepolia.etherscan.io/address/0xba595155585b3572f17ee1050d8c6fb9653fcb93>
* Chainlink USTB Oracle - <https://sepolia.etherscan.io/address/0x732d3C7515356eAB22E3F3DcA183c5c65102d518>
* Chainlink USCC Oracle - [https://sepolia.etherscan.io/address/0xE38b0917888d0d5d8d03B7371d5214A1aF8e1892](<https://sepolia.etherscan.io/address/0xE38b0917888d0d5d8d03B7371d5214A1aF8e1892&#xA;>)
  {% endtab %}

{% tab title="Plume Mainnet" %}

* AllowlistV3 Proxy - <https://phoenix-explorer.plumenetwork.xyz/address/0x06ed3c1cfd09e3665f72928517c86f6a87e8c35d>
* USTB Token Proxy - <https://phoenix-explorer.plumenetwork.xyz/address/0xe4fa682f94610ccd170680cc3b045d77d9e528a8>
* USCC Token Proxy - <https://phoenix-explorer.plumenetwork.xyz/address/0x4c21b7577c8fe8b0b0669165ee7c8f67fa1454cf>
  {% endtab %}

{% tab title="Plume Testnet" %}

* AllowlistV3 Proxy - <https://testnet-explorer.plumenetwork.xyz/address/0x4b056c23abf9a4c94ec10821b731ced73601a845>
* USTB Token Proxy - <https://testnet-explorer.plumenetwork.xyz/address/0x39727692cf58137bd8c401efe87cc8a190d62ead>
* USCC Token Proxy - <https://testnet-explorer.plumenetwork.xyz/address/0xebba0e36545903f64291c4ba6d2c3b51c57a812e>
  {% endtab %}
  {% endtabs %}

Our smart contracts are upgradable and various functions are gated behind the Superstate Admin Address calling them. This includes all minting, adding or removing users from the allowlist, and forcibly burning an investor’s tokens (if required by exogenous legal circumstances, for example).

#### Code Repositories

* [Github - USTB](https://github.com/superstateinc/ustb/tree/main)
* [Github - on-chain redemptions](https://github.com/superstateinc/onchain-redemptions)

#### Audits

* <https://chainsecurity.com/security-audit/compound-suptb/>
* <https://0xmacro.com/library/audits/superstate-1>
* <https://0xmacro.com/library/audits/superstate-2>
* <https://0xmacro.com/library/audits/superstate-3>
* <https://0xmacro.com/library/audits/superstate-4>
* <https://0xmacro.com/library/audits/superstate-5>
* <https://0xmacro.com/library/audits/superstate-6>
* <https://0xmacro.com/library/audits/superstate-7>
* <https://0xmacro.com/library/audits/superstate-8>
* <https://0xmacro.com/library/audits/superstate-9>
* <https://0xmacro.com/library/audits/superstate-10>
* <https://0xmacro.com/library/audits/superstate-11>

{% file src="/files/iBrehX5OPLl9D7AnlDUS" %}

***

## SVM contracts

{% tabs %}
{% tab title="Solana Mainnet" %}

* Allowlist - <https://explorer.solana.com/address/HFkKyweJDUuGer5KaCst5qZSYD5aapKaD7xzdNaoRtfA>
* USTB Token 2022 - <https://explorer.solana.com/address/CCz3SGVziFeLYk2xfEstkiqJfYkjaSWb2GCABYsVcjo2>
* USCC Token 2022 - <https://explorer.solana.com/address/BTRR3sj1Bn2ZjuemgbeQ6SCtf84iXS81CS7UDTSxUCaK>
* Burn Address - <https://explorer.solana.com/address/2u8YwJTykTreziHBN5QwE7Bi2SyN8M2MicCscthtph9E>
* Pyth USTB Oracle - <https://explorer.solana.com/address/EqggHKbjePzmXAX6MW3EsgjiJ4mhkbb8j5s5KfGs1gLq>
* Pyth USCC Oracle - <https://explorer.solana.com/address/823Y4cV7XH2TzkB9NdHfTRoCKLrqXv8EgQP5nzEG43Hp>
* Pyth FWDI Superstate Oracle (for DeFi protocols) - <https://insights.pyth.network/price-feeds/Crypto.Index.FWDI%2FUSD>
* Pyth FWDI Nasdaq Oracle - <https://insights.pyth.network/price-feeds/Equity.US.FWDI%2FUSD>
* Pyth GLXY Superstate Oracle (for DeFi protocols) - <https://insights.pyth.network/price-feeds/Crypto.Index.GLXY%2FUSD>
* Pyth GLXY Nasdaq Oracle - <https://insights.pyth.network/price-feeds/Equity.US.GLXY%2FUSD>
  {% endtab %}

{% tab title="Solana Devnet" %}

* Allowlist - <https://explorer.solana.com/address/Fdq29GdM8sZtbL9xrLLKwFEo3GuGHo6C2r4VKEWATqQW?cluster=devnet>
* USTB Token 2022 - <https://explorer.solana.com/address/2mBiupxRpJQKnWEDvUmiuPpGyKrmPqsKLeeHdL4JUvRM?cluster=devnet>
* USCC Token 2022 - <https://explorer.solana.com/address/CmfVS7ucShR4hgVESvjJpPE4k4b6Zv4AoTzT8rEipvrP?cluster=devnet>
* Burn Address - <https://explorer.solana.com/address/7pt81Zc8ywxdhfBzV9d8uLe5YU27MNoJh8ZGA7iJmEBE?cluster=devnet>
* Pyth USTB Oracle - <https://explorer.solana.com/address/EqggHKbjePzmXAX6MW3EsgjiJ4mhkbb8j5s5KfGs1gLq?cluster=devnet>
* Pyth USCC Oracle - <https://explorer.solana.com/address/823Y4cV7XH2TzkB9NdHfTRoCKLrqXv8EgQP5nzEG43Hp?cluster=devnet>
  {% endtab %}
  {% endtabs %}

Our Allowlist program is upgradeable. To simplify integrations, it has both a [Rust SDK](https://crates.io/crates/superstate-allowlist-interface) and a [Typescript SDK](https://www.npmjs.com/package/@superstateinc/allowlist).

***

## Allowlist Audits

{% file src="/files/Bd8PXKZtcG1JDz16chd1" %}

{% file src="/files/WzC0z0G1Fe3mfXR25n80" %}

* Macro Audit - <https://0xmacro.com/library/audits/superstate-7>

***

## **USTB and USCC Shared Functionality**

#### EVM Design

A standard Upgradable OpenZeppelin ERC-20 implementation with a few changes:

1. USTB/USCC check that all holders are on the Superstate controlled Allowlist contract and are authorized for that token.
2. Redeem - Investors can call the `offchainRedeem`function or transfer their USTB/USCC to the contract address to kick off a standard redemption
3. Mint - Superstate can call the `mint` function to mint new shares of USTB/USCC when investors subscribe to the fund

#### SVM Design

Our tokens use the [SPL Token 2022 Program](https://spl.solana.com/token-2022) with the following extensions:

* [Default Account State](https://solana.com/developers/courses/token-extensions/default-account-state) (set to Frozen)
* [Permanent Delegate](https://solana.com/developers/courses/token-extensions/permanent-delegate)
* [ScaledUi](https://solana.com/docs/tokens/extensions/scaled-ui-amount)
* [Immutable Owner](https://solana.com/developers/courses/token-extensions/immutable-owner)
* [Metadata and Metadata Pointer](https://solana.com/developers/courses/token-extensions/token-extensions-metadata)

The tokens are permissioned by a novel and first of its kind Allowlist Program that allows for seamless integration with DeFi protocols.

#### Transfers

USTB/USCC is freely transferrable between addresses that are on the Allowlist.

* **EVM:** This is via `transfer` or `transferFrom`. Each function checks that the sender and receiver are both on the Allowlist and authorized for that specific token.
* **SVM:** This is done the `Transfer` or `TransferChecked` Instructions. Once an account has been thawed by the Allowlist program, that account is able to freely transfer between other addresses that have been thawed.<br>

#### Burn to book-entry

It is possible to convert tokenized shares into shares held in book-entry:

* **EVM:** This is done by calling the `bridgeToBookEntry` function onchain.
* **SVM**: Burn to book-entry is not supported for shares of funds held as SVM tokens. Instead investors can redeem shares held as SVM tokens, set their purchase destination to book-entry, and re-purchase the same fund.<br>

#### Bridging

* **EVM:** This is done by calling the `bridge` function. It allows users to burn their tokens on the source chain, and receive the specified number of tokens on supported destination chains. This functionality makes it easy for users of all types to move their tokens cheaply and efficiently across chains. As mentioned in the burn to book-entry section, the helper function `bridgeToBookEntry` allows users to burn their tokens and hold their shares in book entry with Superstate, instead of onchain as an ERC-20.
* **SVM:** Bridging is not supported for shares of funds held as SVM tokens. Instead investors can redeem shares held as SVM tokens, set their purchase destination to another chain, and re-purchase the same fund.<br>

#### EVM Allowlist

Adds/Removes Ethereum addresses to/from the allowlist with certain permissions. Fund tickers are used with `privateInstrumentPermissionByEntityId` determine if an entity is allowed to interact with a specific fund's token or not\
\
Ethereum addresses are also grouped by their Entity Id. Entity Ids are how Superstate identifies investors.\
\
The USTB/USCC token contract calls `isAddressAllowedForPrivateInstrument` on the Allowlist contract to see if the sender and receiver of USTB are allowed to hold it.\
\
Only the Superstate Admin Address can make any changes to the allowlist, using the following functions `setEntityAllowedForPrivateInstrument`, `setProtocolAddressPermission`, `setProtocolAddressPermissions`, `setEntityIdForAddress`, `setEntityIdForMultipleAddresses`, `setEntityPermissionsAndAddresses.`

We call these functions when onboarding or offboarding an investor.\
\
We only add Ethereum addresses for investors that have made it through our KYC / Investment Agreement processes. However, Superstate Inc. audited DeFi protocols may be added to the allowlist at our discretion.

#### SVM Allowlist

On the SVM, Superstate adds/removes addresses via the [admin\_add\_public\_allowed\_account](https://docs.rs/superstate-allowlist-interface/0.1.0/superstate_allowlist_interface/instruction/fn.admin_add_public_allowed_account.html) or [admin\_add\_private\_allowed\_account](https://docs.rs/superstate-allowlist-interface/0.1.0/superstate_allowlist_interface/instruction/fn.admin_add_private_allowed_account.html) instructions.

The Allowlist Program is the Freeze Authority for Superstate Tokens, and [provides a permissionless Thaw instruction](https://docs.rs/superstate-allowlist-interface/0.1.0/superstate_allowlist_interface/instruction/fn.thaw.html) for DeFi protocols can call to seamlessly integrate and onboard users within existing flows.

Both the Rust and Typescript SDKs provide helper methods for clients to read the Allowlist Program's internal state. This can be used to determine if an address is on the allowlist, for example.

***

## **USTB Specific Functionality**&#x20;

#### Subscribe function (Ethereum only)

Protocols can mint USTB by calling the `subscribe` function on the Ethereum USTB contract. This function atomically transfers the investor’s USDC to Superstate, and newly minted USTB into the investor’s wallet in one transaction. The price per share is read from the Superstate USTB Continuous Price oracle contract. There are no limits for subscriptions.

Users must call `approve` on the USDC contract before calling `subscribe` on the USTB contract.

DeFi Protocols will be interested in the `calculateSuperstateTokenOut(uint256 inAmount, address stablecoin) returns (uint256 superstateTokenOutAmount, uint256 stablecoinInAmountAfterFee, uint256 feeOnStablecoinInAmount)` function, also on the USTB contract. Given an `inAmount` of stablecoin it will give you the `superstateTokenOutAmount` you should expect to receive back accounting for fees.\
\
There is also a `subscribe` function variant that takes a `to` address argument. The `to` address can be any of your entity's Allowlisted Ethereum addresses and USTB is sent to it.&#x20;

At time of writing, fees are set to 0 and only USDC is supported. For more information, please visit [superstate.com/ustb](http://superstate.com/ustb).

#### RedemptionIdle Contract (Ethereum only)

The RedemptionIdle contract holds USDC liquidity while waiting to facilitate USTB redemptions. Investors can call the `redeem` function on the contract to burn USTB from the investor’s wallet and receive USDC in one transaction. USDC liquidity will be replenished in this contract regularly to facilitate protocol redemptions. The `redeem` function will revert if there is not enough USDC in the contract to match the `superstateTokenInAmount`.

Users must call `approve` on the USTB contract before calling `redeem` on the RedemptionIdle contract.

DeFi Protocols will be interested in the `calculateUstbIn(uint256 usdcOutAmount) returns (uint256 ustbInAmount, uint256 usdPerUstbChainlinkRaw)` function. This function takes a desired amount of USDC and returns how much USTB is needed for the `superstateTokenInAmount` argument of the `redeem` function to reach the `usdcOutAmount`. This function always rounds up, so the user will always hit or exceed the `usdcOutAmount`.

There is also a redeem function variant that takes a `to` address argument. The `to` address can be any Ethereum address and USDC is sent to it.&#x20;

At time of writing, fees are set to 0 and only USDC is supported or more information please visit [superstate.com/ustb](http://superstate.com/ustb).

#### Superstate USTB Continuous Price Oracle (Ethereum only)

A custom onchain oracle to facilitate continuous pricing onchain, which powers Atomic Subscriptions and Redemptions. The oracle receives pricing updates from Superstate every time a new Net Asset Value per Share (NAV/S) is calculated by our NAV Calculation Agent partner. When a continuous price is requested, the Oracle does linear extrapolation using the two newest NAV/S checkpoints to calculate it.

\
Any smart contract can request a continuous price onchain. The Oracle contract uses the Chainlink `AggregatorV3Interface`, so it works out of the box with any Chainlink data feed integrations. <https://docs.chain.link/data-feeds/api-reference#functions-in-aggregatorv3interface>

#### Chainlink USTB/USCC Oracle

Chainlink puts the USTB/USCC Net Asset Value per Share price onchain once per day. The Oracle contract uses the AggregatorV3Interface.<https://docs.chain.link/data-feeds/api-reference#functions-in-aggregatorv3interface>&#x20;

This oracle has the daily USTB/USCC NAV/S price and can be used like any other Chainlink oracle.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superstate.com/investors/smart-contracts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
