# Table of Contents - [Usual Tech Hub | Usual Tech Docs](#usual-tech-hub-usual-tech-docs) - [Protocol Contracts | Usual Tech Docs](#protocol-contracts-usual-tech-docs) - [USUAL Distribution Model | Usual Tech Docs](#usual-distribution-model-usual-tech-docs) - [Usual Protocol Primer | Usual Tech Docs](#usual-protocol-primer-usual-tech-docs) - [Utility Contracts | Usual Tech Docs](#utility-contracts-usual-tech-docs) - [Token Contracts | Usual Tech Docs](#token-contracts-usual-tech-docs) - [Features | Usual Tech Docs](#features-usual-tech-docs) - [Security Practices | Usual Tech Docs](#security-practices-usual-tech-docs) - [ETH0 Collateral | Usual Tech Docs](#eth0-collateral-usual-tech-docs) - [EUR0 Collateral | Usual Tech Docs](#eur0-collateral-usual-tech-docs) - [Monitoring Framework | Usual Tech Docs](#monitoring-framework-usual-tech-docs) - [USDC by Circle | Usual Tech Docs](#usdc-by-circle-usual-tech-docs) - [Testing Framework | Usual Tech Docs](#testing-framework-usual-tech-docs) - [USD0a Collateral | Usual Tech Docs](#usd0a-collateral-usual-tech-docs) - [Usual bUSD0 Investment Vault | Usual Tech Docs](#usual-busd0-investment-vault-usual-tech-docs) - [USD0 Collateral | Usual Tech Docs](#usd0-collateral-usual-tech-docs) - [USDtb by Ethena | Usual Tech Docs](#usdtb-by-ethena-usual-tech-docs) - [EUR0 Classical Oracle | Usual Tech Docs](#eur0-classical-oracle-usual-tech-docs) - [RedStone Oracle | Usual Tech Docs](#redstone-oracle-usual-tech-docs) - [Architecture | Usual Tech Docs](#architecture-usual-tech-docs) - [Role Management | Usual Tech Docs](#role-management-usual-tech-docs) - [USCC by Superstate | Usual Tech Docs](#uscc-by-superstate-usual-tech-docs) - [FAQ | Usual Tech Docs](#faq-usual-tech-docs) - [Contract Deployments | Usual Tech Docs](#contract-deployments-usual-tech-docs) - [Community & Support | Usual Tech Docs](#community-support-usual-tech-docs) - [ETH0 | Usual Tech Docs](#eth0-usual-tech-docs) - [UsualUSDC | Usual Tech Docs](#usualusdc-usual-tech-docs) - [USD0a | Usual Tech Docs](#usd0a-usual-tech-docs) - [Claim Address Redirect | Usual Tech Docs](#claim-address-redirect-usual-tech-docs) - [M by M0 | Usual Tech Docs](#m-by-m0-usual-tech-docs) - [USD0a Classical Oracle | Usual Tech Docs](#usd0a-classical-oracle-usual-tech-docs) - [EUR0 | Usual Tech Docs](#eur0-usual-tech-docs) - [Privacy Policy | Usual Tech Docs](#privacy-policy-usual-tech-docs) - [USD0 Abstract Oracle | Usual Tech Docs](#usd0-abstract-oracle-usual-tech-docs) - [USD0 DaoCollateral | Usual Tech Docs](#usd0-daocollateral-usual-tech-docs) - [Legal Notice | Usual Tech Docs](#legal-notice-usual-tech-docs) - [USUAL distribution | Usual Tech Docs](#usual-distribution-usual-tech-docs) - [ETH0 Abstract Oracle | Usual Tech Docs](#eth0-abstract-oracle-usual-tech-docs) - [USUAL | Usual Tech Docs](#usual-usual-tech-docs) - [EUR0 | Usual Tech Docs](#eur0-usual-tech-docs) - [USUAL | Usual Tech Docs](#usual-usual-tech-docs) - [USD0 | Usual Tech Docs](#usd0-usual-tech-docs) - [USD0a DaoCollateral | Usual Tech Docs](#usd0a-daocollateral-usual-tech-docs) - [DebtUSDC Oracle | Usual Tech Docs](#debtusdc-oracle-usual-tech-docs) - [USDC by Circle | Usual Tech Docs](#usdc-by-circle-usual-tech-docs) - [USUAL* | Usual Tech Docs](#usual-usual-tech-docs) - [Glossary | Usual Tech Docs](#glossary-usual-tech-docs) - [USUAL* | Usual Tech Docs](#usual-usual-tech-docs) - [EUR0 | Usual Tech Docs](#eur0-usual-tech-docs) - [USD0 | Usual Tech Docs](#usd0-usual-tech-docs) - [EUR0 | Usual Tech Docs](#eur0-usual-tech-docs) - [ETH0 | Usual Tech Docs](#eth0-usual-tech-docs) - [References | Usual Tech Docs](#references-usual-tech-docs) - [USD0 | Usual Tech Docs](#usd0-usual-tech-docs) - [USUALx (USUAL staking) | Usual Tech Docs](#usualx-usual-staking-usual-tech-docs) - [wstETH by Lido | Usual Tech Docs](#wsteth-by-lido-usual-tech-docs) - [Reward redistribution by integration partner | Usual Tech Docs](#reward-redistribution-by-integration-partner-usual-tech-docs) - [USUAL | Usual Tech Docs](#usual-usual-tech-docs) - [Audits | Usual Tech Docs](#audits-usual-tech-docs) - [bUSD0 (formerly USD0++) | Usual Tech Docs](#busd0-formerly-usd0-usual-tech-docs) - [USTB by Superstate | Usual Tech Docs](#ustb-by-superstate-usual-tech-docs) - [Bug Bounty | Usual Tech Docs](#bug-bounty-usual-tech-docs) - [EUR0 SwapperEngine | Usual Tech Docs](#eur0-swapperengine-usual-tech-docs) - [EUTBL by Spiko | Usual Tech Docs](#eutbl-by-spiko-usual-tech-docs) - [Usual Protocol Primer | Usual Tech Docs](#usual-protocol-primer-usual-tech-docs) - [USD0a Reverse Gateway | Usual Tech Docs](#usd0a-reverse-gateway-usual-tech-docs) - [bUSD0 (formerly USD0++) | Usual Tech Docs](#busd0-formerly-usd0-usual-tech-docs) - [Distribution Module | Usual Tech Docs](#distribution-module-usual-tech-docs) - [UsualM | Usual Tech Docs](#usualm-usual-tech-docs) - [USD0a | Usual Tech Docs](#usd0a-usual-tech-docs) - [Protocol Contracts | Usual Tech Docs](#protocol-contracts-usual-tech-docs) - [ETH0 | Usual Tech Docs](#eth0-usual-tech-docs) - [EUR0 DaoCollateral | Usual Tech Docs](#eur0-daocollateral-usual-tech-docs) - [USYC by Hashnote | Usual Tech Docs](#usyc-by-hashnote-usual-tech-docs) - [ETH0 | Usual Tech Docs](#eth0-usual-tech-docs) - [UsualUSDtb | Usual Tech Docs](#usualusdtb-usual-tech-docs) - [USD0a | Usual Tech Docs](#usd0a-usual-tech-docs) - [USUAL | Usual Tech Docs](#usual-usual-tech-docs) - [USD0 | Usual Tech Docs](#usd0-usual-tech-docs) - [Usual bUSD0 (formerly USD0++) Investment Vault | Usual Tech Docs](#usual-busd0-formerly-usd0-investment-vault-usual-tech-docs) - [USD0a | Usual Tech Docs](#usd0a-usual-tech-docs) - [ETH0 DaoCollateral | Usual Tech Docs](#eth0-daocollateral-usual-tech-docs) - [Pyth Oracles | Usual Tech Docs](#pyth-oracles-usual-tech-docs) - [USD0 ClassicalOracle | Usual Tech Docs](#usd0-classicaloracle-usual-tech-docs) - [ETH0 Classical Oracle | Usual Tech Docs](#eth0-classical-oracle-usual-tech-docs) - [Integrate bUSD0 | Usual Tech Docs](#integrate-busd0-usual-tech-docs) - [EUR0 Revenue Distribution Module | Usual Tech Docs](#eur0-revenue-distribution-module-usual-tech-docs) - [DebtUSCC Oracle | Usual Tech Docs](#debtuscc-oracle-usual-tech-docs) - [Terms of Services | Usual Tech Docs](#terms-of-services-usual-tech-docs) - [Lido wstETH Oracle | Usual Tech Docs](#lido-wsteth-oracle-usual-tech-docs) - [Circle EURC/EUR Oracle | Usual Tech Docs](#circle-eurc-eur-oracle-usual-tech-docs) - [USUAL Distribution | Usual Tech Docs](#usual-distribution-usual-tech-docs) - [Mint & Redeem Engine | Usual Tech Docs](#mint-redeem-engine-usual-tech-docs) - [Chainlink Oracles | Usual Tech Docs](#chainlink-oracles-usual-tech-docs) - [USUAL* Vested Allocation Staking | Usual Tech Docs](#usual-vested-allocation-staking-usual-tech-docs) - [sUSD0 | Usual Tech Docs](#susd0-usual-tech-docs) - [Monerium Swapper Helper | Usual Tech Docs](#monerium-swapper-helper-usual-tech-docs) - [USD0a Gateway | Usual Tech Docs](#usd0a-gateway-usual-tech-docs) - [USUAL staking | Usual Tech Docs](#usual-staking-usual-tech-docs) - [Security Practices | Usual Tech Docs](#security-practices-usual-tech-docs) - [USD0 Swapper Engine | Usual Tech Docs](#usd0-swapper-engine-usual-tech-docs) - [VaultRouter | Usual Tech Docs](#vaultrouter-usual-tech-docs) - [Yield Module | Usual Tech Docs](#yield-module-usual-tech-docs) - [USD0a SwapperEngine | Usual Tech Docs](#usd0a-swapperengine-usual-tech-docs) - [USUALx | Usual Tech Docs](#usualx-usual-tech-docs) - [USUALx Lockup Contract | Usual Tech Docs](#usualx-lockup-contract-usual-tech-docs) - [sEUR0 | Usual Tech Docs](#seur0-usual-tech-docs) - [USD0 Revenue Distribution Module | Usual Tech Docs](#usd0-revenue-distribution-module-usual-tech-docs) - [Integrate bUSD0 | Usual Tech Docs](#integrate-busd0-usual-tech-docs) - [FAQ | Usual Tech Docs](#faq-usual-tech-docs) - [Community & Support | Usual Tech Docs](#community-support-usual-tech-docs) - [Terms of Services | Usual Tech Docs](#terms-of-services-usual-tech-docs) --- # Usual Tech Hub | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FNgPVJEnPL9Cmc4egACp9%252FPage%2520Cover%252001.png%3Falt%3Dmedia%26token%3D86264197-a7e5-427b-bc45-6159448b5252&width=1248&dpr=3&quality=100&sign=863596b5&sv=2) [hashtag](https://tech.usual.money/#welcome-to-the-usual-technical-documentation) Welcome to the **Usual** **technical documentation** ------------------------------------------------------------------------------------------------------------------------------------------- circle-info Unlike other protocols, we strive to provide **detailed insights** and create **full transparency** about our implementation, so that you can have **peace of mind** when you are using our products or want to integrate with them. ### [hashtag](https://tech.usual.money/#get-started-right-here) GET STARTED RIGHT HERE [Usual Protocol Primerchevron-right](https://tech.usual.money/overview/usual-protocol-primer) [](https://tech.usual.money/overview/features) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FlS6MamVRGcxLSUff3Q1p%252FCard%2520Cover%252001.png%3Falt%3Dmedia%26token%3D78376d8b-5fa7-4847-9e55-37eebdc119e3&width=752&dpr=3&quality=100&sign=159e2b24&sv=2) **Get to know the features of the protocol** [](https://tech.usual.money/overview/architecture) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FIaNVNd7uw7aZbFveNqMl%252FCard%2520Cover%252002.png%3Falt%3Dmedia%26token%3D2d66d3cd-afd6-4471-bb78-a25df1e0e37b&width=752&dpr=3&quality=100&sign=61a3210c&sv=2) **Understand how everything comes together** [](https://tech.usual.money/smart-contracts/protocol-contracts) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F5qjaHFymUscGRsRm8Wuk%252FCard%2520Cover%252003.png%3Falt%3Dmedia%26token%3Ddbe3dfb5-13f9-4d4f-8d0e-29ad8c4a6ae7&width=752&dpr=3&quality=100&sign=81b74cd4&sv=2) **Dive into the smart contracts** [](https://tech.usual.money/security-and-audits/security-practices) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FhJJYAaF3Kzr4vF2fZ6wm%252FCard%2520Cover%252004.png%3Falt%3Dmedia%26token%3D8896d96f-866c-4bbb-862f-c9ac48efbf04&width=752&dpr=3&quality=100&sign=a12f0a4&sv=2) **Validate our security approach** Last updated 4 months ago Was this helpful? --- # Protocol Contracts | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FiZANt6QS7u1XwcZPiH4x%252FPage%2520Cover%252005.png%3Falt%3Dmedia%26token%3D9108bba3-b5a8-4ec1-8e9d-5e61429ef577&width=1248&dpr=3&quality=100&sign=c444e57e&sv=2) [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FQqjDcoSOp61dTfCNxQJt%252FUSD0%2520contracts.png%3Falt%3Dmedia%26token%3Da07e36c5-013a-4844-bf3a-2bda14d0aea3&width=752&dpr=3&quality=100&sign=3c35e15e&sv=2) **Contracts that power USD0** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FqKa2lQMESvzUV8vKwrqi%252FCard%2520Cover%252003.png%3Falt%3Dmedia%26token%3Dd62ccbd0-a163-418b-83d4-ebee158a08f9&width=752&dpr=3&quality=100&sign=6aa67ce0&sv=2) **Contracts that power USD0a** [](https://tech.usual.money/smart-contracts/protocol-contracts/eth0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FkIAr6o24CcXZt8bvmlbc%252FETH0%2520contracts.png%3Falt%3Dmedia%26token%3D3ee8121d-912e-4d46-824e-6549a5fc111d&width=752&dpr=3&quality=100&sign=f33430ee&sv=2) **Contracts that power ETH0** [](https://tech.usual.money/smart-contracts/protocol-contracts/eur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FJ05Aqkh2J0RiONORdSyF%252FCard%2520Cover%2520131.png%3Falt%3Dmedia%26token%3D3419081d-6f33-4d8b-86de-67bb8ece0f41&width=752&dpr=3&quality=100&sign=6c93f0d1&sv=2) **Contracts that power EUR0** [](https://tech.usual.money/smart-contracts/protocol-contracts/usual) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FNWP3EmzMJTdxXUovkOvc%252FUSUAL%2520contracts.png%3Falt%3Dmedia%26token%3Ddb01bd20-a0bb-416f-a213-bc111cc886e2&width=752&dpr=3&quality=100&sign=eba765d7&sv=2) **Contracts that power USUAL** [PreviousUSUAL Distribution Modelchevron-left](https://tech.usual.money/overview/architecture/usual-distribution-model) [NextUSD0chevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0) Last updated 4 months ago Was this helpful? Was this helpful? --- # USUAL Distribution Model | Usual Tech Docs [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#introduction) Introduction ----------------------------------------------------------------------------------------------------------------- The following document is a comprehensive review of the USUAL minting module. It follows that USUAL is minted based on parameters tied to TVL, the underlying interest rate for the collateral of USD0 and additional factors. It should further be noted the math for this paper is specifically focused on a single asset environment where Usual only accepts and mints USD0 (which can be locked as USD0++) for collateral deposited (based on accepted Usual collateral). [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-of-usual) Minting of USUAL ------------------------------------------------------------------------------------------------------------------------- The minting of USUAL is completed daily and based on many different factors. The model has three layers of calculations. ### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#daily-minting-of-usual-first-layer) Daily Minting of USUAL - First Layer We calculate the daily distribution as such given d the global distribution rate, Mt the minting rate, Supply++ the supply of USD0++ , and P the primary market price of USD0: ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fvp03GmQ0Y2M2Y6NRIYiA%252Fimage.png%3Falt%3Dmedia%26token%3Dafd68f0f-f30f-45a3-98e5-232aeccb570b&width=768&dpr=3&quality=100&sign=d2ef243b&sv=2) The distribution rate is immutable and set to 0.25 meaning we will plan to fully distribute the minting rate per the market cap of current locked assets over 4 years total. However, given the dynamic nature of TVL and Price, the real circulating supply will be dynamic and is the aggregate of the daily distribution over time. ### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-rate-second-layer) Minting Rate - Second Layer The minting rate is a new concept that represents the supply of USUAL per LST to be emitted over four years (considering d = 0.25). It is inversely related to the growth of the LST supply St and directly related to changes in the interest rate Rt. This minting rate is capped so it does not exceed a set maximum rate κt allowing for some sensitivity to interest rate increases and LST supply reduction. Additionally, a growth control variable γt is included, allowing the DAO to accelerate or decelerate changes in the minting rate globally for all LST assets (set to 1 by default, but adjustable through governance). ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FM2NVbnFS7y6PQmbeSTs9%252FScreenshot%25202024-10-24%2520at%252019.50.21.png%3Falt%3Dmedia%26token%3D410f5b59-82a9-491d-97f4-dec774b44eaa&width=768&dpr=3&quality=100&sign=3b7bc8d0&sv=2) Where M0 is the initial set minting rate. This is immutable and set to 10. ### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-rate-factors-third-layer) Minting rate Factors - Third Layer There are 4 factors calculated which are used to compute the minting rate. We use the supply, rate, scale and cap factors to complete this calculation (as first illustrated in "Minting of USUAL"). #### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#supply-factor) Supply Factor St is a supply factor which inversely adjusts the minting rate as supply increases. It has a ceiling of 1 such that if the supply is ever below the initial supply at launch, we use this ceiling value. On the contrary, for any supply Supply++ above the initial supply Supply++, the factor will be below one. It t0 should further be noted we include price in the calculation Pt given this model can eventually be adapted to a multi asset environment (where we would still use the initial supply and current price of USD0 for the numerator rather than the initial supply and current price of the newly added asset - this is still under research). ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FN7KLsc290XS4BvrHov7G%252Fimage.png%3Falt%3Dmedia%26token%3Daad4ae9e-428a-47ab-a984-1699e3014e57&width=768&dpr=3&quality=100&sign=913de6a&sv=2) #### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#rate-factor) Rate Factor Rt is a rate factor which directly adjusts the minting rate based on change in the current underlying interest rate of collateral for USD0 rt (subject to the rate floor and celing rmin and P90(πt)). We use a rate floor set by the DAO to mint and distribute a minimum amount of USUAL. Further, we use the 90th percentile of the daily rates from the last 60 days as a rate ceiling to cap the rate factor increasing significantly when large sudden changes in the underlying interest rate are realized (ideally creating a smoother transition in the number of USUAL distributed before and after large rate changes). ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FAHE4AmUeEjsPJx9W878Z%252FScreenshot%25202024-11-01%2520at%252013.22.16.png%3Falt%3Dmedia%26token%3D1f766067-94e5-4be0-b33b-60d35475f992&width=768&dpr=3&quality=100&sign=d0d0c072&sv=2) #### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#scale-factor) Scale Factor The scale factor γt is used to modify the minted amount of USUAL by a set base scale factor γ which is set by the DAO and by a time factor τt. The base scale factor allows the DAO to modify the daily minting of USUAL to either reduce or increase the USUAL emission rate over time; this acts as either an accelerator for inflation when set below 1 (and always above 0) and as a decelerator when set above 1. If set to 1, the scale is neutral such that the inflation is as originally intended. The time factor for this is calculated using the UNIX timestamp at which the last mint occurred and the timestamp at which the current mint occurs. This is then adjusted to calculate how many days (based on using 86400 seconds per day via DF S = 86400, the distribution frequency scalar.) have elapsed between mints to adjust the distribution (given it is supposed to be daily). Since the model is meant to operate on a daily basis but may differ in terms of times between the actual mints of USUAL This function uses the last parameter values available at the time of the call for calculations. We use this to adjust and ensure the correct amount of USUAL per time is minted from one mint to the next. ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FFZoCn0leV4dOY9XROcyE%252FScreenshot%25202024-11-01%2520at%252013.22.38.png%3Falt%3Dmedia%26token%3D310065c0-e3be-4cf0-8a27-6a4e820d8373&width=768&dpr=3&quality=100&sign=1c7c5767&sv=2) #### [hashtag](https://tech.usual.money/overview/architecture/usual-distribution-model#cap-factor) Cap Factor Further, we set the cap factor κt based on the initial minting rate but is modified over time by the change in the underlying interest rates and the scale factor. κt is set as follows (where r0 is the initial underlying interest rate of USD0 at launch): ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FaxJ9OnX4RuvJwxRByVZA%252FScreenshot%25202024-10-24%2520at%252019.55.43.png%3Falt%3Dmedia%26token%3Dee746d51-3a36-4ad6-b148-7109c5539196&width=768&dpr=3&quality=100&sign=f11e6b3d&sv=2) circle-info The research paper on the USUAL distribution model can be downloaded below. file-pdf 215KB [USUAL Distribution Model.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FjcrVRcddasPhjcGb7ZQ9%2FUSUAL%20Distribution%20Model.pdf?alt=media&token=ad0fa318-374f-44c3-bc17-e5b72fa80194) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FjcrVRcddasPhjcGb7ZQ9%2FUSUAL%20Distribution%20Model.pdf?alt=media&token=ad0fa318-374f-44c3-bc17-e5b72fa80194) [PreviousRole Managementchevron-left](https://tech.usual.money/overview/architecture/role-management) [NextProtocol Contractschevron-right](https://tech.usual.money/smart-contracts/protocol-contracts) Last updated 1 year ago Was this helpful? * [Introduction](https://tech.usual.money/overview/architecture/usual-distribution-model#introduction) * [Minting of USUAL](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-of-usual) * [Daily Minting of USUAL - First Layer](https://tech.usual.money/overview/architecture/usual-distribution-model#daily-minting-of-usual-first-layer) * [Minting Rate - Second Layer](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-rate-second-layer) * [Minting rate Factors - Third Layer](https://tech.usual.money/overview/architecture/usual-distribution-model#minting-rate-factors-third-layer) Was this helpful? --- # Usual Protocol Primer | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FX5mUOyVQlIadphiDavhF%252FPage%2520Cover%252002.png%3Falt%3Dmedia%26token%3D96c9ac9c-a390-4bc5-85a5-25fac853138b&width=1248&dpr=3&quality=100&sign=2c8e1e32&sv=2) [hashtag](https://tech.usual.money/overview/usual-protocol-primer#what-is-the-usual-protocol-about-eli5-version) What is the Usual protocol about? (ELI5 version) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Usual is a new kind of stablecoin protocol designed to give users more control and rewards compared to traditional stablecoins like USDC or USDT. It creates a better system where you, as a user, not only benefit from using the stablecoin but also get ownership in the protocol itself. ### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#why-was-usual-created) **Why was Usual created?** In the current crypto landscape, stablecoin issuers (like Tether and Circle) make a lot of money, but users don’t benefit from this wealth. Usual flips this model by redistributing profits and ownership to users. This makes it a fairer system, where users who hold or use USD0 and $USUAL actually benefit from the protocol’s success. ### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#the-core-elements-of-usual) **The core elements of Usual** #### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#usd0) **USD0** This is Usual’s stablecoin. It's pegged to the US dollar and backed by real world assets (RWA) like US Treasury Bills (T-Bills). Unlike other stablecoins that might have hidden risks (like depending on banks), USD0 is fully backed by super-safe assets (T-Bills), making it more secure. It’s also designed to be permissionless and easily integrated into DeFi (Decentralized Finance) ecosystems. **Key features of USD0:** * Fully backed by RWA T-Bills, making it stable and secure * Completely transparent - anyone can verify the reserves backing USD0 * Works seamlessly in DeFi, allowing for easy trading, lending, or using it as collateral #### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#busd0) **bUSD0** bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. If you want to earn more from your USD0, you can deposit it in bUSD0 for up to four years. While locked, bUSD0 still remains liquid and tradable, and it earns extra rewards in the form of yield ($USUAL and maturity yield). **Key features of bUSD0:** * Staked for 4 years but still tradable in DeFi * Earns daily yield, paid in $USUAL tokens, as well as maturity yield * Offers a minimum guaranteed yield, making it attractive for users seeking stable returns #### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#eth0) ETH0 ETH0 is a synthetic ETH asset fully backed by Lido’s wstETH and issued by the Usual protocol. It allows institutional investors and crypto-native whales to maintain directional ETH exposure while capturing significantly higher yields than conventional staking or restaking. Powered by the same architecture that underpins Usual’s stablecoin (backed by tokenized T-bills), ETH0 holders receive USUAL tokens, allowing them to outperform the underlying yield. **Key features of USD0++:** * Retain full ETH exposure (1:1 peg to ETH) * Earn yield through USUAL distributions * Redeem their position anytime for wstETH #### [hashtag](https://tech.usual.money/overview/usual-protocol-primer#usual) **USUAL** USUAL is Usual’s governance token, but it’s much more than just a token to vote with. It represents ownership of the protocol, meaning users benefit from the protocol’s growth and revenue. The more USD0 is used, the more valuable USUAL becomes. It also gives users a say in how the protocol is run, including decisions on collateral types and rewards distribution. **Key features of USUAL:** * Represents ownership in the protocol’s revenue * The token supply grows slowly over time, ensuring it becomes more valuable as the protocol grows * USUAL holders can stake their tokens to earn more USUAL and participate in governance [PreviousUsual Tech Hubchevron-left](https://tech.usual.money/) [NextFeatureschevron-right](https://tech.usual.money/overview/features) Last updated 4 months ago Was this helpful? * [What is the Usual protocol about? (ELI5 version)](https://tech.usual.money/overview/usual-protocol-primer#what-is-the-usual-protocol-about-eli5-version) * [Why was Usual created?](https://tech.usual.money/overview/usual-protocol-primer#why-was-usual-created) * [The core elements of Usual](https://tech.usual.money/overview/usual-protocol-primer#the-core-elements-of-usual) Was this helpful? --- # Utility Contracts | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FO44xSFYqj7csSAiwII1V%252FPage%2520Cover%252007.png%3Falt%3Dmedia%26token%3D099fb3fe-d3b1-46b1-8c31-dfcdd2dac71d&width=1248&dpr=3&quality=100&sign=abcea038&sv=2) [](https://tech.usual.money/smart-contracts/utility-contracts/usd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FfZhANap8EAXOYinAePcV%252FCard%2520Cover%2520111.png%3Falt%3Dmedia%26token%3Dc5d8ede3-9f0c-4e21-a0ce-5b949f24292f&width=752&dpr=3&quality=100&sign=71ae3f94&sv=2) **Get infos on USD0(++) related oracles** [](https://tech.usual.money/smart-contracts/utility-contracts/usd0a) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fesnb4vA35w3DB0reAseA%252FCard%2520Cover%252003.png%3Falt%3Dmedia%26token%3Def1dff80-1a4e-4850-9fe5-546a21ab217f&width=752&dpr=3&quality=100&sign=3c227ef5&sv=2) **Get infos on USD0a related oracles** [](https://tech.usual.money/smart-contracts/utility-contracts/eth0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FVBLPMMIa8zGAduX1EVtd%252FCard%2520Cover%2520108.png%3Falt%3Dmedia%26token%3D57cd2071-daab-497b-920e-aba63b7d6045&width=752&dpr=3&quality=100&sign=cdb1c559&sv=2) **Get infos on ETH0 related oracles** [](https://tech.usual.money/smart-contracts/utility-contracts/eur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FXReNGjATzkvAneu2HyGH%252FCard%2520Cover%2520111%2520%282%29.png%3Falt%3Dmedia%26token%3D5e763d78-582a-4412-b1cd-b32d12ce3c50&width=752&dpr=3&quality=100&sign=2e436d3e&sv=2) **Get infos on EUR0 related oracles** [](https://tech.usual.money/smart-contracts/utility-contracts/usual) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FMgjqOnlgQyhwTZvLndcG%252FCard%2520Cover%2520109.png%3Falt%3Dmedia%26token%3D7583ecad-f9a8-4699-9792-c8047d36b235&width=752&dpr=3&quality=100&sign=c6fd7fa3&sv=2) **Get infos on USUAL related oracles** [PrevioussEUR0chevron-left](https://tech.usual.money/smart-contracts/token-contracts/seur0) [NextUSD0chevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0) Last updated 1 month ago Was this helpful? Was this helpful? --- # Token Contracts | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F9VNWxJ5rGBYBfdAQzIhL%252FPage%2520Cover%252006.png%3Falt%3Dmedia%26token%3Db22037dc-62af-4b9f-b656-2cbeda011531&width=1248&dpr=3&quality=100&sign=5d1aa6a6&sv=2) [](https://tech.usual.money/smart-contracts/token-contracts/usd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FXAfexvaeeUwVwZfFfxLZ%252FCard%2520Cover%252006.png%3Falt%3Dmedia%26token%3Dfa4485e0-49a8-423d-95bf-29404f795104&width=490&dpr=3&quality=100&sign=d0de971a&sv=2) **USD0 Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/usd0++) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FduLQpxGyY8nWXXhhWonY%252FCard%2520Cover%252007.png%3Falt%3Dmedia%26token%3D3a98275c-15b9-481e-a9ac-4400fa7d1fbc&width=490&dpr=3&quality=100&sign=c4ef33ee&sv=2) **bUSD0 (formerly USD0++) Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/usd0a) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FDgRMP6TusyRDJqvkiKGX%252Fusd0a.png%3Falt%3Dmedia%26token%3Db0b67910-ca89-4461-a082-e3a4f709fd9e&width=490&dpr=3&quality=100&sign=a553053e&sv=2) USD0a Smart Contract [](https://tech.usual.money/overview/features/eth0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FScflAqg7g4gJgOLEV1Nk%252FETH0%2520cover.png%3Falt%3Dmedia%26token%3De9043800-6bb4-447f-b69b-129b64be823b&width=490&dpr=3&quality=100&sign=abaa233&sv=2) **ETH0 Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/eur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FY6AG3rTbzH5DtBpQzOWd%252FCard%2520Cover%2520126.png%3Falt%3Dmedia%26token%3D2ed134d1-f0fa-4a7f-b3e5-8c57ded7f242&width=490&dpr=3&quality=100&sign=46bfd895&sv=2) **EUR0 Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/usual) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FeVvtMz8X9I9wnqpgoHW2%252FCard%2520Cover%252008.png%3Falt%3Dmedia%26token%3D21c61277-921e-462e-823a-63f06f414e85&width=490&dpr=3&quality=100&sign=97842914&sv=2) **USUAL Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/usualx) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FizeOf8kFjTFY0EAhFjeU%252FCard%2520Cover%252009.png%3Falt%3Dmedia%26token%3D865beaf4-6fcb-45ff-9274-0261b92057ba&width=490&dpr=3&quality=100&sign=42455997&sv=2) **USUALx Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/usual-1) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FcevDUnytgSNZ47xom288%252FCard%2520Cover%252010.png%3Falt%3Dmedia%26token%3D69882494-1530-4627-a029-24be11d29d80&width=490&dpr=3&quality=100&sign=7cdd0d7d&sv=2) **USUAL\* Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/susd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FjQiBm9yeqI8yX4QnoQo8%252FCard%2520Cover%252012.png%3Falt%3Dmedia%26token%3D11405e98-2248-4163-b7be-0b4ff216f590&width=490&dpr=3&quality=100&sign=7983c21b&sv=2) **sUSD0 Smart Contract** [](https://tech.usual.money/smart-contracts/token-contracts/seur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FuI3LLZftwXcefJVzOSgC%252FCard%2520Cover%252010.png%3Falt%3Dmedia%26token%3D529a6f9d-d6b0-4523-ae52-e5c5d3992439&width=490&dpr=3&quality=100&sign=78a0e556&sv=2) **sEUR0 Smart Contract** [PreviousUSUALx Lockup Contractchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract) [NextUSD0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usd0) Last updated 4 months ago Was this helpful? Was this helpful? --- # Features | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FHYulrXA9jjyTxiA37xZW%252FPage%2520Cover%252003.png%3Falt%3Dmedia%26token%3D3cfac1fd-8875-4d91-8d6d-7b71cb0cfedc&width=1248&dpr=3&quality=100&sign=57429de1&sv=2) [](https://tech.usual.money/overview/features/usd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FXAfexvaeeUwVwZfFfxLZ%252FCard%2520Cover%252006.png%3Falt%3Dmedia%26token%3Dfa4485e0-49a8-423d-95bf-29404f795104&width=752&dpr=3&quality=100&sign=d0de971a&sv=2) **Get to know USD0** [](https://tech.usual.money/overview/features/usd0++) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FPjXpBJqsuULz4bysy221%252Fwhatever%2520%281%29.png%3Falt%3Dmedia%26token%3De6788f8b-8b31-4a4a-bafd-8a18a9023e95&width=752&dpr=3&quality=100&sign=8e9994f2&sv=2) **Get to know bUSD0** [](https://tech.usual.money/overview/features/usd0a) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FDgRMP6TusyRDJqvkiKGX%252Fusd0a.png%3Falt%3Dmedia%26token%3Db0b67910-ca89-4461-a082-e3a4f709fd9e&width=752&dpr=3&quality=100&sign=a553053e&sv=2) **Get to know USD0a** [](https://tech.usual.money/overview/features/eur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FY6AG3rTbzH5DtBpQzOWd%252FCard%2520Cover%2520126.png%3Falt%3Dmedia%26token%3D2ed134d1-f0fa-4a7f-b3e5-8c57ded7f242&width=752&dpr=3&quality=100&sign=46bfd895&sv=2) **Get to know EUR0** [](https://tech.usual.money/overview/features/eth0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FScflAqg7g4gJgOLEV1Nk%252FETH0%2520cover.png%3Falt%3Dmedia%26token%3De9043800-6bb4-447f-b69b-129b64be823b&width=752&dpr=3&quality=100&sign=abaa233&sv=2) **Get to know ETH0** [](https://tech.usual.money/overview/features/usual) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FeVvtMz8X9I9wnqpgoHW2%252FCard%2520Cover%252008.png%3Falt%3Dmedia%26token%3D21c61277-921e-462e-823a-63f06f414e85&width=752&dpr=3&quality=100&sign=97842914&sv=2) **Get to know USUAL** [](https://tech.usual.money/overview/features/usualx-usual-staking) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FizeOf8kFjTFY0EAhFjeU%252FCard%2520Cover%252009.png%3Falt%3Dmedia%26token%3D865beaf4-6fcb-45ff-9274-0261b92057ba&width=752&dpr=3&quality=100&sign=42455997&sv=2) **Get to know USUALx** [](https://tech.usual.money/overview/features/usual-1) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FcevDUnytgSNZ47xom288%252FCard%2520Cover%252010.png%3Falt%3Dmedia%26token%3D69882494-1530-4627-a029-24be11d29d80&width=752&dpr=3&quality=100&sign=7cdd0d7d&sv=2) **Get to know USUAL\*** [](https://tech.usual.money/overview/features/mint-and-redeem-engine) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FzP3YzexwWfoQlGkMu4yT%252FCard%2520Cover%252005.png%3Falt%3Dmedia%26token%3D6f15e9f3-8171-4ce7-82fe-a58a9ba88533&width=752&dpr=3&quality=100&sign=af02a5d4&sv=2) **Understand our USD0 Mint & Redeem Engine** [](https://tech.usual.money/overview/features/usual-distribution) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEy064RKliOtKB8UKksFZ%252FCard%2520Cover%252011.png%3Falt%3Dmedia%26token%3Df19a57bf-580f-4bd9-b08d-bd35480ecece&width=752&dpr=3&quality=100&sign=a5427cd9&sv=2) **Understand the USUAL distribution** [PreviousUsual Protocol Primerchevron-left](https://tech.usual.money/overview/usual-protocol-primer) [NextUSD0chevron-right](https://tech.usual.money/overview/features/usd0) Last updated 4 months ago Was this helpful? Was this helpful? --- # Security Practices | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FCZ8cZz2r9ReDWCpnq1ww%252FPage%2520Cover%252010.png%3Falt%3Dmedia%26token%3Df0ec777f-9f83-40f0-ae58-439544b26b0d&width=1248&dpr=3&quality=100&sign=13951c90&sv=2) [hashtag](https://tech.usual.money/security-and-audits/security-practices#security-approach) Security Approach ------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/security-practices#multi-layered-security-strategy) Multi-layered Security Strategy 1. **Secure Development Practices**: We follow industry-standard secure coding practices and regularly review our codebase for potential vulnerabilities. 2. **Tokenomics Design and Simulation**: Mechanisms implemented in our smart contracts undergo thorough analysis by a team of economists to optimize and simulate their behavior to validate the designs. 3. **Access Control**: We implement robust access control mechanisms to ensure only authorized parties can interact with sensitive functions. 4. **Upgrade Mechanisms**: Our contracts include secure upgrade patterns to allow for improvements without compromising security or user funds. 5. **Smart Contract Security Audits**: Our contracts are periodically reviewed by multiple security auditors and bug bounty campaigns to find any vulnerabilities. 6. **Continuous Monitoring**: We employ advanced monitoring tools to detect any unusual activity or potential threats in real-time, allowing for swift response to any security incidents. [PreviousContract Deploymentschevron-left](https://tech.usual.money/smart-contracts/contract-deployments) [NextTesting Frameworkchevron-right](https://tech.usual.money/security-and-audits/testing-framework) Last updated 1 year ago Was this helpful? * [Security Approach](https://tech.usual.money/security-and-audits/security-practices#security-approach) * [Multi-layered Security Strategy](https://tech.usual.money/security-and-audits/security-practices#multi-layered-security-strategy) Was this helpful? --- # ETH0 Collateral | Usual Tech Docs [](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FaA3J0XxtlnEguEmh4yeM%252FCard%2520Cover%2520115.png%3Falt%3Dmedia%26token%3D3512e089-445d-4316-b021-641981e34965&width=752&dpr=3&quality=100&sign=5d1c6051&sv=2) **Get to know wstETH by Lido** [PreviousUSDC by Circlechevron-left](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle) [NextwstETH by Lidochevron-right](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido) Last updated 7 months ago Was this helpful? Was this helpful? --- # EUR0 Collateral | Usual Tech Docs [](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FeukypajACIrTom1EOUgh%252FCard%2520Cover%2520139.png%3Falt%3Dmedia%26token%3Db45192e9-d7b3-43a7-979a-86344147975b&width=752&dpr=3&quality=100&sign=50a5207b&sv=2) **Get to know EURTBL by Spiko** [PreviouswstETH by Lidochevron-left](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido) [NextEUTBL by Spikochevron-right](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko) Last updated 7 months ago Was this helpful? Was this helpful? --- # Monitoring Framework | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fc2OVhYgyinb9enFvHaVg%252FPage%2520Cover%252012.png%3Falt%3Dmedia%26token%3Df67c0cb7-7cf2-4d63-8c17-0e8a5b05ecb1&width=1248&dpr=3&quality=100&sign=7543bafa&sv=2) Our security operations provides 24/7/365 monitoring of the Usual protocol. This ensures that any potential issues or anomalies are detected and addressed promptly. ### [hashtag](https://tech.usual.money/security-and-audits/monitoring-framework#passive-monitoring) Passive Monitoring This foundational level focuses on monitoring the critical components that form the backbone of our protocol's security: * **Critical Role Monitoring**: Continuous tracking of all accounts with elevated privileges within the system. * **Multisig Activity**: Real-time monitoring of all multisignature wallet activities to ensure proper authorization of significant actions. * **Key Event Tracking**: Vigilant observation of crucial events such as: * Changes in role assignments * Updates to proxy implementations * Administrative changes Any activity at this level triggers immediate notifications to our security team for verification and response. ### [hashtag](https://tech.usual.money/security-and-audits/monitoring-framework#active-monitoring) Active Monitoring This level involves monitoring the operational aspects of our protocol to detect any deviations from expected behavior: * **Contract State Changes**: Tracking significant state changes across all protocol contracts. * **Mechanism Monitoring**: Continuous oversight of key protocol mechanisms, including: * Collateral Backing Ratio (CBR) activations and deactivations * Pausing and unpausing of contract functionalities * Activities within the DaoCollateral and SwapperEngine contracts * **Threshold Alerts**: Notifications triggered by unusual transaction volumes, large token movements, or unexpected price fluctuations. Anomalies detected at this level prompt immediate investigation by our security and development teams. #### [hashtag](https://tech.usual.money/security-and-audits/monitoring-framework#automated-defense-mechanisms) Automated defense mechanisms Our highest level of security involves automated circuit breakers that immediately pause contract operations in response to critical security events: * **Asset Protection**: Automatic pause triggers in response to suspicious movement of protocol funds * **Protocol Integrity**: Immediate response to unexpected changes in core protocol metrics, balances, and under collateralization. * **Access Security**: Detection and response to potential security access anomalies * **Smart Contract Safety**: Automated protection against suspicious contract interactions that could impact protocol security These automated defense mechanisms serve as the protocol's last line of defense, automatically pausing relevant contract operations when critical security thresholds are breached. This "circuit breaker" approach ensures the protocol can enter a safe state while our security team investigates and responds to potential threats. [PreviousTesting Frameworkchevron-left](https://tech.usual.money/security-and-audits/testing-framework) [NextAuditschevron-right](https://tech.usual.money/security-and-audits/audits) Last updated 1 year ago Was this helpful? * [Passive Monitoring](https://tech.usual.money/security-and-audits/monitoring-framework#passive-monitoring) * [Active Monitoring](https://tech.usual.money/security-and-audits/monitoring-framework#active-monitoring) Was this helpful? --- # USDC by Circle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle#who-is-circle) Who is Circle? -------------------------------------------------------------------------------------------------------------------- Circle is a financial technology company that develops infrastructure for digital currencies and payments. It is the principal issuer of USDC and a founding member of the Centre Consortium, which governs the standards and policies around USDC issuance and usage. Find out more about [Circlearrow-up-right](https://www.circle.com/fr/about-circle) . [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle#what-is-usdc) What is USDC? ------------------------------------------------------------------------------------------------------------------ USDC (USD Coin) is a fiat-backed stablecoin issued by Circle. Each USDC token is intended to be redeemable 1:1 for U.S. dollars, with reserves held in cash and short-duration U.S. government obligations. These reserves are held with regulated financial institutions, and Circle publishes regular attestations from third-party accounting firms to verify the backing of USDC in circulation. USDC is available on multiple blockchains and is used in a variety of applications, including payments, trading, decentralized finance (DeFi), and remittances. More on [USDCarrow-up-right](https://www.circle.com/fr/usdc) . [PreviousUsualUSDtbchevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb) [NextUsualUSDCchevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc) Last updated 10 months ago Was this helpful? * [Who is Circle?](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle#who-is-circle) * [What is USDC?](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle#what-is-usdc) Was this helpful? --- # Testing Framework | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F8taSz2YBH0xJPYSHhy8V%252FPage%2520Cover%252011.png%3Falt%3Dmedia%26token%3Da9fbaad7-ae5b-4623-a34f-f5ef38b33988&width=1248&dpr=3&quality=100&sign=c897e07f&sv=2) [hashtag](https://tech.usual.money/security-and-audits/testing-framework#testing-framework) Testing Framework ------------------------------------------------------------------------------------------------------------------ Our comprehensive testing framework ensures the reliability and security of our protocol: 1. **Unit Testing**: Extensive unit tests cover individual functions and components. 2. **Integration Testing**: We perform thorough integration tests to ensure different parts of the system work together seamlessly. 3. **Fuzz Testing**: Automated fuzz testing helps identify edge cases and unexpected inputs that could lead to vulnerabilities. 4. **Stress Testing**: We simulate extreme scenarios to ensure our protocol remains stable under pressure and shifts in interest rates. 5. **Scenario Testing**: Complex real-world scenarios are modeled and tested to validate the protocol's behavior in various market conditions. [PreviousSecurity Practiceschevron-left](https://tech.usual.money/security-and-audits/security-practices) [NextMonitoring Frameworkchevron-right](https://tech.usual.money/security-and-audits/monitoring-framework) Last updated 1 year ago Was this helpful? Was this helpful? --- # USD0a Collateral | Usual Tech Docs [](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FJYSD1QXY5IOK28qPz5r8%252FCard%2520Cover%252017.png%3Falt%3Dmedia%26token%3D814c8fc9-27df-463b-86d3-6f9c610261b0&width=752&dpr=3&quality=100&sign=b9879313&sv=2) **Get to know USTB** [](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FDYu1FS3cRhgxqqLFfS5w%252Fuscc.png%3Falt%3Dmedia%26token%3D4a1e5455-c585-4233-ac09-b13d6452b03a&width=752&dpr=3&quality=100&sign=36ad83a9&sv=2) **Get to know USCC** [](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FfXtgCHut4dk7MBEMk2w9%252FCard%2520Cover%2520118%2520%281%29.png%3Falt%3Dmedia%26token%3De31180fe-1e50-4584-b8da-b6bc539a7157&width=752&dpr=3&quality=100&sign=f5691480&sv=2) Get to know USDC [PreviousUsualUSDCchevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc) [NextUSTB by Superstatechevron-right](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate) Last updated 5 months ago Was this helpful? Was this helpful? --- # Usual bUSD0 Investment Vault | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#high-level-overview) High-Level Overview The WrappedDollarVault contract is an upgradeable ERC4626-compliant yield-bearing vault. The contract leverages OpenZeppelin's upgradeable contracts for enhanced security and flexibility, including pausability and reentrancy protection. The vault holds another USD-denominated ERC4626 and allows users to deposit and withdraw this token, with fees accrued in USD, and a monotonic increase in USD value per share only, rather than a monotonic increase in assets or share. The price in units of asset decreases over time due to fees accruing. Only the registered router via the setRouter() function can call deposit, mint, withdraw, redeem . The goal of the router is to allow for swaps and permits for approvals, ensuring that arbitrary tokens are accepted as input and bUSD0 is accepted as output. The primary objective of the investment vault is to have a generic contract to allow wrapping of yield bearing token from external strategies without leaving the Usual ecosystem. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#contract-summary) Contract Summary The contract provides the following main functions: * `pause`: Pause the vault's functionality. * `unpause`: Unpause the vault's functionality. * `setRouter`: Add or remove a router. * `setFeeRateBps`: Set the fee rate in basis points. * `harvest`: Harvest management fees by minting shares to the treasury. * `feeRateBps`: Returns the fee rate in basis points. * `getRouterState`: Returns the state of a router. * `decimals`: Returns the number of decimals of the vault. * `withdraw` / `redeem`: Handles asset withdrawals and share redemptions, incorporating withdrawal fees. * `mint` / `deposit` : Handles depositing asset and mint shares of the vault * `previewWithdraw` / `previewRedeem`: Simulates withdrawal and redemption operations for users. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#inherited-contracts) Inherited Contracts * **PausableUpgradeable**: Enables emergency halt of contract operations. * **ReentrancyGuardUpgradeable**: Prevents reentrancy attacks in critical functions. * **ERC20PermitUpgradeable**: Extends ERC20 to support gasless transactions through signed * **ERC4626Upgradable**: Provide a standard implementation for ERC4626 vault. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#functionality-breakdown) Functionality Breakdown 1. Access Control and Security: * Utilizes a registry contract for role-based access control. * Implements specific role to set router `_VAULT_SET_ROUTER_ROLE_`, set fee `VAULT_SET_FEE_ROLE` and harvest `VAULT_HARVESTER_ROLE` to prevent specific addresses from interacting with the contract. * Enforces router registration for all the creation and destruction of vault shares, allowing only previously set router addresses to interact with the vault. 2. Fee Management: * Allows admin-controlled daily harvest of fee to the treasury. * Accrues fees over time based on configurable parameters. Fees are due when withdrawing and redeeming * The number of underlying assets behind a share decreases over time due to fee accruing. 3. Asset Management: * Implements ERC4626 standard for standardized vault interactions. * Handles withdrawals, and redemption with consideration for accrued fees. * Asset is yield bearing so its USD value will increase overtime. 4. Upgradability and Pause Mechanism: * Utilizes OpenZeppelin's upgradeable contract pattern for future improvements. * Includes pause functionality for emergency situations. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-initialize) Method: initialize Initializes the vault, setting up the registry contract, underlying asset, name, symbol, and initial vault state. 11-12. Ensures valid registry contract and underlying asset addresses, reverting if either is zero to prevent null references. 1. Initializes inherited contracts for reentrancy protection 14-15. ERC20 functionality sets the vault name, symbol and permit support. 16-17. Pausability, and ERC4626 vault standards with the underlying asset. 19-22. Sets up contract storage with the registry contract, access control from the registry. 23-26. treasury address, default fee rate, last fee update timestamp, and mints initial shares to a dead address. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-setrouter) Method: setRouter Add or disable a router, updating its active state. 1\. Sets the router address is only callable when the vault is not paused. 3-4. Checks that the caller has the `VAULT_SET_ROUTER_ROLE` via the registry’s access control, reverting if unauthorized. 5. Ensures the router address is not zero, reverting if null to prevent invalid settings. 7-8. Verifies the router’s current state differs from the requested state, reverting if unchanged to avoid redundant updates. 9-10. Updates the router’s active state in storage and emits a `RouterUpdated` event with the router address and new status. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-setfeeratebps) Method: setFeeRateBps Set the fee rate in basis points, updating the vault’s fee structure. 1-2. Sets a new fee rate in micro basis points is only callable when the vault is not paused, with a check to ensure it doesn’t exceed the maximum allowed fee rate. 5-6. Verifies the caller has the `VAULT_SET_FEE_ROLE` via the registry’s access control, reverting if unauthorized. 8. Ensures the new fee rate differs from the current rate, reverting if unchanged to avoid redundant updates. 9-10. Confirms at least one week has passed since the last fee update, reverting if too frequent to maintain stability. 12-15. Stores the old fee rate, updates the fee rate and timestamp in storage, and emits a `FeeRateUpdated` event with the old and new rates. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-harvest) Method: harvest Harvest management fees by minting shares to the treasury based on the current fee rate 1-5. Initiates the harvest process to mint shares for management fees, callable only when not paused and non-reentrant, returning the number of shares minted. 9-10. Verifies the caller has the `VAULT_HARVESTER_ROLE` via the registry’s access control, reverting if unauthorized. 13-14. Ensures at least one day has passed since the last harvest, reverting if too frequent to prevent abuse. 17-20. Calculates the shares to mint based on the current total supply and fee rate, reverting if the result is zero to avoid empty operations. 22-28. Updates the last harvest timestamp, mints the calculated shares to the treasury, emits a `Harvested` event with the caller and shares minted, and returns the shares minted. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-previewwithdraw) Method: previewWithdraw 1-6. Previews the withdrawal process by calculating the shares needed to withdraw a given amount of assets, including the applicable fee, overriding the ERC4626 implementation. 8-10. Retrieves the vault’s storage and calculates the fee based on the requested assets and the current fee rate in basis points. 13. Adds the fee to the requested assets and uses the parent ERC4626 `previewWithdraw` function to determine the total shares required, returning the result. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-previewredeem) Method: previewRedeem Previews the amount of assets that would be returned for redeeming a specified number of shares, after deducting fees 1-6. Previews the redemption process by calculating the assets returned for a given number of shares, after subtracting the applicable fee, overriding the ERC4626 implementation. 9. Uses the parent ERC4626 `previewRedeem` function to convert the shares into assets. 13. Calculates the fee based on the raw asset amount and the current fee rate in basis points. 12. Returns the assets minus the calculated fee as the final redeemable amount * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#method-_withdraw) Method: \_withdraw Internal function to handle the withdrawal of assets, including minting fee shares to the treasury. 1-9. Executes the withdrawal process internally, taking the caller, receiver, owner, assets, and shares as inputs, overriding the parent implementation to include fee handling. 15. Calculates the fee in shares based on the raw shares being withdrawn and the current fee rate in basis points. 18. Calls the parent \_withdraw function to perform the core withdrawal logic for the specified assets and shares. 21-22. Mints the calculated fee shares to the treasury if the fee is greater than zero, ensuring fees are collected. [PreviousUSUALxchevron-left](https://tech.usual.money/smart-contracts/token-contracts/usualx) [NextVaultRouterchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault#security-analysis) Was this helpful? Copy function initialize( address registryContract_, address underlyingAsset_, string memory name_, string memory symbol_ ) public initializer { if (registryContract_ == address(0) || underlyingAsset_ == address(0)) { revert NullAddress(); } __ReentrancyGuard_init(); __ERC20_init(name_, symbol_); __ERC20Permit_init(name_); __ERC20Pausable_init(); __ERC4626_init(IERC20(underlyingAsset_)); WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); $.registryContract = IRegistryContract(registryContract_); $.registryAccess = IRegistryAccess( $.registryContract.getContract(CONTRACT_REGISTRY_ACCESS) ); $.treasury = $.registryContract.getContract(CONTRACT_YIELD_TREASURY); $.feeRateBps = DEFAULT_FEE_RATE_BPS; $.lastFeeRateUpdateTimestamp = block.timestamp; _mint(DEAD_ADDRESS, INITIAL_SHARES_SUPPLY); } Copy function setRouter(address router, bool isActive) public whenNotPaused { WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); if (!$.registryAccess.hasRole(VAULT_SET_ROUTER_ROLE, _msgSender())) { revert NotAuthorized(); } if (router == address(0)) revert NullAddress(); if ($.routers[router] == isActive) { revert SameRouterActivity(router, isActive); } $.routers[router] = isActive; emit RouterUpdated(router, isActive); } Copy function setFeeRateBps(uint32 newFeeRateBps) external whenNotPaused { if (newFeeRateBps > MAX_FEE_RATE_BPS) revert InvalidFeeRate(); WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); if (!$.registryAccess.hasRole(VAULT_SET_FEE_ROLE, _msgSender())) { revert NotAuthorized(); } if (newFeeRateBps == $.feeRateBps) revert SameFeeRate(); if (block.timestamp < $.lastFeeRateUpdateTimestamp + ONE_WEEK) { revert FeeRateUpdateTooFrequent(); } uint32 oldFeeRateBps = $.feeRateBps; $.feeRateBps = newFeeRateBps; $.lastFeeRateUpdateTimestamp = block.timestamp; emit FeeRateUpdated(oldFeeRateBps, newFeeRateBps); } Copy function harvest() external whenNotPaused nonReentrant returns (uint256 sharesMinted) { WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); if (!$.registryAccess.hasRole(VAULT_HARVESTER_ROLE, _msgSender())) { revert NotAuthorized(); } if (block.timestamp < $.lastHarvestTimestamp + ONE_DAY) { revert HarvestTooFrequent(); } uint256 currentSupply = totalSupply(); sharesMinted = _feeOnTotal(currentSupply, $.feeRateBps); if (sharesMinted == 0) revert ZeroAmount(); $.lastHarvestTimestamp = block.timestamp; _mint($.treasury, sharesMinted); emit Harvested(_msgSender(), sharesMinted); return sharesMinted; } Copy function previewWithdraw(uint256 assets) public view virtual override(ERC4626Upgradeable, IERC4626) returns (uint256) { WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); // Calculate fee amount uint256 fee = _feeOnTotal(assets, $.feeRateBps); // Calculate shares needed for assets + fee return super.previewWithdraw(assets + fee); } Copy function previewRedeem(uint256 shares) public view virtual override(ERC4626Upgradeable, IERC4626) returns (uint256) { // Convert shares to assets uint256 assets = super.previewRedeem(shares); WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); // Calculate and deduct fee uint256 fee = _feeOnRaw(assets, $.feeRateBps); return assets - fee; } Copy function _withdraw( address caller, address receiver, address owner, uint256 assets, uint256 shares ) internal virtual override { WrappedDollarVaultStorageV0 storage $ = _wrappedDollarVaultStorageV0(); // Calculate fee shares uint256 feeShares = _feeOnRaw(shares, $.feeRateBps); // Call parent implementation to handle the withdrawal super._withdraw(caller, receiver, owner, assets, shares); // Mint fee shares to treasury if (feeShares > 0) { _mint($.treasury, feeShares); } } --- # USD0 Collateral | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FN4zKj5VMgUIqw7bGLtzT%252FPage%2520Cover%252008.png%3Falt%3Dmedia%26token%3D752694c9-f00f-4029-9c5b-43916fdbd80d&width=1248&dpr=3&quality=100&sign=9866bb2a&sv=2) [](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fcax7EwMdvk97RTr3uls2%252FCard%2520Cover%252062.png%3Falt%3Dmedia%26token%3D97cd859e-4c09-4f12-bb8d-8b09e3f614b6&width=752&dpr=3&quality=100&sign=eabd25ec&sv=2) **Get to know USYC** [](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FKidmBH4q9ibumPx5xULX%252FCard%2520Cover%2520119.png%3Falt%3Dmedia%26token%3Dee737dee-cfb1-45e4-b01c-ffe4ed3673a6&width=752&dpr=3&quality=100&sign=6fbb14f&sv=2) **Get to know M** ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FsACry8IQh4hUPnwFf7xZ%252FCard%2520Cover%252064.png%3Falt%3Dmedia%26token%3Dec8ac39b-14ed-4691-8a9d-964d266c85bd&width=752&dpr=3&quality=100&sign=ab2fcdc9&sv=2) **Get to know USDtb** [](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FfXtgCHut4dk7MBEMk2w9%252FCard%2520Cover%2520118%2520%281%29.png%3Falt%3Dmedia%26token%3De31180fe-1e50-4584-b8da-b6bc539a7157&width=752&dpr=3&quality=100&sign=f5691480&sv=2) Get to know USDC [PreviousRedStone Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usual/redstone-oracle) [NextUSYC by Hashnotechevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote) Last updated 7 months ago Was this helpful? Was this helpful? --- # USDtb by Ethena | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena#who-is-ethena) Who is Ethena? --------------------------------------------------------------------------------------------------------------------- Ethena is a pioneering synthetic dollar protocol built on the Ethereum blockchain, offering a crypto-native alternative to traditional financial systems. Its flagship product, USDe, is a synthetic dollar designed to provide stability and scalability without relying on conventional banking infrastructure. Find out more about [Ethenaarrow-up-right](https://ethena.fi/) . [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena#what-is-usdtb) What is USDtb? --------------------------------------------------------------------------------------------------------------------- In December 2024, Ethena introduced USDtb, a stablecoin backed primarily by BlackRock's USD Institutional Digital Liquidity Fund (BUIDL). This fund invests in short-term U.S. government debt, cash, and repos, providing a stable and secure foundation for USDtb. The stablecoin's reserves are composed of approximately 90% BUIDL and 10% stablecoins like USDC to facilitate liquidity and redemptions. USDtb offers a distinct risk profile compared to Ethena's earlier synthetic dollar token, USDe, which utilizes a derivative-based trading strategy. By being fully backed by reserve assets, USDtb provides users with a more stable and reliable digital asset option. More on [USDtbarrow-up-right](https://usdtb.money/) . [PreviousUsualMchevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm) [NextUsualUSDtbchevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb) Last updated 1 year ago Was this helpful? * [Who is Ethena?](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena#who-is-ethena) * [What is USDtb?](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena#what-is-usdtb) Was this helpful? --- # EUR0 Classical Oracle | Usual Tech Docs circle-info Unlike other Usual protocols, the ClassicalOracle contract has been merged with the AbstractOracle one [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------------------------------- The ClassicalOracle contract is used by DaoCollateral to fetch the price of external tokens. The price of tokens is used for minting and redeeming the right amount of EUR0. It is an upgradable contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#contract-summary) Contract Summary The logic contained in ClassicalOracle includes: * Initializing `tokenToOracleInfo` for each supported token with a ChainlinkV3Aggregator-compatible price feed * 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 * Interacting with the aggregator to fetch the latest price and its number of decimals ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with the ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **Initializable**: Allows to handle contract setup and upgrades. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------------------------------- After deploying the contract, the administrator should initialize the price feed for all supported collateral thanks to the `initializeTokenOracle` function. When another contract or external service calls `getPrice` or `getQuote`, the contract calls the virtual function `_latestRoundData` passing the desired token as parameter. This function is implemented in ClassicalOracle and retrieves the associated price aggregator for this token, then calls `decimals` and `latestRoundData.` ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#public-external-functions) Public/External Functions * **initializeTokenOracle(address token, address dataSource, uint64 timeout, bool isStablecoin)**: Registers a new supported token or updates the data source (price aggregator) for an existing token. The new price feed must have been last updated within the last `timeout` seconds. This check is only performed once. If `isStablecoin` is true, the depeg check will be enabled and `getPrice`/`getQuote` will revert if the price is not around $1. * **getMaxDepegThreshold()**: Returns the current maximum allowed price variation for stablecoins in basis points (e.g. with a value of 500, `getPrice` and `getQuote` will revert if the price of a stablecoin is outside the range $0.95-$1.05). View function. * **setMaxDepegThreshold(uint256 maxAuthorizedDepegPrice)**: Updates the maximum allowed price variation and emits a `SetMaxDepegThreshold` event. Nonpayable function. Reserved for admin use only. * **getPrice(address token)**: Returns the price of the given token scaled to 18 decimals (e.g. a return value of 3e18 means the token price is $3). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. * **getQuote(address token)**: Returns the USD value equivalent to the given amount of the given token (e.g. if the token price is $3, calling with 1e6 will return 3e6, no matter the number of decimals of the token). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. [PreviousEUR0chevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eur0) [NextCircle EURC/EUR Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle) Last updated 7 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle#functions-description) Was this helpful? --- # RedStone Oracle | Usual Tech Docs [RedStonearrow-up-right](https://www.redstone.finance/) is a leading oracle provider fulfilling the growing need for decentralized applications (dApps) to access data feeds that are frequently updated, reliable, and secure. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usual/redstone-oracle#usual) USUAL ------------------------------------------------------------------------------------------------------------ [![Logo](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fapp.redstone.finance%2Ffav.svg&width=20&dpr=3&quality=100&sign=a049d92d&sv=2)Push Feeds | RedStoneRedStone Oracleschevron-right](https://app.redstone.finance/app/feeds/ethereum-mainnet/usual/) USUAL/USD Pricefeed Etherscan: [0x2240AE461B34CC56D654ba5FA5830A243Ca54840arrow-up-right](https://etherscan.io/address/0x2240AE461B34CC56D654ba5FA5830A243Ca54840) [PreviousUSUALchevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usual) [NextUSD0 Collateralchevron-right](https://tech.usual.money/smart-contracts/usd0-collateral) Last updated 1 year ago Was this helpful? Was this helpful? --- # Architecture | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fx8gKizkgQJNz1AzFWPCP%252FPage%2520Cover%252004.png%3Falt%3Dmedia%26token%3D4f5fff7a-a6bd-4652-b5ab-9f99c5f5b8cb&width=1248&dpr=3&quality=100&sign=96921786&sv=2) circle-info This architecture describes the V1 state of the USD0, ETH0 and USUAL protocol. Further updates will be commenced with new feature releases. ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FAIoAppiHEamBqqC2mLrl%252Fimage.png%3Falt%3Dmedia%26token%3Dfbdfdbed-af12-4202-b23d-766bef83340c&width=768&dpr=3&quality=100&sign=55ad3dba&sv=2) V1 Architecture circle-info This architecture describes the V1 state of the ETH0. Further updates will be commenced soon. ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FNcgLVqTQGzeazi2ilJ7C%252Fimage.png%3Falt%3Dmedia%26token%3Dde3b1446-bb75-423f-8b72-47c1e1bd19da&width=768&dpr=3&quality=100&sign=bae6cce5&sv=2) ETH0 V1 Architecture circle-info This architecture describes the V1 state of the EUR0. Further updates will be commenced soon. ![EUR0 V1 Architecture](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F3V8JpzFaw51rYZoaymLK%252Fimage.png%3Falt%3Dmedia%26token%3D28c6b599-8353-4b4d-9c3d-c6000c96aecf&width=768&dpr=3&quality=100&sign=8087a690&sv=2) EUR0 V1 Architecture The Usual protocol contracts are specifically engineered to handle complex operations such as asset swaps between Real World Assets (RWAs) and stablecoins, lifecycle management of the USD0 stablecoin, structured financial product issuance, efficient asset exchange without traditional liquidity pools, and accurate asset pricing for reliable transaction execution. Usual's smart contracts follow the [transparent proxy patternarrow-up-right](https://docs.openzeppelin.com/contracts/4.x/api/proxy#TransparentUpgradeableProxy) to allow the Usual DAO to upgrade the protocol contracts, to expand its functionalities and have the possibility to remedy any unexpected issues. Our current on-chain Collateral RWA consists of [Hashnote's USYCarrow-up-right](https://usyc.hashnote.com/) . [hashtag](https://tech.usual.money/overview/architecture#core-contracts) **Core Contracts** ------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/overview/architecture#daocollateral) [**DaoCollateral**](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) The `daoCollateral.sol` contract is essential in swapping real-world assets (RWAs) . It enables users to swap RWAs for the USD0 stablecoin and vice versa, and serves as a key node for converting these assets into more liquid forms like USDC. * **Key Functionalities:** * **Swap and Redeem Mechanisms**: Facilitate the conversion between RWAs and Usual's stablecoin (USD0), as well as swapping into USDC for enhanced liquidity in conjunction with the SwapperEngine. ### [hashtag](https://tech.usual.money/overview/architecture#usd0) [**USD0**](https://tech.usual.money/smart-contracts/token-contracts/usd0) The primary Stablecoin of Usual, a liquid and transferable ERC-20 token that can be staked or locked to receive rewards. It is backed by cash equivalents like tokenized money market funds. * **Key Functionalities:** * **Controlled Minting and Burning**: Manages the stablecoin supply to match backing assets, essential for value stability. ### [hashtag](https://tech.usual.money/overview/architecture#busd0-formerly-usd0) [**bUSD0 (formerly USD0++)**](https://tech.usual.money/overview/architecture#usd0-1) The `USD0PP contract` is tailored for bond management, replicating traditional fixed end-date bonds. It allows for the issuance, management, and redemption of bUSD0 (formerly USD0++), a 4 year bond emitting off-chain yield (only during the pre-launch, on-chain afterwards) * **Key Functionalities:** * **Bond Lifecycle Management**: Facilitates the minting and unwrapping of bond tokens, offering fixed-income securities in blockchain format. * **Emergency Withdrawal Mechanisms**: Provides options for asset withdrawal in critical situations, reinforcing trust and security for investors. * **Automated Parity Mechanisms**: Provides options for the Usual DAO to maintain parity of USD0<->bUSD0 (formerly USD0++) on secondary markets if deemed necessary. * **Floor-price redemption:** Provides an early-redemption option to redeem bUSD0 (formerly USD0++) before the bond maturity date for the floor price. ### [hashtag](https://tech.usual.money/overview/architecture#swapperengine) [**SwapperEngine**](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) The SwapperEngine contract ensures efficient token swaps between USDC and USD0 through an order matching system, avoiding traditional liquidity pools for direct no-fee, low-slippage exchanges. * **Key Functionalities:** * **Efficient Order Matching**: Allows for precise order placement and fulfillment, minimizing costs and slippage. ### [hashtag](https://tech.usual.money/overview/architecture#classicaloracle) [**ClassicalOracle**](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle) Essential for the ecosystem's functionality, the ClassicalOracle contract sources accurate pricing information to inform asset valuations , ensuring all financial operations are based on reliable market data. * **Key Functionalities:** * **Robust Data Sources**: Aggregates and evaluate prices from pricefeeds to diminish risks related to price manipulation. * **Stablecoin Monitoring**: Implements checks to maintain stablecoin pegs, crucial for the ecosystem's financial stability. ### [hashtag](https://tech.usual.money/overview/architecture#usual) [**USUAL**](https://tech.usual.money/smart-contracts/token-contracts/usualx) The `USUAL` contract implements the governance token of the Usual Protocol, incorporating security features and role-based access control. $USUAL is a ERC-20 compliant token designed with pausability and permit functionalities, allowing for enhanced governance mechanisms and secure token operations. * **Key Functionalities:** * **Role-Based Token Operations**: Implements strict access control for critical functions like minting, burning, and blacklist management through dedicated roles (USUAL\_MINT, USUAL\_BURN, BLACKLIST\_ROLE). ### [hashtag](https://tech.usual.money/overview/architecture#usual-1) [**USUAL\***](https://tech.usual.money/overview/features/usual-1) The `Usual*` contract implements the Early Contributor Token of the Usual Protocol, incorporating security features and role-based access control. $USUAL is a ERC-20 compliant token designed with pausability and permit functionalities, allowing for enhanced governance mechanisms and secure token operations. The totalSupply is capped and no further mints of `USUAL*` are possible. All Usual\* is initially locked into the [UsualSP contract](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking) as part of the allocation/ vested mechanic. * **Key Functionalities:** * **Role-Based Token Operations**: * Strict access control for critical functions through dedicated roles (USUALS\_BURN, BLACKLIST\_ROLE) * Special one-time deployment privileges for the USUALSP contract via stakeAll() ### [hashtag](https://tech.usual.money/overview/architecture#distribution-module-contract) [**Distribution Module Contract**](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution) The `DistributionModule` contract manages the daily distribution of Usual tokens across on-chain vaults (UsualX and UsualS) and off-chain user allocations. It implements a sophisticated distribution system with challenge mechanisms and merkle-proof validation to ensure fair and secure token allocation. * **Key Functionalities:** * **Daily Token Distribution**: * Calculates and distributes new token emissions * Manages off-chain distribution allocations through a merkle-proof system * Scales distribution based on time elapsed since last distribution * **Security Mechanisms**: * Challengeable queue system for off-chain distributions * 7-day challenge period for distribution validation * Role-based access control for critical operations * **Distribution Features**: * Configurable bucket allocation percentages * Real-time emission calculations based on protocol parameters * Automated distribution tracking and validation system ### [hashtag](https://tech.usual.money/overview/architecture#yield-module-contract) [Yield Module Contract](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module) The `YieldModule` contract manages the collection, accumulation, and distribution of yield generated from Real World Assets (RWAs) backing the protocol's stablecoins. It serves as the central hub for yield processing and implements sophisticated mechanisms to ensure fair and efficient yield distribution across protocol participants. * **Key Functionalities:** * **Yield Collection & Processing**: * Aggregates yield from multiple RWA sources backing USD0 * Calculates blended interest rates from various RWA (Real World Asset) sources * Tracks interest rates for different assets via oracles or manual input * Calculates weighted average interest rates based on asset values in treasuries * Manages treasury addresses where assets are held * Provides a P90 interest rate for protocol calculations * **Security Mechanisms:** * **Access Control:** * Role-based permissions for yield collection and calculation operations * **Yield Validation:** * Data freshness (checks if oracle data is within maxDataAge) * Feed interface validity (checks if Chainlink feed returns valid data) * Interest rate bounds (ensures rates don't exceed basis point limits) This module works in conjunction with the Distribution Module to ensure that both newly minted tokens and accumulated yields are distributed fairly and efficiently across the protocol ecosystem. ### [hashtag](https://tech.usual.money/overview/architecture#eth0) [ETH0](https://tech.usual.money/overview/features/eth0) `ETH0` is an Ethereum-pegged synthetic ERC-20 compliant token fully collateralized by wstETH. * **Key Functionalities:** * **Controlled Minting and Burning**: Manages the ETH0 supply to match backing asset (wstETH), essential for value stability. * **Controlled Supply Management**: Mint Cap: Has a configurable mint cap to prevent excessive issuance * **Role-Based Token Operations**: * Strict access control for critical functions through dedicated roles (ETH0\_MINT, ETH0\_BURN, BLACKLIST\_ROLE) * Emergency stop though dedicated role (PAUSING\_CONTRACTS\_ROLE, UNPAUSING\_CONTRACTS\_ROLE) ### [hashtag](https://tech.usual.money/overview/architecture#eth0-daocollateral) [ETH0 DaoCollateral](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral) `ETH0 DaoCollateral` contract is a core component of ETH0 that manages collateralization, minting, and redemption of ETH0 tokens. It ensures ETH0 is fully backed by collateral and provides secure mechanisms for token swapping and redemption with emergency safeguards. * **Key Functionalities:** * **Swap and Redeem Mechanisms**: Facilitate the conversion between wstETH and Usual's ETH (ETH0). * **Role-Based Token Operations**: Segregated roles for admin, pausing, unpausing, and DAO operations * **Fee Management** Adjustable redemption fees (max 25%) for protocol sustainability and automated fee distribution to yield treasury * **Security Mechanisms:** * **Counter Bank Run (CBR)**: Emergency mechanism that reduces collateral returns during market stress * **Pausability**: Granular pausing of swap/redeem operations and global contract pausing ### [hashtag](https://tech.usual.money/overview/architecture#eur0) [EUR0](https://tech.usual.money/smart-contracts/token-contracts/eur0) `EUR0` is an Ethereum-pegged synthetic ERC-20 compliant token fully collateralized by EUTBL. * **Key Functionalities:** * **Controlled Minting and Burning**: Manages the EUR0 supply to match backing asset (EUTBL), essential for value stability. * **Role-Based Token Operations**: * Strict access control for critical functions through dedicated roles (EUR0\_MINT, EUR0\_BURN, BLACKLIST\_ROLE) * Emergency stop though dedicated role (PAUSING\_CONTRACTS\_ROLE, UNPAUSING\_CONTRACTS\_ROLE) ### [hashtag](https://tech.usual.money/overview/architecture#eur0-daocollateral) [EUR0 DaoCollateral](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral) `EUR0 DaoCollateral` contract is a core component of EUR0 that manages collateralization, minting, and redemption of EUR0 tokens. It ensures EUR0 is fully backed by collateral and provides secure mechanisms for token swapping and redemption with emergency safeguards. * **Key Functionalities:** * **Swap and Redeem Mechanisms**: Facilitate the conversion between EUTBL and Usual's EUR (EUR0). * **Role-Based Token Operations**: Segregated roles for admin, pausing, unpausing, and DAO operations * **Fee Management** Adjustable redemption fees (max 25%) for protocol sustainability and automated fee distribution to yield treasury * **Security Mechanisms:** * **Counter Bank Run (CBR)**: Emergency mechanism that reduces collateral returns during market stress * **Pausability**: Granular pausing of swap/redeem operations and global contract pausing ### [hashtag](https://tech.usual.money/overview/architecture#eur0-swapperengine) [EUR0 SwapperEngine](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine) The SwapperEngine contract ensures efficient token swaps between EURC and EUR0 through an order matching system, avoiding traditional liquidity pools for direct no-fee, low-slippage exchanges. * **Key Functionalities:** * **Efficient Order Matching**: Allows for precise order placement and fulfillment, minimizing costs and slippage. ### [hashtag](https://tech.usual.money/overview/architecture#usualx-lockup) [USUALX Lockup](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract) The `UsualXLockup` contract allows users to lock their **UsualX** tokens for predetermined durations (1, 3, 6, or 12 months). It's designed primarily for governance participation and reward earning mechanisms, providing a secure and flexible token locking infrastructure with comprehensive position management capabilities. * **Key Functionalities:** * **Locking Operations** * **Position Creation**: Users can create new lock positions with specified amounts and durations * **Intra-day Top-ups**: Enhance existing positions within the same UTC calendar day as creation * **Position Release**: Withdraw tokens after lock expiration * **Combined Operations**: Release expired positions and immediately create new ones * **Security Mechanisms:** * **Role-based Permissions**: Different roles for pausing, unpausing, duration management, and forced unlocking * **Reentrancy Protection**: Guards against reentrancy attacks on all state-changing functions * **Pausable Operations:** Emergency halt capabilities for contract operations * **Administrative Features** * **Lock Duration Management**: Configure which lock durations are available * **Batch Processing**: Efficient handling of multiple position unlock operation * **Balance Tracking**: Total locked amount per user [PreviousUsual bUSD0 (formerly USD0++) Investment Vaultchevron-left](https://tech.usual.money/overview/features/usual-usd0++-investment-vault) [NextRole Managementchevron-right](https://tech.usual.money/overview/architecture/role-management) Last updated 4 months ago Was this helpful? * [Core Contracts](https://tech.usual.money/overview/architecture#core-contracts) * [DaoCollateral](https://tech.usual.money/overview/architecture#daocollateral) * [USD0](https://tech.usual.money/overview/architecture#usd0) * [bUSD0 (formerly USD0++)](https://tech.usual.money/overview/architecture#busd0-formerly-usd0) * [SwapperEngine](https://tech.usual.money/overview/architecture#swapperengine) * [ClassicalOracle](https://tech.usual.money/overview/architecture#classicaloracle) * [USUAL](https://tech.usual.money/overview/architecture#usual) * [USUAL\*](https://tech.usual.money/overview/architecture#usual-1) * [Distribution Module Contract](https://tech.usual.money/overview/architecture#distribution-module-contract) * [Yield Module Contract](https://tech.usual.money/overview/architecture#yield-module-contract) * [ETH0](https://tech.usual.money/overview/architecture#eth0) * [ETH0 DaoCollateral](https://tech.usual.money/overview/architecture#eth0-daocollateral) * [EUR0](https://tech.usual.money/overview/architecture#eur0) * [EUR0 DaoCollateral](https://tech.usual.money/overview/architecture#eur0-daocollateral) * [EUR0 SwapperEngine](https://tech.usual.money/overview/architecture#eur0-swapperengine) * [USUALX Lockup](https://tech.usual.money/overview/architecture#usualx-lockup) Was this helpful? --- # Role Management | Usual Tech Docs [hashtag](https://tech.usual.money/overview/architecture/role-management#role-and-permissions) Role & Permissions ---------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/overview/architecture/role-management#default_admin) DEFAULT\_ADMIN The DEFAULT\_ADMIN role serves as the highest administrative authority in the system, possessing complete control over role management and critical system parameters. This role can manage all other roles, control emergency functions, configure core system parameters, and execute privileged operations across all contracts. It is typically assigned to a secure multisig wallet or governance contract and cannot be renounced to prevent system lockup. A delay of three days must be observed before granting that role to a new address. **Role Holders**: Usual Multisig * Add USD0 RWA (TokenMapping) * Unpause (AirdropDistribution, AirdropTaxCollector, DaoCollateral, DistributionModule, L2Usd0, L2Usd0PP, SwapperEngine, Usd0, USD0pp, Usual, UsualS, USUALSP, UsualX) * Activate/Deactivate CBR (DaoCollateral) * Set redeem fee (DaoCollateral) * Redeem DAO (DaoCollateral) * Unpause redeem/swap (DaoCollateral) * Set max depeg threshold (AbstractContract) * Initialize token oracle (ClassicalOracle, UsualOracle) * Set role admin (RegistryAccess) * Set contract (RegistryContract) * Update minimum USDC amount provided (SwapperEngine) * Emergency withdraw (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#pausing_contracts_role) PAUSING\_CONTRACTS\_ROLE The PAUSING\_CONTRACTS\_ROLE exists as an emergency control mechanism to halt contract operations when critical issues are detected. This role has the ability to pause functionality across multiple core contracts including token transfers, DAO collateral operations, and swapper engine activities. It serves as a first line of defense against potential exploits or system anomalies. **Role Holders**: Usual Multisig * Pause ( DaoCollateral, DistributionModule, L2Usd0, L2Usd0PP, SwapperEngine, Usd0, USD0pp, Usual, UsualS, USUALSP, UsualX) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#unpausing_contracts_role) UNPAUSING\_CONTRACTS\_ROLE The UNPAUSING\_CONTRACTS\_ROLE is crucial for resuming normal operations after an emergency pause has been enacted. This role ensures that, after thorough checks and validations, the systems and contract functionalities that were halted can be safely reactivated. It is critical for maintaining operational continuity and system integrity. **Role Holders**: Usual Multisig * Unpause ( DaoCollateral, DistributionModule, L2Usd0, L2Usd0PP, SwapperEngine, Usd0, USD0pp, Usual, UsualS, USUALSP, UsualX) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_m_pause) USUAL\_M\_PAUSE The USUAL\_M\_PAUSE role is dedicated to managing pause functions for wrapped m. Holders of this role have the authority to initiate emergency pauses, ensuring immediate response to critical threats or issues within the system's operations. This ability is essential for maintaining system security and operational stability during unforeseen events. **Role Holders**: Usual Pauser * Pause (UsualM) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_m_unpause) USUAL\_M\_UNPAUSE The USUAL\_M\_UNPAUSE role is critical for resuming operations that were halted due to an emergency pause. Holders of this role can safely unpause the system once the underlying issues are addressed, ensuring that the system returns to normal operations without compromising security and stability. **Role Holders**: Usual Multisig * Unpause (UsualM) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_m_unwrap) USUAL\_M\_UNWRAP The USUAL\_M\_UNWRAP role is responsible for managing the unwrapping operations within the system. This involves managing the conversion of wrapped tokens back to their original form in a secure and efficient manner, ensuring liquidity and accessibility for stakeholders. **Role Holders**: Usual Multisig * Unwrap (UsualM) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_m_mintcap_allocator) USUAL\_M\_MINTCAP\_ALLOCATOR The USUAL\_M\_MINTCAP\_ALLOCATOR is responsible for managing the allocation of the minting cap within the system. This role ensures that minting operations are within the predefined limits, maintaining stability and preventing excessive token creation which could impact the market. **Role Holders**: Usual Mintcap Multisig * setMintCap (UsualM) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#nonce_threshold_manager) NONCE\_THRESHOLD\_MANAGER The NONCE\_THRESHOLD\_MANAGER is tasked with continuous monitoring and management of the nonce thresholds within the DAO collateral system. This role requires frequent adjustments based on transaction volume and emerging security requirements, ensuring robust protection against unauthorized transaction replays. **Role Holders**: Usual Multisig * Monitor and adjust nonce thresholds (NonceManagement) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#nonce_threshold_setter_role) NONCE\_THRESHOLD\_SETTER\_ROLE The NONCE\_THRESHOLD\_SETTER\_ROLE exists to manage the nonce threshold parameters in the DAO collateral system. This role is responsible for setting and adjusting the nonce threshold that determines the validity of swap intents, helping prevent replay attacks and ensuring transaction ordering in the RWA to STBC swap process. **Role Holders**: Usual Multisig * Set nonce threshold (DaoCollateral) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#intent_matching_role) INTENT\_MATCHING\_ROLE The INTENT\_MATCHING\_ROLE exists to facilitate secure RWA to STBC token swaps in the DAO collateral system. This role is responsible for executing swap intents by matching off-chain orders with on-chain transactions, ensuring proper order execution and token transfers between parties. The role is typically assigned to trusted swap operators or automated market makers authorized by the Usual Multisig. **Role Holders**: Swapper Engine Keeper * Swap RWA to STBC intent (DaoCollateral) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#distribution_operator_role) DISTRIBUTION\_OPERATOR\_ROLE The DISTRIBUTION\_OPERATOR\_ROLE exists to manage the daily distribution of USUAL tokens across various protocol buckets and off-chain distributions. This role is responsible for executing the core token distribution mechanics, including calculating new emissions, distributing tokens to on-chain vaults (Usual+ and Usual\*), and managing the off-chain distribution queue through merkle proofs. The role is typically assigned to an automated keeper managed. **Role Holders**: Google KMS Service Account (Keeper) * Distribute USUAL to buckets (DistributionModule) * Queue off-chain USUAL distribution (DistributionModule) * Reset off-chain distribution queue (DistributionModule) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#distribution_allocator_role) DISTRIBUTION\_ALLOCATOR\_ROLE The DISTRIBUTION\_ALLOCATOR\_ROLE exists to manage the core economic parameters of the USUAL token distribution system. This role is responsible for configuring the distribution mechanics by setting emission rates, bucket allocations, and key distribution parameters that determine how USUAL tokens are distributed across different protocol components. The role has significant control over the tokenomics and must be carefully managed to ensure fair and efficient token distribution. It is typically assigned to a Usual Multisig under DAO oversight. **Role Holders**: Usual DAO * Set buckets distribution (DistributionModule) * Set gamma (DistributionModule) * Set rate min (DistributionModule) * Set D (DistributionModule) * Set M0 (DistributionModule) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#distribution_challenger_role) DISTRIBUTION\_CHALLENGER\_ROLE The DISTRIBUTION\_CHALLENGER\_ROLE exists as a security mechanism to ensure the integrity of off-chain USUAL token distributions. This role has the authority to challenge and invalidate potentially incorrect or malicious distributions before they are finalized. It can challenge all distributions in the queue that are older than a specified timestamp and optionally propose new valid distributions with corrected merkle roots. The role serves as a critical safeguard against distribution errors or manipulation attempts and is typically assigned to the Usual Multisig. **Role Holders**: Usual Multisig * Challenge distribution (DistributionModule) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#blacklist_role) BLACKLIST\_ROLE The BLACKLIST\_ROLE exists as a security mechanism to protect the protocol from malicious actors, comply with regulatory requirements, and ensure rapid response to security incidents. This role has the authority to restrict specific addresses from participating in token transfers and protocol operations across multiple core contracts including L2USD0, L2USD0PP, USD0PP, USD0, USUAL, USUALS, and USUALX. **Role Holders**: Usual Multisig * Blacklist/Unblacklist (L2Usd0, L2Usd0PP, USD0pp, Usd0, Usual, UsualS, UsualX) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0_mint) USD0\_MINT The USD0\_MINT role exists as a critical control mechanism for managing the supply of USD0 tokens in the system. This role has the authority to mint new USD0 tokens across multiple contracts including L2USD0, L2USD0PP, and USD0, but only when there is sufficient backing in the treasury. The role is typically assigned to the DAO Collateral contract and other protocol-controlled contracts to ensure automated and secure minting operations. **Role Holders**: DAO Collateral Contract, SwapperEngine * Mint (L2Usd0, L2Usd0PP, Usd0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0_burn) USD0\_BURN The USD0\_BURN role exists as a critical control mechanism for managing the supply of USD0 tokens in the system. This role has the authority to burn USD0 tokens across multiple contracts including L2USD0, L2USD0PP, and USD0, ensuring proper supply management and redemption functionality. The role is typically assigned to the DAO Collateral contract and SwapperEngine to enable automated burning operations during redemptions and swaps. **Role Holders**: DAO Collateral Contract, SwapperEngine * Burn (L2Usd0, L2Usd0PP, Usd0) * Burn from (L2Usd0, L2Usd0PP, Usd0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#early_bond_unlock_role) EARLY\_BOND\_UNLOCK\_ROLE The EARLY\_BOND\_UNLOCK\_ROLE exists to manage early bond unlocking functionality in the USD0PP (USD0 Plus Plus) contract. This role is responsible for configuring and executing early bond release mechanisms, allowing authorized entities to set up special unlock periods and allocate early unlock balances for specific bond holders. **Role Holders**: Usual Multisig * Allocate early unlock balance (USD0pp) * Setup early unlock period (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#peg_maintainer_role) PEG\_MAINTAINER\_ROLE The PEG\_MAINTAINER\_ROLE exists to maintain the USD0 peg through interactions with Curve pools and peg maintenance mechanisms. This role is responsible for triggering the Par mechanism on the USD0/USD0PP Curve pools in the case the peg is broken. **Role Holders**: Usual Multisig * Trigger PAR mechanism Curvepool (USD0pp) * Unwrap peg maintainer (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_mint) USUAL\_MINT The USUAL\_MINT role exists to control the minting of new USUAL tokens. This role has the authority to mint new USUAL tokens to specified addresses, ensuring that token supply expansion follows protocol rules and economic parameters. The role is typically assigned to the Distribution Module contract to handle automated emissions and rewards distribution. **Role Holders**: Distribution Module Contract * Mint (Usual) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_burn) USUAL\_BURN The USUAL\_BURN role exists as a critical control mechanism for managing the supply of USUAL tokens in the system. This role has the authority to burn USUAL tokens from any address, ensuring proper supply management during redemptions, liquidations, or other protocol operations that require token destruction. The role is typically assigned to protocol-controlled contracts. **Role Holders**: N/A * Burn (Usual) * Burn from (Usual) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usuals_burn) USUALS\_BURN The USUALS\_BURN role exists as a critical control mechanism for managing the supply of USUALS tokens in the system. This role has the authority to burn USUALS tokens from any address. The role is typically assigned to protocol-controlled contracts that need to manage USUALS token supply, particularly during staking and unstaking operations. **Role Holders**: USUALSP Contract * Burn (UsualS) * Burn from (UsualS) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usualsp_operator_role) USUALSP\_OPERATOR\_ROLE The USUALSP\_OPERATOR\_ROLE exists to manage the staking and allocation mechanics of the USUALS token staking program. This role is responsible for configuring initial token allocations, managing the staking process, and handling original allocation removals in the USUALSP (USUAL Staking Pool) contract. The role has significant control over the staking parameters and must be carefully managed to ensure fair distribution and proper vesting of tokens. **Role Holders**: Usual Multisig * Allocate (USUALSP) * Remove original allocation (USUALSP) * Stake UsualS (USUALSP) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#withdraw_fee_updater_role) WITHDRAW\_FEE\_UPDATER\_ROLE The WITHDRAW\_FEE\_UPDATER\_ROLE exists to manage withdrawal fee parameters in the UsualX contract. This role is responsible for adjusting the fees charged when users withdraw their tokens, allowing the protocol to maintain economic stability and prevent exploitation of the withdrawal mechanism. **Role Holders**: Usual Multisig * Update withdraw fee (UsualX) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#floor_price_updater_role) FLOOR\_PRICE\_UPDATER\_ROLE The FLOOR\_PRICE\_UPDATER\_ROLE exists to manage the minimum price threshold for USD0PP tokens in the system. This role is responsible for adjusting the floor price parameter that helps maintain price stability and protect token holders from excessive devaluation. The role has the authority to update floor prices in the USD0PP contract, which directly impacts the minimum value guarantee of the token. **Role Holders**: Usual Multisig * Update floor price (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp_usual_distribution_role) USD0PP\_USUAL\_DISTRIBUTION\_ROLE The USD0PP\_USUAL\_DISTRIBUTION\_ROLE exists to manage the USUAL token distribution rate per USD0PP token. This role is responsible for adjusting the distribution rate parameter that determines how much USUAL is distributed per USD0PP token. **Role Holders**: Usual Multisig * Update usualDistributionPerUsd0pp (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp_duration_cost_factor_role) USD0PP\_DURATION\_COST\_FACTOR\_ROLE The USD0PP\_DURATION\_COST\_FACTOR\_ROLE exists to manage the duration cost factor that affects early redemption costs. This role is responsible for adjusting the duration cost factor parameter that helps determine the USUAL burn amount required for early redemptions. **Role Holders**: Usual Multisig * Update durationCostFactor (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp_treasury_allocation_rate_role) USD0PP\_TREASURY\_ALLOCATION\_RATE\_ROLE The USD0PP\_TREASURY\_ALLOCATION\_RATE\_ROLE exists to manage the percentage of burned USUAL that goes to the treasury during early redemptions. This role is responsible for adjusting the treasury allocation rate in basis points. **Role Holders**: Usual Multisig * Update treasuryAllocationRate (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp_target_redemption_rate_role) USD0PP\_TARGET\_REDEMPTION\_RATE\_ROLE The USD0PP\_TARGET\_REDEMPTION\_RATE\_ROLE exists to manage the daily redemption target rate for USD0PP tokens. This role is responsible for adjusting the target redemption rate (in basis points of total supply) that affects the USUAL burn calculations for early redemptions. **Role Holders**: Usual Multisig * Update targetRedemptionRate (USD0pp) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp_capped_unwrap_role) USD0PP\_CAPPED\_UNWRAP\_ROLE The `USD0PP_CAPPED_UNWRAP_ROLE` has certain responsibilities to ensure the stability and integrity of the protocol. **Role Holders**: Usual Multisig, Joint Partner Vault Multisig, VaultRouter * unwrapWithCap**()**: Role holders can adjust the capped unwrap limits, which control the maximum amount of tokens that can be unwrapped in a certain period ### [hashtag](https://tech.usual.money/overview/architecture/role-management#redirection_admin_role) REDIRECTION\_ADMIN\_ROLE The `REDIRECTION_ADMIN_ROLE` is responsible for redirecting off-chain distribution from an account to a new account **Role Holders**: Redirection Maintainers Multisig * redirection management of Offchain distribution: (DistributionModule) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yield_module_max_data_age_role) YIELD\_MODULE\_MAX\_DATA\_AGE\_ROLE the `YIELD_MODULE_MAX_DATA_AGE_ROLE` is responsible for setting the maximum data age for the RWA data. **Role Holders**: Usual Tokenomics Multisig * can manage maximum data age for yield module. (YieldModule) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yield_module_p90_interest_role) YIELD\_MODULE\_P90\_INTEREST\_ROLE The `YIELD_MODULE_P90_INTEREST_ROLE` is tasked with managing the P90 interest rate within the yield module. **Role Holders**: Usual Tokenomics Multisig * can modify P90 interest settings within the YieldModule. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yield_module_updater_role) YIELD\_MODULE\_UPDATER\_ROLE The `YIELD_MODULE_UPDATER_ROLE` is responsible for making updates within the Yield Module. **Role Holders**: Usual Tokenomics Multisig * Update Interest Rate to ensure accurate data. * Update yield data feed updates to various interest and yield settings. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yield_module_tokenomics_operator_role) YIELD\_MODULE\_TOKENOMICS\_OPERATOR\_ROLE The `YIELD_MODULE_TOKENOMICS_OPERATOR_ROLE` is designed to manage and oversee the tokenomics aspect within the Yield Module. **Role Holders**: Usual Tokenomics Multisig * Add yield data feed updates to various interest and yield settings. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yield_module_super_admin_role) YIELD\_MODULE\_SUPER\_ADMIN\_ROLE The `YIELD_MODULE_SUPER_ADMIN_ROLE` encompasses comprehensive control over the Yield Module. **Role Holders**: Usual Tokenomics Multisig * Remove yield data feed. * Manage the treasuries that are being used for the different calculations. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#vault_set_router_role) VAULT\_SET\_ROUTER\_ROLE The `VAULT_SET_ROUTER_ROLE` allows authorized entities to configure and manage router within the wrapped dollar vault system. **Role Holders**: Usual Vault Router Multisig * Enabling or disabling vault for wrapped dollar vaults. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#vault_pauser_role) VAULT\_PAUSER\_ROLE The `VAULT_PAUSER_ROLE` grants the authority to pause vault operations temporarily. **Role Holders**: Usual Vault Admin Multisig * Halting all transactions to address emergency scenarios or unforeseen issues. * Safeguarding assets by preventing unauthorized access or fraud during a pause. * Ensuring system integrity and stability by providing a controlled cessation of operations when necessary. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#vault_unpauser_role) VAULT\_UNPAUSER\_ROLE The `VAULT_UNPAUSER_ROLE` is designated to resume vault operations after they have been paused. **Role Holders**: Usual Vault Admin Multisig * Reactivating transactions once it is deemed safe and all issues have been resolved. * Restoring normal system functionality and access to vaults. * Collaborating with relevant parties to ensure a secure and well-managed transition back to normal operations. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#fee_sweeper_role) FEE\_SWEEPER\_ROLE The `FEE_SWEEPER_ROLE` can transfer the fees accumulating to the distribution module. **Role Holders**: Yield treasury Multisig * Collecting and distributing accrued fees from vault or bond withdrawals. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#fee_rate_setter_role) FEE\_RATE\_SETTER\_ROLE The `FEE_RATE_SETTER_ROLE` plays a crucial role in managing the fee rates within the system. **Role Holders**: Yield treasury Multisig * Alters the usualX, burn and treasury fee rate in basis points. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#unwrap_cap_allocator_role) UNWRAP\_CAP\_ALLOCATOR\_ROLE the UNWRAP\_CAP\_ALLOCATOR\_ROLE can update the unwrap bUSD0 (formerly USD0++) amount of a user **Role Holders**: Usual unwrap cap Multisig ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual_-_mintcap_allocator) USUAL\_\*\*\*\_MINTCAP\_ALLOCATOR Roles like `USUAL_USDC_MINTCAP_ALLOCATOR`, `USUAL_M_MINTCAP_ALLOCATOR` or `USUAL_USDTB_MINTCAP_ALLOCATOR` allows to set the mintcap for the corresponding tokens. **Role Holders**: Usual mint allocator Multisig * set the maximum amount of token that can be minted. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#wrappeddollarvault) WrappedDollarVault * `VAULT_PAUSER_ROLE` * can call `pause` * `VAULT_UNPAUSER_ROLE` * can call `unpause` * `VAULT_SET_ROUTER_ROLE` * can call `setRouter` * `VAULT_HARVESTER_ROLE` * can call `harvest` * `VAULT_SET_FEE_ROLE` * can call `setWithdrawFeeRateBps` * can call `setHarvestFeeRateBps` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#yieldmodule) YieldModule * `YIELD_MODULE_SUPER_ADMIN_ROLE` * can call `removeTreasury` * can call `addTreasury` * can call `removeYieldSource` * `YIELD_MODULE_TOKENOMICS_OPERATOR_ROLE` * can call `addYieldSourceWithFeed` * can call `addYieldSourceWithWeeklyInterest` * `YIELD_MODULE_UPDATER_ROLE` * can call `updateInterestRate` * can call `updateFeed` * `YIELD_MODULE_P90_INTEREST_ROLE` * can call `setP90InterestRate` * `YIELD_MODULE_MAX_DATA_AGE_ROLE` * can call `setMaxDataAge` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#tokenmapping) TokenMapping * `DEFAULT_ADMIN_ROLE` * can call `addUsd0Rwa` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol) DaoCollateral.sol * `DEFAULT_ADMIN_ROLE` * can call `activateCBR` * can call `deactivateCBR` * can call `setRedeemFee` * can call `redeemDao` * can call `unpause` * can call `unpauseRedeem` * can call `unpauseSwap` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * can call `pauseSwap` * can call `pauseRedeem` * `NONCE_THRESHOLD_SETTER_ROLE` * can call `setNonceThreshold` * `INTENT_MATCHING_ROLE` * can call `swapRWAtoStbcIntent` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#distributionmodule.sol) DistributionModule.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `DISTRIBUTION_OPERATOR_ROLE` * can call `distributeUsualToBuckets` * can call `queueOffChainUsualDistribution` * can call `resetOffChainDistributionQueue` * `DISTRIBUTION_ALLOCATOR_ROLE` * can call `setBucketsDistribution` * can call `setGamma` * can call `setRateMin` * can call `setD` * can call `setM0` * `DISTRIBUTION_CHALLENGER_ROLE` * can call `challengeDistribution` * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `USD0_MINT` * can call `mint` * `USD0_BURN` * can call `burn` * can call `burnFrom` * `REDIRECTION_ADMIN_ROLE` * can call `acceptRedirectedOffChainDistribution` * can call `removeRedirectedOffChainDistribution` * can call `cancelInitiatedRedirectedOffChainDistribution` * can call `redirectOffChainDistribution` * `FEE_RATE_SETTER_ROLE` * can call `setFeeRates` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation) RevenueDistributionModule.sol `OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE` * can call `distributeRevenueSwitch` `OPERATOR_ACC_DT_DISTRIBUTOR_ROLE` * can call `distributeAccruingDT` `OPERATOR_REB_DT_DISTRIBUTOR_ROLE` * can call `distributeRebasingDT` `OPERATOR_ADMIN_ROLE` * can call `setDailyAccruingYieldRate` * can call `setOperatorMintCap` * can call `setMaxRevSwitchMintCap` * can call `setMaxAccruingMintCap` * can call `setMaxRebasingDTMintCap` * can call `setRewardClaimForRevenueSwitch` * can call `setRewardClaimForAccruingDT` * can call `setRewardClaimForRebasingDT` `PAUSING_CONTRACTS_ROLE` * can call `pause` * can call `pauseRevenueSwitchDistribution` * can call `pauseAccruingDTDistribution` * can call `pauseRebasingDTDistribution` `UNPAUSING_CONTRACTS_ROLE` * can call `unpause` * can call `unpauseRevenueSwitchDistribution` * can call `unpauseAccruingDTDistribution` * can call `unpauseRebasingDTDistribution` `USD0_MINT` (on USD0 Contract) * can call `mint` (required for the Revenue Distribution Module to mint USD0 tokens during distributions) **Note**: The `USD0_MINT` role is granted to the RevenueDistributionModule contract on the USD0 token contract, not directly to individual operators. This allows the module to mint USD0 tokens when executing distributions. ### [hashtag](https://tech.usual.money/overview/architecture/role-management#susd0sol) sUSD0.sol * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `UNPAUSING_CONTRACTS_ROLE` * can call `unpause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` * `SUSD0_WITHDRAW_FEE_UPDATER_ROLE` * can call `updateWithdrawFee` * `SUSD0_YIELD_DISTRIBUTOR_ROLE` * can call `startYieldDistribution` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#l2usd0pp.sol) L2Usd0PP.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `USD0_MINT` * can call `mint` * `USD0_BURN` * can call `burn` * can call `burnFrom` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#abstractcontract.sol) AbstractContract.sol * `DEFAULT_ADMIN_ROLE` * can call `setMaxDepegThreshold` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#classicaloracle.sol) ClassicalOracle.sol * `DEFAULT_ADMIN_ROLE` * can call `initializeTokenOracle` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usualoracle.sol) UsualOracle.sol * `DEFAULT_ADMIN_ROLE` * can call `initializeTokenOracle` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#registryaccess.sol) RegistryAccess.sol * `DEFAULT_ADMIN_ROLE` * can call `setRoleAdmin` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#registrycontract.sol) RegistryContract.sol * `DEFAULT_ADMIN_ROLE` * can call `setContract` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#swapperengine.sol) SwapperEngine.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * can call `updateMinimumUSDCAmountProvided` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `DEFAULT_ADMIN_ROLE` * can call `blacklist` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `USD0_BURN` * can call `burn` * can call `burnFrom` * `USD0_MINT` * can call `mint` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usd0pp.sol) USD0pp.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * can call `emergencyWithdraw` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `EARLY_BOND_UNLOCK_ROLE` * can call `allocateEarlyUnlockBalance` * can call `setupEarlyUnlockPeriod` * `PEG_MAINTAINER_ROLE` * can call `triggerPARMechanismCurvepool` * can call `unwrapPegMaintainer` * `FLOOR_PRICE_UPDATER_ROLE` * can call `updateFloorPrice` * `USD0PP_USUAL_DISTRIBUTION_ROLE` * can call `setUsualDistributionPerUsd0pp` * `USD0PP_DURATION_COST_FACTOR_ROLE` * can call `setDurationCostFactor` * `USD0PP_TREASURY_ALLOCATION_RATE_ROLE` * can call `setTreasuryAllocationRate` * `USD0PP_USUAL_BURN_TARGET_REDEMPTION_ROLE` * can call `setTargetRedemptionRate` * `FEE_SWEEPER_ROLE` * can call `sweepFees` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usual.sol) Usual.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` * `USUAL_MINT` * can call `mint` * `USUAL_BURN` * can call `burn` * can call `burnFrom` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usuals.sol) UsualS.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` * `USUALS_BURN` * can call `burn` * can call `burnFrom` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usualsp.sol) USUALSP.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `USUALSP_OPERATOR_ROLE` * can call `allocate` * can call `removeOriginalAllocation` * can call `stakeUsualS` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usualx.sol) UsualX.sol * `DEFAULT_ADMIN_ROLE` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unBlacklist` * `WHITELIST_ROLE` * can call `whitelist` * can call `unWhitelist` * `WITHDRAW_FEE_UPDATER_ROLE` * can call `updateWithdrawFee` * `FEE_SWEEPER_ROLE` * can call `sweepFees` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#usualm.sol) USUALM.sol The `USUALM` contract includes specific roles designed to manage particular functionalities and maintain the security and efficiency of the platform. * `USUAL_M_UNPAUSE` * can call `unpause` * `USUAL_M_PAUSE` * can call `pause` * `BLACKLIST_ROLE` * can call `blacklist` * can call `unblacklist` * `USUAL_M_MINTCAP_ALLOCATOR` * can call `setMintCap` * `USUAL_M_UNWRAP` * can call `unwrap` [hashtag](https://tech.usual.money/overview/architecture/role-management#undefined) --------------------------------------------------------------------------------------- * * * [hashtag](https://tech.usual.money/overview/architecture/role-management#eth0-role-management) ETH0 Role Management ------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/overview/architecture/role-management#mint_cap_operator) MINT\_CAP\_OPERATOR The MINT\_CAP\_OPERATOR role is pivotal in controlling the minting activities for specific tokens. Holders of this role are empowered to adjust the cap on the amount of new tokens that can be minted within a certain period, ensuring that the minting process remains within defined limits to maintain token stability and prevent inflationary pressures. **Role Holders**: Token Governance Multisig * Update mintCap * Monitor compliance with minting policies * Enforce minting restrictions if caps are breached ### [hashtag](https://tech.usual.money/overview/architecture/role-management#blacklist_role-1) BLACKLIST\_ROLE The BLACKLIST\_ROLE exists as a security mechanism to protect the protocol from malicious actors, comply with regulatory requirements, and ensure rapid response to security incidents. This role has the authority to restrict specific addresses from participating in token transfers and protocol operations across multiple core contracts including L2USD0, L2USD0PP, USD0PP, USD0, USUAL, USUALS, and USUALX. **Role Holders**: Usual Multisig * Blacklist/Unblacklist (ETH0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#undefined-1) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#eth0_mint) ETH0\_MINT The ETH0\_MINT role exists as a critical control mechanism for managing the supply of ETH0 tokens in the system. This role has the authority to mint new ETH0 tokens across multiple contracts including ETH0, but only when there is sufficient backing in the treasury. The role is typically assigned to the DAO Collateral contract to ensure automated and secure minting operations. **Role Holders**: DAO Collateral Contract * Mint (ETH0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#eth0_burn) ETH0\_BURN The ETH0\_BURN role exists as a critical control mechanism for managing the supply of ETH0 tokens in the system. This role has the authority to burn ETH0 tokens across multiple contracts including ETH0, ensuring proper supply management and redemption functionality. The role is typically assigned to the DAO Collateral contract to enable automated burning operations during redemptions and swaps. **Role Holders**: DAO Collateral Contract * Burn (ETH0) * Burn from (ETH0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol-1) DaoCollateral.sol * `DEFAULT_ADMIN_ROLE` * can call `activateCBR` * can call `deactivateCBR` * can call `setRedeemFee` * can call `redeemDao` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * can call `pauseSwap` * can call `pauseRedeem` * `UNPAUSING_CONTRACTS_ROLE` * can call `unpause` * can call `unpauseRedeem` * can call `unpauseSwap` * `NONCE_THRESHOLD_SETTER_ROLE` * can call `setNonceThreshold` * * * [hashtag](https://tech.usual.money/overview/architecture/role-management#eur0-role-management) EUR0 Role Management ------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/overview/architecture/role-management#blacklist_role-2) BLACKLIST\_ROLE The BLACKLIST\_ROLE exists as a security mechanism to protect the protocol from malicious actors, comply with regulatory requirements, and ensure rapid response to security incidents. This role has the authority to restrict specific addresses from participating in token transfers and protocol operations across multiple core contracts including L2USD0, L2USD0PP, USD0PP, USD0, USUAL, USUALS, and USUALX. **Role Holders**: Usual Multisig * Blacklist/Unblacklist (EUR0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#eur0_mint) EUR0\_MINT The EUR0\_MINT role exists as a critical control mechanism for managing the supply of EUR0 tokens in the system. This role has the authority to mint new EUR0 tokens across multiple contracts including EUR0, but only when there is sufficient backing in the treasury. The role is typically assigned to the DAO Collateral contract to ensure automated and secure minting operations. **Role Holders**: DAO Collateral Contract * Mint (EUR0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#eur0_burn) EUR0\_BURN The EUR0\_BURN role exists as a critical control mechanism for managing the supply of EUR0 tokens in the system. This role has the authority to burn EUR0 tokens across multiple contracts including EUR0, ensuring proper supply management and redemption functionality. The role is typically assigned to the DAO Collateral contract to enable automated burning operations during redemptions and swaps. **Role Holders**: DAO Collateral Contract * Burn (EUR0) * Burn from (EUR0) ### [hashtag](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol-2) DaoCollateral.sol * `DEFAULT_ADMIN_ROLE` * can call `activateCBR` * can call `deactivateCBR` * can call `setRedeemFee` * can call `redeemDao` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * can call `pauseSwap` * can call `pauseRedeem` * `UNPAUSING_CONTRACTS_ROLE` * can call `unpause` * can call `unpauseRedeem` * can call `unpauseSwap` * `NONCE_THRESHOLD_SETTER_ROLE` * can call `setNonceThreshold` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation-1) sEUR0.sol * `**PAUSING_CONTRACTS_ROLE**` * can call `pause` * `**UNPAUSING_CONTRACTS_ROLE**` * can call `unpause` * `**BLACKLIST_ROLE**` * can call `blacklist` * can call `unBlacklist` * `**SEUR0_WITHDRAW_FEE_UPDATER_ROLE**` * can call `updateWithdrawFee` * `**SEUR0_YIELD_DISTRIBUTOR_ROLE**` * can call `startYieldDistribution` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#swapperengine.sol-1) SwapperEngine.sol * `DEFAULT_ADMIN_ROLE` * can call `updateMinimumEURCAmountProvided` * can call `unpause` * `PAUSING_CONTRACTS_ROLE` * can call `pause` * `UNPAUSING_CONTRACT_ROLE` * can call `unpause` ### [hashtag](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation-2) RevenueDistributionModule.sol `**OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE**` * can call `distributeRevenueSwitch` `**OPERATOR_ACC_DT_DISTRIBUTOR_ROLE**` * can call `distributeAccruingDT` `**OPERATOR_REB_DT_DISTRIBUTOR_ROLE**` * can call `distributeRebasingDT` `**OPERATOR_ADMIN_ROLE**` * can call `setDailyAccruingYieldRate` * can call `setOperatorMintCap` * can call `setMaxRevSwitchMintCap` * can call `setMaxAccruingMintCap` * can call `setMaxRebasingDTMintCap` * can call `setRewardClaimForRevenueSwitch` * can call `setRewardClaimForAccruingDT` * can call `setRewardClaimForRebasingDT` `**PAUSING_CONTRACTS_ROLE**` * can call `pause` * can call `pauseRevenueSwitchDistribution` * can call `pauseAccruingDTDistribution` * can call `pauseRebasingDTDistribution` `**UNPAUSING_CONTRACTS_ROLE**` * can call `unpause` * can call `unpauseRevenueSwitchDistribution` * can call `unpauseAccruingDTDistribution` * can call `unpauseRebasingDTDistribution` `**EUR0_MINT**` **(on EUR0 Contract)** * can call `mint` (required for the Revenue Distribution Module to mint EUR0 tokens during distributions) **Note:** The `EUR0_MINT` role is granted to the RevenueDistributionModule contract on the EUR0 token contract, not directly to individual operators. This allows the module to mint EUR0 tokens when executing distributions. [PreviousArchitecturechevron-left](https://tech.usual.money/overview/architecture) [NextUSUAL Distribution Modelchevron-right](https://tech.usual.money/overview/architecture/usual-distribution-model) Last updated 4 months ago Was this helpful? * [Role & Permissions](https://tech.usual.money/overview/architecture/role-management#role-and-permissions) * [DEFAULT\_ADMIN](https://tech.usual.money/overview/architecture/role-management#default_admin) * [PAUSING\_CONTRACTS\_ROLE](https://tech.usual.money/overview/architecture/role-management#pausing_contracts_role) * [UNPAUSING\_CONTRACTS\_ROLE](https://tech.usual.money/overview/architecture/role-management#unpausing_contracts_role) * [USUAL\_M\_PAUSE](https://tech.usual.money/overview/architecture/role-management#usual_m_pause) * [USUAL\_M\_UNPAUSE](https://tech.usual.money/overview/architecture/role-management#usual_m_unpause) * [USUAL\_M\_UNWRAP](https://tech.usual.money/overview/architecture/role-management#usual_m_unwrap) * [USUAL\_M\_MINTCAP\_ALLOCATOR](https://tech.usual.money/overview/architecture/role-management#usual_m_mintcap_allocator) * [NONCE\_THRESHOLD\_MANAGER](https://tech.usual.money/overview/architecture/role-management#nonce_threshold_manager) * [NONCE\_THRESHOLD\_SETTER\_ROLE](https://tech.usual.money/overview/architecture/role-management#nonce_threshold_setter_role) * [INTENT\_MATCHING\_ROLE](https://tech.usual.money/overview/architecture/role-management#intent_matching_role) * [DISTRIBUTION\_OPERATOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#distribution_operator_role) * [DISTRIBUTION\_ALLOCATOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#distribution_allocator_role) * [DISTRIBUTION\_CHALLENGER\_ROLE](https://tech.usual.money/overview/architecture/role-management#distribution_challenger_role) * [BLACKLIST\_ROLE](https://tech.usual.money/overview/architecture/role-management#blacklist_role) * [USD0\_MINT](https://tech.usual.money/overview/architecture/role-management#usd0_mint) * [USD0\_BURN](https://tech.usual.money/overview/architecture/role-management#usd0_burn) * [EARLY\_BOND\_UNLOCK\_ROLE](https://tech.usual.money/overview/architecture/role-management#early_bond_unlock_role) * [PEG\_MAINTAINER\_ROLE](https://tech.usual.money/overview/architecture/role-management#peg_maintainer_role) * [USUAL\_MINT](https://tech.usual.money/overview/architecture/role-management#usual_mint) * [USUAL\_BURN](https://tech.usual.money/overview/architecture/role-management#usual_burn) * [USUALS\_BURN](https://tech.usual.money/overview/architecture/role-management#usuals_burn) * [USUALSP\_OPERATOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#usualsp_operator_role) * [WITHDRAW\_FEE\_UPDATER\_ROLE](https://tech.usual.money/overview/architecture/role-management#withdraw_fee_updater_role) * [FLOOR\_PRICE\_UPDATER\_ROLE](https://tech.usual.money/overview/architecture/role-management#floor_price_updater_role) * [USD0PP\_USUAL\_DISTRIBUTION\_ROLE](https://tech.usual.money/overview/architecture/role-management#usd0pp_usual_distribution_role) * [USD0PP\_DURATION\_COST\_FACTOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#usd0pp_duration_cost_factor_role) * [USD0PP\_TREASURY\_ALLOCATION\_RATE\_ROLE](https://tech.usual.money/overview/architecture/role-management#usd0pp_treasury_allocation_rate_role) * [USD0PP\_TARGET\_REDEMPTION\_RATE\_ROLE](https://tech.usual.money/overview/architecture/role-management#usd0pp_target_redemption_rate_role) * [USD0PP\_CAPPED\_UNWRAP\_ROLE](https://tech.usual.money/overview/architecture/role-management#usd0pp_capped_unwrap_role) * [REDIRECTION\_ADMIN\_ROLE](https://tech.usual.money/overview/architecture/role-management#redirection_admin_role) * [YIELD\_MODULE\_MAX\_DATA\_AGE\_ROLE](https://tech.usual.money/overview/architecture/role-management#yield_module_max_data_age_role) * [YIELD\_MODULE\_P90\_INTEREST\_ROLE](https://tech.usual.money/overview/architecture/role-management#yield_module_p90_interest_role) * [YIELD\_MODULE\_UPDATER\_ROLE](https://tech.usual.money/overview/architecture/role-management#yield_module_updater_role) * [YIELD\_MODULE\_TOKENOMICS\_OPERATOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#yield_module_tokenomics_operator_role) * [YIELD\_MODULE\_SUPER\_ADMIN\_ROLE](https://tech.usual.money/overview/architecture/role-management#yield_module_super_admin_role) * [VAULT\_SET\_ROUTER\_ROLE](https://tech.usual.money/overview/architecture/role-management#vault_set_router_role) * [VAULT\_PAUSER\_ROLE](https://tech.usual.money/overview/architecture/role-management#vault_pauser_role) * [VAULT\_UNPAUSER\_ROLE](https://tech.usual.money/overview/architecture/role-management#vault_unpauser_role) * [FEE\_SWEEPER\_ROLE](https://tech.usual.money/overview/architecture/role-management#fee_sweeper_role) * [FEE\_RATE\_SETTER\_ROLE](https://tech.usual.money/overview/architecture/role-management#fee_rate_setter_role) * [UNWRAP\_CAP\_ALLOCATOR\_ROLE](https://tech.usual.money/overview/architecture/role-management#unwrap_cap_allocator_role) * [USUAL\_\*\*\*\_MINTCAP\_ALLOCATOR](https://tech.usual.money/overview/architecture/role-management#usual_-_mintcap_allocator) * [WrappedDollarVault](https://tech.usual.money/overview/architecture/role-management#wrappeddollarvault) * [YieldModule](https://tech.usual.money/overview/architecture/role-management#yieldmodule) * [TokenMapping](https://tech.usual.money/overview/architecture/role-management#tokenmapping) * [DaoCollateral.sol](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol) * [DistributionModule.sol](https://tech.usual.money/overview/architecture/role-management#distributionmodule.sol) * [RevenueDistributionModule.sol](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation) * [sUSD0.sol](https://tech.usual.money/overview/architecture/role-management#susd0sol) * [L2Usd0PP.sol](https://tech.usual.money/overview/architecture/role-management#l2usd0pp.sol) * [AbstractContract.sol](https://tech.usual.money/overview/architecture/role-management#abstractcontract.sol) * [ClassicalOracle.sol](https://tech.usual.money/overview/architecture/role-management#classicaloracle.sol) * [UsualOracle.sol](https://tech.usual.money/overview/architecture/role-management#usualoracle.sol) * [RegistryAccess.sol](https://tech.usual.money/overview/architecture/role-management#registryaccess.sol) * [RegistryContract.sol](https://tech.usual.money/overview/architecture/role-management#registrycontract.sol) * [SwapperEngine.sol](https://tech.usual.money/overview/architecture/role-management#swapperengine.sol) * [USD0pp.sol](https://tech.usual.money/overview/architecture/role-management#usd0pp.sol) * [Usual.sol](https://tech.usual.money/overview/architecture/role-management#usual.sol) * [UsualS.sol](https://tech.usual.money/overview/architecture/role-management#usuals.sol) * [USUALSP.sol](https://tech.usual.money/overview/architecture/role-management#usualsp.sol) * [UsualX.sol](https://tech.usual.money/overview/architecture/role-management#usualx.sol) * [USUALM.sol](https://tech.usual.money/overview/architecture/role-management#usualm.sol) * [](https://tech.usual.money/overview/architecture/role-management#undefined) * [ETH0 Role Management](https://tech.usual.money/overview/architecture/role-management#eth0-role-management) * [MINT\_CAP\_OPERATOR](https://tech.usual.money/overview/architecture/role-management#mint_cap_operator) * [BLACKLIST\_ROLE](https://tech.usual.money/overview/architecture/role-management#blacklist_role-1) * [](https://tech.usual.money/overview/architecture/role-management#undefined-1) * [ETH0\_MINT](https://tech.usual.money/overview/architecture/role-management#eth0_mint) * [ETH0\_BURN](https://tech.usual.money/overview/architecture/role-management#eth0_burn) * [DaoCollateral.sol](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol-1) * [EUR0 Role Management](https://tech.usual.money/overview/architecture/role-management#eur0-role-management) * [BLACKLIST\_ROLE](https://tech.usual.money/overview/architecture/role-management#blacklist_role-2) * [EUR0\_MINT](https://tech.usual.money/overview/architecture/role-management#eur0_mint) * [EUR0\_BURN](https://tech.usual.money/overview/architecture/role-management#eur0_burn) * [DaoCollateral.sol](https://tech.usual.money/overview/architecture/role-management#daocollateral.sol-2) * [sEUR0.sol](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation-1) * [SwapperEngine.sol](https://tech.usual.money/overview/architecture/role-management#swapperengine.sol-1) * [RevenueDistributionModule.sol](https://tech.usual.money/overview/architecture/role-management#revenue-distribution-module---roles-documentation-2) Was this helpful? --- # USCC by Superstate | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate#who-is-superstate) Who is Superstate? --------------------------------------------------------------------------------------------------------------------------------- Superstate is an asset-management firm building regulated, tokenized investment products on blockchain. Its mission is to bridge traditional financial markets with crypto-native infrastructure, allowing investors to hold real-world assets directly on-chain. Find out more about [Superstatearrow-up-right](https://superstate.com/) . [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate#what-is-uscc) What is USCC? ----------------------------------------------------------------------------------------------------------------------- USCC is the **Superstate Crypto Carry Fund**, tokenized as an ERC-20 (and in book-entry form), that executes a “cash-and-carry” strategy: it buys spot Bitcoin and Ether, and sells futures on those assets. It targets yield by exploiting the price differential between spot and futures markets, while remaining market-neutral (i.e., limited directional exposure). The fund is available to **qualified purchasers** More on [USCCarrow-up-right](https://superstate.com/assets/uscc) . [PreviousUSTB by Superstatechevron-left](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate) [NextUSDC by Circlechevron-right](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle) Last updated 5 months ago Was this helpful? * [Who is Superstate?](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate#who-is-superstate) * [What is USCC?](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate#what-is-uscc) Was this helpful? --- # FAQ | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FesftqPgboaydFZgbYk7k%252FPage%2520Cover%252016.png%3Falt%3Dmedia%26token%3Ddfe5396f-f088-40ac-b5e6-3a6559991225&width=1248&dpr=3&quality=100&sign=88045fe0&sv=2) circle-info As we are collecting feedback after each release this FAQ page will emerge. In the meantime feel free to ask the AI 🤖 or reach out on Discord. [PreviousReferenceschevron-left](https://tech.usual.money/resources/references) [NextGlossarychevron-right](https://tech.usual.money/support/glossary) Last updated 4 months ago Was this helpful? Was this helpful? --- # Contract Deployments | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FQKQpyXprERwJGupJJpvp%252FPage%2520Cover%252009.png%3Falt%3Dmedia%26token%3D81fe5688-2c41-49f4-8153-da568d6c8367&width=1248&dpr=3&quality=100&sign=d8de3011&sv=2) All our contracts are verified & their code is inspectable. They utilize transparent proxies, therefore you can see the implementation code/ABI, if you choose `Read/Write as Proxy` on Etherscan. [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#ethereum-mainnet) Ethereum Mainnet --------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#usual) USUAL Contract Name Address & Etherscan Link USUAL [0xC4441c2BE5d8fA8126822B9929CA0b81Ea0DE38Earrow-up-right](https://etherscan.io/address/0xC4441c2BE5d8fA8126822B9929CA0b81Ea0DE38E) USUALx [0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8Earrow-up-right](https://etherscan.io/address/0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E) USUALS [0x094B360AE512A65584d4f5Be33D68B2E08677b89arrow-up-right](https://etherscan.io/address/0x094b360ae512a65584d4f5be33d68b2e08677b89) USUALSP [0xa55AF35E5F4bb6A82E0A290570BcE38Ce2757d37arrow-up-right](https://etherscan.io/address/0xa55AF35E5F4bb6A82E0A290570BcE38Ce2757d37) USUAL distribution [0x75cC0C0DDD2Ccafe6EC415bE686267588011E36Aarrow-up-right](https://etherscan.io/address/0x75cC0C0DDD2Ccafe6EC415bE686267588011E36A) AirdropDistribution [0x89e813661628a277714C76d80c7fcB192a0896Edarrow-up-right](https://etherscan.io/address/0x89e813661628a277714C76d80c7fcB192a0896Ed) AirdropTaxCollector [0xA6cd248943F3d3415458b264e2C890FF422A4c01arrow-up-right](https://etherscan.io/address/0xA6cd248943F3d3415458b264e2C890FF422A4c01) YieldModule [0x647F8987C288bf6D2fDb332918E1E14424839EDAarrow-up-right](https://etherscan.io/address/0x647F8987C288bf6D2fDb332918E1E14424839EDA) UsualX Lockup [0x85b6f9bddb10c6b320d07416a250f984f0f0e9edarrow-up-right](https://etherscan.io/address/0x85B6F9BDdb10c6B320d07416a250F984f0F0E9ED#code) ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#usd0) USD0 Contract Name Address & Etherscan Link USD0 [0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5arrow-up-right](https://etherscan.io/address/0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5) bUSD0 (formerly USD0++) [0x35D8949372D46B7a3D5A56006AE77B215fc69bC0arrow-up-right](https://etherscan.io/token/0x35D8949372D46B7a3D5A56006AE77B215fc69bC0) rt-bUSD0 [0x82DCA22b48B14DE38ccf83B03330120c4b8acFe9arrow-up-right](https://etherscan.io/token/0x82DCA22b48B14DE38ccf83B03330120c4b8acFe9) sUSD0 [0xd861bE82dEe3223CFBEd160791f6550b0704D406arrow-up-right](https://etherscan.io/address/0xd861bE82dEe3223CFBEd160791f6550b0704D406) DaoCollateral [0xde6e1F680C4816446C8D515989E2358636A38b04arrow-up-right](https://etherscan.io/address/0xde6e1F680C4816446C8D515989E2358636A38b04) SwapperEngine [0xB969B0d14F7682bAF37ba7c364b351B830a812B2arrow-up-right](https://etherscan.io/address/0xB969B0d14F7682bAF37ba7c364b351B830a812B2) TokenMapping [0x43882C864a406D55411b8C166bCA604709fDF624arrow-up-right](https://etherscan.io/address/0x43882C864a406D55411b8C166bCA604709fDF624) RegistryAccess [0x0D374775E962c3608B8F0A4b8B10567DF739bb56arrow-up-right](https://etherscan.io/address/0x0D374775E962c3608B8F0A4b8B10567DF739bb56) RegistryContract [0x0594cb5ca47eFE1Ff25C7B8B43E221683B4Db34carrow-up-right](https://etherscan.io/address/0x0594cb5ca47eFE1Ff25C7B8B43E221683B4Db34c) ClassicalOracle [0xb97e163cE6A8296F36112b042891CFe1E23C35BFarrow-up-right](https://etherscan.io/address/0xb97e163cE6A8296F36112b042891CFe1E23C35BF) Chainlink USD0 Oracle [0x7e891DEbD8FA0A4Cf6BE58Ddff5a8ca174FebDCBarrow-up-right](https://etherscan.io/address/0x7e891DEbD8FA0A4Cf6BE58Ddff5a8ca174FebDCB) Chainlink bUSD0 (formerly USD0++) Oracle [0xFC9e30Cf89f8A00dba3D34edf8b65BCDAdeCC1cBarrow-up-right](https://etherscan.io/address/0xfc9e30cf89f8a00dba3d34edf8b65bcdadecc1cb) USD0RewardsClaim [0xB3911C121909736A9C1a76e5Cf078D19a3E7d233arrow-up-right](https://etherscan.io/address/0xB3911C121909736A9C1a76e5Cf078D19a3E7d233) Revenue Distribution Module [0x6ec631c19372d5a9345Ec4aeED93BA9eb0A45F77arrow-up-right](https://etherscan.io/address/0x6ec631c19372d5a9345Ec4aeED93BA9eb0A45F77) ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#usd0a) USD0a Contract Name Address & Etherscan Link USD0a [0x2e7fC02bE94BC7f0cD69DcAB572F64bcC173cd81arrow-up-right](https://etherscan.io/address/0x2e7fC02bE94BC7f0cD69DcAB572F64bcC173cd81) DaoCollateral [0xecD854A1a0ddd5f35F2F24eC3605D8BAebF77039arrow-up-right](https://etherscan.io/address/0xecD854A1a0ddd5f35F2F24eC3605D8BAebF77039) SwapperEngine [0x51B18b90A81a7Ff90FA5e7968358aAb18D479f4earrow-up-right](https://etherscan.io/address/0x51B18b90A81a7Ff90FA5e7968358aAb18D479f4e) TokenMapping [0x9D99EA108550f7777348bfA49e79589DB2a7d6e5arrow-up-right](https://etherscan.io/address/0x9D99EA108550f7777348bfA49e79589DB2a7d6e5) RegistryAccess [0xe4B1a03087D5BcB56d4fD6aF8267278246C0b982arrow-up-right](https://etherscan.io/address/0xe4B1a03087D5BcB56d4fD6aF8267278246C0b982) RegistryContract [0xd1014B9517E5A8D1f61812484a8553eEe8845309arrow-up-right](https://etherscan.io/address/0xd1014B9517E5A8D1f61812484a8553eEe8845309) ClassicalOracle [0xaA3E78B52E5003a7f82a7ef1C01447028e669fAEarrow-up-right](https://etherscan.io/address/0xaA3E78B52E5003a7f82a7ef1C01447028e669fAE) Gateway [0xaAF8c2ae29190D6F886115b92b6b1Fcd513931Abarrow-up-right](https://etherscan.io/address/0xaAF8c2ae29190D6F886115b92b6b1Fcd513931Ab) DebtUSDC Token [0xcbA56BB5FECc6A3d35393F8dffdd28Af02EF1748arrow-up-right](https://etherscan.io/address/0xcbA56BB5FECc6A3d35393F8dffdd28Af02EF1748) DebtUSDC Oracle [0x28b5735dE1990d5C3c5Dfb4Ad7D2496579e1f5Eaarrow-up-right](https://etherscan.io/address/0x28b5735de1990d5c3c5dfb4ad7d2496579e1f5ea) CircleUSDC Oracle [0x2ad0Eb228cCF87FcBeC4F85a779Aa61CD6784bECarrow-up-right](https://etherscan.io/address/0x2ad0Eb228cCF87FcBeC4F85a779Aa61CD6784bEC) ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#eur0) EUR0 Contract Name Address & Etherscan Link EUR0 [0x3c89Cd1884E7beF73ca3ef08d2eF6EC338fD8E49arrow-up-right](https://etherscan.io/address/0x3c89Cd1884E7beF73ca3ef08d2eF6EC338fD8E49) sEUR0 [0x35f43C6604B0DE814ABAa2D94C878BD1F5165478arrow-up-right](https://etherscan.io/address/0x35f43C6604B0DE814ABAa2D94C878BD1F5165478) DaoCollateral [0xB9677b45BffBE3d586D2AE2cbCD1775577B166D1arrow-up-right](https://etherscan.io/address/0xB9677b45BffBE3d586D2AE2cbCD1775577B166D1) SwapperEngine [0x46c023cbBdFffed1A3A3ef0C915610DEEb14847Aarrow-up-right](https://etherscan.io/address/0x46c023cbBdFffed1A3A3ef0C915610DEEb14847A) TokenMapping [0xf20Ba8F5195fCC094d94a937F0d2719f6Da14A4aarrow-up-right](https://etherscan.io/address/0xf20Ba8F5195fCC094d94a937F0d2719f6Da14A4a) RegistryAccess [0x65771978FF9238162a41c77384c9F55C1eC9e9Abarrow-up-right](https://etherscan.io/address/0x65771978FF9238162a41c77384c9F55C1eC9e9Ab) RegistryContract [0x2b98Bbb548eE8F442F63A92a06a1CDb5f5bd52AFarrow-up-right](https://etherscan.io/address/0x2b98Bbb548eE8F442F63A92a06a1CDb5f5bd52AF) ClassicalOracle [0x3b4b5CB9865A354d6c3faaDDD8753a2e55D60546arrow-up-right](https://etherscan.io/address/0x3b4b5CB9865A354d6c3faaDDD8753a2e55D60546) Circle EURC/EUR Oracle [0x2A02fDaB11F05D5b16B16E01e140a8AF12A5F69Barrow-up-right](https://etherscan.io/address/0x2A02fDaB11F05D5b16B16E01e140a8AF12A5F69B) YieldModule [0x042d3c300C547aE60d6a5B3bc62D6FbDA7DBf59Darrow-up-right](https://etherscan.io/address/0x042d3c300C547aE60d6a5B3bc62D6FbDA7DBf59D) Revenue Distribution Module [0x78331cC94BbF86293bDa80cA10463812b1E73179arrow-up-right](https://etherscan.io/address/0x78331cC94BbF86293bDa80cA10463812b1E73179) Monerium Swapper Helper [0x7a03038711d8905c8a7f56b857777dea1447a2f0arrow-up-right](https://etherscan.io/address/0x7a03038711d8905c8a7f56b857777dea1447a2f0) ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#eth0) ETH0 Contract Name Address & Etherscan Link ETH0 [0x734eec7930bc84ec5732022b9eb949a81fb89abearrow-up-right](https://etherscan.io/address/0x734eec7930bc84ec5732022b9eb949a81fb89abe) DaoCollateral [0xAAD0a80fB8F0DA4799E457b5Ae8EA70Fa61a45fcarrow-up-right](https://etherscan.io/address/0xAAD0a80fB8F0DA4799E457b5Ae8EA70Fa61a45fc) TokenMapping [0x934F166Aec37a02AA213D93394243b231fc5b4B9arrow-up-right](https://etherscan.io/address/0x934F166Aec37a02AA213D93394243b231fc5b4B9) RegistryAccess [0x6d2A468450ACf416791B12109f15797B1944152Farrow-up-right](https://etherscan.io/address/0x6d2A468450ACf416791B12109f15797B1944152F) RegistryContract [0xfE35066Ce9b91026E0C0056d6F4520e409B793cAarrow-up-right](https://etherscan.io/address/0xfE35066Ce9b91026E0C0056d6F4520e409B793cA) ClassicalOracle [0x8a03c57069A25C7E6e62e9C0d03a2CC10A74b1a7arrow-up-right](https://etherscan.io/address/0x8a03c57069A25C7E6e62e9C0d03a2CC10A74b1a7) Lido wstETH Oracle [0xEB9B65345B1eeD32153Ef85D97874c1aD98e5DC4arrow-up-right](https://etherscan.io/address/0xEB9B65345B1eeD32153Ef85D97874c1aD98e5DC4) ### [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#treasuries) Treasuries Contract Name Address & Etherscan Link Collateral treasury [0xdd82875f0840AAD58a455A70B88eEd9F59ceC7c7arrow-up-right](https://etherscan.io/address/0xdd82875f0840AAD58a455A70B88eEd9F59ceC7c7) Yield Treasury [0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4arrow-up-right](https://etherscan.io/address/0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4) Longterm Treasury [0xF3D913De4B23ddB9CfdFAF955BAC5634CbAE95F4arrow-up-right](https://etherscan.io/address/0xF3D913De4B23ddB9CfdFAF955BAC5634CbAE95F4) USD0a Collateral Treasury [0xbfBE929807cADbc3fd5191800DFB10454ff5c792arrow-up-right](https://etherscan.io/address/0xbfBE929807cADbc3fd5191800DFB10454ff5c792) USD0a Yield Treasury [0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4arrow-up-right](https://etherscan.io/address/0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4) EUR0 Collateral Treasury [0x11D75bC93aE69350231D8fF0F5832A697678183Earrow-up-right](https://etherscan.io/address/0x11D75bC93aE69350231D8fF0F5832A697678183E) EUR0 Yield Treasury [0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4arrow-up-right](https://etherscan.io/address/0x81ad394C0Fa87e99Ca46E1aca093BEe020f203f4) [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#arbitrum-one) Arbitrum One ------------------------------------------------------------------------------------------------------- Contract Name Address & ArbiScan Link RegistryAccess [0x168BA269fc6CDe6115F3b03C94F55831165D374Farrow-up-right](https://arbiscan.io/address/0x168BA269fc6CDe6115F3b03C94F55831165D374F) RegistryContract [0x3F44A0D493Ef5ae030fCf36a2b5d4365fb22BC4Aarrow-up-right](https://arbiscan.io/address/0x3F44A0D493Ef5ae030fCf36a2b5d4365fb22BC4A) USD0 [0x35f1C5cB7Fb977E669fD244C567Da99d8a3a6850arrow-up-right](https://arbiscan.io/address/0x35f1C5cB7Fb977E669fD244C567Da99d8a3a6850#code) bUSD0 (formerly USD0++) [0x2B65F9d2e4B84a2dF6ff0525741b75d1276a9C2Farrow-up-right](https://arbiscan.io/address/0x2B65F9d2e4B84a2dF6ff0525741b75d1276a9C2F) USUAL [0x6A5D904519A2b605Da2D5DA7137ED5F4184F6513arrow-up-right](https://arbiscan.io/address/0x6A5D904519A2b605Da2D5DA7137ED5F4184F6513) [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#base) BASE --------------------------------------------------------------------------------------- Contract Name Address & BaseScan Link RegistryAccess [0x2EF13d2626bb115A46eBD72475C0be7f56Cdf013arrow-up-right](https://basescan.org/address/0x2EF13d2626bb115A46eBD72475C0be7f56Cdf013) RegistryContract [0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0arrow-up-right](https://basescan.org/address/0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0) USD0 [0x758a3e0b1F842C9306B783f8A4078C6C8C03a270arrow-up-right](https://basescan.org/address/0x758a3e0b1F842C9306B783f8A4078C6C8C03a270) USUAL [0x4ACD4D03af6F9cc0fB7C5f0868B7b6287D7969c5arrow-up-right](https://basescan.org/address/0x4ACD4D03af6F9cc0fB7C5f0868B7b6287D7969c5) [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#bnb-chain) BNB Chain ------------------------------------------------------------------------------------------------- Contract Name Address & BscScan Link RegistryAccess [0x2EF13d2626bb115A46eBD72475C0be7f56Cdf013arrow-up-right](https://bscscan.com/address/0x2EF13d2626bb115A46eBD72475C0be7f56Cdf013) RegistryContract [0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0arrow-up-right](https://bscscan.com/address/0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0) USD0 [0x758a3e0b1f842c9306b783f8a4078c6c8c03a270arrow-up-right](https://bscscan.com/address/0x758a3e0b1f842c9306b783f8a4078c6c8c03a270#code) USUAL [0x4ACD4D03af6F9cc0fB7C5f0868B7b6287D7969c5arrow-up-right](https://bscscan.com/address/0x4ACD4D03af6F9cc0fB7C5f0868B7b6287D7969c5) [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#tac) TAC ------------------------------------------------------------------------------------- Contract Name Address & BscScan Link RegistryAccess [0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0arrow-up-right](https://explorer.tac.build/address/0xB4c3f4cA17FAF31C0A5186A2ddA19Dbc26cE04e0) RegistryContract [0x9D9b970be71AD9d0b8Fa7A018B7Ab53dbf17D1C6arrow-up-right](https://explorer.tac.build/address/0x9D9b970be71AD9d0b8Fa7A018B7Ab53dbf17D1C6) USD0 [0x9bB6983Ca454320BD8691409690B4FCCD489EE96arrow-up-right](https://explorer.tac.build/address/0x9bB6983Ca454320BD8691409690B4FCCD489EE96) bUSD0 (formerly USD0++) [0x1791BAff6a5e2F2A1340e8B7C1EA2B0c1E2DD1eaarrow-up-right](https://explorer.tac.build/address/0x1791BAff6a5e2F2A1340e8B7C1EA2B0c1E2DD1ea) [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#real-world-assets) Real World Assets ----------------------------------------------------------------------------------------------------------------- Contract Name Address & Explorer Link Chain USYC [0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2barrow-up-right](https://etherscan.io/address/0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b) Ethereum M by M0 [0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1barrow-up-right](https://etherscan.io/token/0x866a2bf4e572cbcf37d5071a7a58503bfb36be1b) Ethereum UsualM (Wrapped M) [0x4Cbc25559DbBD1272EC5B64c7b5F48a2405e6470arrow-up-right](https://etherscan.io/token/0x4Cbc25559DbBD1272EC5B64c7b5F48a2405e6470) Ethereum USDtb [0xC139190F447e929f090Edeb554D95AbB8b18aC1Carrow-up-right](https://etherscan.io/token/0xC139190F447e929f090Edeb554D95AbB8b18aC1C?a=0x58073531a2809744d1bf311d30fd76b27d662abb) Ethereum UsualUSDtb [0x58073531a2809744D1bF311D30FD76B27D662abBarrow-up-right](https://etherscan.io/address/0x58073531a2809744d1bf311d30fd76b27d662abb) Ethereum USDC [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48arrow-up-right](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) Ethereum UsualUSDC [0xb672B3976bAa3952bFb2eCE8eeFB784f8daB1424arrow-up-right](https://etherscan.io/address/0xb672b3976baa3952bfb2ece8eefb784f8dab1424#readProxyContract) Ethereum euTBL [0xa0769f7a8fc65e47de93797b4e21c073c117fc80arrow-up-right](https://etherscan.io/token/0xa0769f7a8fc65e47de93797b4e21c073c117fc80) Ethereum [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#busd0-formerly-usd0-investment-vaults) bUSD0 (formerly USD0++) Investment Vaults ------------------------------------------------------------------------------------------------------------------------------------------------------------- deployed and curated by Usual (more info [herearrow-up-right](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault) ) Contract Name Address & Explorer Link Chain usUSDS++ [0x67ec31a47a4126A66C7bb2fE017308cf5832A4Dbarrow-up-right](https://etherscan.io/address/0x67ec31a47a4126A66C7bb2fE017308cf5832A4Db) Ethereum usUSDS++ vault router [0x4F6E3115d607A10A68C9ab35102016cC92b178fDarrow-up-right](https://etherscan.io/address/0x4f6e3115d607A10A68c9Ab35102016cC92b178FD#code) Ethereum [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#ccip-bridging) CCIP Bridging --------------------------------------------------------------------------------------------------------- Contract Name Address & Explorer Link Chain LockReleaseTokenPool USD0 [0xC3d39B77032114c8884276Dae0F02cdF75162782arrow-up-right](https://etherscan.io/address/0xc3d39b77032114c8884276dae0f02cdf75162782) Ethereum BurnMintTokenPool USD0 [0x8d20F295518B12E63F65aB7cf930AD88e8d17cbAarrow-up-right](https://basescan.org/address/0x8d20f295518b12e63f65ab7cf930ad88e8d17cba) Base BurnMintTokenPool USD0 [0x8d20F295518B12E63F65aB7cf930AD88e8d17cbAarrow-up-right](https://bscscan.com/address/0x8d20f295518b12e63f65ab7cf930ad88e8d17cba) BNB LockReleaseTokenPool USUAL [0x72a0203b731EdECE2DdAa506a048c0378C44366aarrow-up-right](https://etherscan.io/address/0x72a0203b731edece2ddaa506a048c0378c44366a) Ethereum BurnMintTokenPool USUAL [0x30Ea2d525eF7C234F8AA6E3a8909B88f71244cB0arrow-up-right](https://basescan.org/address/0x30ea2d525ef7c234f8aa6e3a8909b88f71244cb0) Base BurnMintTokenPool USUAL [0x30Ea2d525eF7C234F8AA6E3a8909B88f71244cB0arrow-up-right](https://bscscan.com/address/0x30ea2d525ef7c234f8aa6e3a8909b88f71244cb0) BNB [hashtag](https://tech.usual.money/smart-contracts/contract-deployments#layer0-bridging) Layer0 Bridging ------------------------------------------------------------------------------------------------------------- Contract Name Address & Explorer Link Chain USD0 L1OFTAdapter [0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26arrow-up-right](https://etherscan.io/address/0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26) Ethereum bUSD0 (formerly USD0++) L1OFTAdapter [0xd155d91009cbE9B0204B06CE1b62bf1D793d3111arrow-up-right](https://etherscan.io/address/0xd155d91009cbE9B0204B06CE1b62bf1D793d3111) Ethereum bUSD0 (formerly USD0++) L1OFTAdapter (for TAC) [0x8Cc230FC8d736BF3Fbe911A17c6c59d522F85ff4arrow-up-right](https://etherscan.io/address/0x8Cc230FC8d736BF3Fbe911A17c6c59d522F85ff4#readContract) Ethereum USUAL L1OFTAdapter [0xd277CBCFe8cB37CA90129a33EC7eE590ee392b59arrow-up-right](https://etherscan.io/address/0xd277CBCFe8cB37CA90129a33EC7eE590ee392b59) Ethereum USD0 OFTMintAndBurnAdapter [0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26arrow-up-right](https://arbiscan.io/address/0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26) Arbitrum One bUSD0 (formerly USD0++) OFTMintAndBurnAdapter [0xd155d91009cbE9B0204B06CE1b62bf1D793d3111arrow-up-right](https://arbiscan.io/address/0xd155d91009cbE9B0204B06CE1b62bf1D793d3111) Arbitrum One USUAL OFTMintAndBurnAdapter [0xd277CBCFe8cB37CA90129a33EC7eE590ee392b59arrow-up-right](https://arbiscan.io/address/0xd277CBCFe8cB37CA90129a33EC7eE590ee392b59) Arbitrum One USD0 OFTMintAndBurnAdapter [0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26arrow-up-right](https://explorer.tac.build/address/0xE14C486b93C3B62F76F88cf8FE4B36fb672f3B26?tab=read_write_contract) TAC USD0PP OFTMintAndBurnAdapter [0xd155d91009cbE9B0204B06CE1b62bf1D793d3111arrow-up-right](https://explorer.tac.build/address/0xd155d91009cbE9B0204B06CE1b62bf1D793d3111?tab=contract) TAC [PreviousEUTBL by Spikochevron-left](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko) [NextSecurity Practiceschevron-right](https://tech.usual.money/security-and-audits/security-practices) Last updated 1 month ago Was this helpful? * [Ethereum Mainnet](https://tech.usual.money/smart-contracts/contract-deployments#ethereum-mainnet) * [USUAL](https://tech.usual.money/smart-contracts/contract-deployments#usual) * [USD0](https://tech.usual.money/smart-contracts/contract-deployments#usd0) * [USD0a](https://tech.usual.money/smart-contracts/contract-deployments#usd0a) * [EUR0](https://tech.usual.money/smart-contracts/contract-deployments#eur0) * [ETH0](https://tech.usual.money/smart-contracts/contract-deployments#eth0) * [Treasuries](https://tech.usual.money/smart-contracts/contract-deployments#treasuries) * [Arbitrum One](https://tech.usual.money/smart-contracts/contract-deployments#arbitrum-one) * [BASE](https://tech.usual.money/smart-contracts/contract-deployments#base) * [BNB Chain](https://tech.usual.money/smart-contracts/contract-deployments#bnb-chain) * [TAC](https://tech.usual.money/smart-contracts/contract-deployments#tac) * [Real World Assets](https://tech.usual.money/smart-contracts/contract-deployments#real-world-assets) * [bUSD0 (formerly USD0++) Investment Vaults](https://tech.usual.money/smart-contracts/contract-deployments#busd0-formerly-usd0-investment-vaults) * [CCIP Bridging](https://tech.usual.money/smart-contracts/contract-deployments#ccip-bridging) * [Layer0 Bridging](https://tech.usual.money/smart-contracts/contract-deployments#layer0-bridging) Was this helpful? --- # Community & Support | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FTNDArYneh0Dk6JTSEkLM%252FPage%2520Cover%252014.png%3Falt%3Dmedia%26token%3Df9362ec8-40ce-4c2d-99da-af40d2ed4d6c&width=1248&dpr=3&quality=100&sign=b816f646&sv=2) [hashtag](https://tech.usual.money/resources/community-and-support#socials) Socials ---------------------------------------------------------------------------------------- [**Telegram**arrow-up-right](https://telegram.usual.money/) [**LinkedIn**arrow-up-right](https://linkedin.usual.money/) [**Discord**arrow-up-right](https://discord.usual.money/) [**X**arrow-up-right](https://x.usual.money/) [**Linktree**arrow-up-right](https://linktr.ee/usualmoney) [**Youtube**arrow-up-right](https://www.youtube.com/channel/UCxshfCtZTlahG_Bwchclb8A) [hashtag](https://tech.usual.money/resources/community-and-support#contact) Contact ---------------------------------------------------------------------------------------- Please contact us via this [**form**arrow-up-right](https://usual.money/form/contact-us) . [PreviousClaim Address Redirectchevron-left](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) [NextReferenceschevron-right](https://tech.usual.money/resources/references) Last updated 1 year ago Was this helpful? * [Socials](https://tech.usual.money/resources/community-and-support#socials) * [Contact](https://tech.usual.money/resources/community-and-support#contact) Was this helpful? --- # ETH0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fs03nwUaWtx0ACaNQKxRX%252FCard%2520Cover%252041.png%3Falt%3Dmedia%26token%3D99184f18-f0bd-43c2-a680-60f8d304eff3&width=752&dpr=3&quality=100&sign=431e88b5&sv=2) **ETH0 DAO Collateral Smart Contract** [PreviousUSD0a Reverse Gatewaychevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway) [NextETH0 DaoCollateralchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral) Last updated 7 months ago Was this helpful? Was this helpful? --- # UsualUSDC | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#high-level-overview) High-Level Overview ----------------------------------------------------------------------------------------------------------------------------------------- The **UsualUSDC** smart contract manages the **UsualUSDC** ERC20 Token and acts as a wrapped version of the USDC token. It allows users to wrap USDC tokens into **UsualUSDC**, adding enhanced functionality such as pausability, blacklist enforcement, mint cap restrictions, redemption fees, and allowlist-based redemption controls. It also supports permits and implements role-based access control to ensure secure operations. This contract is specifically designed to interact with the USDC token while enforcing access control through a Registry Access Contract. Key features include wrapping, unwrapping with fee collection, minting, pausing operations, and redemption allowlist management. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#contract-summary) Contract Summary **UsualUSDC** is an ERC-20 token with additional features that provide security, operational flexibility, and revenue generation capabilities. It integrates with OpenZeppelin upgradeable modules for pausability and permit-based approvals. Moreover, it enforces blacklist restrictions to prevent interactions with malicious or sanctioned addresses, limits the maximum supply via a configurable mint cap, implements redemption fees for revenue generation, and restricts unwrapping to allowlisted addresses only. #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#inherited-contracts) **Inherited Contracts** * **ERC20PausableUpgradeable**: Enables pausability of token transfers, ensuring operations can be halted in emergencies. * **ERC20PermitUpgradeable**: Supports gasless approvals through EIP-2612 signatures, enabling off-chain approval of token transfers. * **ERC20Upgradeable**: Provides the core ERC-20 token implementation. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#public-external-functions) Public/External Functions Wrapping Functions: * **wrap(address recipient, uint256 amount):** Wraps the specified amount of USDC tokens into **UsualUSDC** tokens for the recipient. * **wrapWithPermit(address recipient, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s):** Wraps USDC tokens using a permit signature for approval, enabling gasless wrapping. Unwrapping Functions: * **unwrap(address recipient, uint256 amount):** Unwraps **UsualUSDC** tokens into USDC tokens, subject to allowlist checks and redemption fee collection. Admin Functions: * **setMintCap(uint256 newMintCap)**: Updates the mint cap for the token. Callable only by accounts with the **USUAL\_USDC\_MINTCAP\_ALLOCATOR** role. * **pause()**: Pauses all token transfers. Callable only by accounts with the **USUAL\_USDC\_PAUSE** role. * **unpause()**: Resumes all token transfers. Callable only by accounts with the **USUAL\_USDC\_UNPAUSE** role. * **blacklist(address account)**: Blacklists an address, preventing it from interacting with the token. Callable only by accounts with the **BLACKLIST\_ROLE**. * **unBlacklist(address account)**: Removes an address from the blacklist. Callable only by accounts with the **BLACKLIST\_ROLE**. Redemption Management Functions: * **addToRedemptionAllowList(address account)**: Adds an account to the redemption allowlist. Callable only by accounts with the **USUAL\_USDC\_REDEMPTION\_ROLE**. * **removeFromRedemptionAllowList(address account)**: Removes an account from the redemption allowlist. Callable only by accounts with the **USUAL\_USDC\_REDEMPTION\_ROLE**. * **setRedemptionFee(uint256 newRedemptionFeeBps)**: Sets the redemption fee in basis points. Callable only by accounts with the **USUAL\_USDC\_REDEMPTION\_ROLE**. * **setFeeRecipient(address newFeeRecipient)**: Sets the fee recipient address. Callable only by accounts with the **USUAL\_USDC\_FEE\_RECIPIENT\_ROLE**. [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#functionality-breakdown) Functionality Breakdown ------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#sc-flows) SC-Flows ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FlsPNij35sGTBxeCJAI8k%252Fimage.png%3Falt%3Dmedia%26token%3Dbcc27835-4cd3-4120-9853-37761a5d1cc2&width=768&dpr=3&quality=100&sign=467f0d74&sv=2) #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#key-functionalities) Key Functionalities * **Wrapping**: Users can wrap USDC tokens into **UsualUSDC**, making use of enhanced token features. * **Unwrapping** **with Fees**: Users can unwrap **UsualUSDC** tokens back into USDC, subject to allowlist checks and redemption fee collection. * **Mint Cap Enforcement**: Ensures that the total supply of **UsualUSDC** tokens does not exceed the configured mint cap. * **Blacklist Enforcement**: Prevents blacklisted addresses from participating in token transfers. * **Pausability**: Allows administrators to halt all token transfers during emergencies. * **Redemption Allowlist**: Restricts unwrapping functionality to allowlisted addresses only. * **Fee Collection**: Implements configurable redemption fees for revenue generation. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#constants) Constants * **USUAL\_USDC\_PAUSE**: Role required to pause the contract. * **USUAL\_USDC\_UNPAUSE**: Role required to unpause the contract. * **USUAL\_USDC\_MINTCAP\_ALLOCATOR**: Role required to update the mint cap. * **BLACKLIST\_ROLE**: Role required to blacklist/unblacklist accounts. * **USUAL\_USDC\_REDEMPTION\_ROLE**: Role required to manage redemption allowlist and fees. * **USUAL\_USDC\_FEE\_RECIPIENT\_ROLE**: Role required to update fee recipient. * **USUAL\_USDC\_DECIMALS**: Token decimals (6, matching USDC). * **BPS\_SCALAR**: Basis points scalar (10,000 for 100%). ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#safeguards-implementation) Safeguards Implementation * **Pausability**: The contract integrates pausability to ensure all token transfers can be halted in emergencies. Only accounts with the appropriate roles can pause/unpause the contract. * **Role-Based Access Control**: Sensitive operations such as pausing, blacklisting, updating the mint cap, managing redemption allowlist, and setting fees are restricted to accounts with specific roles. This ensures that only authorized entities can perform these operations. * **Mint Cap Enforcement**: The total supply of **UsualUSDC** tokens is capped by a configurable limit, ensuring supply control. * **Blacklist Enforcement**: The contract prevents interactions with blacklisted addresses, safeguarding the token economy from malicious actors. * **Redemption Allowlist**: Unwrapping is restricted to allowlisted addresses only, providing additional control over who can redeem tokens. * **Fee Collection**: Configurable redemption fees provide revenue generation while discouraging excessive unwrapping. * **Input Validation**: Comprehensive checks for zero addresses, invalid amounts, and same-value operations prevent common errors and ensure data integrity. [PreviousUSDC by Circlechevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle) [NextUSD0a Collateralchevron-right](https://tech.usual.money/smart-contracts/usd0a-collateral) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#contract-summary) * [Functions Description](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#functions-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#functionality-breakdown) * [SC-Flows](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#sc-flows) * [Constants](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle/usualusdc#safeguards-implementation) Was this helpful? --- # USD0a | Usual Tech Docs [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fs03nwUaWtx0ACaNQKxRX%252FCard%2520Cover%252041.png%3Falt%3Dmedia%26token%3D99184f18-f0bd-43c2-a680-60f8d304eff3&width=752&dpr=3&quality=100&sign=431e88b5&sv=2) **USD0a** **DAO Collateral Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEAXcO5aCmFvNWZ0zLCW1%252FCard%2520Cover%252054.png%3Falt%3Dmedia%26token%3D9ac7d7ae-2286-4dca-8f0c-0b4adc72bc3a&width=752&dpr=3&quality=100&sign=ccb79780&sv=2) **USD0a** **Swapper Engine Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FFfoKjESCGHw9mhoQQkvJ%252FCard%2520Cover%252013.png%3Falt%3Dmedia%26token%3Dc4f43a83-b4d3-48b1-a4a0-bb4e28a7bfb1&width=752&dpr=3&quality=100&sign=dc7e637e&sv=2) **USD0a Gateway Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FduHCoYbjgEjgJBMjjcHp%252FCard%2520Cover%252013.png%3Falt%3Dmedia%26token%3D6fb75bc2-9a5a-4523-9eed-b00ec2dd5b0d&width=752&dpr=3&quality=100&sign=bf2b60e3&sv=2) USD0a Reverse Gateway Smart Contract [PreviousUSD0 Revenue Distribution Modulechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module) [NextUSD0a DaoCollateralchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral) Last updated 4 months ago Was this helpful? Was this helpful? --- # Claim Address Redirect | Usual Tech Docs [hashtag](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect#overview) Overview -------------------------------------------------------------------------------------------------------------- If a bUSD0 integration partner can't by themselves mint and claim the USUAL rewards that accumulate on their smart contract, then this "Claim Address Redirect" integration feature enables them to access the USUAL and redistribute it to their Users as lined out [here](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) . ### [hashtag](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect#detailed-flow) Detailed Flow circle-info In order to be eligible for a claim address redirect the USUAL accumulating on the address needs to fulfil the following prerequisites: * $100 worth of USUAL/month * $1000 worth of USUAL in total 1. Contact the USUAL DAO via the established communication channel. 1. If no channel is available yet, set one up (if you work in Crypto you know how 😏) 2. Communicate the contract address on which the USUAL accumulates as well as the address that should "Claim" it. 1. For the best "Claim" experience after the successful redirect we recommend that address is set up in a (MultiSig) wallet (such as [Safearrow-up-right](https://safe.global/) ), which can interact with our dApp or Etherscan. 3. In order to add your claim address we require "sufficient" proof that you are the deployer or the project team behind the contract address that should be redirected. 1. Sufficient proof could be: 1. Social proof 2. Governance proof (e.g. DAO vote) 3. Signed message from original deployer 4. Proof of redistribution 2. Once the proof has been established, the Claim Redirect will be added to the [DistributionModule](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution) . 4. After the "Claim Redirect Address" has been added, a pre-defined challenge period (**5 days**) will start, in which the USUAL DAO admin or the original claim address owner can cancel the addition of the claim address. 5. As soon as the challenge period has concluded the added "Claim address" can claim the USUAL via the Usual dApp's [Earn pagearrow-up-right](https://app.usual.money/earn) (or [Etherscanarrow-up-right](https://etherscan.io/address/0x75cC0C0DDD2Ccafe6EC415bE686267588011E36A#writeProxyContract#F3) ). circle-exclamation As long as an integration is not fully integrated with the reward system (i.e. enduser can claim USUAL via [Earn pagearrow-up-right](https://app.usual.money/earn) ) it is up to the bUSD0 integrator to reward its endusers. As USUAL DAO we strive to diligently enact the "Claim Address Redirect" process. However, it's up to the integrators to provide correct addresses, sufficient proof and reward their users properly. As an enduser please take up any reward disputes and challenges with the respective integrator. [PreviousReward redistribution by integration partnerchevron-left](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) [NextCommunity & Supportchevron-right](https://tech.usual.money/resources/community-and-support) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect#overview) * [Detailed Flow](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect#detailed-flow) Was this helpful? --- # M by M0 | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0#who-is-m0) Who is M0? ----------------------------------------------------------------------------------------------------- M^0 is an on-chain protocol, as well as a set of off-chain standards and APIs, that allows multiple Minters to issue a fully fungible stablecoin called $M. Minters connect to the protocol to manage the supply of $M, while Validators support the process independently by providing near-constant information on the presence of off-chain collateral held in best-in-class storage structures. This coordination is underpinned by a novel governance mechanism called the Two Token Governor. Website of [M0arrow-up-right](https://www.m0.org/) . [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0#what-is-m) What is M? ----------------------------------------------------------------------------------------------------- $M is a fungible token that can be generated by a Minter by locking Eligible Collateral, currently short term T-bills, in a secure off-chain facility. Once generated, a Minter can then sell these tokens into the market. With selling and buying back these tokens at the price of $1, $M serves as a stablecoin, offering a stable, digital representation of the US dollar. $M can also be used as raw material to create other stablecoin products. More on [Marrow-up-right](https://www.m0.org/faqs) . [PreviousUSYC by Hashnotechevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote) [NextUsualMchevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm) Last updated 1 year ago Was this helpful? * [Who is M0?](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0#who-is-m0) * [What is M?](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0#what-is-m) Was this helpful? --- # USD0a Classical Oracle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#high-level-overview) High-Level Overview ----------------------------------------------------------------------------------------------------------------------------------------------- The ClassicalOracle contract is used by DaoCollateral to fetch the price of collaterals. This is also used for minting and redeeming the right amount of USD0a. It is an upgradable contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#contract-summary) Contract Summary The logic contained in ClassicalOracle includes: * Initializing `tokenToOracleInfo` for each supported token with a ChainlinkV3Aggregator-compatible price feed * 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 * Interacting with the aggregator to fetch the latest price and its number of decimals ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with the ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **Initializable**: Allows to handle contract setup and upgrades. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#functionality-breakdown) Functionality Breakdown ------------------------------------------------------------------------------------------------------------------------------------------------------- After deploying the contract, the administrator should initialize the price feed for all supported collateral thanks to the `initializeTokenOracle` function. When another contract or external service calls `getPrice` or `getQuote`, the contract calls the virtual function `_latestRoundData` passing the desired token as parameter. This function is implemented in ClassicalOracle and retrieves the associated price aggregator for this token, then calls `decimals` and `latestRoundData.` ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#public-external-functions) Public/External Functions * **initializeTokenOracle(address token, address dataSource, uint64 timeout, bool isStablecoin)**: Registers a new supported token or updates the data source (price aggregator) for an existing token. The new price feed must have been last updated within the last `timeout` seconds. This check is only performed once. If `isStablecoin` is true, the depeg check will be enabled and `getPrice`/`getQuote` will revert if the price is not around $1. * **getMaxDepegThreshold()**: Returns the current maximum allowed price variation for stablecoins in basis points (e.g. with a value of 500, `getPrice` and `getQuote` will revert if the price of a stablecoin is outside the range $0.95-$1.05). View function. * **setMaxDepegThreshold(uint256 maxAuthorizedDepegPrice)**: Updates the maximum allowed price variation and emits a `SetMaxDepegThreshold` event. Nonpayable function. Reserved for admin use only. * **getPrice(address token)**: Returns the price of the given token scaled to 18 decimals (e.g. a return value of 3e18 means the token price is $3). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. * **getQuote(address token, uint256 amount)**: Returns the USD value equivalent to the given amount of the given token (e.g. if the token price is $3, calling with 1e6 will return 3e6, no matter the number of decimals of the token). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. [PreviousUSD0achevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0a) [NextDebtUSDC Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle#functions-description) Was this helpful? --- # EUR0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fs03nwUaWtx0ACaNQKxRX%252FCard%2520Cover%252041.png%3Falt%3Dmedia%26token%3D99184f18-f0bd-43c2-a680-60f8d304eff3&width=752&dpr=3&quality=100&sign=431e88b5&sv=2) **EUR0** **DAO Collateral Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEAXcO5aCmFvNWZ0zLCW1%252FCard%2520Cover%252054.png%3Falt%3Dmedia%26token%3D9ac7d7ae-2286-4dca-8f0c-0b4adc72bc3a&width=752&dpr=3&quality=100&sign=ccb79780&sv=2) **EUR0** **Swapper Engine Smart Contract** ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEibMJfsT9wzRjS2tj263%252FCard%2520Cover%252011.png%3Falt%3Dmedia%26token%3D17f67d1e-c30b-43e7-b67d-22132c0ed4ad&width=752&dpr=3&quality=100&sign=26f753a7&sv=2) **EUR0 Distribution Smart Contract** [PreviousETH0 DaoCollateralchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral) [NextEUR0 DaoCollateralchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral) Last updated 5 months ago Was this helpful? Was this helpful? --- # Privacy Policy | Usual Tech Docs \*\*Date of the latest revision: 10/18/2024\*\* 1. **INTRODUCTION** Up Only Co (hereinafter referred to as "Usual Labs", the "Company", "we", "us" or "our") a French simplified joint stock company (société par actions simplifiée) organized under the laws of France, having its registered office located at 1 rue de Stockholm 75008 Paris , incorporated with the Commercial and Companies Register of Paris under number 919 540 427 is committed to protecting and respecting your privacy (hereinafter referred to as "Users", "you" or "your"). This privacy policy (hereinafter referred to as "Privacy Policy") together with our legal notice, disclaimers, documentation, and general terms and conditions explain how Usual Labs operates and how it may - from time to time only - use your personal information (hereinafter referred to as "Personal Information" or "Personal Data") when Users access the websites : [https://usual.money/arrow-up-right](https://usual.money/) and [https://app.usual.money/arrow-up-right](https://app.usual.money/) (hereinafter together referred to as the "Site"). For more information about the Company, the User is invited to consult the legal notice . Usual Labs has developed a tool under the name "Usual" that permits, among other things, the generation of stablecoins, transactions using smart contracts, and the lending, leveraging, and staking of cryptographic assets (hereinafter referred to as the “Usual Protocol”). In this context, this Privacy Policy describes why and how we may collect and use Personal Information and provides information about individuals’ rights in relation to Personal Information. 1. **PURPOSE OF PRIVACY POLICY** The purpose of this Privacy Policy is to set out in an accountable and transparent way the collection and use of information by Usual Labs. In order to comply with General Data Protection Regulation (GDPR) and applicable regulation, Usual Labs may gather personal information from Users to provide its services. 1. **ELIGIBILITY** Usual Labs does not allow persons under the age of 18 to use the Usual Labs Services and does not knowingly collect personal data from children under the age of 18. In alignment with the regulations, Usual Labs does not knowingly collect, store, or process any personal data from children under the age of 18. Any personal data mistakenly provided by a minor will be promptly deleted upon identification or notification. Usual Labs actively enforces measures to prevent unauthorized access by individuals who do not meet the minimum age requirement, wherever possible, given the decentralized nature of the protocol, in line with its commitment to data privacy and protection standards. 1. **PERSONAL INFORMATION COLLECTION - PURPOSE - LEGAL BASIS** Personal Information is information which identifies you personally or by which your identity can reasonably be ascertained. The Personal Information which may be processed is listed below. What personal data does Usual Labs may collect and/or process? Why does Usual Labs process my personal data? Legal basis for our use of personal data * First and last name, * email address, * nationality, * content, within any messages you send to us via our contact address: [\[email protected\]](https://tech.usual.money/cdn-cgi/l/email-protection) (such as feedback, questions, job applications, etc.). Transaction Services. We may use your personal information to process your orders and to communicate with you about orders and services, in connection with the services. Communicating with you. We may use your personal information to communicate with you regarding our services. Fulfillment of a contract when we provide services to you, or communicate with you about them. Legal obligation, to comply with our legal obligations under applicable laws and regulations. Your consent where we ask for your consent to process your Personal Data for a specific purpose that we communicate to you. Where you consent to Usual Labs processing your Personal Data for a specific purpose, you may withdraw your consent at any time and we will stop processing your Personal Data for that purpose. Withdrawal of consent does not affect the lawfulness of the processing based on the consent prior to its withdrawal. * the Internet Protocol (IP) address used to connect your computer to the Internet, * audience and technical measurements of the Usual Labs services (e.g., occurrences of technical errors, your interactions with the features and content of the Services, and your preferences for settings), * version and time zone settings. To provide, troubleshoot and improve the Usual Labs services. We use your personal data to provide functionality, analyze performance, correct errors, and improve the usability and efficiency of the Usual Labs services. Legitimate interest and the interests of our Users when, for example, we detect and prevent fraud and abuse to protect the safety of our Users, ourselves or others. Fulfillment of a contract when we provide products or services to you, or communicate with you about them. This includes where we use your personal data to take and process orders, and to process payments. Blockchains provide transparency into transactions and Usual Labs is not responsible for preventing or managing information broadcasted on a blockchain. Important notice: Given the use of services offered via the Site, Personal Information may be processed and stored within the blockchains used for the processing of digital asset transactions. Therefore, the User is informed that, in any event, such processing is not the responsibility of Usual Labs, which does not manage nor control said blockchains, and as such does not have any power of determination nor control over the possible processing of Personal Information which may be implemented in connection with said blockchains. 1. **PROTECTION AND USE OF PERSONAL INFORMATION** Usual Labs is committed to protecting your privacy. Internally, only a specified number of employees within our business have access to your Personal Information. Usual Labs’ systems and data are constantly under review to ensure that you are getting the best access and that market borrowing and lending security features are in place. Usual Labs reserves the right to retain and share certain Personal Information in order to meet our regulatory and statutory requirements. In addition, Usual Labs reserves the right to retain and share certain Personal Information with our corporate partners, and third parties acting on behalf of Usual Labs. Personal Information and other related data may be exported outside of the jurisdiction in which you reside. Your Personal Information may be processed and stored in a foreign country or countries. Under those circumstances, the governments, courts, law enforcement or regulatory agencies of that country or those countries may be able to obtain access to your Personal Information through foreign laws. You need to be aware that the privacy standards of those countries may be lower than those of the jurisdiction in which you reside. 1. **ACCESS AND CHANGING OF PERSONAL INFORMATION** You have the right to access the Personal Information we hold about you, and to require the correction, updating and blocking of inaccurate and/or incorrect data by sending an email to us. We will aim respond to your request within 14 days. You may also request the deletion or destruction of your Personal Information, your account details, etc. Usual Labs will act on your request only when it is not inconsistent with its legal and regulatory obligations and compliance procedures. Upon your written request, we will inform you of the use and general disclosure of your Personal Information. Important notice: The exercise of these rights is nevertheless limited, with regard to Personal Information that may be necessary for the operation of a blockchain. Indeed, this Data required for the operation of blockchains cannot be modified or erased during the lifetime of the blockchain in question. In addition, the retention / storage of said Data in said blockchains is not the responsibility of Usual Labs, which does not manage nor control said blockchains, and therefore has no power to determine or control the processing of Personal Information which may be implemented in connection with said blockchains, nor to pass on the exercise by Users of their rights to said blockchains. 1. **RIGHTS** You benefit, under the terms and conditions and within the limits defined by the legal and regulatory provisions on the protection of Personal Information, the following rights with regard to your Data: * Right of access: you can obtain confirmation whether or not Personal Information concerning you is processed by the Company and, when they are, access to said Personal Information, as well as certain information relating to the processing of your Personal Information and the characteristics of such processing; * Right of rectification: you can request the correction of your Personal Information that you consider incomplete or inaccurate; * Right to erasure: you can, in certain cases, request the erasure of your Personal Information (except for example if they are necessary for the execution of your contractual relations with the Company where applicable, or if they are necessary for the Company to comply with its legal or regulatory obligations or to ascertain or exercise its rights); * Right to limitation of processing: you can request limitation of processing of your Personal Information, allowing you to request in certain cases the marking of your Personal Information in order to limit future processing; * Right to the portability of your Personal Information: you have the right in certain cases and under certain conditions to request to receive the Personal Information concerning you that you have provided to us or, when technically possible, to they are transferred to a third party, in a machine-readable form (it being specified that this right to data portability only applies to processing based on the consent of the Persons concerned or on the execution of contractual relations, and this provided that the Data processing is carried out using automated processes); * Right to withdraw your consent: you can withdraw your consent if the processing is carried out on the basis of your consent, without the withdrawal of such consent prejudicing the lawfulness of the processing based on the consent made before the withdrawal of it; * Right to define guidelines for the retention, erasure or communication of your Personal Information after your death: in this regard, in the event of death which would be brought to our attention, please be aware that your Personal Information will in principle be deleted (unless it is necessary to keep it for a specified period for reasons relating to our legal and regulatory obligations), after having been communicated to a third party possibly designated by you. Regarding the processing of your Personal Information implemented by the Company, these rights are exercised: 1. by email to the following email address: [\[email protected\]](https://tech.usual.money/cdn-cgi/l/email-protection) or, 2. by post to the address next: 1, rue de Stockholm, 75008 Paris In any event, in the event of reasonable doubt as to the identity of the person submitting such a request to exercise their rights, the Company may always request that it be provided with additional information necessary to confirm the identity of the Person concerned and request for this purpose, when the situation so requires, a photocopy of an identity document bearing the signature of the holder. 1. COOKIES A. WHAT IS A COOKIE? A cookie is a small file for storing and retrieving information, generally made up of alphanumeric characters (cf. letters and numbers), deposited by a web server on the computer or electronic terminal of the User of the site to send state information to said browser and likewise obtain such information back from the browser. The status information can be for example a session identifier, a language, an expiration date, a response domain, etc. Cookies usually make it possible to obtain certain information on the browsing habits of the User, his computer or his terminal, in particular in order to improve the content and the service offered by the site in question, to know the traffic of said site and to provide Internet Users with personalized services. The notion of cookies covers all types of tracers or other similar technologies, for example: * HTTP Cookies; * but also the use of other techniques: * * “local shared objects” sometimes called “Flash Cookies”; * “local storage” implemented within HTML 5; * identifications by calculating the fingerprint of the terminal (“device fingerprinting”); * identifiers generated by operating systems (whether advertising or not: IDFA, IDFV, Android ID, etc.); * hardware identifiers (MAC address, serial number or any other identifier of a device); * etc. In any case, cookies can be: * session cookies, which disappear as soon as the User leaves the browser or the Site; * where permanent cookies that remain until the expiration of their lifespan or validity, or until the User deletes them by means of the functionalities of his browser for example or through the cookie management module set available on our Site. B. WHAT ARE THE MAIN “FAMILIES” OF COOKIES? "Functional" cookies not subject to User consent Functional Cookies, ie those whose sole purpose is to allow or facilitate electronic communication on, from or to a site or which are strictly necessary for the provision of a communication online at the express request of the User of a site, are exempt from the need for the publisher of a site to request the User's consent for their installation. The Company may thus use such functioning cookies, in particular technical cookies essential for navigation on the Site and cookies strictly necessary for the provision of certain services explicitly requested by the User, without requesting prior consent from you. If the User deactivates these “operating” cookies for example by means of the functionalities offered by his browser, he may not be able to access the Site, and / or not correctly receive the content and information available on the Site and / or not being able to benefit from all the features of the Site. Other cookies, subject in principle to the consent of the User The use of other cookies as referred to below is subject in principle to the prior consent of the User, the latter being free to either accept them by expressly consenting to their installation and reading in his browser (it being specified that the latter will then have the possibility to withdraw his consent at any time), or to refuse them. C. THE COMPANY’S COOKIES POLICY? With regard to cookies, the Company implements session cookies for user authentication, for which user consent will be requested when accessing the Site. Cookies and other tracers or similar technologies may be installed and / or read in your browser or terminal during your visit to the Site. 1. SECURITY We take reasonable steps to protect your Personal Information from misuse, loss, unauthorized access, modification or disclosure, including implementing appropriate security measures. The security measures in place will, from time to time, be reviewed in line with legal and technical developments. However, we give no guarantee that such misuse, loss, unauthorized access, modification or disclosure will not occur. There are protective measures that you should take which as well include but are not limited to changing password regularly, not sharing your Personal Information with other unless you clearly understand the purpose of their request and you know with whom you are dealing. 1. RETENTION OF PERSONAL INFORMATION We will hold your Personal Information only for as long as it is necessary for us to do so, having regard to the purposes described in this Privacy Policy and our own legal and regulatory requirements. In general, Personal Information relating to you shall be deleted after a period of five (5) years after your account is closed. Similarly, we usually retain information about transactions on your account for a period of five (5) years from the date of the transaction. 1. LINKS There may be links from our Site to other sites and resources provided by third parties. This Privacy Policy applies only to our Site. Accessing those third-party sites or sources requires you to leave our Site. We do not control those third party sites or any of the content contained therein and you agree that we are in no circumstances responsible or liable for any of those third party sites, including, without limitation, their content, policies, failures, promotions, products, services or actions and/or any damages, losses, failures or problems caused by, related to or arising from those sites. We encourage you to review all policies, rules, terms and regulations, including the privacy policies, of each site that you visit. 1. CHANGES Our policies, content, information, promotions, disclosures, disclaimers and features may be revised, modified, updated, and/or supplemented at any time and without prior notice at the sole and absolute discretion of the Company. If we change this Privacy Policy, we will take steps to notify all Users by a notice on our Site and will post the amended Privacy Policy on the Site. 1. COMPLAINTS TO THE SUPERVISORY AUTHORITY If you consider that we have not responded adequately to your request or your questions, you are entitled to lodge a complaint with the competent authority in matters of Personal Information protection, the National Commission for Informatics and Liberties (CNIL), at the following Internet address: * [https://www.cnil.fr/fr/plaintesarrow-up-right](https://www.cnil.fr/fr/plaintes) ; * or to the following postal address: CNIL - 3 PLACE DE FONTENOY - TSA 80715 - 75334 PARIS CEDEX 07. 1. CONSULTATION OF APPLICABLE TEXTS The text of the General Data Protection Regulation (GDPR) is freely accessible at the following Internet address: [https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX:32016R0679arrow-up-right](https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX:32016R0679) ; or on the CNIL website at the following internet address: [https://www.cnil.fr/fr/reglement-europeen-protection-donneesarrow-up-right](https://www.cnil.fr/fr/reglement-europeen-protection-donnees) as well as all applicable texts on the protection of Personal Information and protection of rights and freedoms on the Internet (https://www.cnil.fr ). To understand your rights, you can also refer to the explanations provided by the Cnil here: [https://www.cnil.fr/fr/les-droits-pour-maitriser-vos-donnees-personnellesarrow-up-right](https://www.cnil.fr/fr/les-droits-pour-maitriser-vos-donnees-personnelles) . We point out that in application of articles L.223-1 et seq. Of the Consumer Code, you can, if you are a consumer, object at any time to being canvassed by telephone, by registering for free on the site [www.bloctel.gouv.frarrow-up-right](http://www.bloctel.gouv.fr/) . 1. CONTACT US If you have any questions, comments, or concerns regarding our Privacy Policy, please contact us at following email address: [\[email protected\]envelope](https://tech.usual.money/cdn-cgi/l/email-protection#ceada1a0baafadba8ebbbdbbafa2bebca1baa1ada1a2e0ada1a3) . Usual Labs, a French simplified joint stock company (société par actions simplifiée) organized under the laws of France, having its registered office located at 1 rue de Stockholm 75008 Paris, incorporated with the Commercial and Companies Register of Paris under number 919 540 427. [PreviousLegal Noticechevron-left](https://tech.usual.money/legal/legal-notice) Last updated 1 year ago Was this helpful? Was this helpful? --- # USD0 Abstract Oracle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#high-level-overview) High-Level Overview -------------------------------------------------------------------------------------------------------------------------------------------- The AbstractOracle contract is inherited by the ClassicalOracle. It is not meant to be deployed on its own and is designed to safely be inherited by upgradable contracts, and upgradable contracts only. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#contract-summary) Contract Summary 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 The inheriting contracts are responsible for initializing the `tokenToOracleInfo` mapping as well as implementing `_latestRoundData` to handle the specific interaction for the corresponding oracle. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with UsualOracle and ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **Initializable**: Allows to handle contract setup and upgrades. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#functionality-breakdown) Functionality Breakdown ---------------------------------------------------------------------------------------------------------------------------------------------------- The main functionality of this contract is to get the price a given token by its address with `getPrice`. The AbstractOracle contract calls the virtual function `_latestRoundData`. It then converts the returned amount to 18 decimals. Finally, it runs the anti-depeg check for stablecoins. The `getQuote` function calls `getPrice` internally, and then applies a cross-product to the amount given as parameter, yielding the final quote. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#public-external-functions) Public/External Functions * **getMaxDepegThreshold()**: Returns the current maximum allowed price variation for stablecoins in basis points (e.g. with a value of 500, `getPrice` and `getQuote` will revert if the price of a stablecoin is outside the range $0.95-$1.05). View function. * **setMaxDepegThreshold(uint256 maxAuthorizedDepegPrice)**: Updates the maximum allowed price variation and emits a `SetMaxDepegThreshold` event. Nonpayable function. Reserved for admin use only. * **getPrice(address token)**: Returns the price of the given token scaled to 18 decimals (e.g. a return value of 3e18 means the token price is $3). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. * **getQuote(address token)**: Returns the USD value equivalent to the given amount of the given token (e.g. if the token price is $3, calling with 1e6 will return 3e6, no matter the number of decimals of the token). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#remediation-strategies) Remediation Strategies * **Off-chain data sources:** We do not rely on on-chain oracles, such as Uniswap or Curve. These protocols could more easily be vulnerable to sandwich and/or flashloan attacks, enabling price manipulation. * **Dual-oracle cross-verification**: _Not live yet, will require a future upgrade._ Drawing inspiration from [Liquity’s PriceFeedarrow-up-right](https://github.com/liquity/dev/blob/main/packages/contracts/contracts/PriceFeed.sol) , we could add a secondary oracle and compare prices between the two. This would reduce the impact of one of the two oracles getting hacked or freezing. We had implemented such a system, but didn’t find any other reliable price feed for USDC, USDT, nor USYC. [PreviousUSD0 ClassicalOraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle) [NextChainlink Oracleschevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#functions-description) * [Remediation Strategies](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle#remediation-strategies) Was this helpful? --- # USD0 DaoCollateral | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------------------- The DaoCollateral contract is a crucial component of the USD0 stablecoin ecosystem, designed to manage the collateralization, minting, and redemption of USD0 tokens. It ensures that the circulating supply of USD0 is always fully backed by Real World Assets (RWA) collateral, providing transparency and security for USD0 holders. The contract facilitates the swapping of RWA tokens for USD0, redemption of USD0 for RWA tokens, and implements an intent-based matching system for efficient, non-custodial trading. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#inherited-contracts) Inherited Contracts * `Initializable` (OZ): Allows the contract to be initialized in an upgradeable pattern. * `ReentrancyGuardUpgradeable` (OZ): Prevents reentrant attacks on sensitive functions. * `PausableUpgradeable` (OZ): Enables pausing of contract functionality by authorized accounts. * `NoncesUpgradeable` (OZ): Manages nonces for user operations. * `EIP712Upgradeable` (OZ): Implements EIP-712 for structured data hashing and signing. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#functionality-breakdown) Functionality Breakdown --------------------------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#key-functionalities) Key Functionalities 1. **Minting and redeeming USD0:** At its core, the contract accrues RWAs (USYC) by routing trades accordingly. When a user sends RWA, the daoCollateral contract mints the equivalent amount of USD0 stablecoins, and vice versa, allowing users to exchange their USD0 stablecoins for RWAs, represented as USYC tokens, at the current exchange rate. * **Swap:** Facilitates the conversion of Real World Assets (RWAs), represented as USYC tokens, into the DAO's stablecoin (USD0). Upon initiating this function, users exchange their USYC tokens for USD0 stablecoins directly. * **Redeem:** Allows users to redeem their USD0 stablecoins against a fee. By invoking this function, users exchange their USD0 stablecoins for RWAs, represented as USYC tokens, at the current exchange rate. The system is also able to route Swapper Engine trades on their behalf against a different token pair (USDC/USD0), by accumulating the underlying RWAs and minting USD0 to route user's intents. This mechanism, inspired by CowSwap, allows RWA providers to retain their tokens until the trade is executed, allowing for _non-custodial, gas-less, just-in-time,_ RWA liquidity providers. 1. **Intent-Based Matching System (Three-Way Trade Example):** The Intent-Based Matching System is facilitated by the daoCollateral contract, in this example three parties are involved: a USDC provider, an RWA provider, and the daoCollateral contract itself. Here’s how it works step-by-step: * **USDC Provider**: A user who holds USDC initiates a trade by providing USDC to the Swapper engine. In return, this user receives USD0. * **RWA Provider**: Another user who holds Real World Assets (RWAs), such as USYC, wants to exchange these assets for USDC. This user submits their intent to trade RWAs for USDC to the daoCollateral contract. * **daoCollateral Contract**: The daoCollateral contract plays a crucial intermediary role in this three-way trade. It accumulates the RWAs from the RWA provider. The contract mints new USD0 tokens equivalent to the value of the received RWAs. The contract then completes the trade by providing the newly minted USD0 to the Swapper engine, which matches the initial USDC provider’s trade. Finally, the daoCollateral contract gives the USDC from the USDC provider to the RWA provider. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#id-3.-role-based-access-control) 3\. Role-Based Access Control The contract implements a role-based access control system for sensitive operations: * DEFAULT\_ADMIN\_ROLE: Has the highest level of access, including the ability to unpause the contract and perform critical administrative tasks. * INTENT\_MATCHING\_ROLE: Required to execute intent-based swaps, ensuring that only authorized entities can match and process intents. * NONCE\_THRESHOLD\_SETTER\_ROLE: Allows setting of nonce thresholds, which is crucial for the intent-based system's security. * PAUSING\_CONTRACTS\_ROLE: Grants the ability to pause specific contract functionalities in case of emergencies. These roles ensure that different levels of access are properly managed and that sensitive operations are restricted to authorized entities, enhancing the overall security and governance of the contract. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#public-external-functions) Public/External Functions * `initialize`: Sets up the contract with initial parameters. * `swap`: Allows users to swap RWA tokens for USD0. * `swapWithPermit`: Similar to `swap` but uses permit for approval. * `redeem`: Enables users to redeem USD0 for RWA tokens. * `redeemDao`: Special redemption function for DAO operations. Only callable by DEFAULT\_ADMIN\_ROLE. * `swapRWAtoStbc`: Facilitates swapping RWA to stablecoins through the SwapperEngine. * `swapRWAtoStbcIntent`: Executes swaps based on signed intents. Only callable by INTENT\_MATCHING\_ROLE. * `activateCBR`: Activates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * `deactivateCBR`: Deactivates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * `setRedeemFee`: Sets the fee for redemption operations. Only callable by DEFAULT\_ADMIN\_ROLE. * `setNonceThreshold`: Set the lower bound for the intent nonce to be considered consumed. Only callable by NONCE\_THRESHOLD\_SETTER\_ROLE. * `pauseRedeem`, `pause`, `pauseSwap`: Pausing functions for specific operations. Only callable by PAUSING\_CONTRACTS\_ROLE. * `unpause`, `unpauseRedeem`, `unpauseSwap` : Global unpausing functions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#constants) Constants * CONTRACT\_REGISTRY\_ACCESS: Address of the registry access contract. * CONTRACT\_TOKEN\_MAPPING: Address of the token mapping contract. * CONTRACT\_ORACLE: Address of the oracle contract. * CONTRACT\_TREASURY: Address of the treasury contract. * CONTRACT\_USD0: Address of the USD0 token contract. * CONTRACT\_SWAPPER\_ENGINE: Address of the SwapperEngine contract. * DEFAULT\_ADMIN\_ROLE: Role identifier for the default admin. * INTENT\_MATCHING\_ROLE: Role identifier for intent matching operations. * NONCE\_THRESHOLD\_SETTER\_ROLE: Role identifier for setting nonce thresholds. * PAUSING\_CONTRACTS\_ROLE: Role identifier for pausing contract operations. * MAX\_REDEEM\_FEE: Maximum allowed redemption fee. * SCALAR\_ONE: Scalar value representing 1 in the contract's decimal system. * SCALAR\_TEN\_KWEI: Scalar value representing 10,000 in the contract's decimal system. * INTENT\_TYPE\_HASH: Type hash for EIP-712 structured data signing of intents. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#key-components) Key Components * **Oracle Integration**: Uses an oracle to fetch real-time price data for RWA tokens. * **SwapperEngine**: Interacts with the SwapperEngine contract for executing trades. * **Token Mapping**: Manages the mapping of supported RWA tokens. * **Access Control**: Implements role-based access control for administrative functions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of critical functions in emergencies. * **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. * **Access Control**: Restricts sensitive operations to authorized roles. * **Intent Validation**: Implements checks for intent-based swaps. [PreviousUSD0chevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0) [NextUSD0 Swapper Enginechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#functions-description) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#constants) * [Key Components](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#key-components) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral#safeguards-implementation) Was this helpful? --- # Legal Notice | Usual Tech Docs [hashtag](https://tech.usual.money/legal/legal-notice#usual-protocol-date-of-the-latest-revision-10-18-2024) Usual Protocol - Date of the latest revision: 10/18/2024 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The information contained on the websites [https://usual.moneyarrow-up-right](https://usual.money/) and [https://app.usual.money/arrow-up-right](https://app.usual.money/) (together the “Website”) has no contractual value and is provided for information purposes only. Up Only Co (the “Company”) reserves the right to modify their characteristics at any time and without prior notice. The information contained in this Website shall not be construed as an offer to the public, a solicitation, an investment advice, or a solicitation by the Company to the users of the Website. ### [hashtag](https://tech.usual.money/legal/legal-notice#presentation-of-the-company) PRESENTATION OF THE COMPANY The Website is published by the Company. \- Company’s name: Up Only Co, \- SIREN number: 919 540 427, \- Registered office: 1, rue de Stockholm, 75008, Paris, \- VAT number: 919 540 427 \- Jurisdiction: France. The Company undertakes to comply with the regulations governing the management and operation of a website. At any time, you can contact the Company by email at [\[email protected\]](https://tech.usual.money/cdn-cgi/l/email-protection) ### [hashtag](https://tech.usual.money/legal/legal-notice#site-content) SITE CONTENT The Company declines all responsibility in the event of impossibility or difficulty in accessing its Website, in particular due to an Internet connection problem. The Company shall not be liable for any direct or indirect damage, including loss of business, loss of profit and/or loss resulting from a partial or permanent interruption of service due to an Internet connection problem. The Company may not be held liable for elements beyond its control, nor for damage that may be caused by the technical environment of users of this Website, including their software, computers, network equipment and any other equipment used to access the services and/or information published on the Website. The Company makes every effort to ensure that the information published on its Website is up-to-date and accurate and reserves the right to modify its content at any time without prior notice. However, the Company cannot guarantee that it has not been modified by a third party (_e.g._, via virus, malware, or intrusion) or that the information is complete. ### [hashtag](https://tech.usual.money/legal/legal-notice#hypertext-links) HYPERTEXT LINKS The Company may provide hypertext links to other Internet sites or resources from the Website. The Company has no control over such sites and resources and is not responsible for any damage or loss resulting from your access or use of such sites. ### [hashtag](https://tech.usual.money/legal/legal-notice#personal-data) PERSONAL DATA For more information, please consult the Company’s data policy, which can be consulted by clicking on the following link: ### [hashtag](https://tech.usual.money/legal/legal-notice#general-terms-of-use-of-the-website) GENERAL TERMS OF USE OF THE WEBSITE For more information, please consult the Company’s general terms of use of the Website, which can be consulted by clicking on the following link: ### [hashtag](https://tech.usual.money/legal/legal-notice#security) SECURITY It is the responsibility of each Internet user to take appropriate measures to protect his or her computer from contamination by viruses and other malicious computer programs. The Company shall not be held responsible for elements beyond its control and for any damage that may be suffered by the user's terminal, and in particular smartphones, tablets, computers, software, network equipment and any other equipment used to access the Website. [PreviousTerms of Serviceschevron-left](https://tech.usual.money/legal/terms-of-services) [NextPrivacy Policychevron-right](https://tech.usual.money/legal/privacy-policy) Last updated 1 year ago Was this helpful? * [Usual Protocol - Date of the latest revision: 10/18/2024](https://tech.usual.money/legal/legal-notice#usual-protocol-date-of-the-latest-revision-10-18-2024) * [PRESENTATION OF THE COMPANY](https://tech.usual.money/legal/legal-notice#presentation-of-the-company) * [SITE CONTENT](https://tech.usual.money/legal/legal-notice#site-content) * [HYPERTEXT LINKS](https://tech.usual.money/legal/legal-notice#hypertext-links) * [PERSONAL DATA](https://tech.usual.money/legal/legal-notice#personal-data) * [GENERAL TERMS OF USE OF THE WEBSITE](https://tech.usual.money/legal/legal-notice#general-terms-of-use-of-the-website) * [SECURITY](https://tech.usual.money/legal/legal-notice#security) Was this helpful? --- # USUAL distribution | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usual-distribution#overview) Overview ----------------------------------------------------------------------------------------------- The USUAL token distribution system is designed to ensure fair, efficient, and community-driven emission. Tokens are distributed through a daily mechanism, which adjusts based on the protocol's performance indicators, such as TVL growth and interest rates. Emissions are allocated to on-chain vaults, like UsualX and UsualS, as well as off-chain participants through a merkle proof validation process. To prevent excessive inflation, emissions are capped and decrease over time as the TVL grows. Governance controls the allocation of tokens across various categories, such as liquidity providers, stakers, and market makers, ensuring flexibility and alignment with protocol growth. For more information see [USUAL Distribution Model](https://tech.usual.money/overview/architecture/usual-distribution-model) . ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FK6T4T4xs3D4jKCF1EErP%252Fimage.png%3Falt%3Dmedia%26token%3D3d849fd0-fd40-4fff-9cb3-69fd892bf85c&width=768&dpr=3&quality=100&sign=8317ae8c&sv=2) High level flow of the USUAL distribution model [PreviousUSUALx (USUAL staking)chevron-left](https://tech.usual.money/overview/features/usualx-usual-staking) [NextUsual bUSD0 (formerly USD0++) Investment Vaultchevron-right](https://tech.usual.money/overview/features/usual-usd0++-investment-vault) Last updated 4 months ago Was this helpful? Was this helpful? --- # ETH0 Abstract Oracle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#high-level-overview) High-Level Overview -------------------------------------------------------------------------------------------------------------------------------------------- The AbstractOracle contract is inherited by the ClassicalOracle. It is not meant to be deployed on its own and is designed to safely be inherited by upgradable contracts, and upgradable contracts only. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#contract-summary) Contract Summary 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 The inheriting contracts are responsible for initializing the `tokenToOracleInfo` mapping as well as implementing `_latestRoundData` to handle the specific interaction for the corresponding oracle. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with the ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **Initializable**: Allows to handle contract setup and upgrades. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#functionality-breakdown) Functionality Breakdown ---------------------------------------------------------------------------------------------------------------------------------------------------- The main functionality of this contract is to get the price a given token by its address with `getPrice`. The AbstractOracle contract calls the virtual function `_latestRoundData`. It then converts the returned amount to 18 decimals. Finally, it runs the anti-depeg check for stablecoins. The `getQuote` function calls `getPrice` internally, and then applies a cross-product to the amount given as parameter, yielding the final quote. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#public-external-functions) Public/External Functions * **getMaxDepegThreshold()**: Returns the current maximum allowed price variation for stablecoins in basis points (e.g. with a value of 500, `getPrice` and `getQuote` will revert if the price of a stablecoin is outside the range $0.95-$1.05). View function. * **setMaxDepegThreshold(uint256 maxAuthorizedDepegPrice)**: Updates the maximum allowed price variation and emits a `SetMaxDepegThreshold` event. Nonpayable function. Reserved for admin use only. * **getPrice(address token)**: Returns the price of the given token scaled to 18 decimals (e.g. a return value of 3e18 means the token price is $3). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. * **getQuote(address token)**: Returns the USD value equivalent to the given amount of the given token (e.g. if the token price is $3, calling with 1e6 will return 3e6, no matter the number of decimals of the token). Reverts if the token is a stablecoin and it’s outside of the allowed price variation range. View function. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#remediation-strategies) Remediation Strategies * **Off-chain data sources:** We do not rely on on-chain oracles, such as Uniswap or Curve. These protocols could more easily be vulnerable to sandwich and/or flashloan attacks, enabling price manipulation. * **Dual-oracle cross-verification**: _Not live yet, will require a future upgrade._ Drawing inspiration from [Liquity’s PriceFeedarrow-up-right](https://github.com/liquity/dev/blob/main/packages/contracts/contracts/PriceFeed.sol) , we could add a secondary oracle and compare prices between the two. This would reduce the impact of one of the two oracles getting hacked or freezing. [PreviousETH0 Classical Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle) [NextLido wstETH Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#functions-description) * [Remediation Strategies](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle#remediation-strategies) Was this helpful? --- # USUAL | Usual Tech Docs [](https://tech.usual.money/smart-contracts/utility-contracts/usual/redstone-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FjOFPpJlHupDnVLNqFTAd%252FCard%2520Cover%252060.png%3Falt%3Dmedia%26token%3Dd2a97411-6a7f-4a22-9993-59d32c0abd47&width=752&dpr=3&quality=100&sign=d8e75c2d&sv=2) **What Oracle does Redstone provide?** [PreviousMonerium Swapper Helperchevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper) [NextRedStone Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usual/redstone-oracle) Last updated 1 month ago Was this helpful? Was this helpful? --- # EUR0 | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/eur0#overview) Overview --------------------------------------------------------------------------------- EUR0 is a euro-pegged stablecoin designed for secure and seamless use across the DeFi ecosystem. It is fully backed by EU issued T-Bills, offering enhanced security without reliance on traditional banks. The coin is permissionless and easily integrable, with real-time reserve transparency provided by fund administrators. EUR0 consolidates liquidity from diverse sources and utilizes an innovative mint engine for efficient collateralization, ensuring peg stability and compliance with EU regulations, making it a reliable alternative to other EURO pegged stablecoins. chevron-right**How to Mint EUR0**[hashtag](https://tech.usual.money/overview/features/eur0#how-to-mint-eur0) EUR0 tokens can be minted through Usual's counter in two ways: * Direct Mint: By depositing an eligible RWA (e.g. Spiko euTBL) into the protocol to receive an equivalent amount of EUR0 on a 1:1 basis. * Indirect Mint: By depositing EURC into the protocol to receive EUR0 on a 1:1 basis. In this method, a third party known as the Collateral Provider (CP) supplies the necessary RWA collateral, enabling users to obtain EUR0 without directly holding RWAs. chevron-right**How to Redeem EUR0**[hashtag](https://tech.usual.money/overview/features/eur0#how-to-redeem-eur0) * Withdrawal of Underlying Assets: Users can withdraw the Real World Asset (RWA) underlying the EUR0 token directly with Usual's dApp * Secondary Market Transactions: Users can sell EUR0 for EURC (or any other token) on the secondary market. As EUR0 is fully redeemable within Usual's dApp the 1:1 peg is expected to be maintained through arbitrage, similar to other fiat-backed stablecoin. [hashtag](https://tech.usual.money/overview/features/eur0#smart-contract) Smart Contract --------------------------------------------------------------------------------------------- [EUR0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/eur0) [PreviousMint & Redeem Enginechevron-left](https://tech.usual.money/overview/features/mint-and-redeem-engine) [NextETH0chevron-right](https://tech.usual.money/overview/features/eth0) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/eur0#overview) * [Smart Contract](https://tech.usual.money/overview/features/eur0#smart-contract) Was this helpful? --- # USUAL | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usual#overview) Overview ---------------------------------------------------------------------------------- $USUAL is the governance and utility token of the protocol designed for long-term value and sustainable growth, backed by real cash flows from the Usual Protocol. It offers disinflationary issuance, with supply tied to the Total Value Locked (TVL) of staked USD0, and is aligned with future cash flows to ensure that emissions remain lower than revenue growth. USUAL holders can stake tokens to earn rewards and activate governance rights, which include managing treasury and protocol decisions. It also allows governance control over collateral types, optimizing stability. chevron-right**USUAL issuance**[hashtag](https://tech.usual.money/overview/features/usual#usual-issuance) USUAL is issued to USD0, USD0++, USUALx and USUAL\* users on daily basis based on the USUAL distribution math. For further details see [USUAL distributionarrow-up-right](https://app.gitbook.com/o/qhhUYNkfevGh3Y1MDQaS/s/pUhQzPJGdJzuLTQ5sCym/overview/features#usual-distribution) . [hashtag](https://tech.usual.money/overview/features/usual#smart-contract) Smart Contract ---------------------------------------------------------------------------------------------- [USUALchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual) [PreviousETH0chevron-left](https://tech.usual.money/overview/features/eth0) [NextUSUAL\*chevron-right](https://tech.usual.money/overview/features/usual-1) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usual#overview) * [Smart Contract](https://tech.usual.money/overview/features/usual#smart-contract) Was this helpful? --- # USD0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fs03nwUaWtx0ACaNQKxRX%252FCard%2520Cover%252041.png%3Falt%3Dmedia%26token%3D99184f18-f0bd-43c2-a680-60f8d304eff3&width=752&dpr=3&quality=100&sign=431e88b5&sv=2) **USD0** **DAO Collateral Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEAXcO5aCmFvNWZ0zLCW1%252FCard%2520Cover%252054.png%3Falt%3Dmedia%26token%3D9ac7d7ae-2286-4dca-8f0c-0b4adc72bc3a&width=752&dpr=3&quality=100&sign=ccb79780&sv=2) **Swapper Engine Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FWePR3Lq3b0QzmvocsimR%252FCard%2520Cover%252011.png%3Falt%3Dmedia%26token%3Df0fe83b7-5889-488f-80e6-fb25a9ee9f96&width=752&dpr=3&quality=100&sign=4ae7921a&sv=2) **USD0 Distribution Smart Contract** [PreviousProtocol Contractschevron-left](https://tech.usual.money/smart-contracts/protocol-contracts) [NextUSD0 DaoCollateralchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) Last updated 5 months ago Was this helpful? Was this helpful? --- # USD0a DaoCollateral | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#high-level-overview) High-Level Overview The DaoCollateral contract is a crucial component of the USD0a ecosystem, designed to manage the collateralization, minting, and redemption of USD0a tokens. USD0a is a yield-bearing token that represents a proportional share of the total value of underlying collateral assets. The contract facilitates the swapping of collateral tokens (such as USCC, USTB, and USDC) for USD0a, redemption of USD0a for collateral tokens, and implements a Counter Bank Run (CBR) mechanism to protect the protocol during extreme market conditions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#inherited-contracts) Inherited Contracts * **ReentrancyGuardUpgradeable (OZ)**: Prevents reentrant attacks on sensitive functions. * **PausableUpgradeable (OZ)**: Enables pausing of contract functionality by authorized accounts. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#functionality-breakdown) Functionality Breakdown **Key Functionalities** **1\. Minting and redeeming USD0a:** At its core, the contract accrues collaterals by routing trades accordingly. When a user sends collateral tokens, the daoCollateral contract mints the equivalent amount of USD0a tokens, and vice versa, allowing users to exchange their USD0a tokens for collaterals at the current exchange rate. * **Swap**: Facilitates the conversion of collateral tokens (such as USCC, USTB, and USDC) into USD0a tokens. Upon initiating this function, users exchange their collateral tokens for USD0a tokens directly. The amount of USD0a minted is calculated based on the current USD0a price in USD, which accounts for yield accumulation. Since USD0a is yield-bearing, its price increases over time depending on the collaterals price. * **Redeem**: Allows users to redeem their USD0a tokens against a fee. By invoking this function, users exchange their USD0a tokens for collateral tokens at the current exchange rate. The redemption fee is deducted from the amount and, when CBR is not active, is minted to the yield treasury to improve the collateralization ratio. **2\. Counter Bank Run (CBR) Mechanism:** The Counter Bank Run mechanism is a protective feature that can be activated during extreme market conditions. When activated: * Swap functionality is automatically paused * Redemptions continue but at a reduced rate (determined by the CBR coefficient) * Redemption fees are burned instead of being sent to the yield treasury, helping to maintain the protocol's solvency * The CBR coefficient (between 0 and 1) determines the discount applied to redemptions **3\. Role-Based Access Control** The contract implements a role-based access control system for sensitive operations: * **CBR\_OPERATOR\_ROLE**: Required to activate or deactivate the Counter Bank Run mechanism. * **REDEEM\_FEE\_OPERATOR\_ROLE**: Allows setting of the redemption fee, which is crucial for managing protocol economics. * **MIN\_REDEEM\_AMOUNT\_SETTER\_ROLE**: Allows setting of the minimum redeem amount in USD0a, preventing dust redemptions. * **DAO\_REDEMPTION\_ROLE**: Grants the ability to perform fee-free redemptions for DAO operations. * **PAUSING\_CONTRACTS\_ROLE**: Grants the ability to pause specific contract functionalities in case of emergencies. * **UNPAUSING\_CONTRACTS\_ROLE**: Grants the ability to unpause contract functionalities. These roles ensure that different levels of access are properly managed and that sensitive operations are restricted to authorized entities, enhancing the overall security and governance of the contract. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#publicexternal-functions) Public/External Functions * **initialize**: Sets up the contract with initial parameters including the registry contract and initial redeem fee. * **swap**: Allows users to swap collateral tokens for USD0a. The function calculates the USD value of the collateral tokens, determines the equivalent USD0a amount based on the current USD0a price, and mints USD0a to the user. * **swapWithPermit**: Similar to swap but uses permit for approval, enabling gasless approvals for supported tokens. * **redeem**: Enables users to redeem USD0a for collateral tokens. A redemption fee is deducted, and the net amount is used to calculate the collateral tokens returned. The fee is minted to the yield treasury (unless CBR is active). * **redeemDao**: Special redemption function for DAO operations that bypasses the redemption fee. Only callable by DAO\_REDEMPTION\_ROLE. * **activateCBR**: Activates the Counter Bank Run mechanism with a specified coefficient. Automatically pauses swap functionality. Only callable by CBR\_OPERATOR\_ROLE. * **deactivateCBR**: Deactivates the Counter Bank Run mechanism. Only callable by CBR\_OPERATOR\_ROLE. * **setRedeemFee**: Sets the fee for redemption operations (in basis points). Only callable by REDEEM\_FEE\_OPERATOR\_ROLE. * **setMinRedeemAmountInUSD0X**: Sets the minimum amount of USD0a that can be redeemed. Only callable by MIN\_REDEEM\_AMOUNT\_SETTER\_ROLE. * **pauseRedeem, pauseSwap, pause**: Pausing functions for specific operations or the entire contract. Only callable by PAUSING\_CONTRACTS\_ROLE. * **unpause, unpauseRedeem, unpauseSwap**: Global unpausing functions. Only callable by UNPAUSING\_CONTRACTS\_ROLE. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#getter-functions) Getter Functions * **isCBROn**: Returns whether the Counter Bank Run mechanism is currently active. * **cbrCoef**: Returns the current CBR coefficient. * **redeemFee**: Returns the current redemption fee in basis points. * **minRedeemAmountInUSD0X**: Returns the minimum amount of USD0a that can be redeemed. * **isRedeemPaused**: Returns whether redeem functionality is paused. * **isSwapPaused**: Returns whether swap functionality is paused. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: Address of the registry access contract. * **CONTRACT\_TOKEN\_MAPPING**: Address of the token mapping contract. * **CONTRACT\_ORACLE**: Address of the oracle contract. * **CONTRACT\_TREASURY**: Address of the treasury contract holding collateral tokens. * **CONTRACT\_YIELD\_TREASURY**: Address of the treasury contract holding fee tokens. * **CONTRACT\_USD0X**: Address of the USD0a token contract. * **CBR\_OPERATOR\_ROLE**: Role identifier for CBR operations. * **REDEEM\_FEE\_OPERATOR\_ROLE**: Role identifier for setting redemption fees. * **MIN\_REDEEM\_AMOUNT\_SETTER\_ROLE**: Role identifier for setting minimum redeem amounts. * **DAO\_REDEMPTION\_ROLE**: Role identifier for DAO redemptions. * **PAUSING\_CONTRACTS\_ROLE**: Role identifier for pausing contract operations. * **UNPAUSING\_CONTRACTS\_ROLE**: Role identifier for unpausing contract operations. * **MAX\_REDEEM\_FEE**: Maximum allowed redemption fee (2500 basis points = 25%). * **SCALAR\_ONE**: Scalar value representing 1 in the contract's decimal system (1e18). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#key-components) Key Components * **Oracle Integration**: Uses an oracle to fetch real-time price data for collateral tokens and USD0a. * **Token Mapping**: Manages the mapping of supported collateral tokens through the TokenMapping contract. * **Access Control**: Implements role-based access control for administrative functions through the RegistryAccess contract. * **USD0a Price Integration**: Interacts with the USD0a token contract to get the current USD0a price in USD, which accounts for yield accumulation and determines the exchange rate for swaps and redemptions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of critical functions (swap, redeem, or entire contract) in emergencies. * **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. * **Access Control**: Restricts sensitive operations to authorized roles. * **Counter Bank Run (CBR)**: Provides a mechanism to protect the protocol during extreme market conditions by reducing redemption rates and pausing swaps. * **Minimum Redeem Amount**: Prevents dust redemptions that could be economically inefficient. * **Price Validation**: Ensures prices are non-zero before executing swaps or redemptions. * **Amount Validation**: Validates that amounts are non-zero, within acceptable ranges, and meet minimum thresholds. [PreviousUSD0achevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a) [NextUSD0a SwapperEnginechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#contract-summary) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#functions-description) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#constants) * [Key Components](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#key-components) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral#safeguards-implementation) Was this helpful? --- # DebtUSDC Oracle | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#high-level-overview) High-Level Overview The DebtUSDCOracle contract is a simple wrapper around the USDC/USD Chainlink price feed that implements a price cap mechanism. The contract ensures that the DebtUSDC token price never exceeds $1 USD, maintaining price stability and preventing oracle manipulation from affecting the protocol's debt token pricing. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#contract-summary) Contract Summary The contract provides a Chainlink-compatible aggregator interface that: * Wraps the underlying USDC/USD price feed * Caps the maximum price at $1 USD (1e8 with 8 decimals) * Returns price data in the standard Chainlink AggregatorV3Interface format ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#key-functionality) Key Functionality #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#latestrounddata) latestRoundData Returns the latest price data from the USDC/USD feed with a price cap applied: * If the USDC/USD feed price is at or below $1, returns the actual price * If the USDC/USD feed price exceeds 1,returns1,returns1 as the maximum price This ensures that DebtUSDC tokens maintain a stable price ceiling, preventing oracle anomalies or manipulation from causing the debt token price to exceed its intended value. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#getrounddata) getRoundData Not supported - reverts with `NotSupported` error. Only `latestRoundData` is available. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#constants) Constants * **PRICE\_FEED\_DECIMALS**: 8 (standard Chainlink decimals) * **MAX\_USDC\_ORACLE\_PRICE**: 1e8 (represents $1.00 with 8 decimals) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#immutable-variables) Immutable Variables * **USDC\_USD\_FEED**: The underlying USDC/USD Chainlink price feed aggregator ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#use-case) Use Case The DebtUSDCOracle is used by the protocol to price DebtUSDC tokens. By capping the price at $1, the protocol ensures that debt tokens maintain their intended value relationship with USDC, preventing any oracle manipulation or price anomalies from affecting the protocol's accounting. [PreviousUSD0a Classical Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle) [NextDebtUSCC Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#contract-summary) * [Key Functionality](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#key-functionality) * [Constants](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#constants) * [Immutable Variables](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#immutable-variables) * [Use Case](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle#use-case) Was this helpful? --- # USDC by Circle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle#who-is-circle) Who is Circle? --------------------------------------------------------------------------------------------------------------------- Circle is a financial technology company that develops infrastructure for digital currencies and payments. It is the principal issuer of USDC and a founding member of the Centre Consortium, which governs the standards and policies around USDC issuance and usage. Find out more about [Circlearrow-up-right](https://www.circle.com/fr/about-circle) . [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle#what-is-usdc) What is USDC? ------------------------------------------------------------------------------------------------------------------- USDC (USD Coin) is a fiat-backed stablecoin issued by Circle. Each USDC token is intended to be redeemable 1:1 for U.S. dollars, with reserves held in cash and short-duration U.S. government obligations. These reserves are held with regulated financial institutions, and Circle publishes regular attestations from third-party accounting firms to verify the backing of USDC in circulation. USDC is available on multiple blockchains and is used in a variety of applications, including payments, trading, decentralized finance (DeFi), and remittances. More on [USDCarrow-up-right](https://www.circle.com/fr/usdc) . [PreviousUSCC by Superstatechevron-left](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate) [NextETH0 Collateralchevron-right](https://tech.usual.money/smart-contracts/eth0-collateral) Last updated 5 months ago Was this helpful? * [Who is Circle?](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle#who-is-circle) * [What is USDC?](https://tech.usual.money/smart-contracts/usd0a-collateral/usdc-by-circle#what-is-usdc) Was this helpful? --- # USUAL* | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#high-level-overview) High-Level Overview This section provides an overview of the UsualS smart contract. The UsualS contract is designed to manage the USUALS ERC20 token, implementing essential functionalities for minting, burning, and transferring tokens, along with additional layers of control and security. The contract integrates role-based access control through a registry system, ensuring that only authorized entities can perform sensitive operations such as pausing the contract or blacklisting addresses ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#inherited-contracts) Inherited Contracts * **ERC20PausableUpgradeable**: Extends ERC20 to support pausability * **ERC20PermitUpgradeable**: Extends ERC20 to support gasless transactions through signed approvals. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#erc20pausableupgradeable) ERC20PausableUpgradeable Standard OpenZeppelin Implementation. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#erc20permitupgradeable) ERC20PermitUpgradeable Standard OpenZeppelin Implementation. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#sc-flows) SC-Flows ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FB2LkpTP3JkXz0o55fpOP%252FSans%2520titre.svg%3Falt%3Dmedia%26token%3D7f4f43a7-53c3-4f2e-a693-5dd19711f7f8&width=768&dpr=3&quality=100&sign=4a168cd5&sv=2) #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#key-functionalities) Key Functionalities * **Minting**: Tokens can be minted to an address, subject to role checks. * **Burning**: Tokens can be burned from an address, also subject to role checks. * **Transfers**: Tokens can be sent or receive. Will revert if blacklisted. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#public-external-functions) Public/External Functions * **pause()**: Pauses all token transfer operations; callable only by the PAUSING\_CONTRACTS\_ROLE. * **unpause()**: Resumes all token transfer operations; also callable only by the DEFAULT\_ADMIN\_ROLE. * **transfer(address to, uint256 amount)**: Transfers tokens to a non-blacklisted address. * **transferFrom(address sender, address to, uint256 amount)**: Transfers tokens from one non-blacklisted address to another. * **burn(uint256 amount)** and **burnFrom(address account, uint256 amount)**: Burns tokens from an address, requiring the USUALS\_BURN role. * **blacklist(address account)** and **unBlacklist(address account)**: Those functions allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the BLACKLIST\_ROLE. * **stakeAll()** : Sends the total supply of **USUALS** to the staking contract. Only callable by the `USUALSP` contract. * **isBlacklisted()**: Returns true if the account is blacklisted. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: Registry access contract address. * **DEFAULT\_ADMIN\_ROLE**: Default admin role. * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract. * **BLACKLIST\_ROLE**: Role required to blacklist an address. * **USUALS\_BURN**: Role required to burn tokens. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#safeguards-implementation) Safeguards Implementation * **Pausability**: Ensures that token transfers can be halted in case of emergency. * **Role-Based Access Control**: Restricts sensitive actions to addresses with appropriate roles. * **Blacklist Enforcement**: Ensures that unauthorized addresses can't participate in the token economy. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-1#undefined) [PreviousUSUALchevron-left](https://tech.usual.money/smart-contracts/token-contracts/usual) [NextUSUALxchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usualx) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usual-1#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usual-1#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usual-1#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/usual-1#functions-description) * [Constants](https://tech.usual.money/smart-contracts/token-contracts/usual-1#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/token-contracts/usual-1#safeguards-implementation) * [](https://tech.usual.money/smart-contracts/token-contracts/usual-1#undefined) Was this helpful? --- # Glossary | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fo0bT0nAfIcvw4uzFkPcs%252FPage%2520Cover%252017.png%3Falt%3Dmedia%26token%3D123818d4-c372-4e9f-b5b0-142b05681852&width=1248&dpr=3&quality=100&sign=28a3af66&sv=2) circle-info The glossary is a living artifact that will be incrementally & continuously updated. * **USD0 (Usual USD):** The primary stablecoin of Usual, a liquid and transferable ERC-20 token that can be staked or locked to receive rewards. It is backed by cash equivalents like tokenized money market funds. * **bUSD0 (Bond USD0):** A token representing USD0 deposited in a onchain bond, maturing over a defined period, during which $USUAL can be claimed. * **USYC (US Yield Coin):** USYC is the on-chain representation of the Hashnote International Short Duration Yield Fund Ltd. ("SDYF"). SDYF invests primarily in reverse repo and U.S. Government backed securities. * **ERC-20 Token:** A popular token standard on the Ethereum blockchain, enabling the creation of fungible tokens. * **Staking:** The process of locking cryptocurrencies in a blockchain network to support operations, in return for rewards. * **Reverse Repo:** A repurchase agreement wherein securities are sold with an agreement to repurchase them at a higher price in the future. * **Money Market Fund:** A fund that invests in short-term, high-quality debt securities, providing liquidity and safety. [PreviousFAQchevron-left](https://tech.usual.money/support/faq) [NextTerms of Serviceschevron-right](https://tech.usual.money/legal/terms-of-services) Last updated 4 months ago Was this helpful? Was this helpful? --- # USUAL* | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usual-1#overview) Overview ------------------------------------------------------------------------------------ USUAL\* is a specialized token designed for early investors, contributors, and advisors of the Usual protocol, granting them unique benefits and governance power. It inherits basic functionalities from the USUAL token. Holders of USUAL\* are entitled to 10% of all USUAL distributions, a right that is permanently integrated into the protocol and cannot be overridden. Initially, USUAL\* holders maintain majority voting control to ensure the project adheres to its roadmap during the early stages of development. Over time, the governance structure will evolve toward a more decentralized model centered on USUAL token holders, but without compromising the immutable rights of USUAL\* holders. chevron-right**USUAL\* issuance**[hashtag](https://tech.usual.money/overview/features/usual-1#usual-issuance) Investor, contributors and insider will receive USUAL\* at TGE as a staked, cliffed and vested allocation that receives 10% of the daily USUAL distribution. In order to claim USUAL\* a user will have to unstake the vested allocation, thereby minting the token. [hashtag](https://tech.usual.money/overview/features/usual-1#smart-contract) Smart Contract ------------------------------------------------------------------------------------------------ [USUAL\*chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-1) [PreviousUSUALchevron-left](https://tech.usual.money/overview/features/usual) [NextUSUALx (USUAL staking)chevron-right](https://tech.usual.money/overview/features/usualx-usual-staking) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usual-1#overview) * [Smart Contract](https://tech.usual.money/overview/features/usual-1#smart-contract) Was this helpful? --- # EUR0 | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#high-level-overview) High-Level Overview The EUR0 contract is designed to manage the EUR0 ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blacklist checks to restrict these operations to authorized addresses. The total EUR0 supply is collateralized with at minimum 1:1 in Euro-denominated collateral tokens, ensuring the stability and security of the protocol. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#contract-summary) Contract Summary EUR0 is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability. It inherits functionalities from `ERC20PausableUpgradeable` and `ERC20PermitUpgradeable` to support permit-based approvals and pausability. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#minting-eur0) Minting EUR0 Users can swap their Euro collateral tokens via the DaoCollateral contract to mint an equivalent amount of EUR0. The minting process is subject to several checks: * The amount must not exceed the current collateral backing * The total supply after minting must not exceed the total collateral backing * The caller must have the `EUR0_MINT` role #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#redeeming-eur0) Redeeming EUR0 Users can swap any EUR0 back to the underlying Euro collateral tokens at any time via the DaoCollateral contract, burning the EUR0 in the process. The redemption process includes a configurable fee to prevent oracle manipulation attacks. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#regulatory-compliance) Regulatory Compliance The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract, and the list is kept up to date. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#collateralization-enforcement) Collateralization Enforcement Minting of EUR0 is only possible if the total collateral backing equals or exceeds the EUR0 `totalSupply()`. The contract verifies this by: * Checking the balance of all Euro collateral tokens in the treasury * Converting collateral amounts to EUR using oracle prices * Ensuring the total collateral value in EUR exceeds the new total supply ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#key-functionalities) Key Functionalities * **Minting**: Tokens can be minted to an address, subject to role checks and collateralization requirements. * **Burning**: Tokens can be burned from an address, subject to role checks. * **Transfers**: Only non-blacklisted addresses can send or receive tokens. * **Blacklist Management**: The contract implements a blacklist system for regulatory compliance. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#public-external-functions) Public/External Functions * `**pause()**`: Pauses all token transfer operations; callable only by the `PAUSING_CONTRACTS_ROLE`. * `**unpause()**`: Resumes all token transfer operations; callable only by the `UNPAUSING_CONTRACTS_ROLE`. * `**mint(address to, uint256 amount)**`: Mints tokens to a non-blacklisted address if the caller has the `EUR0_MINT` role and collateralization requirements are met. * `**burn(uint256 amount)**` and `**burnFrom(address account, uint256 amount)**`: Burns tokens from an address, requiring the `EUR0_BURN` role. * `**blacklist(address account)**` and `**unBlacklist(address account)**`: Allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the `BLACKLIST_ROLE`. * `**isBlacklisted(address account)**`: Checks if an address is blacklisted. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#role-based-access-control) Role-Based Access Control The contract implements several roles for different operations: * `**EUR0_MINT**`: Required for minting new tokens * `**EUR0_BURN**`: Required for burning tokens * `**BLACKLIST_ROLE**`: Required for managing the blacklist * `**PAUSING_CONTRACTS_ROLE**`: Required for pausing the contract * `**UNPAUSING_CONTRACTS_ROLE**`: Required for unpausing the contract ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of all token transfers in emergencies * **Blacklist**: Prevents sanctioned addresses from interacting with the token * **Collateralization Check**: Ensures EUR0 remains fully backed by Euro collateral * **Role-Based Access**: Restricts sensitive operations to authorized roles ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#security-features) Security Features #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#blacklist-mechanism) Blacklist Mechanism The contract implements a comprehensive blacklist system that prevents blacklisted addresses from: * Sending tokens (from address is blacklisted) * Receiving tokens (to address is blacklisted) * Any transfer operations involving blacklisted addresses #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#collateralization-verification) Collateralization Verification The minting process includes real-time collateralization verification: * Fetches all supported Euro collateral tokens from the token mapping * Calculates the total value of collateral in EUR using oracle prices * Ensures the new total supply does not exceed the collateral backing * Prevents over-minting that would compromise the 1:1 collateralization ratio #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eur0#access-control) Access Control All critical functions are protected by role-based access control: * Only authorized roles can mint, burn, pause, or manage blacklists * Prevents unauthorized manipulation of token supply * Ensures regulatory compliance through controlled blacklist management [PreviousETH0chevron-left](https://tech.usual.money/smart-contracts/token-contracts/eth0) [NextUSUALchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual) Last updated 7 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/eur0#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/eur0#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/eur0#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/eur0#functions-description) * [Role-Based Access Control](https://tech.usual.money/smart-contracts/token-contracts/eur0#role-based-access-control) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/token-contracts/eur0#safeguards-implementation) * [Security Features](https://tech.usual.money/smart-contracts/token-contracts/eur0#security-features) Was this helpful? --- # USD0 | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------- The USD0 contract is designed to manage Usuals Stablecoin, the USD0 ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blacklist checks to restrict these operations to authorized addresses. The total USD0 supply is collateralized with at minimum 1:1 in USD Real World Assets ( read more [herearrow-up-right](https://gitbook.usual.money/usual-mechanisms/liquid-deposit-token-ldt/usd0-rwa-stablecoin/why-usd0) ) [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#contract-summary) Contract Summary --------------------------------------------------------------------------------------------------------------- USD0 is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability. It inherits functionalities from ERC20PausableUpgradable and ERC20PermitUpgradeable to support permit-based approvals and pausability. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#minting-usd0) Minting USD0 Users can swap their Real World Assets via the [USD0 DaoCollateral](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) to mint an equivalent USD amount of USD0. Alternatively, they can deposit USDC into the [USD0 Swapper Engine](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) for a RWA Provider to exchange their RWA to USD0. Additionally, as part of the accumulating yield of our underlying Real World Assets, the Usual DAO can mint additional USD0 for any excess collateral above 100% + 21 days of yield. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#redeeming-usd0) Redeeming USD0 Users can swap any USD0 back to the underlying Real World Assets at any time via the [USD0 DaoCollateral](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) contract, burning the USD0 in the process. In order to prevent sandwich oracle attacks on yield, the Usual DAO Treasury charges a redemption fee of`0.10%` ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#regulatory-compliance) Regulatory Compliance The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract, and kept up to date. Usual is enforcing the OFAC Sanctions List: [https://sanctionslist.ofac.treas.gov/Home/SdnListarrow-up-right](https://sanctionslist.ofac.treas.gov/Home/SdnList) As well as the FAFT: [https://www.fatf-gafi.org/en/home.htmlarrow-up-right](https://www.fatf-gafi.org/en/home.html) ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#collateralization-enforcement) Collateralization Enforcement Minting of USD0 is only possible if the Usual DAO Treasury equals or exceeds the USD Backing Ratio of 1:1 in Real World Assets versus the USD0 totalSupply() [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#key-functionalities) Key Functionalities * **Minting**: Tokens can be minted to an address, subject to role checks. * **Burning**: Tokens can be burned from an address, also subject to role checks. * **Transfers**: Only not blacklisted addresses can send or receive tokens. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#public-external-functions) Public/External Functions * **pause()**: Pauses all token transfer operations; callable only by the `PAUSING_CONTRACTS_ROLE`. * **unpause()**: Resumes all token transfer operations; also callable only by the `DEFAULT_ADMIN_ROLE`. * **transfer(address to, uint256 amount)**: Transfers tokens to a non-blacklisted address. * **transferFrom(address sender, address to, uint256 amount)**: Transfers tokens from one non-blacklisted address to another. * **mint(address to, uint256 amount)**: Mints tokens to a non-blacklisted address if the caller has the `USD0_MINT` role. * **burn(uint256 amount)** and **burnFrom(address account, uint256 amount)**: Burns tokens from an address, requiring the `USD0_BURN` role. * **blacklist(address account)** and **unBlacklist(address account)**: Those functions allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the BLACKLIST\_ROLE. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0#undefined) [PreviousToken Contractschevron-left](https://tech.usual.money/smart-contracts/token-contracts) [NextbUSD0 (formerly USD0++)chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usd0++) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usd0#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usd0#contract-summary) * [Minting USD0](https://tech.usual.money/smart-contracts/token-contracts/usd0#minting-usd0) * [Redeeming USD0](https://tech.usual.money/smart-contracts/token-contracts/usd0#redeeming-usd0) * [Regulatory Compliance](https://tech.usual.money/smart-contracts/token-contracts/usd0#regulatory-compliance) * [Collateralization Enforcement](https://tech.usual.money/smart-contracts/token-contracts/usd0#collateralization-enforcement) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usd0#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/usd0#functions-description) * [](https://tech.usual.money/smart-contracts/token-contracts/usd0#undefined) Was this helpful? --- # EUR0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle) **What is the EUR0 ClassicalOracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle) **What is the CircleEURCOracle?** ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FIFdCYG28aoGBD0DVGhsG%252Fimage%2520%282%29.png%3Falt%3Dmedia%26token%3D930cf71d-6ff3-4abf-a864-a30587d71517&width=752&dpr=3&quality=100&sign=fb80dcec&sv=2) **What is the Monerium Swapper Helper?** [PreviousLido wstETH Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle) [NextEUR0 Classical Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle) Last updated 1 month ago Was this helpful? Was this helpful? --- # ETH0 | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/eth0#overview) Overview --------------------------------------------------------------------------------- **ETH0** is a synthetic Ethereum-based asset issued by the Usual Protocol and **fully collateralized by Lido’s wrapped staked ETH (wstETH)**. It’s designed for institutions, whales, and sophisticated DeFi users who want to maintain ETH exposure while significantly boosting yield. Unlike traditional staked ETH (which earns ~3.5% APY), ETH0 holders don’t receive yield directly. Instead, they earn USUAL tokens, which capture protocol revenues and speculative upside, potentially pushing **effective returns to double digits** (e.g. 13% APY according to simulations). **ETH0** allows users to: * Retain full ETH exposure (1:1 peg to ETH) * Earn yield through USUAL distributions * Redeem their position anytime for wstETH * Use ETH0 composably across DeFi platforms like Pendle or Morpho Built on the same infrastructure as Usual’s USD0 stablecoin (backed by tokenized T-bills), ETH0 brings a **DeFi-native yield abstraction model** to ETH-based portfolios. All minting and redemption are atomic, on-chain, and secured by a rigorously audited, upgradeable contract system with oracle-based price validation. chevron-right**How to mint ETH0**[hashtag](https://tech.usual.money/overview/features/eth0#how-to-mint-eth0) 1. User holds wstETH (wrapped stETH from Lido). 2. They visit the Usual dApp and navigate to the ETH0 Vault interface. 3. The user deposits wstETH via the smart contract. 4. The protocol validates collateral via oracles and mints ETH0 tokens at a 1:1 ETH value. 5. ETH0 is sent to the user’s wallet. Minting is atomic, permissionless, and immediate. chevron-rightHow to redeem ETH0[hashtag](https://tech.usual.money/overview/features/eth0#how-to-redeem-eth0) 1. User holds ETH0 and wants to convert back to wstETH. 2. They initiate a redemption via the Usual dApp. 3. The ETH0 tokens are burned, and the contract releases the underlying wstETH. 4. A small redemption fee (e.g., 3-5 bps) may apply. 5. The wstETH is transferred to the user’s wallet, completing the redemption. chevron-right**How earn yield in USUAL for holding ETH0**[hashtag](https://tech.usual.money/overview/features/eth0#how-earn-yield-in-usual-for-holding-eth0) 1. By simply holding ETH0 in their wallet, users start accumulating protocol-based rewards. 2. The staking yield from the underlying wstETH is redirected to the Usual treasury. 3. That value is redistributed via USUAL token emissions, which are claimable by ETH0 holders (e.g. via a claim UI or distribution mechanism). 4. The USUAL token provides speculative upside and participation in protocol revenue—potentially boosting effective APY well beyond wstETH’s base yield. 5. Users may choose to hold, sell, or stake USUAL to amplify returns further (e.g., in USUALx programs). [hashtag](https://tech.usual.money/overview/features/eth0#smart-contracts) Smart Contracts ----------------------------------------------------------------------------------------------- [ETH0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/eth0) [PreviousEUR0chevron-left](https://tech.usual.money/overview/features/eur0) [NextUSUALchevron-right](https://tech.usual.money/overview/features/usual) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/eth0#overview) * [Smart Contracts](https://tech.usual.money/overview/features/eth0#smart-contracts) Was this helpful? --- # References | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fu6mKzSyTEySrNxp4qoqg%252FPage%2520Cover%252015.png%3Falt%3Dmedia%26token%3D36cec58c-b576-4a51-a209-d735cd36f82f&width=1248&dpr=3&quality=100&sign=c325ecd0&sv=2) [hashtag](https://tech.usual.money/resources/references#curated-by-usual) Curated by Usual ----------------------------------------------------------------------------------------------- [**dApp**arrow-up-right](https://app.usual.money/) [**Usual Website**arrow-up-right](https://usual.money/) [**Usual Docs**arrow-up-right](https://docs.usual.money/) [**Usual Blog**arrow-up-right](https://blog.usual.money/) [**Jobs at Usual**arrow-up-right](https://breezy.usual.money/) [hashtag](https://tech.usual.money/resources/references#curated-by-3rd-parties) Curated by 3rd Parties ----------------------------------------------------------------------------------------------------------- [**Coingecko**arrow-up-right](https://cgusd0.usual.money/) [**Coinmarketcap**arrow-up-right](https://cmcusd0.usual.money/) [**Defillama**arrow-up-right](https://dlusd0.usual.money/) [**Dune** arrow-up-right](https://dune.com/usual_team/usual) [**RWA.xyz**arrow-up-right](https://rwa.usual.money/) [**Token Terminal**arrow-up-right](https://tokenterminal.com/explorer/projects/usual) [PreviousCommunity & Supportchevron-left](https://tech.usual.money/resources/community-and-support) [NextFAQchevron-right](https://tech.usual.money/support/faq) Last updated 10 months ago Was this helpful? * [Curated by Usual](https://tech.usual.money/resources/references#curated-by-usual) * [Curated by 3rd Parties](https://tech.usual.money/resources/references#curated-by-3rd-parties) Was this helpful? --- # USD0 | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usd0#overview) Overview --------------------------------------------------------------------------------- USD0 is a USD-pegged stablecoin designed for secure and seamless use across the DeFi ecosystem. It is fully backed by US Treasury Bill tokens, offering enhanced security without reliance on traditional banks. The coin is permissionless and easily integrable, with real-time reserve transparency provided by fund administrators. USD0 consolidates liquidity from diverse sources and utilizes an innovative mint engine for efficient collateralization, ensuring peg stability and compliance with US and EU regulations, making it a reliable alternative to USDC and USDT. ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F7Qtqp8f0yaIfZGANl6nK%252Fimage.png%3Falt%3Dmedia%26token%3D41db1d44-91da-49fe-a561-ab1d780d25aa&width=768&dpr=3&quality=100&sign=c2afaf0c&sv=2) USD0 Overview chevron-right**How to Mint USD0**[hashtag](https://tech.usual.money/overview/features/usd0#how-to-mint-usd0) USD0 tokens can be minted through Usual's counter in two ways: 1. **Direct Mint:** By depositing an eligible RWA into the protocol to receive an equivalent amount of USD0 on a 1:1 basis. 2. **Indirect Mint**: By depositing USDC into the protocol to receive USD0 on a 1:1 basis. In this method, a third party known as the Collateral Provider (CP) supplies the necessary RWA collateral, enabling users to obtain USD0 without directly holding RWAs. chevron-right**How to Redeem USD0**[hashtag](https://tech.usual.money/overview/features/usd0#how-to-redeem-usd0) USD0 tokens can be redeemed in two ways: 1. **Withdrawal of Underlying Assets**: Users can withdraw the Real World Asset (RWA) underlying the USD0 token directly with the Usual dApp 2. **Secondary Market Transactions**: Users can sell USD0 for USDC/T on the secondary market. As USD0 is fully redeemable within Usual's dApp, the 1:1 peg is expected to be maintained through arbitrage, similar to other fiat backed stablecoins. [hashtag](https://tech.usual.money/overview/features/usd0#smart-contract) Smart Contract --------------------------------------------------------------------------------------------- [USD0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usd0) [PreviousFeatureschevron-left](https://tech.usual.money/overview/features) [NextbUSD0 (formerly USD0++)chevron-right](https://tech.usual.money/overview/features/usd0++) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usd0#overview) * [Smart Contract](https://tech.usual.money/overview/features/usd0#smart-contract) Was this helpful? --- # USUALx (USUAL staking) | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usualx-usual-staking#overview) Overview ------------------------------------------------------------------------------------------------- The UsualX staking feature is a robust, upgradeable ERC4626-compliant vault designed for secure yield generation. It offers functionalities like whitelist and blacklist management, withdrawal fees, and yield distribution over specific periods. chevron-right**Receive USUAL staking yield**[hashtag](https://tech.usual.money/overview/features/usualx-usual-staking#receive-usual-staking-yield) 1. **Deposit:** USUAL owner can deposit their tokens into USUALx vault and will receive a vaultshare token (call USUALx) that represents their share a will be used to calculate the amount of USUAL token rewards a user eligible for. 2. **Redeem:** User can claim the yield by exchanging vaultshare tokens for the USUAL rewards within the vault against a fee that is set by the DAO. Partial redemptions are possible. [hashtag](https://tech.usual.money/overview/features/usualx-usual-staking#smart-contracts) Smart Contracts --------------------------------------------------------------------------------------------------------------- [USUALxchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usualx) [USUAL stakingchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking) [PreviousUSUAL\*chevron-left](https://tech.usual.money/overview/features/usual-1) [NextUSUAL distributionchevron-right](https://tech.usual.money/overview/features/usual-distribution) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usualx-usual-staking#overview) * [Smart Contracts](https://tech.usual.money/overview/features/usualx-usual-staking#smart-contracts) Was this helpful? --- # wstETH by Lido | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido#who-is-lido) Who is Lido? ---------------------------------------------------------------------------------------------------------------- Lido is a leading liquid staking protocol built on the Ethereum blockchain, offering a secure and accessible way for users to stake their ETH while maintaining liquidity. As one of the largest staking providers in the Ethereum ecosystem, Lido enables users to earn staking rewards without the technical complexity or minimum requirements of running their own validator. Find out more about [Lidoarrow-up-right](https://help.lido.fi/en/articles/5230607-what-is-lido) . [hashtag](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido#what-is-wsteth) What is wstETH? ---------------------------------------------------------------------------------------------------------------------- `wstETH` (Wrapped Staked ETH) is Lido's wrapped version of `stETH` (Staked ETH), designed to provide enhanced composability and integration capabilities within the DeFi ecosystem. When users stake their ETH through Lido, they receive `stETH`, which represents their staked ETH position. `wstETH` is then created by wrapping `stETH`, making it compatible with ERC-20 standards and easier to integrate with various DeFi protocols. This makes `wstETH` an ideal collateral asset for protocols like `ETH0`, as it combines the security of staked ETH with the flexibility of a wrapped token. More on [wstETHarrow-up-right](https://help.lido.fi/en/articles/5231836-what-is-lido-s-wsteth) . [PreviousETH0 Collateralchevron-left](https://tech.usual.money/smart-contracts/eth0-collateral) [NextEUR0 Collateralchevron-right](https://tech.usual.money/smart-contracts/eur0-collateral) Last updated 10 months ago Was this helpful? * [Who is Lido?](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido#who-is-lido) * [What is wstETH?](https://tech.usual.money/smart-contracts/eth0-collateral/wsteth-by-lido#what-is-wsteth) Was this helpful? --- # Reward redistribution by integration partner | Usual Tech Docs [hashtag](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner#overview) Overview ------------------------------------------------------------------------------------------------------------------------------------ In this case, the integration partners need to have a function in their smart contract to claim and mint the USUAL. Subsequently, it is the responsibility of the integration partners to redistribute the USUAL to their users according to the conditions described in their product offering. As mentioned previously, by default, the Usual reward system assigns the holder's address as the recipient of these rewards. This means that for integration partners who integrate bUSD0 in their LP or vault offering, which is not "fully integrated" into the reward system, the USUAL accumulates daily on the contract address of the respective LP or vault. circle-info This approach is only considered as "Partially integrated", i.e. overall rewards are claimed by integrator and subsequently distributed to endusers. No native claim experience via Usual's [Earn pagearrow-up-right](https://app.usual.money/earn) . circle-exclamation If the USUAL rewards are redistributed by integration partners, it is the SOLE RESPONSIBILITY of the respective bUSD0 integrator to reward its user. That means as an enduser, please reach out to the respective integrator in case of any reward disputes or challenges. [PreviousIntegrate bUSD0chevron-left](https://tech.usual.money/integrations/integrate-busd0) [NextClaim Address Redirectchevron-right](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) Last updated 4 months ago Was this helpful? Was this helpful? --- # USUAL | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#high-level-overview) High-Level Overview This section provides an overview of the USUAL smart contract. The USUAL contract is designed to manage the USUAL ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blacklist checks to restrict these operations from sanctioned addresses. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#contract-summary) Contract Summary USUAL is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability. It inherits functionalities from ERC20PausableUpgradable and ERC20PermitUpgradeable to support permit-based approvals and pausability. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#inherited-contracts) Inherited Contracts * **ERC20PausableUpgradeable**: Extends ERC20 to support pausability * **ERC20PermitUpgradeable**: Extends ERC20 to support gasless transactions through signed approvals. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#erc20pausableupgradeable) ERC20PausableUpgradeable Standard OpenZeppelin Implementation. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#erc20permitupgradeable) ERC20PermitUpgradeable Standard OpenZeppelin Implementation. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#public-external-functions) Public/External Functions * **pause()**: Pauses all token transfer operations; callable only by the PAUSING\_CONTRACTS\_ROLE. * **unpause()**: Resumes all token transfer operations; also callable only by the DEFAULT\_ADMIN\_ROLE. * **transfer(address to, uint256 amount)**: Transfers tokens to a non-sanctioned address. * **transferFrom(address sender, address to, uint256 amount)**: Transfers tokens from one non-sanctioned address to another. * **mint(address to, uint256 amount)**: Mints tokens to a non-sanctioned address if the caller has the USUAL\_MINT role. * **burn(uint256 amount)** and **burnFrom(address account, uint256 amount)**: Burns tokens from an address, requiring the USUAL\_BURN role. * **blacklist(address account)** and **unBlacklist(address account)**: Those functions allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the BLACKLIST\_ROLE. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#sc-flows) SC-Flows ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FAPCwusbRxQ8ul6CPGQSj%252FSans%2520titre.svg%3Falt%3Dmedia%26token%3D5a262505-df51-4262-b298-31879ca8e4a6&width=768&dpr=3&quality=100&sign=ae33432d&sv=2) #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#key-functionalities) Key Functionalities * **Minting**: Tokens can be minted to an address, subject to role checks. * **Burning**: Tokens can be burned from an address, also subject to role checks. * **Transfers**: Only not sanctioned addresses can send or receive tokens. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: This constant is used to define the address of the registry access contract * **DEFAULT\_ADMIN\_ROLE**: This constant is used to define the default admin role for the contract. * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract. * **BLACKLIST\_ROLE**: Role required to blacklist an address. * **USUAL\_MINT**: Role required to mint new tokens. * **USUAL\_BURN**: Role required to burn tokens. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual#safeguards-implementation) Safeguards Implementation * **Pausability**: Ensures that token transfers can be halted in case of emergency. * **Role-Based Access Control**: Restricts sensitive actions to addresses with appropriate roles. * **Blacklist Enforcement**: Ensures that only non-malicious addresses can participate in the token economy. [PreviousEUR0chevron-left](https://tech.usual.money/smart-contracts/token-contracts/eur0) [NextUSUAL\*chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-1) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usual#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usual#contract-summary) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/usual#functions-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usual#functionality-breakdown) * [Constants](https://tech.usual.money/smart-contracts/token-contracts/usual#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/token-contracts/usual#safeguards-implementation) Was this helpful? --- # Audits | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FmF8JSiL0urbqzshufXY1%252FPage%2520Cover%252013.png%3Falt%3Dmedia%26token%3Dede37aaf-2ac3-467c-a1d7-e110395418a1&width=1248&dpr=3&quality=100&sign=e5ad9044&sv=2) [hashtag](https://tech.usual.money/security-and-audits/audits#security-is-our-top-priority) **Security is Our Top Priority** --------------------------------------------------------------------------------------------------------------------------------- Smart contract risk is highly prevalent among DeFi protocols. One of Usual’s top priorities is to mitigate and reduce the potential risk from the underlying Usual smart contracts by conducting in-depth audits aimed at identifying potential vulnerabilities, logical errors, or inefficiencies and further by conducting continuous security monitoring of the smart contracts. The audits are conducted by leading industry experts and will be used to enhance trust through proper risk and security management on the smart contracts. Please find below the chronological overview of our completed audits. [hashtag](https://tech.usual.money/security-and-audits/audits#may-2024) **May 2024** ----------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditor) **Auditor** [Cantinaarrow-up-right](https://cantina.xyz/welcome) * Lead Security Researcher: xmxanuel * Security Researcher: deadroses * Associate Security Researcher: jonatas ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope) **Scope** * Codebase Simplification: Replacing the "mint engine" with the "swap engine" * Cantina Managed Audit Phase 1: Permissioned launch smart contracts audit * Cantina Managed Audit Phase 2: Permissionless launch smart contracts audit file-download 545KB [Pegasus permissioned launch - Security Review by Cantina.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F663ZJyiBoOzbNZ4SyAbr%2FPegasus%20permissioned%20launch%20-%20Security%20Review%20by%20Cantina.pdf?alt=media&token=f89c418c-2b67-4b8a-ad9a-2616ea149f96) downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F663ZJyiBoOzbNZ4SyAbr%2FPegasus%20permissioned%20launch%20-%20Security%20Review%20by%20Cantina.pdf?alt=media&token=f89c418c-2b67-4b8a-ad9a-2616ea149f96) Spearbit Cantina Report for Permissionless launch file-download 527KB [Usual Pegasus - Security Review by Cantina.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKVqreB0coxbKmJoOxJhc%2FUsual%20Pegasus%20-%20Security%20Review%20by%20Cantina.pdf?alt=media&token=94aee9af-0170-412e-a807-113a725d88ac) downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKVqreB0coxbKmJoOxJhc%2FUsual%20Pegasus%20-%20Security%20Review%20by%20Cantina.pdf?alt=media&token=94aee9af-0170-412e-a807-113a725d88ac) Spearbit Cantina Report for Permissionless launch [hashtag](https://tech.usual.money/security-and-audits/audits#june-2024) **June 2024** ------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditor-1) **Auditor** [Cantinaarrow-up-right](https://cantina.xyz/welcome) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-1) **Scope** * Public security competition managed by Cantina on the same scope that audited in May 2024 * Link: [Public Competition & Bug Bounty Programarrow-up-right](https://cantina.xyz/competitions/31a752e3-8ece-49b3-a9ee-d7294c659340) file-download 502KB [Pegasus Competition by Cantina.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKv2d0EXVP8O4pSxlmYyL%2FPegasus%20Competition%20by%20Cantina.pdf?alt=media&token=fcecb067-d8c9-4562-bb92-0aad5d0c0e41) downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKv2d0EXVP8O4pSxlmYyL%2FPegasus%20Competition%20by%20Cantina.pdf?alt=media&token=fcecb067-d8c9-4562-bb92-0aad5d0c0e41) Pegasus Audit Competition run by Cantina [hashtag](https://tech.usual.money/security-and-audits/audits#october-2024) October 2024 --------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditor-2) Auditor [Paladinarrow-up-right](https://paladinsec.co/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-2) Scope * L2 Token contracts * OFT MintAndBurnAdapter * L1 OFT Adapter * Link: [L2 Tokens & Adapter Auditarrow-up-right](https://paladinsec.co/projects/usual/) file-pdf 641KB [L2 Tokens Audit by Paladin.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fd1bkFNZnti2CS90W7kGI%2FL2%20Tokens%20Audit%20by%20Paladin.pdf?alt=media&token=3c49c747-544d-42d4-8604-32baf3070da3) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fd1bkFNZnti2CS90W7kGI%2FL2%20Tokens%20Audit%20by%20Paladin.pdf?alt=media&token=3c49c747-544d-42d4-8604-32baf3070da3) L2 Token Audit conducted by Paladin [hashtag](https://tech.usual.money/security-and-audits/audits#november-2024) November 2024 ----------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors) Auditors [Cantinaarrow-up-right](https://cantina.xyz/welcome) * Lead Security Researcher: deadroses * Lead Security Researcher: xmxanuel * Security Researcher: Phaze * Associate Security Researcher: Chinmay Farkya [Halbornarrow-up-right](https://www.halborn.com/) [Sherlockarrow-up-right](https://www.sherlock.xyz/) (public audit competition) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-3) Scope V1 contract upgrades & additions covering: * bUSD0 (formerly USD0++) * DAO Collateral * SwapperEngine * USUAL * USUALS * USUALSP * USUAL distribution * USUAL Airdrop * USUALx file-pdf 548KB [Spearbit Cantina Report for Usual Pegasus Phase 1.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FBtEA47JlsWFteDb5GpwE%2FSpearbit%20Cantina%20Report%20for%20Usual%20Pegasus%20Phase%201.pdf?alt=media&token=5ee61161-fd50-4935-96ed-1de73275f856) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FBtEA47JlsWFteDb5GpwE%2FSpearbit%20Cantina%20Report%20for%20Usual%20Pegasus%20Phase%201.pdf?alt=media&token=5ee61161-fd50-4935-96ed-1de73275f856) Spearbit Cantina Report for Usual Pegasus Phase 1 file-pdf 638KB [Spearbit Cantina Report for Usual Pegasus Phase 2.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FcXuPxTTIHMM2KNopvVFh%2FSpearbit%20Cantina%20Report%20for%20Usual%20Pegasus%20Phase%202.pdf?alt=media&token=9c3c2758-af60-4b81-b843-01ed0874bef0) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FcXuPxTTIHMM2KNopvVFh%2FSpearbit%20Cantina%20Report%20for%20Usual%20Pegasus%20Phase%202.pdf?alt=media&token=9c3c2758-af60-4b81-b843-01ed0874bef0) file-pdf 2MB [Halborn Usual V1 Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKzNfBOtCOLamJuh8pQWF%2FHalborn%20Usual%20V1%20Audit.pdf?alt=media&token=9c068fc5-bce9-477f-962b-a927f4e1cc79) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FKzNfBOtCOLamJuh8pQWF%2FHalborn%20Usual%20V1%20Audit.pdf?alt=media&token=9c068fc5-bce9-477f-962b-a927f4e1cc79) Halborn Usual V1 file-pdf 948KB [Sherlock - Usual V1 Audit Competition Report.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FnJ3MWYlnSYTkLuUFqXz5%2FSherlock%20-%20Usual%20V1%20Audit%20Competition%20Report.pdf?alt=media&token=866b2e6c-ff4b-4fa4-9e38-c6cd761dcfa2) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FnJ3MWYlnSYTkLuUFqXz5%2FSherlock%20-%20Usual%20V1%20Audit%20Competition%20Report.pdf?alt=media&token=866b2e6c-ff4b-4fa4-9e38-c6cd761dcfa2) Sherlock - Usual V1 Audit Competition Report.pdf [hashtag](https://tech.usual.money/security-and-audits/audits#december-2024) December 2024 ----------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-1) Auditors Blackthorne [Cantinaarrow-up-right](https://cantina.xyz/welcome) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-4) Scope * WrappedM aka UsualM * bUSD0 (formerly USD0++) unwrap with Cap for vault strategies * USUALx file-pdf 665KB [Blackthorn Audit Report - WrappedM.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW7YOK5z76EilIY39jmxE%2FBlackthorn%20Audit%20Report%20-%20WrappedM.pdf?alt=media&token=995576ee-e809-4ed0-b77a-638d47947874) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW7YOK5z76EilIY39jmxE%2FBlackthorn%20Audit%20Report%20-%20WrappedM.pdf?alt=media&token=995576ee-e809-4ed0-b77a-638d47947874) Blackthorn Audit Report - WrappedM file-pdf 501KB [Spearbit Cantina Report for UsualM extension.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FH3vfJZvsgb1QSMC9cML0%2FSpearbit%20Cantina%20Report%20for%20UsualM%20extension.pdf?alt=media&token=b4a6ced0-0458-4403-a3dc-b3418865b453) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FH3vfJZvsgb1QSMC9cML0%2FSpearbit%20Cantina%20Report%20for%20UsualM%20extension.pdf?alt=media&token=b4a6ced0-0458-4403-a3dc-b3418865b453) Spearbit Cantina Report for UsualM extension file-pdf 562KB [Spearbit Cantina Report for USD0pp adjustments .pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FJd3MEliEfOdTpLn8Lj1c%2FSpearbit%20Cantina%20Report%20for%20USD0pp%20adjustments%20.pdf?alt=media&token=17983c8d-8443-436c-b4da-94bdcab5237d) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FJd3MEliEfOdTpLn8Lj1c%2FSpearbit%20Cantina%20Report%20for%20USD0pp%20adjustments%20.pdf?alt=media&token=17983c8d-8443-436c-b4da-94bdcab5237d) Spearbit Cantina Report for USD0pp adjustments [hashtag](https://tech.usual.money/security-and-audits/audits#january-2025) January 2025 --------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-2) Auditors [Spearbitarrow-up-right](https://cantina.xyz/portfolio/51ba92e3-1c77-4e55-be3f-b43b529fd38b) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-5) Scope * Claim Redirect * Fee sweep via DistributionModule * USUALx adjustment for fee sweep * bUSD0 (formerly USD0++) adjustment for fee sweep file-pdf 570KB [Spearbit - Audit Report on Redirect & Fee Sweep.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FHtgp95SukDIpq9RSnnt8%2FSpearbit%20-%20Audit%20Report%20on%20Redirect%20%26%20Fee%20Sweep.pdf?alt=media&token=34031538-4cf0-4361-bc5a-72d3c8245126) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FHtgp95SukDIpq9RSnnt8%2FSpearbit%20-%20Audit%20Report%20on%20Redirect%20%26%20Fee%20Sweep.pdf?alt=media&token=34031538-4cf0-4361-bc5a-72d3c8245126) Spearbit - Audit Report on Redirect & Fee Sweep [hashtag](https://tech.usual.money/security-and-audits/audits#february-2025) February 2025 ----------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-3) Auditors [Sherlockarrow-up-right](https://www.sherlock.xyz/) [Spearbitarrow-up-right](https://spearbit.com/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-6) Scope * Euler USL vault and oracle * Usual USL Economic Risk Assessment * UsualUSDtb * Yield Module file-pdf 942KB [Sherlock - Audit Report on Euler.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FtkQNpfVUW8AybJWRoURx%2FSherlock%20-%20Audit%20Report%20on%20Euler.pdf?alt=media&token=5c927319-294d-4250-a950-e0d92ec580ba) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FtkQNpfVUW8AybJWRoURx%2FSherlock%20-%20Audit%20Report%20on%20Euler.pdf?alt=media&token=5c927319-294d-4250-a950-e0d92ec580ba) Sherlock - Audit Report on USL on Euler file-pdf 566KB [Spearbit - Audit Report on USL on Euler.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FM9fwC3lrmoXsV51iAmhX%2FSpearbit%20-%20Audit%20Report%20on%20USL%20on%20Euler.pdf?alt=media&token=c119331a-f652-4d13-ac9a-648efcb79eda) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FM9fwC3lrmoXsV51iAmhX%2FSpearbit%20-%20Audit%20Report%20on%20USL%20on%20Euler.pdf?alt=media&token=c119331a-f652-4d13-ac9a-648efcb79eda) Spearbit - Audit Report on USL on Euler file-pdf 1MB [OAK Security - Usual USL Economic Risk Assessment.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FJJRRRX0G6wz1CGyDWHI4%2FOAK%20Security%20-%20Usual%20USL%20Economic%20Risk%20Assessment.pdf?alt=media&token=db96beb4-a834-424f-b62c-e7280f00b620) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FJJRRRX0G6wz1CGyDWHI4%2FOAK%20Security%20-%20Usual%20USL%20Economic%20Risk%20Assessment.pdf?alt=media&token=db96beb4-a834-424f-b62c-e7280f00b620) OAK Security - Usual USL Economic Risk Assessment file-pdf 901KB [Sherlock - Audit Report on UsualUSDtB.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLbD0S1mgQJcVQmpwKPoD%2FSherlock%20-%20Audit%20Report%20on%20UsualUSDtB.pdf?alt=media&token=08c4ca09-3d7b-40a5-b808-b6fe7855f2b5) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLbD0S1mgQJcVQmpwKPoD%2FSherlock%20-%20Audit%20Report%20on%20UsualUSDtB.pdf?alt=media&token=08c4ca09-3d7b-40a5-b808-b6fe7855f2b5) Sherlock - Audit Report on UsualUSDtb file-pdf 612KB [Spearbit - Audit Report on Yield Module.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW15r2CMqY4ND4OELp9y6%2FSpearbit%20-%20Audit%20Report%20on%20Yield%20Module.pdf?alt=media&token=e4952c97-ed67-42ce-bd78-36986eaf72f7) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW15r2CMqY4ND4OELp9y6%2FSpearbit%20-%20Audit%20Report%20on%20Yield%20Module.pdf?alt=media&token=e4952c97-ed67-42ce-bd78-36986eaf72f7) Spearbit - Audit Report on Yield Module For more detailed information on our security measures or to report a potential vulnerability, please contact our security team at [\[email protected\]envelope](https://tech.usual.money/cdn-cgi/l/email-protection#c8bbadabbdbaa1bcb188bdbbbda9a4e6aba7a5b8a9a6b1) . [hashtag](https://tech.usual.money/security-and-audits/audits#march-2025) March 2025 ----------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-4) Auditors [Sherlockarrow-up-right](https://www.sherlock.xyz/) [Spearbitarrow-up-right](https://spearbit.com/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-7) Scope * Usual bUSD0 (formerly USD0++) Investment Vault * Coherent Audit competition on overall protocol file-pdf 581KB [Spearbit - Usual USD0++ Investment Vault.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FPpuD1K1dwd2rI5YbqRWP%2FSpearbit%20-%20Usual%20USD0%2B%2B%20Investment%20Vault.pdf?alt=media&token=0a981ceb-e3f2-4214-b421-9a7b59480e14) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FPpuD1K1dwd2rI5YbqRWP%2FSpearbit%20-%20Usual%20USD0%2B%2B%20Investment%20Vault.pdf?alt=media&token=0a981ceb-e3f2-4214-b421-9a7b59480e14) Spearbit - Usual bUSD0 (formerly USD0++) Investment Vault file-pdf 877KB [Sherlock - Usual Labs Public Audit Contest.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FuIIECu9Z1z2RSIcirRxf%2FSherlock%20-%20Usual%20Labs%20Public%20Audit%20Contest.pdf?alt=media&token=42987c9b-b669-4f35-9dfc-9b5c91bff12a) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FuIIECu9Z1z2RSIcirRxf%2FSherlock%20-%20Usual%20Labs%20Public%20Audit%20Contest.pdf?alt=media&token=42987c9b-b669-4f35-9dfc-9b5c91bff12a) Sherlock - Usual Labs Public Audit Contest file-pdf 6MB [Halborn - USD0++ Investment vault.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLQrZex8aJ7jDq4mYpjqU%2FHalborn%20-%20USD0%2B%2B%20Investment%20vault.pdf?alt=media&token=72430ff1-4dd0-44b3-ba9a-65f2ab214504) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLQrZex8aJ7jDq4mYpjqU%2FHalborn%20-%20USD0%2B%2B%20Investment%20vault.pdf?alt=media&token=72430ff1-4dd0-44b3-ba9a-65f2ab214504) Halborn - bUSD0 (formerly USD0++) Investment vault [hashtag](https://tech.usual.money/security-and-audits/audits#may-2025) May 2025 ------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-5) Auditors [Hexensarrow-up-right](https://hexens.io/) [Halbornarrow-up-right](https://www.halborn.com/audits) [Sherlockarrow-up-right](https://www.sherlock.xyz/) [Spearbitarrow-up-right](https://spearbit.com/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-8) Scope * ETH0 Protocol * ETH0 Zapper Contract * USUALX Lockup Contract file-pdf 572KB [Spearbit - Audit report on ETH0.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FX5OW30LK9N0f5UHww6lN%2FSpearbit%20-%20Audit%20report%20on%20ETH0.pdf?alt=media&token=df844f0b-1fff-4340-aef8-806fd4609425) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FX5OW30LK9N0f5UHww6lN%2FSpearbit%20-%20Audit%20report%20on%20ETH0.pdf?alt=media&token=df844f0b-1fff-4340-aef8-806fd4609425) file-pdf 918KB [Sherlock - Audit report on on ETH0 Zapper contract.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FIZ2LqzJHKiWarrkwFRji%2FSherlock%20-%20Audit%20report%20on%20on%20ETH0%20Zapper%20contract.pdf?alt=media&token=356ac968-732b-4bed-bc9e-1de0e59a6d9b) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FIZ2LqzJHKiWarrkwFRji%2FSherlock%20-%20Audit%20report%20on%20on%20ETH0%20Zapper%20contract.pdf?alt=media&token=356ac968-732b-4bed-bc9e-1de0e59a6d9b) Sherlock - Audit report on ETH0 Zapper contract file-pdf 3MB [Hexens - Audit report on UsualXLockup.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F34RgOSQLMEzmUOxpSh2N%2FHexens%20-%20Audit%20report%20on%20UsualXLockup.pdf?alt=media&token=752294fa-d850-49a9-b9eb-31c637a4a537) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F34RgOSQLMEzmUOxpSh2N%2FHexens%20-%20Audit%20report%20on%20UsualXLockup.pdf?alt=media&token=752294fa-d850-49a9-b9eb-31c637a4a537) Hexens - Audit report on UsualX Lockup Contract file-pdf 10MB [Halborn - Audit report on UsualXLockup.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FRRE8HgRDg1V2qCIVA604%2FHalborn%20-%20Audit%20report%20on%20UsualXLockup.pdf?alt=media&token=e3aa1973-8966-4409-b690-99a455eea620) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FRRE8HgRDg1V2qCIVA604%2FHalborn%20-%20Audit%20report%20on%20UsualXLockup.pdf?alt=media&token=e3aa1973-8966-4409-b690-99a455eea620) Halborn - Audit report on UsualX Lockup Contract [hashtag](https://tech.usual.money/security-and-audits/audits#july-2025) July 2025 --------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-6) Auditors [Sherlockarrow-up-right](https://www.sherlock.xyz/) [Spearbitarrow-up-right](https://spearbit.com/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-9) Scope * bUSD0 (formerly USD0++) Upgrade (Updating Burn Redemption Mechanism) * Sync Vault remediation * Usual USDC file-pdf 877KB [Sherlock- Audit report on USD0++ upgrade (Burn Redemption Mechanism).pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F8gq6et5OGqJHJGphqav6%2FSherlock-%20Audit%20report%20on%20USD0%2B%2B%20upgrade%20(Burn%20Redemption%20Mechanism).pdf?alt=media&token=27674355-9c34-496e-970d-723f522221fa) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F8gq6et5OGqJHJGphqav6%2FSherlock-%20Audit%20report%20on%20USD0%2B%2B%20upgrade%20(Burn%20Redemption%20Mechanism).pdf?alt=media&token=27674355-9c34-496e-970d-723f522221fa) Sherlock - Audit report on bUSD0 (formerly USD0++) upgrade (Burn Redemption Mechanism) file-pdf 594KB [Spearbit - Audit report on Sync Vault remediation.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FzSchlFhZb6F4gUpuYu3E%2FSpearbit%20-%20Audit%20report%20on%20Sync%20Vault%20remediation.pdf?alt=media&token=1a069c46-4387-40ee-bc35-b4869a4702fc) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FzSchlFhZb6F4gUpuYu3E%2FSpearbit%20-%20Audit%20report%20on%20Sync%20Vault%20remediation.pdf?alt=media&token=1a069c46-4387-40ee-bc35-b4869a4702fc) file-pdf 497KB [Spearbit - Audit report on Usual USDC.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fok3wIxqFWGKqBnRQw1Dw%2FSpearbit%20-%20Audit%20report%20on%20Usual%20USDC.pdf?alt=media&token=98892efa-f5af-47b5-93e9-aaddb2d93749) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fok3wIxqFWGKqBnRQw1Dw%2FSpearbit%20-%20Audit%20report%20on%20Usual%20USDC.pdf?alt=media&token=98892efa-f5af-47b5-93e9-aaddb2d93749) [hashtag](https://tech.usual.money/security-and-audits/audits#october-2025) October 2025 --------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-7) Auditors [Sherlockarrow-up-right](https://www.sherlock.xyz/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-10) Scope * EUR0 file-pdf 1017KB [Sherlock - EUR0 Protocol Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fi8N4N5nDayNTlZsshidU%2FSherlock%20-%20EUR0%20Protocol%20Audit.pdf?alt=media&token=9e0852df-a5c9-48f7-8a95-118e1166bb59) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2Fi8N4N5nDayNTlZsshidU%2FSherlock%20-%20EUR0%20Protocol%20Audit.pdf?alt=media&token=9e0852df-a5c9-48f7-8a95-118e1166bb59) [hashtag](https://tech.usual.money/security-and-audits/audits#november-2025) November 2025 ----------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/security-and-audits/audits#auditors-8) Auditors [Hexensarrow-up-right](https://hexens.io/) [Halbornarrow-up-right](https://www.halborn.com/audits) [Sherlockarrow-up-right](https://www.sherlock.xyz/) ### [hashtag](https://tech.usual.money/security-and-audits/audits#scope-11) Scope * sUSD0 * sEUR0 * RDM (Revenue Distribution Module) * USD0a Protocol * bUSD0 (formerly USD0++) Upgrade file-pdf 3MB [Hexens - sUSD0 Protocol Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW8L1sNcxO9fA7jVvCtUZ%2FHexens%20-%20sUSD0%20Protocol%20Audit.pdf?alt=media&token=c1e65ec3-cdf5-4396-93ff-396c8a5a71ba) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FW8L1sNcxO9fA7jVvCtUZ%2FHexens%20-%20sUSD0%20Protocol%20Audit.pdf?alt=media&token=c1e65ec3-cdf5-4396-93ff-396c8a5a71ba) file-pdf 10MB [Halborn - sUSD0-SEUR0-RDM Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F0ng3wp3joaciGht2vx48%2FHalborn%20-%20sUSD0-SEUR0-RDM%20Audit.pdf?alt=media&token=950a9779-c8c5-4d39-86d6-6a65778dd8a0) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2F0ng3wp3joaciGht2vx48%2FHalborn%20-%20sUSD0-SEUR0-RDM%20Audit.pdf?alt=media&token=950a9779-c8c5-4d39-86d6-6a65778dd8a0) file-pdf 4MB [Hexens - USD0a Protocol Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FADNHL3PqW4HMQ3m5Vweo%2FHexens%20-%20USD0a%20Protocol%20Audit.pdf?alt=media&token=3a34f6d7-d907-4541-89ce-93cbfa6970a1) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FADNHL3PqW4HMQ3m5Vweo%2FHexens%20-%20USD0a%20Protocol%20Audit.pdf?alt=media&token=3a34f6d7-d907-4541-89ce-93cbfa6970a1) file-pdf 1MB [Sherlock - USD0a Protocol Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLcHMqp6aagbzqsfUXR33%2FSherlock%20-%20USD0a%20Protocol%20Audit.pdf?alt=media&token=1f32edd9-4701-4ffe-81a1-6e1b3fe63ee3) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FLcHMqp6aagbzqsfUXR33%2FSherlock%20-%20USD0a%20Protocol%20Audit.pdf?alt=media&token=1f32edd9-4701-4ffe-81a1-6e1b3fe63ee3) file-pdf 912KB [Sherlock - bUSD0 Upgrade Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FroXirXvK4iNSufm3lrik%2FSherlock%20-%20bUSD0%20Upgrade%20Audit.pdf?alt=media&token=73e9a975-7b99-45f2-a2c4-b2afc6a88e15) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FroXirXvK4iNSufm3lrik%2FSherlock%20-%20bUSD0%20Upgrade%20Audit.pdf?alt=media&token=73e9a975-7b99-45f2-a2c4-b2afc6a88e15) file-pdf 4MB [Hexens - bUSD0 Upgrade Audit.pdf](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FG7sBFMaZHmGWhkg8WPtt%2FHexens%20-%20bUSD0%20Upgrade%20Audit.pdf?alt=media&token=775baffe-4fc5-46c2-8a18-4401a9080815) PDF downloadDownload[arrow-up-right-from-squareOpen](https://1503334455-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpUhQzPJGdJzuLTQ5sCym%2Fuploads%2FG7sBFMaZHmGWhkg8WPtt%2FHexens%20-%20bUSD0%20Upgrade%20Audit.pdf?alt=media&token=775baffe-4fc5-46c2-8a18-4401a9080815) [PreviousMonitoring Frameworkchevron-left](https://tech.usual.money/security-and-audits/monitoring-framework) [NextBug Bountychevron-right](https://tech.usual.money/security-and-audits/bug-bounty) Last updated 4 months ago Was this helpful? * [Security is Our Top Priority](https://tech.usual.money/security-and-audits/audits#security-is-our-top-priority) * [May 2024](https://tech.usual.money/security-and-audits/audits#may-2024) * [Auditor](https://tech.usual.money/security-and-audits/audits#auditor) * [Scope](https://tech.usual.money/security-and-audits/audits#scope) * [June 2024](https://tech.usual.money/security-and-audits/audits#june-2024) * [Auditor](https://tech.usual.money/security-and-audits/audits#auditor-1) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-1) * [October 2024](https://tech.usual.money/security-and-audits/audits#october-2024) * [Auditor](https://tech.usual.money/security-and-audits/audits#auditor-2) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-2) * [November 2024](https://tech.usual.money/security-and-audits/audits#november-2024) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-3) * [December 2024](https://tech.usual.money/security-and-audits/audits#december-2024) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-1) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-4) * [January 2025](https://tech.usual.money/security-and-audits/audits#january-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-2) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-5) * [February 2025](https://tech.usual.money/security-and-audits/audits#february-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-3) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-6) * [March 2025](https://tech.usual.money/security-and-audits/audits#march-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-4) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-7) * [May 2025](https://tech.usual.money/security-and-audits/audits#may-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-5) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-8) * [July 2025](https://tech.usual.money/security-and-audits/audits#july-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-6) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-9) * [October 2025](https://tech.usual.money/security-and-audits/audits#october-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-7) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-10) * [November 2025](https://tech.usual.money/security-and-audits/audits#november-2025) * [Auditors](https://tech.usual.money/security-and-audits/audits#auditors-8) * [Scope](https://tech.usual.money/security-and-audits/audits#scope-11) Was this helpful? --- # bUSD0 (formerly USD0++) | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usd0++#overview) Overview ----------------------------------------------------------------------------------- bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. It remains transferable during this period, earning USUAL incentives and maturity yield. Users receive 1 USD0 for 1 bUSD0 at maturity. For early redemption, users need an equivalent amount of rt-USD0 - received at mint - which unlocks bUSD0 back into USD0 at a 1:1 rate anytime. Additionally, early redemption below peg can be made at a DAO set price floor. chevron-right**bUSD0 Issuance**[hashtag](https://tech.usual.money/overview/features/usd0++#busd0-issuance) A holder of USD0 can deposit their USD0 into bUSD0 at any time: 1. **Depositing USD0**: The user deposits their USD0 to convert them into bUSD0. 2. **1:1 Issuance**: bUSD0 are issued on a 1:1 basis with the deposited USD0. Along side with bUSD0 users also receive redemption token (rt-bUSD0) that allows them to leave bUSD0 at any time before the maturity date. 3. **Bond Duration**: bUSD0 has a maturity date (11 June, 2028) with guaranteed 1:1 redemption — or at any time by burning the redemption token. chevron-right**bUSD0 Redemption**[hashtag](https://tech.usual.money/overview/features/usd0++#busd0-redemption) Users can exit their position in the following ways: **1) Redeem 1:1 back into USD0 using rt-bUSD0.** Provide an equivalent amount of rt-bUSD0 (the redemption-right token received at mint) to unlock bUSD0 at full value. Any missing rt-bUSD0 can be purchased on the secondary market. **2) Sell bUSD0 on the secondary market.** Because bUSD0 remains fully transferable, users can exit instantly at the market price whenever you choose. **3) Redeem at the DAO-defined floor price.** If bUSD0 trades below its projected remaining maturity value, users can redeem at a protocol-set floor price that reflects the remaining risk-free yield of USD0, ensuring a minimum guaranteed exit. **4) Wait until maturity.** At maturity, bUSD0 unlocks automatically and can be redeemed 1:1 back into USD0 without requiring rt-bUSD0. [bUSD0 (formerly USD0++)chevron-right](https://tech.usual.money/smart-contracts/token-contracts/usd0++) [PreviousUSD0chevron-left](https://tech.usual.money/overview/features/usd0) [NextUSD0achevron-right](https://tech.usual.money/overview/features/usd0a) Last updated 4 months ago Was this helpful? Was this helpful? --- # USTB by Superstate | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate#who-is-superstate) Who is Superstate? --------------------------------------------------------------------------------------------------------------------------------- Superstate is an asset-management firm building regulated, tokenized investment products on blockchain. Its mission is to bridge traditional financial markets with crypto-native infrastructure, allowing investors to hold real-world assets directly on-chain. Find out more about [Superstatearrow-up-right](https://superstate.com/) . [hashtag](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate#what-is-ustb) What is USTB? ----------------------------------------------------------------------------------------------------------------------- USTB is a tokenized fund backed primarily by short-duration U.S. Treasury bills. The fund holds high-quality government debt and cash, providing a conservative yield-bearing option for on-chain investors. Unlike synthetic or derivative-based products, USTB represents shares in a fully backed, regulated investment fund. By offering on-chain access to T-bills, USTB gives users a transparent and lower-risk way to hold dollar-based assets while earning short-term Treasury yields. More on [USTBarrow-up-right](https://superstate.com/assets/ustb) . [PreviousUSD0a Collateralchevron-left](https://tech.usual.money/smart-contracts/usd0a-collateral) [NextUSCC by Superstatechevron-right](https://tech.usual.money/smart-contracts/usd0a-collateral/uscc-by-superstate) Last updated 5 months ago Was this helpful? * [Who is Superstate?](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate#who-is-superstate) * [What is USTB?](https://tech.usual.money/smart-contracts/usd0a-collateral/ustb-by-superstate#what-is-ustb) Was this helpful? --- # Bug Bounty | Usual Tech Docs [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#why-bug-bounty) **Why Bug Bounty?** ---------------------------------------------------------------------------------------------------------- This program aims to strengthen the security of our protocol by encouraging ethical hackers to report potential security flaws of varying degrees of impact. By leveraging the expertise of security researchers, we can proactively identify and address vulnerabilities before they can be exploited. The safety of our users and the integrity of the Usual Protocol are our top priorities, and we know that an incentivized security program is crucial to maintaining a robust and resilient ecosystem. [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#bug-bounty-program-description) **Bug Bounty Program Description** ----------------------------------------------------------------------------------------------------------------------------------------- The program follows a **severity matrix** to classify findings and determine rewards based on potential impact. Critical vulnerabilities affecting our **Total Value Locked (TVL)** are the highest priority, while lower-severity issues are assessed accordingly. #### [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#scope-of-the-bug-bounty) **Scope of the Bug Bounty** The **Core Stablecoin Protocol** is the primary focus of this bug bounty, as it directly affects the security of our TVL. The following contracts (and their imports) are in scope: * **Chains in scope** Ethereum Mainnet only. (Smart contracts on any other networks or testnets are out-of-scope.) * **Core Stablecoin Protocol** * [USD0arrow-up-right](https://etherscan.io/token/0x73a15fed60bf67631dc6cd7bc5b6e8da8190acf5) * [USD0PParrow-up-right](https://etherscan.io/token/0x35D8949372D46B7a3D5A56006AE77B215fc69bC0) * [DaoCollateralarrow-up-right](https://etherscan.io/token/0xde6e1F680C4816446C8D515989E2358636A38b04) * [RegistryAccessarrow-up-right](https://etherscan.io/address/0x0D374775E962c3608B8F0A4b8B10567DF739bb56) * [RegistryContractarrow-up-right](https://etherscan.io/address/0x0594cb5ca47eFE1Ff25C7B8B43E221683B4Db34c) * [ClassicalOraclearrow-up-right](https://etherscan.io/address/0xb97e163cE6A8296F36112b042891CFe1E23C35BF) * [SwapperEnginearrow-up-right](https://etherscan.io/address/0xB969B0d14F7682bAF37ba7c364b351B830a812B2) * [TokenMappingarrow-up-right](https://etherscan.io/address/0x43882C864a406D55411b8C166bCA604709fDF624) These contracts handle stablecoin issuance, structured financial product management, swaps between **Real-World Assets (RWAs)** and stablecoins, and asset pricing. Their security is mission-critical. Additional areas covered by the bug bounty include: * **RWA Token Wrapper Contracts and Euler** * [UsualMarrow-up-right](https://etherscan.io/token/0x4Cbc25559DbBD1272EC5B64c7b5F48a2405e6470) * [UsualUSDtbarrow-up-right](https://etherscan.io/address/0x58073531a2809744d1bf311d30fd76b27d662abb) * [EulerOraclearrow-up-right](https://etherscan.io/address/0xe1DeE60c516a8350704Ec24a6E856c9F533d1c1b) These ERC-20 wrapper contracts enhance security for RWAs like wrappedM by M0 or USDtB by Ethena. Exploits here could impact a limited portion of TVL based on mint caps. For any USL Euler-Vault-related code, we refer to the [Cantina Bug Bounty.arrow-up-right](https://cantina.xyz/bounties/4d285eee-602e-440a-845e-25e155cec26a) * **Usual Token & Distribution Module** * [Usualarrow-up-right](https://etherscan.io/address/0xC4441c2BE5d8fA8126822B9929CA0b81Ea0DE38E) * [Usual\*arrow-up-right](https://etherscan.io/address/0x094B360AE512A65584d4f5Be33D68B2E08677b89) * [UsualXarrow-up-right](https://etherscan.io/address/0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E) * [DistributionModulearrow-up-right](https://etherscan.io/address/0x75cC0C0DDD2Ccafe6EC415bE686267588011E36A) * [YieldModulearrow-up-right](https://etherscan.io/address/0x647F8987C288bf6D2fDb332918E1E14424839EDA#readProxyContract) The Usual Protocol’s token distribution system, tied to RWA yield, is also included, though it is a lower priority than the stablecoin core. #### [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#out-of-scope) **Out of Scope** The following vulnerabilities and attack vectors are **out of scope** and will not be rewarded: * Any code or contracts **not deployed on Ethereum mainnet** (e.g. development branches, testnet or staging deployments) * Any **known issues** already identified in prior audits or otherwise documented by Usual Labs * Front-end websites or web applications (UI/UX) – (Issues here may be eligible for **discretionary** rewards at the team's discretion, but are not part of the core smart contract bounty scope) * Integrations with external protocols (e.g. Curve pools or any third-party platform integrations) * Oracle contracts or RWA token contracts **maintained by third parties** (bugs in external dependency contracts are out-of-scope) * Risks related to RWA Tokenizer contracts (including external oracles). * Issues that require **privileged access** (admin/governance only actions or intended permissioned functions) * Pure gas optimization improvements with no security impact * Theoretical attacks requiring impractical **brute-force** methods or only resulting in minor rounding/precision errors * Economic or market-manipulation attacks that are not symmetric or require extreme market turmoil conditions. * Incorrect data or pricing information supplied by third-party oracles. * Vulnerabilities related to malicious bridge implementations (e.g., LayerZero or Chainlink CCIP). * Issues related to the SwapperEngine when the underlying asset isn't USDC or when Circle itself is compromised. * Issues solely related to missing or incorrect NatSpec comments, outdated documentation, or comment hygiene #### [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#judging) **Judging** Sherlock’s security team will triage all submissions and determine severity based on impact. **Usual Labs will not be judging** submissions in this program. Sherlock will decide whether a reported issue is valid and what severity/reward applies, in accordance with the criteria below. #### [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#severity-definitions) Severity Definitions **Severity** **Scope** **Potential Impact** **Critical** Core contracts only Theft or **irreversible loss** of **5%–100%** of TVL **High** Entire protocol Significant loss of funds (**1%–5%** of TVL) or equivalent impact **Medium** Individual users Loss or permanent lock of funds for **individual users** (not systemic) [hashtag](https://tech.usual.money/security-and-audits/bug-bounty#bug-bounty-links) **Bug Bounty Links** ------------------------------------------------------------------------------------------------------------- To take part in the program and find out more, visit the Sherlock website by following this [LINKarrow-up-right](https://audits.sherlock.xyz/bug-bounties) . [PreviousAuditschevron-left](https://tech.usual.money/security-and-audits/audits) [NextIntegrate bUSD0chevron-right](https://tech.usual.money/integrations/integrate-busd0) Last updated 1 year ago Was this helpful? * [Why Bug Bounty?](https://tech.usual.money/security-and-audits/bug-bounty#why-bug-bounty) * [Bug Bounty Program Description](https://tech.usual.money/security-and-audits/bug-bounty#bug-bounty-program-description) * [Bug Bounty Links](https://tech.usual.money/security-and-audits/bug-bounty#bug-bounty-links) Was this helpful? --- # EUR0 SwapperEngine | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#high-level-overview) High-Level Overview The SwapperEngine contract is a smart contract designed to facilitate the swapping of EURC tokens for EUR0 tokens using an order matching mechanism. The contract allows users to create orders specifying the amount of EURC they wish to swap, and other users can fill these orders by providing EUR0 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. It is important to note that the contract's mechanism can be utilized to facilitate a vampire attack, RWA → EUR0 → EURC → $$$ → RWA → to churn EURC into EUR0 by transparently staking treasury bonds to mint EUR0 swapping that EUR0 for EURC and cycling back into RWA ready to mint more EUR0 limited only by EURC order book depth. **Flow EURC Depositors:** * Users deposit EURC tokens to create orders * Orders wait for matching with EUR0 providers * When matched, users receive EUR0 tokens **Flow RWA Provider:** * RWA providers mint EUR0 through collateralization * They can swap EUR0 for EURC through the SwapperEngine * This creates a cycle: RWA → EUR0 → EURC → Cash → RWA ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#contract-summary) Contract Summary The contract provides the following main functions: * **depositEURC** and **depositEURCOnBehalf**: Allows users to create a new order by depositing EURC and also to set a specific receiver with **depositEURCOnBehalf**. * **withdrawEURC**: Allows users to cancel an order and withdraw their deposited EURC. * **provideEur0ReceiveEURC**: Allows users to fill orders by providing EUR0 and receiving EURC in return. The contract also includes utility functions such as `getOrder`, `getEur0WadEquivalent`, and `getEurcWadPrice` to retrieve order details and perform price calculations. The swapperEngine has no option to define a maxEURCPrice for buyers and seller's don't have the option to define a minimumEURCPrice, instead the prices are provided by an EURC oracle, which also has measures against a potential EURC depeg. EUR0's price is considered to be €1 == 1EUR0 due to the numerous mechanisms in place to prevent a depeg, like reserves, CBR mechanism, arbitrage etc. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#inherited-contracts) Inherited Contracts * **Initializable (OZ)**: Used to provide a safe and controlled way to initialize the contract's state variables. It ensures that the contract's initializer function can only be called once, preventing accidental or malicious reinitialization. * **ReentrancyGuardUpgradeable (OZ)**: Used to protect against reentrancy attacks. It provides a modifier that can be applied to functions to prevent them from being called recursively or from other functions that are also protected by the same guard. * **PausableUpgradeable (OZ)**: Allows contract functionality to be paused by authorized accounts (PAUSING\_CONTRACTS\_ROLE to pause the contract and DEFAULT\_ADMIN\_ROLE to un-pause). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#functionality-breakdown) Functionality Breakdown The SwapperEngine contract's primary purpose is to facilitate the swapping of EURC tokens for EUR0 tokens using an order matching mechanism. The contract's functionality can be broken down into the following key components: #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#order-creation) Order Creation: Users can create new orders by calling the `depositEURC` function and specifying the amount of EURC they wish to swap and the receiver of the converted amount. The contract transfers the specified amount of EURC tokens from the user to itself and creates a new order with the deposited amount, the user's address as the requester and a receiver. The order is assigned a unique order ID and stored in the contract's orders mapping. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#order-cancellation) Order Cancellation: Users who have created an order can cancel it by calling the `withdrawEURC` function and specifying the order ID. The contract verifies that the caller is the requester of the order and that the order is active. If the conditions are met, the contract deactivates the order, sets its token amount to zero, and transfers the deposited EURC tokens back to the requester. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#order-matching) Order Matching: Users can fill existing orders by specifying the recipient address, the amount of EURC to take (or the amount of EUR0 to give), an array of order IDs to match against, and whether partial matching is allowed. The contract verifies that the caller has sufficient EUR0 balance and allowance to cover the required amount based on the current EURC Price Calculation obtained from the oracle. The contract iterates through the provided order IDs and attempts to match the requested EURC amount against active orders. If partial matching is allowed and there is not enough EURC in the orders to fulfil the entire request, the contract will partially fill orders until the requested amount is met or all orders are exhausted. For each matched order, the contract transfers the corresponding EUR0 tokens from the caller to the order requester and transfers the EURC tokens from itself to the specified recipient. If partial matching is not allowed and the requested EURC amount cannot be fully matched, the contract reverts the transaction. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#price-calculation) Price Calculation: The contract relies on an external oracle contract to obtain the current price of EURC tokens in WAD format (18 decimals). The `_getEurcWadPrice` function is used to retrieve the current EURC price from the oracle. The `_getEur0WadEquivalent` function is used to calculate the equivalent amount of EUR0 tokens for a given amount of EURC tokens based on the current price. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#method-_provideeur0receiveeurc) Method: `_provideEur0ReceiveEURC` This method allows users to provide EUR0 tokens and receive EURC tokens by matching against existing orders. It matches the requested EURC amount to the provided EUR0 tokens against the specified orders, transfers the corresponding EURC tokens to the recipient, and updates the order states accordingly. The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * Validates that the amount of EURC to take is greater than zero. * Validates that at least one order ID is provided for matching. * Retrieves the contract's storage using the correct storage pattern. * Retrieves the current price of EURC in WAD format (18 decimals) from an oracle, ensuring that the price used for calculations is up-to-date and accurate. * Initializes the total amount of EURC taken to zero. * Retrieves the order details for the current order ID. * Checks if the order is active before processing. * If the order is active, calculates the amount of EURC to take from the current order based on the remaining amount to take and the order's available balance. * Updates the order's token amount and the total EURC taken. * Marks the order as inactive if its token amount reaches zero. * Calculates the equivalent EUR0 amount for the EURC taken from the order using the `_getEur0WadEquivalent` function and the current EURC price. * Updates the total EUR0 provided with the calculated amount. * Transfers the EUR0 tokens from the sender to the order requester. * Transfers the EURC tokens from the contract to the recipient. * Emits an OrderMatched event with the relevant details. * Increments the loop counter using an unchecked block for gas optimization. * Reverts the transaction if partial matching is not allowed and the total EURC taken does not match the requested amount or if no EURC was taken. * Returns the remaining amount of EURC that was not taken and the total EUR0 provided. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#method-_geteur0wadequivalent) Method: `_getEur0WadEquivalent` This method calculates the EUR0 equivalent amount in WAD format (18 decimals) for a given EURC token amount. It converts the EURC token amount from its native decimal representation (6 decimals) to WAD format and then calculates the equivalent EUR0 amount based on the provided EURC price in WAD format. * Retrieves the contract's storage using the correct storage pattern. * Retrieves the decimal places of the EURC token using the `decimals()` function from the IERC20Metadata interface. * Converts the `eurcTokenAmountInNativeDecimals` to WAD format (18 decimals) using the `tokenAmountToWad` function, which takes into account the token's native decimals. * Calculates the equivalent amount of EUR0 tokens in WAD format by multiplying the `eurcWad` amount with the `eurcWadPrice` using the `wadAmountByPrice` function. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#method-depositeurc) Method: `depositEURC` This method allows users to deposit EURC tokens and create a new order. It transfers the specified amount of EURC tokens from the caller to the contract and creates a new order with the deposited amount and the caller as the requester. The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * Retrieves the contract's storage using the correct storage pattern. * Validates that the amount of EURC to deposit is greater than or equal to the minimum required amount specified in the contract's storage. This prevents any attempts to deposit amounts below the minimum threshold. * Sets the value of `orderId` to the current value of `$.nextOrderId` then increments by 1. Since it is initialized as 1, the first `orderId` will be one and so on. * Creates a new `EurcOrder` struct in storage using the order ID as key. The struct is set up correctly to contain: the requester's address (`msg.sender`), the deposited token amount (`amountToDeposit`), and sets the active flag to true. * Transfers the specified amount of EURC tokens from the caller (`msg.sender`) to the contract (`address(this)`) using the `safeTransferFrom` function to ensure that the transfer is successful and the contract receives the deposited tokens. If the transfer fails, the function will revert. * Emits a Deposit event, providing the order ID and the deposited amount for the subgraph. The `**depositEURCOnBehalf**` method do the same but with a specific recipient that can be specified by the caller. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#method-withdraweurc) Method: `withdrawEURC` This method allows the requester of an order to withdraw their deposited EURC tokens and cancel the order. It deactivates the specified order, sets its token amount to zero, and transfers the deposited EURC tokens back to the requester. The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * Retrieves the contract's storage using the correct storage pattern. * Retrieves the `EurcOrder` struct as storage so it will be modified. * Checks if the order is active using the active flag. If the order is not active or does not exist, the function will revert with an appropriate error message. This prevents any attempts to withdraw from invalid or canceled orders. * Verifies that the caller (`msg.sender`) is the requester of the order. This ensures that only the original requester can cancel their own order and withdraw the deposited tokens. * Retrieves the token amount associated with the order and assigns it to the `amountToWithdraw` variable. * Sets the active flag of the order to false in storage. * Sets the `tokenAmount` of the order to zero in storage. * Transfers the `amountToWithdraw` of EURC tokens from the contract back to the requester (`msg.sender`) using the `safeTransfer` function. This ensures that the transfer is successful and the requester receives their tokens. If the transfer fails, the function will revert. * Emits a Withdraw event, providing the `orderToCancel` ID and the `amountToWithdraw` for the subgraph. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#method-swapeur0) Method: `swapEur0` This method allows users to provide EUR0 tokens and receive EURC tokens by matching against existing orders. It matches the specified amount of EUR0 tokens against the specified orders, transfers the corresponding EURC tokens to the recipient, and updates the order states accordingly. The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * Retrieves the current EURC price in WAD format using the `_getEurcWadPrice()` function. * Calculates the equivalent amount of EURC to take in native decimals based on the provided `amountEur0ToProvideInWad` and the current `eurcWadPrice` using the `_getEurcAmountFromEur0WadEquivalent` function. Then calls the `_provideEur0ReceiveEURC` function to perform the actual swap, passing the recipient, `amountEurcToTakeInNativeDecimals`, `orderIdsToTake`, `partialMatchingAllowed`, and `eurcWadPrice` parameters. The function returns the total amount of EUR0 provided. * Returns the sum of unmatched EUR0 in wad format including dust, representing the total amount of EUR0 that was not matched or was left as dust. [PreviousEUR0 DaoCollateralchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral) [NextEUR0 Revenue Distribution Modulechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module) Last updated 6 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine#security-analysis) Was this helpful? Copy function _provideEur0ReceiveEURC( ... ) internal returns (uint256 unmatchedEurcAmount, uint256 totalEur0Provided) { if (amountEurcToTakeInNativeDecimals == 0) { revert AmountIsZero() } if (orderIdsToTake.length == 0) { revert NoOrdersIdsProvided() } SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); uint256 eurcWadPrice = _getEurcWadPrice(); uint256 totalEurcTaken = 0; Copy for (uint256 i; i < orderIdsToTake.length && totalEurcTaken < amountEurcToTakeInNativeDecimals;) { uint256 orderId = orderIdsToTake[i]; EurcOrder storage order = $.orders[orderId]; if (order.active) { uint256 remainingAmountToTake = amountEurcToTakeInNativeDecimals - totalEurcTaken; uint256 amountOfEurcFromOrder = order.tokenAmount > remainingAmountToTake ? remainingAmountToTake : order.tokenAmount; order.tokenAmount -= amountOfEurcFromOrder; totalEurcTaken += amountOfEurcFromOrder; if (order.tokenAmount == 0) { order.active = false }; uint256 eur0Amount = _getEur0WadEquivalent(amountOfEurcFromOrder, eurcWadPrice); totalEur0Provided += eur0Amount; $.eur0.safeTransferFrom(msg.sender, order.requester, eur0Amount); $.eurcToken.safeTransfer(recipient, amountOfEurcFromOrder); emit OrderMatched(order.requester, msg.sender, orderId, amountOfEurcFromOrder); } unchecked { ++i } } if (!partialMatchingAllowed && totalEurcTaken != amountEurcToTakeInNativeDecimals || totalEurcTaken == 0) { revert AmountTooLow() } return ((amountEurcToTakeInNativeDecimals - totalEurcTaken), totalEur0Provided); Copy function _getEur0WadEquivalent(uint256 eurcTokenAmountInNativeDecimals, uint256 eurcWadPrice) private view returns (uint256 eur0WadEquivalent) { SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); uint8 decimals = IERC20Metadata(address($.eurcToken)).decimals(); uint256 eurcWad = eurcTokenAmountInNativeDecimals.tokenAmountToWad(decimals); eur0WadEquivalent = eurcWad.wadAmountByPrice(eurcWadPrice); } Copy function depositEURC(uint256 amountToDeposit) external nonReentrant whenNotPaused { SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); _depositEURC($, amountToDeposit, msg.sender, msg.sender); } Copy function withdrawEURC(uint256 orderToCancel) external nonReentrant whenNotPaused { SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); EurcOrder storage order = $.orders[orderToCancel]; if (!order.active) { revert OrderNotActive() } if (order.requester != msg.sender) { revert NotRequester() } uint256 amountToWithdraw = order.tokenAmount; order.active = false; order.tokenAmount = 0; $.eurcToken.safeTransfer(msg.sender, amountToWithdraw); emit Withdraw(msg.sender, orderToCancel, amountToWithdraw); } Copy function swapEur0(address recipient, uint256 amountEur0ToProvideInWad, uint256[] memory orderIdsToTake, bool partialMatchingAllowed) external nonReentrant whenNotPaused returns (uint256) { uint256 eurcWadPrice = _getEurcWadPrice(); (, uint256 totalEur0Provided) = _provideEur0ReceiveEURC( recipient, _getEurcAmountFromEur0WadEquivalent(amountEur0ToProvideInWad, eurcWadPrice), orderIdsToTake, partialMatchingAllowed, eurcWadPrice ); return amountEur0ToProvideInWad - totalEur0Provided; } --- # EUTBL by Spiko | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko#who-is-spiko) Who is Spiko? Spiko is a financial technology company that specializes in tokenizing traditional financial instruments, particularly European Treasury Bills. They provide access to institutional-grade money market funds through blockchain technology, enabling users to participate in traditional financial markets while maintaining the benefits of decentralized finance. Find out more about [Spikoarrow-up-right](https://docs.spiko.io/documentation/intro/welcome/) . ### [hashtag](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko#what-is-eutbl) What is EUTBL? EUTBL (Spiko EU T-Bills) is Spiko's wrapped version of their EU T-Bills Money Market Fund, designed to provide enhanced composability and integration capabilities within the DeFi ecosystem. When users invest in Spiko's EU T-Bills Money Market Fund, they receive EUTBL tokens, which represent their position in the underlying European Treasury Bills. EUTBL is then created by wrapping the fund shares, making it compatible with ERC-20 standards and easier to integrate with various DeFi protocols. This makes EUTBL an ideal collateral asset for protocols like EUR0, as it combines the stability of European Treasury Bills with the flexibility of a wrapped token. More on [EUTBLarrow-up-right](https://www.spiko.io/spiko-euro) . [PreviousEUR0 Collateralchevron-left](https://tech.usual.money/smart-contracts/eur0-collateral) [NextContract Deploymentschevron-right](https://tech.usual.money/smart-contracts/contract-deployments) Last updated 7 months ago Was this helpful? * [Who is Spiko?](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko#who-is-spiko) * [What is EUTBL?](https://tech.usual.money/smart-contracts/eur0-collateral/eutbl-by-spiko#what-is-eutbl) Was this helpful? --- # Usual Protocol Primer | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FX5mUOyVQlIadphiDavhF%252FPage%2520Cover%252002.png%3Falt%3Dmedia%26token%3D96c9ac9c-a390-4bc5-85a5-25fac853138b&width=1248&dpr=3&quality=100&sign=2c8e1e32&sv=2) [hashtag](https://tech.usual.money/overview#what-is-the-usual-protocol-about-eli5-version) What is the Usual protocol about? (ELI5 version) ------------------------------------------------------------------------------------------------------------------------------------------------ Usual is a new kind of stablecoin protocol designed to give users more control and rewards compared to traditional stablecoins like USDC or USDT. It creates a better system where you, as a user, not only benefit from using the stablecoin but also get ownership in the protocol itself. ### [hashtag](https://tech.usual.money/overview#why-was-usual-created) **Why was Usual created?** In the current crypto landscape, stablecoin issuers (like Tether and Circle) make a lot of money, but users don’t benefit from this wealth. Usual flips this model by redistributing profits and ownership to users. This makes it a fairer system, where users who hold or use USD0 and $USUAL actually benefit from the protocol’s success. ### [hashtag](https://tech.usual.money/overview#the-core-elements-of-usual) **The core elements of Usual** #### [hashtag](https://tech.usual.money/overview#usd0) **USD0** This is Usual’s stablecoin. It's pegged to the US dollar and backed by real world assets (RWA) like US Treasury Bills (T-Bills). Unlike other stablecoins that might have hidden risks (like depending on banks), USD0 is fully backed by super-safe assets (T-Bills), making it more secure. It’s also designed to be permissionless and easily integrated into DeFi (Decentralized Finance) ecosystems. **Key features of USD0:** * Fully backed by RWA T-Bills, making it stable and secure * Completely transparent - anyone can verify the reserves backing USD0 * Works seamlessly in DeFi, allowing for easy trading, lending, or using it as collateral #### [hashtag](https://tech.usual.money/overview#busd0) **bUSD0** bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. If you want to earn more from your USD0, you can deposit it in bUSD0 for up to four years. While locked, bUSD0 still remains liquid and tradable, and it earns extra rewards in the form of yield ($USUAL and maturity yield). **Key features of bUSD0:** * Staked for 4 years but still tradable in DeFi * Earns daily yield, paid in $USUAL tokens, as well as maturity yield * Offers a minimum guaranteed yield, making it attractive for users seeking stable returns #### [hashtag](https://tech.usual.money/overview#eth0) ETH0 ETH0 is a synthetic ETH asset fully backed by Lido’s wstETH and issued by the Usual protocol. It allows institutional investors and crypto-native whales to maintain directional ETH exposure while capturing significantly higher yields than conventional staking or restaking. Powered by the same architecture that underpins Usual’s stablecoin (backed by tokenized T-bills), ETH0 holders receive USUAL tokens, allowing them to outperform the underlying yield. **Key features of USD0++:** * Retain full ETH exposure (1:1 peg to ETH) * Earn yield through USUAL distributions * Redeem their position anytime for wstETH #### [hashtag](https://tech.usual.money/overview#usual) **USUAL** USUAL is Usual’s governance token, but it’s much more than just a token to vote with. It represents ownership of the protocol, meaning users benefit from the protocol’s growth and revenue. The more USD0 is used, the more valuable USUAL becomes. It also gives users a say in how the protocol is run, including decisions on collateral types and rewards distribution. **Key features of USUAL:** * Represents ownership in the protocol’s revenue * The token supply grows slowly over time, ensuring it becomes more valuable as the protocol grows * USUAL holders can stake their tokens to earn more USUAL and participate in governance [PreviousUsual Tech Hubchevron-left](https://tech.usual.money/) [NextFeatureschevron-right](https://tech.usual.money/overview/features) Last updated 4 months ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # USD0a Reverse Gateway | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#high-level-overview) High-Level Overview The ReverseGateway contract is a fully permissioned smart contract designed to manage intermediary treasury operations between the protocol's collateral treasury and external collateral services such as Superstate. The contract facilitates the conversion of USCC tokens (from Superstate) to USDC tokens (from Circle) through an order-based tracking system, enabling the protocol to rebalance treasury collaterals efficiently. The main objective of the ReverseGateway contract is to provide a secure and controlled mechanism for interacting with external collateral services while maintaining USD0a price stability through the DebtUSCC token system. When the protocol needs to switch some USCC to USDC, the ReverseGateway manages these operations by tracking deposits and withdrawals through orders. Critically, the ReverseGateway mints DebtUSCC tokens when USCC is sent to Superstate to prevent USD0a price from decreasing while waiting for USDC, since USD0a price depends on the amount of collaterals in the treasury. **Key Use Case**: The ReverseGateway is primarily used for treasury rebalancing operations in the opposite direction of the Gateway. For example, if the protocol wants to convert USCC to USDC, an authorized operator can deposit USCC through the ReverseGateway, which transfers the USCC to the Superstate contract. The ReverseGateway then mints DebtUSCC tokens (1:1 with the USCC amount) to maintain USD0a price stability. This is critical because USD0a price depends on the amount of collaterals in the treasury. Without minting DebtUSCC, the USD0a price would decrease when USCC is sent to Superstate (reducing treasury collateral) while waiting for USDC. By minting DebtUSCC, the protocol maintains the accounting balance, preventing USD0a price from decreasing during the conversion process. When USDC is received from Superstate, the operator can withdraw through the ReverseGateway, which burns the corresponding DebtUSCC tokens and transfers the USDC to the collateral treasury, replacing the debt token with actual collateral. **Important Difference from Gateway**: Unlike the Gateway contract which allows multiple concurrent deposits, the ReverseGateway enforces a single deposit at a time policy. This is implemented through an `ongoingDeposit` flag that prevents new deposits while a previous deposit is still being processed. This design ensures that only one conversion operation is active at any given time, which is critical for maintaining consistent pricing of the DebtUSCC token. By allowing only one deposit at a time, the protocol ensures that all DebtUSCC tokens are minted at a consistent price point (captured via the USCC oracle roundId), preventing price inconsistencies that could arise from multiple concurrent deposits at different price points. Additionally, this constraint simplifies the withdrawal process and reduces complexity in managing multiple concurrent orders. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#contract-summary) Contract Summary The contract provides the following main functions: * **deposit**: Allows authorized users to deposit USCC tokens, transfer them to the Superstate contract, and create a tracking order. This function also mints DebtUSCC tokens (1:1 with USCC) to the collateral treasury to maintain USD0a price stability. Without this minting, the USD0a price would decrease because it depends on the amount of collaterals in the treasury, and USCC is temporarily reduced while waiting for USDC. The function captures the USCC oracle roundId at the time of deposit for price tracking purposes. **Only one deposit can be active at a time** - if an ongoing deposit exists, the function will revert. * **withdraw**: Allows authorized users to withdraw USDC tokens by burning the corresponding DebtUSCC tokens for the last (most recent) order. The function accepts a `usdcAmount` parameter because the exact amount received from Superstate cannot be predicted. After processing the withdrawal, the `ongoingDeposit` flag is reset to false, allowing new deposits. * **emergencyWithdraw**: Provides an emergency mechanism to recover tokens that may have been accidentally sent to the contract. * **setSuperstateAddress**: Allows authorized users to update the Superstate contract address, enabling the protocol to adapt to contract upgrades or migrations. The contract also includes utility functions such as `getOrder`, `getNextOrderId`, `superstate`, `collateralTreasury`, `usccOracle`, `usdcToken`, `usccToken`, and `debtUSCC` to retrieve order details and contract configuration. The ReverseGateway uses an order-based system to track deposits and withdrawals. Each deposit creates an order that stores the USCC amount, active status, timestamp, and the USCC oracle roundId at the time of deposit. Orders are deactivated during withdrawal to prevent double-spending. The DebtUSCC token system ensures that USD0a price stability is maintained during collateral conversion operations. When USCC is sent to Superstate, the treasury temporarily loses collateral, which would cause USD0a price to decrease. By minting DebtUSCC tokens (1:1 with the USCC amount), the protocol maintains the accounting balance, preventing USD0a price from decreasing while waiting for USDC. When USDC is received and DebtUSCC is burned, the actual collateral replaces the debt token. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#inherited-contracts) Inherited Contracts * **Initializable (OZ)**: Used to provide a safe and controlled way to initialize the contract's state variables. It ensures that the contract's initializer function can only be called once, preventing accidental or malicious reinitialization. * **ReentrancyGuardUpgradeable (OZ)**: Used to protect against reentrancy attacks. It provides a modifier that can be applied to functions to prevent them from being called recursively or from being called from other functions that are also protected by the same guard. * **PausableUpgradeable (OZ)**: Allows contract functionality to be paused by authorized accounts (PAUSING\_CONTRACTS\_ROLE to pause the contract and UNPAUSING\_CONTRACTS\_ROLE to unpause). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#functionality-breakdown) Functionality Breakdown The ReverseGateway contract's primary purpose is to facilitate treasury rebalancing operations by managing interactions with external collateral services in the reverse direction (USCC to USDC). The contract's functionality can be broken down into the following key components: #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#order-creation-deposit) Order Creation (Deposit): * Users with the `GATEWAY_DEPOSIT_ROLE` can create new orders by calling the `deposit` function and specifying the amount of USCC tokens to deposit. * The contract validates that no ongoing deposit exists. If an `ongoingDeposit` flag is set to true, the function will revert with an `OngoingDeposit` error, ensuring only one deposit can be processed at a time. * The contract captures the current USCC oracle roundId by calling `latestRoundData()` on the USCC oracle. This roundId is stored in the order for price tracking and audit purposes. * The contract transfers the specified amount of USCC tokens from the caller directly to the Superstate contract (not to the ReverseGateway contract itself). * The contract creates a new order with a unique order ID, storing the USCC amount, active status (set to true), the current block timestamp, and the captured oracle roundId. * The contract mints DebtUSCC tokens (1:1 with the USCC amount) to the collateral treasury. The debt token maintains the accounting balance until USDC is received and replaces it. * The order is assigned a unique order ID (starting from 1) and stored in the contract's orders mapping. * The `ongoingDeposit` flag is set to true to prevent concurrent deposits. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#order-fulfillment-withdraw) Order Fulfillment (Withdraw): * Users with the `GATEWAY_WITHDRAW_ROLE` can fulfill the most recent order by calling the `withdraw` function and specifying the amount of USDC tokens to withdraw. * The contract automatically processes the last order (identified by `nextOrderId - 1`), ensuring that orders are fulfilled in a first-in-first-out manner. * The contract validates that the last order is active and exists. If the order is not active, the function will revert with an `OrderNotActive` error. * The contract deactivates the order (sets `active` to false) to prevent double-spending. * The contract burns DebtUSCC tokens from the collateral treasury (1:1 with the order's USCC amount). This clears the protocol's obligation for the fulfilled order. * The contract transfers the specified amount of USDC tokens from the ReverseGateway contract to the collateral treasury. * The `ongoingDeposit` flag is set to false, allowing new deposits to be processed. * **Important**: The `usdcAmount` parameter is provided by the caller because the exact amount of USDC received from Superstate cannot be predicted in advance. This allows the protocol to handle variable exchange rates, fees, or other factors that may affect the final amount received from external services. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#debtuscc-accounting) DebtUSCC Accounting: The ReverseGateway uses the DebtUSCC token system to maintain USD0a price stability during collateral conversion operations. When USCC is deposited and sent to Superstate, the treasury temporarily loses USCC collateral. Since USD0a price depends on the amount of collaterals in the treasury, this reduction would cause USD0a price to decrease. To prevent this, DebtUSCC tokens are minted (1:1 with the USCC amount) to maintain the accounting balance. This ensures that USD0a price remains stable while waiting for USDC from Superstate. When USDC is received and withdrawn, the corresponding DebtUSCC tokens are burned, and the actual USDC collateral replaces the debt token. This mechanism ensures that USD0a price stability is maintained throughout the entire conversion process, even when interacting with third-party services that may have processing delays. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#oracle-integration) Oracle Integration: The ReverseGateway integrates with a USCC oracle (IAggregator) to capture price information at the time of deposit. During the deposit process, the contract calls `latestRoundData()` on the USCC oracle and stores the `roundId` in the order. This allows the protocol to track the USCC price at the time of deposit, which can be useful for auditing, price verification, and ensuring fair conversions. The oracle address is set during initialization and can be queried through the `usccOracle()` getter function. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#external-integration) External Integration: The ReverseGateway integrates with the Superstate contract for USCC transfers and USDC redemptions. USCC (from Superstate) is transferred directly to the Superstate contract during deposits, and USDC is expected to be received from Superstate before withdrawals can be processed. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#method-deposit) Method: deposit This method allows authorized users to deposit USCC tokens, transfer them to the Superstate contract, create a tracking order, and mint DebtUSCC tokens to the collateral treasury. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * The function is protected by the `whenNotPaused` modifier, ensuring that deposits cannot be made when the contract is paused. * Validates that the USCC amount is greater than zero. * Validates that the caller has the `GATEWAY_DEPOSIT_ROLE` using role-based access control. * **Validates that no ongoing deposit exists** by checking the `ongoingDeposit` flag. If an ongoing deposit is in progress, the function will revert with an `OngoingDeposit` error. This ensures only one deposit can be processed at a time. * Sets the `ongoingDeposit` flag to true to prevent concurrent deposits. * Sets the value of `orderId` to the current value of `$.nextOrderId` then increments by 1. Since it is initialized as 1, the first orderId will be one and so on. * Captures the current USCC oracle roundId by calling `latestRoundData()` on the USCC oracle. This roundId is stored in the order for price tracking purposes. * Creates a new `ReverseGatewayOrder` struct in storage using the order ID as key. The struct contains: the USCC amount, the active flag set to true, the current block timestamp, and the captured oracle roundId. * Transfers the specified amount of USCC tokens from the caller directly to the Superstate contract (not to the ReverseGateway contract) using `safeTransferFrom` to ensure that the transfer is successful. If the transfer fails, the function will revert. * Mints DebtUSCC tokens (1:1 with the USCC amount) to the collateral treasury. This is critical for maintaining USD0a price stability. Since USD0a price depends on the amount of collaterals in the treasury, and USCC is temporarily reduced while waiting for USDC from Superstate, minting DebtUSCC prevents the USD0a price from decreasing during the conversion process. The debt token maintains the accounting balance until USDC is received and replaces it. * Emits a `Deposit` event, providing the caller address, order ID, and USCC amount for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#method-withdraw) Method: withdraw This method allows authorized users to withdraw USDC tokens by burning the corresponding DebtUSCC tokens for the last (most recent) order and transferring USDC to the collateral treasury. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier. * The function is protected by the `whenNotPaused` modifier, ensuring that withdrawals cannot be made when the contract is paused. * Validates that the USDC amount is greater than zero. * Validates that the caller has the `GATEWAY_WITHDRAW_ROLE` using role-based access control. * Automatically selects the last order (identified by `$.nextOrderId - 1`) for processing. This ensures that orders are fulfilled in a first-in-first-out manner and simplifies the withdrawal process compared to the Gateway contract which processes multiple orders. * Validates that the last order is active. If the order is not active or does not exist, the function will revert with an `OrderNotActive` error. This prevents any attempts to withdraw from invalid or already processed orders. * Deactivates the order by setting the `active` flag to false in storage. This prevents double-spending and ensures that orders can only be processed once. * Burns DebtUSCC tokens from the collateral treasury (1:1 with the order's USCC amount). This clears the protocol's obligation for the fulfilled order and ensures proper accounting. * Transfers the specified amount of USDC tokens from the ReverseGateway contract to the collateral treasury using the `safeTransfer` function. This ensures that the transfer is successful. If the transfer fails, the function will revert. * Sets the `ongoingDeposit` flag to false, allowing new deposits to be processed. * **Important**: The `usdcAmount` parameter is provided by the caller because the exact amount of USDC received from Superstate cannot be predicted in advance. This allows the protocol to handle variable exchange rates, fees, or other factors that may affect the final amount received from external services. * Emits a `Withdraw` event, providing the caller address, order ID (the last order), USCC amount from the order, and USDC amount for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#method-emergencywithdraw) Method: emergencyWithdraw This method provides an emergency mechanism to recover tokens that may have been accidentally sent to the ReverseGateway contract. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier. * Validates that the token address is not the zero address. * Validates that the recipient address is not the zero address. * Validates that the amount is greater than zero. * Validates that the caller has the `EMERGENCY_WITHDRAW_ROLE` using role-based access control. * Transfers the specified amount of tokens from the ReverseGateway contract to the recipient using the `safeTransfer` function. This ensures that the transfer is successful. If the transfer fails, the function will revert. * Emits an `EmergencyWithdraw` event, providing the token address, amount, and recipient for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#method-setsuperstateaddress) Method: setSuperstateAddress This method allows authorized users to update the Superstate contract address, enabling the protocol to adapt to contract upgrades or migrations. **Function Description:** * Validates that the new Superstate address is not the zero address. * Validates that the new Superstate address is different from the current address to prevent unnecessary state changes. * Validates that the caller has the `GATEWAY_SUPERSTATE_SETTER_ROLE` using role-based access control. * Updates the Superstate address in storage. * Emits a `SuperstateUpdated` event, providing the old and new Superstate addresses for tracking. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#getter-functions) Getter Functions * **getOrder**: Returns the details of a specific order including USCC amount, active status, timestamp, and the USCC oracle roundId captured at deposit time. * **getNextOrderId**: Returns the next order ID that will be assigned. * **superstate**: Returns the current Superstate contract address. * **collateralTreasury**: Returns the current collateral treasury address. * **usccOracle**: Returns the current USCC oracle contract address. * **usdcToken**: Returns the current USDC token contract address. * **usccToken**: Returns the current USCC token contract address. * **debtUSCC**: Returns the current DebtUSCC token contract address. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: Address of the registry access contract. * **CONTRACT\_TREASURY**: Address of the collateral treasury contract. * **GATEWAY\_DEPOSIT\_ROLE**: Role identifier for depositing USCC and creating orders. * **GATEWAY\_WITHDRAW\_ROLE**: Role identifier for withdrawing USDC and fulfilling orders. * **EMERGENCY\_WITHDRAW\_ROLE**: Role identifier for emergency token recovery. * **GATEWAY\_SUPERSTATE\_SETTER\_ROLE**: Role identifier for updating the Superstate address. * **PAUSING\_CONTRACTS\_ROLE**: Role identifier for pausing contract operations. * **UNPAUSING\_CONTRACTS\_ROLE**: Role identifier for unpausing contract operations. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of contract functionality in emergencies. The contract can be paused by `PAUSING_CONTRACTS_ROLE` and unpaused by `UNPAUSING_CONTRACTS_ROLE`. * **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. All state-changing functions are protected with the `nonReentrant` modifier. * **Access Control**: Restricts sensitive operations to authorized roles. Deposit operations require `GATEWAY_DEPOSIT_ROLE`, withdrawal operations require `GATEWAY_WITHDRAW_ROLE`, emergency withdrawals require `EMERGENCY_WITHDRAW_ROLE`, and Superstate address updates require `GATEWAY_SUPERSTATE_SETTER_ROLE`. * **Amount Validation**: Validates that amounts are non-zero before processing operations. * **Order Validation**: Validates that the last order is active before processing withdrawals, preventing attempts to process invalid or already processed orders. * **Null Address Checks**: Validates that all addresses (registry, Superstate, tokens, oracle, recipient) are not the zero address before processing operations. * **Order Deactivation**: Deactivates orders during withdrawal to prevent double-spending and ensure that orders can only be processed once. * **Single Deposit Constraint**: Enforces that only one deposit can be active at a time through the `ongoingDeposit` flag. This prevents concurrent deposits, ensuring consistent DebtUSCC token pricing by maintaining a single price point for all outstanding debt tokens, and simplifies the withdrawal process. * **SafeERC20**: Uses SafeERC20 for all token transfers to prevent failures from going unnoticed and to handle non-standard ERC20 implementations safely. * **Storage Safety**: Uses ERC-7201 namespaced storage pattern (`ReverseGatewayStorageV0`) to prevent storage collisions during upgrades. The contract is upgradeable via UUPS proxy pattern. * **Same Value Protection**: Prevents unnecessary state changes by validating that the new Superstate address is different from the current address before updating. * **Oracle Integration**: Captures and stores the USCC oracle roundId at deposit time for price tracking and audit purposes, ensuring transparency in the conversion process. [PreviousUSD0a Gatewaychevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway) [NextETH0chevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eth0) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#security-analysis) * [Getter Functions](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#getter-functions) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway#safeguards-implementation) Was this helpful? --- # bUSD0 (formerly USD0++) | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#high-level-overview) High-Level Overview ----------------------------------------------------------------------------------------------------------------------- This smart contract manages a bond financial instrument for the UsualDAO ecosystem. It provides functionality for minting, transferring, and unstaking the liquid token. The contract complies with ERC20 standards and allows users to deposit USD0 into bUSD0 or acquire it on the secondary market. bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. It remains transferable during this period, earning USUAL incentives and maturity yield. Users receive 1 USD0 for 1 bUSD0 at maturity. For early redemption, users need an equivalent amount of rt-USD0 - received at mint - which unlocks bUSD0 back into USD0 at a 1:1 rate anytime. Additionally, early redemption below peg can be made at a DAO set price floor. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#minting-busd0-formerly-usd0) **Minting bUSD0 (formerly USD0++)** Users can stake their USD0 to convert them into bUSD0 (formerly USD0++). The issuance of bUSD0 (formerly USD0++) follows a 1:1 ratio with the staked USD0. Once staked, the assets remain immobilized for the maturity period of the bUSD0 (formerly USD0++) liquid stake, ensuring stability and predictability. **Staking and Issuance** * **Locking USD0**: Users stake their USD0 to mint bUSD0 (formerly USD0++). * **1:1 Issuance**: bUSD0 (formerly USD0++) is issued on a 1:1 basis with the locked USD0. * **Locked Duration**: Assets are locked for the maturity period of the bUSD0 (formerly USD0++) liquid staking token. * **Locking USD0**: Users deposit their USD0 to mint bUSD0 (formerly USD0++). * **1:1 Issuance**: Both bUSD0 (formerly USD0++) and rt-bUSD0 are issued on a 1:1 basis with the deposited USD0. * **Dual Token System**: * **bUSD0 (formerly USD0++)**: The bond asset token, transferable and composable. * **rt-bUSD0**: The redemption token asset, required alongside bUSD0 to reconstruct the bond back to USD0. * **Locked Duration**: Assets are locked for the maturity period of the USD0++. **Reconstructing Bonds** Users can reconstruct (destroy) their bonds by burning both bUSD0 (formerly USD0++) and rt-bUSD0 tokens together to receive the underlying USD0 back. This process requires equal amounts of both tokens and can be done at any time before maturity. * **Reconstruction Process**: Users burn equal amounts of bUSD0 (formerly USD0++) and rt-bUSD0 tokens to receive USD0 at a 1:1 ratio. * **Token Requirements**: Both bUSD0 (formerly USD0++) and rt-bUSD0 tokens must be present in equal amounts to reconstruct the bond. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#floor-price-mechanism) Floor Price Mechanism bUSD0 (formerly USD0++) includes a floor price mechanism, allowing users to unstake their bUSD0 (formerly USD0++) for USD0 at a guaranteed minimum rate. * `updateFloorPrice(uint256 newFloorPrice)`: Allows authorized admins to update the floor price. Only callable by the `FLOOR_PRICE_UPDATER_ROLE` role. * `unlockUsd0ppFloorPrice(uint256 usd0ppAmount)`: Allows users to unstake their bUSD0 (formerly USD0++) at the current floor price. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#usual-fee-mechanism) USUAL Fee Mechanism bUSD0 (formerly USD0++) includes an early redemption mechanism that allows users to unlock their bUSD0 (formerly USD0++) before maturity by transferring USUAL tokens. The amount of USUAL required for redemption is dynamically calculated based on several factors: #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#key-functions) Key Functions * `unlockUSD0ppWithUsual(uint256 usd0ppAmount, uint256 maxUsualAmount)`: Allows users to redeem bUSD0 (formerly USD0++) by transferring USUAL tokens * `unlockUSD0ppWithUsualWithPermit(...)`: Same as above but includes permit functionality for gasless approvals * `calculateRequiredUsual(uint256 usd0ppAmount)`: Calculates the amount of USUAL needed to redeem a given amount of bUSD0 (formerly USD0++) * `sweepFees()` : Callable only by the `FEE_SWEEPER_ROLE` and transfers the accumulated USUAL fees to the distribution module #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#calculation-factors) Calculation Factors The required USUAL amount is determined by: 1. Base Distribution Rate: Amount of USUAL distributed per bUSD0 (formerly USD0++) per day 2. Duration Cost: Adjusts cost based on time window 3. Net Outflows: Considers weekly redemption volume #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#parameters-configurable-by-governance) Parameters (Configurable by governance) * `usualDistributionPerUsd0pp`: Base USUAL distribution rate (per bUSD0, formerly USD0++) * `durationCostFactor`: Multiplier for time-based cost adjustment * `targetRedemptionRate`: Target weekly redemption rate (in basis points of total supply) #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#example-flow) Example Flow 1. User calls `calculateRequiredUsual()` to determine USUAL cost 2. User approves USUAL spend (or uses permit) 3. User calls `unlockUSD0ppWithUsual()` with desired bUSD0 (formerly USD0++) amount and maximum USUAL willing to transfer 4. Contract receive portion of USUAL, increment `accumulatedFees` variable, and returns USD0 to user The mechanism helps maintain protocol stability by adjusting costs based on redemption volume and ensuring controlled unwinding of bUSD0 (formerly USD0++) positions. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#peg-maintainer) Peg Maintainer * `unwrapPegMaintainer(uint256 amount)`: Allows peg maintainers to unwrap liquid staking tokens at any time. Only callable by the `PEG_MAINTAINER_ROLE` role. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#early-unlock-period) Early Unlock Period The contract includes functionality for a temporary early unlock period, allowing users to unwrap their liquid staking tokens before the full maturity period under certain conditions. This is a temporary mechanism specifically related to the airdrop * `setupEarlyUnlockPeriod(uint256 bondEarlyUnlockStart, uint256 bondEarlyUnlockEnd)`: Sets up the early unlock period. Only callable by the `EARLY_BOND_UNLOCK_ROLE` role. * `temporaryOneToOneExitUnwrap(uint256 amountToUnwrap)`: Allows users to unwrap their bonds during the early unlock period. This voids any USUAL airdrop that they are entitled to * `allocateEarlyUnlockBalance(address[] calldata addressesToAllocateTo, uint256[] calldata balancesToAllocate)`: Allocates early unlock balances to specific addresses that have accumulated potential airdrop rewards. Only callable by the `EARLY_BOND_UNLOCK_ROLE` role. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#regulatory-compliance) **Regulatory Compliance** The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract and are kept up to date. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#functionality-breakdown) **Functionality Breakdown** The contract flow begins with the initialization of liquid staking token parameters and related registry and token information. Liquid staking tokens can be minted, transferred, and unstaked. The contract also allows for emergency withdrawals of the underlying token. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#functions-description) **Functions Description** #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#public-external-functions-non-view-non-pure) **Public/External Functions (non-view / non-pure)** * `pause()`: Pauses all token transfer operations; callable only by the `PAUSING_CONTRACTS_ROLE`. * `unpause()`: Resumes all token transfer operations; callable only by the `DEFAULT_ADMIN_ROLE`. * `setupEarlyUnlockPeriod(uint256 bondEarlyUnlockStart, uint256 bondEarlyUnlockEnd)`: Sets up the early unlock period. Only callable by the `EARLY_BOND_UNLOCK_ROLE` role. * `mint(uint256 amountUsd0)`: Mints new bonds by locking the specified amount of collateral token. * `mint(uint256 amountUsd0, address bAssetRecipient, address rAssetRecipient)`: Mints new bonds by locking the specified amount of collateral token. bUSD0 (formerly USD0++) tokens are sent to `bAssetRecipient` and rt-bUSD0 tokens are sent to `rAssetRecipient`, both in a 1:1 ratio with the locked USD0. * `mintWithPermit(uint256 amountUsd0, uint256 deadline, uint8 v, bytes32 r, bytes32 s)`: Mints new bonds with a permit signature. * `unwrap()`: Unwraps the bonds and transfers the underlying collateral token to the user. * `temporaryOneToOneExitUnwrap(uint256 amountToUnwrap)`: Allows users to unwrap their bonds during the early unlock period. * `allocateEarlyUnlockBalance(address[] calldata addressesToAllocateTo, uint256[] calldata balancesToAllocate)`: Allocates early unlock balances to specific addresses. Only callable by the `EARLY_BOND_UNLOCK_ROLE` role. * `unwrapPegMaintainer(uint256 amount)`: Allows peg maintainers to unwrap bonds at any time. Only callable by the `PEG_MAINTAINER_ROLE` role. * `triggerPARMechanismCurvepool(uint256 parUsd0Amount, uint256 minimumPARMechanismGainedAmount)`: Triggers the PAR mechanism in the Curve pool. * `emergencyWithdraw(address safeAccount)`: Allows for the emergency withdrawal of the underlying collateral token. * `updateFloorPrice(uint256 newFloorPrice)`: Allows authorized users to update the floor price. Only callable by the `FLOOR_PRICE_UPDATER_ROLE` role. * `unlockUsd0ppFloorPrice(uint256 usd0ppAmount)`: Allows users to unlock their bUSD0 (formerly USD0++) at the current floor price. * `transfer(address recipient, uint256 amount)`: Transfers bonds from the sender to the recipient. * `transferFrom(address sender, address recipient, uint256 amount)`: Transfers bonds from the sender to the recipient on behalf of the sender. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0++#view-functions) View Functions * `totalBondTimes()`: Returns the total staking duration. * `getBondEarlyUnlockDisabled(address user)`: Checks if early unlock is disabled for a user. * `getStartTime()`: Returns the start time of the staking period. * `getEndTime()`: Returns the end time of the staking period. * `getFloorPrice()`: Returns the current floor price. * `getTemporaryUnlockStartTime()`: Returns the start time of the temporary unstaking period. * `getTemporaryUnlockEndTime()`: Returns the end time of the temporary unstaking period. * `getAllocationEarlyUnlock(address addressToCheck)`: Returns the early unstaking allocation for an address. * `getAccumulatedFees()`: Returns the amount of accumulated fees in USUAL of the contract. [PreviousUSD0chevron-left](https://tech.usual.money/smart-contracts/token-contracts/usd0) [NextUSD0achevron-right](https://tech.usual.money/smart-contracts/token-contracts/usd0a) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usd0++#high-level-overview) * [Minting bUSD0 (formerly USD0++)](https://tech.usual.money/smart-contracts/token-contracts/usd0++#minting-busd0-formerly-usd0) * [Floor Price Mechanism](https://tech.usual.money/smart-contracts/token-contracts/usd0++#floor-price-mechanism) * [USUAL Fee Mechanism](https://tech.usual.money/smart-contracts/token-contracts/usd0++#usual-fee-mechanism) * [Peg Maintainer](https://tech.usual.money/smart-contracts/token-contracts/usd0++#peg-maintainer) * [Early Unlock Period](https://tech.usual.money/smart-contracts/token-contracts/usd0++#early-unlock-period) * [Regulatory Compliance](https://tech.usual.money/smart-contracts/token-contracts/usd0++#regulatory-compliance) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usd0++#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/usd0++#functions-description) Was this helpful? --- # Distribution Module | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#high-level-overview) High-Level Overview ---------------------------------------------------------------------------------------------------------------------------------------------------------------- This contract manages a **Distribution** process of the Usual token. The contract should be called daily to calculate how many new tokens are created, distributed to on-chain vaults (UsualX and UsualS) and how many tokens are available to claim for the off-chain users with a valid merkle proof. The core features of this contract include: * **Daily Distribution**: The contract should be called daily to calculate how many new tokens are created, distributed to On Chain vaults (UsualX and UsualS) and how many tokens are available to claim for the off-chain users with a valid merkle proof. The amount distributed scales based on how much longer (after one day) it has been since the last distribution to account for calling the function at greater than 24 hour periods. * **Merkle Proof for Off-Chain Users**: Ensures that only eligible users, validated through merkle proofs, can receive tokens from the distribution. * **Challengeable Queue of Merkle Proofs**: The contract should have a queue of merkle proofs that can be challenged by a specific role (e.g. governance) to ensure that the off-chain distribution is fair and correct. * **Access Control**: Each functionality should be controlled by a role with minimal required permissions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#inherited-contracts) Inherited Contracts * **Initializable**: For upgradeable contract initialization. * **PausableUpgradeable**: Allows contract execution to be paused or unpaused by an authorized role. * **ReentrancyGuardUpgradeable**: Provides protection against reentrancy attacks. * **IDistributionModule**: Interface that defines all functions that can be called by anyone. * **IDistributionAllocator**: Interface that defines the functions that can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE` * **IDistributionOperator**: Interface that defines the functions that can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. Those functions are used to daily distribute the Usual tokens to on-chain and off-chain buckets. * **IOffChainDistributionChallenger**: Interface that defines the functions that can be only called by the `OFF_CHAIN_DISTRIBUTION_CHALLENGER_ROLE`. Those functions are used to challenge the off-chain distribution in the queue. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#functionality-description) Functionality Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#public-external-functions) Public/External Functions * **initialize**: Initializes the contract with the registry address and sets the initial `rate0` value * **pause**: Admin function to pause the contract. Can be only called by `PAUSING_CONTRACTS_ROLE` * **unpause**: Admin function to unpause the contract. Can be only called by `DEFAULT_ADMIN_ROLE` #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#idistributionmodule) IDistributionModule * **getBucketsDistribution**: Returns the current buckets distribution percentages in basis points. Off-chain buckets are LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers. On-Chain buckets are UsualX and UsualS. * **calculateUsualDist**: Helper view function that calculates a simulated Usual Distribution for the provided `ratet` and `p90Rate` values. It returns `st`, `rt` and `kappa` values that were used in the calculation. * **calculateSt**: Helper view function that returns a calculated `st` value based on provided `supplyPpt` and `pt` values. * **calculateRt**: Helper view function that returns a calculated `rt` value based on provided `ratet` and `p90Rate` values. * **calculateMt**: Helper view function that returns a calculated `mt` value based on provided `st`, `rt` and `kappa` values. * **getOffChainDistributionData**: Returns the currently approved off-chain distribution `timestamp` and `merkleRoot` values. That can be used to pre-validate the merkle proof before calling the `claimOffChainDistribution` function. * **getOffChainDistributionQueue**: Returns the current off-chain distribution queue. The queue is a list of `timestamp` and `merkleRoot` values that are used to claim the off-chain distribution. * **getOffChainDistributionMintCap**: Returns the current off-chain distribution mint cap value. This value is the maximum amount of tokens that can be minted by through the off-chain distribution. It is reduced with every successful claim. * **approveUnchallengedOffChainDistribution**: Approves the latest unchallenged off-chain distribution from the queue that was in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`. All distributions that were in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` are removed from the queue. Even if anyone can call this function, usually it will be called by the `DISTRIBUTION_OPERATOR_ROLE`. * **getOffChainTokensClaimed**: Returns the amount of the tokens claimed by the given `account` address in the off-chain distribution until now. * **claimOffChainDistribution**: Allows to claim the Usual tokens from the latest approved off-chain distribution. Caller should provide a valid merkle proof for the provided `account` and `amount`. The `amount` is the total amount of tokens that were assigned for the given `account` address since the beginning of the distribution. The Usual tokens are minted when the proof is valid and the given `account` has any tokens to claim in the approved off-chain distribution. The given `account` will only receive the tokens that were not claimed by them before based on the value returned by the `getOffChainTokensClaimed` function. The mint cap should be reduced by the claimed amount. The `getOffChainTokensClaimed` should return increased value. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#idistributionallocator) IDistributionAllocator * **setBucketsDistribution**: Allows to set the new buckets distribution percentages in basis points. The sum of all values should be equal to `BASIS_POINT_BASE`. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. Off-chain buckets are LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers. On-Chain buckets are Usual+ and Usual\*. * **setFeeRates**: Allows to set the Treasury, UsualX and Burn fee rates. * **getFeeRates**: Allows to get the Treasury, UsualX and Burn fee rates. * **setD**: Set `D` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getD**: Returns the current `D` parameter value. * **setM0**: Set `m0` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getM0**: Returns the current `m0` parameter value. * **setRateMin**: Set `rateMin` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getRateMin**: Returns the current `rateMin` parameter value. * **setBaseGamma**: Set `baseGamma` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getBaseGamma**: Returns the current `baseGamma` parameter value. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#idistributionoperator) IDistributionOperator * **distributeUsualToBuckets**: Calculates the Usual emissions based on the current state of parameters and provided `ratet` and `p90Rate` values. For on-chain buckets (Usual+ and Usual\*) the tokens are minted directly to the bucket and a vault specific distribution is started. For off-chain buckets (LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers) mint is delayed until the off-chain distribution is approved and tokens are claimed. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. * **queueOffChainDistribution**: Queues the off-chain distribution for the given `merkleRoot`. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. This function cannot be called more than once per 24 hours. * **resetOffChainDistributionQueue**: Removes all off-chain distributions from the queue. This is an emergency functionality is queue ever gets to big to be pruned during a `approveUnchallengedOffChainDistribution` call. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#ioffchaindistributionchallenger) IOffChainDistributionChallenger * **challengeOffChainDistribution**: Challenges all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. The function can be only called by the `DISTRIBUTION_CHALLENGER_ROLE`. * **challengeAndProposeOffChainDistribution**: Challenges all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. The new off-chain distribution is proposed with the given `merkleRoot` and it still has to wait in the queue for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. The function can be only called by the `DISTRIBUTION_CHALLENGER_ROLE`. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#functionality-breakdown) Functionality Breakdown ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#setting-up-calculations-parameters) Setting up calculations parameters * `DISTRIBUTION_ALLOCATOR_ROLE` can change all the values that are used in the emissions calculations formula. There is no timelock for those changes. * `DISTRIBUTION_ALLOCATOR_ROLE` can change the distribution buckets shares percentages. The sum of all values should be equal to 100% (in basis points). There is no timelock for those changes. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#daily-emissions) Daily Emissions * `DISTRIBUTION_OPERATOR_ROLE` is required to call the `distributeUsualToBuckets` every 24 hours to: 1. Fetch the current blended weekly interest rate and P90 rate from the [Yield Modulearrow-up-right](https://app.gitbook.com/o/qhhUYNkfevGh3Y1MDQaS/s/pUhQzPJGdJzuLTQ5sCym/~/changes/119/smart-contracts/protocol-contracts/usual-distribution/yield-module) 2. Calculate the new emissions based on these rates 3. Distribute tokens to the on-chain buckets 4. Increase the off-chain buckets mint cap that can be claimed after successful approval of the off-chain distribution (must be unchallenged and in queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`) * By calling `distributeUsualToBuckets`, this contract will sweep fees accumulated on `Usd0PP` and `UsualX` contracts and, if any, will redistribute those fees depending of fee rates. Those fees will be distributed to UsualX holders, Yield Treasury contract and will be burned. Fee rates can only be changed by the `FEE_RATE_SETTER_ROLE` and the sum of them should be equal to `BASIS_POINT_BASE` (10\_000). * `DISTRIBUTION_OPERATOR_ROLE` is required to call the `queueOffChainDistribution` with a valid `merkleRoot` as soon as the off-chain distribution mint cap is increased. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#off-chain-distribution-queue-approval-and-challenges) Off-Chain Distribution Queue, Approval and Challenges * Once `DISTRIBUTOR_OPERATOR_ROLE` puts a new off-chain distribution in the queue, it has to wait for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. * Anyone can call the `approveUnchallengedOffChainDistribution` function to approve the latest unchallenged off-chain distribution from the queue that was in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`. This function will remove all distributions that were in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` which impacts the gas cost of the function. In normal circumstances, there should be only one distribution in the queue that is older than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` and has to be removed. * `DISTRIBUTION_CHALLENGER_ROLE` can call the `challengeOffChainDistribution` function to challenge all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. In rare cases, a new off-chain distribution can be proposed and it is put in the queue. * The queue should be treated as unordered. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#merkle-tree-root) Merkle Tree Root * The merkle tree root that is queued should be calculated off-chain and should include `account` and `amount` values for each user that is eligible for claiming the off-chain distribution. The `amount` value should be the total amount of tokens that were assigned for the given `account` address since the beginning of the distribution. The `amount` value for the given `account` should never decrease. The `account` address should be in the format `0x123...` and the `amount` should be in wei. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#merkle-proof-validation) Merkle Proof Validation All claims are validated against a Merkle tree using the `MerkleProof` library, ensuring that only eligible users can receive tokens. Separate Merkle roots are set for the initial and vesting periods. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#admin-control) Admin Control Administrators have control over setting key contract parameters, such as the Merkle roots and penalty percentages, as well as pausing the contract in case of emergencies. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#constants) Constants -------------------------------------------------------------------------------------------------------------------------------------------- * **DEFAULT\_ADMIN\_ROLE**: Role required to unpause the contract * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract * **DISTRIBUTION\_ALLOCATOR\_ROLE**: Role required to set the distribution parameters and buckets distribution percentages * **DISTRIBUTION\_OPERATOR\_ROLE**: Role required to distribute the Usual tokens to buckets and queue the off-chain distribution * **DISTRIBUTION\_CHALLENGER\_ROLE**: Role required to challenge the off-chain distribution in the queue * **FEE\_RATE\_SETTER\_ROLE**: Role required to set the fee rates. * **USUAL\_DISTRIBUTION\_CHALLENGE\_PERIOD**: The period in seconds that the off-chain distribution has to wait in the queue before it can be approved. It is 7 days by default. * **CONTRACT\_REGISTRY\_ACCESS**: This constant is used to define the address of the registry access contract. * **CONTRACT\_ORACLE**: This constant is used to define the address of the oracle contract. * **CONTRACT\_USD0**: This constant is used to define the address of the USD0 contract. * **CONTRACT\_USD0PP**: This constant is used to define the address of the USD0PP contract. * **CONTRACT\_USUAL**: This constant is used to define the address of the Usual contract. * **CONTRACT\_USUALSP**: This constant is used to define the address of the UsualSP contract. * **CONTRACT\_USUALX**: This constant is used to define the address of the UsualX contract. * **CONTRACT\_DAO\_COLLATERAL**: This constant is used to define the address of the DAO collateral contract. * **CONTRACT\_YIELD\_TREASURY**: This constant is used to define the address of the Yield Treasury contract. * **BASIS\_POINT\_BASE**: The base value for calculating percentages in basis points. * **BPS\_SCALAR**: The scalar value for calculating percentages in basis points. * **SCALAR\_ONE**: The scalar value for calculating percentages with 10^18 precision. * **REWARD\_PERIOD\_SCALAR**: The scalar value for calculating time since last distribution above 1 day in seconds. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#yield-module-integration) Yield Module Integration -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Distribution Module relies on the Yield Module for two critical values used in emissions calculations: 1. Blended Weekly Interest Rate: A weighted average of all RWA interest rates based on their USD value in the treasury 2. P90 Interest Rate: The 90th percentile interest rate maintained by the Yield Module These values are fetched during the daily distribution process and used to calculate the emission rate for new USUAL tokens. This integration ensures that token emissions are directly tied to the actual yield being generated by the protocol's RWA holdings. More details on the Yield Module [herearrow-up-right](https://app.gitbook.com/o/qhhUYNkfevGh3Y1MDQaS/s/pUhQzPJGdJzuLTQ5sCym/~/changes/119/smart-contracts/protocol-contracts/usual-distribution/yield-module) . [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#safeguard-implementation) Safeguard Implementation -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#reentrancy-guard) Reentrancy Guard All external function handling token mints and transfer are protected with `ReentrancyGuard` to prevent reentrancy attacks. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#access-control) Access Control The contract uses `CheckAccessControl` to enforce role-based access control, ensuring only authorized addresses can perform actions that require specific permissions. Each role has minimal required permissions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#pausability) Pausability The contract is pausable by `PAUSING_CONTRACTS_ROLE`, enabling the ability to pause all operations in case of an emergency. The contract can be resumed only by `DEFAULT_ADMIN_ROLE`. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#off-chain-distribution-queue-and-challenge-mechanism) Off-chain distribution queue and challenge mechanism The off-chain distribution can be validated for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. If an invalid distribution is proposed, it can be challenged by the `DISTRIBUTION_CHALLENGER_ROLE` making it impossible to be approved. If the queue ever gets too big, the `resetOffChainDistributionQueue` function can be called by the `DISTRIBUTION_OPERATOR_ROLE` to remove all off-chain distributions from the queue. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#restrictions-how-often-certain-functions-can-be-called) Restrictions how often certain functions can be called There is a 24 hours limit for the `calculateUsualDist` function to be called. To prevent unwanted emissions and distribution. [PreviousUSUAL Distributionchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution) [NextYield Modulechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module) Last updated 8 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#contract-summary) * [Functionality Description](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#functionality-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#functionality-breakdown) * [Setting up calculations parameters](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#setting-up-calculations-parameters) * [Daily Emissions](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#daily-emissions) * [Off-Chain Distribution Queue, Approval and Challenges](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#off-chain-distribution-queue-approval-and-challenges) * [Merkle Tree Root](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#merkle-tree-root) * [Merkle Proof Validation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#merkle-proof-validation) * [Admin Control](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#admin-control) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#constants) * [Yield Module Integration](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#yield-module-integration) * [Safeguard Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#safeguard-implementation) * [Reentrancy Guard](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#reentrancy-guard) * [Access Control](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#access-control) * [Pausability](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#pausability) * [Off-chain distribution queue and challenge mechanism](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#off-chain-distribution-queue-and-challenge-mechanism) * [Restrictions how often certain functions can be called](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module#restrictions-how-often-certain-functions-can-be-called) Was this helpful? --- # UsualM | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------- The **UsualM** smart contract manages the **UsualM ERC20 Token** and acts as a wrapped version of the **WrappedM** token (wrapped version of the M token). It allows users to wrap **WrappedM** tokens into **UsualM**, adding enhanced functionality such as pausability, blacklist enforcement, and mint cap restrictions. It also supports permits and implements role-based access control to ensure secure operations. This contract is specifically designed to interact with the **WrappedM** token while enforcing access control through a **Registry Access Contract**. Key features include wrapping, unwrapping, minting, and pausing operations. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#contract-summary) Contract Summary **UsualM** is an ERC-20 token with additional features that provide security and operational flexibility. It integrates with OpenZeppelin upgradeable modules for pausability and permit-based approvals. Moreover, it enforces blacklist restrictions to prevent interactions with malicious or sanctioned addresses and limits the maximum supply via a configurable mint cap. #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#inherited-contracts) **Inherited Contracts** * **ERC20PausableUpgradeable**: Enables pausability of token transfers, ensuring operations can be halted in emergencies. * **ERC20PermitUpgradeable**: Supports gasless approvals through EIP-2612 signatures, enabling off-chain approval of token transfers. * **ERC20Upgradeable**: Provides the core ERC-20 token implementation. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#public-external-functions) Public/External Functions * **wrap(address recipient, uint256 amount):** Wraps the specified amount of **WrappedM** tokens into **UsualM** tokens for the `recipient`. * **wrapWithPermit(address recipient, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s):** Wraps **WrappedM** tokens using a permit signature for approval, enabling gasless wrapping. * **unwrap(address recipient, uint256 amount):** Unwraps **UsualM** tokens into **WrappedM** tokens, subject to role checks on the caller. * **setMintCap(uint256 newMintCap):** Updates the mint cap for the token. Callable only by accounts with the `USUAL_M_MINTCAP_ALLOCATOR` role. * **pause():** Pauses all token transfers. Callable only by accounts with the `USUAL_M_PAUSE` role. * **unpause():** Resumes all token transfers. Callable only by accounts with the `USUAL_M_UNPAUSE` role. * **blacklist(address account):** Blacklists an address, preventing it from interacting with the token. Callable only by accounts with the `BLACKLIST_ROLE`. * **unBlacklist(address account):** Removes an address from the blacklist. Callable only by accounts with the `BLACKLIST_ROLE`. [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#functionality-breakdown) Functionality Breakdown --------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#sc-flows) SC-Flows #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#key-functionalities) Key Functionalities * **Wrapping:** Users can wrap **WrappedM** tokens into **UsualM**, making use of enhanced token features. * **Unwrapping:** Users can unwrap **UsualM** tokens back into **WrappedM**, subject to role checks. * **Mint Cap Enforcement:** Ensures that the total supply of **UsualM** tokens does not exceed the configured mint cap. * **Blacklist Enforcement:** Prevents blacklisted addresses from participating in token transfers. * **Pausability:** Allows administrators to halt all token transfers during emergencies. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#constants) Constants * **USUAL\_M\_UNWRAP:** Role required to unwrap tokens. * **USUAL\_M\_PAUSE:** Role required to pause the contract. * **USUAL\_M\_UNPAUSE:** Role required to unpause the contract. * **USUAL\_M\_MINTCAP\_ALLOCATOR:** Role required to update the mint cap. * **BLACKLIST\_ROLE:** Role required to blacklist/unblacklist accounts. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#safeguards-implementation) Safeguards Implementation * **Pausability:** The contract integrates pausability to ensure all token transfers can be halted in emergencies. Only accounts with the appropriate roles can pause/unpause the contract. * **Role-Based Access Control:** Sensitive operations such as pausing, unwrapping, blacklisting, and updating the mint cap are restricted to accounts with specific roles. This ensures that only authorized entities can perform these operations. * **Mint Cap Enforcement:** The total supply of **UsualM** tokens is capped by a configurable limit, ensuring supply control. * **Blacklist Enforcement:** The contract prevents interactions with blacklisted addresses, safeguarding the token economy from malicious actors. [PreviousM by M0chevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0) [NextUSDtb by Ethenachevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#contract-summary) * [Functions Description](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#functions-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#functionality-breakdown) * [SC-Flows](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#sc-flows) * [Constants](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0/usualm#safeguards-implementation) Was this helpful? --- # USD0a | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#high-level-overview) High-Level Overview The USD0a contract is designed to manage the USD0a ERC20 Token, implementing functionalities for minting, burning, transfer operations, and value accounting while incorporating blacklist checks to restrict these operations to authorized addresses. USD0a is a yield-bearing token that represents a proportional share of the total value of underlying collateral assets. The token's price in USD depends on the prices of the underlying collateral tokens and the total supply of USD0a. USD0a value increases based on the increased value of the underlying collateral assets. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#contract-summary) Contract Summary USD0a is an ERC-20 compliant token that integrates additional security, access control, and value accounting features to enhance its governance and usability. It inherits functionalities from `ERC20PausableUpgradeable` and `ERC20PermitUpgradeable` to support permit-based approvals and pausability. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#key-characteristics) Key Characteristics * **Dynamic Pricing**: The price of USD0a in USD is calculated based on the total value of collateral backing divided by the total supply. The price depends on the prices of the underlying collateral tokens (as provided by the oracle) and the total supply of USD0a. Changes in collateral prices or supply will affect the USD0a price accordingly. * **Collateral Backing**: USD0a tokens are backed by collateral tokens (such as USCC, USTB, and USDC) held in the collateral treasury. The price reflects the ratio of total collateral value to total supply. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#minting-usd0a) Minting USD0a Users can swap their collateral tokens via the DaoCollateral contract to mint an equivalent amount of USD0a. The minting process is subject to several checks: * The amount must not exceed the current mint cap * The caller must have the `USD0X_MINT` role * The recipient address must not be blacklisted The amount of USD0a minted is calculated based on the current USD0a price in USD, which depends on the prices of the underlying collateral tokens and the total supply. The price reflects the current ratio of total collateral value to total supply. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#redeeming-usd0a) Redeeming USD0a Users can swap any USD0a back to the underlying collateral tokens at any time via the DaoCollateral contract, burning the USD0a in the process. The redemption process includes a configurable fee to prevent oracle manipulation attacks. When redeeming, users receive collateral tokens based on the current USD0a price in USD, which reflects the current value of the underlying collateral assets. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#regulatory-compliance) Regulatory Compliance The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract, and the list is kept up to date. Blacklisted addresses cannot send or receive USD0a tokens. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#price-calculation) Price Calculation The USD0a price in USD is calculated dynamically based on the total value of collateral backing divided by the total supply. The price depends on two main factors: 1. **Collateral Prices**: The prices of the underlying collateral tokens (as provided by the oracle) 2. **Total Supply**: The total number of USD0a tokens in circulation **Price Calculation:** * The contract retrieves all collateral tokens from the TokenMapping contract * For each collateral token, it calculates the USD value: `balance × price` (where price comes from the oracle) * Sums all collateral USD values to get total collateral backing * Divides total collateral backing by total supply to get the price per USD0a token **Price Formula:** The price can increase or decrease depending on: * Changes in collateral token prices (as reported by the oracle) * Changes in total supply (from minting or burning) * Changes in collateral backing (from deposits or withdrawals) The price can be retrieved with either floor or ceiling rounding using the `getUsd0xPriceInUSD()` function. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#key-functionalities) Key Functionalities * **Minting**: Tokens can be minted to a non-blacklisted address, subject to role checks and mint cap requirements. * **Burning**: Tokens can be burned from an address, subject to role checks. * **Transfers**: Only non-blacklisted addresses can send or receive tokens. * **Harvest Mechanism:** The harvest function calculates the amount to mint based on the configured Annual Percentage Yield (APY) and daily harvest fee, reflecting the value that has been generated by the underlying collateral assets. Harvest can only be executed once per day (enforced by `HARVEST_FREQUENCY`). * **Mint Cap Management**: The contract implements a mint cap that can be adjusted by authorized roles. * **Value Accounting**: The contract implements a harvest mechanism that accounts for increased collateral value by minting USD0a tokens to the yield treasury based on configured APY and daily harvest fee. * **Dynamic Pricing**: The contract calculates the USD0a price in USD based on collateral backing and total supply. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#publicexternal-functions) Public/External Functions * `**pause()**`: Pauses all token transfer operations; callable only by the `PAUSING_CONTRACTS_ROLE`. * `**unpause()**`: Resumes all token transfer operations; callable only by the `UNPAUSING_CONTRACTS_ROLE`. * `**mint(address to, uint256 amount)**`: Mints tokens to a non-blacklisted address if the caller has the `USD0X_MINT` role and the mint cap is not exceeded. * `**burn(uint256 amount)**` and `**burnFrom(address account, uint256 amount)**`: Burns tokens from an address, requiring the `USD0X_BURN` role. * `**setMintCap(uint256 newMintCap)**`: Updates the maximum amount of USD0a that can be minted; callable only by the `MINT_CAP_OPERATOR` role. The new mint cap must be greater than or equal to the current total supply. * `**getMintCap()**`: Returns the current mint cap for USD0a. * `**blacklist(address account)**` and `**unblacklist(address account)**`: Allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the `BLACKLIST_ROLE`. * `**isBlacklisted(address account)**`: Checks if an address is blacklisted. * `**harvest()**`: Only callable by `USD0X_HARVEST_OPERATOR_ROLE`. Can only be called once per day (enforced by `HARVEST_FREQUENCY`). * `**setDailyHarvestFee(uint256 newDailyHarvestFee)**`: Sets the daily harvest fee (in basis points). Only callable by `USD0X_HARVEST_FEE_OPERATOR_ROLE`. Maximum allowed is 25% (2500 basis points). * `**setAnnualPercentageYield(uint256 newAnnualPercentageYield)**`: Sets the annual percentage yield (in basis points). Only callable by `USD0X_HARVEST_APY_OPERATOR_ROLE`. Maximum allowed is 100% (10000 basis points). * `**getUsd0xPriceInUSD(bool roundingUp)**`: Returns the USD price of 1 USD0a token based on collateral backing. The price is calculated as total collateral value divided by total supply. Can return with floor or ceiling rounding. * `**getDailyHarvestFee()**`: Returns the current daily harvest fee in basis points. * `**getAnnualPercentageYield()**`: Returns the current annual percentage yield in basis points. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#role-based-access-control) Role-Based Access Control The contract implements several roles for different operations: * **USD0X\_MINT**: Required for minting new tokens * **USD0X\_BURN**: Required for burning tokens * **BLACKLIST\_ROLE**: Required for managing the blacklist * **MINT\_CAP\_OPERATOR**: Required for adjusting the mint cap * **PAUSING\_CONTRACTS\_ROLE**: Required for pausing the contract * **UNPAUSING\_CONTRACTS\_ROLE**: Required for unpausing the contract * **USD0X\_HARVEST\_OPERATOR\_ROLE**: Required for executing the harvest function * **USD0X\_HARVEST\_FEE\_OPERATOR\_ROLE**: Required for setting the daily harvest fee * **USD0X\_HARVEST\_APY\_OPERATOR\_ROLE**: Required for setting the annual percentage yield ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of all token transfers in emergencies * **Blacklist**: Prevents sanctioned addresses from interacting with the token * **Mint Cap**: Limits the maximum supply of USD0a * **Role-Based Access**: Restricts sensitive operations to authorized roles * **Harvest Frequency Limit**: Prevents harvest from being called too frequently (minimum 1 day - 60 seconds between harvests) * **Harvest Fee Limits**: Maximum daily harvest fee is capped at 25% (2500 basis points) * **APY Limits**: Maximum annual percentage yield is capped at 100% (10000 basis points) * **Mint Cap Validation**: Ensures new mint cap is not smaller than current total supply ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usd0a#key-components) Key Components * **Oracle Integration**: Uses an oracle to fetch real-time price data for collateral tokens when calculating USD0a price. * **Token Mapping**: Manages the list of supported collateral tokens through the TokenMapping contract. * **Access Control**: Implements role-based access control for administrative functions through the RegistryAccess contract. * **Yield Treasury**: Receives minted USD0a tokens from the harvest mechanism, which accounts for increased collateral value and benefits all USD0a holders proportionally. * **Collateral Treasury**: Holds the collateral tokens that back USD0a tokens [PreviousbUSD0 (formerly USD0++)chevron-left](https://tech.usual.money/smart-contracts/token-contracts/usd0++) [NextETH0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/eth0) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usd0a#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usd0a#contract-summary) * [Minting USD0a](https://tech.usual.money/smart-contracts/token-contracts/usd0a#minting-usd0a) * [Redeeming USD0a](https://tech.usual.money/smart-contracts/token-contracts/usd0a#redeeming-usd0a) * [Regulatory Compliance](https://tech.usual.money/smart-contracts/token-contracts/usd0a#regulatory-compliance) * [Price Calculation](https://tech.usual.money/smart-contracts/token-contracts/usd0a#price-calculation) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usd0a#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/usd0a#functions-description) * [Role-Based Access Control](https://tech.usual.money/smart-contracts/token-contracts/usd0a#role-based-access-control) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/token-contracts/usd0a#safeguards-implementation) * [Key Components](https://tech.usual.money/smart-contracts/token-contracts/usd0a#key-components) Was this helpful? Copy USD0a Price = Total Collateral Value / Total Supply --- # Protocol Contracts | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FiZANt6QS7u1XwcZPiH4x%252FPage%2520Cover%252005.png%3Falt%3Dmedia%26token%3D9108bba3-b5a8-4ec1-8e9d-5e61429ef577&width=1248&dpr=3&quality=100&sign=c444e57e&sv=2) [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FQqjDcoSOp61dTfCNxQJt%252FUSD0%2520contracts.png%3Falt%3Dmedia%26token%3Da07e36c5-013a-4844-bf3a-2bda14d0aea3&width=752&dpr=3&quality=100&sign=3c35e15e&sv=2) **Contracts that power USD0** [](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FqKa2lQMESvzUV8vKwrqi%252FCard%2520Cover%252003.png%3Falt%3Dmedia%26token%3Dd62ccbd0-a163-418b-83d4-ebee158a08f9&width=752&dpr=3&quality=100&sign=6aa67ce0&sv=2) **Contracts that power USD0a** [](https://tech.usual.money/smart-contracts/protocol-contracts/eth0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FkIAr6o24CcXZt8bvmlbc%252FETH0%2520contracts.png%3Falt%3Dmedia%26token%3D3ee8121d-912e-4d46-824e-6549a5fc111d&width=752&dpr=3&quality=100&sign=f33430ee&sv=2) **Contracts that power ETH0** [](https://tech.usual.money/smart-contracts/protocol-contracts/eur0) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FJ05Aqkh2J0RiONORdSyF%252FCard%2520Cover%2520131.png%3Falt%3Dmedia%26token%3D3419081d-6f33-4d8b-86de-67bb8ece0f41&width=752&dpr=3&quality=100&sign=6c93f0d1&sv=2) **Contracts that power EUR0** [](https://tech.usual.money/smart-contracts/protocol-contracts/usual) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FNWP3EmzMJTdxXUovkOvc%252FUSUAL%2520contracts.png%3Falt%3Dmedia%26token%3Ddb01bd20-a0bb-416f-a213-bc111cc886e2&width=752&dpr=3&quality=100&sign=eba765d7&sv=2) **Contracts that power USUAL** [PreviousUSUAL Distribution Modelchevron-left](https://tech.usual.money/overview/architecture/usual-distribution-model) [NextUSD0chevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0) Last updated 4 months ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # ETH0 | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------- The ETH0 contract is designed to manage the ETH0 ERC20 Token, implementing functionalities for minting, burning, and transfer operations while incorporating blacklist checks to restrict these operations to authorized addresses. The total ETH0 supply is collateralized with at minimum 1:1 in collateral tokens, ensuring the stability and security of the protocol. [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#contract-summary) Contract Summary --------------------------------------------------------------------------------------------------------------- ETH0 is an ERC-20 compliant token that integrates additional security and access control features to enhance its governance and usability. It inherits functionalities from ERC20PausableUpgradable and ERC20PermitUpgradeable to support permit-based approvals and pausability. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#minting-eth0) Minting ETH0 Users can swap their collateral tokens via the DaoCollateral contract to mint an equivalent amount of ETH0. The minting process is subject to several checks: * The amount must not exceed the current mint cap * The total supply after minting must not exceed the total collateral backing * The caller must have the ETH0\_MINT role ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#redeeming-eth0) Redeeming ETH0 Users can swap any ETH0 back to the underlying collateral tokens at any time via the DaoCollateral contract, burning the ETH0 in the process. The redemption process includes a configurable fee to prevent oracle manipulation attacks. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#regulatory-compliance) Regulatory Compliance The contract includes a blacklist feature to ensure regulatory compliance. Sanctioned addresses are prevented from interacting with the contract, and the list is kept up to date. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#collateralization-enforcement) Collateralization Enforcement Minting of ETH0 is only possible if the total collateral backing equals or exceeds the ETH0 totalSupply(). The contract verifies this by: * Checking the balance of all collateral tokens in the treasury * Converting collateral amounts to ETH using oracle prices * Ensuring the total collateral value in ETH exceeds the new total supply ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#functionality-breakdown) Functionality Breakdown Key Functionalities * **Minting**: Tokens can be minted to an address, subject to role checks and collateralization requirements. * **Burning**: Tokens can be burned from an address, subject to role checks. * **Transfers**: Only non-blacklisted addresses can send or receive tokens. * **Mint Cap Management**: The contract implements a mint cap that can be adjusted by authorized roles. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#functions-description) Functions Description Public/External Functions * `pause()`: Pauses all token transfer operations; callable only by the PAUSING\_CONTRACTS\_ROLE. * `unpause()`: Resumes all token transfer operations; callable only by the UNPAUSING\_CONTRACTS\_ROLE. * `mint(address to, uint256 amount)`: Mints tokens to a non-blacklisted address if the caller has the ETH0\_MINT role and collateralization requirements are met. * `burn(uint256 amount)` and `burnFrom(address account, uint256 amount)`: Burns tokens from an address, requiring the ETH0\_BURN role. * `setMintCap(uint256 newMintCap)`: Updates the maximum amount of ETH0 that can be minted; callable only by the MINT\_CAP\_OPERATOR role. * `getMintCap()`: Returns the current mint cap for ETH0. * `blacklist(address account)` and `unBlacklist(address account)`: Allows the admin to blacklist or remove from blacklist malicious users from using this token. Only callable by the BLACKLIST\_ROLE. * `isBlacklisted(address account)`: Checks if an address is blacklisted. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#role-based-access-control) Role-Based Access Control The contract implements several roles for different operations: * `ETH0_MINT`: Required for minting new tokens * `ETH0_BURN`: Required for burning tokens * `BLACKLIST_ROLE`: Required for managing the blacklist * `MINT_CAP_OPERATOR`: Required for adjusting the mint cap * `PAUSING_CONTRACTS_ROLE`: Required for pausing the contract * `UNPAUSING_CONTRACTS_ROLE`: Required for unpausing the contract ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/eth0#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of all token transfers in emergencies * **Blacklist**: Prevents sanctioned addresses from interacting with the token * **Mint Cap**: Limits the maximum supply of ETH0 * **Collateralization Check**: Ensures ETH0 remains fully backed by collateral * **Role-Based Access**: Restricts sensitive operations to authorized roles [PreviousUSD0achevron-left](https://tech.usual.money/smart-contracts/token-contracts/usd0a) [NextEUR0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/eur0) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/eth0#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/eth0#contract-summary) * [Minting ETH0](https://tech.usual.money/smart-contracts/token-contracts/eth0#minting-eth0) * [Redeeming ETH0](https://tech.usual.money/smart-contracts/token-contracts/eth0#redeeming-eth0) * [Regulatory Compliance](https://tech.usual.money/smart-contracts/token-contracts/eth0#regulatory-compliance) * [Collateralization Enforcement](https://tech.usual.money/smart-contracts/token-contracts/eth0#collateralization-enforcement) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/eth0#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/token-contracts/eth0#functions-description) * [Role-Based Access Control](https://tech.usual.money/smart-contracts/token-contracts/eth0#role-based-access-control) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/token-contracts/eth0#safeguards-implementation) Was this helpful? --- # EUR0 DaoCollateral | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#daocollateral-contract-documentation) DaoCollateral Contract Documentation ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#high-level-overview) High-Level Overview The DaoCollateral contract is a fundamental component of the EUR0 ecosystem, designed to manage the collateralization, minting, and redemption of EUR0 tokens. It ensures that the circulating supply of EUR0 is always fully backed by Euro-denominated collateral, providing transparency and security for EUR0 holders. The contract facilitates the swapping of Euro collateral tokens for EUR0, redemption of EUR0 for Euro collateral tokens, and implements a Counter Bank Run (CBR) mechanism for emergency situations. Additionally, it provides advanced functionality for intent-based trading and integration with the SwapperEngine for EURC trading. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#inherited-contracts) Inherited Contracts * **ReentrancyGuardUpgradeable (OZ)**: Prevents reentrant attacks on sensitive functions. * **PausableUpgradeable (OZ)**: Enables pausing of contract functionality by authorized accounts. * **EIP712Upgradeable (OZ)**: Implements EIP-712 for structured data hashing and signing. * **NoncesUpgradeable**: Manages nonce-based operations for intent matching and replay protection. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#key-functionalities) Key Functionalities **1\. Basic Token Operations** * **Minting and redeeming EUR0**: The contract manages the collateralization of EUR0 by handling Euro-denominated collateral tokens. When a user sends Euro collateral, the DaoCollateral contract mints the equivalent amount of EUR0 stablecoins, and vice versa, allowing users to exchange their EUR0 stablecoins for Euro collateral at the current exchange rate. **2\. Swap Operations** * **swap**: Facilitates the conversion of Euro collateral into EUR0. Upon initiating this function, users exchange their Euro collateral tokens for EUR0 stablecoins directly. * **swapWithPermit**: Similar to swap but uses ERC20Permit for gasless approval, allowing users to approve token transfers without a separate transaction. **3\. Redemption Operations** * **redeem**: Allows users to redeem their EUR0 stablecoins for Euro collateral against a fee. By invoking this function, users exchange their EUR0 stablecoins for Euro collateral at the current exchange rate. * **redeemDao**: Special redemption function for DAO operations that bypasses fees. Only callable by accounts with DAO\_REDEMPTION\_ROLE. **4\. Advanced Trading Features** * **swapCollateralTokenToEurc**: Enables users to swap collateral tokens directly for EURC through the SwapperEngine. This function mints EUR0 internally and uses it to fulfill EURC orders on the SwapperEngine. * **swapCollateralTokenToEurcIntent**: Advanced intent-based trading system that allows pre-signed orders to be executed by authorized parties. This enables gasless trading and more sophisticated trading strategies. **5\. Intent Management System** * **Intent-based Trading**: The contract implements a sophisticated intent system where users can pre-sign trading instructions that can be executed by authorized parties (INTENT\_MATCHING\_ROLE). * **Nonce Management**: Users can invalidate nonces to cancel pending intents or invalidate ranges of nonces for bulk cancellation. * **Partial Matching**: Intents support partial fulfillment, allowing large orders to be filled incrementally. **6\. Counter Bank Run (CBR) Mechanism** The contract implements a Counter Bank Run mechanism that can be activated in emergency situations. When activated: * The CBR coefficient is applied to reduce the amount of collateral returned during redemptions * Swap functionality is automatically paused * The system helps maintain protocol stability during market stress #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#role-based-access-control) Role-Based Access Control The contract implements a comprehensive role-based access control system for sensitive operations: * **DEFAULT\_ADMIN\_ROLE**: Has the highest level of access, including the ability to manage CBR parameters and perform critical administrative tasks. * **DAO\_REDEMPTION\_ROLE**: Required for special DAO redemption operations. * **PAUSING\_CONTRACTS\_ROLE**: Grants the ability to pause specific contract functionalities in case of emergencies. * **UNPAUSING\_CONTRACTS\_ROLE**: Grants the ability to unpause contract functionalities. * **NONCE\_THRESHOLD\_SETTER\_ROLE**: Allows setting the nonce threshold for intent consumption. * **INTENT\_MATCHING\_ROLE**: Required for executing intent-based trades on behalf of users. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#public-external-functions) Public/External Functions **Initialization** * **initialize**: Sets up the contract with initial parameters including registry information and redeem fee. **Basic Trading Functions** * **swap**: Allows users to swap Euro collateral tokens for EUR0. * **swapWithPermit**: Similar to swap but uses permit for approval. * **redeem**: Enables users to redeem EUR0 for Euro collateral tokens. * **redeemDao**: Special redemption function for DAO operations. Only callable by DAO\_REDEMPTION\_ROLE. **Advanced Trading Functions** * **swapCollateralTokenToEurc**: Swaps collateral tokens for EURC through the SwapperEngine with order matching. * **swapCollateralTokenToEurcIntent**: Executes intent-based trades for collateral token to EURC swaps. **Intent Management** * **invalidateNonce**: Invalidates the current nonce for the message sender. * **invalidateUpToNonce**: Invalidates all nonces up to a specified value for the message sender. **Administrative Functions** * **activateCBR**: Activates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * **deactivateCBR**: Deactivates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * **setRedeemFee**: Sets the fee for redemption operations. Only callable by DEFAULT\_ADMIN\_ROLE. * **setNonceThreshold**: Sets the threshold for intent consumption. Only callable by NONCE\_THRESHOLD\_SETTER\_ROLE. **Pausing Functions** * **pauseRedeem, pause, pauseSwap**: Pausing functions for specific operations. Only callable by PAUSING\_CONTRACTS\_ROLE. * **unpause, unpauseRedeem, unpauseSwap**: Global unpausing functions. Only callable by UNPAUSING\_CONTRACTS\_ROLE. **View Functions** * **redeemFee**: Returns the current redemption fee. * **isCBROn**: Returns whether the Counter Bank Run mechanism is active. * **cbrCoef**: Returns the current CBR coefficient. * **isRedeemPaused**: Returns whether redeem functionality is paused. * **isSwapPaused**: Returns whether swap functionality is paused. * **nonceThreshold**: Returns the current nonce threshold for intent consumption. * **orderAmountTakenCurrentNonce**: Returns the amount of tokens taken for the current nonce of an address. * **DOMAIN\_SEPARATOR**: Returns the EIP712 domain separator for signature verification. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#data-structures) Data Structures #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#approval) Approval #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#intent) Intent ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#constants) Constants #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#contract-addresses) Contract Addresses * `**CONTRACT_REGISTRY_ACCESS**`: Address of the registry access contract. * `**CONTRACT_TOKEN_MAPPING**`: Address of the token mapping contract. * `**CONTRACT_ORACLE**`: Address of the oracle contract. * `**CONTRACT_TREASURY**`: Address of the treasury contract. * `**CONTRACT_EUR0**`: Address of the EUR0 token contract. * `**CONTRACT_YIELD_TREASURY**`: Address of the yield treasury contract. * `**CONTRACT_SWAPPER_ENGINE**`: Address of the swapper engine contract. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#role-identifiers) Role Identifiers * `**DEFAULT_ADMIN_ROLE**`: Role identifier for the default admin. * `**DAO_REDEMPTION_ROLE**`: Role identifier for DAO redemption operations. * `**PAUSING_CONTRACTS_ROLE**`: Role identifier for pausing contract operations. * `**UNPAUSING_CONTRACTS_ROLE**`: Role identifier for unpausing contract operations. * `**NONCE_THRESHOLD_SETTER_ROLE**`: Role identifier for setting nonce thresholds. * `**INTENT_MATCHING_ROLE**`: Role identifier for executing intent-based trades. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#fee-and-calculation-constants) Fee and Calculation Constants * `**MAX_REDEEM_FEE**`: Maximum allowed redemption fee (25%). * `**BASIS_POINT_BASE**`: Base value for basis point calculations (10000). * `**SCALAR_ONE**`: Scalar value representing 1 in the contract's decimal system. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#intent-system-constants) Intent System Constants * `**INTENT_TYPE_HASH**`: EIP712 type hash for intent signatures. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#key-components) Key Components #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#oracle-integration) Oracle Integration Uses an oracle to fetch real-time price data for Euro collateral tokens. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#token-mapping) Token Mapping Manages the mapping of supported Euro collateral tokens using `isEur0Collateral()` function. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#access-control) Access Control Implements comprehensive role-based access control for administrative functions and intent execution. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#treasury-management) Treasury Management Handles the storage and distribution of Euro collateral tokens across multiple treasuries. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#swapperengine-integration) SwapperEngine Integration Provides seamless integration with the SwapperEngine for advanced trading operations and EURC trading. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#intent-system) Intent System Implements a sophisticated intent-based trading system with: * Pre-signed order execution * Partial order fulfillment * Nonce-based replay protection * Gasless trading capabilities ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#safeguards-implementation) Safeguards Implementation #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#pausability) Pausability Allows pausing of critical functions in emergencies with granular control over different functionalities. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#reentrancy-protection) Reentrancy Protection Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#access-control-1) Access Control Restricts sensitive operations to authorized roles with comprehensive role management. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#cbr-mechanism) CBR Mechanism Implements a Counter Bank Run mechanism for emergency situations with configurable coefficients. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#fee-management) Fee Management Implements a configurable redemption fee system with a maximum cap of 25%. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#intent-security) Intent Security * Signature verification using EIP712 * Nonce-based replay protection * Deadline enforcement * Partial matching with threshold-based consumption ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#events) Events The contract emits various events for tracking operations: * **Swap**: Emitted when tokens are swapped * **Redeem**: Emitted when tokens are redeemed * **IntentMatched**: Emitted when an intent is matched * **IntentConsumed**: Emitted when an intent is fully consumed * **NonceInvalidated**: Emitted when nonces are invalidated * **CBRActivated/CBRDeactivated**: Emitted when CBR mechanism is activated/deactivated * **RedeemFeeUpdated**: Emitted when redeem fee is updated * **NonceThresholdSet**: Emitted when nonce threshold is set * **RedeemPaused/RedeemUnPaused**: Emitted when redeem functionality is paused/unpaused * **SwapPaused/SwapUnPaused**: Emitted when swap functionality is paused/unpaused [PreviousEUR0chevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eur0) [NextEUR0 SwapperEnginechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine) Last updated 7 months ago Was this helpful? * [DaoCollateral Contract Documentation](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#daocollateral-contract-documentation) * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#functions-description) * [Data Structures](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#data-structures) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#constants) * [Key Components](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#key-components) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#safeguards-implementation) * [Events](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-daocollateral#events) Was this helpful? Copy struct Approval { uint256 deadline; uint8 v; // Changes at each new signature because of ERC20 Permit nonce bytes32 r; bytes32 s; } Copy struct Intent { address recipient; address rwaToken; uint256 amountInTokenDecimals; uint256 deadline; bytes signature; } --- # USYC by Hashnote | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote#who-is-hashnote) Who is Hashnote? -------------------------------------------------------------------------------------------------------------------------- Hashnote is a regulated asset manager providing both US and International investors with customizable digital asset exposure. More on [Hashnotearrow-up-right](https://www.hashnote.com/) . [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote#what-is-usyc) What is USYC? -------------------------------------------------------------------------------------------------------------------- USYC is the on-chain representation of the Hashnote International Short Duration Yield Fund Ltd. ("SDYF"). SDYF invests primarily in reverse repo and U.S. Government backed securities. More on [USYCarrow-up-right](https://usyc.hashnote.com/) . [PreviousUSD0 Collateralchevron-left](https://tech.usual.money/smart-contracts/usd0-collateral) [NextM by M0chevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/m-by-m0) Last updated 1 year ago Was this helpful? * [Who is Hashnote?](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote#who-is-hashnote) * [What is USYC?](https://tech.usual.money/smart-contracts/usd0-collateral/usyc-by-hashnote#what-is-usyc) Was this helpful? --- # ETH0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FPiKhLpHnm2JN83KcxZQ3%252FCard%2520Cover%2520112.png%3Falt%3Dmedia%26token%3D7bb44bb7-e23c-4c3f-a2fe-a9c743aac789&width=752&dpr=3&quality=100&sign=115dfa5c&sv=2) **What is the ETH0 ClassicalOracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FdZQdOntFprovNyYWRc06%252FCard%2520Cover%2520113.png%3Falt%3Dmedia%26token%3De5d60474-3590-4bb0-8e98-47bda9a2e735&width=752&dpr=3&quality=100&sign=25ad24bb&sv=2) **What is the ETH0 Abstract Oracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fcy4ZV332211Uu7I1fnSp%252FCard%2520Cover%2520114.png%3Falt%3Dmedia%26token%3D37242e89-cc95-41ca-a6b1-206b3682bdc9&width=752&dpr=3&quality=100&sign=fd7253f5&sv=2) **What is the Lido wstETH Oracle about?** [PreviousDebtUSCC Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle) [NextETH0 Classical Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle) Last updated 7 months ago Was this helpful? Was this helpful? --- # UsualUSDtb | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------------------- The **UsualUSDTB** smart contract manages the **UsualUSDTB** ERC20 Token and acts as a wrapped version of the **USDTB** token. It allows users to wrap **USDTB** tokens into **UsualUSDTB**, adding enhanced functionality such as pausability, blacklist enforcement, and mint cap restrictions. It also supports permits and implements role-based access control to ensure secure operations. This contract is specifically designed to interact with the **USDTB** token while enforcing access control through a Registry Access Contract. Key features include wrapping, unwrapping, minting, and pausing operations. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#contract-summary) Contract Summary **UsualUSDTB** is an ERC-20 token with additional features that provide security and operational flexibility. It integrates with OpenZeppelin upgradeable modules for pausability and permit-based approvals. Moreover, it enforces blacklist restrictions to prevent interactions with malicious or sanctioned addresses and limits the maximum supply via a configurable mint cap. #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#inherited-contracts) **Inherited Contracts** * **ERC20PausableUpgradeable**: Enables pausability of token transfers, ensuring operations can be halted in emergencies. * **ERC20PermitUpgradeable**: Supports gasless approvals through EIP-2612 signatures, enabling off-chain approval of token transfers. * **ERC20Upgradeable**: Provides the core ERC-20 token implementation. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#public-external-functions) Public/External Functions * **wrap(address recipient, uint256 amount)**: Wraps the specified amount of **USDTB** tokens into **UsualUSDTB** tokens for the recipient. * **wrapWithPermit(address recipient, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)**: Wraps **USDTB** tokens using a permit signature for approval, enabling gasless wrapping. * **unwrap(address recipient, uint256 amount)**: Unwraps **UsualUSDTB** tokens into **USDTB** tokens, subject to role checks on the caller. * **setMintCap(uint256 newMintCap)**: Updates the mint cap for the token. Callable only by accounts with the **USUAL\_USDTB\_MINTCAP\_ALLOCATOR** role. * **pause()**: Pauses all token transfers. Callable only by accounts with the **USUAL\_USDTB\_PAUSE** role. * **unpause()**: Resumes all token transfers. Callable only by accounts with the **USUAL\_USDTB\_UNPAUSE** role. * **blacklist(address account)**: Blacklists an address, preventing it from interacting with the token. Callable only by accounts with the **BLACKLIST\_ROLE**. * **unBlacklist(address account)**: Removes an address from the blacklist. Callable only by accounts with the **BLACKLIST\_ROLE**. [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#functionality-breakdown) Functionality Breakdown --------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#sc-flows) SC-Flows ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fwsd9ZWSfMsEZtV00x5Ov%252Fimage.png%3Falt%3Dmedia%26token%3D7cb65d60-ab6a-4405-8277-b175b9d8d6af&width=768&dpr=3&quality=100&sign=48f56938&sv=2) #### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#key-functionalities) Key Functionalities * **Wrapping**: Users can wrap **USDTB** tokens into **UsualUSDTB**, making use of enhanced token features. * **Unwrapping**: Users can unwrap **UsualUSDTB** tokens back into **USDTB**, subject to role checks. * **Mint Cap Enforcement**: Ensures that the total supply of **UsualUSDTB** tokens does not exceed the configured mint cap. * **Blacklist Enforcement**: Prevents blacklisted addresses from participating in token transfers. * **Pausability**: Allows administrators to halt all token transfers during emergencies. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#constants) Constants * **USUAL\_USDTB\_UNWRAP**: Role required to unwrap tokens. * **USUAL\_USDTB\_PAUSE**: Role required to pause the contract. * **USUAL\_USDTB\_UNPAUSE**: Role required to unpause the contract. * **USUAL\_USDTB\_MINTCAP\_ALLOCATOR**: Role required to update the mint cap. * **BLACKLIST\_ROLE**: Role required to blacklist/unblacklist accounts. * **USUAL\_USDTB\_DECIMALS**: Set to 18 decimals for the token. ### [hashtag](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#safeguards-implementation) Safeguards Implementation * **Pausability**: The contract integrates pausability to ensure all token transfers can be halted in emergencies. Only accounts with the appropriate roles can pause/unpause the contract. * **Role-Based Access Control**: Sensitive operations such as pausing, unwrapping, blacklisting, and updating the mint cap are restricted to accounts with specific roles. This ensures that only authorized entities can perform these operations. * **Mint Cap Enforcement**: The total supply of **UsualUSDTB** tokens is capped by a configurable limit, ensuring supply control. * **Blacklist Enforcement**: The contract prevents interactions with blacklisted addresses, safeguarding the token economy from malicious actors. * **Safe Type Conversion**: The contract includes \_safe96() function to safely convert uint256 to uint96 for mint cap storage, preventing overflow issues. [PreviousUSDtb by Ethenachevron-left](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena) [NextUSDC by Circlechevron-right](https://tech.usual.money/smart-contracts/usd0-collateral/usdc-by-circle) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#contract-summary) * [Functions Description](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#functions-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#functionality-breakdown) * [SC-Flows](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#sc-flows) * [Constants](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/usd0-collateral/usdtb-by-ethena/usualusdtb#safeguards-implementation) Was this helpful? --- # USD0a | Usual Tech Docs [](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FnxRZMlYenVwH08AP26dM%252FCard%2520Cover%252013.png%3Falt%3Dmedia%26token%3D8c5a37c4-cc21-4ecd-9516-d85a3e8f6371&width=752&dpr=3&quality=100&sign=f74b204&sv=2) **What is the ClassicalOracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F455vOgDTSpIkUzfOEh31%252Fdebtusdc.png%3Falt%3Dmedia%26token%3D3947e60a-77f8-4d14-8790-8220e8367771&width=752&dpr=3&quality=100&sign=70047ab0&sv=2) What is the DebtUSDC Oracle? [](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FjtfuiW0Au5h62nTstxso%252Fdebtuscc.png%3Falt%3Dmedia%26token%3D91d81572-516f-459a-a5aa-95d238812dc6&width=752&dpr=3&quality=100&sign=b2072985&sv=2) What is the DebtUSCC Oracle? [PreviousPyth Oracleschevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles) [NextUSD0a Classical Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/usd0a-classical-oracle) Last updated 1 month ago Was this helpful? Was this helpful? --- # USUAL | Usual Tech Docs [](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F6LsKaI3pC3KZ4HxtlB2S%252FCard%2520Cover%252049.png%3Falt%3Dmedia%26token%3Dee0abf2e-ceb3-4a22-b24a-04d906d901a3&width=752&dpr=3&quality=100&sign=69dfe5b9&sv=2) **USUAL Staking Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252Fu8LquPbOsJlW5LSx61Im%252FCard%2520Cover%252050.png%3Falt%3Dmedia%26token%3De80f2230-a654-49e9-872f-afa03b0aea43&width=752&dpr=3&quality=100&sign=741d95f4&sv=2) **USUAL\* Vested Allocation Staking Smart Contract** [](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FEy064RKliOtKB8UKksFZ%252FCard%2520Cover%252011.png%3Falt%3Dmedia%26token%3Df19a57bf-580f-4bd9-b08d-bd35480ecece&width=752&dpr=3&quality=100&sign=a5427cd9&sv=2) **USUAL Distribution Smart Contracts** [](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FYADsexfbfZOsbA0OPNcO%252FCard%2520Cover%2520120.png%3Falt%3Dmedia%26token%3D6dc7f878-f7ca-469e-847f-96a89acf9cf2&width=752&dpr=3&quality=100&sign=9a7770a0&sv=2) USUALX Lockup Contract [PreviousEUR0 Revenue Distribution Modulechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module) [NextUSUAL stakingchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking) Last updated 7 months ago Was this helpful? Was this helpful? --- # USD0 | Usual Tech Docs [](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FnxRZMlYenVwH08AP26dM%252FCard%2520Cover%252013.png%3Falt%3Dmedia%26token%3D8c5a37c4-cc21-4ecd-9516-d85a3e8f6371&width=752&dpr=3&quality=100&sign=f74b204&sv=2) **What is the ClassicalOracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FjcyldUzlJAtOza9POf3p%252FCard%2520Cover%252014.png%3Falt%3Dmedia%26token%3D426294da-ea05-4ba8-969b-64b10287dde5&width=752&dpr=3&quality=100&sign=681bb4fd&sv=2) **What is the Abstract Oracle?** [](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FzoWrEBXxDyI2syC0sVYR%252FCard%2520Cover%252015.png%3Falt%3Dmedia%26token%3D4ddf6abe-3c21-4f34-9f26-2daf258288f2&width=752&dpr=3&quality=100&sign=ffe86984&sv=2) **What Oracles does Pyth provide?** ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FlDacZpi6ajTz1BagCuAc%252FCard%2520Cover%252035.png%3Falt%3Dmedia%26token%3Daf7d7ba4-50e2-4667-ba8b-71e7da5a0077&width=752&dpr=3&quality=100&sign=1a3bee7&sv=2) **What Oracles does Chainlink provide?** [PreviousUtility Contractschevron-left](https://tech.usual.money/smart-contracts/utility-contracts) [NextUSD0 ClassicalOraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle) Last updated 1 month ago Was this helpful? Was this helpful? --- # Usual bUSD0 (formerly USD0++) Investment Vault | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#overview) Overview ---------------------------------------------------------------------------------------------------------- The **Usual bUSD0 Investment Vault** is a seamlessly integrated, yield-bearing vault designed to make DeFi investment effortless and immediate. bUSD0 holders can deposit directly into the vault and begin earning yield **synchronously** — no waiting periods, no bridging, and no off-platform interaction required. All returns are compounded through carefully curated DeFi strategies and users also receive USUAL token rewards. This synchronous model keeps user assets productive from the moment of deposit, while not needing to leave the Usual ecosystem — maximizing both convenience and capital efficiency. chevron-right**Depositing into the vault**[hashtag](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#depositing-into-the-vault) When a user deposits into the vault using bUSD0 (or other supported tokens), the process is immediate and fully automated. Behind the scenes, the system swaps these tokens into the vault's yield-bearing asset and deposits them — all in one synchronous transaction. Users receive vault shares instantly, which begin earning yield without delay. There's no need to manually manage assets across protocols or worry about market timing — every deposit is executed atomically, and earnings start from block one. chevron-right**Withdrawing from the vault**[hashtag](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#withdrawing-from-the-vault) Withdrawals from the vault are just as streamlined. Users redeem their shares in a single step, triggering the vault to withdraw the underlying asset, calculate and apply any fees, and swap it back to bUSD0. This entire process is handled synchronously within the same transaction, ensuring users get immediate access to their funds without waiting for batch processing or delayed harvests. It's fast, reliable, and fully integrated within the Usual infrastructure. [hashtag](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#smart-contracts) Smart Contracts ------------------------------------------------------------------------------------------------------------------------ [Usual bUSD0 Investment Vaultchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault) [VaultRouterchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter) [PreviousUSUAL distributionchevron-left](https://tech.usual.money/overview/features/usual-distribution) [NextArchitecturechevron-right](https://tech.usual.money/overview/architecture) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#overview) * [Smart Contracts](https://tech.usual.money/overview/features/usual-usd0++-investment-vault#smart-contracts) Was this helpful? --- # USD0a | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/usd0a#overview) Overview ---------------------------------------------------------------------------------- USD0a is a yield-bearing accrual asset designed for secure and seamless use across the DeFi ecosystem. It is fully backed by USDC, USTB and USCC tokens, offering enhanced security without reliance on traditional banks. The coin is permissionless and easily integrable, with real-time reserve transparency provided by fund administrators. USD0a consolidates liquidity from diverse sources and utilizes an innovative mint engine for efficient collateralization, with its price determined by the value of the underlying collateral and the total supply, generating yield for holders and providing a transparent, collateral-backed asset for the DeFi ecosystem. chevron-right**How to Mint USD0a**[hashtag](https://tech.usual.money/overview/features/usd0a#how-to-mint-usd0a) USD0a tokens can be minted through Usual's counter in two ways: 1. **Direct Mint:** By depositing an eligible RWA into the protocol to receive an equivalent amount of USDa depending on its actual price. 2. **Indirect Mint**: By depositing USDC into the protocol to receive an equivalent amount of USDa depending on its actual price. In this method, a third party known as the Collateral Provider (CP) supplies some USDC, enabling users to obtain USD0a with a discount amount. chevron-right**How to Redeem USD0a**[hashtag](https://tech.usual.money/overview/features/usd0a#how-to-redeem-usd0a) USD0a tokens can be redeemed in two ways: 1. **Withdrawal of Underlying Assets**: Users can withdraw the Real World Asset (RWA) underlying the USD0a token directly with the Usual dApp [hashtag](https://tech.usual.money/overview/features/usd0a#smart-contract) Smart Contract ---------------------------------------------------------------------------------------------- [USD0achevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a) [PreviousbUSD0 (formerly USD0++)chevron-left](https://tech.usual.money/overview/features/usd0++) [NextMint & Redeem Enginechevron-right](https://tech.usual.money/overview/features/mint-and-redeem-engine) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/usd0a#overview) * [Smart Contract](https://tech.usual.money/overview/features/usd0a#smart-contract) Was this helpful? --- # ETH0 DaoCollateral | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------------------- The DaoCollateral contract is a fundamental component of the ETH0 ecosystem, designed to manage the collateralization, minting, and redemption of ETH0 tokens. It ensures that the circulating supply of ETH0 is always fully backed by collateral, providing transparency and security for ETH0 holders. The contract facilitates the swapping of collateral tokens for ETH0, redemption of ETH0 for collateral tokens, and implements a Counter Bank Run (CBR) mechanism for emergency situations. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#contract-summary) Contract Summary ------------------------------------------------------------------------------------------------------------------------------------- **Inherited Contracts** * ReentrancyGuardUpgradeable (OZ): Prevents reentrant attacks on sensitive functions. * PausableUpgradeable (OZ): Enables pausing of contract functionality by authorized accounts. * EIP712Upgradeable (OZ): Implements EIP-712 for structured data hashing and signing. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#functionality-breakdown) Functionality Breakdown --------------------------------------------------------------------------------------------------------------------------------------------------- **Key Functionalities** 1. M**inting and redeeming ETH0:** The contract manages the collateralization of ETH0 by handling collateral tokens. When a user sends collateral, the DaoCollateral contract mints the equivalent amount of ETH0 stablecoins, and vice versa, allowing users to exchange their ETH0 stablecoins for collateral at the current exchange rate. * Swap: Facilitates the conversion of collateral into ETH0. Upon initiating this function, users exchange their collateral tokens for ETH0 stablecoins directly. * Redeem: Allows users to redeem their ETH0 stablecoins for collateral against a fee. By invoking this function, users exchange their ETH0 stablecoins for collateral at the current exchange rate. 1. **Counter Bank Run (CBR) Mechanism:** The contract implements a Counter Bank Run mechanism that can be activated in emergency situations. When activated: * The CBR coefficient is applied to reduce the amount of collateral returned during redemptions * Swap functionality is automatically paused * The system helps maintain protocol stability during market stress 1. **Role-Based Access Control** The contract implements a role-based access control system for sensitive operations: * **DEFAULT\_ADMIN\_ROLE**: Has the highest level of access, including the ability to manage CBR parameters and perform critical administrative tasks. * **DAO\_REDEMPTION\_ROLE**: Required for special DAO redemption operations. * **PAUSING\_CONTRACTS\_ROLE**: Grants the ability to pause specific contract functionalities in case of emergencies. * **UNPAUSING\_CONTRACTS\_ROLE**: Grants the ability to unpause contract functionalities. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#functions-description) Functions Description **Public/External Functions** * `initialize`: Sets up the contract with initial parameters including registry information and redeem fee. * `swap`: Allows users to swap collateral tokens for ETH0. * `swapWithPermit`: Similar to swap but uses permit for approval. * `redeem`: Enables users to redeem ETH0 for collateral tokens. * `redeemDao`: Special redemption function for DAO operations. Only callable by DAO\_REDEMPTION\_ROLE. * `activateCBR`: Activates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * `deactivateCBR`: Deactivates the Counter Bank Run mechanism. Only callable by DEFAULT\_ADMIN\_ROLE. * `setRedeemFee`: Sets the fee for redemption operations. Only callable by DEFAULT\_ADMIN\_ROLE. * `pauseRedeem`, `pause`, `pauseSwap`: Pausing functions for specific operations. Only callable by PAUSING\_CONTRACTS\_ROLE. * `unpause`, `unpauseRedeem`, `unpauseSwap`: Global unpausing functions. Only callable by UNPAUSING\_CONTRACTS\_ROLE. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#constants) **Constants** * `CONTRACT_REGISTRY_ACCESS`: Address of the registry access contract. * `CONTRACT_TOKEN_MAPPING`: Address of the token mapping contract. * `CONTRACT_ORACLE`: Address of the oracle contract. * `CONTRACT_TREASURY`: Address of the treasury contract. * `CONTRACT_ETH0`: Address of the ETH0 token contract. * `CONTRACT_YIELD_TREASURY`: Address of the yield treasury contract. * `DEFAULT_ADMIN_ROLE`: Role identifier for the default admin. * `DAO_REDEMPTION_ROLE`: Role identifier for DAO redemption operations. * `PAUSING_CONTRACTS_ROLE`: Role identifier for pausing contract operations. * `UNPAUSING_CONTRACTS_ROLE`: Role identifier for unpausing contract operations. * `MAX_REDEEM_FEE`: Maximum allowed redemption fee (25%). * `BASIS_POINT_BASE`: Base value for basis point calculations (10000). * `SCALAR_ONE`: Scalar value representing 1 in the contract's decimal system. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#key-components) Key Components * **Oracle Integration**: Uses an oracle to fetch real-time price data for collateral tokens. * **Token Mapping**: Manages the mapping of supported collateral tokens. * **Access Control**: Implements role-based access control for administrative functions. * **Treasury Management**: Handles the storage and distribution of collateral tokens. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of critical functions in emergencies. * **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. * **Access Control**: Restricts sensitive operations to authorized roles. * **CBR Mechanism**: Implements a Counter Bank Run mechanism for emergency situations. * **Fee Management**: Implements a configurable redemption fee system with a maximum cap of 25%. [PreviousETH0chevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eth0) [NextEUR0chevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/eur0) Last updated 7 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#functions-description) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#constants) * [Key Components](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#key-components) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/eth0/eth0-daocollateral#safeguards-implementation) Was this helpful? --- # Pyth Oracles | Usual Tech Docs [Pytharrow-up-right](https://www.pyth.network/) , a leader in on-chain data provisioning, has provided us with USD0 and bUSD0 (formerly USD0++) price feeds which are available on more than 75 blockchains. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles#usd0) USD0 ------------------------------------------------------------------------------------------------------ [![Logo](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fpythdata.app%2Ficon.png%3Ficon.13-cnwc23r9gv.png%3Fdpl%3Ddpl_3949EgXHDWnKTrGQtyz6irHXDPPz&width=20&dpr=3&quality=100&sign=7fa128e1&sv=2)Pyth Terminalwww.pyth.networkchevron-right](https://www.pyth.network/price-feeds/crypto-usd0-usd) USD0/USD Pricefeed [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles#busd0-formerly-usd0) bUSD0 (formerly USD0++) ---------------------------------------------------------------------------------------------------------------------------------------- [![Logo](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fpythdata.app%2Ficon.png%3Ficon.13-cnwc23r9gv.png%3Fdpl%3Ddpl_3949EgXHDWnKTrGQtyz6irHXDPPz&width=20&dpr=3&quality=100&sign=7fa128e1&sv=2)Pyth Terminalwww.pyth.networkchevron-right](https://www.pyth.network/price-feeds/crypto-usd0%2B%2B-usd?cluster=pythnet&range=1D) bUSD0 (formerly USD0++)/USD Pricefeed [PreviousChainlink Oracleschevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles) [NextUSD0achevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0a) Last updated 4 months ago Was this helpful? * [USD0](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles#usd0) * [bUSD0 (formerly USD0++)](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles#busd0-formerly-usd0) Was this helpful? --- # USD0 ClassicalOracle | Usual Tech Docs circle-info Pricefeeds: Chainlink USDC ETH: 0x8fffffd4afb6115b954bd326cbe7b4ba576818f6 Hashnote Oracle USYC ETH: 0x4c48bcb2160f8e0adbf9d4f3b034f1e36d1f8b3e [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#high-level-overview) High-Level Overview -------------------------------------------------------------------------------------------------------------------------------------------- The ClassicalOracle contract is used by DaoCollateral and the swapperEngine to fetch the price of external tokens, i.e. RWAs and stablecoins. The price of tokens is used for minting and redeeming the right amount of USD0. It is an upgradable contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#contract-summary) Contract Summary Most of the contract’s logic is inherited from AbstractOracle. Two responsibilities remain in ClassicalOracle itself: * Initializing `tokenToOracleInfo` for each supported token with a ChainlinkV3Aggregator-compatible price feed * Interacting with the aggregator to fetch the latest price and its number of decimals ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with UsualOracle and ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **AbstractOracle**: Encapsulates most of the logic and the implementation of public/external functions from IOracle. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#functionality-breakdown) Functionality Breakdown ---------------------------------------------------------------------------------------------------------------------------------------------------- After deploying the contract, the administrator should initialize the price feed for all supported RWAs and stablecoins (i.e. USYC, USDC, and USDT). When another contract or external service calls `getPrice` or `getQuote`, the inherited AbstractOracle contract calls the virtual function `_latestRoundData` passing the desired token as parameter. This function is implemented in ClassicalOracle and retrieves the associated price aggregator for this token, then calls `decimals` and `latestRoundData` which are returned to AbstractOracle. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#flow-diagram) Flow Diagram ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fcontent.gitbook.com%2Fcontent%2FpUhQzPJGdJzuLTQ5sCym%2Fblobs%2FqT7pnYY7DON0ScTkjSOs%2FAbstractOracle.png&width=768&dpr=3&quality=100&sign=9e3e171e&sv=2) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#public-external-functions) Public/External Functions * **initializeTokenOracle(address token, address dataSource, uint64 timeout, bool isStablecoin)**: Registers a new supported token or updates the data source (price aggregator) for an existing token. The new price feed must have been last updated within the last `timeout` seconds. This check is only performed once. If `isStablecoin` is true, the depeg check will be enabled and `getPrice`/`getQuote` will revert if the price is not around $1. Also see AbstractOracle for the other public/external functions. [PreviousUSD0chevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0) [NextUSD0 Abstract Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-classicaloracle#functions-description) Was this helpful? --- # ETH0 Classical Oracle | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------------------------------- The ClassicalOracle contract is used by DaoCollateral to fetch the price of external tokens. The price of tokens is used for minting and redeeming the right amount of ETH0. It is an upgradable contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#contract-summary) Contract Summary Most of the contract’s logic is inherited from AbstractOracle. Two responsibilities remain in ClassicalOracle itself: * Initializing `tokenToOracleInfo` for each supported token with a ChainlinkV3Aggregator-compatible price feed * Interacting with the aggregator to fetch the latest price and its number of decimals ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#inherited-contracts) Inherited Contracts * **IOracle**: Common interface used by other contracts and external service (e.g. the dApp) to interact with the ClassicalOracle. Ensures function signatures are the ones expected by these external actors. * **AbstractOracle**: Encapsulates most of the logic and the implementation of public/external functions from IOracle. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------------------------------- After deploying the contract, the administrator should initialize the price feed for all supported collateral. When another contract or external service calls `getPrice` or `getQuote`, the inherited AbstractOracle contract calls the virtual function `_latestRoundData` passing the desired token as parameter. This function is implemented in ClassicalOracle and retrieves the associated price aggregator for this token, then calls `decimals` and `latestRoundData` which are returned to AbstractOracle. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#flow-diagram) Flow Diagram ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fcontent.gitbook.com%2Fcontent%2FpUhQzPJGdJzuLTQ5sCym%2Fblobs%2FqT7pnYY7DON0ScTkjSOs%2FAbstractOracle.png&width=768&dpr=3&quality=100&sign=9e3e171e&sv=2) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#public-external-functions) Public/External Functions * **initializeTokenOracle(address token, address dataSource, uint64 timeout, bool isStablecoin)**: Registers a new supported token or updates the data source (price aggregator) for an existing token. The new price feed must have been last updated within the last `timeout` seconds. This check is only performed once. If `isStablecoin` is true, the depeg check will be enabled and `getPrice`/`getQuote` will revert if the price is not around $1. Also see AbstractOracle for the other public/external functions. [PreviousETH0chevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eth0) [NextETH0 Abstract Oraclechevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-classical-oracle#functions-description) Was this helpful? --- # Integrate bUSD0 | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FrO0ehSDpTj0PkMxat1zY%252FDocs%2520similar%2520banner.png%3Falt%3Dmedia%26token%3D7d57f4f5-d825-4349-a157-2418d93eca7e&width=1248&dpr=3&quality=100&sign=8e9da8b7&sv=2) circle-info TL:DR - Integrate bUSD0 in your offering and easily expose your community to USUAL rewards, capitalising at minimum on the underlying RWA yield and potentially much more. Current options to integrate bUSD0 rewards in USUAL are: * [Reward-Redistribution by integration partner](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) * [Claim Address Redirect](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) (if integration partner can't claim the rewards that accumulate on their smart contracts). [hashtag](https://tech.usual.money/integrations/integrate-busd0#recap-what-is-busd0-formerly-usd0-about) Recap - What is bUSD0 (formerly USD0++) about? ------------------------------------------------------------------------------------------------------------------------------------------------------------ bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. It remains transferable during this period, earning USUAL incentives and maturity yield. Users receive 1 USD0 for 1 bUSD0 at maturity. For early redemption, users need an equivalent amount of rt-USD0 - received at mint - which unlocks bUSD0 back into USD0 at a 1:1 rate anytime. Additionally, early redemption below peg can be made at a DAO set price floor. **Supply: ∞** - each USD0 can be deposited into bUSD0 **Contract standard:** ERC-20 **Reward distribution approach:** **Claim bearing** **For more insights check out:** [bUSD0 (formerly USD0++) Deep divearrow-up-right](https://docs.usual.money/usual-products/usd0-liquid-staking-token) [bUSD0 (formerly USD0++) Smart Contract](https://tech.usual.money/smart-contracts/token-contracts/usd0++) [USUAL Deep Divearrow-up-right](https://docs.usual.money/usual-products/usual-governance-token) [USUAL Smart Contract](https://tech.usual.money/smart-contracts/token-contracts/usual) [hashtag](https://tech.usual.money/integrations/integrate-busd0#why-should-you-enhance-your-product-offering-with-busd0) Why should you enhance your product offering with bUSD0? -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Usual Protocol is one of the first stablecoin issuer to redistribute generated value in the form of a governance token via bUSD0, directly incentivizing protocol liquidity, _**while remaining fully transferable and composable.**_ 100% of the generated revenues are pooled into the protocol's treasury. Consequently, USUAL a genuine governance token, backed by real RWA yield and revenue, granting ownership rights over the protocol's actual revenues, future revenues, and infrastructure. These USUAL rewards guarantee at least rewards as high as the underlying RWA yield, in reality is likely to be higher due the protocol's unique [tokenomics of USUALarrow-up-right](https://docs.usual.money/usual-products/usual-governance-token/usual-tokenomics) . USUAL distribution is designed to be disinflationary, meaning its value theoretically increases as the Total Value Locked (TVL) in bUSD0 grows. In that sense early participation is highly advantageous. This sets it apart from many other governance tokens, which often lack intrinsic value. [hashtag](https://tech.usual.money/integrations/integrate-busd0#how-can-busd0-be-integrated) How can bUSD0 be integrated? ------------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/integrations/integrate-busd0#reward-logic-claim-bearing) Reward logic = Claim bearing bUSD0 introduces a new logic for rewards distribution. Unlike other tokens, bUSD0 is a "**Claim bearing**" token, not yield bearing or rebasing. Holders of bUSD0 are eligible for "Claiming" daily $USUAL rewards. By default the Usual reward system assigns the holder's address as the recipient of these rewards. The Usual protocol enhances composability by integrating logic that tracks and maps user deposits and activity across other protocols. For instance, Usual monitors deposits of bUSD0 into Morpho, enabling it to reward users who use their bUSD0 deposits as collateral on Morpho. When integrated, the user experience is straightforward. Users can utilize the integrated protocols such as Morpho and Pendle, and directly claiming rewards for their bUSD0 ownership and activity in the "[Earnarrow-up-right](https://app.usual.money/earn) " section of the Usual interface on a daily basis. This setup provides clarity on token values while allowing users to manage and utilize their bUSD0 assets seamlessly, without losing their "**Claim**" on the underlying USUAL rewards. For optimal performance, protocols are highly encouraged to completely integrate with the Usual reward system, so that USUAL rewards are automatically assigned to their users via the daily [USUAL distribution](https://tech.usual.money/overview/features/usual-distribution) , ready to be "claimed". ### [hashtag](https://tech.usual.money/integrations/integrate-busd0#integration-tiers) Integration Tiers For an integration to be considered completely integrated, empowering a straightforward claim experience for bUSD0 holder/users please refer to tier list below: Integration Tier Reward UX Examples Fully integrated USUAL is claimed via [Earn pagearrow-up-right](https://app.usual.money/earn) Curve, Pendle, Morpho Partially integrated USUAL is claimed and redistributed by integration partner Euler, Superform, Contango Not integrated USUAL can't be claimed from smart contract, USUAL remains stale Maybe your smart contract? If you are in the lowest tier, don't fret - we are here to help! Checkout the integration options below. [hashtag](https://tech.usual.money/integrations/integrate-busd0#what-integration-options-are-currently-supported) What integration options are currently supported? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F62HjVqKei4c8p2kkzyuQ%252FCard%2520Cover%252056.png%3Falt%3Dmedia%26token%3D4c0f84bc-6e31-42be-8ad8-cdbfa1dc493e&width=490&dpr=3&quality=100&sign=246efbd2&sv=2) **Reward redistribution by integration partner** [](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F74aRfuBnsNzuaReV7CXR%252FCard%2520Cover%252055.png%3Falt%3Dmedia%26token%3D8a6dd855-879b-4735-9b0d-393fd17f272f&width=490&dpr=3&quality=100&sign=ffecd5c3&sv=2) **Claim Address Redirect** [PreviousBug Bountychevron-left](https://tech.usual.money/security-and-audits/bug-bounty) [NextReward redistribution by integration partnerchevron-right](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) Last updated 4 months ago Was this helpful? * [Recap - What is bUSD0 (formerly USD0++) about?](https://tech.usual.money/integrations/integrate-busd0#recap-what-is-busd0-formerly-usd0-about) * [Why should you enhance your product offering with bUSD0?](https://tech.usual.money/integrations/integrate-busd0#why-should-you-enhance-your-product-offering-with-busd0) * [How can bUSD0 be integrated?](https://tech.usual.money/integrations/integrate-busd0#how-can-busd0-be-integrated) * [Reward logic = Claim bearing](https://tech.usual.money/integrations/integrate-busd0#reward-logic-claim-bearing) * [Integration Tiers](https://tech.usual.money/integrations/integrate-busd0#integration-tiers) * [What integration options are currently supported?](https://tech.usual.money/integrations/integrate-busd0#what-integration-options-are-currently-supported) Was this helpful? --- # EUR0 Revenue Distribution Module | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#high-level-overview) High-Level Overview This contract manages the automated minting and distribution of EUR0 tokens to three dedicated distribution buckets. The contract enables multipurpose revenue distribution with three fixed buckets: Revenue Switch, Accruing Deposit Token (Accruing DT), and Rebasing Deposit Token (Rebasing DT). Each bucket operates independently with its own frequency, mint caps, pause mechanisms, and access control. The core features of this contract include: **Daily Accruing Deposit Token Distribution**: The contract should be called daily to calculate and mint EUR0 tokens into the accruing deposit token vault (SEUR0). The amount to mint is automatically calculated based on the vault's total assets and a configurable daily accruing yield rate. After minting, a yield distribution period is started in the vault to distribute the minted tokens over the next 24 hours. **Daily Rebasing Deposit Token Distribution**: The contract should be called daily to mint a specified amount of EUR0 tokens into the rebasing deposit token rewards claim contract. The amount is determined off-chain and provided as a parameter, typically based on an updated Merkle root calculated off-chain. **Weekly Revenue Switch Distribution**: The contract should be called weekly to receive and mint EUR0 rewards from the DAO into the revenue switch rewards claim contract. The amount is determined by the DAO and provided as a parameter when calling the function. **Mint Cap Management**: The contract maintains a global operator mint cap that restricts the total amount of EUR0 that can be minted through Revenue Switch and Rebasing DT distributions. Accruing DT distribution does not consume from the operator mint cap. Each bucket also has its own maximum mint cap per distribution period. **Granular Pause Mechanisms**: Each distribution bucket can be paused independently, allowing for selective disabling of specific distribution channels without affecting others. **Access Control**: Each functionality is controlled by a role with minimal required permissions, ensuring secure and restricted access to sensitive operations. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#inherited-contracts) Inherited Contracts **PausableUpgradeable**: Allows contract execution to be paused or unpaused by authorized roles. Provides both global pause functionality and per-bucket pause mechanisms. **IRevenueDistributionModule**: Interface that defines all functions that can be called by anyone (view functions) and role-restricted functions for revenue distribution operations. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#storage-structure) Storage Structure The contract uses ERC-7201 namespaced storage with the following key state variables: * **operatorMintCap**: Maximum amount of EUR0 that can be minted globally (applies to Revenue Switch and Rebasing DT) * **lastRevenueSwitchDistribution**: Timestamp of last Revenue Switch distribution * **lastAccruingDTDistribution**: Timestamp of last Accruing DT distribution * **lastRebasingDTDistribution**: Timestamp of last Rebasing DT distribution * **dailyAccruingYieldRate**: Daily accruing yield rate in micro basis points (1 = 0.0001%) * **maxRevSwitchMintCap**: Maximum amount per weekly Revenue Switch distribution * **maxAccruingMintCap**: Maximum amount per daily Accruing DT distribution * **maxRebasingDTMintCap**: Maximum amount per daily Rebasing DT distribution * **rewardClaimForRevenueSwitch**: Address of reward claim contract for Revenue Switch * **rewardClaimForAccruingDT**: Address of SEUR0 vault for Accruing DT (implements ISEur0) * **rewardClaimForRebasingDT**: Address of reward claim contract for Rebasing DT * **revenueSwitchDistributionPaused**: Boolean flag for Revenue Switch pause state * **accruingDTDistributionPaused**: Boolean flag for Accruing DT pause state * **rebasingDTDistributionPaused**: Boolean flag for Rebasing DT pause state #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#functionality-description) Functionality Description **Public/External Functions** **Initialization** **initialize**: Initializes the contract with the registry address, reward claim contract addresses, and initial parameter values. Sets up all three distribution buckets with their initial timestamps. Can only be called once during contract deployment. **IRevenueDistributionModule - Distribution Functions** **distributeRevenueSwitch**: * Distributes EUR0 tokens to the Revenue Switch bucket (weekly) * Requires `OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE` * Validates that at least one week has passed since last distribution * Validates amount against `maxRevSwitchMintCap` and `operatorMintCap` * Reduces `operatorMintCap` by the distributed amount * Mints EUR0 directly to `rewardClaimForRevenueSwitch` * Can only be called when Revenue Switch distribution is not paused **distributeAccruingDT**: * Distributes EUR0 tokens to the Accruing DT bucket (daily) * Requires `OPERATOR_ACC_DT_DISTRIBUTOR_ROLE` * Automatically calculates the amount to distribute based on: * `rewardClaimForAccruingDT.totalAssets() * dailyAccruingYieldRate / BASIS_MILLION_POINT_BASE` * Validates that at least one day has passed since last distribution * Validates calculated amount against `maxAccruingMintCap` * Does not consume from `operatorMintCap` (unlike other distributions) * Mints EUR0 directly to `rewardClaimForAccruingDT` vault * Starts a yield distribution period in the vault using `startYieldDistribution` * The yield distribution period spans from current timestamp to current timestamp + `ONE_DAY` * Can only be called when Accruing DT distribution is not paused **distributeRebasingDT**: * Distributes EUR0 tokens to the Rebasing DT bucket (daily) * Requires `OPERATOR_REB_DT_DISTRIBUTOR_ROLE` * Takes amount as parameter (typically calculated off-chain from Merkle root) * Validates that at least one day has passed since last distribution * Validates amount against `maxRebasingDTMintCap` and `operatorMintCap` * Reduces `operatorMintCap` by the distributed amount * Mints EUR0 directly to `rewardClaimForRebasingDT` * Can only be called when Rebasing DT distribution is not paused **IRevenueDistributionModule - Configuration Functions (OPERATOR\_ADMIN\_ROLE)** **setDailyAccruingYieldRate**: Sets the daily accruing yield rate used for calculating Accruing DT distribution amounts. Rate is in micro basis points (1 = 0.0001%), must be between 0 and `BASIS_MILLION_POINT_BASE`. **setOperatorMintCap**: Sets the global operator mint cap that limits total EUR0 minting through Revenue Switch and Rebasing DT distributions. **setMaxRevSwitchMintCap**: Sets the maximum amount of EUR0 that can be minted per weekly Revenue Switch distribution. **setMaxAccruingMintCap**: Sets the maximum amount of EUR0 that can be minted per daily Accruing DT distribution. **setMaxRebasingDTMintCap**: Sets the maximum amount of EUR0 that can be minted per daily Rebasing DT distribution. **setRewardClaimForRevenueSwitch**: Updates the reward claim contract address for Revenue Switch. **setRewardClaimForAccruingDT**: Updates the reward claim contract address for Accruing DT. Must implement `ISEur0` interface. **setRewardClaimForRebasingDT**: Updates the reward claim contract address for Rebasing DT. **IRevenueDistributionModule - View Functions** **getOperatorMintCap**: Returns the current operator mint cap value. **getDailyAccruingYieldRate**: Returns the current daily accruing yield rate in micro basis points. **getRewardClaimContractForRevenueSwitch**: Returns the reward claim contract address for Revenue Switch. **getRewardClaimContractForAccruingDT**: Returns the reward claim contract address for Accruing DT. **getRewardClaimContractForRebasingDT**: Returns the reward claim contract address for Rebasing DT. **getMaxRevSwitchMintCap**: Returns the maximum amount of EUR0 that can be minted per weekly Revenue Switch distribution. **getMaxAccruingMintCap**: Returns the maximum amount of EUR0 that can be minted per daily Accruing DT distribution. **getMaxRebasingDTMintCap**: Returns the maximum amount of EUR0 that can be minted per daily Rebasing DT distribution. **isRevenueSwitchDistributionPaused**: Returns whether Revenue Switch distribution is currently paused. **isAccruingDTDistributionPaused**: Returns whether Accruing DT distribution is currently paused. **isRebasingDTDistributionPaused**: Returns whether Rebasing DT distribution is currently paused. **IRevenueDistributionModule - Pause Functions** **pause**: Pauses all contract operations. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpause**: Unpauses all contract operations. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseRevenueSwitchDistribution**: Pauses only Revenue Switch distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseRevenueSwitchDistribution**: Unpauses Revenue Switch distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseAccruingDTDistribution**: Pauses only Accruing DT distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseAccruingDTDistribution**: Unpauses Accruing DT distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseRebasingDTDistribution**: Pauses only Rebasing DT distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseRebasingDTDistribution**: Unpauses Rebasing DT distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#functionality-breakdown) Functionality Breakdown **Setting up Calculation Parameters** `OPERATOR_ADMIN_ROLE` can change all parameter values used in distribution calculations: * Daily accruing yield rate (used in Accruing DT amount calculation) * Operator mint cap (global limit for Revenue Switch and Rebasing DT) * Individual bucket maximum mint caps There is no timelock for these changes, allowing for rapid response to market conditions or protocol needs. **Daily Accruing Deposit Token Distribution** `OPERATOR_ACC_DT_DISTRIBUTOR_ROLE` is required to call `distributeAccruingDT` every 24 hours to: * Query the total assets value from the accruing deposit token vault (SEUR0) * Calculate the distribution amount: `totalAssets * dailyAccruingYieldRate / BASIS_MILLION_POINT_BASE` * Validate the calculated amount against `maxAccruingMintCap` * Mint the calculated amount of EUR0 directly to the SEUR0 vault * Start a yield distribution period in the vault that distributes the minted tokens over the next 24 hours **Note**: This distribution does not consume from the operator mint cap, as it is calculated based on vault assets rather than being an arbitrary amount set by an operator. The amount distributed scales based on the vault's total assets, ensuring that as more users deposit into the vault, more yield is distributed proportionally. **Daily Rebasing Deposit Token Distribution** `OPERATOR_REB_DT_DISTRIBUTOR_ROLE` is required to call `distributeRebasingDT` with a valid amount every 24 hours. The amount is typically calculated off-chain based on an updated Merkle root: * Off-chain calculation determines the total EUR0 amount to mint for eligible users * The amount is provided as a parameter to `distributeRebasingDT` * The contract validates the amount against `maxRebasingDTMintCap` and `operatorMintCap` * If valid, the `operatorMintCap` is reduced by the amount * EUR0 is minted directly to the rebasing deposit token rewards claim contract * Users can claim their portion using valid Merkle proofs This distribution requires off-chain infrastructure (Watchtower) to calculate the Merkle root and determine the total distribution amount based on eligible users and their assigned allocations. **Weekly Revenue Switch Distribution** `OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE` is required to call `distributeRevenueSwitch` with a valid amount every week. The amount is determined by the DAO: * DAO determines the weekly EUR0 rewards amount to distribute * The amount is provided as a parameter to `distributeRevenueSwitch` * The contract validates that at least one week has passed since last distribution * The contract validates the amount against `maxRevSwitchMintCap` and `operatorMintCap` * If valid, the `operatorMintCap` is reduced by the amount * EUR0 is minted directly to the revenue switch rewards claim contract This distribution enables the DAO to directly allocate EUR0 rewards on a weekly basis, separate from the automated daily distributions. **Mint Cap Management** The contract implements a two-tier mint cap system: **Operator Mint Cap**: Global limit for EUR0 minting through Revenue Switch and Rebasing DT distributions. This cap is consumed when either of these distributions occurs and can be increased by `OPERATOR_ADMIN_ROLE` if needed. **Per-Bucket Maximum Mint Caps**: Each distribution bucket has its own maximum amount that can be minted per distribution period: * `maxRevSwitchMintCap`: Maximum per weekly Revenue Switch distribution * `maxAccruingMintCap`: Maximum per daily Accruing DT distribution * `maxRebasingDTMintCap`: Maximum per daily Rebasing DT distribution Both the operator mint cap and per-bucket caps must be satisfied for a distribution to proceed (except Accruing DT, which only checks its own cap). **Granular Pause Mechanisms** The contract supports both global and per-bucket pause functionality: **Global Pause**: Pauses all contract operations. Can be used in emergencies to halt all distributions. **Per-Bucket Pause**: Each distribution bucket can be paused independently: * `pauseRevenueSwitchDistribution` / `unpauseRevenueSwitchDistribution` * `pauseAccruingDTDistribution` / `unpauseAccruingDTDistribution` * `pauseRebasingDTDistribution` / `unpauseRebasingDTDistribution` This granular control allows administrators to disable specific distribution channels without affecting others, useful for addressing issues in a single bucket or temporarily suspending specific revenue streams. **Accruing DT Yield Distribution Period** When `distributeAccruingDT` is called, after minting EUR0 to the SEUR0 vault, the contract calls `startYieldDistribution` on the vault with: * `yieldAmount`: The minted EUR0 amount * `startTime`: Current block timestamp * `endTime`: Current block timestamp + `ONE_DAY` This initiates a yield distribution period in the vault where the minted tokens are distributed over the next 24 hours to vault holders proportionally. The vault's yield-bearing mechanism ensures that shares appreciate in value as yield accrues throughout the day. **Rebasing DT Merkle Root Integration** The Rebasing DT distribution relies on off-chain infrastructure (Watchtower) to: * Calculate eligible users and their allocations * Generate a Merkle root from these allocations * Determine the total EUR0 amount to mint * Provide the amount to `distributeRebasingDT` The actual user claims happen through the rewards claim contract using Merkle proofs, not directly through the Revenue Distribution Module. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#constants) Constants * **OPERATOR\_REVSWITCH\_DISTRIBUTOR\_ROLE**: Role required to distribute EUR0 to Revenue Switch bucket (weekly) * **OPERATOR\_ACC\_DT\_DISTRIBUTOR\_ROLE**: Role required to distribute EUR0 to Accruing DT bucket (daily) * **OPERATOR\_REB\_DT\_DISTRIBUTOR\_ROLE**: Role required to distribute EUR0 to Rebasing DT bucket (daily) * **OPERATOR\_ADMIN\_ROLE**: Role required to set configuration parameters (mint caps, yield rates, reward claim addresses) * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract or individual distribution buckets * **UNPAUSING\_CONTRACTS\_ROLE**: Role required to unpause the contract or individual distribution buckets * **CONTRACT\_REGISTRY\_ACCESS**: Constant used to define the address of the registry access contract * **CONTRACT\_EUR0**: Constant used to define the address of the EUR0 contract * **INITIAL\_REVENUE\_DISTRIBUTION\_MINT\_CAP**: Initial value for operator mint cap (50,000 EUR0) * **ONE\_DAY**: Duration of one day in seconds (86,400 seconds) * **ONE\_WEEK**: Duration of one week in seconds (604,800 seconds) * **BASIS\_MILLION\_POINT\_BASE**: Base value for calculating percentages in micro basis points (1,000,000, where 1 = 0.0001%) ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#safeguard-implementation) Safeguard Implementation #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#access-control) Access Control The contract uses `CheckAccessControl` to enforce role-based access control, ensuring only authorized addresses can perform actions that require specific permissions. Each role has minimal required permissions: * Distribution roles can only trigger their specific distribution type * Admin role can only modify configuration parameters * Pausing roles can only pause/unpause functionality #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#pausability) Pausability The contract is pausable at both global and per-bucket levels: * Global pause can halt all operations in emergencies * Per-bucket pause allows selective disabling of specific distribution channels * Separate pausing and unpausing roles prevent unauthorized changes #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#mint-cap-restrictions) Mint Cap Restrictions Multiple layers of mint cap validation prevent excessive minting: * Operator mint cap limits total EUR0 minting (for Revenue Switch and Rebasing DT) * Per-bucket maximum caps limit individual distribution amounts * Both caps must be satisfied for distributions to proceed #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#time-based-restrictions) Time-Based Restrictions Distribution functions enforce time-based restrictions to prevent abuse: * Accruing DT can only be distributed once per day * Rebasing DT can only be distributed once per day * Revenue Switch can only be distributed once per week These restrictions prevent operators from rapidly minting excessive amounts and ensure distributions occur at appropriate intervals. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#input-validation) Input Validation All functions validate inputs: * Non-zero addresses for reward claim contracts * Non-zero amounts where applicable * Yield rate bounds (0 to `BASIS_MILLION_POINT_BASE`) * Same value checks to prevent redundant updates #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#invariant-validation) Invariant Validation The contract maintains system invariants: * Operator mint cap cannot be exceeded (except for Accruing DT which doesn't consume it) * Distribution amounts must respect per-bucket maximum caps * Time restrictions ensure distributions occur at proper intervals * Pause states prevent distributions when buckets are disabled **Note**: In scenarios where overcollateralization invariants are at risk, the contract can be paused or individual buckets can be disabled as a feature flag to protect the system. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#restrictions-on-function-call-frequency) Restrictions on Function Call Frequency There are strict time-based limits for distribution functions: * **distributeAccruingDT**: Can only be called once per 24 hours * **distributeRebasingDT**: Can only be called once per 24 hours * **distributeRevenueSwitch**: Can only be called once per week (7 days) These restrictions prevent unwanted emissions and ensure distributions occur at controlled, predictable intervals. The time checks use block timestamps and enforce minimum periods between distributions. [PreviousEUR0 SwapperEnginechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-swapperengine) [NextUSUALchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#contract-summary) * [Safeguard Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/eur0/eur0-revenue-distribution-module#safeguard-implementation) Was this helpful? --- # DebtUSCC Oracle | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#high-level-overview) High-Level Overview The DebtUSCCOracle contract is a proxy oracle that provides Chainlink-compatible price data for DebtUSCC tokens. Unlike a standard oracle wrapper, this contract returns the USCC/USD price from the time of the last deposit in the ReverseGateway contract, ensuring price consistency for all outstanding DebtUSCC tokens. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#contract-summary) Contract Summary The contract provides a Chainlink-compatible aggregator interface that: * Integrates with the ReverseGateway to track deposit timing * Returns the USCC/USD price from the oracle round captured during the last deposit * Maintains price consistency for all outstanding DebtUSCC tokens ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#key-functionality) Key Functionality #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#latestrounddata) latestRoundData Returns the USCC/USD price data based on the last ReverseGateway deposit: * **If no deposits exist** (nextOrderId == 1): Returns the latest price from the USCC/USD feed * **If deposits exist**: Returns the price from the USCC/USD feed at the roundId captured during the last deposit This design ensures that all outstanding DebtUSCC tokens are priced consistently at the same price point (the price when they were minted), maintaining accounting integrity and preventing price inconsistencies. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#getrounddata) getRoundData Not supported - reverts with `NotSupported` error. Only `latestRoundData` is available. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#integration-with-reversegateway) Integration with ReverseGateway The contract queries the ReverseGateway contract to: 1. Get the next order ID to determine if any deposits have occurred 2. Retrieve the roundId from the last order (if deposits exist) 3. Use that roundId to fetch the historical USCC/USD price from the oracle This integration ensures that the DebtUSCC oracle price reflects the price at which the debt tokens were minted, maintaining consistency with the single deposit constraint in ReverseGateway. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#constants) Constants * **PRICE\_FEED\_DECIMALS**: 8 (standard Chainlink decimals) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#immutable-variables) Immutable Variables * **USCC\_USD\_FEED**: The underlying USCC/USD Chainlink price feed aggregator * **REVERSE\_GATEWAY**: The ReverseGateway contract address ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#use-case) Use Case The DebtUSCCOracle is used by the protocol to price DebtUSCC tokens. By returning the price from the time of the last deposit, the oracle ensures that all outstanding DebtUSCC tokens maintain a consistent price point, which is critical for: * Maintaining accounting accuracy * Ensuring USD0a price stability * Aligning with the single deposit constraint in ReverseGateway [PreviousDebtUSDC Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtusdc-oracle) [NextETH0chevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eth0) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#contract-summary) * [Key Functionality](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#key-functionality) * [Integration with ReverseGateway](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#integration-with-reversegateway) * [Constants](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#constants) * [Immutable Variables](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#immutable-variables) * [Use Case](https://tech.usual.money/smart-contracts/utility-contracts/usd0a/debtuscc-oracle#use-case) Was this helpful? --- # Terms of Services | Usual Tech Docs \*\*Date of the latest revision: 10/18/2024\*\* PLEASE READ THESE TERMS OF USE AND SERVICE CAREFULLY BEFORE USING THE SERVICES. BY USING THE SERVICES, YOU AGREE TO BE LEGALLY AND UNCONDITIONALLY BOUND BY THESE TERMS. APPART FROM THESE TERMS, ALL INFORMATION PROVIDED IN CONNECTION WITH YOUR ACCESS AND USE OF THE INTERFACE AND THE SERVICES IS FOR INFORMATIONAL PURPOSES ONLY. USUAL LABS DRAWS THE ATTENTION OF USERS TO THE RISKS INHERENT IN THE USE OF CRYPTO ASSETS AND BLOCKCHAIN TECHNOLOGY. BEFORE USING THE PROTOCOL, PLEASE READ SECTION 4.3 CAREFULLY. BEFORE MAKING ANY FINANCIAL, LEGAL, TECHNICAL, OR OTHER DECISIONS INVOLVING CRYPTO ASSETS AND/OR THE SERVICES, YOU SHOULD SEEK INDEPENDENT PROFESSIONAL ADVICE FROM A LICENSED AND QUALIFIED INDIVIDUAL IN THE APPROPRIATE AREA. \### 1. PURPOSE OF THIS DOCUMENT \#### 1.1 General information The Usual Protocol, as well as other related interfaces (https://usual.money),Interfaces (as defined below) are provided by Up Only Co, a French simplified joint stock company (société par actions simplifiée) organized under the laws of France, having its registered office located at 1 rue de Stockholm 75008 Paris, incorporated with the Commercial and Companies Register of Paris under number 919 540 427 ("Usual Labs, Inc. ("Usual Labs")" or the “Company”) and its affiliates ("we," "us," "our"). Usual ProtocolThe Interface, as defined below, provides information and resources about the fundamentals of the protocol called "Usual" that permits, among other things, the generation of stablecoins, transactions using smart contracts, and the lending, leveraging, and staking of cryptographic assets (the "Protocol"). The purpose of these terms of use (the "Terms") is to define: * the terms and conditions of use applicable to the user (the "User," "you," or "your"), when using our websites located at https://usual.money or any other related interface (the "Interface") * the terms and conditions applicable to any other features, tools, materials, or other services offered from time to time on the Interface (the "Services"). \### #### 1.2 Definitions * ADDU: means the Association de Développement de la DAO Usual (ADDU), a French law association having its registered office located at 10, rue de la Paix, 75002 Paris, and registered with INSEE under SIREN number 925 013 245, developing and organizing the Usual DAO, composed of Usual Token holders. * Airdrop: means the process of distribution of tokens for free to Users who have participated in an airdrop through a dedicated interface, such operation which may be carried out by ADDU at its own discretion. * AML (Anti Money Laundering): means laws, regulations, and procedures designed to prevent the use of financial systems for the purposes of concealing, disguising, or transforming illegal proceeds derived from criminal activities, financing terrorism, or other illicit activities. As provided in Article 4.1 of these Termes. Users expressly warrant that they are not involved in any activities or transactions that violates AML laws or regulations, and that they will not use the Protocol to facilitate money laundering, terrorist financing, or any other illegal or prohibited activities. Users further agree to comply with any applicable AML requirements in their jurisdiction and acknowledge that the Company may take measures to ensure compliance with AML regulations, wherever possible, given the decentralized nature of the Protocol. * Crypto assets: means tokens used by Users as a currency and unit of value (coins), such as bitcoin (BTC), Ethereum (ETH), or stablecoins, which aim to maintain a fixed parity with a traditional currency; or tokens with a utility function (utility tokens), granting access rights to products or services offered by the issuer. * Connect wallet: means the tab on the Interface available to Users to connect their noncustodial wallet. A non-custodial wallet is a type of cryptocurrency wallet that gives Users full control over their Crypto assets, as they hold the private keys. Unlike custodial wallets, where a third party manages the private keys on behalf of the user, non-custodial wallets allow Users to store, send, and receive Crypto assets without relying on an intermediary. This type of wallet may be considered more secure because it eliminates the risks associated with third-party custodians, but it also requires Users to take responsibility for safeguarding their private keys to avoid losing access to their Crypto assets. As specified below, Usual Labs or any affiliate company may not be liable in such cases where the User loses access to their Crypto assets due to the loss or mismanagement of private keys. * Contact address: means the email address to which the User may request information: [\[email protected\]](https://tech.usual.money/cdn-cgi/l/email-protection) * Interfaces: means the website: [https://usual.moneyarrow-up-right](https://usual.money/) and the front end to the Protocol: [https://app.usual.money/arrow-up-right](https://app.usual.money/) * Jurisdiction: means France, as provided in Article 8.9 of these Terms. * Prohibited Person: means a person who is a resident or national of the following countries: Afghanistan, Albania, Angola, Azerbaijan, Bosnia Herzegovina, Bahamas, Barbados, Burma, Botswana, Burkina Faso, Burundi, Cayman Islands, Cambodia, Cameroon, Crimea (Ukraine), Chad, China, Congo, Democratic Republic of Congo, Cuba, Ethiopia, Eritrea, Fiji, Palau, Ghana, Guinea, Guinea-Bissau, Haiti, Iran, Iraq, Jamaica, Jordan, Lao People's Democratic Republic, Uganda, Liberia, Libya, Madagascar, Mali, Malta, Morocco, Mozambique, Nicaragua, Nigeria, North Korea, Pakistan, Panama, Philippines, Puerto Rico, Russia, Senegal, Somalia, Sri Lanka, Sudan, Syria, Tajikistan, Trinidad and Tobago, Turkey, Turkmenistan, United States, Uzbekistan, Vanuatu, Venezuela, Virgin Islands, Yemen, Zimbabwe and any resident or national of a country otherwise subject to a U.S. Government embargo, or that has been designated by the U.S. Government as a terrorist-supporting country, and (ii) are not listed on any U.S. Government list of prohibited or restricted parties. * Prohibited US Person: means a person who is a resident or national of the United States of America. * USD0: means a liquid deposit token distributed to Users in exchange of deposit eligible on chain assets into the Protocol. For more information, please consult the following link: [https://docs.usual.money/usual-products/usd0-stablecoinarrow-up-right](https://docs.usual.money/usual-products/usd0-stablecoin) (information with no contractual value). * USD0++: means a token distributed to Users who use USD0 in various ways, such as contributing liquidity or locking USD0 and who would then be distributed Usual Tokens if made available by ADDU. For more information, please consult the following link: https://docs.usual.money/usual-products/usd0++-enhanced-tbill (information with no contractual value). * Usual DAO: means the Usual decentralized autonomous organization. * Usual Labs: means the User's co-contracting party, Up Only Co, a software company contributing to the development of the Protocol, registered at 1, rue de Stockholm, 75008 Paris, with the Commercial and Companies Register of Paris under number 919 540 427. * Usual Tokens: means the Protocol's governance tokens which may be released by ADDU at its own discretion. Its primary utility lies in empowering Usual Tokens holders to participate directly in the governance processes of the Usual DAO, effectively granting them a say in decision-making and the future direction of the Protocol. This means that Usual Tokens holders may have the opportunity to vote on proposals, decide upon the development roadmap, and contribute to key decisions that shape the Protocol’s evolution. However, such rights do not constitute ownership or equity in the Company or ADDU and may not grant Usual Tokens holders any legal rights to participate in the formal governance of the Company or ADDU, such as shareholder rights. For more information, please consult the following link: https://docs.usual.money/usual-products/usual-governance-token (information with no contractual value). \### 2. ACCEPTANCE OF TERMS – CHANGE OF TERMS Before using any of the Services, you must first agree to these Terms. By accessing the Services, you expressly confirm that you fully and irrevocably agree to these Terms. If you do not agree to any part of these Terms, you must cease using the Services. You also agree that your personal data and electronic communications on the Interface will be processed in accordance with our privacy policy, which is incorporated herein by reference and available at (https://gitbook.usual.money/ressources-and-ecosystem/privacy-policy). WeTo the maximum extent permitted by applicable law, we reserve the right, at our sole discretion, to modify or replace the Terms at any time. The most current version of these Terms will be posted and accessible via the Interface. You are responsible for reviewing and familiarizing yourself with such modifications. You will be deemed to have accepted all modifications and revisions by continuing to use any of the Services. You may contact us with questions about your use of the Services at [\[email protected\]](https://tech.usual.money/cdn-cgi/l/email-protection) . When you communicate with us electronically, you consent to receive communications from us electronically. \### 3. SERVICES \#### 3.1 Information on the Protocol The Interface is provided as an informational resource about the fundamentals of the Protocol, which is a fully decentralized finance (“DeFi”) infrastructure, community-governed protocolProtocol deployed on multiple blockchain networks and systems, and provides information about the wider Usual ecosystem, governance, community, and various interfaces and integrations to the Protocol. The Protocol is based on: * an open-source solution for which anyone can permissionlessly build or suggest improvement; and * a set of Smart Contracts developed in a modular approach and operating on the Ehtereum blockchain. The Protocol enable Users to: * deposit assets via its front end: Users deposit eligible on chain assets into the Protocol in exchange of USD0 tokens and representing the initial value of the deposit within the Protocol. * earning rewards: Users may utilize USD0 in various ways, such as contributing liquidity or locking USD0 in exchange of USD0++. By doing so, Users may be distributed Usual Tokens. * governance: Users may – when the Usual Tokens will be released which may be carried out by ADDU at its own discretion – be able to utilize Usual Tokens to participate in the governance of the Protocol. All information provided in connection with your access and use of the Interface and the Services is for informational purposes only. You should not take, or refrain from taking, any action based on the information contained on the Interface or any other information that we make available at any time, including blog posts, data, articles, links to third-party content, Discord content, news feeds, tutorials, tweets, and videos. Before making any financial, legal, technical, or other decisions involving crypto assets and/or the Services, you should seek independent professional advice from a licensed and qualified individual in the appropriate area. \#### 3.2 We are software developers in the Protocol ecosystem The Protocol is deployed on multiple blockchain-based networks, and Usual Labs is not responsible for the operation of such networks. It is important to understand that neither we nor any affiliated entity is a party to any transaction on the blockchain networks underlying the Protocol; we do not have possession, custody, or control over any crypto assets appearing on the Services; and we do not have possession, custody, or control over any user’sUser’s funds. Further, we do not store, send, or receive any crypto assets. You understand that when you interact with any Protocol smart contracts, you retain control over your crypto assets at all times. The private key associated with the wallet address from which you transfer crypto assets is the only private key that can control the crypto assets you transfer into the smart contracts. \#### 3.3 License to use our Services We grant you a license to use our Service. Contingent upon your ongoing compliance with these Terms, we grant you a personal, worldwide, revocable, non-exclusive, and non-assignable license to use the software provided as part of our Services. The only purpose of this license is to allow you to use and enjoy the Services solely as permitted by these Terms. We own any and all rights, titles, and interests in and to the Services, including, without limitation, any and all copyrights to any content, code, data, or other materials that you may access or use on or through the Services; except as expressly set forth herein, your use of or access to the Services does not grant you any ownership or other rights therein. We may use and share your feedback. Any comments, bug reports, ideas, or other feedback that you may provide about our Services on the Contact address, including suggestions on how we might improve our Services, are entirely voluntary. You agree that we are free to use or not use any feedback that we receive from you as we see fit, including copying and sharing such feedback with third parties, without any obligation to you. \#### 3.4 Fees Absence of Usual Labs’ fees. Usual Labs dodoes not – itself – charge any fees to Users for the use of Services or the Interface. We doApart from providing the Usual front end through the Interface, the Company does not provide any servicesServices per se to usersUsers or deliver, hold, and/or receive payment for crypto assets. Gas fees. However, note that in connection with your use of the Services, you agree to bear all costs necessary to conduct a transaction on the blockchain, such as gas fees. We attempt to provide accurate cost information, but this information is highly volatile and can change quickly without Users necessarily being aware of these changes. \### 4. USER’S REPRESENTATIONS & WARRANTIES AND ACKNOWLEDGEMENTS \#### 4.1 User’s representations & warranties You hereby represent and warrant, at all times during the use of the Services, that you: * Comply at all times with the laws (including notably anti-money launderingAML regulations) * Your use conforms with and does not breach the laws and in particular any applicable law in the jurisdiction in which you are located, including notably anti-money launderingAML regulations, and you will not be using the Services for, nor will promote or facilitate, illegal activity (including, without limitation, money laundering, financing terrorism, tax evasion, buying or selling illegal drugs, contraband, counterfeit goods, or illegal weapons);). * You are not engaged in any illegal trade, money laundering activities, or activities related to the financing of terrorism and will not be exploiting the Services for any unauthorized commercial purpose. * Neither you nor the geographical locality in which you reside or are domiciled or located are the subject of economic sanctions from the United Nations, the United States of America, or the European Union. * Neither you nor any of your affiliates is owned or controlled by a sanctioned person or involved in any transaction, transfer, or conduct that is likely to result in you or your affiliates becoming a sanctioned person or people. * Neither you nor any of your affiliates is a politically exposed person. * You will not use the Services for any fraudulent or dishonest purpose. * You will not harvest or otherwise collect information from the Services for any unauthorized purpose. * You will not attempt to conceal any non-compliance by you with any laws or these Terms by using a VPN or proxy or any other method or use the Services under false or fraudulent pretenses or otherwise being deceitful. * Are not citizens or residents of the United States; residents of Belarus, the Central African Republic, the Democratic Republic of Congo, the Democratic People’s Republic of Korea, the Crimea region of Ukraine, Cuba, Iran, Libya, Somalia, Sudan, South Sudan, Syria, the USA, the United Kingdom, Yemen, and Zimbabwe or any other jurisdiction in which accessing or using the Usual Protocol is prohibited (“Prohibited Jurisdictions”). In using this interfacea Prohibited US Person or a Prohibited Person; * In using this Interface, you confirm that you are not located in, incorporated or otherwise established in, or a citizen or resident of, a Prohibited Jurisdiction. a jurisdiction listed hereabove in Article 1.2. * You represent and warrant that you are not a citizen or resident of this "Prohibited Juridiction".such prohibited jurisdictions, as listed hereabove in Article 1.2 and You agree not to use the Services if you are located in, or a resident of, "Prohibited Juridiction". such jurisdictions. * Shall not affect the functionality or operation of the Services * You will not upload or transmit viruses, worms, Trojan horses, time bombs, cancel bots, spiders, malware, or any other type of malicious code that will or may be used in any way that may affect the functionality or operation of the Services. * You will not interfere with or circumvent the security features of the Services or any third party’s systems, networks, or resources used in the provision of Services. * You will not engage in any attack, hack, denial-of-service attack, interference, or exploit of any smart contract in connection with the use of the Service (and operations performed by a user that are technically permitted by a smart contract may nevertheless be a violation of our Agreement, including these Terms, and the law) nor engage in any anticompetitive behavior or other misconduct. * Are aware of related risks * By utilizing the Services or interacting with the Interface in any way, you represent that you perfectly understand the inherent risks associated with smart contracts and cryptographic systems (included but not limited to the volatility of cryptocurrencies, risk of regulatory actions, risks of technical issues) as disclosed thereafter and warrant that you have a very good understanding of the usage of cryptographic assets. * Shall not do any trolling activities: You will act toward us with respect and integrity and will not subject us to any abusive or disrespectful acts, including trolling on social media. * You will not interfere with other users’ access to or use of the Services. * Have the legal capacity and sufficient experience to use the Services: You are of the legal age of majority in your jurisdiction as is required and of sufficient mental age, maturity, and capacity to accept these Terms and use the Services. * You are fully able and competent to enter into the terms, conditions, obligations, affirmations, representations, and warranties set forth in these Terms and to abide by and comply with these Terms. * You have knowledge of and experience in the digitalcrypto asset space and are familiar with the functioning and intricacies of digitalcrypto assets including ERC20 tokens and with decentralized finance and decentralized exchanges and markets. * You further represent that you are legally permitted to use the Services in your jurisdiction. You further represent that you are responsible for ensuring compliance with the laws of your jurisdiction and you acknowledge and expressly agree thatwethat we shall not be liable for your compliance with such laws. * No breach of Intellectual Property Rights: * Your use of the Services does not and will not violate any intellectual property rights. You will not engage in transactions involving items that infringe or violate any copyright, trademark, right of publicity or privacy or any other proprietary right under the law, including but not limited to sales, distribution, or access to counterfeit music, movies, software, or other licensed materials without the appropriate authorization from the rights holder; use of our intellectual property, name, or logo, including the use of our trade or service marks, without express consent from us or in a manner that otherwise harms Usual Labs; any action that implies an untrue endorsement by or affiliation with Usual Labs. * You will not attempt to or actually copy or make unauthorized use of all or any portion of the Services, including by attempting to reverse compile, reformatting or framing, disassemble, reverse engineer any part of the Services. * Take your own responsibility: You make your own independent decisions in the way you are using the Services. * You are fully and solely responsible for the security of your wallet(s) and passwords, seed phrases, and private keys. If you provide or make available your passwords, seed phrases, or private keys to anyone else, you are fully and solely responsible for any consequent use of these. * You are fully and solely responsible for obtaining your own independent legal, financial, accounting, and tax advice. \#### 4.2 User’s Acknowledgements By your continuing use of the Services, you acknowledge: * Decentralization of the Protocol * The Protocol is fully decentralized. All transactions entered into by Protocol users are carried out by them on a peer-to-peer basis and Usual Labs has no control over such transactions. * No agency, advisory or partnership * We do not represent the buyer, seller, liquidity provider, offeror of tokens, or any participant or transacting party on the Protocol. * You alone are responsible for securing your private keys. We do not have access to your private keys. Due to the non-custodial and decentralized nature of the technology, we are not intermediaries, agents, advisors, or custodians, and we do not have a fiduciary relationship or obligation to you regarding any other decisions or activities that you affect when using our Services. We neither are accountants, tax advisors, legal representatives, or financial advisors of the Protocol. * You acknowledge that we, for the avoidance of doubt, do not have any information regarding any users, users’ identities, or services beyond what is available or obtainable publicly via the blockchain. We are not responsible for any activities you engage in when using Services, and you should understand the risks associated with crypto assets, blockchain technology generally, and our Services. * All contributors to the ecosystem around the Protocol are independent of us, and we will not have and do not assume any liability or responsibility for their actions or omissions. * We have no control over the Protocol’s operations * The Protocol is deployed on multiple blockchain-based networks, and we are not responsible for the operation of such networks. * The software underlying blockchain networks on which the Protocol is deployed, including, for example, the Ethereum blockchain, is open source, which means that anyone can use, utilize, and build on top of it. By using the Services, you acknowledge and agree (i) that we are not responsible for the operation of the blockchain-based software and networks underlying the Protocol, (ii) that there exists no guarantee of the functionality, security, or availability of that software and networks, and (iii) that the underlying blockchain-based networks are subject to sudden changes in operating rules, such as those commonly referred to as “forks”. * No recommendations * By participating in the Protocol, you acknowledge that you are doing so on the basis of your own enquiry, without solicitation or inducement by Usual Labs. * No information published on the Protocol about any of the digitalcrypto assets, trading strategies, or other financial strategies should be construed as being a promotion, solicitation, recommendation, or marketing of any kind in relation to any of these, and we have no knowledge of the financial circumstances or objectives of any Protocol’s user or any expertise in what might constitute sensible financial practice for them. * There is no assurance, representation, or warranty that your use of the Services: * will provide a profit; * will not incur significant losses; or * will attain your commercial or other objectives. * Automated collection and disbursement of proceeds by smart contracts * You agree to the automated collection and disbursement of proceeds by smart contracts. You acknowledge and agree that all transactions accessed through the Services will be automatically processed using one or more blockchain-based smart contracts. By engaging in transactions using the Services, you acknowledge and consent to the automatic processing of all transactions in connection with using the Services. You further acknowledge and agree that the applicable smart contract will dictate how the funds of a transaction and ownership of crypto assets are distributed. \#### 4.3 Assumption of riskrisks The Company draws the attention of Users to the risks inherent in the use of crypto assets and blockchain technology. Before using the Protocol, please read this section carefully. * Risks inherent to blockchain activities * We do not own or control any of the underlying software through which blockchain networks are formed. In general, the underlying software for blockchain networks tends to be open source such that anyone can use, copy, modify, and distribute it. By using the Services, you acknowledge and agree (i) that we are not responsible for the operation of the underlying software and networks that there exists no guarantee of functionality, security, or availability of such software and networks; and (ii) that digitalcrypto assets are highly volatile because of a range of factors which include, but are not limited to, rate of adoption, speculation, technology changes, security risks, contagion risks, systematic risks, legal and regulatory changes, and factors affecting their supply (such as the mining, minting, or issuing of new tokens, airdrops, the burning of tokens, and blockchain forks). * You understand that Ethereum and other blockchain technologies and associated Digital Assetscrypto assets, currencies, or tokens are highly volatile due to many factors including but not limited to adoption, speculation, technology, and security risks. You also acknowledge that the cost of transacting on such technologies is variable and may increase at any time causing an impact on any activities taking place on the Ethereum blockchain. You acknowledge these risks and represent that the Company cannot be held liable for such fluctuations or increased costs. * Regulatory risks * The Services could be impacted by one or more regulatory inquiries or regulatory action, which could impede or limit the ability of Usual Labs to continue to develop, or which could impede or limit your ability to access or use the Services or Ethereum blockchain, including access to the Interface. * Risk of information inaccuracy * Although it is intended to provide accurate and timely information on the Interface, the Interface or relevant tools may not always be entirely accurate, complete, or current and may also include technical inaccuracies or typographical errors. In an effort to continue to provide you with as complete and accurate information as possible, information may be changed or updated from time to time without notice, including, without limitation, information regarding our policies. Accordingly, you should verify all information before relying on it, and all decisions based on information contained on the Interface or relevant tools are your sole responsibility and the Company shall have no liability for such decisions. Links to third-party materials (including, without limitation, websites) may be provided as a convenience but are not controlled by any entity. You acknowledge and agree that we are not responsible for any aspect of the information, content, or services contained in any third-party materials or on any third-party sites accessible or linked to the Interface or available via other relevant tools. * No representation is made as to the accuracy, completeness, or appropriateness for any particular purpose of any pricing information distributed via the Interface. * Non-private data and data storage * A widespread belief is that transactions involving blockchains are anonymous. In fact, a central feature of blockchains and thus, blockchain-based transactions, is that they are transparent. Your public key and your wallet address, which you need to buy or sell items on the blockchain, are visible to anyone. To the extent your public key or wallet address can be linked back to you, it would be possible for someone to determine your identity and the crypto assets you own. You therefore acknowledge that your activity relating to using is not private and may be visible to third parties, including on public blockchains. * Disruptions and cyber risks * The functioning of the Services may be disrupted from time to time because of system overloads, software or hardware issues, power outages, errors, or instability in experimental features or issues with the functioning of other services and software on which the Interface is dependent. * Users face the risk of cybersecurity events, which may negatively affect the operation of the Services and their availability. * Users accept that we have no liability to them for any losses arising from any such disruptions or cybersecurity events and that we do not warrant that their use will be error-free or uninterrupted. * Users acknowledge that it is their responsibility to ensure that any hardware and software and access credentials they use to access the Services and their wallets are kept secure. Users acknowledge that we are not liable for any security breaches or other failings of any such systems. \### 5. DISCLAIMER OF WARRANTIES – LIABILITY \#### 5.1 No right of withdrawal Consumer Users – within the meaning of the Consumer Code – expressly acknowledge and agree that the Services are to be carried out immediately. Therefore, under these Terms, Users that are considered as consumers – within the meaning of the Consumer Code – expressly waive their right of withdrawal, should such right exist, and give their express consent for the execution of the Terms and the Services before the end of the right of withdrawal. Therefore, these Terms are concluded as soon as they are accepted by the User, without both Parties having to wait for the expiration of the withdrawal period. \#### 5.2 No warranties by Usual Labs You expressly understand and agree that your use of the Services and/or the Interface is at your sole risk. The Services (including the Interface) are provided "as is" and "as available," without warranties of any kind, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose, or non-infringement. You acknowledge and expressly agree that we have no control over, and no duty to take any action regarding: which users gain access to or use the Services; what effects the content of the Interface may have on you; how you may interpret or use the content of the Interface. There are no warranties that access to the Interface and/or the Services will be continuous, uninterrupted, timely, or secure, that the information made available via, contained on, or used by the Interface, will be accurate, reliable, complete, or current, or that the Services will be free from errors, defects, viruses, or other harmful material. You acknowledge and expressly accept that the Interface and/or the Services (a) may contain bugs, errors, and defects, (b) may function improperly or be subject to periods of downtime and unavailability, (c) may result in total or partial loss or corruption of data, and (d) may be modified at any time, including through the release of subsequent versions, all with or without notice to you. No advice, information, or statement that any contributor to the Protocol makes should be treated as creating any warranty concerning the Services. We do not endorse, guarantee, or assume responsibility for any advertisements, offers, or statements made by third parties concerning the Services or the Interface. You acknowledge and expressly agree that we are not responsible for transferring, safeguarding, or maintaining your private keys or any digitalcrypto currency associated therewith. If you lose, mishandle, or have stolen associated digitalcrypto currency private keys, you acknowledge and expressly agree that you may not be able to recover associated digitalcrypto assets, and that we are not responsible for such loss. You acknowledge and expressly agree that we are not responsible for any loss, damage, or liability arising from your failure to comply with the terms hereunder. \#### 5.23 Limitation of Liability You acknowledge and expressly agree that you assume full responsibility for your use of the Services and/or the Interface. You acknowledge and expressly agree that any information you send or receive during your use of the Services and/or the Interface may not be secure and may be intercepted or acquired by unauthorized parties. You acknowledge and expressly agree that your use of the Services and/or the Interface is at your own risk. Recognizing such, you understand and agree that, to the fullest extent permitted by applicable Law, we will not be liable to you for any direct, indirect, incidental, special, consequential, punitive, exemplary, or other damages of any kind, including without limitation damages for loss of profits, goodwill, use, data, or other tangible or intangible losses or any other damages based on contract, tort, strict liability, or any other theory (even if we had been advised of the possibility of such damages), resulting from: the Services and/or the Interface; the use or the inability to use the Services and/or the Interface; unauthorized access to or alteration of your transmissions or data; statements or conduct of any third party on the Services and/or the Interface; any actions we take or fail to take as a result of communications you send to us; errors; technical malfunctions; failures, including public utility or telephone outages; omissions, interruptions, latency, deletions, or defects of any device or network, providers, or software (including, but not limited to, those that do not permit participation in the Services); any injury or damage to computer equipment; inability to fully access the Services and/or the Interface or any other website; theft, tampering, destruction, or unauthorized access to, images or other content of any kind; data that is processed late or incorrectly or is incomplete or lost; typographical, printing, or other errors, or any combination thereof; or any other matter relating to the Services and/or the Interface. The Company shall not be liable for any losses, damages, or liabilities arising directly or indirectly from any unauthorized access, breach, or hack of the underlying Protocol, or any third-party software, hardware, or services utilized by the User. The User acknowledges and agrees that decentralized finance (DeFi) protocols and blockchain technology involve inherent risks, including potential vulnerabilities in the Protocol or the User Devices, which may result in partial or total loss of funds. The Company does not guarantee the security or functionality of the Protocol, and it is the User's sole responsibility to take all necessary precautions to protect their assets and private keys. ADDU may, at its sole discretion, decide to conduct an Airdrop of Usual tokens to eligible Users. Participation in the Airdrop is not guaranteed, and ADDU reserves the right to modify, suspend, or cancel the Airdrop at any time, without notice or liability. ADDU and/or the Company shall not be liable for any losses, damages, or liabilities arising from the User’s failure to receive, claim, or secure the distributed Usual tokens, including, but not limited to, losses due to technical issues, user errors, incorrect wallet addresses, third-party service failures, or unauthorized access to the User’s wallet. The User acknowledges that participation in the Airdrop involves inherent risks and accepts full responsibility for securing any tokens received. \#### 5.34 Indemnification You agree to release and to indemnify, defend, and hold harmless Usual Labs and its affiliates, from and against any and all losses, liabilities, expenses, damages, costs (including attorneys' fees, fees or penalties imposed by any regulatory authority and court costs) claims, or actions of any kind whatsoever arising or resulting from your use of the Services and/or the Interface, your violation of these Terms, your violation of any Law, rule, or regulation, or the rights of any third party, and any of your acts or omissions that implicate publicity rights, defamation, or invasion of privacy. \### 6. LIMITATION OF PARTICIPATION – TERMINATION – ACCOUNT CLOSURE \#### 6.1 Termination by Us To the maximum extent permitted by applicable law, we may at any time and without liability, terminate, suspend, or limit your use of the Services, including, but not limited to, where: (a) we reasonably suspect you of acting in breach of these Terms and/or all other applicable terms; (b) we are required to do so by applicable Law, regulation, or any court or other authority to which the use of the Services is subject to in any jurisdiction; (c) we suspect that your use of the Services is potentially connected to any unlawful activities (including but not limited to money laundering, terrorism financing, and fraudulent activities); (d) we have concerns that the Services are being used in a fraudulent or unauthorized manner. You shall not be entitled to any payment, compensation, or damages whatsoever from us in relation to any suspension, limitation, or termination of your use of the Services for any reason whatsoever. Any suspension, limitation, or termination of your use of the Services for any reason whatsoever shall not release you from any liability or responsibility on your part, which at the time of such suspension, limitation, or termination, has already accrued. The rights of suspension, limitation, and termination under these Terms shall be without prejudice to any other rights or remedies which we may have (whether under these Terms, applicable law, or otherwise). \#### 6.2 Consequences of Termination You will no longer be entitled nor able to use the Services. \### 7. PROCESSING OF PERSONAL DATA The data protection and cookie policy is available at https://gitbook.usual.money/ressources-and-ecosystem/privacy-policy. \### 8. GENERAL PROVISIONS \#### 8.1 Third-Party Links The Interface may provide, or third parties may provide, links to other websites, applications, or resources. Because we have no control over such sites, applications, and resources, you acknowledge and expressly agree that we are not responsible for the availability of such external sites, applications, or resources, and do not endorse and are not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that we shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any such content, goods, or services available on or through any such site or resource. \#### 8.2 Entire Agreement Except otherwise provided herein, these termsTerms (as amended from time to time) and any document expressly referred to hereof constitute the entire agreement between the parties and supersede any prior agreement, promise, assurance, warranty, representation, understanding, undertaking, or arrangement between the parties relating to the subject matter of these termsTerms, whether written or oral. No oral explanation or oral information given by either of us shall alter the interpretation of these Terms. You confirm that, in agreeing to accept these Terms, you have not relied on any representation that is not expressly included herein. \#### 8.3 Severability These Terms shall be deemed severable, and the invalidity or unenforceability of any term or provision hereof shall not affect the validity or enforceability of these Terms or of any other term or provision hereof. Furthermore, such invalid or unenforceable term or provision shall be changed and interpreted to accomplish the objectives of the initial provision to the greatest extent possible under any applicable laws. \#### 8.4 Language These Terms are concluded in the English language upon your request and all communications, including any notices or information being transmitted, shall be in English. In the event that these Terms or any part of it is translated (for any proceedings, for your convenience, or otherwise) into any other language, the English language shall prevail. \#### 8.5 Waiver The delay of enforcement or the non-enforcement of any of the terms of these Terms by any party shall not be construed as a waiver of any of the other rights of that party under these Terms and no right, power, or remedy conferred upon or reserved for any party in these Terms is exclusive of any other right, power, or remedy available to that party and each such right, power, or remedy shall be cumulative. \#### 8.6 Notices and Communications By using the Services and/or the Interface, you agree that we may provide you with any notices or other communications, including marketing, relating to your use of the Services and/or the Interface: (a) via email (in each case to the address that you provide), SMS message, Discord message, or telephone call (in each case to the phone number that you provide), or (b) by posting to the Interface or on Twitter. For notices made by email, the date of receipt will be deemed the date on which such notice is transmitted. You will always be given the option to unsubscribe from receiving any marketing material from us. \#### 8.7 Section Titles The section titles in the Terms are for convenience only and have no legal or contractual effect. \#### 8.8 Pre-contractual information – Customer acceptance The consumer User acknowledges having been informed in a comprehensible manner, by means of the availability of the present Terms, prior to accepting these Terms: * on the essential characteristics of the Services, taking into account the communication medium used; * on the price of the Services; * on the terms of payment, supply and performance of the Terms; * the identities of Usual Labs and ADDU, their postal and electronic contact details, as well as their activities, if they are not apparent from the context, * on legal and contractual guarantees and their implementation; * on the possibility of resorting to conventional mediation in the event of a dispute; * on the absence of right of withdrawal and other important contractual conditions. The fact that Users use the Interface and/or the Services implies full acceptance of these Terms, which is expressly acknowledged by the User, who waives, in particular, the right to rely on any contradictory document, which would be unenforceable against Usual Labs. \#### 8.9 Governing Law, Mediation and Submission to Jurisdiction These Terms shall be governed and construed in accordance with the laws of France have . In case of a dispute as to the interpretation of execution of these Terms, the parties will make every effort to find an amicable solution. Any User who is a consumer within the meaning of applicable law may, free of charge, refer to the services of a consumer mediator with a view to the amicable resolution of a dispute with Usual Labs. The body appointed by Usual Labs for this purpose will be determined In order to contact this body, the User may: * go to the mediator’s site and fill in the online form, enclosing supporting documents; or * send their complaint by post to the mediator’s address. A dispute may only be examined by the consumer mediator if: * the User justifies having tried, beforehand, to resolve his dispute directly with Usual Labs by a written complaint expressly identified as such detailing the reasons for his complaint as well as all the information useful to Usual Labs to understand, study and appreciate the causes, consequences and incidences of this complaint, and sent by e-mail to: \[mail\]; * the claim is not manifestly unfounded or abusive; * the dispute has not been previously examined or is not being examined by another mediator or by a court; * the User submits his request to the mediator within a maximum of one year from the date of his written complaint to Usual Labs; * the dispute falls within the competence of the mediator. The User will be informed by the mediator of the action taken on his or her request for mediation. Furthermore, the User is informed that in accordance with Article 14 of Regulation (EU) No. 524/2013, the European Commission has set up an Online Dispute Resolution platform, facilitating the independent settlement by extrajudicial means of online disputes between consumers and professionals in the European Union. This platform is accessible at the following link: https://webgate.ec.europa.eu/odr/. Users. In the absence of an amicable resolution, You acknowledge and accept that in the event of a claim or dispute, they shall be submitted to the exclusive jurisdiction to settle any dispute arising from or connected with these Terms (including a dispute of the Courts of Paris (Tribunal de Commerce de Paris). EU-based consumers Users. These provisions relating to the existence, validity, or termination of these Terms or the consequences of their nullity or any non-contractual obligation arising out of or in connection with these Terms).applicable law and the competent jurisdictions are applicable subject to the imperative provisions that would have to be applied to the user in his capacity as a consumer. Users must bring any and all legal claims pertaining to the Services in their individual capacities and not as a claimant in or member of any purported class action, collective action, private attorney general action, or other representative proceeding. Users agree to waive the right to demand a trial by jury, where applicable. [PreviousGlossarychevron-left](https://tech.usual.money/support/glossary) [NextLegal Noticechevron-right](https://tech.usual.money/legal/legal-notice) Last updated 1 year ago Was this helpful? Was this helpful? --- # Lido wstETH Oracle | Usual Tech Docs circle-info The contract operates under the assumption that stETH maintains a 1:1 peg with ETH, as stETH represents staked ETH in the Lido protocol. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------------------ The `LidoProxyWstETHPriceFeed` contract is a specialized oracle implementation that serves as a proxy for the Lido wstETH/ETH price feed. It implements the Chainlink AggregatorV3Interface to provide standardized price feed data for wstETH in terms of ETH, making it compatible with the broader Chainlink oracle ecosystem. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#contract-summary) Contract Summary ------------------------------------------------------------------------------------------------------------------------------------ This contract acts as a wrapper around the Lido wstETH contract, converting the stETH per token ratio into a standardized price feed format. It maintains compatibility with the Chainlink AggregatorV3Interface while providing real-time wstETH/ETH price data. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#key-features) Key Features 1. **Chainlink Compatibility** * Implements the AggregatorV3Interface * Provides standardized price feed data structure * Maintains consistent decimal precision (18 decimals) 1. **Real-time Price Data** * Fetches live wstETH/ETH conversion rates from the Lido contract * Updates price data on every query * Provides both round-specific and latest price data 1. **Standardized Interface** * Returns price data in a format compatible with Chainlink consumers * Includes round information, timestamps, and price values * Maintains consistent decimal precision across all operations ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#public-external-functions) Public/External Functions * `decimals()`: Returns the number of decimals used in the price feed (18) * `description()`: Returns the description of the price feed ("wstETH / ETH") * `version()`: Returns the version of the price feed implementation (1) * `getRoundData(uint80 roundId_)`: Returns historical price data for a specific round * `latestRoundData()`: Returns the most recent price data Returns: * `roundId`: The latest round ID (always 1) * `answer`: The current wstETH/ETH price * `startedAt`: Current block timestamp * `updatedAt`: Current block timestamp * `answeredInRound`: The round ID (always 1) #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#state-variables) State Variables * `WST_ETH_CONTRACT`: Immutable address of the Lido wstETH contract * `PRICE_FEED_DECIMALS`: Constant value of 18, representing the number of decimals used in price feed output #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#error-handling) Error Handling `InvalidDecimalsNumber()`: Thrown when the wstETH contract's decimals don't match the expected PRICE\_FEED\_DECIMALS (18) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#security-considerations) Security Considerations 1. I**mmutable Contract Address** * The wstETH contract address is set during construction and cannot be changed * Prevents potential manipulation of the price source 1. **Decimal Validation** * Validates the wstETH contract's decimals during construction * Ensures consistent decimal precision across the system 1. **Real-time Price Updates** * Price data is fetched directly from the Lido contract on each query * No stale price data is stored or returned Integration Notes 1. **Chainlink Compatibility** * Can be used as a drop-in replacement for Chainlink price feeds * Compatible with any system expecting AggregatorV3Interface implementation 1. **Price Data Usage** * The answer returned represents the wstETH/stETH exchange rate based on the `stEthPerToken()` function * All price data is returned with 18 decimal precision * Timestamps are based on block.timestamp for real-time accuracy 1. **Round Data** * While the contract implements the round-based interface, it doesn't maintain historical round data * All round queries return current price data with appropriate round identifiers [PreviousETH0 Abstract Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eth0/eth0-abstract-oracle) [NextEUR0chevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eur0) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#contract-summary) * [Key Features](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#key-features) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#functions-description) * [Security Considerations](https://tech.usual.money/smart-contracts/utility-contracts/eth0/lido-wsteth-oracle#security-considerations) Was this helpful? --- # Circle EURC/EUR Oracle | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#high-level-overview) High-Level Overview The CircleEurcOracle contract is a specialized oracle implementation that serves as a proxy for Circle EURC price feeds. It implements the Chainlink AggregatorV3Interface to provide standardized price feed data for EURC in terms of EUR (not USD), making it compatible with the broader Chainlink oracle ecosystem. **The aim of this oracle is to return a price of EURC in EUR and not in USD.** ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#contract-summary) Contract Summary This contract acts as a wrapper around two separate Chainlink price feeds (EURC/USD and EUR/USD), converting the USD-denominated prices into a standardized EURC/EUR price feed format. It maintains compatibility with the Chainlink AggregatorV3Interface while providing real-time EURC/EUR price data through cross-rate calculation. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#key-features) Key Features #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#chainlink-compatibility) Chainlink Compatibility * Implements the AggregatorV3Interface * Provides standardized price feed data structure * Maintains consistent decimal precision (8 decimals) #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#cross-rate-price-calculation) Cross-Rate Price Calculation * Fetches live EURC/USD and EUR/USD conversion rates from Chainlink feeds * Calculates EURC/EUR price through cross-rate conversion: `EURC/EUR = (EURC/USD) / (EUR/USD)` * Updates price data on every query using the most recent available data #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#standardized-interface) Standardized Interface * Returns price data in a format compatible with Chainlink consumers * Includes round information, timestamps, and price values * Maintains consistent decimal precision across all operations ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#public-external-functions) Public/External Functions * `**decimals()**`: Returns the number of decimals used in the price feed (8) * `**description()**`: Returns the description of the price feed ("EURC / EUR") * `**version()**`: Returns the version of the price feed implementation (1) * `**getRoundData(uint80 roundId_)**`: Returns historical price data for a specific round * `**latestRoundData()**`: Returns the most recent price data **Returns:** * **roundId**: The round ID from the EURC/USD feed * **answer**: The calculated EURC/EUR price * **startedAt**: Timestamp from the EURC/USD feed * **updatedAt**: Minimum timestamp between EURC/USD and EUR/USD feeds * **answeredInRound**: The round ID from the EURC/USD feed ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#state-variables) State Variables * `**EURC_USD_FEED**`: Immutable address of the EURC/USD Chainlink price feed * `**EUR_USD_FEED**`: Immutable address of the EUR/USD Chainlink price feed * `**PRICE_FEED_DECIMALS**`: Constant value of 8, representing the number of decimals used in price feed output ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#error-handling) Error Handling * **InvalidDecimalsNumber()**: Thrown when either price feed's decimals don't match the expected PRICE\_FEED\_DECIMALS (8) ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#security-considerations) Security Considerations #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#immutable-contract-addresses) Immutable Contract Addresses * Both price feed addresses are set during construction and cannot be changed * Prevents potential manipulation of the price sources #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#decimal-validation) Decimal Validation * Validates both price feeds' decimals during construction * Ensures consistent decimal precision across the system #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#cross-rate-calculation) Cross-Rate Calculation * Price data is calculated in real-time using the latest available data from both feeds * Uses the minimum timestamp between both feeds to ensure data freshness * No stale price data is stored or returned #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#price-feed-independence) Price Feed Independence * Relies on two independent Chainlink price feeds * Reduces single points of failure in price discovery * Provides more robust price data through cross-validation ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#integration-notes) Integration Notes #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#chainlink-compatibility-1) Chainlink Compatibility * Can be used as a drop-in replacement for Chainlink price feeds * Compatible with any system expecting AggregatorV3Interface implementation #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#price-data-usage) Price Data Usage * The answer returned represents the EURC/EUR exchange rate calculated as: `(EURC/USD price) / (EUR/USD price)` * All price data is returned with 8 decimal precision * Timestamps are synchronized between both feeds for accuracy #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#round-data) Round Data * Historical round data is based on the EURC/USD feed's round structure * EUR/USD data is always fetched from the latest round for cross-rate calculation * Round queries return calculated prices with appropriate round identifiers [PreviousEUR0 Classical Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eur0/eur0-classical-oracle) [NextMonerium Swapper Helperchevron-right](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper) Last updated 1 month ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#contract-summary) * [Key Features](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#key-features) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#functions-description) * [State Variables](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#state-variables) * [Error Handling](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#error-handling) * [Security Considerations](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#security-considerations) * [Integration Notes](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle#integration-notes) Was this helpful? --- # USUAL Distribution | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#high-level-overview) High-Level Overview -------------------------------------------------------------------------------------------------------------------------------------------- This contract manages a **Distribution** process of the Usual token. The contract should be called daily to calculate how many new tokens are created, distributed to on-chain vaults (UsualX and UsualS) and how many tokens are available to claim for the off-chain users with a valid merkle proof. The core features of this contract include: * **Daily Distribution**: The contract should be called daily to calculate how many new tokens are created, distributed to On Chain vaults (UsualX and UsualS) and how many tokens are available to claim for the off-chain users with a valid merkle proof. The amount distributed scales based on how much longer (after one day) it has been since the last distribution to account for calling the function at greater than 24 hour periods. * **Merkle Proof for Off-Chain Users**: Ensures that only eligible users, validated through merkle proofs, can receive tokens from the distribution. * **Challengeable Queue of Merkle Proofs**: The contract should have a queue of merkle proofs that can be challenged by a specific role (e.g. governance) to ensure that the off-chain distribution is fair and correct. * **Access Control**: Each functionality should be controlled by a role with minimal required permissions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#inherited-contracts) Inherited Contracts * **Initializable**: For upgradeable contract initialization. * **PausableUpgradeable**: Allows contract execution to be paused or unpaused by an authorized role. * **ReentrancyGuardUpgradeable**: Provides protection against reentrancy attacks. * **IDistributionModule**: Interface that defines all functions that can be called by anyone. * **IDistributionAllocator**: Interface that defines the functions that can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE` * **IDistributionOperator**: Interface that defines the functions that can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. Those functions are used to daily distribute the Usual tokens to on-chain and off-chain buckets. * **IOffChainDistributionChallenger**: Interface that defines the functions that can be only called by the `OFF_CHAIN_DISTRIBUTION_CHALLENGER_ROLE`. Those functions are used to challenge the off-chain distribution in the queue. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#functionality-description) Functionality Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#public-external-functions) Public/External Functions * **initialize**: Initializes the contract with the registry address and sets the initial `rate0` value * **pause**: Admin function to pause the contract. Can be only called by `PAUSING_CONTRACTS_ROLE` * **unpause**: Admin function to unpause the contract. Can be only called by `DEFAULT_ADMIN_ROLE` #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#idistributionmodule) IDistributionModule * **getBucketsDistribution**: Returns the current buckets distribution percentages in basis points. Off-chain buckets are LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers. On-Chain buckets are UsualX and UsualS. * **calculateUsualDist**: Helper view function that calculates a simulated Usual Distribution for the provided `ratet` and `p90Rate` values. It returns `st`, `rt` and `kappa` values that were used in the calculation. * **calculateSt**: Helper view function that returns a calculated `st` value based on provided `supplyPpt` and `pt` values. * **calculateRt**: Helper view function that returns a calculated `rt` value based on provided `ratet` and `p90Rate` values. * **calculateMt**: Helper view function that returns a calculated `mt` value based on provided `st`, `rt` and `kappa` values. * **getOffChainDistributionData**: Returns the currently approved off-chain distribution `timestamp` and `merkleRoot` values. That can be used to pre-validate the merkle proof before calling the `claimOffChainDistribution` function. * **getOffChainDistributionQueue**: Returns the current off-chain distribution queue. The queue is a list of `timestamp` and `merkleRoot` values that are used to claim the off-chain distribution. * **getOffChainDistributionMintCap**: Returns the current off-chain distribution mint cap value. This value is the maximum amount of tokens that can be minted by through the off-chain distribution. It is reduced with every successful claim. * **approveUnchallengedOffChainDistribution**: Approves the latest unchallenged off-chain distribution from the queue that was in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`. All distributions that were in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` are removed from the queue. Even if anyone can call this function, usually it will be called by the `DISTRIBUTION_OPERATOR_ROLE`. * **getOffChainTokensClaimed**: Returns the amount of the tokens claimed by the given `account` address in the off-chain distribution until now. * **claimOffChainDistribution**: Allows to claim the Usual tokens from the latest approved off-chain distribution. Caller should provide a valid merkle proof for the provided `account` and `amount`. The `amount` is the total amount of tokens that were assigned for the given `account` address since the beginning of the distribution. The Usual tokens are minted when the proof is valid and the given `account` has any tokens to claim in the approved off-chain distribution. The given `account` will only receive the tokens that were not claimed by them before based on the value returned by the `getOffChainTokensClaimed` function. The mint cap should be reduced by the claimed amount. The `getOffChainTokensClaimed` should return increased value. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#idistributionallocator) IDistributionAllocator * **setBucketsDistribution**: Allows to set the new buckets distribution percentages in basis points. The sum of all values should be equal to `BASIS_POINT_BASE`. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. Off-chain buckets are LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers. On-Chain buckets are Usual+ and Usual\*. * **setFeeRates**: Allows to set the Treasury, UsualX and Burn fee rates. * **getFeeRates**: Allows to get the Treasury, UsualX and Burn fee rates. * **setD**: Set `D` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getD**: Returns the current `D` parameter value. * **setM0**: Set `m0` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getM0**: Returns the current `m0` parameter value. * **setRateMin**: Set `rateMin` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getRateMin**: Returns the current `rateMin` parameter value. * **setBaseGamma**: Set `baseGamma` parameter used it the emissions calculation formula. The function can be only called by the `DISTRIBUTION_ALLOCATOR_ROLE`. * **getBaseGamma**: Returns the current `baseGamma` parameter value. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#idistributionoperator) IDistributionOperator * **distributeUsualToBuckets**: Calculates the Usual emissions based on the current state of parameters and provided `ratet` and `p90Rate` values. For on-chain buckets (Usual+ and Usual\*) the tokens are minted directly to the bucket and a vault specific distribution is started. For off-chain buckets (LST, LYT, IYT, Bribe, Ecosystem, DAO, and Market Makers) mint is delayed until the off-chain distribution is approved and tokens are claimed. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. * **queueOffChainDistribution**: Queues the off-chain distribution for the given `merkleRoot`. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. This function cannot be called more than once per 24 hours. * **resetOffChainDistributionQueue**: Removes all off-chain distributions from the queue. This is an emergency functionality is queue ever gets to big to be pruned during a `approveUnchallengedOffChainDistribution` call. The function can be only called by the `DISTRIBUTION_OPERATOR_ROLE`. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#ioffchaindistributionchallenger) IOffChainDistributionChallenger * **challengeOffChainDistribution**: Challenges all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. The function can be only called by the `DISTRIBUTION_CHALLENGER_ROLE`. * **challengeAndProposeOffChainDistribution**: Challenges all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. The new off-chain distribution is proposed with the given `merkleRoot` and it still has to wait in the queue for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. The function can be only called by the `DISTRIBUTION_CHALLENGER_ROLE`. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#functionality-breakdown) Functionality Breakdown ---------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#setting-up-calculations-parameters) Setting up calculations parameters * `DISTRIBUTION_ALLOCATOR_ROLE` can change all the values that are used in the emissions calculations formula. There is no timelock for those changes. * `DISTRIBUTION_ALLOCATOR_ROLE` can change the distribution buckets shares percentages. The sum of all values should be equal to 100% (in basis points). There is no timelock for those changes. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#daily-emissions) Daily Emissions * `DISTRIBUTION_OPERATOR_ROLE` is required to call the `distributeUsualToBuckets` every 24 hours to calculate the new emissions and distribute them to the on-chain buckets and increase the off-chain buckets mint cap that can be claimed after successful approval of the off-chain distribution that is unchallenged and in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`. * By calling `distributeUsualToBuckets`, this contract will sweep fees accumulated on `Usd0PP` and `UsualX` contracts and, if any, will redistribute those fees depending of fee rates. Those fees will be distributed to UsualX holders, Yield Treasury contract and will be burned. Fee rates can only be changed by the `FEE_RATE_SETTER_ROLE` and the sum of them should be equal to `BASIS_POINT_BASE` (10\_000). * `DISTRIBUTION_OPERATOR_ROLE` is required to call the `queueOffChainDistribution` with a valid `merkleRoot` as soon as the off-chain distribution mint cap is increased. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#off-chain-distribution-queue-approval-and-challenges) Off-Chain Distribution Queue, Approval and Challenges * Once `DISTRIBUTOR_OPERATOR_ROLE` puts a new off-chain distribution in the queue, it has to wait for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. * Anyone can call the `approveUnchallengedOffChainDistribution` function to approve the latest unchallenged off-chain distribution from the queue that was in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD`. This function will remove all distributions that were in the queue for more than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` which impacts the gas cost of the function. In normal circumstances, there should be only one distribution in the queue that is older than `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` and has to be removed. * `DISTRIBUTION_CHALLENGER_ROLE` can call the `challengeOffChainDistribution` function to challenge all off-chain distributions in the queue that are older than specified timestamp. They are marked as challenged and cannot be approved. In rare cases, a new off-chain distribution can be proposed and it is put in the queue. * The queue should be treated as unordered. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#merkle-tree-root) Merkle Tree Root * The merkle tree root that is queued should be calculated off-chain and should include `account` and `amount` values for each user that is eligible for claiming the off-chain distribution. The `amount` value should be the total amount of tokens that were assigned for the given `account` address since the beginning of the distribution. The `amount` value for the given `account` should never decrease. The `account` address should be in the format `0x123...` and the `amount` should be in wei. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#merkle-proof-validation) Merkle Proof Validation All claims are validated against a Merkle tree using the `MerkleProof` library, ensuring that only eligible users can receive tokens. Separate Merkle roots are set for the initial and vesting periods. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#admin-control) Admin Control Administrators have control over setting key contract parameters, such as the Merkle roots and penalty percentages, as well as pausing the contract in case of emergencies. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#constants) Constants ------------------------------------------------------------------------------------------------------------------------ * **DEFAULT\_ADMIN\_ROLE**: Role required to unpause the contract * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract * **DISTRIBUTION\_ALLOCATOR\_ROLE**: Role required to set the distribution parameters and buckets distribution percentages * **DISTRIBUTION\_OPERATOR\_ROLE**: Role required to distribute the Usual tokens to buckets and queue the off-chain distribution * **DISTRIBUTION\_CHALLENGER\_ROLE**: Role required to challenge the off-chain distribution in the queue * **FEE\_RATE\_SETTER\_ROLE**: Role required to set the fee rates. * **USUAL\_DISTRIBUTION\_CHALLENGE\_PERIOD**: The period in seconds that the off-chain distribution has to wait in the queue before it can be approved. It is 7 days by default. * **CONTRACT\_REGISTRY\_ACCESS**: This constant is used to define the address of the registry access contract. * **CONTRACT\_ORACLE**: This constant is used to define the address of the oracle contract. * **CONTRACT\_USD0**: This constant is used to define the address of the USD0 contract. * **CONTRACT\_USD0PP**: This constant is used to define the address of the USD0PP contract. * **CONTRACT\_USUAL**: This constant is used to define the address of the Usual contract. * **CONTRACT\_USUALSP**: This constant is used to define the address of the UsualSP contract. * **CONTRACT\_USUALX**: This constant is used to define the address of the UsualX contract. * **CONTRACT\_DAO\_COLLATERAL**: This constant is used to define the address of the DAO collateral contract. * **CONTRACT\_YIELD\_TREASURY**: This constant is used to define the address of the Yield Treasury contract. * **BASIS\_POINT\_BASE**: The base value for calculating percentages in basis points. * **BPS\_SCALAR**: The scalar value for calculating percentages in basis points. * **SCALAR\_ONE**: The scalar value for calculating percentages with 10^18 precision. * **REWARD\_PERIOD\_SCALAR**: The scalar value for calculating time since last distribution above 1 day in seconds. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#safeguard-implementation) Safeguard Implementation ------------------------------------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#reentrancy-guard) Reentrancy Guard All external function handling token mints and transfer are protected with `ReentrancyGuard` to prevent reentrancy attacks. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#access-control) Access Control The contract uses `CheckAccessControl` to enforce role-based access control, ensuring only authorized addresses can perform actions that require specific permissions. Each role has minimal required permissions. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#pausability) Pausability The contract is pausable by `PAUSING_CONTRACTS_ROLE`, enabling the ability to pause all operations in case of an emergency. The contract can be resumed only by `DEFAULT_ADMIN_ROLE`. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#off-chain-distribution-queue-and-challenge-mechanism) Off-chain distribution queue and challenge mechanism The off-chain distribution can be validated for `USUAL_DISTRIBUTION_CHALLENGE_PERIOD` before it can be approved. If an invalid distribution is proposed, it can be challenged by the `DISTRIBUTION_CHALLENGER_ROLE` making it impossible to be approved. If the queue ever gets too big, the `resetOffChainDistributionQueue` function can be called by the `DISTRIBUTION_OPERATOR_ROLE` to remove all off-chain distributions from the queue. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#restrictions-how-often-certain-functions-can-be-called) Restrictions how often certain functions can be called There is a 24 hours limit for the `calculateUsualDist` function to be called. To prevent unwanted emissions and distribution. [PreviousUSUAL\* Vested Allocation Stakingchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking) [NextDistribution Modulechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module) Last updated 8 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#contract-summary) * [Functionality Description](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#functionality-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#functionality-breakdown) * [Setting up calculations parameters](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#setting-up-calculations-parameters) * [Daily Emissions](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#daily-emissions) * [Off-Chain Distribution Queue, Approval and Challenges](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#off-chain-distribution-queue-approval-and-challenges) * [Merkle Tree Root](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#merkle-tree-root) * [Merkle Proof Validation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#merkle-proof-validation) * [Admin Control](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#admin-control) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#constants) * [Safeguard Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#safeguard-implementation) * [Reentrancy Guard](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#reentrancy-guard) * [Access Control](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#access-control) * [Pausability](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#pausability) * [Off-chain distribution queue and challenge mechanism](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#off-chain-distribution-queue-and-challenge-mechanism) * [Restrictions how often certain functions can be called](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution#restrictions-how-often-certain-functions-can-be-called) Was this helpful? --- # Mint & Redeem Engine | Usual Tech Docs [hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#overview) Overview --------------------------------------------------------------------------------------------------- The mint and redeem engine of the Usual protocol, combines two smart contracts: **DaoCollateral** and **Swapper Engine**. These contracts work in tandem to manage the creation and redemption of USD0 and EUR0, stablecoins backed by Real World Assets (RWAs). Together, they ensure the full collateralization, while providing users with a seamless, non-custodial trading experience. This system is enhanced by an intent-based matching system and an order-matching mechanism, offering an efficient and transparent process for minting, redeeming, and swapping USD0, EUR0 with USDC and EURC respectively. The flows below display interactions, using USD0 as an example. Other Usual issued Stablecoins work similarly. chevron-right**Minting USD0 via DaoCollateral**[hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#minting-usd0-via-daocollateral) * A user who holds RWAs (represented as USYC tokens) interacts with the DaoCollateral contract to mint USD0 stablecoins * The user sends USYC tokens to the DaoCollateral contract, which calculates the equivalent amount of USD0 at the current exchange rate * USD0 is minted and provided to the user in exchange for their USYC tokens * This ensures that every USD0 in circulation is backed by RWAs, providing stability and security chevron-right**Redeeming USD0 via DaoCollateral**[hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#redeeming-usd0-via-daocollateral) * Users who hold USD0 stablecoins can redeem them for RWAs (USYC tokens) * The user invokes the redeem function, providing their USD0 to the DaoCollateral contract * The contract calculates the equivalent value of USYC tokens based on the current exchange rate and sends these tokens to the user, burning the corresponding USD0 in the process chevron-right**Swapping USDC and USD0 via Swapper Engine**[hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#swapping-usdc-and-usd0-via-swapper-engine) * Users can create orders specifying the amount of USDC they want to swap for USD0 by depositing USDC into the Swapper Engine * Other users can fill these orders by providing USD0, with the contract verifying their USD0 balance and allowance * The contract relies on an external oracle to fetch the current USDC price, ensuring that swaps happen at accurate and fair exchange rates * Partial or full matching of orders is allowed, depending on user preferences and order availability chevron-right**Three-Way Intent-Based Matching System**[hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#three-way-intent-based-matching-system) * In a three-party trade facilitated by DaoCollateral, a **USDC provider**, an **RWA provider**, and the **DaoCollateral contract** come together * The **USDC provider** deposits USDC into the Swapper Engine and receives USD0 in return. * The **RWA provider**, who holds RWAs (USYC tokens), submits an intent to exchange these tokens for USDC * The DaoCollateral contract mints new USD0 in exchange for the RWAs from the RWA provider and uses this newly minted USD0 to fulfill the USDC provider’s order. * Finally, the contract transfers the USDC from the Swapper Engine to the RWA provider, completing the trade * This intent-based matching system ensures efficient, non-custodial trading by allowing RWA providers to retain their assets until the trade is executed. [hashtag](https://tech.usual.money/overview/features/mint-and-redeem-engine#smart-contracts) Smart Contracts ----------------------------------------------------------------------------------------------------------------- [USD0 Swapper Enginechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) [USD0 DaoCollateralchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) [PreviousUSD0achevron-left](https://tech.usual.money/overview/features/usd0a) [NextEUR0chevron-right](https://tech.usual.money/overview/features/eur0) Last updated 4 months ago Was this helpful? * [Overview](https://tech.usual.money/overview/features/mint-and-redeem-engine#overview) * [Smart Contracts](https://tech.usual.money/overview/features/mint-and-redeem-engine#smart-contracts) Was this helpful? --- # Chainlink Oracles | Usual Tech Docs [Chainlinkarrow-up-right](https://chain.link/) , the standard for onchain finance, has provided us with USD0 and bUSD0 (formerly USD0++) price feeds that are available on Ethereum. [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles#usd0) USD0 ----------------------------------------------------------------------------------------------------------- [![Logo](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2Fd2f70xi62kby8n.cloudfront.net%2Fchainlink.png%3Fauto%3Dcompress%252Cformat&width=20&dpr=3&quality=100&sign=9207feae&sv=2)USD0 / USD Price Feed | Chainlinkchainlinkchevron-right](https://data.chain.link/feeds/ethereum/mainnet/usd0-usd) USD0/USD Pricefeed Etherscan: [0x7e891DEbD8FA0A4Cf6BE58Ddff5a8ca174FebDCBarrow-up-right](https://etherscan.io/address/0x7e891DEbD8FA0A4Cf6BE58Ddff5a8ca174FebDCB) [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles#busd0-formerly-usd0) bUSD0 (formerly USD0++) --------------------------------------------------------------------------------------------------------------------------------------------- Etherscan: [0xFC9e30Cf89f8A00dba3D34edf8b65BCDAdeCC1cBarrow-up-right](https://etherscan.io/address/0xfc9e30cf89f8a00dba3d34edf8b65bcdadecc1cb) [PreviousUSD0 Abstract Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/usd0/usd0-abstract-oracle) [NextPyth Oracleschevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usd0/pyth-oracles) Last updated 4 months ago Was this helpful? * [USD0](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles#usd0) * [bUSD0 (formerly USD0++)](https://tech.usual.money/smart-contracts/utility-contracts/usd0/chainlink-oracles#busd0-formerly-usd0) Was this helpful? --- # USUAL* Vested Allocation Staking | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#high-level-overview) High-Level Overview The **UsualSP** contract is a smart contract designed for managing the vesting and staking of **USUALS** token allocations. It allows insiders to vest and claim their **USUALS** allocations over a pre-defined vesting period and provides users (both insiders and outsiders) the ability to stake **USUALS** tokens to receive yield in the form of liquid allocations and rewards in **USUAL** tokens. Insiders can claim their vested **USUALS** allocations after a user-specific cliff period (multiple of the **ONE\_MONTH** constant), and these tokens are distributed in monthly increments. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#contract-summary) Contract Summary #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#inherited-contracts) Inherited Contracts * **RewardAccrualBase**: Base contract that handles the reward accrual mechanism for staked tokens. * **PausableUpgradeable**: Allows contract functionality to be paused by authorized accounts (OZ implementation). * **ReentrancyGuardUpgradeable**: Prevents reentrant attacks on sensitive functions (OZ implementation). * **IUsualSP**: Interface defining the required methods for the **UsualSP** contract. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#sc-flows) SC-Flows ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FlqBIwLrZFo6b79zMpBBF%252FSans%2520titre.svg%3Falt%3Dmedia%26token%3D4d6eaf94-6a4f-4f6b-8d07-10557c50a6a0&width=768&dpr=3&quality=100&sign=6f49753d&sv=2) #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#key-functionalities) Key Functionalities * **Vesting**: Insiders receive an initial **USUALS allocation** that is vested over a defined period. This allocation is released gradually, with insiders able to claim it from their start time and after their cliff period has passed. * **Claiming USUALS Allocations**: Insiders can claim their vested **USUALS** after the cliff period is over. The claimable amount is calculated based on the duration passed since the vesting started. * **Staking**: Users (including insiders) can stake their **USUALS** tokens to receive liquid allocations and rewards in **USUAL** tokens. These rewards accrue over time and can be claimed. * **Reward Accrual**: Users who stake **USUALS** tokens are eligible for rewards in **USUAL** tokens based on the staking duration and amount. * **Pause and Unpause**: Admins with specific role have the ability to pause and unpause the contract to safeguard against attacks or during upgrades. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#public-external-functions) Public/External Functions * **initialize**: Initializes the contract by setting the registry contract, vesting start date, and duration. * **claimOriginalAllocation**: Allows insiders to claim their vested **USUALS** allocations. * **stake**: Users can stake their **USUALS** tokens to receive liquid allocations. * **unstake**: Users can withdraw a portion of their staked **USUALS** tokens. * **claimReward**: Users can claim their accrued rewards in **USUAL** tokens based on their allocation. * **pause**: Pauses all token transfer operations; callable only by the PAUSING\_CONTRACTS\_ROLE. * **unpause**: Resumes all token transfer operations; also callable only by the DEFAULT\_ADMIN\_ROLE. * **allocate**: Function to allocate original **USUALS** allocations and set the vesting start times and cliff durations for insiders. Only callable by the USUALSP\_OPERATOR\_ROLE. * **stakeUsualS**: Sends the total supply of **USUALS** to the staking contract. Only callable by the USUALS contract. * **removeOriginalAllocation**: Function to remove the original allocation and claimed amounts for a list of recipients. Only callable by the USUALSP\_OPERATOR\_ROLE. * **startRewardDistribution**: Initiates the reward distribution process. Only callable by the Distribution Module contract. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: Registry access contract address. * **DEFAULT\_ADMIN\_ROLE**: Default admin role. Can unpause the contract. * **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract. * **USUALSP\_OPERATOR\_ROLE**: Role required for allocation management and staking operations. * **CONTRACT\_USUALS**: The address of the **USUALS** token contract. * **CONTRACT\_USUAL**: The address of the **USUAL** token contract. * **CONTRACT\_DISTRIBUTION\_MODULE**: The address of the Distribution Module contract. * **ONE\_MONTH**: Represents the duration of one month in seconds, used to calculate the vesting schedule. * **NUMBER\_OF\_MONTHS\_IN\_THREE\_YEARS**: Used to calculate the total vesting duration over three years. * **STARTDATE\_USUAL\_CLAIMING\_USUALSP:** The start date of the Usual claiming. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#safeguards-implementation) Safeguards Implementation * **Pausability**: Ensures that token transfers can be halted in case of emergency. * **Role-Based Access Control**: Restricts sensitive actions to addresses with appropriate roles. * **ReentrancyGuard**: All external-facing functions that handle transfers or state changes are protected from reentrancy attacks. [PreviousUSUAL stakingchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking) [NextUSUAL Distributionchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#functionality-breakdown) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#functions-description) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking#safeguards-implementation) Was this helpful? --- # sUSD0 | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#high-level-overview) High-Level Overview The sUSD0 contract is an upgradeable ERC4626-compliant yield-bearing vault. It extends the YieldBearingVault contract, incorporating features such as blacklisting, withdrawal fees, and yield distribution linearly over a predefined yield period. The contract leverages OpenZeppelin's upgradeable contracts for enhanced security and flexibility, including pausability and reentrancy protection. It also implements EIP712 for secure off-chain signing capabilities. The primary objective of sUSD0 is to provide a secure, controllable environment for yield generation and distribution on USD0 deposits, while maintaining strict control over who can interact with the contract. This design allows for potential regulatory compliance and risk management in decentralized finance applications. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#contract-summary) Contract Summary The contract provides the following main functions: * **initialize**: Sets up the contract with customizable parameters, including initial shares minting. * **pause / unpause**: Controls the operational state of the contract. * **blacklist / unBlacklist**: Manages addresses prohibited from interacting with the contract. * **startYieldDistribution**: Initiates a new yield accrual period with specified parameters. * **deposit / mint**: Handles asset deposits and share minting. * **depositWithPermit**: Enables gasless deposits using permit functionality. * **withdraw / redeem**: Handles asset withdrawals and share redemptions, incorporating withdrawal fees that are immediately transferred to the treasury yield contract. * **previewWithdraw / previewRedeem**: Simulates withdrawal and redemption operations for users. * **updateWithdrawFee**: Updates the withdrawal fee rate with proper access control. The contract uses a separate storage structure (SUsd0StorageV0) to store state variables for sUSD0 implementation. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#inherited-contracts) Inherited Contracts * **YieldBearingVault**: Provides core yield accrual and distribution mechanisms. * **PausableUpgradeable**: Enables emergency halt of contract operations. * **ReentrancyGuardUpgradeable**: Prevents reentrancy attacks in critical functions. * **EIP712Upgradeable**: Implements EIP712 for secure off-chain message signing. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#access-control-and-security) Access Control and Security: * Utilizes a registry contract for role-based access control. * Implements blacklist to prevent specific addresses from interacting with the contract. * Enforces pause mechanism for emergency situations. * Uses role-based permissions for administrative functions. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#yield-management) Yield Management: * Allows admin-controlled yield distribution periods via `SUSD0_YIELD_DISTRIBUTOR_ROLE`. * Accrues yield over time based on configurable parameters. * Integrates yield accrual with deposit and withdrawal operations. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#asset-management) Asset Management: * Implements ERC4626 standard for standardized vault interactions. * Handles deposits, withdrawals, and redemptions with consideration for accrued yield. * Applies withdrawal fees, immediately transferring them to the treasury yield contract for protocol revenue. * Mints initial "dead" shares during initialization to support early yield distribution. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#upgradability-and-pause-mechanism) Upgradability and Pause Mechanism: * Utilizes OpenZeppelin's upgradeable contract pattern for future improvements. * Includes pause functionality for emergency situations with separate roles for pausing and unpausing. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-initialize) Method: initialize Initializes the vault, token, yield module, EIP712 domain, registry contract and access control, setting up the vault's initial state. **1-3.** Set the registry contract, withdrawal fee in BPS, and initial shares to mint. **4-6.** Validates registry contract is not zero address, reverts if zero address. **7.** Load the contract storage. **8.** Retrieves the USD0 token address from the registry contract. **9-12.** Initializes inherited contracts, with initializer parameters including vault name and symbol from constants. **14-16.** Validates withdrawal fee is below 25% preventing excessive fees that could harm users. **18-20.** Validates initialShares is not zero, ensuring vault starts with a valid state. **22-24.** Sets up contract storage with registry access retrieved from the registry contract. **25-26.** Stores withdrawal fee and USD0 token reference. **27.** Retrieves and stores the treasury yield contract address from the registry. **29-31.** Initializes yield storage with initial shares and mints them to the contract itself, creating "dead" shares that allow for early yield distribution before user deposits. **33.** Emits an event with the new withdrawal fee. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-blacklist) Method: blacklist Adds an address to the blacklist, preventing it from interacting with the contract. **1.** Mark function as external to save gas. **2-4.** Prevents blacklisting of zero address, and reverts if trying to pass zero address. **5-6.** Utilizes the registry for role-based access control, restricting to `BLACKLIST_ROLE`. **7-9.** Reverts if the account is already blacklisted. **10.** Adds the account to the blacklist in SUsd0StorageV0. **12.** Emits an event to log the blacklisting action. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-_update) Method: \_update Internal hook ensuring that both sender and receiver are not blacklisted before updating the token balances. **1-4.** Internal function overriding the base ERC20Upgradeable implementation, includes `whenNotPaused` modifier to prevent transfers when contract is paused. **5.** Retrieves storage pointer for SUsd0StorageV0. **6-8.** Checks both sender and receiver against blacklist, reverting if either is blacklisted. **9.** Passes through to parent implementation if checks pass. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-startyielddistribution) Method: startYieldDistribution Initiates a new yield distribution period with specified parameters, wrapping the internal call to add proper access control. **1-3.** External function for starting a new yield period. **4-5.** Ensures only addresses with `SUSD0_YIELD_DISTRIBUTOR_ROLE` set on registry access can call this function. **6.** Delegates to internal function for yield distribution logic. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-_startyielddistribution) Method: \_startYieldDistribution Internal function to start the yield distribution with validation checks. **1-4.** Internal function overriding the base YieldBearingVault implementation. **5.** Gets reference to the underlying asset (USD0). **7-9.** Validates yield amount is not zero. **10-12.** Validates start time is in the future. **13-15.** Validates end time is after start time. **17.** Retrieves yield data storage. **19-21.** Validates new period starts after the current period finishes. **22-24.** Validates current time is after the current period finishes (prevents overlapping periods). **25.** Updates yield state to account for any accrued yield before starting new period. **27-28.** Calculates the yield rate per second using floor rounding to ensure conservative estimates. **30-32.** Validates contract has sufficient assets (deposits + yield amount) to support the yield distribution. **34-37.** Sets the new yield period parameters and activates yield distribution. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-depositwithpermit) Method: depositWithPermit Enables users to deposit assets using permit functionality, allowing gasless approvals. **1-8.** Public function marked as `nonReentrant` and `whenNotPaused` to prevent reentrancy and ensure contract is active. **9.** Attempts to execute permit signature to approve the contract to spend user's assets. If permit fails (e.g., token doesn't support permit), continues execution assuming approval already exists. **11.** Calls the standard deposit function with the approved assets. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-withdraw) Method: withdraw Overrides the ERC4626 withdraw function to include withdrawal fees and enforce withdrawal limits. Fees are immediately transferred to the treasury yield contract. **1-7.** Public function overriding the ERC4626 withdraw function, protected by `nonReentrant` and `whenNotPaused` modifiers. **8-9.** Retrieves storage pointers for SUsd0StorageV0 and YieldDataStorage. **10-14.** Checks if the withdrawal amount exceeds the maximum allowed (accounting for fees), and reverts if so. **16.** Calculates shares needed using previewWithdraw which accounts for fees. **17-20.** Calculates the withdrawal fee based on the assets being withdrawn. Uses ceiling rounding to ensure fees are not undercharged. The formula accounts for the fee being taken from assets beyond what the user receives. **22.** Calls parent withdrawal function with calculated values, which handles share burning and asset transfer to receiver. **23-24.** Deducts the fee from total deposits and immediately transfers the fee to the treasury yield contract. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-redeem) Method: redeem Overrides the ERC4626 redeem function to include redemption fees and enforce redemption limits. Fees are immediately transferred to the treasury yield contract. **1-7.** Public function overriding the ERC4626 redeem function, protected by `nonReentrant` and `whenNotPaused` modifiers. **8-9.** Retrieves storage pointers for SUsd0StorageV0 and YieldDataStorage. **11-14.** Checks if the redemption amount exceeds the maximum allowed, and reverts if so. **16-18.** Calculates assets the user will receive (after fee) and the total assets represented by the shares (before fee). The difference is the fee amount. **20.** Calls parent withdrawal function which handles share burning and asset transfer to receiver. **22-23.** Deducts the fee from total deposits and immediately transfers the fee to the treasury yield contract. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-previewwithdraw) Method: previewWithdraw Calculates the number of shares required to withdraw a given amount of assets, accounting for withdrawal fees. **1-5.** Public view function overriding ERC4626 previewWithdraw. **6.** Retrieves storage pointer for SUsd0StorageV0. **7-10.** Calculates the fee amount based on the assets being withdrawn. Uses ceiling rounding to ensure conservative estimates. The formula accounts for the fee being a percentage of the total assets needed. **11-12.** Calculates total assets needed including the fee. **13.** Converts the total assets (including fee) to shares using ceiling rounding. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-previewredeem) Method: previewRedeem Calculates the amount of assets that would be received for redeeming a given number of shares, accounting for redemption fees. **1-5.** Public view function overriding ERC4626 previewRedeem. **6.** Retrieves storage pointer for SUsd0StorageV0. **7-8.** Calculates the raw amount of assets represented by the shares (before fee deduction). **10-11.** Calculates the fee portion using ceiling rounding to ensure conservative estimates. **12.** Subtracts the fee from the total assets to get the net assets the user will receive. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/susd0#method-updatewithdrawfee) Method: updateWithdrawFee Updates the withdrawal fee rate with proper access control and validation. **1.** External function for updating withdrawal fee. **2-3.** Retrieves storage pointer and validates caller has `SUSD0_WITHDRAW_FEE_UPDATER_ROLE`. **5-7.** Validates new fee is below 25% maximum, preventing excessive fees. **9-11.** Validates new fee is different from current fee, preventing unnecessary updates. **13.** Updates the withdrawal fee in storage. **14.** Emits an event to log the fee update. [PreviousVaultRouterchevron-left](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter) [NextsEUR0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/seur0) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/susd0#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/susd0#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/token-contracts/susd0#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/susd0#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/token-contracts/susd0#security-analysis) Was this helpful? Copy function initialize(address _registryContract, uint256 _withdrawFeeBps, uint256 initialShares) external initializer { if (_registryContract == address(0)) { revert NullContract(); } SUsd0StorageV0 storage $ = _susd0StorageV0(); address _underlyingToken = IRegistryContract(_registryContract).getContract(CONTRACT_USD0); __YieldBearingVault_init(_underlyingToken, SUSD0Name, SUSD0Symbol); __Pausable_init_unchained(); __ReentrancyGuard_init(); __EIP712_init_unchained(SUSD0Name, "1"); if (_withdrawFeeBps > MAX_25_PERCENT_WITHDRAW_FEE) { revert AmountTooBig(); } if (initialShares == 0) { revert AmountIsZero(); } $.registryAccess = IRegistryAccess( IRegistryContract(_registryContract).getContract(CONTRACT_REGISTRY_ACCESS) ); $.withdrawFeeBps = _withdrawFeeBps; $.usd0Token = IUsd0(_underlyingToken); $.treasuryYield = IRegistryContract(_registryContract).getContract(CONTRACT_YIELD_TREASURY); YieldDataStorage storage y = _getYieldDataStorage(); // mint dead shares to the vault y.totalDeposits = initialShares; _mint(address(this), initialShares); emit WithdrawFeeUpdated(_withdrawFeeBps); } Copy function blacklist(address account) external { if (account == address(0)) { revert NullAddress(); } SUsd0StorageV0 storage $ = _susd0StorageV0(); $.registryAccess.onlyMatchingRole(BLACKLIST_ROLE); if ($.isBlacklisted[account]) { revert SameValue(); } $.isBlacklisted[account] = true; emit Blacklist(account); } Copy function _update(address from, address to, uint256 amount) internal override(ERC20Upgradeable) whenNotPaused { SUsd0StorageV0 storage $ = _susd0StorageV0(); if ($.isBlacklisted[from] || $.isBlacklisted[to]) { revert Blacklisted(); } super._update(from, to, amount); } Copy function startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) external { SUsd0StorageV0 storage $ = _susd0StorageV0(); $.registryAccess.onlyMatchingRole(SUSD0_YIELD_DISTRIBUTOR_ROLE); _startYieldDistribution(yieldAmount, startTime, endTime); } Copy function _startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) internal override { IERC20 _asset = IERC20(asset()); if (yieldAmount == 0) { revert ZeroYieldAmount(); } if (startTime < block.timestamp) { revert StartTimeNotInFuture(); } if (endTime <= startTime) { revert EndTimeNotAfterStartTime(); } YieldDataStorage storage $ = _getYieldDataStorage(); if (startTime < $.periodFinish) { revert StartTimeBeforePeriodFinish(); } if (block.timestamp < $.periodFinish) { revert CurrentTimeBeforePeriodFinish(); } _updateYield(); uint256 periodDuration = endTime - startTime; uint256 newYieldRate = Math.mulDiv(yieldAmount, YIELD_PRECISION, periodDuration, Math.Rounding.Floor); if (_asset.balanceOf(address(this)) < $.totalDeposits + yieldAmount) { revert InsufficientAssetsForYield(); } $.yieldRate = newYieldRate; $.periodStart = startTime; $.periodFinish = endTime; $.lastUpdateTime = startTime; $.isActive = true; } Copy function depositWithPermit( uint256 assets, address receiver, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public nonReentrant whenNotPaused returns (uint256 shares) { try IERC20Permit(asset()).permit(msg.sender, address(this), assets, deadline, v, r, s) {} // solhint-disable-line no-empty-blocks catch {} // solhint-disable-line no-empty-blocks return deposit(assets, receiver); } Copy function withdraw(uint256 assets, address receiver, address owner) public override(ERC4626Upgradeable, ISUsd0) nonReentrant whenNotPaused returns (uint256 shares) { SUsd0StorageV0 storage $ = _susd0StorageV0(); YieldDataStorage storage yieldStorage = _getYieldDataStorage(); // Check withdrawal limit uint256 maxAssets = maxWithdraw(owner); // maxAssets take into account the fee if (assets > maxAssets) { revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets); } shares = previewWithdraw(assets); // we need to add the fee on the assets to know exactly the shares to burn // assets is 100% - fee% of the total assets uint256 fee = Math.mulDiv( assets, $.withdrawFeeBps, BASIS_POINT_BASE - $.withdrawFeeBps, Math.Rounding.Ceil ); // Perform withdrawal (exact assets to receiver) super._withdraw(_msgSender(), receiver, owner, assets, shares); // take the fee yieldStorage.totalDeposits -= fee; $.usd0Token.safeTransfer($.treasuryYield, fee); } Copy function redeem(uint256 shares, address receiver, address owner) public override(ERC4626Upgradeable, ISUsd0) nonReentrant whenNotPaused returns (uint256 assets) { SUsd0StorageV0 storage $ = _susd0StorageV0(); YieldDataStorage storage yieldStorage = _getYieldDataStorage(); // Check redemption limit uint256 maxShares = maxRedeem(owner); if (shares > maxShares) { revert ERC4626ExceededMaxRedeem(owner, shares, maxShares); } // Calculate assets after fee assets = previewRedeem(shares); uint256 assetsWithFee = convertToAssets(shares); uint256 fee = assetsWithFee - assets; // Perform redemption super._withdraw(_msgSender(), receiver, owner, assets, shares); // take the fee yieldStorage.totalDeposits -= fee; $.usd0Token.safeTransfer($.treasuryYield, fee); } Copy function previewWithdraw(uint256 assets) public view override(ERC4626Upgradeable, ISUsd0) returns (uint256 shares) { SUsd0StorageV0 storage $ = _susd0StorageV0(); // Calculate the fee based on the equivalent assets of these shares uint256 fee = Math.mulDiv( assets, $.withdrawFeeBps, BASIS_POINT_BASE - $.withdrawFeeBps, Math.Rounding.Ceil ); // Calculate total assets needed, including fee uint256 assetsWithFee = assets + fee; // Convert the total assets (including fee) to shares shares = _convertToShares(assetsWithFee, Math.Rounding.Ceil); } Copy function previewRedeem(uint256 shares) public view override(ERC4626Upgradeable, ISUsd0) returns (uint256 assets) { SUsd0StorageV0 storage $ = _susd0StorageV0(); // Calculate the raw amount of assets for the given shares uint256 assetsWithFee = convertToAssets(shares); // Calculates the fee part of an amount `assets` that already includes fees. uint256 fee = Math.mulDiv(assetsWithFee, $.withdrawFeeBps, BASIS_POINT_BASE, Math.Rounding.Ceil); assets = assetsWithFee - fee; } Copy function updateWithdrawFee(uint256 newWithdrawFeeBps) external { SUsd0StorageV0 storage $ = _susd0StorageV0(); $.registryAccess.onlyMatchingRole(SUSD0_WITHDRAW_FEE_UPDATER_ROLE); if (newWithdrawFeeBps > MAX_25_PERCENT_WITHDRAW_FEE) { revert AmountTooBig(); } if (newWithdrawFeeBps == $.withdrawFeeBps) { revert SameValue(); } $.withdrawFeeBps = newWithdrawFeeBps; emit WithdrawFeeUpdated(newWithdrawFeeBps); } --- # Monerium Swapper Helper | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#high-level-overview) **High-Level Overview** The `SwapperHelper` contract is a helper utility that performs 1:1 swaps between a collateral token and a stablecoin on behalf of a user. It coordinates a three-way token movement where: * The **caller** supplies stablecoin (EUR0) and receives collateral (EURe). * The **recipient** supplies collateral (EURe) and receives stablecoin (EUR0). The contract supports both standard ERC20 approvals and ERC20 Permit-based approvals (EIP-2612) for the collateral token, enabling gasless approval flows for EOAs. An optional `operator` role can be configured to restrict who is allowed to initiate swaps. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#contract-summary) **Contract Summary** `SwapperHelper` sits between a collateral token (EURe) and a stablecoin (EUR0) and enforces a 1:1 exchange rate between them, assuming they share the same number of decimals. The contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#key-features) **Key Features** **1:1 Swap Mechanism** * Swaps collateral and stablecoin at a 1:1 rate, enforced by equal decimals on both tokens. * The caller ends up with collateral; the recipient ends up with stablecoin. **Permit-Based Approval Flow** * `swapOnBehalfWithPermit` uses `IERC20Permit` to approve collateral spending via signature. * Allows recipients to authorize swaps without an on-chain approval transaction (EOA only). ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#functions-description) **Functions Description** #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#public-external-functions) **Public / External Functions** * `**swapOnBehalfWithPermit(address recipient, uint256 maxAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)**` Performs a 1:1 swap using an ERC20 Permit signature for collateral. * **Parameters**: * `recipient`: Address providing collateral and receiving stablecoin. * `maxAmount`: Maximum collateral amount to swap (and stablecoin to transfer). * `deadline`: Permit deadline; reverts if `block.timestamp > deadline`. * `v`, `r`, `s`: ECDSA signature components for the permit. * **Requirements**: * `COLLATERAL_TOKEN` supports `permit`. * Signature must authorize `recipient` → `this` for `maxAmount` until `deadline`. * Caller must have approved sufficient stablecoin allowance to `this`. * `deadline` must not be expired; otherwise reverts with `DeadlineExpired()`. * Operator check must pass (see `_swapOnBehalf`). * `**swapOnBehalf(address recipient, uint256 maxAmount)**` Performs a 1:1 swap based on pre-existing ERC20 approvals (no permit). * **Parameters**: * `recipient`: Address providing collateral and receiving stablecoin. * `maxAmount`: Maximum collateral amount to swap (and stablecoin to transfer). * **Requirements**: * `recipient` must have approved this contract to spend collateral. * Caller must have approved this contract to spend stablecoin. * Operator check must pass. * `**changeOperator(address newOperator)**` Updates the `operator` address. * **Parameters**: * `newOperator`: New operator address (can be zero to make swaps permissionless). ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#state-variables) **State Variables** * `**COLLATERAL_TOKEN**` Collateral token is **EURe** and used in swaps (must implement `permit` for `swapOnBehalfWithPermit`). * `**STABLECOIN**` Stablecoin token is **EUR0** and used in swaps. * `**operator**` Optional operator address restricting who can initiate swaps. `address(0)` means permissionless. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#error-handling) **Error Handling** * `**NullAddress()**`: Thrown when a required address parameter is zero. * `**DeadlineExpired()**`: Thrown when a provided permit deadline has already passed. * `**ZeroAmount()**`: Thrown when a swap or recovery amount resolves to zero. * `**NotAuthorized()**`: Thrown when a non-operator initiates a swap while an operator is configured. * `**InsufficientBalance()**`: Thrown if stablecoin balance check after transfer fails, indicating an unexpected token behavior. * `**InvalidDecimals()**`: Thrown in the constructor when collateral and stablecoin decimals differ. * `**NotAllowed()**`: Thrown when attempting to renounce ownership. * `**SameValue()**`: Thrown when collateral and stablecoin addresses are the same. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#security-considerations) **Security Considerations** #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#immutable-token-references) **Immutable Token References** * `COLLATERAL_TOKEN` and `STABLECOIN` are `immutable` and set once in the constructor. * Prevents arbitrary token reconfiguration. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#decimal-consistency) **Decimal Consistency** * Validates equal decimals for collateral and stablecoin at deployment. * Ensures 1:1 swaps are value-consistent in token units. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#operator-access-control) **Operator Access Control** * Optional operator limit reduces who can execute swaps in controlled environments. * Owner can update the operator or set it to zero for permissionless use. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#balance-verification) **Balance Verification** * After transferring stablecoin from caller to contract, the contract checks that its balance increased as expected. * Protects against non-standard ERC20 implementations that do not behave as expected. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#reentrancy-and-token-safety) **Reentrancy and Token Safety** * Uses `SafeERC20` for all token transfers. * The stablecoin and collateral transfers are ordered to minimize risk; the final transfer (`safeTransferFrom` of collateral) is from the recipient to the caller. * Comments acknowledge arbitrary ERC20 sends, justified because the recipient is the intended beneficiary of stablecoin. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#ownership-retention) **Ownership Retention** * Ownership cannot be renounced, ensuring a responsible address for operator and recovery actions. #### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#token-recovery) **Token Recovery** * Owner-only `recoverERC20` prevents tokens from being permanently stuck in the contract. ### [hashtag](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#integration-notes) **Integration Notes** * **Token Requirements** * `COLLATERAL_TOKEN`: * Must be ERC20-compliant. * Must implement `IERC20Permit` for the permit-based swap function. * `STABLECOIN`: * Standard ERC20. * Both tokens must: * Have identical `decimals()`. * Be distinct addresses. * **Using** `**swapOnBehalfWithPermit**` 1. Recipient signs an ERC20 Permit approving this contract to spend up to `maxAmount` collateral. 2. Caller provides the signature parameters and `maxAmount`. 3. Contract attempts the permit (non-fatal if it fails) and then swaps up to the minimum of: * Recipient’s collateral allowance to the contract. * Recipient’s collateral balance. * Provided `maxAmount`. * **Using** `**swapOnBehalf**` 1. Recipient approves this contract to spend collateral. 2. Caller approves this contract to spend stablecoin. 3. Caller calls `swapOnBehalf(recipient, maxAmount)`. 4. Swap executes for the capped amount as above. * **Operator Configuration** * For open, permissionless swaps, deploy with `_operator = address(0)` or later call `changeOperator(address(0))`. * For controlled environments (e.g., only a specific router or backend), set `_operator` to that address. * **Event Usage** * Listen to `SwapOnBehalf(caller, recipient, amount)` (defined in `ISwapperHelper`) to index executed swaps. * Listen to `OperatorChanged(newOperator)` to track operator role changes. [PreviousCircle EURC/EUR Oraclechevron-left](https://tech.usual.money/smart-contracts/utility-contracts/eur0/circle-eurc-eur-oracle) [NextUSUALchevron-right](https://tech.usual.money/smart-contracts/utility-contracts/usual) Last updated 1 month ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#contract-summary) * [Key Features](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#key-features) * [Functions Description](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#functions-description) * [State Variables](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#state-variables) * [Error Handling](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#error-handling) * [Security Considerations](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#security-considerations) * [Integration Notes](https://tech.usual.money/smart-contracts/utility-contracts/eur0/monerium-swapper-helper#integration-notes) Was this helpful? --- # USD0a Gateway | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#high-level-overview) High-Level Overview The Gateway contract is a fully permissioned smart contract designed to manage intermediary treasury operations between the protocol's collateral treasury and external collateral services such as Superstate and Circle. The contract facilitates the conversion of USDC tokens (from Circle) to USCC tokens (from Superstate) through an order-based tracking system, enabling the protocol to rebalance treasury collaterals efficiently. The main objective of the Gateway contract is to provide a secure, auditable, and controlled mechanism for interacting with external collateral services while maintaining USD0a price stability through the DebtUSDC token system. When the protocol needs to switch some USDC to USCC, the Gateway manages these operations by tracking deposits and withdrawals through orders. Critically, the Gateway mints DebtUSDC tokens when USDC is sent to Superstate to prevent USD0a price from decreasing while waiting for USCC, since USD0a price depends on the amount of collaterals in the treasury. **Key Use Case**: The Gateway is primarily used for treasury rebalancing operations. For example, if the protocol wants to convert USDC to USCC, an authorized operator can deposit USDC through the Gateway, which transfers the USDC to the Superstate contract. The Gateway then mints DebtUSDC tokens (1:1 with the USDC amount) to maintain USD0a price stability. This is critical because USD0a price depends on the amount of collaterals in the treasury. Without minting DebtUSDC, the USD0a price would decrease when USDC is sent to Superstate (reducing treasury collateral) while waiting for USCC. By minting DebtUSDC, the protocol maintains the accounting balance, preventing USD0a price from decreasing during the conversion process. When USCC is received from Superstate, the operator can withdraw through the Gateway, which burns the corresponding DebtUSDC tokens and transfers the USCC to the collateral treasury, replacing the debt token with actual collateral. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#contract-summary) Contract Summary The contract provides the following main functions: * **deposit**: Allows authorized users to deposit USDC tokens, transfer them to the Superstate contract, and create a tracking order. This function also mints DebtUSDC tokens (1:1 with USDC) to the collateral treasury to maintain USD0a price stability. Without this minting, the USD0a price would decrease because it depends on the amount of collaterals in the treasury, and USDC is temporarily reduced while waiting for USCC. * **withdraw**: Allows authorized users to withdraw USCC tokens by burning the corresponding DebtUSDC tokens for specified orders. The function accepts a `usccAmount` parameter because the exact amount received from Superstate cannot be predicted. * **emergencyWithdraw**: Provides an emergency mechanism to recover tokens that may have been accidentally sent to the contract. * **setSuperstateAddress**: Allows authorized users to update the Superstate contract address, enabling the protocol to adapt to contract upgrades or migrations. The contract also includes utility functions such as `getOrder`, `getNextOrderId`, `superstate`, and `collateralTreasury` to retrieve order details and contract configuration. The Gateway uses an order-based system to track deposits and withdrawals. Each deposit creates an order that stores the USDC amount, active status, and timestamp. Orders are deactivated during withdrawal to prevent double-spending. The DebtUSDC token system ensures that USD0a price stability is maintained during collateral conversion operations. When USDC is sent to Superstate, the treasury temporarily loses collateral, which would cause USD0a price to decrease. By minting DebtUSDC tokens (1:1 with the USDC amount), the protocol maintains the accounting balance, preventing USD0a price from decreasing while waiting for USCC. When USCC is received and DebtUSDC is burned, the actual collateral replaces the debt token. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#inherited-contracts) Inherited Contracts **Initializable (OZ)**: Used to provide a safe and controlled way to initialize the contract's state variables. It ensures that the contract's initializer function can only be called once, preventing accidental or malicious reinitialization. **ReentrancyGuardUpgradeable (OZ)**: Used to protect against reentrancy attacks. It provides a modifier that can be applied to functions to prevent them from being called recursively or from being called from other functions that are also protected by the same guard. **PausableUpgradeable (OZ)**: Allows contract functionality to be paused by authorized accounts (`PAUSING_CONTRACTS_ROLE` to pause the contract and `UNPAUSING_CONTRACTS_ROLE` to unpause). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#functionality-breakdown) Functionality Breakdown The Gateway contract's primary purpose is to facilitate treasury rebalancing operations by managing interactions with external collateral services. The contract's functionality can be broken down into the following key components: #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#order-creation-deposit) Order Creation (Deposit): Users with the `GATEWAY_DEPOSIT_ROLE` can create new orders by calling the `deposit` function and specifying the amount of USDC tokens to deposit. The contract transfers the specified amount of USDC tokens from the caller directly to the Superstate contract (not to the Gateway contract itself). The contract creates a new order with a unique order ID, storing the USDC amount, active status (set to true), and the current block timestamp. The contract mints DebtUSDC tokens (1:1 with the USDC amount) to the collateral treasury. The debt token maintains the accounting balance until USCC is received and replaces it. The order is assigned a unique order ID (starting from 1) and stored in the contract's orders mapping. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#order-fulfillment-withdraw) Order Fulfillment (Withdraw): Users with the `GATEWAY_WITHDRAW_ROLE` can fulfill orders by calling the `withdraw` function and specifying an array of order IDs to process and the amount of USCC tokens to withdraw. The contract validates that all specified orders are active and exist. For each order, the contract deactivates the order (sets `active` to false) to prevent double-spending. The contract burns DebtUSDC tokens from the collateral treasury (1:1 with each order's USDC amount). This clears the protocol's obligation for the fulfilled orders. The contract transfers the specified amount of USCC tokens from the Gateway contract to the collateral treasury. **Important**: The `usccAmount` parameter is provided by the caller because the exact amount of USCC received from Superstate cannot be predicted in advance. This allows the protocol to handle variable exchange rates, fees, or other factors that may affect the final amount received from external services. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#debtusdc-accounting) DebtUSDC Accounting: The Gateway uses the DebtUSDC token system to maintain USD0a price stability during collateral conversion operations. When USDC is deposited and sent to Superstate, the treasury temporarily loses USDC collateral. Since USD0a price depends on the amount of collaterals in the treasury, this reduction would cause USD0a price to decrease. To prevent this, DebtUSDC tokens are minted (1:1 with the USDC amount) to maintain the accounting balance. This ensures that USD0a price remains stable while waiting for USCC from Superstate. When USCC is received and withdrawn, the corresponding DebtUSDC tokens are burned, and the actual USCC collateral replaces the debt token. This mechanism ensures that USD0a price stability is maintained throughout the entire conversion process, even when interacting with third-party services that may have processing delays. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#external-integration) External Integration: The Gateway integrates with the Superstate contract for USDC transfers and USCC redemptions. USDC (from Circle) is transferred directly to the Superstate contract during deposits, and USCC is expected to be received from Superstate before withdrawals can be processed. The Gateway also integrates with the Registry system to access the DebtUSDC contract, collateral treasury address, and access control mechanisms. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#method-deposit) Method: deposit This method allows authorized users to deposit USDC tokens, transfer them to the Superstate contract, create a tracking order, and mint DebtUSDC tokens to the collateral treasury. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. * The function is protected by the `whenNotPaused` modifier, ensuring that deposits cannot be made when the contract is paused. * Validates that the USDC amount is greater than zero. * Validates that the caller has the `GATEWAY_DEPOSIT_ROLE` using role-based access control. * Sets the value of `orderId` to the current value of `$.nextOrderId` then increments by 1. Since it is initialized as 1, the first `orderId` will be one and so on. * Creates a new `GatewayOrder` struct in storage using the order ID as key. The struct contains: the USDC amount, the active flag set to true, and the current block timestamp. * Transfers the specified amount of USDC tokens from the caller directly to the Superstate contract (not to the Gateway contract) using `safeTransferFrom` to ensure that the transfer is successful. If the transfer fails, the function will revert. * Mints DebtUSDC tokens (1:1 with the USDC amount) to the collateral treasury. This is critical for maintaining USD0a price stability. Since USD0a price depends on the amount of collaterals in the treasury, and USDC is temporarily reduced while waiting for USCC from Superstate, minting DebtUSDC prevents the USD0a price from decreasing during the conversion process. The debt token maintains the accounting balance until USCC is received and replaces it. * Emits a `Deposit` event, providing the caller address, order ID, and USDC amount for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#method-withdraw) Method: withdraw This method allows authorized users to withdraw USCC tokens by burning the corresponding DebtUSDC tokens for specified orders and transferring USCC to the collateral treasury. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier. * The function is protected by the `whenNotPaused` modifier, ensuring that withdrawals cannot be made when the contract is paused. * Validates that at least one order ID is provided (orderIds.length > 0). * Validates that the USCC amount is greater than zero. * Validates that the caller has the `GATEWAY_WITHDRAW_ROLE` using role-based access control. * Iterates through the provided order IDs and validates that each order is active. If any order is not active or does not exist, the function will revert with an appropriate error message. This prevents any attempts to withdraw from invalid or already processed orders. * For each order, deactivates the order by setting the `active` flag to false in storage. This prevents double-spending and ensures that orders can only be processed once. * Burns DebtUSDC tokens from the collateral treasury (1:1 with each order's USDC amount). This clears the protocol's obligation for the fulfilled orders and ensures proper accounting. * Accumulates the total debt tokens burned across all orders for event emission. * Transfers the specified amount of USCC tokens from the Gateway contract to the collateral treasury using the `safeTransfer` function. This ensures that the transfer is successful. If the transfer fails, the function will revert. * **Important**: The `usccAmount` parameter is provided by the caller because the exact amount of USCC received from Superstate cannot be predicted in advance. This allows the protocol to handle variable exchange rates, fees, or other factors that may affect the final amount received from external services. * Emits a `Withdraw` event, providing the caller address, order IDs, total debt tokens burned, and USCC amount for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#method-emergencywithdraw) Method: emergencyWithdraw This method provides an emergency mechanism to recover tokens that may have been accidentally sent to the Gateway contract. **Function Description:** * The function is protected against reentrancy attacks by using the `nonReentrant` modifier. * Validates that the token address is not the zero address. * Validates that the recipient address is not the zero address. * Validates that the amount is greater than zero. * Validates that the caller has the `EMERGENCY_WITHDRAW_ROLE` using role-based access control. * Transfers the specified amount of tokens from the Gateway contract to the recipient using the `safeTransfer` function. This ensures that the transfer is successful. If the transfer fails, the function will revert. * Emits an `EmergencyWithdraw` event, providing the token address, amount, and recipient for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#method-setsuperstateaddress) Method: setSuperstateAddress This method allows authorized users to update the Superstate contract address, enabling the protocol to adapt to contract upgrades or migrations. **Function Description:** * Validates that the new Superstate address is not the zero address. * Validates that the new Superstate address is different from the current address to prevent unnecessary state changes. * Validates that the caller has the `GATEWAY_SUPERSTATE_SETTER_ROLE` using role-based access control. * Updates the Superstate address in storage. * Emits a `SuperstateUpdated` event, providing the old and new Superstate addresses for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#getter-functions) Getter Functions **getOrder**: Returns the details of a specific order including USDC amount, active status, and timestamp. **getNextOrderId**: Returns the next order ID that will be assigned. **superstate**: Returns the current Superstate contract address. **collateralTreasury**: Returns the current collateral treasury address. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#constants) Constants `**CONTRACT_REGISTRY_ACCESS**`: Address of the registry access contract. `**CONTRACT_DEBT_USDC**`: Address of the DebtUSDC token contract. `**CONTRACT_TREASURY**`: Address of the collateral treasury contract. `**GATEWAY_DEPOSIT_ROLE**`: Role identifier for depositing USDC and creating orders. `**GATEWAY_WITHDRAW_ROLE**`: Role identifier for withdrawing USCC and fulfilling orders. `**EMERGENCY_WITHDRAW_ROLE**`: Role identifier for emergency token recovery. `**GATEWAY_SUPERSTATE_SETTER_ROLE**`: Role identifier for updating the Superstate address. `**PAUSING_CONTRACTS_ROLE**`: Role identifier for pausing contract operations. `**UNPAUSING_CONTRACTS_ROLE**`: Role identifier for unpausing contract operations. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#safeguards-implementation) Safeguards Implementation **Pausability**: Allows pausing of contract functionality in emergencies. The contract can be paused by `PAUSING_CONTRACTS_ROLE` and unpaused by `UNPAUSING_CONTRACTS_ROLE`. **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. All state-changing functions are protected with the `nonReentrant` modifier. **Access Control**: Restricts sensitive operations to authorized roles. Deposit operations require `GATEWAY_DEPOSIT_ROLE`, withdrawal operations require `GATEWAY_WITHDRAW_ROLE`, emergency withdrawals require `EMERGENCY_WITHDRAW_ROLE`, and Superstate address updates require `GATEWAY_SUPERSTATE_SETTER_ROLE`. **Amount Validation**: Validates that amounts are non-zero and that order arrays are not empty before processing operations. **Order Validation**: Validates that orders are active before processing withdrawals, preventing attempts to process invalid or already processed orders. **Null Address Checks**: Validates that all addresses (registry, Superstate, tokens, recipient) are not the zero address before processing operations. **Order Deactivation**: Deactivates orders during withdrawal to prevent double-spending and ensure that orders can only be processed once. **SafeERC20**: Uses SafeERC20 for all token transfers to prevent failures from going unnoticed and to handle non-standard ERC20 implementations safely. **Storage Safety**: Uses ERC-7201 namespaced storage pattern (`GatewayStorageV0`) to prevent storage collisions during upgrades. The contract is upgradeable via UUPS proxy pattern. **Same Value Protection**: Prevents unnecessary state changes by validating that the new Superstate address is different from the current address before updating. [PreviousUSD0a SwapperEnginechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine) [NextUSD0a Reverse Gatewaychevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-reverse-gateway) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#security-analysis) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#constants) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway#safeguards-implementation) Was this helpful? --- # USUAL staking | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------------------------- The AbstractYieldBearingVault contract is an abstract contract that extends the ERC4626Upgradeable contract and provides functionality for a vault where shares appreciate in value due to yield accrual. The contract tracks total assets deposited and accrues yield over time based on a configurable yield rate and distribution period. Inherited by: [USUALxchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usualx) ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#contract-summary) Contract Summary The contract provides the following main functions: * **totalAssets**: Calculates the total assets in the vault, including accrued yield. * **\_deposit**: Internal function to handle 4626 deposits and mints, updates yield, and tracks total deposits explicitly to avoid vault donation attacks. * **\_withdraw**: Internal function to handle 4626 withdrawals and mints, updates yield, and updates total deposits. * **\_calculateEarnedYield**: Calculates the amount of yield earned since the last update. * **\_updateYield**: Updates the yield state by calculating yield earned and adding it to total deposits. * **\_startYieldDistribution**: Starts a new yield distribution period. The contract uses a separate internal storage structure (YieldDataStorage) to store yield-related state variables, including total deposits, yield rate, period start and finish times, last update time, and maximum period length. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#inherited-contracts) Inherited Contracts * [**ERC4626Upgradeable**arrow-up-right](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v5.0/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol) : The contract inherits from the ERC4626Upgradeable contract, which provides the standard implementation for tokenized vaults. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------------------------- The contract's main functionality is to provide a foundation for implementing yield-bearing vaults that follow the ERC4626 standard. The contract handles the calculation and distribution of yield, updating the total assets in the vault based on the accrued yield. 1. **Yield Calculation and Distribution**: * The contract tracks the total assets deposited and accrues yield over time based on a configurable yield rate and distribution period. * The \_calculateEarnedYield function calculates the amount of yield earned since the last update, taking into account the active yield period and the yield rate. * The \_updateYield function updates the yield state by calculating the earned yield and adding it to the total deposits. It also updates the last update timestamp and deactivates the yield period if it has finished. * The \_startYieldDistribution function starts a new yield distribution period with a specified yield amount, start time, and end time. 1. **Deposits and Withdrawals**: * The contract overrides the internal \_deposit and \_withdraw functions from the ERC4626Upgradeable contract to handle deposits and withdrawals while considering the yield accrual. * The \_deposit function updates the yield, takes the deposited assets, mints shares, and updates the total deposits. * The \_withdraw function updates the yield, burns shares, transfers the withdrawn assets, and updates the total deposits. 1. **Total Assets Calculation**: * The totalAssets function calculates the total assets in the vault, including the accrued yield, by adding the total deposits and the earned yield. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-totalassets) Method: totalAssets Calculates the total assets in the vault, including accrued yield since the last time totalDeposits was updated. This effectively allows yield to accrue uniformly over time. 1. Function is declared as `public view`, allowing external calls without state modifications. 2. Retrieves the YieldDataStorage struct from storage. 3. Calculates current assets by adding total deposits and earned yield since the last time total deposits was updated if there is an active yield period. 4. Returns the calculated current assets as the total assets in the vault. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_deposit) Method: \_deposit Internal function to handle deposits, update yield, and track total deposits explicitly to only count the yield that has accrued so far. Addresses the vault donation attack. Can be overridden in the concrete implementation to allow for fees. 1-5. Function is internal, virtual, overrides the parent contract's \_deposit function. 1. Retrieves the YieldDataStorage struct from storage. 2. Updates the yield accrued by the vault before processing the deposit. 3. Calls the ERC4626Upgradeable contract's \_deposit function to take assets and mint. 4. Finally updates the totalDeposits by adding the deposited assets. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_withdraw) Method: \_withdraw Internal function to handle withdrawals, update yield, and adjust total deposits explicitly. Can be overriden in the concrete implementation to allow for withdraw fees. 1-7. Function is internal, virtual, overrides the parent contract's deposit function. 1. Retrieves the YieldDataStorage struct from storage. 2. Updates the yield before processing the withdrawal. 3. Calls the parent contract's \_withdraw function to burn shares then transfer assets. 4. Updates the totalDeposits by subtracting the withdrawn assets. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_calculateearnedyield) Method: \_calculateEarnedYield Calculates the amount of yield earned since the last update without updating state. 1. Function is declared as internal view, allowing only internal calls without state modifications. 2. Retrieves the YieldDataStorage struct from storage. 3. Returns 0 if there's no active yield period. 4. Calculates the end time as the minimum of current time and period finish time. 5. Calculates the duration since the last update capped at the current yield period finish time. 6. Calculates and returns the earned yield by multiplying by yield rate as tokens/second allowing for high decimal precision and rounding down. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_updateyield) Method: \_updateYield Updates the yield storage by calculating earned yield at the current time stamp and adding it to total deposits, then updates the last update time capped at the end of the current yield period. No-op if there is active yield period because the contract was just deployed or the previous yield period has finished. 1. Function is declared as internal virtual, allowing internal calls and potential overrides. 2. Retrieves the YieldDataStorage struct from storage. 3. Returns early if there's no active yield period. 4. Calculates the new yield earned since the lastUpdateTime. 5. Adds the new yield to total deposits. 6. Updates the last update time, capped at the period finish time. 10-12. Deactivates the yield period if it has finished. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_startyielddistribution) Method: \_startYieldDistribution This method is left abstract and needs to be implemented in the derived contract. It's crucial for setting up the variables needed for calculating and updating yield. When implementing this method, consider the following: * Set the `yieldRate` based on the `yieldAmount` and the duration (`endTime - startTime`) times the YIELD\_PRECISION. * Update `periodStart`, `periodFinish`, and `lastUpdateTime`. * Set `isActive` to true to enable yield calculations. * Implement proper access control to prevent unauthorized yield distributions. * Ensure that the new distribution period doesn't overlap with an existing active period. [PreviousUSUALchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual) [NextUSUAL\* Vested Allocation Stakingchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-vested-allocation-staking) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#security-analysis) * [Method: \_updateYield](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-staking#method-_updateyield) Was this helpful? Copy 1 function totalAssets() public view override returns (uint256) { 2 YieldDataStorage storage $ = _getYieldDataStorage(); 3 uint256 currentAssets = $.totalDeposits + _calculateEarnedYield(); 4 return currentAssets; 5 } Copy 1 function _deposit(address caller, address receiver, uint256 assets, uint256 shares) 2 internal 3 virtual 4 override 5 { 6 YieldDataStorage storage $ = _getYieldDataStorage(); 7 _updateYield(); 8 super._deposit(caller, receiver, assets, shares); 9 $.totalDeposits += assets; 10 } Copy 1 function _withdraw( 2 address caller, 3 address receiver, 4 address owner, 5 uint256 assets, 6 uint256 shares 7 ) internal virtual override { 8 YieldDataStorage storage $ = _getYieldDataStorage(); 9 _updateYield(); 10 super._withdraw(caller, receiver, owner, assets, shares); 11 $.totalDeposits -= assets; 12 } Copy 1 function _calculateEarnedYield() internal view virtual returns (uint256) { 2 YieldDataStorage storage $ = _getYieldDataStorage(); 3 if (!$.isActive) return 0; 4 uint256 endTime = Math.min(block.timestamp, $.periodFinish); 5 uint256 duration = endTime - $.lastUpdateTime; 6 return Math.mulDiv(duration, $.yieldRate, YIELD_PRECISION, Math.Rounding.Floor); 7 } Copy 1 function _updateYield() internal virtual { 2 YieldDataStorage storage $ = _getYieldDataStorage(); 3 if (!$.isActive) return; 4 5 uint256 newYield = _calculateEarnedYield(); 6 $.totalDeposits += newYield; 7 8 $.lastUpdateTime = Math.min(block.timestamp, $.periodFinish); 9 10 if (block.timestamp >= $.periodFinish) { 11 $.isActive = false; 12 } 13 } Copy 1 function _startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) internal virtual; --- # Security Practices | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FCZ8cZz2r9ReDWCpnq1ww%252FPage%2520Cover%252010.png%3Falt%3Dmedia%26token%3Df0ec777f-9f83-40f0-ae58-439544b26b0d&width=1248&dpr=3&quality=100&sign=13951c90&sv=2) [hashtag](https://tech.usual.money/security-and-audits#security-approach) Security Approach ------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/security-and-audits#multi-layered-security-strategy) Multi-layered Security Strategy 1. **Secure Development Practices**: We follow industry-standard secure coding practices and regularly review our codebase for potential vulnerabilities. 2. **Tokenomics Design and Simulation**: Mechanisms implemented in our smart contracts undergo thorough analysis by a team of economists to optimize and simulate their behavior to validate the designs. 3. **Access Control**: We implement robust access control mechanisms to ensure only authorized parties can interact with sensitive functions. 4. **Upgrade Mechanisms**: Our contracts include secure upgrade patterns to allow for improvements without compromising security or user funds. 5. **Smart Contract Security Audits**: Our contracts are periodically reviewed by multiple security auditors and bug bounty campaigns to find any vulnerabilities. 6. **Continuous Monitoring**: We employ advanced monitoring tools to detect any unusual activity or potential threats in real-time, allowing for swift response to any security incidents. [PreviousContract Deploymentschevron-left](https://tech.usual.money/smart-contracts/contract-deployments) [NextTesting Frameworkchevron-right](https://tech.usual.money/security-and-audits/testing-framework) Last updated 1 year ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # USD0 Swapper Engine | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#high-level-overview) High-Level Overview -------------------------------------------------------------------------------------------------------------------------------------------- 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. It is important to note that the contract's mechanism can be utilized to facilitate a vampire attack, **RWA → USD0 → USDC → $$$ → RWA →** to churn _USDC_ into USD0 by transparently staking treasury bonds to mint _USD0_ swapping that _USD0_ for _USDC_ and cycling back into RWA ready to mint more _USD0_ limited only by _USDC_ order book depth. Flow USDC Depositors: spinner Flow RWA Provider: spinner ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#contract-summary) Contract Summary The contract provides the following main functions: * **depositUSDC**: Allows users to create a new order by depositing _USDC_. * **withdrawUSDC**: Allows users to cancel an order and withdraw their deposited _USDC_. * **provideUsd0ReceiveUSDC**: Allows users to fill orders by providing _USD0_ and receiving _USDC_ in return. The contract also includes utility functions such as getOrder, getUsd0WadEquivalent, and getUsdcWadPrice to retrieve order details and perform price calculations. The swapperEngine has no option to define a maxUSDCPrice for buyers and seller's don't have the option to define a minimumUSDCPrice, instead the prices are provided by an USDC oracle, which also has measures against a potential USDC depeg. USD0's price is considered to be $1 == 1USD0 due to the numerous mechanisms in place to prevent a depeg, like reserves, CBR mechanism, arbitrage etc. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#inherited-contracts) Inherited Contracts * **Initializable** (OZ): Used to provide a safe and controlled way to initialize the contract's state variables. It ensures that the contract's initializer function can only be called once, preventing accidental or malicious reinitialization. * **ReentrancyGuardUpgradeable** (OZ): Used to protect against reentrancy attacks. It provides a modifier that can be applied to functions to prevent them from being called recursively or from being called from other functions that are also protected by the same guard. * **PausableUpgradeable (OZ)**: Allows contract functionality to be paused by authorized accounts (`PAUSING_CONTRACTS_ROLE` to pause the contract and `DEFAULT_ADMIN_ROLE` to un-pause). [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#functionality-breakdown) Functionality Breakdown ---------------------------------------------------------------------------------------------------------------------------------------------------- The SwapperEngine contract's primary purpose is to facilitate the swapping of _USDC_ tokens for _USD0_ tokens using an order matching mechanism. The contract's functionality can be broken down into the following key components: 1. **Order Creation**: * Users can create new orders by calling the **depositUSDC** function and specifying the amount of _USDC_ they wish to swap. * The contract transfers the specified amount of _USDC_ tokens from the user to itself and creates a new order with the deposited amount and the user's address as the requester. * The order is assigned a unique order ID and stored in the contract's orders mapping. 2. **Order Cancellation**: * Users who have created an order can cancel it by calling the **withdrawUSDC** function and specifying the order ID. * The contract verifies that the caller is the requester of the order and that the order is active. * If the conditions are met, the contract deactivates the order, sets its token amount to zero, and transfers the deposited _USDC_ tokens back to the requester. 3. **Order Matching**: * Users can fill existing orders by specifying the recipient address, the amount of _USDC_ to take (or the amount of USD0 to give), an array of order IDs to match against, and whether partial matching is allowed. * The contract verifies that the caller has sufficient _USD0_ balance and allowance to cover the required amount based on the current _USDC_ Price Calculation obtained from the oracle. * The contract iterates through the provided order IDs and attempts to match the requested _USDC_ amount against active orders. * If partial matching is allowed and there is not enough _USDC_ in the orders to fulfil the entire request, the contract will partially fill orders until the requested amount is met or all orders are exhausted. * For each matched order, the contract transfers the corresponding _USD0_ tokens from the caller to the order requester and transfers the _USDC_ tokens from itself to the specified recipient. * If partial matching is not allowed and the requested _USDC_ amount cannot be fully matched, the contract reverts the transaction. 4. **Price Calculation**: * The contract relies on an external oracle contract to obtain the current price of _USDC_ tokens in WAD format (18 decimals). * The getUsdcWadPrice function is used to retrieve the current _USDC_ price from the oracle. * The getUsd0WadEquivalent function is used to calculate the equivalent amount of _USD0_ tokens for a given amount of _USDC_ tokens based on the current price. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-provideusd0receiveusdc) Method: provideUsd0ReceiveUSDC This method allows users to provide _USD0_ tokens and receive _USDC_ tokens by matching against existing orders. It matches the requested _USDC_ amount to the provided _USD0_ tokens against the specified orders, transfers the corresponding _USDC_ tokens to the recipient, and updates the order states accordingly. 1. The function is protected against reentrancy attacks by using the nonReentrant modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. 2. Validates that the amount of _USDC_ to take is greater than zero. 3. Validates that at least one order ID is provided for matching. 4. Retrieves the contract's storage using the correct storage pattern. 5. Retrieves the current price of _USDC_ in WAD format (18 decimals) from an oracle, ensuring that the price used for calculations is up-to-date and accurate. 6. Initializes the total amount of _USDC_ taken to zero. 1. Retrieves the order details for the current order ID. 2. Checks if the order is active before processing. 12-13. If the order is active, calculates the amount of USDC to take from the current order based on the remaining amount to take and the order's available balance. 14-15. Updates the order's token amount and the total USDC taken. 3. Marks the order as inactive if its token amount reaches zero. 4. Calculates the equivalent USD0 amount for the USDC taken from the order using the \_getUsd0WadEquivalent function and the current USDC price. 5. Updates the total USD0 provided with the calculated amount. 6. Transfers the USD0 tokens from the sender to the order requester. 7. Transfers the USDC tokens from the contract to the recipient. 8. Emits an OrderMatched event with the relevant details. 9. Increments the loop counter using an unchecked block for gas optimization. 10. Reverts the transaction if partial matching is not allowed and the total USDC taken does not match the requested amount or if no USDC was taken. 11. Returns the remaining amount of USDC that was not taken and the total USD0 provided. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-getusd0wadequivalent) Method: getUsd0WadEquivalent This method calculates the USD0 equivalent amount in WAD format (18 decimals) for a given USDC token amount. It converts the USDC token amount from its native decimal representation (6 decimals) to WAD format and then calculates the equivalent USD0 amount based on the provided USDC price in WAD format. 1. Retrieves the contract's storage using the correct storage pattern. 2. Retrieves the decimal places of the USDC token using the decimals() function from the IERC20Metadata interface. 3. Converts the usdcTokenAmountInNativeDecimals to WAD format (18 decimals) using the tokenAmountToWad function, which takes into account the token's native decimals. 4. Calculates the equivalent amount of USD0 tokens in WAD format by multiplying the usdcWad amount with the usdcWadPrice using the wadAmountByPrice function. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-depositusdc) Method: depositUSDC This method allows users to deposit USDC tokens and create a new order. It transfers the specified amount of USDC tokens from the caller to the contract and creates a new order with the deposited amount and the caller as the requester. 1. The function is protected against reentrancy attacks by using the nonReentrant modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. 2. Retrieves the contract's storage using the correct storage pattern. 3. Validates that the amount of USDC to deposit is greater than or equal to the minimum required amount specified in the contract's storage. This prevents any attempts to deposit amounts below the minimum threshold. 4. Sets the value of orderId to the current value of $.nextOrderId then increments by 1. Since it is initialized as 1, the first orderId will be one and so on. 5. Creates a new UsdcOrder struct in storage using the order ID as key. The struct is set up correctly to contain: the requester's address (msg.sender), the deposited token amount (amountToDeposit), and sets the active flag to true. 6. Transfers the specified amount of USDC tokens from the caller (msg.sender) to the contract (address(this)) using the safeTransferFrom function to ensure that the transfer is successful and the contract receives the deposited tokens. If the transfer fails, the function will revert. 7. Emits a Deposit event, providing the order ID and the deposited amount for the subgraph. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-withdrawusdc) Method: withdrawUSDC This method allows the requester of an order to withdraw their deposited USDC tokens and cancel the order. It deactivates the specified order, sets its token amount to zero, and transfers the deposited USDC tokens back to the requester. 1. The function is protected against reentrancy attacks by using the nonReentrant modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. 2. Retrieves the contract's storage using the correct storage pattern. 3. Retrieves the UsdcOrder struct as storage so it will be modified. 4. Checks if the order is active using the active flag. If the order is not active or does not exist, the function will revert with an appropriate error message. This prevents any attempts to withdraw from invalid or canceled orders. 5. Verifies that the caller (msg.sender) is the requester of the order. This ensures that only the original requester can cancel their own order and withdraw the deposited tokens. 6. Retrieves the token amount associated with the order and assigns it to the amountToWithdraw variable. 7. Sets the active flag of the order to false in storage. 8. Sets the tokenAmount of the order to zero in storage. 9. Transfers the amountToWithdraw of USDC tokens from the contract back to the requester (msg.sender) using the safeTransfer function. This ensures that the transfer is successful and the requester receives their tokens. If the transfer fails, the function will revert. 10. Emits a Withdraw event, providing the orderToCancel ID and the amountToWithdraw for the subgraph ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-swapusd0) Method swapUsd0 This method allows users to provide _USD0_ tokens and receive _USDC_ tokens by matching against existing orders. It matches the specified amount of _USD0_ tokens against the specified orders, transfers the corresponding _USDC_ tokens to the recipient, and updates the order states accordingly. 1. The function is protected against reentrancy attacks by using the nonReentrant modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. 2. Retrieves the current USDC price in WAD format using the getUsdcWadPrice() function. 3-5. Calculates the equivalent amount of USDC to take in native decimals based on the provided amountUsd0ToProvideInWad and the current usdcWadPrice using the \_getUsdcAmountFromUsd0WadEquivalent function. Then calls the \_provideUsd0ReceiveUSDC function to perform the actual swap, passing the recipient, amountUsdcToTakeInNativeDecimals, orderIdsToTake, and partialMatchingAllowed parameters. The function returns the total amount of usd0 provided. 3. Returns the sum of unmatchedUsd0 in wad format including dust, representing the total amount of USD0 that was not matched or was left as dust. [PreviousUSD0 DaoCollateralchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-daocollateral) [NextUSD0 Revenue Distribution Modulechevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#security-analysis) * [Method swapUsd0](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine#method-swapusd0) Was this helpful? Copy 1 function _provideUsd0ReceiveUSDC( ... ) internal returns (uint256 unmatchedUsdcAmount, uint256 totalUsd0Provided) { 2 if (amountUsdcToTakeInNativeDecimals == 0) { revert AmountIsZero() } 3 if (orderIdsToTake.length == 0) { revert NoOrdersIdsProvided() } 4 SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); 5 uint256 usdcWadPrice = _getUsdcWadPrice(); 6 uint256 totalUsdcTaken = 0; Copy 8 for (uint256 i; i < orderIdsToTake.length && totalUsdcTaken < amountUsdcToTakeInNativeDecimals;) { 9 uint256 orderId = orderIdsToTake[i]; 10 UsdcOrder storage order = $.orders[orderId]; 11 if (order.active) { 12 uint256 remainingAmountToTake = amountUsdcToTakeInNativeDecimals - totalUsdcTaken; 13 uint256 amountOfUsdcFromOrder = order.tokenAmount > remainingAmountToTake ? remainingAmountToTake : order.tokenAmount; 14 order.tokenAmount -= amountOfUsdcFromOrder; 15 totalUsdcTaken += amountOfUsdcFromOrder; 16 if (order.tokenAmount == 0) { order.active = false }; 17 uint256 usd0Amount = _getUsd0WadEquivalent(amountOfUsdcFromOrder, usdcWadPrice); 18 totalUsd0Provided += usd0Amount; 19 $.usd0.safeTransferFrom(msg.sender, order.requester, usd0Amount); 20 $.usdcToken.safeTransfer(recipient, amountOfUsdcFromOrder); 21 emit OrderMatched(order.requester, msg.sender, orderId, amountOfUsdcFromOrder); 22 } 23 unchecked { ++i } 24 } 25 if (!partialMatchingAllowed && totalUsdcTaken != amountUsdcToTakeInNativeDecimals || totalUsdcTaken == 0) { revert AmountTooLow() } 26 return ((amountUsdcToTakeInNativeDecimals - totalUsdcTaken), totalUsd0Provided); ... Copy 1 function _getUsd0WadEquivalent(uint256 usdcTokenAmountInNativeDecimals, uint256 usdcWadPrice) private view returns (uint256 usd0WadEquivalent) { 2 SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); 3 uint8 decimals = IERC20Metadata(address($.usdcToken)).decimals(); 4 uint256 usdcWad = usdcTokenAmountInNativeDecimals.tokenAmountToWad(decimals); 5 usd0WadEquivalent = usdcWad.wadAmountByPrice(usdcWadPrice); 6 } Copy 1 function depositUSDC(uint256 amountToDeposit) external nonReentrant { 2 SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); 3 if (amountToDeposit < $.minimumUSDCAmountProvided) { revert AmountTooLow();} 4 uint256 orderId = $.nextOrderId++; 5 $.orders[orderId] = UsdcOrder({requester: msg.sender, tokenAmount: amountToDeposit, active: true}); 6 $.usdcToken.safeTransferFrom(msg.sender, address(this), amountToDeposit); 7 emit Deposit(msg.sender, orderId, amountToDeposit); 8 } Copy 1 function withdrawUSDC(uint256 orderToCancel) external nonReentrant { 2 SwapperEngineStorageV0 storage $ = _swapperEngineStorageV0(); 3 UsdcOrder storage order = $.orders[orderToCancel]; 4 if (!order.active) { revert OrderNotActive() } 5 if (order.requester != msg.sender) { revert NotRequester() } 6 uint256 amountToWithdraw = order.tokenAmount; 7 order.active = false; 8 order.tokenAmount = 0; 9 $.usdcToken.safeTransfer(msg.sender, amountToWithdraw); 10 emit Withdraw(msg.sender, orderToCancel, amountToWithdraw); 11 } Copy 1 function swapUsd0(address recipient, uint256 amountUsd0ToProvideInWad, uint256[] memory orderIdsToTake, bool partialMatchingAllowed) external nonReentrant returns (uint256) { 2 uint256 usdcWadPrice = _getUsdcWadPrice(); 3 (, uint256 totalUsd0Provided) = _provideUsd0ReceiveUSDC( 4 recipient, _getUsdcAmountFromUsd0WadEquivalent(amountUsd0ToProvideInWad, usdcWadPrice), orderIdsToTake, partialMatchingAllowed 5 ); 6 return amountUsd0ToProvideInWad - totalUsd0Provided; 7 } --- # VaultRouter | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#high-level-overview) High-Level Overview The `VaultRouter` contract serves as an intermediary for interacting with the `WrappedDollarVault`. It facilitates deposits, withdrawals, and other operations by abstracting the complexities of approvals and token swaps. The router ensures that arbitrary tokens can be used as input, while the vault operates exclusively with USD-denominated ERC4626 tokens. The router is tightly integrated with the `WrappedDollarVault` and requires registration via the `setRouter()` function in the vault. Only registered routers can interact with the vault, ensuring controlled access and preventing unauthorized operations. The router implementation used by the investment vault aims to swap bUSD0 to yield bearing token when depositing into the vault and swap back to bUSD0 when withdrawing from the vault. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#contract-summary) Contract Summary The contract provides the following main functions: * **deposit**: Swaps arbitrary tokens for the vault's underlying asset and deposits them into the vault. * **withdraw**: Withdraws assets from the vault and swaps them for arbitrary tokens. * **depositWithPermit**: Allows gasless approval of tokens and deposits them into the vault. * **withdrawWithPermit**: Allows gasless approval of tokens and withdraw them from the vault. Inherited Contracts * **ReentrancyGuard**: Prevents reentrancy attacks in critical functions. * **Pausable**: Enables emergency halt of contract operations. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#functionality-breakdown) Functionality Breakdown #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#id-1.-access-control-and-security) 1\. Access Control and Security * **Router Registration**: The router must be registered with the vault via the `setRouter()` function. This ensures only authorized routers can interact with the vault. * **Reentrancy Protection**: All critical functions are protected against reentrancy attacks using the `nonReentrant` modifier. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#id-2.-token-swapping) 2\. Token Swapping * **Arbitrary Token Support**: The router integrates with external decentralized exchanges (DEXs) to swap arbitrary tokens for the vault's underlying asset. However in the current implementation we use paraswap. * **Permit Support**: Enables gasless approvals for tokens using the `permit` function, reducing friction for users. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#id-3.-deposit-and-withdrawal) 3\. Deposit and Withdrawal * **Deposit**: Users can deposit bUSD0 or SUSDS tokens into the vault by swapping them for the vault underlying asset. The router handles the swap and deposit process seamlessly. * **Withdraw**: Users can withdraw assets from the vault and swap them for bUSD0 tokens. The router ensures the correct amount of tokens is returned after fees. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#id-4.-upgradability-and-maintenance) 4\. Upgradability and Maintenance * **Modular Design**: The router is designed to work with any `WrappedDollarVault` vault, allowing flexibility for future upgrades. * **VaultRouter**: The contract can be paused and a new router can be setup in the Vault. this allow for easy upgrade. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#security-analysis) Security Analysis **Method: Deposit** Swaps bUSD0 or USDS tokens for the vault's underlying asset and deposits them into the vault. This function ensures that users can interact with the vault using arbitrary tokens, abstracting the complexity of token swaps. **Description** The `deposit` function allows users to deposit an ERC20 token into the vault by first swapping it for the vault's underlying asset using ParaSwap. The swapped assets are then deposited into the vault, and the user receives vault shares in return. This function ensures that users can interact with the vault using arbitrary tokens, abstracting the complexity of token swaps. The function is protected by a `nonReentrant` modifier to prevent reentrancy attacks during the swap and deposit process. It returns the number of vault shares minted and sent to the `receiver`. **16-21 Input Validation**: * Ensures `augustus`, `tokenIn`, and `receiver` are valid addresses. * Ensures `amountIn` is greater than zero to prevent invalid deposits. **22-23 Swap Execution**: * Interacts with ParaSwap to swap `tokenIn` for the vault's underlying asset using the provided `swapData`. * Ensures the received tokens meet or exceed `minTokensToReceive`, reverting if the condition is not met to protect users from unfavorable swaps. **26-29 Deposit Execution**: * Deposits the swapped assets into the vault on behalf of the `receiver`. * Ensures the resulting vault shares meet or exceed `minSharesToReceive`, reverting if the condition is not met to protect users from unfavorable deposits. **30 Event Emission**: * Emits a `Deposit` event with details of the operation, including the `receiver`, `tokenIn`, `amountIn`, and `sharesReceived`. * * * **Method: depositWithPermit** Executes a permit before depositing it into the vault. **15-23 Permit Execution**: * Uses the provided `permitParams` to approve the router for spending `tokenIn` without requiring a separate transaction. **25-32 Deposit Execution**: * Deposits the swapped assets into the vault. * Ensures the resulting shares meet or exceed `minSharesToReceive`. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#method-withdraw) Method: withdraw Withdraws assets from the vault and converts them to bUSD0. **Description** The `withdraw` function allows users to withdraw assets from the vault and convert them to bUSD0 using ParaSwap. The withdrawn assets are swapped for bUSD0 and the resulting amount are sent to the specified receiver. It returns the amount of USD0PP received by the `receiver`. **13-15 Input Validation**: * Ensures `receiver` is a valid addresses. **17 Withdrawal Execution**: * Withdraws the specified `assets` from the vault. **19-20 Swap Execution**: * Interacts with ParaSwap to swap the withdrawn assets for bUSD0. * Ensures the received bUSD0 meets or exceeds `minUSD0ppToReceive`. **24 Event Emission**: * Emits a `Withdraw` event with details of the operation. * * * #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#method-withdrawwithpermit) Method: withdrawWithPermit Executes a permit and withdraws assets from the vault, converting them to bUSD0. **9-17 Permit Execution**: * Uses the provided `permitParams` to approve the router for spending vault shares without requiring a separate transaction. **19-20 Withdraw Execution** * Call the vault's withdraw function [PreviousUsual bUSD0 Investment Vaultchevron-left](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault) [NextsUSD0chevron-right](https://tech.usual.money/smart-contracts/token-contracts/susd0) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault/vaultrouter#security-analysis) Was this helpful? Copy function deposit( IParaSwapAugustus augustus, IERC20 tokenIn, uint256 amountIn, uint256 minTokensToReceive, uint256 minSharesToReceive, address receiver, bytes calldata swapData ) public payable whenNotPaused nonReentrant returns (uint256 sharesReceived) { if (tokenIn != USD0PP && tokenIn != SUSDS) { revert InvalidInputToken(address(tokenIn)); } if (receiver == address(0)) { revert NullAddress(); } uint256 tokensAmount = _convertToTokens( augustus, tokenIn, amountIn, minTokensToReceive, swapData ); sharesReceived = VAULT.deposit(tokensAmount, receiver); if (sharesReceived < minSharesToReceive) { revert InsufficientSharesReceived(); } emit Deposit(receiver, address(tokenIn), amountIn, sharesReceived); return sharesReceived; } Copy function depositWithPermit( IParaSwapAugustus augustus, IERC20 tokenIn, uint256 amountIn, uint256 minTokensToReceive, uint256 minSharesToReceive, address receiver, bytes calldata swapData, PermitParams calldata permitParams ) public whenNotPaused returns (uint256 sharesReceived) { try ERC20Permit(address(tokenIn)).permit( _msgSender(), address(this), permitParams.value, permitParams.deadline, permitParams.v, permitParams.r, permitParams.s ) { } catch { } // solhint-disable-line no-empty-blocks return deposit( augustus, tokenIn, amountIn, minTokensToReceive, minSharesToReceive, receiver, swapData ); } Copy function withdraw( IParaSwapAugustus augustus, uint256 assets, uint256 minUSD0ppToReceive, address receiver, bytes calldata swapData ) public whenNotPaused nonReentrant returns (uint256 amountUSD0pp) { if (receiver == address(0)) { revert NullAddress(); } VAULT.withdraw(assets, address(this), _msgSender()); amountUSD0pp = _convertTokensToUSD0pp( augustus, assets, minUSD0ppToReceive, swapData ); USD0PP.safeTransfer(receiver, amountUSD0pp); emit Withdraw(receiver, assets, amountUSD0pp); return amountUSD0pp; } Copy function withdrawWithPermit( IParaSwapAugustus augustus, uint256 assets, uint256 minUSD0ppToReceive, address receiver, bytes calldata swapData, PermitParams calldata permitParams ) external returns (uint256 amountUSD0pp){ try ERC20Permit(address(VAULT)).permit( _msgSender(), address(this), permitParams.value, permitParams.deadline, permitParams.v, permitParams.r, permitParams.s ) { } catch { } // solhint-disable-line no-empty-blocks return withdraw(augustus, assets, minUSD0ppToReceive, receiver, swapData); } --- # Yield Module | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------------------------------------------- This contract manages the blending of various Real-World Asset (RWA) interest rates and TVL vault strategies in the treasury. The contract calculates a blended weekly interest rate and maintains a `P90` (90th percentile) rate that can be used by the distribution module for token emissions calculations. The core features of this contract include: * **Interest Rate Management**: Manages yield sources with either Chainlink oracle feeds or manual interest rates * **Blended Rate Calculation**: Calculates a weighted average of interest rates based on asset values in treasuries * **P90 Rate Management**: Maintains a configurable P90 interest rate for distribution calculations * **Treasury Management**: Tracks multiple treasury addresses for asset balance calculations * **Access Control**: Each functionality is controlled by specific roles with minimal required permissions [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#contract-summary) Contract Summary --------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#inherited-contracts) Inherited Contracts * **PausableUpgradeable**: Allows contract execution to be paused/unpaused by authorized role * **IYieldModule**: Interface defining all public/external functions ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#functionality-description) Functionality Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#public-external-functions) **Public/External Functions** **Administrative Functions**: * `initialize`: Initializes contract with registry address and sets initial max data age * `pause`: Pauses contract operations (`PAUSING_CONTRACTS_ROLE` only) * `unpause`: Unpauses contract operations (`DEFAULT_ADMIN_ROLE` only) **Yield Source Management**: * `addYieldSourceWithFeed`: Adds yield source with Chainlink oracle feed (`YIELD_MODULE_TOKENOMICS_OPERATOR_ROLE` only) * `addYieldSourceWithWeeklyInterest`: Adds yield source with manual weekly interest rate (`YIELD_MODULE_TOKENOMICS_OPERATOR_ROLE` only) * `removeYieldSource`: Removes a yield source (`YIELD_MODULE_SUPER_ADMIN_ROLE` only) * `updateInterestRate`: Updates manual interest rate for a new one. This function will override the feed address if it exists (`YIELD_MODULE_UPDATER_ROLE` only) * `updateFeed`: Updates Chainlink feed address for a new fee address (`YIELD_MODULE_UPDATER_ROLE` only) **Treasury Management**: * `addTreasury`: Adds a treasury address for asset balance tracking (`YIELD_MODULE_SUPER_ADMIN_ROLE` only) * `removeTreasury`: Removes a treasury address (`YIELD_MODULE_SUPER_ADMIN_ROLE` only) **Configuration**: * `setMaxDataAge`: Sets maximum allowed age for oracle data (`YIELD_MODULE_MAX_DATA_AGE_ROLE` only) * `setP90InterestRate`: Sets P90 interest rate value (`YIELD_MODULE_P90_INTEREST_ROLE` only) **View Functions**: * `getBlendedWeeklyInterest`: Calculates current blended weekly interest rate * `getP90InterestRate`: Returns current P90 interest rate * `getYieldSource`: Returns data for specific yield source * `getYieldSourceCount`: Returns total number of yield sources * `getAllYieldSourceData`: Returns data for all yield sources * `getTreasuryCount`: Returns number of tracked treasuries * `getAllTreasury`: Returns all treasury addresses [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#yield-source-management) **Yield Source Management** * Each yield source can use either a Chainlink oracle feed or manual interest rate * Oracle feeds must provide valid, recent data within `maxDataAge` * Manual rates are validated to be within acceptable bounds * Interest rates are expressed in basis points (1 = 0.01%) ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#blended-rate-calculation) **Blended Rate Calculation** The `getBlendedWeeklyInterest()` function calculates a weighted average of all RWA interest rates based on their USD value in the treasury. Here's the detailed calculation process: 1. **Asset Value Calculation (in USD)** For each RWA token: where: * `price` is obtained from the oracle for that RWA * `balance` is the sum of the RWA token balance across all registered treasuries * `decimals` is the token's decimal places 2. **Weighted Interest Rate** For each RWA: where: * `rate` is either: * The latest valid rate from the Chainlink oracle feed if configured * The manually set `weeklyInterestBps` if no feed is configured * Oracle data must be fresher than `maxDataAge` to be considered valid 3. **Final Blended Rate** The final rate is rounded down and must be less than `BASIS_POINT_BASE` (10000) [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#constants) Constants ------------------------------------------------------------------------------------------------------------------------------------- * `YIELD_MODULE_TOKENOMICS_OPERATOR_ROLE`: Role for adding yield sources * `YIELD_MODULE_SUPER_ADMIN_ROLE`: Role for removing yield sources and treasury management * `YIELD_MODULE_P90_INTEREST_ROLE`: Role for setting P90 interest rate * `YIELD_MODULE_MAX_DATA_AGE_ROLE`: Role for setting maximum data age * `YIELD_MODULE_UPDATER_ROLE`: Role for updating yield sources * `INITIAL_YIELD_MODULE_MAX_DATA_AGE`: Default maximum age for oracle data (14 days) * `DEFAULT_YIELD_FEED_RATE`: Default rate for new oracle feeds * `BASIS_POINT_BASE`: Base for interest rate calculations (10000 = 100%) [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#safeguard-implementation) Safeguard Implementation ------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#access-control) **Access Control** * Role-based access control for all administrative functions * Specific roles for different aspects of yield management * Minimal permissions principle applied to role assignments ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#pausability) **Pausability** * Contract can be paused by `PAUSING_CONTRACTS_ROLE` * Only `DEFAULT_ADMIN_ROLE` can unpause * Protects against emergencies or discovered vulnerabilities ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#data-validation) **Data Validation** * Oracle data freshness checks * Interest rate bounds validation * Duplicate treasury prevention * Null address checks ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#oracle-safety) **Oracle Safety** * Maximum data age enforcement * Oracle interface validation * Fallback to manual rates if needed [PreviousDistribution Modulechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/distribution-module) [NextUSUALx Lockup Contractchevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract) Last updated 1 year ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#inherited-contracts) * [Functionality Description](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#functionality-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#functionality-breakdown) * [Yield Source Management](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#yield-source-management) * [Blended Rate Calculation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#blended-rate-calculation) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#constants) * [Safeguard Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#safeguard-implementation) * [Access Control](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#access-control) * [Pausability](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#pausability) * [Data Validation](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#data-validation) * [Oracle Safety](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module#oracle-safety) Was this helpful? Copy assetValue = price * balance / (10 ^ decimals) Copy weightedSum += rate * assetValue totalValue += assetValue Copy blendedRate = totalValue > 0 ? weightedSum / totalValue : 0 --- # USD0a SwapperEngine | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#high-level-overview) High-Level Overview The SwapperEngine contract is a smart contract designed to facilitate the swapping of USDC tokens for USD0a tokens using an order matching mechanism. The contract allows users to create orders by depositing USD0a tokens, and other users can fill these orders by providing USDC 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. **Key Advantage for Liquidity Providers**: Users (USDC providers) can provide USDC liquidity to receive USD0a through order matching. Even though USDC is also part of the collateral set, using the SwapperEngine instead of DaoCollateral lets providers earn transaction fees (in USDC) and receive a discount, making it preferable for liquidity providers seeking fee revenue. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#contract-summary) Contract Summary The contract provides the following main functions: * **depositUSD0X**: Allows users to create a new order by depositing USD0a tokens. * **cancelUSD0XOrder**: Allows users to cancel an order and withdraw their deposited USD0a tokens. * **provideUSDCReceiveUSD0X**: Allows users to fill orders by providing USDC and receiving USD0a in return. The contract also includes utility functions such as `getOrder`, `getNextOrderId`, `swapperFee`, and `minimumUSD0XAmountProvided` to retrieve order details and contract configuration. The SwapperEngine uses oracle-based pricing for both USDC and USD0a. USD0a's price is dynamic and increases over time as yield is harvested, since USD0a is a yield-bearing token. Orders can specify a minimum USD0a price to protect against unfavorable price movements. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#inherited-contracts) Inherited Contracts * **Initializable (OZ)**: Used to provide a safe and controlled way to initialize the contract's state variables. It ensures that the contract's initializer function can only be called once, preventing accidental or malicious reinitialization. * **ReentrancyGuardUpgradeable (OZ)**: Used to protect against reentrancy attacks. It provides a modifier that can be applied to functions to prevent them from being called recursively or from being called from other functions that are also protected by the same guard. * **PausableUpgradeable (OZ)**: Allows contract functionality to be paused by authorized accounts (PAUSING\_CONTRACTS\_ROLE to pause the contract and UNPAUSING\_CONTRACTS\_ROLE to unpause). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#functionality-breakdown) Functionality Breakdown The SwapperEngine contract's primary purpose is to facilitate the swapping of USDC tokens for USD0a tokens using an order matching mechanism. The contract's functionality can be broken down into the following key components: #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#order-creation) Order Creation: Users can create new orders by calling the `depositUSD0X` function and specifying the amount of USD0a tokens they wish to swap, along with an optional minimum USD0a price. * The contract transfers the specified amount of USD0a tokens from the user to itself and creates a new order with the deposited amount, the user's address as the requester, and the minimum price requirement. * The order is assigned a unique order ID and stored in the contract's orders mapping. * Users can also use `depositUSD0XWithPermit` to create orders with gasless approvals. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#order-cancellation) Order Cancellation: Users who have created an order can cancel it by calling the `cancelUSD0XOrder` function and specifying the order ID. * The contract verifies that the caller is the requester of the order and that the order is active. * If the conditions are met, the contract deactivates the order, sets its token amount and minimum price to zero, and transfers the deposited USD0a tokens back to the requester. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#order-matching) Order Matching: Users can fill existing orders by calling `provideUSDCReceiveUSD0X` and specifying the recipient address, the amount of USD0a to receive, the maximum USDC amount to spend, an array of order IDs to match against, and whether partial matching is allowed. * The contract verifies that the caller has sufficient USDC balance and allowance to cover the required amount based on the current USDC and USD0a prices obtained from the oracles. * The contract iterates through the provided order IDs and attempts to match the requested USD0a amount against active orders. * For each order, the contract checks if the current USD0a price meets the order's minimum price requirement. * If partial matching is allowed and there is not enough USD0a in the orders to fulfill the entire request, the contract will partially fill orders until the requested amount is met or all orders are exhausted. * For each matched order, the contract transfers the corresponding USDC tokens (minus fees) from the caller to the order requester and transfers the USD0a tokens from itself to the specified recipient. * The transaction fee (in USDC) is deducted from the USDC amount and effectively paid to the order requester (USD0a provider), incentivizing liquidity provision. * If partial matching is not allowed and the requested USD0a amount cannot be fully matched, the contract reverts the transaction. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#price-calculation) Price Calculation: The contract relies on external oracle contracts to obtain the current prices of both USDC and USD0a tokens in WAD format (18 decimals). * The `_getPrices` function retrieves both USDC and USD0a prices from their respective oracles. * USD0a's price is dynamic and reflects the yield-bearing nature of the token, increasing over time as yield is harvested. * The `_getUsdcAmountFromUSD0XWadEquivalent` function calculates the equivalent amount of USDC tokens needed for a given amount of USD0a tokens based on the current prices. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#method-provideusdcreceiveusd0x) Method: provideUSDCReceiveUSD0X This method allows users to provide USDC tokens and receive USD0a tokens by matching against existing orders. It matches the requested USD0a amount to the provided USDC tokens against the specified orders, transfers the corresponding USDC tokens (minus fees) to order requesters, and updates the order states accordingly. **Function Description:** 1. The function is protected against reentrancy attacks by using the `nonReentrant` modifier, ensuring that the function cannot be called recursively or from other functions that are also protected by the same guard. 2. Validates that the amount of USD0a to receive is greater than zero. 3. Validates that at least one order ID is provided for matching. 4. Retrieves and validates prices from oracles, ensuring that USD0a price is non-zero. 5. Checks that the caller has sufficient USDC balance to cover the required amount (including fees). 6. For each order, validates that the current USD0a price meets the order's minimum price requirement (if specified). 7. Processes orders sequentially, updating order states atomically. 8. Validates that the total USDC spent does not exceed the maximum allowed amount specified by the caller. 9. Reverts if partial matching is not allowed and the requested USD0a amount cannot be fully matched. 10. Transfers are performed using SafeERC20 to prevent failures from going unnoticed. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#method-depositusd0x) Method: depositUSD0X This method allows users to deposit USD0a tokens and create a new order. It transfers the specified amount of USD0a tokens from the caller to the contract and creates a new order with the deposited amount, the caller as the requester, and an optional minimum USD0a price. **Function Description:** 1. The function is protected against reentrancy attacks by using the `nonReentrant` modifier. 2. Validates that the amount of USD0a to deposit is greater than or equal to the minimum required amount specified in the contract's storage. This prevents any attempts to deposit amounts below the minimum threshold. 3. Checks that the caller is not blacklisted in the USD0a token contract. 4. Sets the value of `orderId` to the current value of `$.nextOrderId` then increments by 1. Since it is initialized as 1, the first orderId will be one and so on. 5. Creates a new `SwapperOrder` struct in storage using the order ID as key. The struct contains: the requester's address (msg.sender), the deposited token amount, the active flag set to true, and the minimum USD0a price. 6. Transfers the specified amount of USD0a tokens from the caller to the contract using `safeTransferFrom` to ensure that the transfer is successful. If the transfer fails, the function will revert. 7. Emits a `Deposit` event, providing the order ID and the deposited amount for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#method-cancelusd0xorder) Method: cancelUSD0XOrder This method allows the requester of an order to cancel their deposited USD0a tokens and get the deposited amount back. It deactivates the specified order, sets its token amount and minimum price to zero, and transfers the deposited USD0a tokens back to the requester. **Function Description:** 1. The function is protected against reentrancy attacks by using the `nonReentrant` modifier. 2. Retrieves the `SwapperOrder` struct as storage so it will be modified. 3. Checks if the order is active using the active flag. If the order is not active or does not exist, the function will revert with an appropriate error message. This prevents any attempts to cancel invalid or already canceled orders. 4. Verifies that the caller (msg.sender) is the requester of the order. This ensures that only the original requester can cancel their own order and withdraw the deposited tokens. 5. Retrieves the token amount associated with the order and assigns it to the `amountToWithdraw` variable. 6. Sets the active flag of the order to false in storage. 7. Sets the tokenAmount and minimumUsd0xPrice of the order to zero in storage. 8. Transfers the `amountToWithdraw` of USD0a tokens from the contract back to the requester (msg.sender) using the `safeTransfer` function. This ensures that the transfer is successful and the requester receives their tokens. If the transfer fails, the function will revert. 9. Emits an `OrderCancelled` event, providing the order ID and the amount withdrawn for tracking. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#method-_getusdcamountfromusd0xwadequivalent) Method: \_getUsdcAmountFromUSD0XWadEquivalent This method calculates the USDC token amount in native decimals for a given USD0a amount in WAD format. It converts the USD0a amount to its USD value, then calculates the equivalent USDC amount based on the provided USDC price. **Function Description:** 1. Retrieves the contract's storage using the correct storage pattern. 2. Retrieves the decimal places of the USDC token using the `decimals()` function from the `IERC20Metadata` interface. 3. Calculates the USD value of the USD0a amount by multiplying the USD0a amount (in WAD) with the USD0a price (in WAD) and dividing by `SCALAR_ONE`. 4. Converts the USD value to USDC tokens in native decimals by multiplying with `10^decimals` and dividing by the USDC price in WAD format. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#functions-description) Functions Description #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#publicexternal-functions) Public/External Functions * **initialize**: Sets up the contract with initial parameters including the registry contract, initializing the minimum USD0a amount and swapper fee. * **depositUSD0X**: Allows users to deposit USD0a tokens and create a new order with an optional minimum USD0a price. The function calculates the order ID, creates the order, and transfers USD0a tokens to the contract. * **depositUSD0XWithPermit**: Similar to `depositUSD0X` but uses permit for approval, enabling gasless approvals for USD0a tokens. * **cancelUSD0XOrder**: Enables users to cancel their order and withdraw their deposited USD0a tokens. Only the order requester can cancel their own order. * **provideUSDCReceiveUSD0X**: Allows users to provide USDC tokens and receive USD0a tokens by matching against existing orders. The function processes orders, applies fees, and handles transfers. * **pause**: Pauses the contract. Only callable by PAUSING\_CONTRACTS\_ROLE. * **unpause**: Unpauses the contract. Only callable by UNPAUSING\_CONTRACTS\_ROLE. * **updateSwapperFee**: Sets the swapper fee (in basis points). Only callable by SWAPPER\_FEE\_OPERATOR\_ROLE. * **updateMinimumUSD0XAmountProvided**: Sets the minimum amount of USD0a that must be deposited to create an order. Only callable by MINIMUM\_USD0X\_PROVIDED\_OPERATOR\_ROLE. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#getter-functions) Getter Functions * **getOrder**: Returns the details of a specific order including active status, token amount, and minimum USD0a price. * **getNextOrderId**: Returns the next order ID that will be assigned. * **swapperFee**: Returns the current swapper fee in basis points. * **minimumUSD0XAmountProvided**: Returns the minimum amount of USD0a required to create an order. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#constants) Constants * **CONTRACT\_REGISTRY\_ACCESS**: Address of the registry access contract. * **CONTRACT\_ORACLE**: Address of the oracle contract. * **CONTRACT\_USD0X**: Address of the USD0a token contract. * **USDC**: Address of the USDC token contract. * **SWAPPER\_FEE\_OPERATOR\_ROLE**: Role identifier for updating the swapper fee. * **MINIMUM\_USD0X\_PROVIDED\_OPERATOR\_ROLE**: Role identifier for updating the minimum USD0a amount. * **PAUSING\_CONTRACTS\_ROLE**: Role identifier for pausing contract operations. * **UNPAUSING\_CONTRACTS\_ROLE**: Role identifier for unpausing contract operations. * **MAX\_SWAPPER\_FEE**: Maximum allowed swapper fee (1000 basis points = 10%). * **INITIAL\_SWAPPER\_FEE**: Initial swapper fee (5 basis points = 0.05%). * **MINIMUM\_USD0X\_PROVIDED**: Minimum amount of USD0a required to create an order (100 USD0a). * **SCALAR\_ONE**: Scalar value representing 1 in the contract's decimal system (1e18). * **BASIS\_POINT\_BASE**: Base for basis point calculations (10,000). ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#key-components) Key Components * **Oracle Integration**: Uses oracles to fetch real-time price data for both USDC and USD0a tokens. USD0a's price is dynamic and reflects yield accumulation. * **Order Management**: Maintains a mapping of orders with unique IDs, allowing users to create, cancel, and match orders efficiently. * **Fee Mechanism**: Implements a fee system where USDC providers pay fees (in USDC) to USD0a providers, incentivizing liquidity provision through the SwapperEngine. * **Price Protection**: Orders can specify a minimum USD0a price to protect against unfavorable price movements during order execution. * **Access Control**: Implements role-based access control for administrative functions through the RegistryAccess contract. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#safeguards-implementation) Safeguards Implementation * **Pausability**: Allows pausing of contract functionality in emergencies. * **Reentrancy Protection**: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks. * **Access Control**: Restricts sensitive operations to authorized roles. * **Price Validation**: Ensures prices are non-zero and validates minimum price requirements before executing swaps. * **Amount Validation**: Validates that amounts are non-zero, within acceptable ranges, and meet minimum thresholds. * **Blacklist Check**: Prevents blacklisted addresses from creating orders. * **Maximum Spend Protection**: Allows users to specify a maximum USDC amount to spend, protecting against unexpected price movements. * **Partial Matching Control**: Allows users to specify whether partial order matching is acceptable, providing flexibility while protecting against incomplete fills. [PreviousUSD0a DaoCollateralchevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-daocollateral) [NextUSD0a Gatewaychevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-gateway) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#contract-summary) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#security-analysis) * [Functions Description](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#functions-description) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#constants) * [Key Components](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#key-components) * [Safeguards Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a/usd0a-swapperengine#safeguards-implementation) Was this helpful? --- # USUALx | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#high-level-overview) High-Level Overview The UsualX contract is an upgradeable ERC4626-compliant yield-bearing vault. It extends the YieldBearingVaultUpgradeable contract, incorporating features such as whitelisting, blacklisting, withdrawal fees, and yield distribution linearly over a predefined yield period. The contract leverages OpenZeppelin's upgradeable contracts for enhanced security and flexibility, including pausability and reentrancy protection. It also implements EIP712 for secure off-chain signing capabilities. The primary objective of Usualx is to provide a secure, controllable environment for yield generation and distribution, while maintaining strict control over who can interact with the contract. This design allows for potential regulatory compliance and risk management in decentralized finance applications. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#contract-summary) Contract Summary The contract provides the following main functions: * `initialize`: Sets up the contract with customizable parameters. * `initializeV1`: Sets up the contract with new customizable parameters. * `initializeV2`: Sets up the contract with the UsualX lockup mecanism. * `pause` / `unpause`: Controls the operational state of the contract. * `blacklist` / `unBlacklist`: Manages addresses prohibited from interacting with the contract. * `whitelist` / `unWhitelist`: Controls addresses permitted to transfer tokens. * `transfer` / `transferFrom`: Overridden to enforce whitelist restrictions. * `startYieldDistribution`: Initiates a new yield accrual period with specified parameters. * `deposit` / `mint`: Handles asset deposits and share minting. * `depositAndLock`: To deposit assets and immediately locking the received shares * `withdraw` / `redeem`: Handles asset withdrawals and share redemptions, incorporating withdrawal fees. * `previewWithdraw` / `previewRedeem`: Simulates withdrawal and redemption operations for users. The contract uses a separate storage structure (UsualXStorageV0) to store state variables for UsualX implementation. * `sweepFees`: Sweeps accumulated fees to the distribution module contract. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#inherited-contracts) Inherited Contracts * YieldBearingVaultUpgradeable: Provides core yield accrual and distribution mechanisms. * PausableUpgradeable: Enables emergency halt of contract operations. * ReentrancyGuardUpgradeable: Prevents reentrancy attacks in critical functions. * EIP712Upgradeable: Implements EIP712 for secure off-chain message signing. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#functionality-breakdown) Functionality Breakdown 1. Access Control and Security: * Utilizes a registry contract for role-based access control. * Implements blacklist to prevent specific addresses from interacting with the contract. * Enforces whitelist for token transfers, allowing only approved addresses to transfer tokens at launch but anyone not blacklisted to mint or interact with the vault. 1. Yield Management: * Allows admin-controlled yield distribution periods. * Accrues yield over time based on configurable parameters. * Integrates yield accrual with deposit and withdrawal operations. 2. Asset Management: * Implements ERC4626 standard for standardized vault interactions. * Handles deposits, withdrawals, and redemptions with consideration for accrued yield. * Applies withdrawal fees, potentially for protocol revenue or discouraging rapid withdrawals. * Implements a way to deposit some assets and lock received shares in the same transaction. 3. Upgradability and Pause Mechanism: * Utilizes OpenZeppelin's upgradeable contract pattern for future improvements. * Includes pause functionality for emergency situations. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-initialize) Method: initialize Initializes the vault, token, yield module, EIP712 domain, registry contract and access control, setting up the vault's initial state. 1-8. Set the registry contract, withdrawal fee in BPS, token name and symbol for the vault, underlying asset, and the max yield period length. 9-14. Initializes inherited contracts, with initializer parameters. 16-18. Validates withdrawal fee is below 25% preventing excessive fees that could harm users. 20-22. Ensures a valid registry contract, reverts if zero address. 24-26. Sets up contract storage with validated parameter. 1. Points at the access control registry in the registry contract. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-initializev1-decrepated) Method: initializeV1 (decrepated) Initializes the burn ration in bips and a variable linked to the USUAL token. 1\. Uses the `reintializer` modifier to set the second version of the the initialize function. 2\. Load the contract storage. 3-5. Validates `INITIAL_BURN_RATIO_BPS` constant isns't higher 100% preventing excessive burning fees. 6-7. Sets up contract storage with validated parameter. 8\. Emits an event with the new burn ration. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-initializev2) Method: initializeV2 Initializes the UsualX Lockup contract. 1\. Uses the `reintializer` modifier to set the third version of the the initialize function. 2\. Load the contract storage. 3\. Assign the UsualXLockup contract to a new variable. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-blacklist) Method: blacklist Adds an address to the blacklist, preventing it from interacting with the contract. 1. Mark function as external to save gas. 2-4. Prevents blacklisting of zero address, and reverts if trying to pass zero address. 5-6. Utilizes the registry for role-based access control, restricting to admin. 7-9. Reverts if the account is already blacklisted. 1. Adds the account to the blacklist in UsualXStorageV0. 2. Emits an event to log the blacklisting action. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-_update) Method: \_update Internal hook ensuring that both sender and receiver are not blacklisted before updating the token balances. 1-4. Internal function overriding the base ERC20Upgradeable implementation. 1. Retrieves storage pointer for UsualXStorageV0. 6-8. Checks both sender and receiver against blacklist, reverting if either is blacklisted. 2. Passes through to parent implementation if checks pass. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-transfer) Method: transfer Overrides the standard ERC20 transfer function to enforce whitelist restrictions on token transfers when the contract is deployed. This can later be removed via smart contract upgrade. 1-5. Public function overriding ERC20 transfer base implementation. 6-7. Uses `_msgSender()` for potential meta-transaction support, and retrieve storage pointer. 8-11. Allows whitelisted senders to transfer tokens, otherwise reverts. 1. Reverts if sender is not whitelisted. Security considerations: * Correctly enforces whitelist for senders, but doesn't check recipient's whitelist status. * Consider adding a check for the contract's paused state. * The function doesn't emit a custom event for whitelisted transfers, which could aid in monitoring. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-startyielddistribution) Method: startYieldDistribution Initiates a new yield distribution period with specified parameters wrapping the internal call to add proper access control. 1-3. External function for starting a new yield period. 1. Ensures only admin set on registry access can call this function. 2. Delegates to internal function for yield distribution logic. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-depositandlock) Method: depositAndLock Combines deposit and lock operations into a single atomic transaction, allowing users to deposit assets and immediately lock the resulting shares. 1-6. Public function marked as `whenNotPaused` to prevent its usage if contract is paused 7\. Retrieves storage pointers for UsualXStorageV0 8\. Deposits assets into the vault, but instead of sending shares directly to the receiver, they are minted to the contract itself 9\. Approves the UsualXLockup contract to transfer the newly minted shares from the UsualX contract 10\. Calls the lock function on the UsualXLockup contract to lock the shares for the specified duration, with the receiver as the beneficiary. 11\. Returns the number of shares that were minted and locked #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-withdraw) Method: withdraw Overrides the ERC4626 withdraw function to include withdrawal fees and enforce withdrawal limits, calculates shares internally to avoid another storage fetch from calling previewWithdraw. 1-5. Public function overriding the ERC4626 withdraw function. 6-7. Retrieves storage pointers for UsualXStorageV0 and YieldDataStorage. 9-12. Checks if the withdrawal amount exceeds the maximum allowed, and reverts if so. 14-15. Calculates the withdrawal fee based on the number of assets user wants to withdraw taking the precision into account. 1. Converts assets to shares, considering the fee. 2. Deducts the fee from the total deposits in the yield storage. 3. Calls parent withdrawal function with calculated values. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/usualx#method-sweepfees) Method: sweepFees Sweeps accumulated fees to the specified collector address, optionally burning a portion of the fees based on the burn ratio. Enforces non-reentrancy, role-based access control, and validates input. 1\. A public external function marked as `nonReentrant` to prevent reentrancy attacks. 2-3. Retrieves storage pointer for `UsualXStorageV0` and validates that the caller has the `FEE_SWEEPER_ROLE` permission. 5\. Get the Distribution Module contract. 7-10. Get the accumulated fees. Return 0 if no fees. 12\. Reset the `accumulatedFees` variable. 14\. Transfer fees to the Distribution Module contract. 16\. Emits a `FeeSwept` event with the caller address, the distribution module address, and amount of fees swept. [PreviousUSUAL\*chevron-left](https://tech.usual.money/smart-contracts/token-contracts/usual-1) [NextUsual bUSD0 Investment Vaultchevron-right](https://tech.usual.money/smart-contracts/token-contracts/usual-usd0++-investment-vault) Last updated 4 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/usualx#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/usualx#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/token-contracts/usualx#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/usualx#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/token-contracts/usualx#security-analysis) Was this helpful? Copy 1 function initialize( 2 address _registryContract, 3 uint256 _withdrawFeeBps, 4 string memory _name, 5 string memory _symbol, 6 IERC20 _underlying, 7 uint256 _maxPeriodLength 8 ) external initializer { 9 __YieldBearingVault_init(_maxPeriodLength); 10 __ERC4626_init(_underlying); 11 __ERC20_init(_name, _symbol); 12 __Pausable_init_unchained(); 13 __ReentrancyGuard_init(); 14 __EIP712_init_unchained(_name, "1"); 15 16 if (_withdrawFeeBps > MAX_WITHDRAW_FEE) { 17 revert AmountTooBig(); 18 } 19 20 if (_registryContract == address(0)) { 21 revert NullContract(); 22 } 23 24 UsualXStorageV0 storage $ = _usualXStorageV0(); 25 $.withdrawFeeBps = _withdrawFeeBps; 26 $.registryContract = IRegistryContract(_registryContract); 27 $.registryAccess = IRegistryAccess($.registryContract.getContract(CONTRACT_REGISTRY_ACCESS)); 28 } Copy 1 function initializeV1() public reinitializer(2) { 2 UsualXStorageV0 storage $ = _usualXStorageV0(); 3 if (INITIAL_BURN_RATIO_BPS > BASIS_POINT_BASE) { 4 revert AmountTooBig(); 5 } 6 $.burnRatioBps = INITIAL_BURN_RATIO_BPS; 7 $.usualToken = IUsual($.registryContract.getContract(CONTRACT_USUAL)); 8 emit BurnRatioUpdated($.burnRatioBps); 9 } Copy 1 function initializeV2() external reinitializer(3) { 2 UsualXStorageV0 storage $ = _usualXStorageV0(); 3 $.usualXLockup = IUsualXLockup($.registryContract.getContract(CONTRACT_USUALX_LOCKUP)); 4 } Copy 1 function blacklist(address account) external { 2 if (account == address(0)) { 3 revert NullAddress(); 4 } 5 UsualXStorageV0 storage $ = _usualXStorageV0(); 6 $.registryAccess.onlyMatchingRole(DEFAULT_ADMIN_ROLE); 7 if ($.isBlacklisted[account]) { 8 revert SameValue(); 9 } 10 $.isBlacklisted[account] = true; 11 12 emit Blacklist(account); 13 } Copy 1 function _update(address from, address to, uint256 amount) 2 internal 3 override(ERC20Upgradeable) 4 { 5 UsualXStorageV0 storage $ = _usualXStorageV0(); 6 if ($.isBlacklisted[from] || $.isBlacklisted[to]) { 7 revert Blacklisted(); 8 } 9 super._update(from, to, amount); 10 } Copy 1 function transfer(address to, uint256 value) 2 public 3 override(ERC20Upgradeable, IERC20) 4 returns (bool) 5 { 6 address owner = _msgSender(); 7 UsualXStorageV0 storage $ = _usualXStorageV0(); 8 if ($.isWhitelisted[owner]) { 9 _transfer(owner, to, value); 10 return true; 11 } 12 revert NotWhitelisted(); 13 } Copy 1 function startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) 2 external 3 { 4 _requireOnlyAdmin(); 5 _startYieldDistribution(yieldAmount, startTime, endTime); 6 } Copy 1 function depositAndLock(uint256 assets, address receiver, uint256 lockDuration) 2 public 3 override 4 whenNotPaused 5 returns (uint256 shares) 6 { 7 UsualXStorageV0 storage $ = _usualXStorageV0(); 8 shares = deposit(assets, address(this)); 9 _approve(address(this), address($.usualXLockup), shares); 10 $.usualXLockup.lock(receiver, shares, lockDuration); 11 return shares; 12 } Copy 1 function withdraw(uint256 assets, address receiver, address owner) 2 public 3 override 4 returns (uint256 shares) 5 { 6 UsualXStorageV0 storage $ = _usualXStorageV0(); 7 YieldDataStorage storage yieldStorage = _getYieldDataStorage(); 8 9 uint256 maxAssets = maxWithdraw(owner); 10 if (assets > maxAssets) { 11 revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets); 12 } 13 14 uint256 fee = Math.mulDiv(assets, $.withdrawFeeBps, BPS_DENOMINATOR, Math.Rounding.Floor); 15 uint256 assetsWithFee = assets + fee; 16 17 shares = convertToShares(assetsWithFee); 18 19 yieldStorage.totalDeposits -= fee; 20 21 super._withdraw(_msgSender(), receiver, owner, assets, shares); 22 } Copy 1 function sweepFees() external nonReentrant returns (uint256) { 2 UsualXStorageV0 storage $ = _usualXStorageV0(); 3 $.registryAccess.onlyMatchingRole(FEE_SWEEPER_ROLE); 4 5 address distributionModule = $.registryContract.getContract(CONTRACT_DISTRIBUTION_MODULE); 6 7 uint256 feesToSweep = $.accumulatedFees; 8 if (feesToSweep == 0) { 9 return 0; 10 } 11 12 $.accumulatedFees = 0; 13 14 $.usualToken.safeTransfer(distributionModule, feesToSweep); 15 16 emit FeeSwept(msg.sender, distributionModule, feesToSweep); 17 return feesToSweep; 18 } --- # USUALx Lockup Contract | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#high-level-overview) High-Level Overview ------------------------------------------------------------------------------------------------------------------------------------------------ The UsualXLockup contract is an upgradeable vault that enables users to lock their UsualX tokens for predefined durations. It implements a flexible locking mechanism with features such as position creation, top-ups within the same UTC calendar day, and position releases after lock expiration. The contract leverages OpenZeppelin's upgradeable contracts for enhanced security and flexibility, including pausability and reentrancy protection. The primary objective of UsualXLockup is to provide a secure mechanism for users to lock their UsualX tokens, potentially for governance or reward-earning purposes, while maintaining strict control over lock durations and position management. ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#inherited-contracts) Inherited Contracts * **PausableUpgradeable**: Emergency halt capabilities * **ReentrancyGuardUpgradeable**: Reentrancy attack prevention ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#reward-boost-mechanism) Reward Boost Mechanism The contract enables users to lock their UsualX tokens for various durations to receive boosted rewards. Key points: * Boost calculations are performed off-chain * Contract provides only necessary on-chain data through events and state tracking [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#contract-summary) Contract Summary ------------------------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#main-functions) Main Functions * `initialize`: Contract setup with registry contract address * `lock`: New lock position creation * `intraDayTopUp`: Same-day position top-ups * `release`: Token release after lock expiration * `releaseAndLock`: Combined release and lock operations * `unlockUserPosition`: Forced position unlock by privileged roles * `unlockUsersPositionsBatch`: Forced batch position unlocking by privileged roles Storage: * Uses UsualXLockupStorageV0 structure for state variables ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#functionality-breakdown) Functionality Breakdown A. Access Control and Security * Registry contract for role-based access * Position unlocking controls through dedicated roles B. Position Management * Multiple lock positions per user support * Same-day position top-ups * Post-expiration release functionality * Privileged forced unlock capabilities C. Lock Duration Management * Predefined durations (1, 3, 6, and 12 months) * Lock duration validation enforcement ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#method-analysis) Method Analysis #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#public-external-functions) Public/External Functions #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#id-1.-initialize) 1\. Initialize **Purpose**: Contract initialization **Key Features:** * Registry contract validation * Access control setup * Default lock duration enablement Security: * Null address checks * Single initialization enforcement 1. **Lock** **Purpose**: New position creation **Key Features:** * Amount and receiver validation * Lock duration verification * Position creation and event emission * Reentrancy protection * Pause mechanism * Null address checks 1. **IntraDayTopUp** **Purpose:** Same-day position enhancement **Key Features:** * Same-day validation * Position amount update * Event emission * Reentrancy protection * Position existence checks * Active status verification 1. **Release** **Purpose**: Lock expiration token release **Key Features:** * Lock expiration verification * Token transfer * Position status update * Reentrancy protection * Position validation * Active status checks #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#internal-functions) Internal Functions 1. **\_lock** **Purpose**: Core lock position creation **Implementation**: * Lock duration validation * Token transfer handling * Position creation * Total amount tracking * Event emission 1. **\_topUp** **Purpose**: Position top-up logic **Implementation**: * Position validation * Same-day verification * Amount updates * Event emission 1. **\_release** **Purpose**: Token release implementation **Implementation**: * Position validation * Lock expiration check * Token transfer * State updates 1. **\_unlockBatchPositionsForUser** * Range validation * Position processing * Amount accumulation * State updates * Token transfers [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#flow-diagram) Flow Diagram ---------------------------------------------------------------------------------------------------------------------------------- ![](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F5vDW8JrttbBWZXlbdnYc%252FEditor%2520%257C%2520Mermaid%2520Chart-2025-06-13-091129.png%3Falt%3Dmedia%26token%3De0abd991-b8f7-4301-a886-9ed91bf240ca&width=768&dpr=3&quality=100&sign=2d88a143&sv=2) [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#security-considerations) Security Considerations -------------------------------------------------------------------------------------------------------------------------------------------------------- **1\. Access Control** * Role-based permissions * Registry contract integration * Function-level access restrictions **2\. Input Validation** * Address validation * Amount verification * Index range checks **3\. Protection Mechanisms** * Reentrancy guards * Pause functionality * Duration controls [PreviousYield Modulechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usual-distribution/yield-module) [NextToken Contractschevron-right](https://tech.usual.money/smart-contracts/token-contracts) Last updated 10 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#high-level-overview) * [Inherited Contracts](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#inherited-contracts) * [Reward Boost Mechanism](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#reward-boost-mechanism) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#contract-summary) * [Main Functions](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#main-functions) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#functionality-breakdown) * [Method Analysis](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#method-analysis) * [Flow Diagram](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#flow-diagram) * [Security Considerations](https://tech.usual.money/smart-contracts/protocol-contracts/usual/usualx-lockup-contract#security-considerations) Was this helpful? Copy function initialize(address registryContract) external initializer { if (registryContract == address(0)) { revert NullAddress(); } UsualXLockupStorageV0 storage $ = _usualXLockupStorageV0(); $.registryContract = IRegistryContract(registryContract); $.registryAccess = IRegistryAccess($.registryContract.getContract(CONTRACT_REGISTRY_ACCESS)); $.usualX = IERC20($.registryContract.getContract(CONTRACT_USUALX)); $.lockDurations[ONE_MONTH] = true; $.lockDurations[THREE_MONTHS] = true; $.lockDurations[SIX_MONTHS] = true; $.lockDurations[ONE_YEAR] = true; } Copy function lock(address receiver, uint256 amount, uint256 lockDuration) external nonReentrant whenNotPaused { if (receiver == address(0)) { revert NullAddress(); } if (amount == 0) { revert AmountIsZero(); } UsualXLockupStorageV0 storage $ = _usualXLockupStorageV0(); _lock($, msg.sender, receiver, amount, lockDuration); } Copy function intraDayTopUp(address receiver, uint256 amount, uint256 positionIndex) external nonReentrant whenNotPaused { if (receiver == address(0)) { revert NullAddress(); } if (amount == 0) { revert AmountIsZero(); } UsualXLockupStorageV0 storage $ = _usualXLockupStorageV0(); _topUp($, msg.sender, receiver, amount, positionIndex); } Copy function release(address user, uint256 positionIndex) external nonReentrant whenNotPaused { if (user == address(0)) { revert NullAddress(); } UsualXLockupStorageV0 storage $ = _usualXLockupStorageV0(); _release($, user, positionIndex); } Copy function _lock( UsualXLockupStorageV0 storage $, address sender, address receiver, uint256 amount, uint256 lockDuration ) internal { if ($.lockDurations[lockDuration] == false) { revert LockDurationIsNotEnabled(); } $.usualX.safeTransferFrom(sender, address(this), amount); LockPosition memory lockPosition = LockPosition({ amount: amount, startTime: block.timestamp, endTime: block.timestamp + lockDuration, isActive: true }); $.userLockPositions[receiver].push(lockPosition); $.userLockedAmount[receiver] += amount; emit PositionCreated( receiver, $.userLockPositions[receiver].length - 1, lockPosition.amount, lockPosition.startTime, lockPosition.endTime ); } Copy function _topUp( UsualXLockupStorageV0 storage $, address sender, address receiver, uint256 amount, uint256 positionIndex ) internal { if (positionIndex >= $.userLockPositions[receiver].length) { revert PositionDoesNotExist(); } LockPosition storage lockPosition = $.userLockPositions[receiver][positionIndex]; if (!lockPosition.isActive) { revert PositionIsNotActive(); } // Check if current time is within the same UTC calendar day as start time uint256 startDay = lockPosition.startTime / ONE_DAY; uint256 currentDay = block.timestamp / ONE_DAY; if (currentDay > startDay) { revert TopUpDelayHasPassed(); } $.usualX.safeTransferFrom(sender, address(this), amount); lockPosition.amount += amount; $.userLockedAmount[receiver] += amount; emit PositionToppedUp( receiver, positionIndex, amount, lockPosition.amount, lockPosition.startTime, lockPosition.endTime ); } Copy function _release(UsualXLockupStorageV0 storage $, address user, uint256 positionIndex) internal { if (positionIndex >= $.userLockPositions[user].length) { revert PositionDoesNotExist(); } LockPosition storage lockPosition = $.userLockPositions[user][positionIndex]; if (!lockPosition.isActive) { revert PositionIsNotActive(); } if (block.timestamp < lockPosition.endTime) { revert PositionIsStillLocked(); } uint256 positionAmount = lockPosition.amount; lockPosition.isActive = false; $.userLockedAmount[user] -= positionAmount; $.usualX.safeTransfer(user, positionAmount); emit PositionReleased(user, positionIndex, positionAmount); } Copy function _unlockBatchPositionsForUser( UsualXLockupStorageV0 storage $, address user, uint256 startIndex, uint256 endIndex ) private returns (uint256[] memory) { if (user == address(0)) { revert NullAddress(); } if (startIndex > endIndex) { revert StartIndexGreaterThanEndIndex(); } if (endIndex > $.userLockPositions[user].length) { revert PositionDoesNotExist(); } uint256 totalAmount = 0; uint256[] memory unlockedIndexes = new uint256[](endIndex - startIndex + 1); uint256 unlockedCount = 0; for (uint256 j = startIndex; j <= endIndex; j++) { LockPosition storage lockPosition = $.userLockPositions[user][j]; if (!lockPosition.isActive) { continue; } lockPosition.isActive = false; totalAmount += lockPosition.amount; unlockedIndexes[unlockedCount] = j; unlockedCount++; } // Optimize array length using assembly // solhint-disable-next-line no-inline-assembly assembly { mstore(unlockedIndexes, unlockedCount) } // Update the user's locked amount and transfer the assets $.userLockedAmount[user] -= totalAmount; $.usualX.safeTransfer(user, totalAmount); return unlockedIndexes; }Purpose: Batch position unlocking Implementation: --- # sEUR0 | Usual Tech Docs ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#high-level-overview) High-Level Overview The sEUR0 contract is an upgradeable ERC4626-compliant yield-bearing vault. It extends the YieldBearingVault contract, incorporating features such as blacklisting, withdrawal fees, and yield distribution linearly over a predefined yield period. The contract leverages OpenZeppelin's upgradeable contracts for enhanced security and flexibility, including pausability and reentrancy protection. It also implements EIP712 for secure off-chain signing capabilities. The primary objective of sEUR0 is to provide a secure, controllable environment for yield generation and distribution on EUR0 deposits, while maintaining strict control over who can interact with the contract. This design allows for potential regulatory compliance and risk management in decentralized finance applications. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#contract-summary) Contract Summary The contract provides the following main functions: * **initialize**: Sets up the contract with customizable parameters, including initial shares minting. * **pause / unpause**: Controls the operational state of the contract. * **blacklist / unBlacklist**: Manages addresses prohibited from interacting with the contract. * **startYieldDistribution**: Initiates a new yield accrual period with specified parameters. * **deposit / mint**: Handles asset deposits and share minting. * **depositWithPermit**: Enables gasless deposits using permit functionality. * **withdraw / redeem**: Handles asset withdrawals and share redemptions, incorporating withdrawal fees that are immediately transferred to the treasury yield contract. * **previewWithdraw / previewRedeem**: Simulates withdrawal and redemption operations for users. * **updateWithdrawFee**: Updates the withdrawal fee rate with proper access control. The contract uses a separate storage structure (SEur0StorageV0) to store state variables for sEUR0 implementation. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#inherited-contracts) Inherited Contracts * **YieldBearingVault**: Provides core yield accrual and distribution mechanisms. * **PausableUpgradeable**: Enables emergency halt of contract operations. * **ReentrancyGuardUpgradeable**: Prevents reentrancy attacks in critical functions. * **EIP712Upgradeable**: Implements EIP712 for secure off-chain message signing. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#functionality-breakdown) Functionality Breakdown **Access Control and Security:** * Utilizes a registry contract for role-based access control. * Implements blacklist to prevent specific addresses from interacting with the contract. * Enforces pause mechanism for emergency situations. * Uses role-based permissions for administrative functions. **Yield Management:** * Allows admin-controlled yield distribution periods via SEUR0\_YIELD\_DISTRIBUTOR\_ROLE. * Accrues yield over time based on configurable parameters. * Integrates yield accrual with deposit and withdrawal operations. **Asset Management:** * Implements ERC4626 standard for standardized vault interactions. * Handles deposits, withdrawals, and redemptions with consideration for accrued yield. * Applies withdrawal fees, immediately transferring them to the treasury yield contract for protocol revenue. * Mints initial "dead" shares during initialization to support early yield distribution. **Upgradability and Pause Mechanism:** * Utilizes OpenZeppelin's upgradeable contract pattern for future improvements. * Includes pause functionality for emergency situations with separate roles for pausing and unpausing. ### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#security-analysis) Security Analysis #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-initialize) Method: initialize Initializes the vault, token, yield module, EIP712 domain, registry contract and access control, setting up the vault's initial state. 1-3. Set the registry contract, withdrawal fee in BPS, and initial shares to mint. 4-6. Validates registry contract is not zero address, reverts if zero address. 7. Load the contract storage. 8. Retrieves the EUR0 token address from the registry contract. 9-12. Initializes inherited contracts, with initializer parameters including vault name and symbol from constants. 14-16. Validates withdrawal fee is below 25% preventing excessive fees that could harm users. 18-20. Validates initialShares is not zero, ensuring vault starts with a valid state. 22-24. Sets up contract storage with registry access retrieved from the registry contract. 25-26. Stores withdrawal fee and EUR0 token reference. 27. Retrieves and stores the treasury yield contract address from the registry. 29-31. Initializes yield storage with initial shares and mints them to the contract itself, creating "dead" shares that allow for early yield distribution before user deposits. 33. Emits an event with the new withdrawal fee. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-pause) Method: pause Pauses the contract operations, preventing most function calls until unpaused. 1. External function to pause the contract. 2. Retrieves storage pointer for SEur0StorageV0. 3. Ensures only addresses with PAUSING\_CONTRACTS\_ROLE set on registry access can call this function. 4. Calls the internal pause function from PausableUpgradeable. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-unpause) Method: unpause Unpauses the contract operations, allowing normal function calls to resume. 1. External function to unpause the contract. 2. Retrieves storage pointer for SEur0StorageV0. 3. Ensures only addresses with UNPAUSING\_CONTRACTS\_ROLE set on registry access can call this function. 4. Calls the internal unpause function from PausableUpgradeable. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-blacklist) Method: blacklist Adds an address to the blacklist, preventing it from interacting with the contract. 1. Mark function as external to save gas. 2-4. Prevents blacklisting of zero address, and reverts if trying to pass zero address. 5-6. Utilizes the registry for role-based access control, restricting to BLACKLIST\_ROLE. 7-9. Reverts if the account is already blacklisted. 2. Adds the account to the blacklist in SEur0StorageV0. 3. Emits an event to log the blacklisting action. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-unblacklist) Method: unBlacklist Removes an address from the blacklist, allowing it to interact with the contract again. 1. External function to remove an address from the blacklist. 2. Retrieves storage pointer for SEur0StorageV0. 3. Ensures only addresses with BLACKLIST\_ROLE set on registry access can call this function. 4-6. Reverts if the account is not currently blacklisted. 4. Removes the account from the blacklist. 5. Emits an event to log the unblacklisting action. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-_update) Method: \_update Internal hook ensuring that both sender and receiver are not blacklisted before updating the token balances. 1-4. Internal function overriding the base ERC20Upgradeable implementation, includes whenNotPaused modifier to prevent transfers when contract is paused. 5. Retrieves storage pointer for SEur0StorageV0. 6-8. Checks both sender and receiver against blacklist, reverting if either is blacklisted. 9. Passes through to parent implementation if checks pass. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-startyielddistribution) Method: startYieldDistribution Initiates a new yield distribution period with specified parameters, wrapping the internal call to add proper access control. 1-3. External function for starting a new yield period. 4-5. Ensures only addresses with SEUR0\_YIELD\_DISTRIBUTOR\_ROLE set on registry access can call this function. 6. Delegates to internal function for yield distribution logic. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-_startyielddistribution) Method: \_startYieldDistribution Internal function to start the yield distribution with validation checks. 1-4. Internal function overriding the base YieldBearingVault implementation. 5. Gets reference to the underlying asset (EUR0). 7-9. Validates yield amount is not zero. 10-12. Validates start time is in the future. 13-15. Validates end time is after start time. 17. Retrieves yield data storage. 19-21. Validates new period starts after the current period finishes. 22-24. Validates current time is after the current period finishes (prevents overlapping periods). 25. Updates yield state to account for any accrued yield before starting new period. 27-28. Calculates the yield rate per second using floor rounding to ensure conservative estimates. 30-32. Validates contract has sufficient assets (deposits + yield amount) to support the yield distribution. 34-37. Sets the new yield period parameters and activates yield distribution. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-deposit) Method: deposit Allows users to deposit assets and receive shares in return. 1-6. Public function overriding the ERC4626 deposit function, protected by whenNotPaused modifier. 7. Delegates to parent implementation which handles share calculation and minting. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-mint) Method: mint Allows users to mint shares by depositing the equivalent amount of assets. 1-6. Public function overriding the ERC4626 mint function, protected by whenNotPaused modifier. 7. Delegates to parent implementation which handles asset deposit and share minting. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-depositwithpermit) Method: depositWithPermit Enables users to deposit assets using permit functionality, allowing gasless approvals. 1-8. Public function marked as nonReentrant and whenNotPaused to prevent reentrancy and ensure contract is active. 9. Attempts to execute permit signature to approve the contract to spend user's assets. If permit fails (e.g., token doesn't support permit), continues execution assuming approval already exists. 11. Calls the standard deposit function with the approved assets. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-withdraw) Method: withdraw Overrides the ERC4626 withdraw function to include withdrawal fees and enforce withdrawal limits. Fees are immediately transferred to the treasury yield contract. 1-7. Public function overriding the ERC4626 withdraw function, protected by nonReentrant and whenNotPaused modifiers. 8-9. Retrieves storage pointers for SEur0StorageV0 and YieldDataStorage. 10-14. Checks if the withdrawal amount exceeds the maximum allowed (accounting for fees), and reverts if so. 16. Calculates shares needed using previewWithdraw which accounts for fees. 17-20. Calculates the withdrawal fee based on the assets being withdrawn. Uses ceiling rounding to ensure fees are not undercharged. The formula accounts for the fee being taken from assets beyond what the user receives. 22. Calls parent withdrawal function with calculated values, which handles share burning and asset transfer to receiver. 23-24. Deducts the fee from total deposits and immediately transfers the fee to the treasury yield contract. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-redeem) Method: redeem Overrides the ERC4626 redeem function to include redemption fees and enforce redemption limits. Fees are immediately transferred to the treasury yield contract. 1-7. Public function overriding the ERC4626 redeem function, protected by nonReentrant and whenNotPaused modifiers. 8-9. Retrieves storage pointers for SEur0StorageV0 and YieldDataStorage. 11-14. Checks if the redemption amount exceeds the maximum allowed, and reverts if so. 16-18. Calculates assets the user will receive (after fee) and the total assets represented by the shares (before fee). The difference is the fee amount. 20. Calls parent withdrawal function which handles share burning and asset transfer to receiver. 22-23. Deducts the fee from total deposits and immediately transfers the fee to the treasury yield contract. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-previewwithdraw) Method: previewWithdraw Calculates the number of shares required to withdraw a given amount of assets, accounting for withdrawal fees. 1-5. Public view function overriding ERC4626 previewWithdraw. 6. Retrieves storage pointer for SEur0StorageV0. 7-10. Calculates the fee amount based on the assets being withdrawn. Uses ceiling rounding to ensure conservative estimates. The formula accounts for the fee being a percentage of the total assets needed. 11-12. Calculates total assets needed including the fee. 13. Converts the total assets (including fee) to shares using ceiling rounding. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-maxwithdraw) Method: maxWithdraw Returns the maximum amount of assets that can be withdrawn by a given owner, accounting for fees. 1-5. Public view function overriding ERC4626 maxWithdraw. 6. Calculates the maximum withdrawable assets by previewing the redemption of all shares owned by the owner, which automatically accounts for fees. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-previewredeem) Method: previewRedeem Calculates the amount of assets that would be received for redeeming a given number of shares, accounting for redemption fees. 1-5. Public view function overriding ERC4626 previewRedeem. 6. Retrieves storage pointer for SEur0StorageV0. 7-8. Calculates the raw amount of assets represented by the shares (before fee deduction). 10-11. Calculates the fee portion using ceiling rounding to ensure conservative estimates. 12. Subtracts the fee from the total assets to get the net assets the user will receive. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-updatewithdrawfee) Method: updateWithdrawFee Updates the withdrawal fee rate with proper access control and validation. 1. External function for updating withdrawal fee. 2-3. Retrieves storage pointer and validates caller has SEUR0\_WITHDRAW\_FEE\_UPDATER\_ROLE. 5-7. Validates new fee is below 25% maximum, preventing excessive fees. 9-11. Validates new fee is different from current fee, preventing unnecessary updates. 2. Updates the withdrawal fee in storage. 3. Emits an event to log the fee update. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-isblacklisted) Method: isBlacklisted Checks if an address is currently blacklisted. 1. External view function to check blacklist status. 2. Retrieves storage pointer for SEur0StorageV0. 3. Returns the blacklist status for the given account. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-withdrawfeebps) Method: withdrawFeeBps Returns the current withdrawal fee in basis points. 1. Public view function to retrieve withdrawal fee. 2. Retrieves storage pointer for SEur0StorageV0. 3. Returns the current withdrawal fee in basis points. #### [hashtag](https://tech.usual.money/smart-contracts/token-contracts/seur0#method-getyieldrate) Method: getYieldRate Returns the current yield rate used for yield distribution. 1. External view function to retrieve yield rate. 2. Retrieves yield data storage. 3. Returns the current yield rate value. [PrevioussUSD0chevron-left](https://tech.usual.money/smart-contracts/token-contracts/susd0) [NextUtility Contractschevron-right](https://tech.usual.money/smart-contracts/utility-contracts) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/token-contracts/seur0#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/token-contracts/seur0#contract-summary) * [Inherited Contracts](https://tech.usual.money/smart-contracts/token-contracts/seur0#inherited-contracts) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/token-contracts/seur0#functionality-breakdown) * [Security Analysis](https://tech.usual.money/smart-contracts/token-contracts/seur0#security-analysis) Was this helpful? Copy function initialize(address _registryContract, uint256 _withdrawFeeBps, uint256 initialShares) external initializer { if (_registryContract == address(0)) { revert NullContract(); } SEur0StorageV0 storage $ = _seur0StorageV0(); address _underlyingToken = IRegistryContract(_registryContract).getContract(CONTRACT_EUR0); __YieldBearingVault_init(_underlyingToken, SEUR0Name, SEUR0Symbol); __Pausable_init_unchained(); __ReentrancyGuard_init(); __EIP712_init_unchained(SEUR0Name, "1"); if (_withdrawFeeBps > MAX_25_PERCENT_WITHDRAW_FEE) { revert AmountTooBig(); } if (initialShares == 0) { revert AmountIsZero(); } $.registryAccess = IRegistryAccess( IRegistryContract(_registryContract).getContract(CONTRACT_REGISTRY_ACCESS) ); $.withdrawFeeBps = _withdrawFeeBps; $.eur0Token = IEur0(_underlyingToken); $.treasuryYield = IRegistryContract(_registryContract).getContract(CONTRACT_YIELD_TREASURY); YieldDataStorage storage y = _getYieldDataStorage(); // mint dead shares to the vault y.totalDeposits = initialShares; _mint(address(this), initialShares); emit WithdrawFeeUpdated(_withdrawFeeBps); } Copy function pause() external { SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(PAUSING_CONTRACTS_ROLE); _pause(); } Copy function unpause() external { SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(UNPAUSING_CONTRACTS_ROLE); _unpause(); } Copy function blacklist(address account) external { if (account == address(0)) { revert NullAddress(); } SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(BLACKLIST_ROLE); if ($.isBlacklisted[account]) { revert SameValue(); } $.isBlacklisted[account] = true; emit Blacklist(account); } Copy function unBlacklist(address account) external { SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(BLACKLIST_ROLE); if (!$.isBlacklisted[account]) { revert SameValue(); } $.isBlacklisted[account] = false; emit UnBlacklist(account); } Copy function _update(address from, address to, uint256 amount) internal override(ERC20Upgradeable) whenNotPaused { SEur0StorageV0 storage $ = _seur0StorageV0(); if ($.isBlacklisted[from] || $.isBlacklisted[to]) { revert Blacklisted(); } super._update(from, to, amount); } Copy function startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) external { SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(SEUR0_YIELD_DISTRIBUTOR_ROLE); _startYieldDistribution(yieldAmount, startTime, endTime); } Copy function _startYieldDistribution(uint256 yieldAmount, uint256 startTime, uint256 endTime) internal override { IERC20 _asset = IERC20(asset()); if (yieldAmount == 0) { revert ZeroYieldAmount(); } if (startTime < block.timestamp) { revert StartTimeNotInFuture(); } if (endTime <= startTime) { revert EndTimeNotAfterStartTime(); } YieldDataStorage storage $ = _getYieldDataStorage(); if (startTime < $.periodFinish) { revert StartTimeBeforePeriodFinish(); } if (block.timestamp < $.periodFinish) { revert CurrentTimeBeforePeriodFinish(); } _updateYield(); uint256 periodDuration = endTime - startTime; uint256 newYieldRate = Math.mulDiv(yieldAmount, YIELD_PRECISION, periodDuration, Math.Rounding.Floor); if (_asset.balanceOf(address(this)) < $.totalDeposits + yieldAmount) { revert InsufficientAssetsForYield(); } $.yieldRate = newYieldRate; $.periodStart = startTime; $.periodFinish = endTime; $.lastUpdateTime = startTime; $.isActive = true; } Copy function deposit(uint256 assets, address receiver) public override(ERC4626Upgradeable, ISEur0) whenNotPaused returns (uint256 shares) { return super.deposit(assets, receiver); } Copy function mint(uint256 shares, address receiver) public override(ERC4626Upgradeable, ISEur0) whenNotPaused returns (uint256) { return super.mint(shares, receiver); } Copy function depositWithPermit( uint256 assets, address receiver, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public nonReentrant whenNotPaused returns (uint256 shares) { try IERC20Permit(asset()).permit(msg.sender, address(this), assets, deadline, v, r, s) {} // solhint-disable-line no-empty-blocks catch {} // solhint-disable-line no-empty-blocks return deposit(assets, receiver); } Copy function withdraw(uint256 assets, address receiver, address owner) public override(ERC4626Upgradeable, ISEur0) nonReentrant whenNotPaused returns (uint256 shares) { SEur0StorageV0 storage $ = _seur0StorageV0(); YieldDataStorage storage yieldStorage = _getYieldDataStorage(); // Check withdrawal limit uint256 maxAssets = maxWithdraw(owner); // maxAssets take into account the fee if (assets > maxAssets) { revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets); } shares = previewWithdraw(assets); // we need to add the fee on the assets to know exactly the shares to burn // assets is 100% - fee% of the total assets uint256 fee = Math.mulDiv( assets, $.withdrawFeeBps, BASIS_POINT_BASE - $.withdrawFeeBps, Math.Rounding.Ceil ); // Perform withdrawal (exact assets to receiver) super._withdraw(_msgSender(), receiver, owner, assets, shares); // take the fee yieldStorage.totalDeposits -= fee; $.eur0Token.safeTransfer($.treasuryYield, fee); } Copy function redeem(uint256 shares, address receiver, address owner) public override(ERC4626Upgradeable, ISEur0) nonReentrant whenNotPaused returns (uint256 assets) { SEur0StorageV0 storage $ = _seur0StorageV0(); YieldDataStorage storage yieldStorage = _getYieldDataStorage(); // Check redemption limit uint256 maxShares = maxRedeem(owner); if (shares > maxShares) { revert ERC4626ExceededMaxRedeem(owner, shares, maxShares); } // Calculate assets after fee assets = previewRedeem(shares); uint256 assetsWithFee = convertToAssets(shares); uint256 fee = assetsWithFee - assets; // Perform redemption super._withdraw(_msgSender(), receiver, owner, assets, shares); // take the fee yieldStorage.totalDeposits -= fee; $.eur0Token.safeTransfer($.treasuryYield, fee); } Copy function previewWithdraw(uint256 assets) public view override(ERC4626Upgradeable, ISEur0) returns (uint256 shares) { SEur0StorageV0 storage $ = _seur0StorageV0(); // Calculate the fee based on the equivalent assets of these shares uint256 fee = Math.mulDiv( assets, $.withdrawFeeBps, BASIS_POINT_BASE - $.withdrawFeeBps, Math.Rounding.Ceil ); // Calculate total assets needed, including fee uint256 assetsWithFee = assets + fee; // Convert the total assets (including fee) to shares shares = _convertToShares(assetsWithFee, Math.Rounding.Ceil); } Copy function maxWithdraw(address owner) public view override(ERC4626Upgradeable, ISEur0) returns (uint256) { return previewRedeem(balanceOf(owner)); } Copy function previewRedeem(uint256 shares) public view override(ERC4626Upgradeable, ISEur0) returns (uint256 assets) { SEur0StorageV0 storage $ = _seur0StorageV0(); // Calculate the raw amount of assets for the given shares uint256 assetsWithFee = convertToAssets(shares); // Calculates the fee part of an amount `assets` that already includes fees. uint256 fee = Math.mulDiv(assetsWithFee, $.withdrawFeeBps, BASIS_POINT_BASE, Math.Rounding.Ceil); assets = assetsWithFee - fee; } Copy function updateWithdrawFee(uint256 newWithdrawFeeBps) external { SEur0StorageV0 storage $ = _seur0StorageV0(); $.registryAccess.onlyMatchingRole(SEUR0_WITHDRAW_FEE_UPDATER_ROLE); if (newWithdrawFeeBps > MAX_25_PERCENT_WITHDRAW_FEE) { revert AmountTooBig(); } if (newWithdrawFeeBps == $.withdrawFeeBps) { revert SameValue(); } $.withdrawFeeBps = newWithdrawFeeBps; emit WithdrawFeeUpdated(newWithdrawFeeBps); } Copy function isBlacklisted(address account) external view returns (bool) { SEur0StorageV0 storage $ = _seur0StorageV0(); return $.isBlacklisted[account]; } Copy function withdrawFeeBps() public view returns (uint256) { SEur0StorageV0 storage $ = _seur0StorageV0(); return $.withdrawFeeBps; } Copy function getYieldRate() external view returns (uint256) { YieldDataStorage storage $ = _getYieldDataStorage(); return $.yieldRate; } --- # USD0 Revenue Distribution Module | Usual Tech Docs [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#high-level-overview) High-Level Overview --------------------------------------------------------------------------------------------------------------------------------------------------------- This contract manages the automated minting and distribution of USD0 tokens to three dedicated distribution buckets. The contract enables multipurpose revenue distribution with three fixed buckets: Revenue Switch, Accruing Deposit Token (Accruing DT), and Rebasing Deposit Token (Rebasing DT). Each bucket operates independently with its own frequency, mint caps, pause mechanisms, and access control. The core features of this contract include: **Daily Accruing Deposit Token Distribution**: The contract should be called daily to calculate and mint USD0 tokens into the accruing deposit token vault (SUSD0/UsualS). The amount to mint is automatically calculated based on the vault's total assets and a configurable daily accruing yield rate. After minting, a yield distribution period is started in the vault to distribute the minted tokens over the next 24 hours. **Daily Rebasing Deposit Token Distribution**: The contract should be called daily to mint a specified amount of USD0 tokens into the rebasing deposit token rewards claim contract. The amount is determined off-chain and provided as a parameter, typically based on an updated Merkle root calculated off-chain. **Weekly Revenue Switch Distribution**: The contract should be called weekly to receive and mint USD0 rewards from the DAO into the revenue switch rewards claim contract. The amount is determined by the DAO and provided as a parameter when calling the function. **Mint Cap Management**: The contract maintains a global operator mint cap that restricts the total amount of USD0 that can be minted through Revenue Switch and Rebasing DT distributions. Accruing DT distribution does not consume from the operator mint cap. Each bucket also has its own maximum mint cap per distribution period. **Granular Pause Mechanisms**: Each distribution bucket can be paused independently, allowing for selective disabling of specific distribution channels without affecting others. **Access Control**: Each functionality is controlled by a role with minimal required permissions, ensuring secure and restricted access to sensitive operations. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#contract-summary) Contract Summary --------------------------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#inherited-contracts) Inherited Contracts **PausableUpgradeable**: Allows contract execution to be paused or unpaused by authorized roles. Provides both global pause functionality and per-bucket pause mechanisms. **IRevenueDistributionModule**: Interface that defines all functions that can be called by anyone (view functions) and role-restricted functions for revenue distribution operations. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#storage-structure) Storage Structure The contract uses ERC-7201 namespaced storage with the following key state variables: * **operatorMintCap**: Maximum amount of USD0 that can be minted globally (applies to Revenue Switch and Rebasing DT) * **lastRevenueSwitchDistribution**: Timestamp of last Revenue Switch distribution * **lastAccruingDTDistribution**: Timestamp of last Accruing DT distribution * **lastRebasingDTDistribution**: Timestamp of last Rebasing DT distribution * **dailyAccruingYieldRate**: Daily accruing yield rate in micro basis points (1 = 0.0001%) * **maxRevSwitchMintCap**: Maximum amount per weekly Revenue Switch distribution * **maxAccruingMintCap**: Maximum amount per daily Accruing DT distribution * **maxRebasingDTMintCap**: Maximum amount per daily Rebasing DT distribution * **rewardClaimForRevenueSwitch**: Address of reward claim contract for Revenue Switch * **rewardClaimForAccruingDT**: Address of SUSD0 vault for Accruing DT (implements ISUsd0) * **rewardClaimForRebasingDT**: Address of reward claim contract for Rebasing DT * **revenueSwitchDistributionPaused**: Boolean flag for Revenue Switch pause state * **accruingDTDistributionPaused**: Boolean flag for Accruing DT pause state * **rebasingDTDistributionPaused**: Boolean flag for Rebasing DT pause state [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#functionality-description) Functionality Description --------------------------------------------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#publicexternal-functions) Public/External Functions **Initialization** **initialize**: Initializes the contract with the registry address, reward claim contract addresses, and initial parameter values. Sets up all three distribution buckets with their initial timestamps. Can only be called once during contract deployment. **IRevenueDistributionModule - Distribution Functions** **distributeRevenueSwitch**: * Distributes USD0 tokens to the Revenue Switch bucket (weekly) * Requires `OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE` * Validates that at least one week has passed since last distribution * Validates amount against maxRevSwitchMintCap and operatorMintCap * Reduces operatorMintCap by the distributed amount * Mints USD0 directly to rewardClaimForRevenueSwitch * Can only be called when Revenue Switch distribution is not paused **distributeAccruingDT**: * Distributes USD0 tokens to the Accruing DT bucket (daily) * Requires `OPERATOR_ACC_DT_DISTRIBUTOR_ROLE` * Automatically calculates the amount to distribute based on: * `rewardClaimForAccruingDT.totalAssets() * dailyAccruingYieldRate / BASIS_MILLION_POINT_BASE` * Validates that at least one day has passed since last distribution * Validates calculated amount against maxAccruingMintCap * Does not consume from operatorMintCap (unlike other distributions) * Mints USD0 directly to rewardClaimForAccruingDT vault * Starts a yield distribution period in the vault using `startYieldDistribution` * The yield distribution period spans from current timestamp to current timestamp + ONE\_DAY * Can only be called when Accruing DT distribution is not paused **distributeRebasingDT**: * Distributes USD0 tokens to the Rebasing DT bucket (daily) * Requires `OPERATOR_REB_DT_DISTRIBUTOR_ROLE` * Takes amount as parameter (typically calculated off-chain from Merkle root) * Validates that at least one day has passed since last distribution * Validates amount against maxRebasingDTMintCap and operatorMintCap * Reduces operatorMintCap by the distributed amount * Mints USD0 directly to rewardClaimForRebasingDT * Can only be called when Rebasing DT distribution is not paused **IRevenueDistributionModule - Configuration Functions (OPERATOR\_ADMIN\_ROLE)** **setDailyAccruingYieldRate**: Sets the daily accruing yield rate used for calculating Accruing DT distribution amounts. Rate is in micro basis points (1 = 0.0001%), must be between 0 and BASIS\_MILLION\_POINT\_BASE. **setOperatorMintCap**: Sets the global operator mint cap that limits total USD0 minting through Revenue Switch and Rebasing DT distributions. **setMaxRevSwitchMintCap**: Sets the maximum amount of USD0 that can be minted per weekly Revenue Switch distribution. **setMaxAccruingMintCap**: Sets the maximum amount of USD0 that can be minted per daily Accruing DT distribution. **setMaxRebasingDTMintCap**: Sets the maximum amount of USD0 that can be minted per daily Rebasing DT distribution. **setRewardClaimForRevenueSwitch**: Updates the reward claim contract address for Revenue Switch. **setRewardClaimForAccruingDT**: Updates the reward claim contract address for Accruing DT. Must implement ISUsd0 interface. **setRewardClaimForRebasingDT**: Updates the reward claim contract address for Rebasing DT. **IRevenueDistributionModule - View Functions** **getOperatorMintCap**: Returns the current operator mint cap value. **getDailyAccruingYieldRate**: Returns the current daily accruing yield rate in micro basis points. **getRewardClaimContractForRevenueSwitch**: Returns the reward claim contract address for Revenue Switch. **getRewardClaimContractForAccruingDT**: Returns the reward claim contract address for Accruing DT. **getRewardClaimContractForRebasingDT**: Returns the reward claim contract address for Rebasing DT. **getMaxRevSwitchMintCap**: Returns the maximum amount of USD0 that can be minted per weekly Revenue Switch distribution. **getMaxAccruingMintCap**: Returns the maximum amount of USD0 that can be minted per daily Accruing DT distribution. **getMaxRebasingDTMintCap**: Returns the maximum amount of USD0 that can be minted per daily Rebasing DT distribution. **isRevenueSwitchDistributionPaused**: Returns whether Revenue Switch distribution is currently paused. **isAccruingDTDistributionPaused**: Returns whether Accruing DT distribution is currently paused. **isRebasingDTDistributionPaused**: Returns whether Rebasing DT distribution is currently paused. **IRevenueDistributionModule - Pause Functions** **pause**: Pauses all contract operations. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpause**: Unpauses all contract operations. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseRevenueSwitchDistribution**: Pauses only Revenue Switch distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseRevenueSwitchDistribution**: Unpauses Revenue Switch distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseAccruingDTDistribution**: Pauses only Accruing DT distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseAccruingDTDistribution**: Unpauses Accruing DT distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. **pauseRebasingDTDistribution**: Pauses only Rebasing DT distribution. Can only be called by `PAUSING_CONTRACTS_ROLE`. **unpauseRebasingDTDistribution**: Unpauses Rebasing DT distribution. Can only be called by `UNPAUSING_CONTRACTS_ROLE`. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#functionality-breakdown) Functionality Breakdown ----------------------------------------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#setting-up-calculation-parameters) Setting up Calculation Parameters `OPERATOR_ADMIN_ROLE` can change all parameter values used in distribution calculations: * Daily accruing yield rate (used in Accruing DT amount calculation) * Operator mint cap (global limit for Revenue Switch and Rebasing DT) * Individual bucket maximum mint caps There is no timelock for these changes, allowing for rapid response to market conditions or protocol needs. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#daily-accruing-deposit-token-distribution) Daily Accruing Deposit Token Distribution `OPERATOR_ACC_DT_DISTRIBUTOR_ROLE` is required to call `distributeAccruingDT` every 24 hours to: 1. Query the total assets value from the accruing deposit token vault (SUSD0) 2. Calculate the distribution amount: `totalAssets * dailyAccruingYieldRate / BASIS_MILLION_POINT_BASE` 3. Validate the calculated amount against maxAccruingMintCap 4. Mint the calculated amount of USD0 directly to the SUSD0 vault 5. Start a yield distribution period in the vault that distributes the minted tokens over the next 24 hours **Note**: This distribution does not consume from the operator mint cap, as it is calculated based on vault assets rather than being an arbitrary amount set by an operator. The amount distributed scales based on the vault's total assets, ensuring that as more users deposit into the vault, more yield is distributed proportionally. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#daily-rebasing-deposit-token-distribution) Daily Rebasing Deposit Token Distribution `OPERATOR_REB_DT_DISTRIBUTOR_ROLE` is required to call `distributeRebasingDT` with a valid amount every 24 hours. The amount is typically calculated off-chain based on an updated Merkle root: 1. Off-chain calculation determines the total USD0 amount to mint for eligible users 2. The amount is provided as a parameter to `distributeRebasingDT` 3. The contract validates the amount against maxRebasingDTMintCap and operatorMintCap 4. If valid, the operatorMintCap is reduced by the amount 5. USD0 is minted directly to the rebasing deposit token rewards claim contract 6. Users can claim their portion using valid Merkle proofs This distribution requires off-chain infrastructure (Watchtower) to calculate the Merkle root and determine the total distribution amount based on eligible users and their assigned allocations. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#weekly-revenue-switch-distribution) Weekly Revenue Switch Distribution `OPERATOR_REVSWITCH_DISTRIBUTOR_ROLE` is required to call `distributeRevenueSwitch` with a valid amount every week. The amount is determined by the DAO: 1. DAO determines the weekly USD0 rewards amount to distribute 2. The amount is provided as a parameter to `distributeRevenueSwitch` 3. The contract validates that at least one week has passed since last distribution 4. The contract validates the amount against maxRevSwitchMintCap and operatorMintCap 5. If valid, the operatorMintCap is reduced by the amount 6. USD0 is minted directly to the revenue switch rewards claim contract This distribution enables the DAO to directly allocate USD0 rewards on a weekly basis, separate from the automated daily distributions. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#mint-cap-management) Mint Cap Management The contract implements a two-tier mint cap system: 1. **Operator Mint Cap**: Global limit for USD0 minting through Revenue Switch and Rebasing DT distributions. This cap is consumed when either of these distributions occurs and can be increased by `OPERATOR_ADMIN_ROLE` if needed. 2. **Per-Bucket Maximum Mint Caps**: Each distribution bucket has its own maximum amount that can be minted per distribution period: * `maxRevSwitchMintCap`: Maximum per weekly Revenue Switch distribution * `maxAccruingMintCap`: Maximum per daily Accruing DT distribution * `maxRebasingDTMintCap`: Maximum per daily Rebasing DT distribution Both the operator mint cap and per-bucket caps must be satisfied for a distribution to proceed (except Accruing DT, which only checks its own cap). #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#granular-pause-mechanisms) Granular Pause Mechanisms The contract supports both global and per-bucket pause functionality: * **Global Pause**: Pauses all contract operations. Can be used in emergencies to halt all distributions. * **Per-Bucket Pause**: Each distribution bucket can be paused independently: * `pauseRevenueSwitchDistribution` / `unpauseRevenueSwitchDistribution` * `pauseAccruingDTDistribution` / `unpauseAccruingDTDistribution` * `pauseRebasingDTDistribution` / `unpauseRebasingDTDistribution` This granular control allows administrators to disable specific distribution channels without affecting others, useful for addressing issues in a single bucket or temporarily suspending specific revenue streams. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#accruing-dt-yield-distribution-period) Accruing DT Yield Distribution Period When `distributeAccruingDT` is called, after minting USD0 to the SUSD0 vault, the contract calls `startYieldDistribution` on the vault with: * `yieldAmount`: The minted USD0 amount * `startTime`: Current block timestamp * `endTime`: Current block timestamp + ONE\_DAY This initiates a yield distribution period in the vault where the minted tokens are distributed over the next 24 hours to vault holders proportionally. The vault's yield-bearing mechanism ensures that shares appreciate in value as yield accrues throughout the day. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#rebasing-dt-merkle-root-integration) Rebasing DT Merkle Root Integration The Rebasing DT distribution relies on off-chain infrastructure (Watchtower) to: 1. Calculate eligible users and their allocations 2. Generate a Merkle root from these allocations 3. Determine the total USD0 amount to mint 4. Provide the amount to `distributeRebasingDT` The actual user claims happen through the rewards claim contract using Merkle proofs, not directly through the Revenue Distribution Module. [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#constants) Constants ------------------------------------------------------------------------------------------------------------------------------------- **OPERATOR\_REVSWITCH\_DISTRIBUTOR\_ROLE**: Role required to distribute USD0 to Revenue Switch bucket (weekly) **OPERATOR\_ACC\_DT\_DISTRIBUTOR\_ROLE**: Role required to distribute USD0 to Accruing DT bucket (daily) **OPERATOR\_REB\_DT\_DISTRIBUTOR\_ROLE**: Role required to distribute USD0 to Rebasing DT bucket (daily) **OPERATOR\_ADMIN\_ROLE**: Role required to set configuration parameters (mint caps, yield rates, reward claim addresses) **PAUSING\_CONTRACTS\_ROLE**: Role required to pause the contract or individual distribution buckets **UNPAUSING\_CONTRACTS\_ROLE**: Role required to unpause the contract or individual distribution buckets **CONTRACT\_REGISTRY\_ACCESS**: Constant used to define the address of the registry access contract **CONTRACT\_USD0**: Constant used to define the address of the USD0 contract **INITIAL\_REVENUE\_DISTRIBUTION\_MINT\_CAP**: Initial value for operator mint cap (50,000 USD0) **ONE\_DAY**: Duration of one day in seconds (86,400 seconds) **ONE\_WEEK**: Duration of one week in seconds (604,800 seconds) **BASIS\_MILLION\_POINT\_BASE**: Base value for calculating percentages in micro basis points (1,000,000, where 1 = 0.0001%) ### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#safeguard-implementation) Safeguard Implementation #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#access-control) Access Control The contract uses `CheckAccessControl` to enforce role-based access control, ensuring only authorized addresses can perform actions that require specific permissions. Each role has minimal required permissions: * Distribution roles can only trigger their specific distribution type * Admin role can only modify configuration parameters * Pausing roles can only pause/unpause functionality #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#pausability) Pausability The contract is pausable at both global and per-bucket levels: * Global pause can halt all operations in emergencies * Per-bucket pause allows selective disabling of specific distribution channels * Separate pausing and unpausing roles prevent unauthorized changes #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#mint-cap-restrictions) Mint Cap Restrictions Multiple layers of mint cap validation prevent excessive minting: 1. Operator mint cap limits total USD0 minting (for Revenue Switch and Rebasing DT) 2. Per-bucket maximum caps limit individual distribution amounts 3. Both caps must be satisfied for distributions to proceed #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#time-based-restrictions) Time-Based Restrictions Distribution functions enforce time-based restrictions to prevent abuse: * Accruing DT can only be distributed once per day * Rebasing DT can only be distributed once per day * Revenue Switch can only be distributed once per week These restrictions prevent operators from rapidly minting excessive amounts and ensure distributions occur at appropriate intervals. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#input-validation) Input Validation All functions validate inputs: * Non-zero addresses for reward claim contracts * Non-zero amounts where applicable * Yield rate bounds (0 to BASIS\_MILLION\_POINT\_BASE) * Same value checks to prevent redundant updates #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#invariant-validation) Invariant Validation The contract maintains system invariants: * Operator mint cap cannot be exceeded (except for Accruing DT which doesn't consume it) * Distribution amounts must respect per-bucket maximum caps * Time restrictions ensure distributions occur at proper intervals * Pause states prevent distributions when buckets are disabled **Note**: In scenarios where overcollateralization invariants are at risk, the contract can be paused or individual buckets can be disabled as a feature flag to protect the system. #### [hashtag](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#restrictions-on-function-call-frequency) Restrictions on Function Call Frequency There are strict time-based limits for distribution functions: * `distributeAccruingDT`: Can only be called once per 24 hours * `distributeRebasingDT`: Can only be called once per 24 hours * `distributeRevenueSwitch`: Can only be called once per week (7 days) These restrictions prevent unwanted emissions and ensure distributions occur at controlled, predictable intervals. The time checks use block timestamps and enforce minimum periods between distributions. [PreviousUSD0 Swapper Enginechevron-left](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-swapper-engine) [NextUSD0achevron-right](https://tech.usual.money/smart-contracts/protocol-contracts/usd0a) Last updated 5 months ago Was this helpful? * [High-Level Overview](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#high-level-overview) * [Contract Summary](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#contract-summary) * [Functionality Description](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#functionality-description) * [Functionality Breakdown](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#functionality-breakdown) * [Constants](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#constants) * [Safeguard Implementation](https://tech.usual.money/smart-contracts/protocol-contracts/usd0/usd0-revenue-distribution-module#safeguard-implementation) Was this helpful? --- # Integrate bUSD0 | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FrO0ehSDpTj0PkMxat1zY%252FDocs%2520similar%2520banner.png%3Falt%3Dmedia%26token%3D7d57f4f5-d825-4349-a157-2418d93eca7e&width=1248&dpr=3&quality=100&sign=8e9da8b7&sv=2) circle-info TL:DR - Integrate bUSD0 in your offering and easily expose your community to USUAL rewards, capitalising at minimum on the underlying RWA yield and potentially much more. Current options to integrate bUSD0 rewards in USUAL are: * [Reward-Redistribution by integration partner](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) * [Claim Address Redirect](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) (if integration partner can't claim the rewards that accumulate on their smart contracts). [hashtag](https://tech.usual.money/integrations#recap-what-is-busd0-formerly-usd0-about) Recap - What is bUSD0 (formerly USD0++) about? -------------------------------------------------------------------------------------------------------------------------------------------- bUSD0 (Bond USD0) represents USD0 stablecoin locked until June 11, 2028. It remains transferable during this period, earning USUAL incentives and maturity yield. Users receive 1 USD0 for 1 bUSD0 at maturity. For early redemption, users need an equivalent amount of rt-USD0 - received at mint - which unlocks bUSD0 back into USD0 at a 1:1 rate anytime. Additionally, early redemption below peg can be made at a DAO set price floor. **Supply: ∞** - each USD0 can be deposited into bUSD0 **Contract standard:** ERC-20 **Reward distribution approach:** **Claim bearing** **For more insights check out:** [bUSD0 (formerly USD0++) Deep divearrow-up-right](https://docs.usual.money/usual-products/usd0-liquid-staking-token) [bUSD0 (formerly USD0++) Smart Contract](https://tech.usual.money/smart-contracts/token-contracts/usd0++) [USUAL Deep Divearrow-up-right](https://docs.usual.money/usual-products/usual-governance-token) [USUAL Smart Contract](https://tech.usual.money/smart-contracts/token-contracts/usual) [hashtag](https://tech.usual.money/integrations#why-should-you-enhance-your-product-offering-with-busd0) Why should you enhance your product offering with bUSD0? ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Usual Protocol is one of the first stablecoin issuer to redistribute generated value in the form of a governance token via bUSD0, directly incentivizing protocol liquidity, _**while remaining fully transferable and composable.**_ 100% of the generated revenues are pooled into the protocol's treasury. Consequently, USUAL a genuine governance token, backed by real RWA yield and revenue, granting ownership rights over the protocol's actual revenues, future revenues, and infrastructure. These USUAL rewards guarantee at least rewards as high as the underlying RWA yield, in reality is likely to be higher due the protocol's unique [tokenomics of USUALarrow-up-right](https://docs.usual.money/usual-products/usual-governance-token/usual-tokenomics) . USUAL distribution is designed to be disinflationary, meaning its value theoretically increases as the Total Value Locked (TVL) in bUSD0 grows. In that sense early participation is highly advantageous. This sets it apart from many other governance tokens, which often lack intrinsic value. [hashtag](https://tech.usual.money/integrations#how-can-busd0-be-integrated) How can bUSD0 be integrated? -------------------------------------------------------------------------------------------------------------- ### [hashtag](https://tech.usual.money/integrations#reward-logic-claim-bearing) Reward logic = Claim bearing bUSD0 introduces a new logic for rewards distribution. Unlike other tokens, bUSD0 is a "**Claim bearing**" token, not yield bearing or rebasing. Holders of bUSD0 are eligible for "Claiming" daily $USUAL rewards. By default the Usual reward system assigns the holder's address as the recipient of these rewards. The Usual protocol enhances composability by integrating logic that tracks and maps user deposits and activity across other protocols. For instance, Usual monitors deposits of bUSD0 into Morpho, enabling it to reward users who use their bUSD0 deposits as collateral on Morpho. When integrated, the user experience is straightforward. Users can utilize the integrated protocols such as Morpho and Pendle, and directly claiming rewards for their bUSD0 ownership and activity in the "[Earnarrow-up-right](https://app.usual.money/earn) " section of the Usual interface on a daily basis. This setup provides clarity on token values while allowing users to manage and utilize their bUSD0 assets seamlessly, without losing their "**Claim**" on the underlying USUAL rewards. For optimal performance, protocols are highly encouraged to completely integrate with the Usual reward system, so that USUAL rewards are automatically assigned to their users via the daily [USUAL distribution](https://tech.usual.money/overview/features/usual-distribution) , ready to be "claimed". ### [hashtag](https://tech.usual.money/integrations#integration-tiers) Integration Tiers For an integration to be considered completely integrated, empowering a straightforward claim experience for bUSD0 holder/users please refer to tier list below: Integration Tier Reward UX Examples Fully integrated USUAL is claimed via [Earn pagearrow-up-right](https://app.usual.money/earn) Curve, Pendle, Morpho Partially integrated USUAL is claimed and redistributed by integration partner Euler, Superform, Contango Not integrated USUAL can't be claimed from smart contract, USUAL remains stale Maybe your smart contract? If you are in the lowest tier, don't fret - we are here to help! Checkout the integration options below. [hashtag](https://tech.usual.money/integrations#what-integration-options-are-currently-supported) What integration options are currently supported? -------------------------------------------------------------------------------------------------------------------------------------------------------- [](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F62HjVqKei4c8p2kkzyuQ%252FCard%2520Cover%252056.png%3Falt%3Dmedia%26token%3D4c0f84bc-6e31-42be-8ad8-cdbfa1dc493e&width=490&dpr=3&quality=100&sign=246efbd2&sv=2) **Reward redistribution by integration partner** [](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) ![Cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252F74aRfuBnsNzuaReV7CXR%252FCard%2520Cover%252055.png%3Falt%3Dmedia%26token%3D8a6dd855-879b-4735-9b0d-393fd17f272f&width=490&dpr=3&quality=100&sign=ffecd5c3&sv=2) **Claim Address Redirect** [PreviousBug Bountychevron-left](https://tech.usual.money/security-and-audits/bug-bounty) [NextReward redistribution by integration partnerchevron-right](https://tech.usual.money/integrations/integrate-busd0/reward-redistribution-by-integration-partner) Last updated 4 months ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # FAQ | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FesftqPgboaydFZgbYk7k%252FPage%2520Cover%252016.png%3Falt%3Dmedia%26token%3Ddfe5396f-f088-40ac-b5e6-3a6559991225&width=1248&dpr=3&quality=100&sign=88045fe0&sv=2) circle-info As we are collecting feedback after each release this FAQ page will emerge. In the meantime feel free to ask the AI 🤖 or reach out on Discord. [PreviousReferenceschevron-left](https://tech.usual.money/resources/references) [NextGlossarychevron-right](https://tech.usual.money/support/glossary) Last updated 4 months ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # Community & Support | Usual Tech Docs ![Page cover](https://tech.usual.money/~gitbook/image?url=https%3A%2F%2F1503334455-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FpUhQzPJGdJzuLTQ5sCym%252Fuploads%252FTNDArYneh0Dk6JTSEkLM%252FPage%2520Cover%252014.png%3Falt%3Dmedia%26token%3Df9362ec8-40ce-4c2d-99da-af40d2ed4d6c&width=1248&dpr=3&quality=100&sign=b816f646&sv=2) [hashtag](https://tech.usual.money/resources#socials) Socials ------------------------------------------------------------------ [**Telegram**arrow-up-right](https://telegram.usual.money/) [**LinkedIn**arrow-up-right](https://linkedin.usual.money/) [**Discord**arrow-up-right](https://discord.usual.money/) [**X**arrow-up-right](https://x.usual.money/) [**Linktree**arrow-up-right](https://linktr.ee/usualmoney) [**Youtube**arrow-up-right](https://www.youtube.com/channel/UCxshfCtZTlahG_Bwchclb8A) [hashtag](https://tech.usual.money/resources#contact) Contact ------------------------------------------------------------------ Please contact us via this [**form**arrow-up-right](https://usual.money/form/contact-us) . [PreviousClaim Address Redirectchevron-left](https://tech.usual.money/integrations/integrate-busd0/claim-address-redirect) [NextReferenceschevron-right](https://tech.usual.money/resources/references) Last updated 1 year ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject --- # Terms of Services | Usual Tech Docs \*\*Date of the latest revision: 10/18/2024\*\* PLEASE READ THESE TERMS OF USE AND SERVICE CAREFULLY BEFORE USING THE SERVICES. BY USING THE SERVICES, YOU AGREE TO BE LEGALLY AND UNCONDITIONALLY BOUND BY THESE TERMS. APPART FROM THESE TERMS, ALL INFORMATION PROVIDED IN CONNECTION WITH YOUR ACCESS AND USE OF THE INTERFACE AND THE SERVICES IS FOR INFORMATIONAL PURPOSES ONLY. USUAL LABS DRAWS THE ATTENTION OF USERS TO THE RISKS INHERENT IN THE USE OF CRYPTO ASSETS AND BLOCKCHAIN TECHNOLOGY. BEFORE USING THE PROTOCOL, PLEASE READ SECTION 4.3 CAREFULLY. BEFORE MAKING ANY FINANCIAL, LEGAL, TECHNICAL, OR OTHER DECISIONS INVOLVING CRYPTO ASSETS AND/OR THE SERVICES, YOU SHOULD SEEK INDEPENDENT PROFESSIONAL ADVICE FROM A LICENSED AND QUALIFIED INDIVIDUAL IN THE APPROPRIATE AREA. \### 1. PURPOSE OF THIS DOCUMENT \#### 1.1 General information The Usual Protocol, as well as other related interfaces (https://usual.money),Interfaces (as defined below) are provided by Up Only Co, a French simplified joint stock company (société par actions simplifiée) organized under the laws of France, having its registered office located at 1 rue de Stockholm 75008 Paris, incorporated with the Commercial and Companies Register of Paris under number 919 540 427 ("Usual Labs, Inc. ("Usual Labs")" or the “Company”) and its affiliates ("we," "us," "our"). Usual ProtocolThe Interface, as defined below, provides information and resources about the fundamentals of the protocol called "Usual" that permits, among other things, the generation of stablecoins, transactions using smart contracts, and the lending, leveraging, and staking of cryptographic assets (the "Protocol"). The purpose of these terms of use (the "Terms") is to define: * the terms and conditions of use applicable to the user (the "User," "you," or "your"), when using our websites located at https://usual.money or any other related interface (the "Interface") * the terms and conditions applicable to any other features, tools, materials, or other services offered from time to time on the Interface (the "Services"). \### #### 1.2 Definitions * ADDU: means the Association de Développement de la DAO Usual (ADDU), a French law association having its registered office located at 10, rue de la Paix, 75002 Paris, and registered with INSEE under SIREN number 925 013 245, developing and organizing the Usual DAO, composed of Usual Token holders. * Airdrop: means the process of distribution of tokens for free to Users who have participated in an airdrop through a dedicated interface, such operation which may be carried out by ADDU at its own discretion. * AML (Anti Money Laundering): means laws, regulations, and procedures designed to prevent the use of financial systems for the purposes of concealing, disguising, or transforming illegal proceeds derived from criminal activities, financing terrorism, or other illicit activities. As provided in Article 4.1 of these Termes. Users expressly warrant that they are not involved in any activities or transactions that violates AML laws or regulations, and that they will not use the Protocol to facilitate money laundering, terrorist financing, or any other illegal or prohibited activities. Users further agree to comply with any applicable AML requirements in their jurisdiction and acknowledge that the Company may take measures to ensure compliance with AML regulations, wherever possible, given the decentralized nature of the Protocol. * Crypto assets: means tokens used by Users as a currency and unit of value (coins), such as bitcoin (BTC), Ethereum (ETH), or stablecoins, which aim to maintain a fixed parity with a traditional currency; or tokens with a utility function (utility tokens), granting access rights to products or services offered by the issuer. * Connect wallet: means the tab on the Interface available to Users to connect their noncustodial wallet. A non-custodial wallet is a type of cryptocurrency wallet that gives Users full control over their Crypto assets, as they hold the private keys. Unlike custodial wallets, where a third party manages the private keys on behalf of the user, non-custodial wallets allow Users to store, send, and receive Crypto assets without relying on an intermediary. This type of wallet may be considered more secure because it eliminates the risks associated with third-party custodians, but it also requires Users to take responsibility for safeguarding their private keys to avoid losing access to their Crypto assets. As specified below, Usual Labs or any affiliate company may not be liable in such cases where the User loses access to their Crypto assets due to the loss or mismanagement of private keys. * Contact address: means the email address to which the User may request information: support@usual.company * Interfaces: means the website: [https://usual.moneyarrow-up-right](https://usual.money/) and the front end to the Protocol: [https://app.usual.money/arrow-up-right](https://app.usual.money/) * Jurisdiction: means France, as provided in Article 8.9 of these Terms. * Prohibited Person: means a person who is a resident or national of the following countries: Afghanistan, Albania, Angola, Azerbaijan, Bosnia Herzegovina, Bahamas, Barbados, Burma, Botswana, Burkina Faso, Burundi, Cayman Islands, Cambodia, Cameroon, Crimea (Ukraine), Chad, China, Congo, Democratic Republic of Congo, Cuba, Ethiopia, Eritrea, Fiji, Palau, Ghana, Guinea, Guinea-Bissau, Haiti, Iran, Iraq, Jamaica, Jordan, Lao People's Democratic Republic, Uganda, Liberia, Libya, Madagascar, Mali, Malta, Morocco, Mozambique, Nicaragua, Nigeria, North Korea, Pakistan, Panama, Philippines, Puerto Rico, Russia, Senegal, Somalia, Sri Lanka, Sudan, Syria, Tajikistan, Trinidad and Tobago, Turkey, Turkmenistan, United States, Uzbekistan, Vanuatu, Venezuela, Virgin Islands, Yemen, Zimbabwe and any resident or national of a country otherwise subject to a U.S. Government embargo, or that has been designated by the U.S. Government as a terrorist-supporting country, and (ii) are not listed on any U.S. Government list of prohibited or restricted parties. * Prohibited US Person: means a person who is a resident or national of the United States of America. * USD0: means a liquid deposit token distributed to Users in exchange of deposit eligible on chain assets into the Protocol. For more information, please consult the following link: [https://docs.usual.money/usual-products/usd0-stablecoinarrow-up-right](https://docs.usual.money/usual-products/usd0-stablecoin) (information with no contractual value). * USD0++: means a token distributed to Users who use USD0 in various ways, such as contributing liquidity or locking USD0 and who would then be distributed Usual Tokens if made available by ADDU. For more information, please consult the following link: https://docs.usual.money/usual-products/usd0++-enhanced-tbill (information with no contractual value). * Usual DAO: means the Usual decentralized autonomous organization. * Usual Labs: means the User's co-contracting party, Up Only Co, a software company contributing to the development of the Protocol, registered at 1, rue de Stockholm, 75008 Paris, with the Commercial and Companies Register of Paris under number 919 540 427. * Usual Tokens: means the Protocol's governance tokens which may be released by ADDU at its own discretion. Its primary utility lies in empowering Usual Tokens holders to participate directly in the governance processes of the Usual DAO, effectively granting them a say in decision-making and the future direction of the Protocol. This means that Usual Tokens holders may have the opportunity to vote on proposals, decide upon the development roadmap, and contribute to key decisions that shape the Protocol’s evolution. However, such rights do not constitute ownership or equity in the Company or ADDU and may not grant Usual Tokens holders any legal rights to participate in the formal governance of the Company or ADDU, such as shareholder rights. For more information, please consult the following link: https://docs.usual.money/usual-products/usual-governance-token (information with no contractual value). \### 2. ACCEPTANCE OF TERMS – CHANGE OF TERMS Before using any of the Services, you must first agree to these Terms. By accessing the Services, you expressly confirm that you fully and irrevocably agree to these Terms. If you do not agree to any part of these Terms, you must cease using the Services. You also agree that your personal data and electronic communications on the Interface will be processed in accordance with our privacy policy, which is incorporated herein by reference and available at (https://gitbook.usual.money/ressources-and-ecosystem/privacy-policy). WeTo the maximum extent permitted by applicable law, we reserve the right, at our sole discretion, to modify or replace the Terms at any time. The most current version of these Terms will be posted and accessible via the Interface. You are responsible for reviewing and familiarizing yourself with such modifications. You will be deemed to have accepted all modifications and revisions by continuing to use any of the Services. You may contact us with questions about your use of the Services at contact@usualprotocol.com. When you communicate with us electronically, you consent to receive communications from us electronically. \### 3. SERVICES \#### 3.1 Information on the Protocol The Interface is provided as an informational resource about the fundamentals of the Protocol, which is a fully decentralized finance (“DeFi”) infrastructure, community-governed protocolProtocol deployed on multiple blockchain networks and systems, and provides information about the wider Usual ecosystem, governance, community, and various interfaces and integrations to the Protocol. The Protocol is based on: * an open-source solution for which anyone can permissionlessly build or suggest improvement; and * a set of Smart Contracts developed in a modular approach and operating on the Ehtereum blockchain. The Protocol enable Users to: * deposit assets via its front end: Users deposit eligible on chain assets into the Protocol in exchange of USD0 tokens and representing the initial value of the deposit within the Protocol. * earning rewards: Users may utilize USD0 in various ways, such as contributing liquidity or locking USD0 in exchange of USD0++. By doing so, Users may be distributed Usual Tokens. * governance: Users may – when the Usual Tokens will be released which may be carried out by ADDU at its own discretion – be able to utilize Usual Tokens to participate in the governance of the Protocol. All information provided in connection with your access and use of the Interface and the Services is for informational purposes only. You should not take, or refrain from taking, any action based on the information contained on the Interface or any other information that we make available at any time, including blog posts, data, articles, links to third-party content, Discord content, news feeds, tutorials, tweets, and videos. Before making any financial, legal, technical, or other decisions involving crypto assets and/or the Services, you should seek independent professional advice from a licensed and qualified individual in the appropriate area. \#### 3.2 We are software developers in the Protocol ecosystem The Protocol is deployed on multiple blockchain-based networks, and Usual Labs is not responsible for the operation of such networks. It is important to understand that neither we nor any affiliated entity is a party to any transaction on the blockchain networks underlying the Protocol; we do not have possession, custody, or control over any crypto assets appearing on the Services; and we do not have possession, custody, or control over any user’sUser’s funds. Further, we do not store, send, or receive any crypto assets. You understand that when you interact with any Protocol smart contracts, you retain control over your crypto assets at all times. The private key associated with the wallet address from which you transfer crypto assets is the only private key that can control the crypto assets you transfer into the smart contracts. \#### 3.3 License to use our Services We grant you a license to use our Service. Contingent upon your ongoing compliance with these Terms, we grant you a personal, worldwide, revocable, non-exclusive, and non-assignable license to use the software provided as part of our Services. The only purpose of this license is to allow you to use and enjoy the Services solely as permitted by these Terms. We own any and all rights, titles, and interests in and to the Services, including, without limitation, any and all copyrights to any content, code, data, or other materials that you may access or use on or through the Services; except as expressly set forth herein, your use of or access to the Services does not grant you any ownership or other rights therein. We may use and share your feedback. Any comments, bug reports, ideas, or other feedback that you may provide about our Services on the Contact address, including suggestions on how we might improve our Services, are entirely voluntary. You agree that we are free to use or not use any feedback that we receive from you as we see fit, including copying and sharing such feedback with third parties, without any obligation to you. \#### 3.4 Fees Absence of Usual Labs’ fees. Usual Labs dodoes not – itself – charge any fees to Users for the use of Services or the Interface. We doApart from providing the Usual front end through the Interface, the Company does not provide any servicesServices per se to usersUsers or deliver, hold, and/or receive payment for crypto assets. Gas fees. However, note that in connection with your use of the Services, you agree to bear all costs necessary to conduct a transaction on the blockchain, such as gas fees. We attempt to provide accurate cost information, but this information is highly volatile and can change quickly without Users necessarily being aware of these changes. \### 4. USER’S REPRESENTATIONS & WARRANTIES AND ACKNOWLEDGEMENTS \#### 4.1 User’s representations & warranties You hereby represent and warrant, at all times during the use of the Services, that you: * Comply at all times with the laws (including notably anti-money launderingAML regulations) * Your use conforms with and does not breach the laws and in particular any applicable law in the jurisdiction in which you are located, including notably anti-money launderingAML regulations, and you will not be using the Services for, nor will promote or facilitate, illegal activity (including, without limitation, money laundering, financing terrorism, tax evasion, buying or selling illegal drugs, contraband, counterfeit goods, or illegal weapons);). * You are not engaged in any illegal trade, money laundering activities, or activities related to the financing of terrorism and will not be exploiting the Services for any unauthorized commercial purpose. * Neither you nor the geographical locality in which you reside or are domiciled or located are the subject of economic sanctions from the United Nations, the United States of America, or the European Union. * Neither you nor any of your affiliates is owned or controlled by a sanctioned person or involved in any transaction, transfer, or conduct that is likely to result in you or your affiliates becoming a sanctioned person or people. * Neither you nor any of your affiliates is a politically exposed person. * You will not use the Services for any fraudulent or dishonest purpose. * You will not harvest or otherwise collect information from the Services for any unauthorized purpose. * You will not attempt to conceal any non-compliance by you with any laws or these Terms by using a VPN or proxy or any other method or use the Services under false or fraudulent pretenses or otherwise being deceitful. * Are not citizens or residents of the United States; residents of Belarus, the Central African Republic, the Democratic Republic of Congo, the Democratic People’s Republic of Korea, the Crimea region of Ukraine, Cuba, Iran, Libya, Somalia, Sudan, South Sudan, Syria, the USA, the United Kingdom, Yemen, and Zimbabwe or any other jurisdiction in which accessing or using the Usual Protocol is prohibited (“Prohibited Jurisdictions”). In using this interfacea Prohibited US Person or a Prohibited Person; * In using this Interface, you confirm that you are not located in, incorporated or otherwise established in, or a citizen or resident of, a Prohibited Jurisdiction. a jurisdiction listed hereabove in Article 1.2. * You represent and warrant that you are not a citizen or resident of this "Prohibited Juridiction".such prohibited jurisdictions, as listed hereabove in Article 1.2 and You agree not to use the Services if you are located in, or a resident of, "Prohibited Juridiction". such jurisdictions. * Shall not affect the functionality or operation of the Services * You will not upload or transmit viruses, worms, Trojan horses, time bombs, cancel bots, spiders, malware, or any other type of malicious code that will or may be used in any way that may affect the functionality or operation of the Services. * You will not interfere with or circumvent the security features of the Services or any third party’s systems, networks, or resources used in the provision of Services. * You will not engage in any attack, hack, denial-of-service attack, interference, or exploit of any smart contract in connection with the use of the Service (and operations performed by a user that are technically permitted by a smart contract may nevertheless be a violation of our Agreement, including these Terms, and the law) nor engage in any anticompetitive behavior or other misconduct. * Are aware of related risks * By utilizing the Services or interacting with the Interface in any way, you represent that you perfectly understand the inherent risks associated with smart contracts and cryptographic systems (included but not limited to the volatility of cryptocurrencies, risk of regulatory actions, risks of technical issues) as disclosed thereafter and warrant that you have a very good understanding of the usage of cryptographic assets. * Shall not do any trolling activities: You will act toward us with respect and integrity and will not subject us to any abusive or disrespectful acts, including trolling on social media. * You will not interfere with other users’ access to or use of the Services. * Have the legal capacity and sufficient experience to use the Services: You are of the legal age of majority in your jurisdiction as is required and of sufficient mental age, maturity, and capacity to accept these Terms and use the Services. * You are fully able and competent to enter into the terms, conditions, obligations, affirmations, representations, and warranties set forth in these Terms and to abide by and comply with these Terms. * You have knowledge of and experience in the digitalcrypto asset space and are familiar with the functioning and intricacies of digitalcrypto assets including ERC20 tokens and with decentralized finance and decentralized exchanges and markets. * You further represent that you are legally permitted to use the Services in your jurisdiction. You further represent that you are responsible for ensuring compliance with the laws of your jurisdiction and you acknowledge and expressly agree thatwethat we shall not be liable for your compliance with such laws. * No breach of Intellectual Property Rights: * Your use of the Services does not and will not violate any intellectual property rights. You will not engage in transactions involving items that infringe or violate any copyright, trademark, right of publicity or privacy or any other proprietary right under the law, including but not limited to sales, distribution, or access to counterfeit music, movies, software, or other licensed materials without the appropriate authorization from the rights holder; use of our intellectual property, name, or logo, including the use of our trade or service marks, without express consent from us or in a manner that otherwise harms Usual Labs; any action that implies an untrue endorsement by or affiliation with Usual Labs. * You will not attempt to or actually copy or make unauthorized use of all or any portion of the Services, including by attempting to reverse compile, reformatting or framing, disassemble, reverse engineer any part of the Services. * Take your own responsibility: You make your own independent decisions in the way you are using the Services. * You are fully and solely responsible for the security of your wallet(s) and passwords, seed phrases, and private keys. If you provide or make available your passwords, seed phrases, or private keys to anyone else, you are fully and solely responsible for any consequent use of these. * You are fully and solely responsible for obtaining your own independent legal, financial, accounting, and tax advice. \#### 4.2 User’s Acknowledgements By your continuing use of the Services, you acknowledge: * Decentralization of the Protocol * The Protocol is fully decentralized. All transactions entered into by Protocol users are carried out by them on a peer-to-peer basis and Usual Labs has no control over such transactions. * No agency, advisory or partnership * We do not represent the buyer, seller, liquidity provider, offeror of tokens, or any participant or transacting party on the Protocol. * You alone are responsible for securing your private keys. We do not have access to your private keys. Due to the non-custodial and decentralized nature of the technology, we are not intermediaries, agents, advisors, or custodians, and we do not have a fiduciary relationship or obligation to you regarding any other decisions or activities that you affect when using our Services. We neither are accountants, tax advisors, legal representatives, or financial advisors of the Protocol. * You acknowledge that we, for the avoidance of doubt, do not have any information regarding any users, users’ identities, or services beyond what is available or obtainable publicly via the blockchain. We are not responsible for any activities you engage in when using Services, and you should understand the risks associated with crypto assets, blockchain technology generally, and our Services. * All contributors to the ecosystem around the Protocol are independent of us, and we will not have and do not assume any liability or responsibility for their actions or omissions. * We have no control over the Protocol’s operations * The Protocol is deployed on multiple blockchain-based networks, and we are not responsible for the operation of such networks. * The software underlying blockchain networks on which the Protocol is deployed, including, for example, the Ethereum blockchain, is open source, which means that anyone can use, utilize, and build on top of it. By using the Services, you acknowledge and agree (i) that we are not responsible for the operation of the blockchain-based software and networks underlying the Protocol, (ii) that there exists no guarantee of the functionality, security, or availability of that software and networks, and (iii) that the underlying blockchain-based networks are subject to sudden changes in operating rules, such as those commonly referred to as “forks”. * No recommendations * By participating in the Protocol, you acknowledge that you are doing so on the basis of your own enquiry, without solicitation or inducement by Usual Labs. * No information published on the Protocol about any of the digitalcrypto assets, trading strategies, or other financial strategies should be construed as being a promotion, solicitation, recommendation, or marketing of any kind in relation to any of these, and we have no knowledge of the financial circumstances or objectives of any Protocol’s user or any expertise in what might constitute sensible financial practice for them. * There is no assurance, representation, or warranty that your use of the Services: * will provide a profit; * will not incur significant losses; or * will attain your commercial or other objectives. * Automated collection and disbursement of proceeds by smart contracts * You agree to the automated collection and disbursement of proceeds by smart contracts. You acknowledge and agree that all transactions accessed through the Services will be automatically processed using one or more blockchain-based smart contracts. By engaging in transactions using the Services, you acknowledge and consent to the automatic processing of all transactions in connection with using the Services. You further acknowledge and agree that the applicable smart contract will dictate how the funds of a transaction and ownership of crypto assets are distributed. \#### 4.3 Assumption of riskrisks The Company draws the attention of Users to the risks inherent in the use of crypto assets and blockchain technology. Before using the Protocol, please read this section carefully. * Risks inherent to blockchain activities * We do not own or control any of the underlying software through which blockchain networks are formed. In general, the underlying software for blockchain networks tends to be open source such that anyone can use, copy, modify, and distribute it. By using the Services, you acknowledge and agree (i) that we are not responsible for the operation of the underlying software and networks that there exists no guarantee of functionality, security, or availability of such software and networks; and (ii) that digitalcrypto assets are highly volatile because of a range of factors which include, but are not limited to, rate of adoption, speculation, technology changes, security risks, contagion risks, systematic risks, legal and regulatory changes, and factors affecting their supply (such as the mining, minting, or issuing of new tokens, airdrops, the burning of tokens, and blockchain forks). * You understand that Ethereum and other blockchain technologies and associated Digital Assetscrypto assets, currencies, or tokens are highly volatile due to many factors including but not limited to adoption, speculation, technology, and security risks. You also acknowledge that the cost of transacting on such technologies is variable and may increase at any time causing an impact on any activities taking place on the Ethereum blockchain. You acknowledge these risks and represent that the Company cannot be held liable for such fluctuations or increased costs. * Regulatory risks * The Services could be impacted by one or more regulatory inquiries or regulatory action, which could impede or limit the ability of Usual Labs to continue to develop, or which could impede or limit your ability to access or use the Services or Ethereum blockchain, including access to the Interface. * Risk of information inaccuracy * Although it is intended to provide accurate and timely information on the Interface, the Interface or relevant tools may not always be entirely accurate, complete, or current and may also include technical inaccuracies or typographical errors. In an effort to continue to provide you with as complete and accurate information as possible, information may be changed or updated from time to time without notice, including, without limitation, information regarding our policies. Accordingly, you should verify all information before relying on it, and all decisions based on information contained on the Interface or relevant tools are your sole responsibility and the Company shall have no liability for such decisions. Links to third-party materials (including, without limitation, websites) may be provided as a convenience but are not controlled by any entity. You acknowledge and agree that we are not responsible for any aspect of the information, content, or services contained in any third-party materials or on any third-party sites accessible or linked to the Interface or available via other relevant tools. * No representation is made as to the accuracy, completeness, or appropriateness for any particular purpose of any pricing information distributed via the Interface. * Non-private data and data storage * A widespread belief is that transactions involving blockchains are anonymous. In fact, a central feature of blockchains and thus, blockchain-based transactions, is that they are transparent. Your public key and your wallet address, which you need to buy or sell items on the blockchain, are visible to anyone. To the extent your public key or wallet address can be linked back to you, it would be possible for someone to determine your identity and the crypto assets you own. You therefore acknowledge that your activity relating to using is not private and may be visible to third parties, including on public blockchains. * Disruptions and cyber risks * The functioning of the Services may be disrupted from time to time because of system overloads, software or hardware issues, power outages, errors, or instability in experimental features or issues with the functioning of other services and software on which the Interface is dependent. * Users face the risk of cybersecurity events, which may negatively affect the operation of the Services and their availability. * Users accept that we have no liability to them for any losses arising from any such disruptions or cybersecurity events and that we do not warrant that their use will be error-free or uninterrupted. * Users acknowledge that it is their responsibility to ensure that any hardware and software and access credentials they use to access the Services and their wallets are kept secure. Users acknowledge that we are not liable for any security breaches or other failings of any such systems. \### 5. DISCLAIMER OF WARRANTIES – LIABILITY \#### 5.1 No right of withdrawal Consumer Users – within the meaning of the Consumer Code – expressly acknowledge and agree that the Services are to be carried out immediately. Therefore, under these Terms, Users that are considered as consumers – within the meaning of the Consumer Code – expressly waive their right of withdrawal, should such right exist, and give their express consent for the execution of the Terms and the Services before the end of the right of withdrawal. Therefore, these Terms are concluded as soon as they are accepted by the User, without both Parties having to wait for the expiration of the withdrawal period. \#### 5.2 No warranties by Usual Labs You expressly understand and agree that your use of the Services and/or the Interface is at your sole risk. The Services (including the Interface) are provided "as is" and "as available," without warranties of any kind, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose, or non-infringement. You acknowledge and expressly agree that we have no control over, and no duty to take any action regarding: which users gain access to or use the Services; what effects the content of the Interface may have on you; how you may interpret or use the content of the Interface. There are no warranties that access to the Interface and/or the Services will be continuous, uninterrupted, timely, or secure, that the information made available via, contained on, or used by the Interface, will be accurate, reliable, complete, or current, or that the Services will be free from errors, defects, viruses, or other harmful material. You acknowledge and expressly accept that the Interface and/or the Services (a) may contain bugs, errors, and defects, (b) may function improperly or be subject to periods of downtime and unavailability, (c) may result in total or partial loss or corruption of data, and (d) may be modified at any time, including through the release of subsequent versions, all with or without notice to you. No advice, information, or statement that any contributor to the Protocol makes should be treated as creating any warranty concerning the Services. We do not endorse, guarantee, or assume responsibility for any advertisements, offers, or statements made by third parties concerning the Services or the Interface. You acknowledge and expressly agree that we are not responsible for transferring, safeguarding, or maintaining your private keys or any digitalcrypto currency associated therewith. If you lose, mishandle, or have stolen associated digitalcrypto currency private keys, you acknowledge and expressly agree that you may not be able to recover associated digitalcrypto assets, and that we are not responsible for such loss. You acknowledge and expressly agree that we are not responsible for any loss, damage, or liability arising from your failure to comply with the terms hereunder. \#### 5.23 Limitation of Liability You acknowledge and expressly agree that you assume full responsibility for your use of the Services and/or the Interface. You acknowledge and expressly agree that any information you send or receive during your use of the Services and/or the Interface may not be secure and may be intercepted or acquired by unauthorized parties. You acknowledge and expressly agree that your use of the Services and/or the Interface is at your own risk. Recognizing such, you understand and agree that, to the fullest extent permitted by applicable Law, we will not be liable to you for any direct, indirect, incidental, special, consequential, punitive, exemplary, or other damages of any kind, including without limitation damages for loss of profits, goodwill, use, data, or other tangible or intangible losses or any other damages based on contract, tort, strict liability, or any other theory (even if we had been advised of the possibility of such damages), resulting from: the Services and/or the Interface; the use or the inability to use the Services and/or the Interface; unauthorized access to or alteration of your transmissions or data; statements or conduct of any third party on the Services and/or the Interface; any actions we take or fail to take as a result of communications you send to us; errors; technical malfunctions; failures, including public utility or telephone outages; omissions, interruptions, latency, deletions, or defects of any device or network, providers, or software (including, but not limited to, those that do not permit participation in the Services); any injury or damage to computer equipment; inability to fully access the Services and/or the Interface or any other website; theft, tampering, destruction, or unauthorized access to, images or other content of any kind; data that is processed late or incorrectly or is incomplete or lost; typographical, printing, or other errors, or any combination thereof; or any other matter relating to the Services and/or the Interface. The Company shall not be liable for any losses, damages, or liabilities arising directly or indirectly from any unauthorized access, breach, or hack of the underlying Protocol, or any third-party software, hardware, or services utilized by the User. The User acknowledges and agrees that decentralized finance (DeFi) protocols and blockchain technology involve inherent risks, including potential vulnerabilities in the Protocol or the User Devices, which may result in partial or total loss of funds. The Company does not guarantee the security or functionality of the Protocol, and it is the User's sole responsibility to take all necessary precautions to protect their assets and private keys. ADDU may, at its sole discretion, decide to conduct an Airdrop of Usual tokens to eligible Users. Participation in the Airdrop is not guaranteed, and ADDU reserves the right to modify, suspend, or cancel the Airdrop at any time, without notice or liability. ADDU and/or the Company shall not be liable for any losses, damages, or liabilities arising from the User’s failure to receive, claim, or secure the distributed Usual tokens, including, but not limited to, losses due to technical issues, user errors, incorrect wallet addresses, third-party service failures, or unauthorized access to the User’s wallet. The User acknowledges that participation in the Airdrop involves inherent risks and accepts full responsibility for securing any tokens received. \#### 5.34 Indemnification You agree to release and to indemnify, defend, and hold harmless Usual Labs and its affiliates, from and against any and all losses, liabilities, expenses, damages, costs (including attorneys' fees, fees or penalties imposed by any regulatory authority and court costs) claims, or actions of any kind whatsoever arising or resulting from your use of the Services and/or the Interface, your violation of these Terms, your violation of any Law, rule, or regulation, or the rights of any third party, and any of your acts or omissions that implicate publicity rights, defamation, or invasion of privacy. \### 6. LIMITATION OF PARTICIPATION – TERMINATION – ACCOUNT CLOSURE \#### 6.1 Termination by Us To the maximum extent permitted by applicable law, we may at any time and without liability, terminate, suspend, or limit your use of the Services, including, but not limited to, where: (a) we reasonably suspect you of acting in breach of these Terms and/or all other applicable terms; (b) we are required to do so by applicable Law, regulation, or any court or other authority to which the use of the Services is subject to in any jurisdiction; (c) we suspect that your use of the Services is potentially connected to any unlawful activities (including but not limited to money laundering, terrorism financing, and fraudulent activities); (d) we have concerns that the Services are being used in a fraudulent or unauthorized manner. You shall not be entitled to any payment, compensation, or damages whatsoever from us in relation to any suspension, limitation, or termination of your use of the Services for any reason whatsoever. Any suspension, limitation, or termination of your use of the Services for any reason whatsoever shall not release you from any liability or responsibility on your part, which at the time of such suspension, limitation, or termination, has already accrued. The rights of suspension, limitation, and termination under these Terms shall be without prejudice to any other rights or remedies which we may have (whether under these Terms, applicable law, or otherwise). \#### 6.2 Consequences of Termination You will no longer be entitled nor able to use the Services. \### 7. PROCESSING OF PERSONAL DATA The data protection and cookie policy is available at https://gitbook.usual.money/ressources-and-ecosystem/privacy-policy. \### 8. GENERAL PROVISIONS \#### 8.1 Third-Party Links The Interface may provide, or third parties may provide, links to other websites, applications, or resources. Because we have no control over such sites, applications, and resources, you acknowledge and expressly agree that we are not responsible for the availability of such external sites, applications, or resources, and do not endorse and are not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that we shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any such content, goods, or services available on or through any such site or resource. \#### 8.2 Entire Agreement Except otherwise provided herein, these termsTerms (as amended from time to time) and any document expressly referred to hereof constitute the entire agreement between the parties and supersede any prior agreement, promise, assurance, warranty, representation, understanding, undertaking, or arrangement between the parties relating to the subject matter of these termsTerms, whether written or oral. No oral explanation or oral information given by either of us shall alter the interpretation of these Terms. You confirm that, in agreeing to accept these Terms, you have not relied on any representation that is not expressly included herein. \#### 8.3 Severability These Terms shall be deemed severable, and the invalidity or unenforceability of any term or provision hereof shall not affect the validity or enforceability of these Terms or of any other term or provision hereof. Furthermore, such invalid or unenforceable term or provision shall be changed and interpreted to accomplish the objectives of the initial provision to the greatest extent possible under any applicable laws. \#### 8.4 Language These Terms are concluded in the English language upon your request and all communications, including any notices or information being transmitted, shall be in English. In the event that these Terms or any part of it is translated (for any proceedings, for your convenience, or otherwise) into any other language, the English language shall prevail. \#### 8.5 Waiver The delay of enforcement or the non-enforcement of any of the terms of these Terms by any party shall not be construed as a waiver of any of the other rights of that party under these Terms and no right, power, or remedy conferred upon or reserved for any party in these Terms is exclusive of any other right, power, or remedy available to that party and each such right, power, or remedy shall be cumulative. \#### 8.6 Notices and Communications By using the Services and/or the Interface, you agree that we may provide you with any notices or other communications, including marketing, relating to your use of the Services and/or the Interface: (a) via email (in each case to the address that you provide), SMS message, Discord message, or telephone call (in each case to the phone number that you provide), or (b) by posting to the Interface or on Twitter. For notices made by email, the date of receipt will be deemed the date on which such notice is transmitted. You will always be given the option to unsubscribe from receiving any marketing material from us. \#### 8.7 Section Titles The section titles in the Terms are for convenience only and have no legal or contractual effect. \#### 8.8 Pre-contractual information – Customer acceptance The consumer User acknowledges having been informed in a comprehensible manner, by means of the availability of the present Terms, prior to accepting these Terms: * on the essential characteristics of the Services, taking into account the communication medium used; * on the price of the Services; * on the terms of payment, supply and performance of the Terms; * the identities of Usual Labs and ADDU, their postal and electronic contact details, as well as their activities, if they are not apparent from the context, * on legal and contractual guarantees and their implementation; * on the possibility of resorting to conventional mediation in the event of a dispute; * on the absence of right of withdrawal and other important contractual conditions. The fact that Users use the Interface and/or the Services implies full acceptance of these Terms, which is expressly acknowledged by the User, who waives, in particular, the right to rely on any contradictory document, which would be unenforceable against Usual Labs. \#### 8.9 Governing Law, Mediation and Submission to Jurisdiction These Terms shall be governed and construed in accordance with the laws of France have . In case of a dispute as to the interpretation of execution of these Terms, the parties will make every effort to find an amicable solution. Any User who is a consumer within the meaning of applicable law may, free of charge, refer to the services of a consumer mediator with a view to the amicable resolution of a dispute with Usual Labs. The body appointed by Usual Labs for this purpose will be determined In order to contact this body, the User may: * go to the mediator’s site and fill in the online form, enclosing supporting documents; or * send their complaint by post to the mediator’s address. A dispute may only be examined by the consumer mediator if: * the User justifies having tried, beforehand, to resolve his dispute directly with Usual Labs by a written complaint expressly identified as such detailing the reasons for his complaint as well as all the information useful to Usual Labs to understand, study and appreciate the causes, consequences and incidences of this complaint, and sent by e-mail to: \[mail\]; * the claim is not manifestly unfounded or abusive; * the dispute has not been previously examined or is not being examined by another mediator or by a court; * the User submits his request to the mediator within a maximum of one year from the date of his written complaint to Usual Labs; * the dispute falls within the competence of the mediator. The User will be informed by the mediator of the action taken on his or her request for mediation. Furthermore, the User is informed that in accordance with Article 14 of Regulation (EU) No. 524/2013, the European Commission has set up an Online Dispute Resolution platform, facilitating the independent settlement by extrajudicial means of online disputes between consumers and professionals in the European Union. This platform is accessible at the following link: https://webgate.ec.europa.eu/odr/. Users. In the absence of an amicable resolution, You acknowledge and accept that in the event of a claim or dispute, they shall be submitted to the exclusive jurisdiction to settle any dispute arising from or connected with these Terms (including a dispute of the Courts of Paris (Tribunal de Commerce de Paris). EU-based consumers Users. These provisions relating to the existence, validity, or termination of these Terms or the consequences of their nullity or any non-contractual obligation arising out of or in connection with these Terms).applicable law and the competent jurisdictions are applicable subject to the imperative provisions that would have to be applied to the user in his capacity as a consumer. Users must bring any and all legal claims pertaining to the Services in their individual capacities and not as a claimant in or member of any purported class action, collective action, private attorney general action, or other representative proceeding. Users agree to waive the right to demand a trial by jury, where applicable. [PreviousGlossarychevron-left](https://tech.usual.money/support/glossary) [NextLegal Noticechevron-right](https://tech.usual.money/legal/legal-notice) Last updated 1 year ago Was this helpful? This site uses cookies to deliver its service and to analyze traffic. By browsing this site, you accept the [privacy policy](https://docs.usual.money/resources-and-ecosystem/legal-documentation/privacy-policy) . close AcceptReject ---