-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2712304
commit 95ab79a
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# USDP Smart Contract Overview | ||
|
||
The USDP smart contract is a part of the Unit Protocol, a decentralized finance (DeFi) platform. It focuses on the USDP stablecoin, implementing ERC20 standards along with specific functionalities tailored for stablecoin operations on the Ethereum blockchain. | ||
|
||
## Key Components and Features | ||
|
||
### 1. Contract Inheritance | ||
- Inherits from the `Auth` contract for system access and permission management. | ||
|
||
### 2. SafeMath Library | ||
- Uses `SafeMath` for safe arithmetic operations, safeguarding against integer overflows. | ||
|
||
### 3. Core Attributes | ||
- `name`: "USDP Stablecoin" | ||
- `symbol`: "USDP" | ||
- `version`: Token contract version | ||
- `decimals`: 18, defining the smallest unit of the token | ||
- `totalSupply`: Tracks total USDP tokens in circulation | ||
|
||
### 4. State Variables | ||
- `balanceOf`: Mapping of account balances | ||
- `allowance`: Mapping to manage token allowances | ||
|
||
### 5. Contract Events | ||
- `Approval`: Emitted when `approve` is called successfully | ||
- `Transfer`: Triggered during token transfers | ||
|
||
### 6. Constructor | ||
- Initializes the contract with system parameters | ||
|
||
### 7. Token Minting and Burning | ||
- `mint`: Function for the Vault to mint USDP tokens | ||
- `burn`: Allows burning tokens from a manager's balance or any account by the Vault | ||
|
||
### 8. ERC20 Standard Functions | ||
- `transfer`: Transfers tokens from the caller's account | ||
- `transferFrom`: Manages transfers considering allowances | ||
- `approve`: Sets allowances for other accounts | ||
- `increaseAllowance` and `decreaseAllowance`: Adjust allowances with granularity | ||
|
||
### 9. Internal Functions | ||
- `_approve`: Sets allowances internally | ||
- `_burn`: Handles the burning of tokens internally | ||
|
||
The USDP smart contract is integral to the Unit Protocol's stablecoin system, enabling the creation, management, and transfer of the USDP token. It conforms to the ERC20 standard for compatibility within the Ethereum ecosystem and incorporates additional functionalities for governance and operational purposes like minting and burning tokens. |