CompetitionsBountiesReviewsGuildsFellowship
Sign in
Sign in

Usual / Pegasus

Ender13120

Overview

Leaderboard

Usual is a Stablecoin DeFi protocol that redistributes control and redefines value sharing. It empowers users by aligning their interests with the platform's success. $USD0 is a USUAL native stablecoin with real-time transparency of reserves, fully collateralized by US Treasury Bills. This eliminates fractional reserve risks and protects against the bankruptcy risks of fiat-backed stablecoins. $USD0 can be locked into $USD0++, a liquid 4-year bond backed 1:1, offering users the alpha-yield distributed as points and ensuring at least the native yield of their collateral. This provides enhanced stability and attractive returns for holders.

Prize distribution and scoring

Total Prize Pool $80000

  • The prize distribution has 2 possible triggers:
    • If one or more valid medium severity findings are found, the total pot size is $15000
    • If one or more valid high severity findings are found, the total pot size is $80000
  • Scoring described in the competition scoring page.
  • Findings Severities described in detail on our docs page.
  • Only High and Medium findings would be accepted for Primary Prize Pool.

Documentation

Scope

src
├── daoCollateral
├── interfaces
├── oracles
├── registry
├── swapperEngine
├── token
├── utils 
├── constants.sol
├── errors.sol
└── TokenMapping.sol

Code Overview

Diagram

Contracts

Each Contract has its own markdown file inside the repository with a more in-depth walkthrough. Below is a high level overview summary of the contracts:

Contracts Summary Overview:

Oracles:

AbstractOracle.sol The AbstractOracle contract is inherited by the ClassicalOracle contract, and as such it is not meant to be deployed on its own. It is designed to safely be inherited by upgradable contracts, and upgradable contracts only. The shared logic contained in AbstractOracle includes: Converting the price of the oracle of arbitrary decimals into wad (18 decimals). Computing a quote (USD value) for a given token and amount of tokens. Making sure stablecoins haven’t depegged. Allowing the admin to set the maximum allowed price variation for stablecoins (maxDepegThreshold).

ClassicalOracle.sol The ClassicalOracle contract is used by the DaoCollateral and the SwapperEngine to fetch the price of external tokens implementing chainlinks IAggregator Interface, i.e. RWAs and stablecoins. The price of tokens is used for minting and redeeming the right amount of USD0, and to ensure the proper SwapperEngine USDC -> USD0 swap amounts. It is an upgradable contract and most of the contract’s logic is inherited from AbstractOracle.

Tokens:

Usd0.sol The USD0 contract is designed to manage the USD0 ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blocklist checks to restrict these operations from blocklisted addresses. USD0 is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability in a regulated environment. It inherits functionalities from Blacklist.sol, ERC20PausableUpgradable and ERC20PermitUpgradeable to manage a blocklist, support permit-based approvals and pausability.

Usd0pp.sol The USD0pp contract is designed to manage the USD0PP ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blocklist checks to restrict these operations from blocklisted addresses. The USD0pp Token is minted by depositing an equivalent amount of USD0 tokens for a fixed timeframe, during which the USD0 amount is locked. The USD0 tokens can be redeemed back after the fixed timeframe has ended. During the timeframe, holders are eligible to offchain rewards (out of scope for the competition).

Main protocol contracts:

DaoCollateral.sol The DaoCollateral smart contract is designed to facilitate the swapping of Real World Assets (RWAs) to USD0 Stablecoins. This contract enables users to swap their Real World Assets (currently available with Hashnote’s USYC) either for Usual’s stablecoin (USD0) or for USDC (via the SwapperEngine indirectly). Additionally, it provides the functionality to redeem USD0 tokens back into Real World Assets (USYC).

SwapperEngine.sol The SwapperEngine contract is a smart contract designed to facilitate the swapping of USDC tokens for USD0 tokens using an order matching mechanism. The contract allows users to create orders specifying the amount of USDC they wish to swap, and other users can fill these orders by providing USD0 tokens in return. The contract aims to provide a direct token swapping solution without the need for intermediary liquidity pools. The main objective of the SwapperEngine contract is to enable efficient and low-slippage token swaps between users. The contract relies on oracle-based pricing to determine swap prices, which helps minimize slippage. However, liquidity within the contract depends on the availability of active orders, and users may need to wait for new orders to be created if no matching orders are available.

Repository: usual-dao/pegasus

Commit: 05da1a828af59deb401a48cd4b9e3792a2459f98

Build Instructions

forge build

Proof of Concept Instructions

forge test

Out of scope

  • Scripts and test files

Out of scope:

All findings in the audits before.

Contact Us

For any issues or concerns regarding this competition, please reach out to the Cantina core team through the Cantina Discord.

Summary

Status

Completed

Total reward:

$80,000 USDC

Start date:

18 Jun 2024 3:00pm (local time)

End date:

28 Jun 2024 8:00pm (local time)

Services

CompetitionsReviewsBountiesGuildsFellowship

© 2024 Cantina. All rights reserved.