USDs
Last updated
Last updated
ERC20 contract
USDs is a stable coin which generates auto-yield natively.
USDs is a rebasing token with two modes of accounting for users:
Rebasing wallets
Users holding tokens in their EOA are by default in this category and are eligible for auto-yield via a rebasing mechanism.
Any contract opted-in for rebase also comes in this category.
Balance for this category is tracked via a credit system, as described below :
creditsPerToken is tracked at a global level and is updated when doing a rebase.
creditBalance is tracked at an account level and is updated via token transfer, mint, redemption of USDs
Non-Rebasing wallets
For Non-Rebasing wallets this token acts as a normal ERC20 token and tracks the balance of the wallet as usual.
Rebasing Mechanism
Users mint USDs using approved list of collaterals
These collaterals accumulated in the USDs vault are then deployed to various yield on-chain earning opportunities.
Yield is harvested periodically and is used to buyback USDs from the market of which 50% is used as revenue for veSPA holders and rest of it goes for USDs auto yield.
While doing a rebase the x amount of USDs is partially burnt (without changing the overall total supply) and the creditsPerToken
value is adjusted such that the burnt amount is proportionally distributed across all rebasing wallets.
Inherits: ERC20PermitUpgradeable, OwnableUpgradeable, ReentrancyGuardUpgradeable, IUSDs
Author: Sperax Foundation
ERC20 compatible contract for USDs supporting the rebase feature. This ERC20 token represents USDs on the Arbitrum (L2) network. Note that the invariant holds that the sum of balanceOf(x) for all x is not greater than totalSupply(). This is a consequence of the rebasing design. Integrations with USDs should be aware of this feature.
Inspired by OUSD: https://github.com/OriginProtocol/origindollar/blob/master/contracts/contracts/token/OUSD.sol
Verifies that the caller is the Savings Manager contract.
Initializes the contract with the provided name, symbol, and vault address.
Parameters
Mints new USDs tokens, increasing totalSupply.
Parameters
Burns tokens, decreasing totalSupply.
Parameters
Voluntary opt-in for rebase.
Useful for smart-contract wallets.
Voluntary opt-out from rebase.
Adds _account
to the rebasing account list.
Parameters
Adds _account
to the non-rebasing account list.
Parameters
The rebase function. Modifies the supply without minting new tokens. This uses a change in the exchange rate between "credits" and USDs tokens to change balances.
Parameters
Change the vault address.
Parameters
Called by the owner to pause or unpause the contract.
Parameters
Transfer tokens to a specified address.
Parameters
Returns
Transfer tokens from one address to another.
Parameters
Returns
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility.
increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance - if they are both greater than zero - if a transfer transaction is mined before the later approve() call is mined.
Parameters
Returns
Increase the amount of tokens that an owner has allowed a _spender
to spend. This method should be used instead of approve() to avoid the double approval vulnerability described above.
Parameters
Returns
Decrease the amount of tokens that an owner has allowed a _spender
to spend.
Parameters
Returns
Check the current total supply of USDs.
Returns
Gets the USDs balance of the specified address.
Parameters
Returns
Gets the credits balance of the specified address.
Parameters
Returns
Function to check the amount of tokens that an owner has allowed a spender.
Parameters
Returns
Creates _amount
tokens and assigns them to _account
, increasing the total supply.
Emits a {Transfer} event with from
set to the zero address.
Requirements - to
cannot be the zero address.
Parameters
Destroys _amount
tokens from _account
, reducing the total supply.
Emits a {Transfer} event with to
set to the zero address.
Requirements:
_account
cannot be the zero address.
_account
must have at least _amount
tokens.*
Parameters
For non-rebasing accounts credit amount = _amount
Update the count of non-rebasing credits in response to a transfer
Parameters
Add a contract address to the non-rebasing exception list. I.e., the address's balance will be part of rebases so the account will be exposed to upside and downside.
Parameters
Remove a contract address from the non-rebasing exception list.
Is an account using rebasing accounting or non-rebasing accounting? Also, ensure contracts are non-rebasing if they have not opted in.
Parameters
Ensures internal account for rebasing and non-rebasing credits and supply is updated following the deployment of frozen yield change.
Parameters
Calculates the balance of the account.
Function assumes the _account is already upgraded.
Parameters
Get the credits per token for an account. Returns a fixed amount if the account is non-rebasing.
Parameters
Validates if the contract is not paused.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
_nameArg
string
The name of the USDs token.
_symbolArg
string
The symbol of the USDs token.
_vaultAddress
address
The address where collaterals of USDs protocol reside, and major actions like USDs minting are initiated.
_account
address
The account address to which the newly minted USDs will be attributed.
_amount
uint256
The amount of USDs to be minted.
_amount
uint256
The amount to burn.
_account
address
Address of the desired account.
_account
address
Address of the desired account.
_rebaseAmt
uint256
The amount of USDs to rebase with.
_newVault
address
The new vault address.
_pause
bool
The state of the pause switch.
_to
address
The address to transfer to.
_value
uint256
The amount to be transferred.
bool
True on success.
_from
address
The address from which you want to send tokens.
_to
address
The address to which the tokens will be transferred.
_value
uint256
The amount of tokens to be transferred.
bool
true on success.
_spender
address
The address that will spend the funds.
_value
uint256
The amount of tokens to be spent.
bool
true on success.
_spender
address
The address that will spend the funds.
_addedValue
uint256
The amount of tokens to increase the allowance by.
bool
true on success.
_spender
address
The address that will spend the funds.
_subtractedValue
uint256
The amount of tokens to decrease the allowance by.
bool
true on success.
uint256
The total supply of USDs.
_account
address
The address to query the balance of.
uint256
A uint256 representing the amount of base units owned by the specified address.
_account
address
The address to query the balance of.
uint256
(uint256, uint256) Credit balance and credits per token of the address.
uint256
_owner
address
The address that owns the funds.
_spender
address
The address that will spend the funds.
uint256
The number of tokens still available for the spender.
_account
address
The account address to which the newly minted USDs will be attributed.
_amount
uint256
The amount of USDs that will be minted.
_account
address
The account address from which the USDs will be burnt.
_amount
uint256
The amount of USDs that will be burnt.
_from
address
The address from which you want to send tokens.
_to
address
The address to which the tokens will be transferred.
_value
uint256
Amount of USDs to transfer
_account
address
address of the account opting in for rebase.
_account
address
Address of the account.
_account
address
Address of the account.
_account
address
Address of the account.
_account
address
Address of the account.