Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
iethena committed Nov 1, 2024
1 parent 347f8ed commit 8614185
Showing 1 changed file with 38 additions and 44 deletions.
82 changes: 38 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
## Foundry
# UStb token and minting

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
Contracts in scope:

Foundry consists of:
1) `contracts/contracts/SingleAdminAccessControl.sol`
2) `contracts/contracts/SingleAdminAccessControlUpgradeable.sol`
3) `contracts/contracts/ustb/UStb.sol`
4) `contracts/contracts/ustb/UStbMinting.sol`

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
## UStb token features

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

https://book.getfoundry.sh/
#### 1. Whitelisting

## Usage
A set of addresses that are whitelisted for the purpose of transfer restrictions. Only the whitelist manager specified by the admin can add or remove whitelist addresses.

### Build
#### 2. Blacklisting

```shell
$ forge build
```
A set of addresses that are blacklisted for the purpose of transfer restrictions. In any case blacklisted addresses cannot send or receive tokens, apart from burning their tokens. Only the blacklist manager specified by the admin can add or remove blacklisted addresses.

### Test
#### 3. Token Redistribution

```shell
$ forge test
```
Allows the admin to forcefully move tokens from a blacklisted address to a non-blacklisted address.

### Format
#### 4. Transfer States

```shell
$ forge fmt
```
The admin address can change the state at any time, without a timelock. There are three main transfer states to consider:

### Gas Snapshots
- **FULLY_DISABLED**: No holder of this token, whether whitelisted, blacklisted or otherwise can send or receive this token.
- **WHITELIST_ENABLED**: Only whitelisted addresses can send and receive this token.
- **FULLY_ENABLED**: Only non-blacklisted addresses can send and receive this token.

```shell
$ forge snapshot
```
## UStb minting features

### Anvil
**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.

```shell
$ anvil
```
#### 1. Max mint/redeem per block by collateral

### Deploy
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.

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```
#### 2. Global max mint/redeem per block

### Cast
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.

```shell
$ cast <subcommand>
```
#### 3. Delegate signer

### Help
Allows an address to delegate signing to another address. The mechanism to set a delegate signer is a two-step process, first the delegator needs to propose a delegatee, finally the delegatee needs to accept the role. The purpose of this feature is to allow smart contracts to delegate signing to an EOA to sign mint/redeem instructions.

```shell
$ forge --help
$ anvil --help
$ cast --help
```
#### 4. Custodians

Custodians are the only addresses that can receive collateral assets from the mint process.

#### 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.

#### 6. Beneficiary

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

0 comments on commit 8614185

Please sign in to comment.