Skip to content

Commit

Permalink
token rename
Browse files Browse the repository at this point in the history
  • Loading branch information
iethena committed Nov 25, 2024
1 parent 4b33f21 commit d912448
Show file tree
Hide file tree
Showing 25 changed files with 3,148 additions and 3,148 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# UStb token and minting
# USDtb token and minting

Contracts in scope:

1) `contracts/SingleAdminAccessControl.sol`
2) `contracts/SingleAdminAccessControlUpgradeable.sol`
3) `contracts/ustb/UStb.sol`
4) `contracts/ustb/UStbMinting.sol`
3) `contracts/usdtb/USDtb.sol`
4) `contracts/usdtb/USDtbMinting.sol`

## UStb token features
## USDtb token features

**Overview**: An upgradeable ERC20 with mint and burn functionality and various transfer states that is controlled by a single admin address.

Expand All @@ -31,17 +31,17 @@ The admin address can change the state at any time, without a timelock. There ar
- `WHITELIST_ENABLED`: Only whitelisted addresses can send and receive this token.
- `FULLY_ENABLED`: Only non-blacklisted addresses can send and receive this token.

## UStb minting features
## USDtb minting features

**Overview**: A contract defining the operations to mint and redeem UStb tokens based on signed orders that is controlled by a single admin. The price present in any mint/redeem orders are determined by an off-chain RFQ system controlled by Ethena, which a benefactor may accept and sign an order for. The minter/redeemer then has last look rights to be able to filter out any malicious orders and proceed with on-chain settlement.
**Overview**: A contract defining the operations to mint and redeem USDtb tokens based on signed orders that is controlled by a single admin. The price present in any mint/redeem orders are determined by an off-chain RFQ system controlled by Ethena, which a benefactor may accept and sign an order for. The minter/redeemer then has last look rights to be able to filter out any malicious orders and proceed with on-chain settlement.

#### 1. Max mint/redeem per block by collateral

Implements the max amount of UStb that can be minted/redeemed in a single block using a certain type of collateral. The limit can be adjusted by the admin on a per collateral basis, regardless whether the collateral is active or not.
Implements the max amount of USDtb that can be minted/redeemed in a single block using a certain type of collateral. The limit can be adjusted by the admin on a per collateral basis, regardless whether the collateral is active or not.

#### 2. Global max mint/redeem per block

In addition to mint/redeem limits by collateral, there is a global mint/redeem per block configuration that caps the amount of UStb that can be minted in a single block, regardless of the collateral used to mint UStb. The admin can adjust this configurations, regardless whether the collateral is active or not.
In addition to mint/redeem limits by collateral, there is a global mint/redeem per block configuration that caps the amount of USDtb that can be minted in a single block, regardless of the collateral used to mint USDtb. The admin can adjust this configurations, regardless whether the collateral is active or not.

#### 3. Delegate signer

Expand All @@ -53,11 +53,11 @@ Custodians are the only addresses that can receive collateral assets from the mi

#### 5. Benefactor

An address holding collateral assets (benefactor) for a minting instruction that can receive UStb from the minting process. Benefactors are entities that have undergone KYC with Ethena and have been expressly registered by the admin to be able to participate in mint/redeem operations.
An address holding collateral assets (benefactor) for a minting instruction that can receive USDtb from the minting process. Benefactors are entities that have undergone KYC with Ethena and have been expressly registered by the admin to be able to participate in mint/redeem operations.

#### 6. Beneficiary

An address holding collateral assets (benefactor) for a minting instruction can assign a different address (beneficiary) to receive UStb.
An address holding collateral assets (benefactor) for a minting instruction can assign a different address (beneficiary) to receive USDtb.

#### 6. TokenType

Expand Down
2 changes: 1 addition & 1 deletion contracts/ustb/IUStb.sol → contracts/usdtb/IUSDtb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";

interface IUStb is IERC20, IERC20Permit, IERC20Metadata {
interface IUSDtb is IERC20, IERC20Permit, IERC20Metadata {
function mint(address _to, uint256 _amount) external;

function burnFrom(address account, uint256 amount) external;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.26;

interface IUStbDefinitions {
interface IUSDtbDefinitions {
enum TransferState {
FULLY_DISABLED,
WHITELIST_ENABLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity 0.8.26;

/* solhint-disable var-name-mixedcase */

import "./IUStbMintingEvents.sol";
import "./IUSDtbMintingEvents.sol";

interface IUStbMinting is IUStbMintingEvents {
interface IUSDtbMinting is IUSDtbMintingEvents {
enum Role {
Minter,
Redeemer
Expand Down Expand Up @@ -51,7 +51,7 @@ interface IUStbMinting is IUStbMintingEvents {
address beneficiary;
address collateral_asset;
uint128 collateral_amount;
uint128 ustb_amount;
uint128 usdtb_amount;
}

struct TokenConfig {
Expand All @@ -66,21 +66,21 @@ interface IUStbMinting is IUStbMintingEvents {
}

struct BlockTotals {
/// @notice UStb minted per block / per asset per block
/// @notice USDtb minted per block / per asset per block
uint128 mintedPerBlock;
/// @notice UStb redeemed per block / per asset per block
/// @notice USDtb redeemed per block / per asset per block
uint128 redeemedPerBlock;
}

struct GlobalConfig {
/// @notice max UStb that can be minted across all assets within a single block.
/// @notice max USDtb that can be minted across all assets within a single block.
uint128 globalMaxMintPerBlock;
/// @notice max UStb that can be redeemed across all assets within a single block.
/// @notice max USDtb that can be redeemed across all assets within a single block.
uint128 globalMaxRedeemPerBlock;
}

error InvalidAddress();
error InvalidUStbAddress();
error InvalidUSDtbAddress();
error InvalidZeroAddress();
error InvalidAssetAddress();
error InvalidBenefactorAddress();
Expand Down Expand Up @@ -116,7 +116,7 @@ interface IUStbMinting is IUStbMintingEvents {

function verifyStablesLimit(
uint128 collateralAmount,
uint128 ustbAmount,
uint128 usdtbAmount,
address collateralAsset,
OrderType orderType
) external view returns (bool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ pragma solidity 0.8.26;

/* solhint-disable var-name-mixedcase */

interface IUStbMintingEvents {
interface IUSDtbMintingEvents {
/// @notice Event emitted when contract receives ETH
event Received(address, uint256);

/// @notice Event emitted when UStb is minted
/// @notice Event emitted when USDtb is minted
event Mint(
string indexed order_id,
address indexed benefactor,
address indexed beneficiary,
address minter,
address collateral_asset,
uint256 collateral_amount,
uint256 ustb_amount
uint256 usdtb_amount
);

/// @notice Event emitted when funds are redeemed
Expand All @@ -26,7 +26,7 @@ interface IUStbMintingEvents {
address redeemer,
address collateral_asset,
uint256 collateral_amount,
uint256 ustb_amount
uint256 usdtb_amount
);

/// @notice Event emitted when a supported asset is added
Expand Down Expand Up @@ -56,8 +56,8 @@ interface IUStbMintingEvents {
/// @notice Event emitted when assets are moved to custody provider wallet
event CustodyTransfer(address indexed wallet, address indexed asset, uint256 amount);

/// @notice Event emitted when UStb is set
event UStbSet(address indexed UStb);
/// @notice Event emitted when USDtb is set
event USDtbSet(address indexed USDtb);

/// @notice Event emitted when the max mint per block is changed
event MaxMintPerBlockChanged(uint256 oldMaxMintPerBlock, uint256 newMaxMintPerBlock, address indexed asset);
Expand Down
24 changes: 12 additions & 12 deletions contracts/ustb/UStb.sol → contracts/usdtb/USDtb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20Burnable
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "../SingleAdminAccessControlUpgradeable.sol";
import "./IUStbDefinitions.sol";
import "./IUSDtbDefinitions.sol";

/**
* @title UStb
* @notice UStb rwa token contract
* @title USDtb
* @notice USDtb rwa token contract
*/
contract UStb is
contract USDtb is
ERC20BurnableUpgradeable,
ERC20PermitUpgradeable,
IUStbDefinitions,
IUSDtbDefinitions,
ReentrancyGuardUpgradeable,
SingleAdminAccessControlUpgradeable
{
using SafeERC20Upgradeable for IERC20Upgradeable;

/// @notice The role is allowed to mint UStb. To be pointed to UStb minting contract only.
/// @notice The role is allowed to mint USDtb. To be pointed to USDtb minting contract only.
bytes32 public constant MINTER_CONTRACT = keccak256("MINTER_CONTRACT");
/// @notice Role that can handle Blacklisting, in addition to admin role.
bytes32 public constant BLACKLIST_MANAGER_ROLE = keccak256("BLACKLIST_MANAGER_ROLE");
Expand All @@ -41,13 +41,13 @@ contract UStb is

/* ------------- INITIALIZE ------------- */
/**
* @notice Initializer for UStb contract.
* @notice Initializer for USDtb contract.
* @param admin The address of the admin role.
* @param minterContract The initial minterContract. Only this address can mint UStb
* @param minterContract The initial minterContract. Only this address can mint USDtb
*/
function initialize(address admin, address minterContract) public initializer {
__ERC20_init("UStb", "UStb");
__ERC20Permit_init("UStb");
__ERC20_init("USDtb", "USDtb");
__ERC20Permit_init("USDtb");
__ReentrancyGuard_init();
if (admin == address(0) || minterContract == address(0)) revert ZeroAddressException();
transferState = TransferState.FULLY_ENABLED;
Expand Down Expand Up @@ -105,7 +105,7 @@ contract UStb is
}

/**
* @dev Burns the blacklisted user UStb and mints to the desired owner address.
* @dev Burns the blacklisted user USDtb and mints to the desired owner address.
* @param from The address to burn the entire balance, with the BLACKLISTED_ROLE
* @param to The address to mint the entire balance of "from" parameter.
*/
Expand All @@ -132,7 +132,7 @@ contract UStb is
}

/**
* @notice Mints new UStb tokens
* @notice Mints new USDtb tokens
* @param to The address to mint tokens to
* @param amount The amount of tokens to mint
* @dev Only callable by MINTER_CONTRACT role
Expand Down
Loading

0 comments on commit d912448

Please sign in to comment.