📄

Smart Contracts

Smart Contracts

Below you will find a brief descriptive overview for each of the primary smart contracts in Ubiquity's algorithmic dollar protocol, along with hyperlinks to their source code on Github.

Proxy Yield Aggregator Beta

Our initial deployment of the Proxy Yield Aggregator, which does not understand the concept of the global system debt clock (the current rate of depreciation for uAR tokens) and does not tokenize the user's position upon deposit.

Ubiquity Dollar Core Contracts

ABDKTest.sol

Imports the ABDKMathQuad library, a Solidity library of mathematical functions which utilize IEEE 754 quadruple-precision binary floating-point numbers (created by ABDK), to define max() and add() functions.
 

Bonding.sol

Deprecated contract for bonding deposits, withdrawals and minting. See BondingV2.sol for the upgraded contract.
 

BondingV2.sol

Bonding v2 Upgrade
Ubiquity Dollar's Bonding contract, which handles staking deposits, withdrawals, and minting. Also allows the BondingManager to take emergency action in raising or lowering the price of uAD by removing uAD or 3CRV LP tokens from the pool, respectively (see functions addLiquidity and removeLiquidity).
The BondingManager has unilateral access to the bonding 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 to the v2 contract (see Bonding v2 Upgrade for more).
 

BondingFormulas.sol

Contains formulas which are used to determine allotted LP shares and proportional token ownership for a given bonding contract. In particular, the functions sharesForLP calculates the proportional ownership of bonded LP tokens for UBQ rewards, and correctedAmountToWithdraw calculates the number of LP tokens to withdrawal based on a bonding contract's proportional ownership of the pool.
 

BondingShare.sol

Constructs the ERC1155Ubiquity contract.
 

BondingShareV2.sol

The upgraded contract for handling a user's persistent bonding share NFT, which stores the user's history of interactions with the bonding contract.
 

CouponsForDollarsCalculator.sol

Calculates the premium at which uDEBT coupons are to be issued for a given amount of uAD to burn.
 

CurveUADIncentive.sol

Contains functions which implement price stability mechanisms through the Curve LP token pool. Specifically, the contract incentivizes arbitrage that brings the uAD price closer to peg via UBQ rewards.
 

DEBTCoupon.sol

The ERC-1155 compliant uDEBT coupon contract. Contains functions that calculate the total debt in the system and update the debt in the system on every debt-related state change.

DEBTCouponManager.sol

The ERC-1155 Receiver compliant debt issuance and redemption contract. Implements the protocol's debt issuing and redemption mechanism for coupon holders.
This is the contract end users interact with, directly. It allows users to burn their uAD in exchange for coupons redeemable in the future. It allows users to redeem individual debt coupons or batch redeem coupons on a first-come, first-serve basis.
 

DollarMintingCalculator.sol

Calculates the total amount of uAD to be minted, given the TWAP at that moment, in the case of a supply expansion.
 

ERC1155Ubiquity.sol

The preset contract that implements the ERC-1155 standard for NFTs. The contract also defines the minting, burning and pausing permissions for uDEBT non-fungible tokens.
 

ERC20Ubiquity.sol

The preset contract for ERC20-standard tokens of the protocol (uAD, UBQ, and uAR). The contract also defines the transfer function and the minting, burning and pausing permissions for these tokens.
 

ExcessDollarsDistributor.sol

An excess dollar distributor that sends excess uAD minted during a supply expansion to Treasury, LP rewards, and supply expansion rewards. Here, "excess uAD minted" refers to any leftover uAD in the DEBT redemption contract (i.e., DEBTCouponManager.sol), not required to pay off the debt being redeemed in the concerned transaction.
 

MasterChef.sol

Deprecated contract used for UBQ rewards. See MasterChefV2.1.sol for the upgraded contract.
 

MasterChefV2.sol

Contains an error which miscalculates the pending rewards. Its use has been deprecated.
 

MasterChefV2.1.sol

Calculates and distributes UBQ rewards to LP token pool stakers based on a deposit time length-based multiplier. The upgraded contract contains logic which handles the persistent bonding share NFT
 

SushiSwapPool.sol

Implements pairs for uAD and UBQ on SushiSwap.
 

TWAPOracle.sol

This contract is the oracle which retrieves and calculates the Time Weighted Average Price (TWAP) for both uAD and 3CRV, taken directly from Curve's API.
 

UARForDollarsCalculator.sol

Calculates the amount of uAD to be burned in order to 'auto-redeem' and pay out to existing uAD debt tokens.
 

UbiquityAlgorithmicDollarManager.sol

A central config for the uAD 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).

UbiquityAlgorithmicDollar.sol

The ERC-20 compliant contract for the uAD token.

UbiquityAutoRedeem.sol

Defines the RaiseCapital function to be used by the contracts manager to mint uAD for the treasury. See the Treasury Module documentation page to learn more.
 

UbiquityFormulas.sol

This contract uses mathematical functions in order to calculate the staking-length based rewards multipliers, as well as the the calculations for uDEBT issuance, price, and redemption.
 

UbiquityGovernance.sol

The ERC-20 compliant contract for the protocol's native governance token, UBQ.

Ubiquity Dollar Dependencies

Curve Metapool

 

Curve 3pool Token

 

Treasury