-
Notifications
You must be signed in to change notification settings - Fork 91
18. Smart Contracts (legacy)
Here you will find a brief descriptive overview for each of the primary smart contracts in Ubiquity's dollar protocol, along with hyperlinks to their source code on Github.
Ubiquity Dollar's Staking contract, which handles staking deposits, withdrawals, and minting. Also allows the StakingManager to take emergency action in raising or lowering the price of Dollar by removing Dollar or 3CRV LP tokens from the pool, respectively (see functions addLiquidity
and removeLiquidity
).
The Staking Manager has unilateral access to the staking contract's minting and pool adjustment functions. This permissioned wallet is currently operated by the development team, as per the initial DAO governance operations period outlined here. This will be changed following the DAO's continued governance rollout, and manual utilization of these functions using the manager address will only take play via governance votes.
Also contains disabled functions used for the migration from the bonding v1 contract(previous staking contract) to the v2 contract(current staking contract) Staking Upgrade.
Contains formulas which are used to determine allotted LP shares and proportional token ownership for a given staking contract. In particular, the functions sharesForLP
calculates the proportional ownership of staked LP tokens for Governance rewards, and correctedAmountToWithdraw calculates the number of LP tokens to withdrawal based on a staking contract's proportional ownership of the pool.
The upgraded contract for handling a user's persistent staking share NFT, which stores the user's history of interactions with the staking contract.
Calculates the premium at which Credit NFTs are to be issued for a given amount of Dollars to burn.
Contains functions which implement price stability mechanisms through the Curve LP token pool. Specifically, the contract incentivizes arbitrage that brings the Dollar price closer to peg via Governance rewards.
The ERC-1155 compliant Credit NFT contract. Contains functions that calculate the total debt in the system and update the debt in the system on every debt-related state change.
The ERC-1155 Receiver compliant credit issuance and redemption contract. Implements the protocol's credit issuing and redemption mechanism for Credit NFT holders.
This is the contract end users interact with, directly. It allows users to burn their Dollars in exchange for Credit NFTs redeemable in the future. It allows users to redeem individual Credit NFTs or batch redeem Credit NFTs on a first-come, first-serve basis.
Calculates the total amount of Dollars to be minted, given the TWAP at that moment, in the case of a supply expansion.
The preset contract that implements the ERC-1155 standard for NFTs. The contract also defines the minting, burning and pausing permissions for Credit NFT tokens.
The preset contract for ERC20-standard tokens of the protocol (Dollar, Governance, and Credit). The contract also defines the transfer function and the minting, burning and pausing permissions for these tokens.
An excess dollar distributor that sends excess Dollars minted during a supply expansion to Treasury, LP rewards, and supply expansion rewards. Here, "excess Dollars minted" refers to any leftover Dollars in the Credit NFT redemption contract (i.e., CreditNFTManager.sol), not required to pay off the credit being redeemed in the concerned transaction.
Calculates and distributes Governance rewards to LP token pool stakers based on a deposit time length-based multiplier. The upgraded contract contains logic which handles the persistent staking share NFT
Implements pairs for Dollar and Governance on SushiSwap.
This contract is the oracle which retrieves and calculates the Time Weighted Average Price (TWAP) for both Dollar and 3CRV, taken directly from Curve's API.
Calculates the amount of Dollars to be burned in order to 'auto-redeem' and pay out to existing Dollar credit tokens.
A central config for the Ubiquity DAO system. Also acts as a central access control manager. For storing constants, storing variables, and allowing them to be changed by the admin (see the Governance Module) to learn more).
The ERC-20 compliant contract for the Dollar token.
Defines the RaiseCapital function to be used by the contracts manager to mint Dollars for the treasury. See the Treasury Module documentation page to learn more.
This contract uses mathematical functions in order to calculate the staking-length based rewards multipliers, as well as the the calculations for Credit NFT issuance, price, and redemption.
The ERC-20 compliant contract for the protocol's native governance token.
Without stability we have nothing. © 2023 Ubiquity DAO.