Skip to content

Commit

Permalink
USDP smart contract overview
Browse files Browse the repository at this point in the history
  • Loading branch information
uprotocore committed Nov 29, 2023
1 parent 2712304 commit 95ab79a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions doc/dev/USDP.md
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.

0 comments on commit 95ab79a

Please sign in to comment.