diff --git a/.github/workflows/run-semgrep.yaml b/.github/workflows/run-semgrep.yaml new file mode 100644 index 000000000..bcc45a4f0 --- /dev/null +++ b/.github/workflows/run-semgrep.yaml @@ -0,0 +1,39 @@ +name: Run Semgrep + +on: + workflow_dispatch: + push: + paths: + - '**.sol' + pull_request: + paths: + - '**.sol' + +jobs: + semgrep: + name: Scan + runs-on: ubuntu-latest + + container: + image: returntocorp/semgrep + + if: (github.actor != 'dependabot[bot]') + + steps: + - uses: actions/checkout@v3 + + - name: Fetch semgrep rules + uses: actions/checkout@v3 + with: + repository: decurity/semgrep-smart-contracts + path: rules + + - run: semgrep ci --sarif --output=semgrep.sarif --include packages/contracts/src/dollar --no-suppress-errors + env: + SEMGREP_RULES: rules/solidity/security + + - name: Upload findings to GitHub Advanced Security Dashboard + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: semgrep.sarif + if: always() \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index ff98ee869..5c71a385d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,4 +37,12 @@ [submodule "packages/contracts/lib/chainlink-brownie-contracts"] path = packages/contracts/lib/chainlink-brownie-contracts url = https://github.com/smartcontractkit/chainlink-brownie-contracts - branch= main \ No newline at end of file + branch= main +[submodule "packages/contracts/lib/aave-v3-core"] + path = packages/contracts/lib/aave-v3-core + url = https://github.com/aave/aave-v3-core + branch= master +[submodule "packages/contracts/lib/aave-v3-periphery"] + path = packages/contracts/lib/aave-v3-periphery + url = https://github.com/aave/aave-v3-periphery + branch= master diff --git a/.semgrepignore b/.semgrepignore new file mode 100644 index 000000000..7a613e799 --- /dev/null +++ b/.semgrepignore @@ -0,0 +1,8 @@ +# mocks +packages/contracts/src/dollar/mocks/ + +# deprecated contracts +packages/contracts/src/dollar/core/CreditNft.sol +packages/contracts/src/dollar/core/StakingShare.sol +packages/contracts/src/dollar/libraries/LibCreditNftManager.sol +packages/contracts/src/dollar/libraries/LibDollarMintExcess.sol diff --git a/cspell.json b/cspell.json index 40f83956d..75164182e 100644 --- a/cspell.json +++ b/cspell.json @@ -162,7 +162,13 @@ "blockhash", "Merkle", "UUPS", - "Initializable" + "Initializable", + "IAMO", + "timelock", + "AAve", + "AAveV3", + "IAAve", + "Cust" ], "flagWords": ["creditNFT", "CreditNFT"], "language": "en-US" diff --git a/packages/contracts/LICENSE_GPL b/packages/contracts/LICENSE_GPL new file mode 100644 index 000000000..3d2480a49 --- /dev/null +++ b/packages/contracts/LICENSE_GPL @@ -0,0 +1 @@ +Sections of this software is licensed under the GNU GPL-2.0-or-later. You can find the source code at: https://github.com/FraxFinance. diff --git a/packages/contracts/docs/src/SUMMARY.md b/packages/contracts/docs/src/SUMMARY.md index 9f8fa8d0b..9b2391d56 100644 --- a/packages/contracts/docs/src/SUMMARY.md +++ b/packages/contracts/docs/src/SUMMARY.md @@ -4,11 +4,14 @@ - [❱ dollar](src/dollar/README.md) - [❱ access](src/dollar/access/README.md) - [AccessControlInternal](src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md) + - [❱ amo](src/dollar/amo/README.md) + - [AaveAmo](src/dollar/amo/AaveAmo.sol/contract.AaveAmo.md) - [❱ core](src/dollar/core/README.md) - [CreditNft](src/dollar/core/CreditNft.sol/contract.CreditNft.md) - [ERC1155Ubiquity](src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md) - [ERC20Ubiquity](src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md) - [StakingShare](src/dollar/core/StakingShare.sol/contract.StakingShare.md) + - [UbiquityAmoMinter](src/dollar/core/UbiquityAmoMinter.sol/contract.UbiquityAmoMinter.md) - [UbiquityCreditToken](src/dollar/core/UbiquityCreditToken.sol/contract.UbiquityCreditToken.md) - [UbiquityDollarToken](src/dollar/core/UbiquityDollarToken.sol/contract.UbiquityDollarToken.md) - [UbiquityGovernanceToken](src/dollar/core/UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md) @@ -35,7 +38,9 @@ - [❱ interfaces](src/dollar/interfaces/README.md) - [❱ utils](src/dollar/interfaces/utils/README.md) - [ICollectableDust](src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md) + - [IAaveAmo](src/dollar/interfaces/IAaveAmo.sol/interface.IAaveAmo.md) - [IAccessControl](src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md) + - [IAmo](src/dollar/interfaces/IAmo.sol/interface.IAmo.md) - [IBondingCurve](src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md) - [ICreditNft](src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md) - [ICreditNftManager](src/dollar/interfaces/ICreditNftManager.sol/interface.ICreditNftManager.md) @@ -58,6 +63,7 @@ - [IStableSwap3Pool](src/dollar/interfaces/IStableSwap3Pool.sol/interface.IStableSwap3Pool.md) - [IStaking](src/dollar/interfaces/IStaking.sol/interface.IStaking.md) - [IStakingShare](src/dollar/interfaces/IStakingShare.sol/interface.IStakingShare.md) + - [IUbiquityAmoMinter](src/dollar/interfaces/IUbiquityAmoMinter.sol/interface.IUbiquityAmoMinter.md) - [IUbiquityChef](src/dollar/interfaces/IUbiquityChef.sol/interface.IUbiquityChef.md) - [IUbiquityDollarManager](src/dollar/interfaces/IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md) - [IUbiquityDollarToken](src/dollar/interfaces/IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md) diff --git a/packages/contracts/docs/src/src/dollar/Diamond.sol/contract.Diamond.md b/packages/contracts/docs/src/src/dollar/Diamond.sol/contract.Diamond.md index d1aa6d28f..92544c71b 100644 --- a/packages/contracts/docs/src/src/dollar/Diamond.sol/contract.Diamond.md +++ b/packages/contracts/docs/src/src/dollar/Diamond.sol/contract.Diamond.md @@ -1,5 +1,5 @@ # Diamond -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/Diamond.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/Diamond.sol) Contract that implements diamond proxy pattern diff --git a/packages/contracts/docs/src/src/dollar/Diamond.sol/struct.DiamondArgs.md b/packages/contracts/docs/src/src/dollar/Diamond.sol/struct.DiamondArgs.md index aae0794f0..6d8abbda6 100644 --- a/packages/contracts/docs/src/src/dollar/Diamond.sol/struct.DiamondArgs.md +++ b/packages/contracts/docs/src/src/dollar/Diamond.sol/struct.DiamondArgs.md @@ -1,5 +1,5 @@ # DiamondArgs -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/Diamond.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/Diamond.sol) Struct used for `Diamond` constructor args diff --git a/packages/contracts/docs/src/src/dollar/README.md b/packages/contracts/docs/src/src/dollar/README.md index fa02f431e..439ad69db 100644 --- a/packages/contracts/docs/src/src/dollar/README.md +++ b/packages/contracts/docs/src/src/dollar/README.md @@ -2,6 +2,7 @@ # Contents - [access](/src/dollar/access) +- [amo](/src/dollar/amo) - [core](/src/dollar/core) - [facets](/src/dollar/facets) - [interfaces](/src/dollar/interfaces) diff --git a/packages/contracts/docs/src/src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md b/packages/contracts/docs/src/src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md index 166cae581..54a21e7ed 100644 --- a/packages/contracts/docs/src/src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md +++ b/packages/contracts/docs/src/src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md @@ -1,5 +1,5 @@ # AccessControlInternal -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/access/AccessControlInternal.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/access/AccessControlInternal.sol) Role-based access control system diff --git a/packages/contracts/docs/src/src/dollar/amo/AaveAmo.sol/contract.AaveAmo.md b/packages/contracts/docs/src/src/dollar/amo/AaveAmo.sol/contract.AaveAmo.md new file mode 100644 index 000000000..ac36f6ac6 --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/amo/AaveAmo.sol/contract.AaveAmo.md @@ -0,0 +1,218 @@ +# AaveAmo +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/amo/AaveAmo.sol) + +**Inherits:** +[IAmo](/src/dollar/interfaces/IAmo.sol/interface.IAmo.md), Ownable + +AMO to interact with Aave V3: supply and manage rewards. + +Can receive collateral from UbiquityAmoMinter and interact with Aave's V3 pool. + + +## State Variables +### amoMinter +UbiquityAmoMinter instance + + +```solidity +UbiquityAmoMinter public amoMinter; +``` + + +### aavePool +Aave V3 pool instance + + +```solidity +IPool public immutable aavePool; +``` + + +### aaveRewardsController +Aave rewards controller + + +```solidity +IRewardsController public immutable aaveRewardsController; +``` + + +## Functions +### constructor + +Initializes the contract with necessary parameters + + +```solidity +constructor(address _ownerAddress, address _amoMinterAddress, address _aavePool, address _aaveRewardsController); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_ownerAddress`|`address`|Address of the contract owner| +|`_amoMinterAddress`|`address`|Address of the Ubiquity Amo minter| +|`_aavePool`|`address`|Address of the Aave pool| +|`_aaveRewardsController`|`address`|Address of the Aave rewards controller| + + +### aaveDepositCollateral + +Deposits collateral to Aave pool + + +```solidity +function aaveDepositCollateral(address collateralAddress, uint256 amount) public onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAddress`|`address`|Address of the collateral ERC20| +|`amount`|`uint256`|Amount of collateral to deposit| + + +### aaveWithdrawCollateral + +Withdraws collateral from Aave pool + + +```solidity +function aaveWithdrawCollateral(address collateralAddress, uint256 aTokenAmount) public onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAddress`|`address`|Address of the collateral ERC20| +|`aTokenAmount`|`uint256`|Amount of collateral to withdraw| + + +### claimAllRewards + +Claims all rewards available from the list of assets provided, will fail if balance on asset is zero + + +```solidity +function claimAllRewards(address[] memory assets) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`assets`|`address[]`|Array of aTokens/sTokens/vTokens addresses to claim rewards from| + + +### returnCollateralToMinter + +Returns collateral back to the AMO minter + + +```solidity +function returnCollateralToMinter(uint256 collateralAmount) public override onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAmount`|`uint256`|Amount of collateral to return, pass 0 to return all collateral| + + +### setAmoMinter + +Sets the AMO minter address + + +```solidity +function setAmoMinter(address _amoMinterAddress) external override onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_amoMinterAddress`|`address`|New address of the AMO minter| + + +### recoverERC20 + +Recovers any ERC20 tokens held by the contract + + +```solidity +function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenAddress`|`address`|Address of the token to recover| +|`tokenAmount`|`uint256`|Amount of tokens to recover| + + +### execute + +Executes arbitrary calls from this contract + + +```solidity +function execute(address _to, uint256 _value, bytes calldata _data) external onlyOwner returns (bool, bytes memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_to`|`address`|Address to call| +|`_value`|`uint256`|Value to send| +|`_data`|`bytes`|Data to execute| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|success, result Returns whether the call succeeded and the returned data| +|``|`bytes`|| + + +## Events +### CollateralDeposited + +```solidity +event CollateralDeposited(address indexed collateralAddress, uint256 amount); +``` + +### CollateralWithdrawn + +```solidity +event CollateralWithdrawn(address indexed collateralAddress, uint256 amount); +``` + +### CollateralReturnedToMinter + +```solidity +event CollateralReturnedToMinter(uint256 amount); +``` + +### RewardsClaimed + +```solidity +event RewardsClaimed(); +``` + +### AmoMinterSet + +```solidity +event AmoMinterSet(address indexed newMinter); +``` + +### ERC20Recovered + +```solidity +event ERC20Recovered(address tokenAddress, uint256 tokenAmount); +``` + +### ExecuteCalled + +```solidity +event ExecuteCalled(address indexed to, uint256 value, bytes data); +``` + diff --git a/packages/contracts/docs/src/src/dollar/amo/README.md b/packages/contracts/docs/src/src/dollar/amo/README.md new file mode 100644 index 000000000..db3fee1bf --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/amo/README.md @@ -0,0 +1,4 @@ + + +# Contents +- [AaveAmo](AaveAmo.sol/contract.AaveAmo.md) diff --git a/packages/contracts/docs/src/src/dollar/core/CreditNft.sol/contract.CreditNft.md b/packages/contracts/docs/src/src/dollar/core/CreditNft.sol/contract.CreditNft.md index 9328ca5fc..60611e801 100644 --- a/packages/contracts/docs/src/src/dollar/core/CreditNft.sol/contract.CreditNft.md +++ b/packages/contracts/docs/src/src/dollar/core/CreditNft.sol/contract.CreditNft.md @@ -1,5 +1,5 @@ # CreditNft -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/CreditNft.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/CreditNft.sol) **Inherits:** [ERC1155Ubiquity](/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md), [ICreditNft](/src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md) diff --git a/packages/contracts/docs/src/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md b/packages/contracts/docs/src/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md index be4661809..48602fc7a 100644 --- a/packages/contracts/docs/src/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md +++ b/packages/contracts/docs/src/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md @@ -1,5 +1,5 @@ # ERC1155Ubiquity -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/ERC1155Ubiquity.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/ERC1155Ubiquity.sol) **Inherits:** Initializable, ERC1155BurnableUpgradeable, ERC1155PausableUpgradeable, UUPSUpgradeable diff --git a/packages/contracts/docs/src/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md b/packages/contracts/docs/src/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md index cfda79370..8a47231ae 100644 --- a/packages/contracts/docs/src/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md +++ b/packages/contracts/docs/src/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md @@ -1,5 +1,5 @@ # ERC20Ubiquity -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/ERC20Ubiquity.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/ERC20Ubiquity.sol) **Inherits:** Initializable, UUPSUpgradeable, ERC20Upgradeable, ERC20PermitUpgradeable, ERC20PausableUpgradeable diff --git a/packages/contracts/docs/src/src/dollar/core/README.md b/packages/contracts/docs/src/src/dollar/core/README.md index c6373b440..fcbc2c6b1 100644 --- a/packages/contracts/docs/src/src/dollar/core/README.md +++ b/packages/contracts/docs/src/src/dollar/core/README.md @@ -5,6 +5,7 @@ - [ERC1155Ubiquity](ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md) - [ERC20Ubiquity](ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md) - [StakingShare](StakingShare.sol/contract.StakingShare.md) +- [UbiquityAmoMinter](UbiquityAmoMinter.sol/contract.UbiquityAmoMinter.md) - [UbiquityCreditToken](UbiquityCreditToken.sol/contract.UbiquityCreditToken.md) - [UbiquityDollarToken](UbiquityDollarToken.sol/contract.UbiquityDollarToken.md) - [UbiquityGovernanceToken](UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md) diff --git a/packages/contracts/docs/src/src/dollar/core/StakingShare.sol/contract.StakingShare.md b/packages/contracts/docs/src/src/dollar/core/StakingShare.sol/contract.StakingShare.md index 726bcda1d..b521ae354 100644 --- a/packages/contracts/docs/src/src/dollar/core/StakingShare.sol/contract.StakingShare.md +++ b/packages/contracts/docs/src/src/dollar/core/StakingShare.sol/contract.StakingShare.md @@ -1,5 +1,5 @@ # StakingShare -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/StakingShare.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/StakingShare.sol) **Inherits:** [ERC1155Ubiquity](/src/dollar/core/ERC1155Ubiquity.sol/abstract.ERC1155Ubiquity.md), ERC1155URIStorageUpgradeable diff --git a/packages/contracts/docs/src/src/dollar/core/UbiquityAmoMinter.sol/contract.UbiquityAmoMinter.md b/packages/contracts/docs/src/src/dollar/core/UbiquityAmoMinter.sol/contract.UbiquityAmoMinter.md new file mode 100644 index 000000000..6b8584639 --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/core/UbiquityAmoMinter.sol/contract.UbiquityAmoMinter.md @@ -0,0 +1,263 @@ +# UbiquityAmoMinter +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/UbiquityAmoMinter.sol) + +**Inherits:** +Ownable + +Contract responsible for managing collateral borrowing from Ubiquity's Pool to AMOs. + +Allows owner to move Dollar collateral to AMOs, enabling yield generation. + +It keeps track of borrowed collateral balances per Amo and the total borrowed sum. + + +## State Variables +### collateralToken +Collateral token used by the AMO minter + + +```solidity +ERC20 public immutable collateralToken; +``` + + +### pool +Ubiquity pool interface + + +```solidity +IUbiquityPool public pool; +``` + + +### collateralAddress +Collateral-related properties + + +```solidity +address public immutable collateralAddress; +``` + + +### collateralIndex + +```solidity +uint256 public immutable collateralIndex; +``` + + +### missingDecimals + +```solidity +uint256 public immutable missingDecimals; +``` + + +### collateralBorrowCap + +```solidity +int256 public collateralBorrowCap = int256(100_000e18); +``` + + +### collateralBorrowedBalances +Mapping for tracking borrowed collateral balances per AMO + + +```solidity +mapping(address => int256) public collateralBorrowedBalances; +``` + + +### collateralTotalBorrowedBalance +Sum of all collateral borrowed across Amos + + +```solidity +int256 public collateralTotalBorrowedBalance = 0; +``` + + +### Amos +Mapping to track active AMOs + + +```solidity +mapping(address => bool) public Amos; +``` + + +## Functions +### constructor + +Initializes the Amo minter contract + + +```solidity +constructor(address _ownerAddress, address _collateralAddress, uint256 _collateralIndex, address _poolAddress); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_ownerAddress`|`address`|Address of the contract owner| +|`_collateralAddress`|`address`|Address of the collateral token| +|`_collateralIndex`|`uint256`|Index of the collateral in the pool| +|`_poolAddress`|`address`|Address of the Ubiquity pool| + + +### validAmo + +Ensures the caller is a valid AMO + + +```solidity +modifier validAmo(address amoAddress); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amoAddress`|`address`|Address of the AMO to check| + + +### enableAmo + +Enables an AMO + + +```solidity +function enableAmo(address amo) external onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amo`|`address`|Address of the AMO to enable| + + +### disableAmo + +Disables an AMO + + +```solidity +function disableAmo(address amo) external onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amo`|`address`|Address of the AMO to disable| + + +### giveCollateralToAmo + +Transfers collateral to the specified AMO + + +```solidity +function giveCollateralToAmo(address destinationAmo, uint256 collateralAmount) + external + onlyOwner + validAmo(destinationAmo); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`destinationAmo`|`address`|Address of the AMO to receive collateral| +|`collateralAmount`|`uint256`|Amount of collateral to transfer| + + +### receiveCollateralFromAmo + +Receives collateral back from an AMO + + +```solidity +function receiveCollateralFromAmo(uint256 collateralAmount) external validAmo(msg.sender); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAmount`|`uint256`|Amount of collateral being returned| + + +### setCollateralBorrowCap + +Updates the collateral borrow cap + + +```solidity +function setCollateralBorrowCap(uint256 _collateralBorrowCap) external onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_collateralBorrowCap`|`uint256`|New collateral borrow cap| + + +### setPool + +Updates the pool address + + +```solidity +function setPool(address _poolAddress) external onlyOwner; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_poolAddress`|`address`|New pool address| + + +### collateralDollarBalance + +Returns the total value of borrowed collateral + + +```solidity +function collateralDollarBalance() external view returns (uint256); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|Total balance of collateral borrowed| + + +## Events +### CollateralGivenToAmo + +```solidity +event CollateralGivenToAmo(address destinationAmo, uint256 collateralAmount); +``` + +### CollateralReceivedFromAmo + +```solidity +event CollateralReceivedFromAmo(address sourceAmo, uint256 collateralAmount); +``` + +### CollateralBorrowCapSet + +```solidity +event CollateralBorrowCapSet(uint256 newCollateralBorrowCap); +``` + +### PoolSet + +```solidity +event PoolSet(address newPoolAddress); +``` + +### OwnershipTransferred + +```solidity +event OwnershipTransferred(address newOwner); +``` + diff --git a/packages/contracts/docs/src/src/dollar/core/UbiquityCreditToken.sol/contract.UbiquityCreditToken.md b/packages/contracts/docs/src/src/dollar/core/UbiquityCreditToken.sol/contract.UbiquityCreditToken.md index 5f6402d2e..39f64e94a 100644 --- a/packages/contracts/docs/src/src/dollar/core/UbiquityCreditToken.sol/contract.UbiquityCreditToken.md +++ b/packages/contracts/docs/src/src/dollar/core/UbiquityCreditToken.sol/contract.UbiquityCreditToken.md @@ -1,5 +1,5 @@ # UbiquityCreditToken -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/UbiquityCreditToken.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/UbiquityCreditToken.sol) **Inherits:** [ERC20Ubiquity](/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/core/UbiquityDollarToken.sol/contract.UbiquityDollarToken.md b/packages/contracts/docs/src/src/dollar/core/UbiquityDollarToken.sol/contract.UbiquityDollarToken.md index 02c941dc8..c1f010c03 100644 --- a/packages/contracts/docs/src/src/dollar/core/UbiquityDollarToken.sol/contract.UbiquityDollarToken.md +++ b/packages/contracts/docs/src/src/dollar/core/UbiquityDollarToken.sol/contract.UbiquityDollarToken.md @@ -1,5 +1,5 @@ # UbiquityDollarToken -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/UbiquityDollarToken.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/UbiquityDollarToken.sol) **Inherits:** [ERC20Ubiquity](/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/core/UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md b/packages/contracts/docs/src/src/dollar/core/UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md index 507e16c55..4dc51fc3a 100644 --- a/packages/contracts/docs/src/src/dollar/core/UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md +++ b/packages/contracts/docs/src/src/dollar/core/UbiquityGovernanceToken.sol/contract.UbiquityGovernanceToken.md @@ -1,5 +1,5 @@ # UbiquityGovernanceToken -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/core/UbiquityGovernanceToken.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/core/UbiquityGovernanceToken.sol) **Inherits:** [ERC20Ubiquity](/src/dollar/core/ERC20Ubiquity.sol/abstract.ERC20Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/AccessControlFacet.sol/contract.AccessControlFacet.md b/packages/contracts/docs/src/src/dollar/facets/AccessControlFacet.sol/contract.AccessControlFacet.md index a6cff7e93..b1136f14f 100644 --- a/packages/contracts/docs/src/src/dollar/facets/AccessControlFacet.sol/contract.AccessControlFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/AccessControlFacet.sol/contract.AccessControlFacet.md @@ -1,5 +1,5 @@ # AccessControlFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/AccessControlFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/AccessControlFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md), [IAccessControl](/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md), [AccessControlInternal](/src/dollar/access/AccessControlInternal.sol/abstract.AccessControlInternal.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/BondingCurveFacet.sol/contract.BondingCurveFacet.md b/packages/contracts/docs/src/src/dollar/facets/BondingCurveFacet.sol/contract.BondingCurveFacet.md index 6c1087b12..f285b6bb6 100644 --- a/packages/contracts/docs/src/src/dollar/facets/BondingCurveFacet.sol/contract.BondingCurveFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/BondingCurveFacet.sol/contract.BondingCurveFacet.md @@ -1,5 +1,5 @@ # BondingCurveFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/BondingCurveFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/BondingCurveFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md), [IBondingCurve](/src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/ChefFacet.sol/contract.ChefFacet.md b/packages/contracts/docs/src/src/dollar/facets/ChefFacet.sol/contract.ChefFacet.md index 3667509e0..f581c7f19 100644 --- a/packages/contracts/docs/src/src/dollar/facets/ChefFacet.sol/contract.ChefFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/ChefFacet.sol/contract.ChefFacet.md @@ -1,5 +1,5 @@ # ChefFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/ChefFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/ChefFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CollectableDustFacet.sol/contract.CollectableDustFacet.md b/packages/contracts/docs/src/src/dollar/facets/CollectableDustFacet.sol/contract.CollectableDustFacet.md index 22cbd6673..486f4865f 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CollectableDustFacet.sol/contract.CollectableDustFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CollectableDustFacet.sol/contract.CollectableDustFacet.md @@ -1,5 +1,5 @@ # CollectableDustFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CollectableDustFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CollectableDustFacet.sol) **Inherits:** [ICollectableDust](/src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md), [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CreditClockFacet.sol/contract.CreditClockFacet.md b/packages/contracts/docs/src/src/dollar/facets/CreditClockFacet.sol/contract.CreditClockFacet.md index 825fef503..f6e83d8ed 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CreditClockFacet.sol/contract.CreditClockFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CreditClockFacet.sol/contract.CreditClockFacet.md @@ -1,5 +1,5 @@ # CreditClockFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CreditClockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CreditClockFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CreditNftManagerFacet.sol/contract.CreditNftManagerFacet.md b/packages/contracts/docs/src/src/dollar/facets/CreditNftManagerFacet.sol/contract.CreditNftManagerFacet.md index 3f68dac7e..086206504 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CreditNftManagerFacet.sol/contract.CreditNftManagerFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CreditNftManagerFacet.sol/contract.CreditNftManagerFacet.md @@ -1,5 +1,5 @@ # CreditNftManagerFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CreditNftManagerFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CreditNftManagerFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol/contract.CreditNftRedemptionCalculatorFacet.md b/packages/contracts/docs/src/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol/contract.CreditNftRedemptionCalculatorFacet.md index f52049f31..1c55e942b 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol/contract.CreditNftRedemptionCalculatorFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol/contract.CreditNftRedemptionCalculatorFacet.md @@ -1,5 +1,5 @@ # CreditNftRedemptionCalculatorFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CreditNftRedemptionCalculatorFacet.sol) **Inherits:** [ICreditNftRedemptionCalculator](/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol/interface.ICreditNftRedemptionCalculator.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CreditRedemptionCalculatorFacet.sol/contract.CreditRedemptionCalculatorFacet.md b/packages/contracts/docs/src/src/dollar/facets/CreditRedemptionCalculatorFacet.sol/contract.CreditRedemptionCalculatorFacet.md index 7472ea2c7..44ec118ea 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CreditRedemptionCalculatorFacet.sol/contract.CreditRedemptionCalculatorFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CreditRedemptionCalculatorFacet.sol/contract.CreditRedemptionCalculatorFacet.md @@ -1,5 +1,5 @@ # CreditRedemptionCalculatorFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CreditRedemptionCalculatorFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CreditRedemptionCalculatorFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md), [ICreditRedemptionCalculator](/src/dollar/interfaces/ICreditRedemptionCalculator.sol/interface.ICreditRedemptionCalculator.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/CurveDollarIncentiveFacet.sol/contract.CurveDollarIncentiveFacet.md b/packages/contracts/docs/src/src/dollar/facets/CurveDollarIncentiveFacet.sol/contract.CurveDollarIncentiveFacet.md index 99565c9cb..57e5467e4 100644 --- a/packages/contracts/docs/src/src/dollar/facets/CurveDollarIncentiveFacet.sol/contract.CurveDollarIncentiveFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/CurveDollarIncentiveFacet.sol/contract.CurveDollarIncentiveFacet.md @@ -1,5 +1,5 @@ # CurveDollarIncentiveFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/CurveDollarIncentiveFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/CurveDollarIncentiveFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/DiamondCutFacet.sol/contract.DiamondCutFacet.md b/packages/contracts/docs/src/src/dollar/facets/DiamondCutFacet.sol/contract.DiamondCutFacet.md index fd0f36a74..edb2418c0 100644 --- a/packages/contracts/docs/src/src/dollar/facets/DiamondCutFacet.sol/contract.DiamondCutFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/DiamondCutFacet.sol/contract.DiamondCutFacet.md @@ -1,5 +1,5 @@ # DiamondCutFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/DiamondCutFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/DiamondCutFacet.sol) **Inherits:** [IDiamondCut](/src/dollar/interfaces/IDiamondCut.sol/interface.IDiamondCut.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/DiamondLoupeFacet.sol/contract.DiamondLoupeFacet.md b/packages/contracts/docs/src/src/dollar/facets/DiamondLoupeFacet.sol/contract.DiamondLoupeFacet.md index 7e6c85687..df3a554d7 100644 --- a/packages/contracts/docs/src/src/dollar/facets/DiamondLoupeFacet.sol/contract.DiamondLoupeFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/DiamondLoupeFacet.sol/contract.DiamondLoupeFacet.md @@ -1,5 +1,5 @@ # DiamondLoupeFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/DiamondLoupeFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/DiamondLoupeFacet.sol) **Inherits:** [IDiamondLoupe](/src/dollar/interfaces/IDiamondLoupe.sol/interface.IDiamondLoupe.md), IERC165 diff --git a/packages/contracts/docs/src/src/dollar/facets/DirectGovernanceFarmerFacet.sol/contract.DirectGovernanceFarmerFacet.md b/packages/contracts/docs/src/src/dollar/facets/DirectGovernanceFarmerFacet.sol/contract.DirectGovernanceFarmerFacet.md index 8248d5627..159d00c65 100644 --- a/packages/contracts/docs/src/src/dollar/facets/DirectGovernanceFarmerFacet.sol/contract.DirectGovernanceFarmerFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/DirectGovernanceFarmerFacet.sol/contract.DirectGovernanceFarmerFacet.md @@ -1,5 +1,5 @@ # DirectGovernanceFarmerFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/DirectGovernanceFarmerFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/DirectGovernanceFarmerFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/DollarMintCalculatorFacet.sol/contract.DollarMintCalculatorFacet.md b/packages/contracts/docs/src/src/dollar/facets/DollarMintCalculatorFacet.sol/contract.DollarMintCalculatorFacet.md index 2c076796b..d661d41d5 100644 --- a/packages/contracts/docs/src/src/dollar/facets/DollarMintCalculatorFacet.sol/contract.DollarMintCalculatorFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/DollarMintCalculatorFacet.sol/contract.DollarMintCalculatorFacet.md @@ -1,5 +1,5 @@ # DollarMintCalculatorFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/DollarMintCalculatorFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/DollarMintCalculatorFacet.sol) **Inherits:** [IDollarMintCalculator](/src/dollar/interfaces/IDollarMintCalculator.sol/interface.IDollarMintCalculator.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/DollarMintExcessFacet.sol/contract.DollarMintExcessFacet.md b/packages/contracts/docs/src/src/dollar/facets/DollarMintExcessFacet.sol/contract.DollarMintExcessFacet.md index 65304cd71..1e1e566c3 100644 --- a/packages/contracts/docs/src/src/dollar/facets/DollarMintExcessFacet.sol/contract.DollarMintExcessFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/DollarMintExcessFacet.sol/contract.DollarMintExcessFacet.md @@ -1,5 +1,5 @@ # DollarMintExcessFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/DollarMintExcessFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/DollarMintExcessFacet.sol) **Inherits:** [IDollarMintExcess](/src/dollar/interfaces/IDollarMintExcess.sol/interface.IDollarMintExcess.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/ManagerFacet.sol/contract.ManagerFacet.md b/packages/contracts/docs/src/src/dollar/facets/ManagerFacet.sol/contract.ManagerFacet.md index 277ee2f2e..539f24416 100644 --- a/packages/contracts/docs/src/src/dollar/facets/ManagerFacet.sol/contract.ManagerFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/ManagerFacet.sol/contract.ManagerFacet.md @@ -1,5 +1,5 @@ # ManagerFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/ManagerFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/ManagerFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/OwnershipFacet.sol/contract.OwnershipFacet.md b/packages/contracts/docs/src/src/dollar/facets/OwnershipFacet.sol/contract.OwnershipFacet.md index e5f9bceef..955459b2f 100644 --- a/packages/contracts/docs/src/src/dollar/facets/OwnershipFacet.sol/contract.OwnershipFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/OwnershipFacet.sol/contract.OwnershipFacet.md @@ -1,5 +1,5 @@ # OwnershipFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/OwnershipFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/OwnershipFacet.sol) **Inherits:** [IERC173](/src/dollar/interfaces/IERC173.sol/interface.IERC173.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/StakingFacet.sol/contract.StakingFacet.md b/packages/contracts/docs/src/src/dollar/facets/StakingFacet.sol/contract.StakingFacet.md index 3a8ab3dc5..1f6b0a802 100644 --- a/packages/contracts/docs/src/src/dollar/facets/StakingFacet.sol/contract.StakingFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/StakingFacet.sol/contract.StakingFacet.md @@ -1,5 +1,5 @@ # StakingFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/StakingFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/StakingFacet.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md), [IStaking](/src/dollar/interfaces/IStaking.sol/interface.IStaking.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/StakingFormulasFacet.sol/contract.StakingFormulasFacet.md b/packages/contracts/docs/src/src/dollar/facets/StakingFormulasFacet.sol/contract.StakingFormulasFacet.md index 2ff10f594..e646171a2 100644 --- a/packages/contracts/docs/src/src/dollar/facets/StakingFormulasFacet.sol/contract.StakingFormulasFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/StakingFormulasFacet.sol/contract.StakingFormulasFacet.md @@ -1,5 +1,5 @@ # StakingFormulasFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/StakingFormulasFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/StakingFormulasFacet.sol) **Inherits:** [IUbiquityFormulas](/src/dollar/interfaces/IUbiquityFormulas.sol/interface.IUbiquityFormulas.md) diff --git a/packages/contracts/docs/src/src/dollar/facets/UbiquityPoolFacet.sol/contract.UbiquityPoolFacet.md b/packages/contracts/docs/src/src/dollar/facets/UbiquityPoolFacet.sol/contract.UbiquityPoolFacet.md index 5353514e1..a47151639 100644 --- a/packages/contracts/docs/src/src/dollar/facets/UbiquityPoolFacet.sol/contract.UbiquityPoolFacet.md +++ b/packages/contracts/docs/src/src/dollar/facets/UbiquityPoolFacet.sol/contract.UbiquityPoolFacet.md @@ -1,5 +1,5 @@ # UbiquityPoolFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/facets/UbiquityPoolFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/facets/UbiquityPoolFacet.sol) **Inherits:** [IUbiquityPool](/src/dollar/interfaces/IUbiquityPool.sol/interface.IUbiquityPool.md), [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IAaveAmo.sol/interface.IAaveAmo.md b/packages/contracts/docs/src/src/dollar/interfaces/IAaveAmo.sol/interface.IAaveAmo.md new file mode 100644 index 000000000..0db5ab4fe --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/interfaces/IAaveAmo.sol/interface.IAaveAmo.md @@ -0,0 +1,229 @@ +# IAaveAmo +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IAaveAmo.sol) + + +## Functions +### aaveDepositCollateral + +Deposits collateral into the Aave pool + + +```solidity +function aaveDepositCollateral(address collateralAddress, uint256 amount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAddress`|`address`|Address of the collateral ERC20 token| +|`amount`|`uint256`|Amount of collateral to deposit| + + +### aaveWithdrawCollateral + +Withdraws collateral from the Aave pool + + +```solidity +function aaveWithdrawCollateral(address collateralAddress, uint256 aTokenAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAddress`|`address`|Address of the collateral ERC20 token| +|`aTokenAmount`|`uint256`|Amount of aTokens (collateral) to withdraw| + + +### aaveBorrow + +Borrows an asset from the Aave pool + + +```solidity +function aaveBorrow(address asset, uint256 borrowAmount, uint256 interestRateMode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`asset`|`address`|Address of the asset to borrow| +|`borrowAmount`|`uint256`|Amount of the asset to borrow| +|`interestRateMode`|`uint256`|Interest rate mode: 1 for stable, 2 for variable| + + +### aaveRepay + +Repays a borrowed asset to the Aave pool + + +```solidity +function aaveRepay(address asset, uint256 repayAmount, uint256 interestRateMode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`asset`|`address`|Address of the asset to repay| +|`repayAmount`|`uint256`|Amount of the asset to repay| +|`interestRateMode`|`uint256`|Interest rate mode: 1 for stable, 2 for variable| + + +### claimAllRewards + +Claims all rewards from the provided assets + + +```solidity +function claimAllRewards(address[] memory assets) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`assets`|`address[]`|Array of aTokens/sTokens/vTokens addresses to claim rewards from| + + +### returnCollateralToMinter + +Returns collateral back to the AMO minter + + +```solidity +function returnCollateralToMinter(uint256 collateralAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAmount`|`uint256`|Amount of collateral to return| + + +### setAmoMinter + +Sets the address of the AMO minter + + +```solidity +function setAmoMinter(address _amoMinterAddress) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_amoMinterAddress`|`address`|New address of the AMO minter| + + +### recoverERC20 + +Recovers any ERC20 tokens held by the contract + + +```solidity +function recoverERC20(address tokenAddress, uint256 tokenAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenAddress`|`address`|Address of the token to recover| +|`tokenAmount`|`uint256`|Amount of tokens to recover| + + +### execute + +Executes an arbitrary call from the contract + + +```solidity +function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_to`|`address`|Address to call| +|`_value`|`uint256`|Value to send with the call| +|`_data`|`bytes`|Data to execute in the call| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|success Boolean indicating whether the call succeeded| +|``|`bytes`|result Bytes data returned from the call| + + +## Events +### CollateralDeposited +Emitted when collateral is deposited into the Aave pool + + +```solidity +event CollateralDeposited(address indexed collateralAddress, uint256 amount); +``` + +### CollateralWithdrawn +Emitted when collateral is withdrawn from the Aave pool + + +```solidity +event CollateralWithdrawn(address indexed collateralAddress, uint256 amount); +``` + +### Borrowed +Emitted when an asset is borrowed from the Aave pool + + +```solidity +event Borrowed(address indexed asset, uint256 amount, uint256 interestRateMode); +``` + +### Repaid +Emitted when a borrowed asset is repaid to the Aave pool + + +```solidity +event Repaid(address indexed asset, uint256 amount, uint256 interestRateMode); +``` + +### CollateralReturnedToMinter +Emitted when collateral is returned to the AMO minter + + +```solidity +event CollateralReturnedToMinter(uint256 amount); +``` + +### RewardsClaimed +Emitted when rewards are claimed + + +```solidity +event RewardsClaimed(); +``` + +### AmoMinterSet +Emitted when the AMO minter address is set + + +```solidity +event AmoMinterSet(address indexed newMinter); +``` + +### ERC20Recovered +Emitted when ERC20 tokens are recovered from the contract + + +```solidity +event ERC20Recovered(address tokenAddress, uint256 tokenAmount); +``` + +### ExecuteCalled +Emitted when an arbitrary call is executed from the contract + + +```solidity +event ExecuteCalled(address indexed to, uint256 value, bytes data); +``` + diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md b/packages/contracts/docs/src/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md index 4f08d24b7..517ef048e 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md @@ -1,5 +1,5 @@ # IAccessControl -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IAccessControl.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IAccessControl.sol) Access contol interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IAmo.sol/interface.IAmo.md b/packages/contracts/docs/src/src/dollar/interfaces/IAmo.sol/interface.IAmo.md new file mode 100644 index 000000000..d56537ea6 --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/interfaces/IAmo.sol/interface.IAmo.md @@ -0,0 +1,35 @@ +# IAmo +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IAmo.sol) + + +## Functions +### returnCollateralToMinter + +Returns collateral back to the AMO minter + + +```solidity +function returnCollateralToMinter(uint256 collateralAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAmount`|`uint256`|Amount of collateral to return| + + +### setAmoMinter + +Sets the address of the AMO minter + + +```solidity +function setAmoMinter(address _amoMinterAddress) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_amoMinterAddress`|`address`|New address of the AMO minter| + + diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md b/packages/contracts/docs/src/src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md index 5860075a3..ed667ed9f 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IBondingCurve.sol/interface.IBondingCurve.md @@ -1,5 +1,5 @@ # IBondingCurve -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IBondingCurve.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IBondingCurve.sol) Interface based on Bancor formula diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md index 0d4f37d73..2d610cf32 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNft.sol/interface.ICreditNft.md @@ -1,5 +1,5 @@ # ICreditNft -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICreditNft.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICreditNft.sol) **Inherits:** IERC1155Upgradeable diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftManager.sol/interface.ICreditNftManager.md b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftManager.sol/interface.ICreditNftManager.md index 2220b8aa1..43a80d1ae 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftManager.sol/interface.ICreditNftManager.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftManager.sol/interface.ICreditNftManager.md @@ -1,5 +1,5 @@ # ICreditNftManager -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICreditNftManager.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICreditNftManager.sol) **Inherits:** IERC1155Receiver diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol/interface.ICreditNftRedemptionCalculator.md b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol/interface.ICreditNftRedemptionCalculator.md index d77cb5c63..f921cb01f 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol/interface.ICreditNftRedemptionCalculator.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol/interface.ICreditNftRedemptionCalculator.md @@ -1,5 +1,5 @@ # ICreditNftRedemptionCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICreditNftRedemptionCalculator.sol) Contract interface for calculating amount of Credit NFTs to mint on Dollars burn diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICreditRedemptionCalculator.sol/interface.ICreditRedemptionCalculator.md b/packages/contracts/docs/src/src/dollar/interfaces/ICreditRedemptionCalculator.sol/interface.ICreditRedemptionCalculator.md index 4d74ea815..257c69e82 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICreditRedemptionCalculator.sol/interface.ICreditRedemptionCalculator.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICreditRedemptionCalculator.sol/interface.ICreditRedemptionCalculator.md @@ -1,5 +1,5 @@ # ICreditRedemptionCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICreditRedemptionCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICreditRedemptionCalculator.sol) Contract interface for calculating amount of Credits to mint on Dollars burn diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICurveFactory.sol/interface.ICurveFactory.md b/packages/contracts/docs/src/src/dollar/interfaces/ICurveFactory.sol/interface.ICurveFactory.md index 6f856f202..1532da781 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICurveFactory.sol/interface.ICurveFactory.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICurveFactory.sol/interface.ICurveFactory.md @@ -1,5 +1,5 @@ # ICurveFactory -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICurveFactory.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICurveFactory.sol) Curve Factory interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol/interface.ICurveStableSwapFactoryNG.md b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol/interface.ICurveStableSwapFactoryNG.md index fa572ecb3..245835378 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol/interface.ICurveStableSwapFactoryNG.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol/interface.ICurveStableSwapFactoryNG.md @@ -1,5 +1,5 @@ # ICurveStableSwapFactoryNG -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICurveStableSwapFactoryNG.sol) Factory allows the permissionless deployment of up to eight-coin plain pools (ex: DAI-USDT-USDC) and metapools (ex: USDT-3CRV). diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md index e9cf8a223..ffa337b3b 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md @@ -1,5 +1,5 @@ # ICurveStableSwapMetaNG -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICurveStableSwapMetaNG.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICurveStableSwapMetaNG.sol) **Inherits:** IERC20 diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapNG.sol/interface.ICurveStableSwapNG.md b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapNG.sol/interface.ICurveStableSwapNG.md index c75907127..05796aea0 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapNG.sol/interface.ICurveStableSwapNG.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICurveStableSwapNG.sol/interface.ICurveStableSwapNG.md @@ -1,5 +1,5 @@ # ICurveStableSwapNG -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICurveStableSwapNG.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICurveStableSwapNG.sol) **Inherits:** [ICurveStableSwapMetaNG](/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/ICurveTwocryptoOptimized.sol/interface.ICurveTwocryptoOptimized.md b/packages/contracts/docs/src/src/dollar/interfaces/ICurveTwocryptoOptimized.sol/interface.ICurveTwocryptoOptimized.md index e5b52a380..ad92f26d7 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/ICurveTwocryptoOptimized.sol/interface.ICurveTwocryptoOptimized.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/ICurveTwocryptoOptimized.sol/interface.ICurveTwocryptoOptimized.md @@ -1,5 +1,5 @@ # ICurveTwocryptoOptimized -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/ICurveTwocryptoOptimized.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/ICurveTwocryptoOptimized.sol) **Inherits:** [ICurveStableSwapMetaNG](/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDepositZap.sol/interface.IDepositZap.md b/packages/contracts/docs/src/src/dollar/interfaces/IDepositZap.sol/interface.IDepositZap.md index e11c81fa9..c8d587fb3 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDepositZap.sol/interface.IDepositZap.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDepositZap.sol/interface.IDepositZap.md @@ -1,5 +1,5 @@ # IDepositZap -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDepositZap.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDepositZap.sol) Interface for Curve's Deposit Zap diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDiamondCut.sol/interface.IDiamondCut.md b/packages/contracts/docs/src/src/dollar/interfaces/IDiamondCut.sol/interface.IDiamondCut.md index 42f193aaf..d61303bb2 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDiamondCut.sol/interface.IDiamondCut.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDiamondCut.sol/interface.IDiamondCut.md @@ -1,5 +1,5 @@ # IDiamondCut -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDiamondCut.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDiamondCut.sol) Interface that allows modifications to diamond function selector mapping diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDiamondLoupe.sol/interface.IDiamondLoupe.md b/packages/contracts/docs/src/src/dollar/interfaces/IDiamondLoupe.sol/interface.IDiamondLoupe.md index bc3d464cc..9a0dd2678 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDiamondLoupe.sol/interface.IDiamondLoupe.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDiamondLoupe.sol/interface.IDiamondLoupe.md @@ -1,5 +1,5 @@ # IDiamondLoupe -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDiamondLoupe.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDiamondLoupe.sol) A loupe is a small magnifying glass used to look at diamonds. These functions look at diamonds. diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDollarAmoMinter.sol/interface.IDollarAmoMinter.md b/packages/contracts/docs/src/src/dollar/interfaces/IDollarAmoMinter.sol/interface.IDollarAmoMinter.md index b30f1e92f..94535c13b 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDollarAmoMinter.sol/interface.IDollarAmoMinter.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDollarAmoMinter.sol/interface.IDollarAmoMinter.md @@ -1,5 +1,5 @@ # IDollarAmoMinter -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDollarAmoMinter.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDollarAmoMinter.sol) AMO minter interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintCalculator.sol/interface.IDollarMintCalculator.md b/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintCalculator.sol/interface.IDollarMintCalculator.md index e309623bf..9552be4c3 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintCalculator.sol/interface.IDollarMintCalculator.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintCalculator.sol/interface.IDollarMintCalculator.md @@ -1,5 +1,5 @@ # IDollarMintCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDollarMintCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDollarMintCalculator.sol) Interface for calculating amount of Dollars to be minted diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintExcess.sol/interface.IDollarMintExcess.md b/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintExcess.sol/interface.IDollarMintExcess.md index d995b1d39..2d150973a 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintExcess.sol/interface.IDollarMintExcess.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IDollarMintExcess.sol/interface.IDollarMintExcess.md @@ -1,5 +1,5 @@ # IDollarMintExcess -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IDollarMintExcess.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IDollarMintExcess.sol) Interface for distributing excess Dollars when `mintClaimableDollars()` is called diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IERC1155Ubiquity.sol/interface.IERC1155Ubiquity.md b/packages/contracts/docs/src/src/dollar/interfaces/IERC1155Ubiquity.sol/interface.IERC1155Ubiquity.md index 5cd3cc222..fc49aa09e 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IERC1155Ubiquity.sol/interface.IERC1155Ubiquity.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IERC1155Ubiquity.sol/interface.IERC1155Ubiquity.md @@ -1,5 +1,5 @@ # IERC1155Ubiquity -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IERC1155Ubiquity.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IERC1155Ubiquity.sol) **Inherits:** IERC1155 diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IERC173.sol/interface.IERC173.md b/packages/contracts/docs/src/src/dollar/interfaces/IERC173.sol/interface.IERC173.md index 1f9c03c31..5a463807e 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IERC173.sol/interface.IERC173.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IERC173.sol/interface.IERC173.md @@ -1,5 +1,5 @@ # IERC173 -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IERC173.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IERC173.sol) ERC-173 Contract Ownership Standard diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md b/packages/contracts/docs/src/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md index 0165c9a08..cd0466536 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md @@ -1,5 +1,5 @@ # IERC20Ubiquity -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IERC20Ubiquity.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IERC20Ubiquity.sol) **Inherits:** IERC20, IERC20Permit diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IStableSwap3Pool.sol/interface.IStableSwap3Pool.md b/packages/contracts/docs/src/src/dollar/interfaces/IStableSwap3Pool.sol/interface.IStableSwap3Pool.md index 591df37f8..4c34d17bd 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IStableSwap3Pool.sol/interface.IStableSwap3Pool.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IStableSwap3Pool.sol/interface.IStableSwap3Pool.md @@ -1,5 +1,5 @@ # IStableSwap3Pool -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IStableSwap3Pool.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IStableSwap3Pool.sol) Curve TriPool interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IStaking.sol/interface.IStaking.md b/packages/contracts/docs/src/src/dollar/interfaces/IStaking.sol/interface.IStaking.md index f9047f1e7..2b97fa722 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IStaking.sol/interface.IStaking.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IStaking.sol/interface.IStaking.md @@ -1,5 +1,5 @@ # IStaking -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IStaking.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IStaking.sol) Staking interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IStakingShare.sol/interface.IStakingShare.md b/packages/contracts/docs/src/src/dollar/interfaces/IStakingShare.sol/interface.IStakingShare.md index fdefaaf87..fc922ea37 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IStakingShare.sol/interface.IStakingShare.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IStakingShare.sol/interface.IStakingShare.md @@ -1,5 +1,5 @@ # IStakingShare -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IStakingShare.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IStakingShare.sol) **Inherits:** [IERC1155Ubiquity](/src/dollar/interfaces/IERC1155Ubiquity.sol/interface.IERC1155Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityAmoMinter.sol/interface.IUbiquityAmoMinter.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityAmoMinter.sol/interface.IUbiquityAmoMinter.md new file mode 100644 index 000000000..363d009cf --- /dev/null +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityAmoMinter.sol/interface.IUbiquityAmoMinter.md @@ -0,0 +1,152 @@ +# IUbiquityAmoMinter +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityAmoMinter.sol) + + +## Functions +### enableAmo + +Enables an AMO for collateral transfers + + +```solidity +function enableAmo(address amo) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amo`|`address`|Address of the AMO to enable| + + +### disableAmo + +Disables an AMO, preventing further collateral transfers + + +```solidity +function disableAmo(address amo) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amo`|`address`|Address of the AMO to disable| + + +### giveCollateralToAmo + +Transfers collateral to a specified AMO + + +```solidity +function giveCollateralToAmo(address destinationAmo, uint256 collateralAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`destinationAmo`|`address`|Address of the AMO to receive collateral| +|`collateralAmount`|`uint256`|Amount of collateral to transfer| + + +### receiveCollateralFromAmo + +Receives collateral back from an AMO + + +```solidity +function receiveCollateralFromAmo(uint256 collateralAmount) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`collateralAmount`|`uint256`|Amount of collateral being returned| + + +### setCollateralBorrowCap + +Updates the maximum allowable borrowed collateral + + +```solidity +function setCollateralBorrowCap(uint256 _collateralBorrowCap) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_collateralBorrowCap`|`uint256`|New collateral borrow cap value| + + +### setPool + +Updates the address of the Ubiquity pool + + +```solidity +function setPool(address _poolAddress) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_poolAddress`|`address`|New pool address| + + +### collateralDollarBalance + +Returns the total balance of collateral borrowed by all AMOs + + +```solidity +function collateralDollarBalance() external view returns (uint256); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|Total balance of collateral borrowed| + + +## Events +### CollateralGivenToAmo +Emitted when collateral is given to an AMO + + +```solidity +event CollateralGivenToAmo(address destinationAmo, uint256 collateralAmount); +``` + +### CollateralReceivedFromAmo +Emitted when collateral is returned from an AMO + + +```solidity +event CollateralReceivedFromAmo(address sourceAmo, uint256 collateralAmount); +``` + +### CollateralBorrowCapSet +Emitted when the collateral borrow cap is updated + + +```solidity +event CollateralBorrowCapSet(uint256 newCollateralBorrowCap); +``` + +### PoolSet +Emitted when the Ubiquity pool address is updated + + +```solidity +event PoolSet(address newPoolAddress); +``` + +### OwnershipTransferred +Emitted when ownership of the contract is transferred + + +```solidity +event OwnershipTransferred(address newOwner); +``` + diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityChef.sol/interface.IUbiquityChef.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityChef.sol/interface.IUbiquityChef.md index af52d38fd..a8fa942fb 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityChef.sol/interface.IUbiquityChef.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityChef.sol/interface.IUbiquityChef.md @@ -1,5 +1,5 @@ # IUbiquityChef -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityChef.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityChef.sol) Interface for staking Dollar-3CRV LP tokens for Governance tokens reward diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md index d53598054..89af2fda0 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md @@ -1,5 +1,5 @@ # IUbiquityDollarManager -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityDollarManager.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityDollarManager.sol) **Inherits:** [IAccessControl](/src/dollar/interfaces/IAccessControl.sol/interface.IAccessControl.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md index 530ecaca3..c2cd30453 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md @@ -1,5 +1,5 @@ # IUbiquityDollarToken -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityDollarToken.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityDollarToken.sol) **Inherits:** [IERC20Ubiquity](/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityFormulas.sol/interface.IUbiquityFormulas.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityFormulas.sol/interface.IUbiquityFormulas.md index b12aeefc2..f020af85b 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityFormulas.sol/interface.IUbiquityFormulas.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityFormulas.sol/interface.IUbiquityFormulas.md @@ -1,5 +1,5 @@ # IUbiquityFormulas -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityFormulas.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityFormulas.sol) Interface for staking formulas diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityGovernance.sol/interface.IUbiquityGovernanceToken.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityGovernance.sol/interface.IUbiquityGovernanceToken.md index 1b643baae..eebc65dad 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityGovernance.sol/interface.IUbiquityGovernanceToken.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityGovernance.sol/interface.IUbiquityGovernanceToken.md @@ -1,5 +1,5 @@ # IUbiquityGovernanceToken -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityGovernance.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityGovernance.sol) **Inherits:** [IERC20Ubiquity](/src/dollar/interfaces/IERC20Ubiquity.sol/interface.IERC20Ubiquity.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityPool.sol/interface.IUbiquityPool.md b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityPool.sol/interface.IUbiquityPool.md index 2fe1b98a7..d930c35df 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityPool.sol/interface.IUbiquityPool.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/IUbiquityPool.sol/interface.IUbiquityPool.md @@ -1,5 +1,5 @@ # IUbiquityPool -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/IUbiquityPool.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/IUbiquityPool.sol) Ubiquity pool interface diff --git a/packages/contracts/docs/src/src/dollar/interfaces/README.md b/packages/contracts/docs/src/src/dollar/interfaces/README.md index 07bf9c282..8dac8c92a 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/README.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/README.md @@ -2,7 +2,9 @@ # Contents - [utils](/src/dollar/interfaces/utils) +- [IAaveAmo](IAaveAmo.sol/interface.IAaveAmo.md) - [IAccessControl](IAccessControl.sol/interface.IAccessControl.md) +- [IAmo](IAmo.sol/interface.IAmo.md) - [IBondingCurve](IBondingCurve.sol/interface.IBondingCurve.md) - [ICreditNft](ICreditNft.sol/interface.ICreditNft.md) - [ICreditNftManager](ICreditNftManager.sol/interface.ICreditNftManager.md) @@ -25,6 +27,7 @@ - [IStableSwap3Pool](IStableSwap3Pool.sol/interface.IStableSwap3Pool.md) - [IStaking](IStaking.sol/interface.IStaking.md) - [IStakingShare](IStakingShare.sol/interface.IStakingShare.md) +- [IUbiquityAmoMinter](IUbiquityAmoMinter.sol/interface.IUbiquityAmoMinter.md) - [IUbiquityChef](IUbiquityChef.sol/interface.IUbiquityChef.md) - [IUbiquityDollarManager](IUbiquityDollarManager.sol/interface.IUbiquityDollarManager.md) - [IUbiquityDollarToken](IUbiquityDollarToken.sol/interface.IUbiquityDollarToken.md) diff --git a/packages/contracts/docs/src/src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md b/packages/contracts/docs/src/src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md index 49913cc35..5c32c9cd5 100644 --- a/packages/contracts/docs/src/src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md +++ b/packages/contracts/docs/src/src/dollar/interfaces/utils/ICollectableDust.sol/interface.ICollectableDust.md @@ -1,5 +1,5 @@ # ICollectableDust -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/interfaces/utils/ICollectableDust.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/interfaces/utils/ICollectableDust.sol) Interface for collecting dust (i.e. not part of a protocol) tokens sent to a contract diff --git a/packages/contracts/docs/src/src/dollar/libraries/AddressUtils.sol/library.AddressUtils.md b/packages/contracts/docs/src/src/dollar/libraries/AddressUtils.sol/library.AddressUtils.md index ab85c3d30..50357fbcc 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/AddressUtils.sol/library.AddressUtils.md +++ b/packages/contracts/docs/src/src/dollar/libraries/AddressUtils.sol/library.AddressUtils.md @@ -1,5 +1,5 @@ # AddressUtils -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/AddressUtils.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/AddressUtils.sol) Address utils diff --git a/packages/contracts/docs/src/src/dollar/libraries/Constants.sol/constants.Constants.md b/packages/contracts/docs/src/src/dollar/libraries/Constants.sol/constants.Constants.md index 401128339..c9c19e1e8 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/Constants.sol/constants.Constants.md +++ b/packages/contracts/docs/src/src/dollar/libraries/Constants.sol/constants.Constants.md @@ -1,5 +1,5 @@ # Constants -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/Constants.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/Constants.sol) ### DEFAULT_ADMIN_ROLE *Default admin role name* diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibAccessControl.sol/library.LibAccessControl.md b/packages/contracts/docs/src/src/dollar/libraries/LibAccessControl.sol/library.LibAccessControl.md index 31093fbd5..365efffda 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibAccessControl.sol/library.LibAccessControl.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibAccessControl.sol/library.LibAccessControl.md @@ -1,5 +1,5 @@ # LibAccessControl -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibAccessControl.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibAccessControl.sol) Access control library diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md index 9fe55aab8..184f87402 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md @@ -1,5 +1,5 @@ # Modifiers -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibAppStorage.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibAppStorage.sol) Contract includes modifiers shared across all protocol's contracts diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/library.LibAppStorage.md b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/library.LibAppStorage.md index ebd93e78f..b2b8ce1b9 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/library.LibAppStorage.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/library.LibAppStorage.md @@ -1,5 +1,5 @@ # LibAppStorage -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibAppStorage.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibAppStorage.sol) Library used as a shared storage among all protocol libraries diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/struct.AppStorage.md b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/struct.AppStorage.md index e2d2fd5d2..78fa66f93 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/struct.AppStorage.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibAppStorage.sol/struct.AppStorage.md @@ -1,5 +1,5 @@ # AppStorage -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibAppStorage.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibAppStorage.sol) Shared struct used as a storage in the `LibAppStorage` library diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibBondingCurve.sol/library.LibBondingCurve.md b/packages/contracts/docs/src/src/dollar/libraries/LibBondingCurve.sol/library.LibBondingCurve.md index 9e8a3e864..1c4118fc8 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibBondingCurve.sol/library.LibBondingCurve.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibBondingCurve.sol/library.LibBondingCurve.md @@ -1,5 +1,5 @@ # LibBondingCurve -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibBondingCurve.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibBondingCurve.sol) Bonding curve library based on Bancor formula diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibChef.sol/library.LibChef.md b/packages/contracts/docs/src/src/dollar/libraries/LibChef.sol/library.LibChef.md index 7f31e57a6..5e0bcf373 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibChef.sol/library.LibChef.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibChef.sol/library.LibChef.md @@ -1,5 +1,5 @@ # LibChef -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibChef.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibChef.sol) Library for staking Dollar-3CRV LP tokens for Governance tokens reward diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCollectableDust.sol/library.LibCollectableDust.md b/packages/contracts/docs/src/src/dollar/libraries/LibCollectableDust.sol/library.LibCollectableDust.md index becb77fba..5fa21e90a 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCollectableDust.sol/library.LibCollectableDust.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCollectableDust.sol/library.LibCollectableDust.md @@ -1,5 +1,5 @@ # LibCollectableDust -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCollectableDust.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCollectableDust.sol) Library for collecting dust (i.e. not part of a protocol) tokens sent to a contract diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCreditClock.sol/library.LibCreditClock.md b/packages/contracts/docs/src/src/dollar/libraries/LibCreditClock.sol/library.LibCreditClock.md index 9f6d9bd81..0efb4d703 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCreditClock.sol/library.LibCreditClock.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCreditClock.sol/library.LibCreditClock.md @@ -1,5 +1,5 @@ # LibCreditClock -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCreditClock.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCreditClock.sol) Library for Credit Clock Facet diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftManager.sol/library.LibCreditNftManager.md b/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftManager.sol/library.LibCreditNftManager.md index cc675afd6..9a5b46ba6 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftManager.sol/library.LibCreditNftManager.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftManager.sol/library.LibCreditNftManager.md @@ -1,5 +1,5 @@ # LibCreditNftManager -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCreditNftManager.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCreditNftManager.sol) Library for basic credit issuing and redemption mechanism for Credit NFT and Credit holders diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol/library.LibCreditNftRedemptionCalculator.md b/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol/library.LibCreditNftRedemptionCalculator.md index 67a06737b..a4d586a0c 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol/library.LibCreditNftRedemptionCalculator.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol/library.LibCreditNftRedemptionCalculator.md @@ -1,5 +1,5 @@ # LibCreditNftRedemptionCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCreditNftRedemptionCalculator.sol) Library for calculating amount of Credit NFTs to mint on Dollars burn diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCreditRedemptionCalculator.sol/library.LibCreditRedemptionCalculator.md b/packages/contracts/docs/src/src/dollar/libraries/LibCreditRedemptionCalculator.sol/library.LibCreditRedemptionCalculator.md index 658ea18c8..ba24b5d89 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCreditRedemptionCalculator.sol/library.LibCreditRedemptionCalculator.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCreditRedemptionCalculator.sol/library.LibCreditRedemptionCalculator.md @@ -1,5 +1,5 @@ # LibCreditRedemptionCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCreditRedemptionCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCreditRedemptionCalculator.sol) Library for calculating amount of Credits to mint on Dollars burn diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibCurveDollarIncentive.sol/library.LibCurveDollarIncentive.md b/packages/contracts/docs/src/src/dollar/libraries/LibCurveDollarIncentive.sol/library.LibCurveDollarIncentive.md index bbc9c2dc2..f2d87792d 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibCurveDollarIncentive.sol/library.LibCurveDollarIncentive.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibCurveDollarIncentive.sol/library.LibCurveDollarIncentive.md @@ -1,5 +1,5 @@ # LibCurveDollarIncentive -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibCurveDollarIncentive.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibCurveDollarIncentive.sol) Library adds buy incentive and sell penalty for Curve's Dollar-3CRV MetaPool diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/error.InitializationFunctionReverted.md b/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/error.InitializationFunctionReverted.md index 86b2fec8b..675e83815 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/error.InitializationFunctionReverted.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/error.InitializationFunctionReverted.md @@ -1,5 +1,5 @@ # InitializationFunctionReverted -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibDiamond.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibDiamond.sol) Error thrown when `initializeDiamondCut()` fails diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/library.LibDiamond.md b/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/library.LibDiamond.md index 923612972..4a240a316 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/library.LibDiamond.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibDiamond.sol/library.LibDiamond.md @@ -1,5 +1,5 @@ # LibDiamond -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibDiamond.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibDiamond.sol) Library used for diamond facets and selector modifications diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibDirectGovernanceFarmer.sol/library.LibDirectGovernanceFarmer.md b/packages/contracts/docs/src/src/dollar/libraries/LibDirectGovernanceFarmer.sol/library.LibDirectGovernanceFarmer.md index 3d4923698..56c00cb65 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibDirectGovernanceFarmer.sol/library.LibDirectGovernanceFarmer.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibDirectGovernanceFarmer.sol/library.LibDirectGovernanceFarmer.md @@ -1,5 +1,5 @@ # LibDirectGovernanceFarmer -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibDirectGovernanceFarmer.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibDirectGovernanceFarmer.sol) ## State Variables diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintCalculator.sol/library.LibDollarMintCalculator.md b/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintCalculator.sol/library.LibDollarMintCalculator.md index ba201d2a2..6f7aa036a 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintCalculator.sol/library.LibDollarMintCalculator.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintCalculator.sol/library.LibDollarMintCalculator.md @@ -1,5 +1,5 @@ # LibDollarMintCalculator -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibDollarMintCalculator.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibDollarMintCalculator.sol) Calculates amount of Dollars ready to be minted when TWAP price (i.e. Dollar price) > 1$ diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintExcess.sol/library.LibDollarMintExcess.md b/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintExcess.sol/library.LibDollarMintExcess.md index ef82f6fa0..7b12fefc1 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintExcess.sol/library.LibDollarMintExcess.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibDollarMintExcess.sol/library.LibDollarMintExcess.md @@ -1,5 +1,5 @@ # LibDollarMintExcess -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibDollarMintExcess.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibDollarMintExcess.sol) Library for distributing excess Dollars when `mintClaimableDollars()` is called diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibStaking.sol/library.LibStaking.md b/packages/contracts/docs/src/src/dollar/libraries/LibStaking.sol/library.LibStaking.md index 44ac0e2ad..b6496a71d 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibStaking.sol/library.LibStaking.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibStaking.sol/library.LibStaking.md @@ -1,5 +1,5 @@ # LibStaking -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibStaking.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibStaking.sol) Staking library diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibStakingFormulas.sol/library.LibStakingFormulas.md b/packages/contracts/docs/src/src/dollar/libraries/LibStakingFormulas.sol/library.LibStakingFormulas.md index a2adbe3c3..fcdf21db3 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibStakingFormulas.sol/library.LibStakingFormulas.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibStakingFormulas.sol/library.LibStakingFormulas.md @@ -1,5 +1,5 @@ # LibStakingFormulas -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibStakingFormulas.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibStakingFormulas.sol) Library for staking formulas diff --git a/packages/contracts/docs/src/src/dollar/libraries/LibUbiquityPool.sol/library.LibUbiquityPool.md b/packages/contracts/docs/src/src/dollar/libraries/LibUbiquityPool.sol/library.LibUbiquityPool.md index c048fb538..be7873555 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/LibUbiquityPool.sol/library.LibUbiquityPool.md +++ b/packages/contracts/docs/src/src/dollar/libraries/LibUbiquityPool.sol/library.LibUbiquityPool.md @@ -1,5 +1,5 @@ # LibUbiquityPool -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/LibUbiquityPool.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/LibUbiquityPool.sol) Ubiquity pool library diff --git a/packages/contracts/docs/src/src/dollar/libraries/UintUtils.sol/library.UintUtils.md b/packages/contracts/docs/src/src/dollar/libraries/UintUtils.sol/library.UintUtils.md index 28565a0de..c8d7c97b6 100644 --- a/packages/contracts/docs/src/src/dollar/libraries/UintUtils.sol/library.UintUtils.md +++ b/packages/contracts/docs/src/src/dollar/libraries/UintUtils.sol/library.UintUtils.md @@ -1,5 +1,5 @@ # UintUtils -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/libraries/UintUtils.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/libraries/UintUtils.sol) *Derived from https://github.com/OpenZeppelin/openzeppelin-contracts/ (MIT license)* diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockChainLinkFeed.sol/contract.MockChainLinkFeed.md b/packages/contracts/docs/src/src/dollar/mocks/MockChainLinkFeed.sol/contract.MockChainLinkFeed.md index 594377c87..d5f68a673 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockChainLinkFeed.sol/contract.MockChainLinkFeed.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockChainLinkFeed.sol/contract.MockChainLinkFeed.md @@ -1,5 +1,5 @@ # MockChainLinkFeed -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockChainLinkFeed.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockChainLinkFeed.sol) **Inherits:** AggregatorV3Interface diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockCurveFactory.sol/contract.MockCurveFactory.md b/packages/contracts/docs/src/src/dollar/mocks/MockCurveFactory.sol/contract.MockCurveFactory.md index ee91245ad..a26c06de9 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockCurveFactory.sol/contract.MockCurveFactory.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockCurveFactory.sol/contract.MockCurveFactory.md @@ -1,5 +1,5 @@ # MockCurveFactory -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockCurveFactory.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockCurveFactory.sol) **Inherits:** [ICurveFactory](/src/dollar/interfaces/ICurveFactory.sol/interface.ICurveFactory.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md b/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md index dc0c10953..296908521 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md @@ -1,5 +1,5 @@ # MockCurveStableSwapMetaNG -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockCurveStableSwapMetaNG.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockCurveStableSwapMetaNG.sol) **Inherits:** [ICurveStableSwapMetaNG](/src/dollar/interfaces/ICurveStableSwapMetaNG.sol/interface.ICurveStableSwapMetaNG.md), [MockERC20](/src/dollar/mocks/MockERC20.sol/contract.MockERC20.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapNG.sol/contract.MockCurveStableSwapNG.md b/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapNG.sol/contract.MockCurveStableSwapNG.md index 02b88871a..dbb6ad7ce 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapNG.sol/contract.MockCurveStableSwapNG.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockCurveStableSwapNG.sol/contract.MockCurveStableSwapNG.md @@ -1,5 +1,5 @@ # MockCurveStableSwapNG -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockCurveStableSwapNG.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockCurveStableSwapNG.sol) **Inherits:** [ICurveStableSwapNG](/src/dollar/interfaces/ICurveStableSwapNG.sol/interface.ICurveStableSwapNG.md), [MockCurveStableSwapMetaNG](/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockCurveTwocryptoOptimized.sol/contract.MockCurveTwocryptoOptimized.md b/packages/contracts/docs/src/src/dollar/mocks/MockCurveTwocryptoOptimized.sol/contract.MockCurveTwocryptoOptimized.md index 7bc60dea2..e9c3cbc85 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockCurveTwocryptoOptimized.sol/contract.MockCurveTwocryptoOptimized.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockCurveTwocryptoOptimized.sol/contract.MockCurveTwocryptoOptimized.md @@ -1,5 +1,5 @@ # MockCurveTwocryptoOptimized -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockCurveTwocryptoOptimized.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockCurveTwocryptoOptimized.sol) **Inherits:** [ICurveTwocryptoOptimized](/src/dollar/interfaces/ICurveTwocryptoOptimized.sol/interface.ICurveTwocryptoOptimized.md), [MockCurveStableSwapMetaNG](/src/dollar/mocks/MockCurveStableSwapMetaNG.sol/contract.MockCurveStableSwapMetaNG.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockERC20.sol/contract.MockERC20.md b/packages/contracts/docs/src/src/dollar/mocks/MockERC20.sol/contract.MockERC20.md index 27aec6457..949a2203a 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockERC20.sol/contract.MockERC20.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockERC20.sol/contract.MockERC20.md @@ -1,5 +1,5 @@ # MockERC20 -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockERC20.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockERC20.sol) **Inherits:** ERC20 diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/constants.MockFacet.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/constants.MockFacet.md index 26a6e8c71..7da969703 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/constants.MockFacet.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/constants.MockFacet.md @@ -1,5 +1,5 @@ # Constants -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) ### NEW_STORAGE_POSITION diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetInitializer.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetInitializer.md index 35a46f2e1..466792ef5 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetInitializer.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetInitializer.md @@ -1,5 +1,5 @@ # MockFacetInitializer -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) ## Functions diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithExtendedStorageWriteFunctions.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithExtendedStorageWriteFunctions.md index c7ff63f56..c1fb981f4 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithExtendedStorageWriteFunctions.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithExtendedStorageWriteFunctions.md @@ -1,5 +1,5 @@ # MockFacetWithExtendedStorageWriteFunctions -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) **Inherits:** [IMockFacet](/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithPureFunctions.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithPureFunctions.md index a41b791c2..8a8e33f6a 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithPureFunctions.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithPureFunctions.md @@ -1,5 +1,5 @@ # MockFacetWithPureFunctions -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) **Inherits:** [IMockFacet](/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithStorageWriteFunctions.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithStorageWriteFunctions.md index 950e72cb1..6f335a6cd 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithStorageWriteFunctions.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/contract.MockFacetWithStorageWriteFunctions.md @@ -1,5 +1,5 @@ # MockFacetWithStorageWriteFunctions -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) **Inherits:** [IMockFacet](/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md) diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md index 1268d37fc..64d861d74 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/interface.IMockFacet.md @@ -1,5 +1,5 @@ # IMockFacet -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) ## Functions diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewSimpleStorage.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewSimpleStorage.md index 0563d397f..32dbb9899 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewSimpleStorage.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewSimpleStorage.md @@ -1,5 +1,5 @@ # NewSimpleStorage -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) ```solidity diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewStorageExtended.md b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewStorageExtended.md index 08324035d..a628b6602 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewStorageExtended.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockFacet.sol/struct.NewStorageExtended.md @@ -1,5 +1,5 @@ # NewStorageExtended -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockFacet.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockFacet.sol) ```solidity diff --git a/packages/contracts/docs/src/src/dollar/mocks/MockShareV1.sol/contract.BondingShare.md b/packages/contracts/docs/src/src/dollar/mocks/MockShareV1.sol/contract.BondingShare.md index bf3d7d3e0..173f9bed4 100644 --- a/packages/contracts/docs/src/src/dollar/mocks/MockShareV1.sol/contract.BondingShare.md +++ b/packages/contracts/docs/src/src/dollar/mocks/MockShareV1.sol/contract.BondingShare.md @@ -1,5 +1,5 @@ # BondingShare -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/mocks/MockShareV1.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/mocks/MockShareV1.sol) **Inherits:** [StakingShare](/src/dollar/core/StakingShare.sol/contract.StakingShare.md) diff --git a/packages/contracts/docs/src/src/dollar/upgradeInitializers/DiamondInit.sol/contract.DiamondInit.md b/packages/contracts/docs/src/src/dollar/upgradeInitializers/DiamondInit.sol/contract.DiamondInit.md index 20f1a4d5a..741155612 100644 --- a/packages/contracts/docs/src/src/dollar/upgradeInitializers/DiamondInit.sol/contract.DiamondInit.md +++ b/packages/contracts/docs/src/src/dollar/upgradeInitializers/DiamondInit.sol/contract.DiamondInit.md @@ -1,5 +1,5 @@ # DiamondInit -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/upgradeInitializers/DiamondInit.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/upgradeInitializers/DiamondInit.sol) **Inherits:** [Modifiers](/src/dollar/libraries/LibAppStorage.sol/contract.Modifiers.md) diff --git a/packages/contracts/docs/src/src/dollar/utils/SafeAddArray.sol/library.SafeAddArray.md b/packages/contracts/docs/src/src/dollar/utils/SafeAddArray.sol/library.SafeAddArray.md index 247ca9291..c7032ddf3 100644 --- a/packages/contracts/docs/src/src/dollar/utils/SafeAddArray.sol/library.SafeAddArray.md +++ b/packages/contracts/docs/src/src/dollar/utils/SafeAddArray.sol/library.SafeAddArray.md @@ -1,5 +1,5 @@ # SafeAddArray -[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/c8e4c35e03024dbea12740d3dfedc8e8a0bad6a8/src/dollar/utils/SafeAddArray.sol) +[Git Source](https://github.com/ubiquity/ubiquity-dollar/blob/386de2abb8d1171ab47c0b149dede7c48631259f/src/dollar/utils/SafeAddArray.sol) Wrappers over Solidity's array push operations with added check diff --git a/packages/contracts/foundry.toml b/packages/contracts/foundry.toml index c1c0e91ca..ba07f2bd8 100644 --- a/packages/contracts/foundry.toml +++ b/packages/contracts/foundry.toml @@ -19,6 +19,7 @@ force = false [rpc_endpoints] mainnet = "https://rpc.ankr.com/eth" +sepolia = "https://1rpc.io/sepolia" [profile.SMT.model_checker] contracts = { } @@ -41,8 +42,8 @@ targets = [ src = 'src/dollar' [profile.intense.fuzz] -runs = 100000 -max_test_rejects = 900000 +runs = 16500000 # 5h 30m +max_test_rejects = 144000000 [profile.intense.invariant] -runs = 50000 # ~1 hour \ No newline at end of file +runs = 350000 # 5h 40m \ No newline at end of file diff --git a/packages/contracts/remappings.txt b/packages/contracts/remappings.txt index 638db8d7f..c50eb50a7 100644 --- a/packages/contracts/remappings.txt +++ b/packages/contracts/remappings.txt @@ -8,4 +8,6 @@ solidity-linked-list/=lib/solidity-linked-list @uniswap/v3-periphery/contracts/=lib/Uniswap/v3-periphery/contracts abdk/=lib/abdk-libraries-solidity/ operator-filter-registry/=lib/operator-filter-registry/src -@chainlink/=lib/chainlink-brownie-contracts/contracts/src/v0.8/ \ No newline at end of file +@chainlink/=lib/chainlink-brownie-contracts/contracts/src/v0.8/ +@aavev3-core/contracts/=lib/aave-v3-core/contracts +@aavev3-periphery/contracts/=lib/aave-v3-periphery/contracts \ No newline at end of file diff --git a/packages/contracts/src/dollar/amo/AaveAmo.sol b/packages/contracts/src/dollar/amo/AaveAmo.sol new file mode 100644 index 000000000..5b69a5076 --- /dev/null +++ b/packages/contracts/src/dollar/amo/AaveAmo.sol @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity 0.8.19; + +import {UbiquityAmoMinter} from "../core/UbiquityAmoMinter.sol"; +import {IAmo} from "../interfaces/IAmo.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {IPool} from "@aavev3-core/contracts/interfaces/IPool.sol"; +import {IRewardsController} from "@aavev3-periphery/contracts/rewards/interfaces/IRewardsController.sol"; + +/** + * @title AaveAmo + * @notice AMO to interact with Aave V3: supply and manage rewards. + * @notice Can receive collateral from UbiquityAmoMinter and interact with Aave's V3 pool. + */ +contract AaveAmo is IAmo, Ownable { + using SafeERC20 for ERC20; + + /// @notice UbiquityAmoMinter instance + UbiquityAmoMinter public amoMinter; + + /// @notice Aave V3 pool instance + IPool public immutable aavePool; + + /// @notice Aave rewards controller + IRewardsController public immutable aaveRewardsController; + + /* ========== CONSTRUCTOR ========== */ + + /** + * @notice Initializes the contract with necessary parameters + * @param _ownerAddress Address of the contract owner + * @param _amoMinterAddress Address of the Ubiquity Amo minter + * @param _aavePool Address of the Aave pool + * @param _aaveRewardsController Address of the Aave rewards controller + */ + constructor( + address _ownerAddress, + address _amoMinterAddress, + address _aavePool, + address _aaveRewardsController + ) { + require(_ownerAddress != address(0), "Owner address cannot be zero"); + require( + _amoMinterAddress != address(0), + "Amo minter address cannot be zero" + ); + require(_aavePool != address(0), "Aave pool address cannot be zero"); + require( + _aaveRewardsController != address(0), + "Aave rewards controller address cannot be zero" + ); + + // Set contract owner + transferOwnership(_ownerAddress); + + // Set the Amo minter + amoMinter = UbiquityAmoMinter(_amoMinterAddress); + + // Set the Aave pool + aavePool = IPool(_aavePool); + + // Set the Aave rewards controller + aaveRewardsController = IRewardsController(_aaveRewardsController); + } + + /* ========== Aave V3 + REWARDS ========== */ + + /** + * @notice Deposits collateral to Aave pool + * @param collateralAddress Address of the collateral ERC20 + * @param amount Amount of collateral to deposit + */ + function aaveDepositCollateral( + address collateralAddress, + uint256 amount + ) public onlyOwner { + ERC20 token = ERC20(collateralAddress); + token.safeApprove(address(aavePool), amount); + aavePool.deposit(collateralAddress, amount, address(this), 0); + + emit CollateralDeposited(collateralAddress, amount); + } + + /** + * @notice Withdraws collateral from Aave pool + * @param collateralAddress Address of the collateral ERC20 + * @param aTokenAmount Amount of collateral to withdraw + */ + function aaveWithdrawCollateral( + address collateralAddress, + uint256 aTokenAmount + ) public onlyOwner { + aavePool.withdraw(collateralAddress, aTokenAmount, address(this)); + + emit CollateralWithdrawn(collateralAddress, aTokenAmount); + } + + /** + * @notice Claims all rewards available from the list of assets provided, will fail if balance on asset is zero + * @param assets Array of aTokens/sTokens/vTokens addresses to claim rewards from + */ + function claimAllRewards(address[] memory assets) external { + // Claim all rewards for the collected tokens + aaveRewardsController.claimAllRewards(assets, address(this)); + + emit RewardsClaimed(); + } + + /* ========== RESTRICTED GOVERNANCE FUNCTIONS ========== */ + + /** + * @notice Returns collateral back to the AMO minter + * @param collateralAmount Amount of collateral to return, pass 0 to return all collateral + */ + function returnCollateralToMinter( + uint256 collateralAmount + ) public override onlyOwner { + ERC20 collateralToken = amoMinter.collateralToken(); + + if (collateralAmount == 0) { + collateralAmount = collateralToken.balanceOf(address(this)); + } + + // Approve and return collateral + collateralToken.approve(address(amoMinter), collateralAmount); + amoMinter.receiveCollateralFromAmo(collateralAmount); + + emit CollateralReturnedToMinter(collateralAmount); + } + + /** + * @notice Sets the AMO minter address + * @param _amoMinterAddress New address of the AMO minter + */ + function setAmoMinter( + address _amoMinterAddress + ) external override onlyOwner { + amoMinter = UbiquityAmoMinter(_amoMinterAddress); + + emit AmoMinterSet(_amoMinterAddress); + } + + /** + * @notice Recovers any ERC20 tokens held by the contract + * @param tokenAddress Address of the token to recover + * @param tokenAmount Amount of tokens to recover + */ + function recoverERC20( + address tokenAddress, + uint256 tokenAmount + ) external onlyOwner { + ERC20(tokenAddress).safeTransfer(msg.sender, tokenAmount); + + emit ERC20Recovered(tokenAddress, tokenAmount); + } + + /** + * @notice Executes arbitrary calls from this contract + * @param _to Address to call + * @param _value Value to send + * @param _data Data to execute + * @return success, result Returns whether the call succeeded and the returned data + */ + function execute( + address _to, + uint256 _value, + bytes calldata _data + ) external onlyOwner returns (bool, bytes memory) { + (bool success, bytes memory result) = _to.call{value: _value}(_data); + + emit ExecuteCalled(_to, _value, _data); + return (success, result); + } + + /* ========== EVENTS ========== */ + + event CollateralDeposited( + address indexed collateralAddress, + uint256 amount + ); + event CollateralWithdrawn( + address indexed collateralAddress, + uint256 amount + ); + event CollateralReturnedToMinter(uint256 amount); + event RewardsClaimed(); + event AmoMinterSet(address indexed newMinter); + event ERC20Recovered(address tokenAddress, uint256 tokenAmount); + event ExecuteCalled(address indexed to, uint256 value, bytes data); +} diff --git a/packages/contracts/src/dollar/core/UbiquityAmoMinter.sol b/packages/contracts/src/dollar/core/UbiquityAmoMinter.sol new file mode 100644 index 000000000..2b97a0a54 --- /dev/null +++ b/packages/contracts/src/dollar/core/UbiquityAmoMinter.sol @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity 0.8.19; + +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {IUbiquityPool} from "../interfaces/IUbiquityPool.sol"; + +/** + * @title UbiquityAmoMinter + * @notice Contract responsible for managing collateral borrowing from Ubiquity's Pool to AMOs. + * @notice Allows owner to move Dollar collateral to AMOs, enabling yield generation. + * @notice It keeps track of borrowed collateral balances per Amo and the total borrowed sum. + */ +contract UbiquityAmoMinter is Ownable { + using SafeERC20 for ERC20; + + /// @notice Collateral token used by the AMO minter + ERC20 public immutable collateralToken; + + /// @notice Ubiquity pool interface + IUbiquityPool public pool; + + /// @notice Collateral-related properties + address public immutable collateralAddress; + uint256 public immutable collateralIndex; // Index of the collateral in the pool + uint256 public immutable missingDecimals; + int256 public collateralBorrowCap = int256(100_000e18); + + /// @notice Mapping for tracking borrowed collateral balances per AMO + mapping(address => int256) public collateralBorrowedBalances; + + /// @notice Sum of all collateral borrowed across Amos + int256 public collateralTotalBorrowedBalance = 0; + + /// @notice Mapping to track active AMOs + mapping(address => bool) public Amos; + + /* ========== CONSTRUCTOR ========== */ + + /** + * @notice Initializes the Amo minter contract + * @param _ownerAddress Address of the contract owner + * @param _collateralAddress Address of the collateral token + * @param _collateralIndex Index of the collateral in the pool + * @param _poolAddress Address of the Ubiquity pool + */ + constructor( + address _ownerAddress, + address _collateralAddress, + uint256 _collateralIndex, + address _poolAddress + ) { + require(_ownerAddress != address(0), "Owner address cannot be zero"); + require(_poolAddress != address(0), "Pool address cannot be zero"); + + // Set the owner + transferOwnership(_ownerAddress); + + // Pool related + pool = IUbiquityPool(_poolAddress); + + // Collateral related + collateralAddress = _collateralAddress; + collateralIndex = _collateralIndex; + collateralToken = ERC20(_collateralAddress); + missingDecimals = uint256(18) - collateralToken.decimals(); + + emit OwnershipTransferred(_ownerAddress); + emit PoolSet(_poolAddress); + } + + /* ========== MODIFIERS ========== */ + + /** + * @notice Ensures the caller is a valid AMO + * @param amoAddress Address of the AMO to check + */ + modifier validAmo(address amoAddress) { + require(Amos[amoAddress], "Invalid Amo"); + _; + } + + /* ========== AMO MANAGEMENT FUNCTIONS ========== */ + + /** + * @notice Enables an AMO + * @param amo Address of the AMO to enable + */ + function enableAmo(address amo) external onlyOwner { + Amos[amo] = true; + } + + /** + * @notice Disables an AMO + * @param amo Address of the AMO to disable + */ + function disableAmo(address amo) external onlyOwner { + Amos[amo] = false; + } + + /* ========== COLLATERAL FUNCTIONS ========== */ + + /** + * @notice Transfers collateral to the specified AMO + * @param destinationAmo Address of the AMO to receive collateral + * @param collateralAmount Amount of collateral to transfer + */ + function giveCollateralToAmo( + address destinationAmo, + uint256 collateralAmount + ) external onlyOwner validAmo(destinationAmo) { + require( + collateralToken.balanceOf(address(pool)) >= collateralAmount, + "Insufficient balance" + ); + + int256 collateralAmount_i256 = int256(collateralAmount); + + require( + (collateralTotalBorrowedBalance + collateralAmount_i256) <= + collateralBorrowCap, + "Borrow cap exceeded" + ); + + collateralBorrowedBalances[destinationAmo] += collateralAmount_i256; + collateralTotalBorrowedBalance += collateralAmount_i256; + + // Borrow collateral from the pool + pool.amoMinterBorrow(collateralAmount); + + // Transfer collateral to the AMO + collateralToken.safeTransfer(destinationAmo, collateralAmount); + + emit CollateralGivenToAmo(destinationAmo, collateralAmount); + } + + /** + * @notice Receives collateral back from an AMO + * @param collateralAmount Amount of collateral being returned + */ + function receiveCollateralFromAmo( + uint256 collateralAmount + ) external validAmo(msg.sender) { + int256 collateralAmount_i256 = int256(collateralAmount); + + // Update the collateral balances + collateralBorrowedBalances[msg.sender] -= collateralAmount_i256; + collateralTotalBorrowedBalance -= collateralAmount_i256; + + // Transfer collateral back to the pool + collateralToken.safeTransferFrom( + msg.sender, + address(pool), + collateralAmount + ); + + emit CollateralReceivedFromAmo(msg.sender, collateralAmount); + } + + /* ========== RESTRICTED GOVERNANCE FUNCTIONS ========== */ + + /** + * @notice Updates the collateral borrow cap + * @param _collateralBorrowCap New collateral borrow cap + */ + function setCollateralBorrowCap( + uint256 _collateralBorrowCap + ) external onlyOwner { + collateralBorrowCap = int256(_collateralBorrowCap); + emit CollateralBorrowCapSet(_collateralBorrowCap); + } + + /** + * @notice Updates the pool address + * @param _poolAddress New pool address + */ + function setPool(address _poolAddress) external onlyOwner { + pool = IUbiquityPool(_poolAddress); + emit PoolSet(_poolAddress); + } + + /* =========== VIEWS ========== */ + + /** + * @notice Returns the total value of borrowed collateral + * @return Total balance of collateral borrowed + */ + function collateralDollarBalance() external view returns (uint256) { + return uint256(collateralTotalBorrowedBalance); + } + + /* ========== EVENTS ========== */ + + event CollateralGivenToAmo( + address destinationAmo, + uint256 collateralAmount + ); + event CollateralReceivedFromAmo( + address sourceAmo, + uint256 collateralAmount + ); + event CollateralBorrowCapSet(uint256 newCollateralBorrowCap); + event PoolSet(address newPoolAddress); + event OwnershipTransferred(address newOwner); +} diff --git a/packages/contracts/src/dollar/interfaces/IAaveAmo.sol b/packages/contracts/src/dollar/interfaces/IAaveAmo.sol new file mode 100644 index 000000000..025e11c7b --- /dev/null +++ b/packages/contracts/src/dollar/interfaces/IAaveAmo.sol @@ -0,0 +1,163 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +interface IAaveAmo { + /** + * @notice Deposits collateral into the Aave pool + * @param collateralAddress Address of the collateral ERC20 token + * @param amount Amount of collateral to deposit + */ + function aaveDepositCollateral( + address collateralAddress, + uint256 amount + ) external; + + /** + * @notice Withdraws collateral from the Aave pool + * @param collateralAddress Address of the collateral ERC20 token + * @param aTokenAmount Amount of aTokens (collateral) to withdraw + */ + function aaveWithdrawCollateral( + address collateralAddress, + uint256 aTokenAmount + ) external; + + /** + * @notice Borrows an asset from the Aave pool + * @param asset Address of the asset to borrow + * @param borrowAmount Amount of the asset to borrow + * @param interestRateMode Interest rate mode: 1 for stable, 2 for variable + */ + function aaveBorrow( + address asset, + uint256 borrowAmount, + uint256 interestRateMode + ) external; + + /** + * @notice Repays a borrowed asset to the Aave pool + * @param asset Address of the asset to repay + * @param repayAmount Amount of the asset to repay + * @param interestRateMode Interest rate mode: 1 for stable, 2 for variable + */ + function aaveRepay( + address asset, + uint256 repayAmount, + uint256 interestRateMode + ) external; + + /** + * @notice Claims all rewards from the provided assets + * @param assets Array of aTokens/sTokens/vTokens addresses to claim rewards from + */ + function claimAllRewards(address[] memory assets) external; + + /** + * @notice Returns collateral back to the AMO minter + * @param collateralAmount Amount of collateral to return + */ + function returnCollateralToMinter(uint256 collateralAmount) external; + + /** + * @notice Sets the address of the AMO minter + * @param _amoMinterAddress New address of the AMO minter + */ + function setAmoMinter(address _amoMinterAddress) external; + + /** + * @notice Recovers any ERC20 tokens held by the contract + * @param tokenAddress Address of the token to recover + * @param tokenAmount Amount of tokens to recover + */ + function recoverERC20(address tokenAddress, uint256 tokenAmount) external; + + /** + * @notice Executes an arbitrary call from the contract + * @param _to Address to call + * @param _value Value to send with the call + * @param _data Data to execute in the call + * @return success Boolean indicating whether the call succeeded + * @return result Bytes data returned from the call + */ + function execute( + address _to, + uint256 _value, + bytes calldata _data + ) external returns (bool, bytes memory); + + /** + * @notice Emitted when collateral is deposited into the Aave pool + * @param collateralAddress Address of the collateral token + * @param amount Amount of collateral deposited + */ + event CollateralDeposited( + address indexed collateralAddress, + uint256 amount + ); + + /** + * @notice Emitted when collateral is withdrawn from the Aave pool + * @param collateralAddress Address of the collateral token + * @param amount Amount of collateral withdrawn + */ + event CollateralWithdrawn( + address indexed collateralAddress, + uint256 amount + ); + + /** + * @notice Emitted when an asset is borrowed from the Aave pool + * @param asset Address of the asset borrowed + * @param amount Amount of asset borrowed + * @param interestRateMode Interest rate mode used for the borrow (1 for stable, 2 for variable) + */ + event Borrowed( + address indexed asset, + uint256 amount, + uint256 interestRateMode + ); + + /** + * @notice Emitted when a borrowed asset is repaid to the Aave pool + * @param asset Address of the asset repaid + * @param amount Amount of asset repaid + * @param interestRateMode Interest rate mode used for the repay (1 for stable, 2 for variable) + */ + event Repaid( + address indexed asset, + uint256 amount, + uint256 interestRateMode + ); + + /** + * @notice Emitted when collateral is returned to the AMO minter + * @param amount Amount of collateral returned + */ + event CollateralReturnedToMinter(uint256 amount); + + /** + * @notice Emitted when rewards are claimed + */ + event RewardsClaimed(); + + /** + * @notice Emitted when the AMO minter address is set + * @param newMinter Address of the new AMO minter + */ + event AmoMinterSet(address indexed newMinter); + + /** + * @notice Emitted when ERC20 tokens are recovered from the contract + * @param tokenAddress Address of the recovered token + * @param tokenAmount Amount of tokens recovered + */ + event ERC20Recovered(address tokenAddress, uint256 tokenAmount); + + /** + * @notice Emitted when an arbitrary call is executed from the contract + * @param to Address of the call target + * @param value Value sent with the call + * @param data Data sent with the call + */ + event ExecuteCalled(address indexed to, uint256 value, bytes data); +} diff --git a/packages/contracts/src/dollar/interfaces/IAmo.sol b/packages/contracts/src/dollar/interfaces/IAmo.sol new file mode 100644 index 000000000..8dca94c7d --- /dev/null +++ b/packages/contracts/src/dollar/interfaces/IAmo.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +interface IAmo { + /** + * @notice Returns collateral back to the AMO minter + * @param collateralAmount Amount of collateral to return + */ + function returnCollateralToMinter(uint256 collateralAmount) external; + + /** + * @notice Sets the address of the AMO minter + * @param _amoMinterAddress New address of the AMO minter + */ + function setAmoMinter(address _amoMinterAddress) external; +} diff --git a/packages/contracts/src/dollar/interfaces/IUbiquityAmoMinter.sol b/packages/contracts/src/dollar/interfaces/IUbiquityAmoMinter.sol new file mode 100644 index 000000000..2587402bd --- /dev/null +++ b/packages/contracts/src/dollar/interfaces/IUbiquityAmoMinter.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity 0.8.19; + +interface IUbiquityAmoMinter { + /** + * @notice Enables an AMO for collateral transfers + * @param amo Address of the AMO to enable + */ + function enableAmo(address amo) external; + + /** + * @notice Disables an AMO, preventing further collateral transfers + * @param amo Address of the AMO to disable + */ + function disableAmo(address amo) external; + + /** + * @notice Transfers collateral to a specified AMO + * @param destinationAmo Address of the AMO to receive collateral + * @param collateralAmount Amount of collateral to transfer + */ + function giveCollateralToAmo( + address destinationAmo, + uint256 collateralAmount + ) external; + + /** + * @notice Receives collateral back from an AMO + * @param collateralAmount Amount of collateral being returned + */ + function receiveCollateralFromAmo(uint256 collateralAmount) external; + + /** + * @notice Updates the maximum allowable borrowed collateral + * @param _collateralBorrowCap New collateral borrow cap value + */ + function setCollateralBorrowCap(uint256 _collateralBorrowCap) external; + + /** + * @notice Updates the address of the Ubiquity pool + * @param _poolAddress New pool address + */ + function setPool(address _poolAddress) external; + + /** + * @notice Returns the total balance of collateral borrowed by all AMOs + * @return Total balance of collateral borrowed + */ + function collateralDollarBalance() external view returns (uint256); + + /** + * @notice Emitted when collateral is given to an AMO + * @param destinationAmo Address of the AMO receiving the collateral + * @param collateralAmount Amount of collateral transferred + */ + event CollateralGivenToAmo( + address destinationAmo, + uint256 collateralAmount + ); + + /** + * @notice Emitted when collateral is returned from an AMO + * @param sourceAmo Address of the AMO returning the collateral + * @param collateralAmount Amount of collateral returned + */ + event CollateralReceivedFromAmo( + address sourceAmo, + uint256 collateralAmount + ); + + /** + * @notice Emitted when the collateral borrow cap is updated + * @param newCollateralBorrowCap The updated collateral borrow cap + */ + event CollateralBorrowCapSet(uint256 newCollateralBorrowCap); + + /** + * @notice Emitted when the Ubiquity pool address is updated + * @param newPoolAddress The updated pool address + */ + event PoolSet(address newPoolAddress); + + /** + * @notice Emitted when ownership of the contract is transferred + * @param newOwner Address of the new contract owner + */ + event OwnershipTransferred(address newOwner); +} diff --git a/packages/contracts/test/amo/AaveAmo.t.sol b/packages/contracts/test/amo/AaveAmo.t.sol new file mode 100644 index 000000000..6b7b5d53e --- /dev/null +++ b/packages/contracts/test/amo/AaveAmo.t.sol @@ -0,0 +1,338 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +import "forge-std/Test.sol"; +import {DiamondTestSetup} from "../diamond/DiamondTestSetup.sol"; +import {UbiquityAmoMinter} from "../../src/dollar/core/UbiquityAmoMinter.sol"; +import {AaveAmo} from "../../src/dollar/amo/AaveAmo.sol"; +import {MockERC20} from "../../src/dollar/mocks/MockERC20.sol"; +import {MockChainLinkFeed} from "../../src/dollar/mocks/MockChainLinkFeed.sol"; +import {IPool} from "@aavev3-core/contracts/interfaces/IPool.sol"; +import {IAToken} from "@aavev3-core/contracts/interfaces/IAToken.sol"; +import {IVariableDebtToken} from "@aavev3-core/contracts/interfaces/IVariableDebtToken.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract AaveAmoTest is DiamondTestSetup { + UbiquityAmoMinter amoMinter; + AaveAmo aaveAmo; + address rewardsController = + address(0x4DA5c4da71C5a167171cC839487536d86e083483); // Aave Rewards Controller + address collateralOwner = + address(0xC959483DBa39aa9E78757139af0e9a2EDEb3f42D); // Aave Sepolia Faucet + MockERC20 collateralToken = + MockERC20(0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357); // DAI-TestnetMintableERC20-Aave Sepolia + MockChainLinkFeed collateralTokenPriceFeed = + MockChainLinkFeed(0x9aF11c35c5d3Ae182C0050438972aac4376f9516); // DAI-TestnetPriceAggregator-Aave Sepolia + IAToken aToken = IAToken(0x29598b72eb5CeBd806C5dCD549490FdA35B13cD8); // DAI-AToken-Aave Sepolia + IVariableDebtToken vToken = + IVariableDebtToken(0x22675C506A8FC26447aFFfa33640f6af5d4D4cF0); // DAI-VariableDebtToken-Aave Sepolia + + // Constants for the test + address constant newAmoMinterAddress = address(5); // mock new Amo minter address + address constant nonAmo = address(9999); // Address representing a non-Amo entity + uint256 constant interestRateMode = 2; // Variable interest rate mode in Aave + + // Mocking the Aave Pool + IPool private constant aavePool = + IPool(0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951); // Aave V3 Sepolia Pool + + function setUp() public override { + vm.createSelectFork(vm.rpcUrl("sepolia")); + super.setUp(); + + // Deploy UbiquityAmoMinter contract + amoMinter = new UbiquityAmoMinter( + owner, + address(collateralToken), + 0, + address(ubiquityPoolFacet) + ); + + // Deploy AaveAmo contract + aaveAmo = new AaveAmo( + owner, + address(amoMinter), + address(aavePool), + address(rewardsController) + ); + + // Enable AaveAmo as a valid Amo + vm.prank(owner); + amoMinter.enableAmo(address(aaveAmo)); + + vm.startPrank(admin); + + // Add collateral token to the pool + uint256 poolCeiling = 500_000e18; + ubiquityPoolFacet.addCollateralToken( + address(collateralToken), + address(collateralTokenPriceFeed), + poolCeiling + ); + + // Enable collateral and register Amo Minter + ubiquityPoolFacet.toggleCollateral(0); + ubiquityPoolFacet.addAmoMinter(address(amoMinter)); + + vm.stopPrank(); + } + + /* ========== Aave Amo SETUP TESTS ========== */ + + function testAaveAmoSetup_ShouldSet_owner() public { + // Verify the owner was set correctly + assertEq(aaveAmo.owner(), owner); + } + + function testAaveAmoSetup_ShouldSet_amoMinter() public { + // Verify the Amo minter was set correctly + assertEq(address(aaveAmo.amoMinter()), address(amoMinter)); + } + + function testAaveAmoSetup_ShouldSet_aavePool() public { + // Verify the Aave pool was set correctly + assertEq(address(aaveAmo.aavePool()), address(aavePool)); + } + + function testAaveAmoSetup_ShouldSet_aaveRewardsController() public { + // Verify the Aave rewards controller was set correctly + assertEq( + address(aaveAmo.aaveRewardsController()), + address(rewardsController) + ); + } + + function testConstructor_ShouldRevertWhenOwnerIsZeroAddress() public { + // Test with zero address for owner + vm.expectRevert("Owner address cannot be zero"); + new AaveAmo( + address(0), // Invalid owner address + address(amoMinter), + address(aavePool), + address(rewardsController) + ); + } + + function testConstructor_ShouldRevertWhenAmoMinterIsZeroAddress() public { + // Test with zero address for Amo minter + vm.expectRevert("Amo minter address cannot be zero"); + new AaveAmo( + owner, + address(0), // Invalid Amo minter address + address(aavePool), + address(rewardsController) + ); + } + + function testConstructor_ShouldRevertWhenAavePoolIsZeroAddress() public { + // Test with zero address for Aave pool + vm.expectRevert("Aave pool address cannot be zero"); + new AaveAmo( + owner, + address(amoMinter), + address(0), // Invalid Aave pool address + address(rewardsController) + ); + } + + function testConstructor_ShouldRevertWhenAaveRewardsControllerIsZeroAddress() + public + { + // Test with zero address for Aave + vm.expectRevert("Aave rewards controller address cannot be zero"); + new AaveAmo( + owner, + address(amoMinter), + address(aavePool), + address(0) // Invalid Aave rewards controller address + ); + } + + /* ========== Aave Amo COLLATERAL TESTS ========== */ + + function testAaveDepositCollateral_ShouldDepositSuccessfully() public { + uint256 depositAmount = 1000e18; + + // Mints collateral to Amo + vm.prank(collateralOwner); + collateralToken.mint(address(aaveAmo), depositAmount); + + // Owner deposits collateral to Aave Pool + vm.prank(owner); + aaveAmo.aaveDepositCollateral(address(collateralToken), depositAmount); + + // Check if the deposit was successful + assertApproxEqAbs( + aToken.balanceOf(address(aaveAmo)), + depositAmount, + 1e2 + ); // little error this is due to interest rate + assertEq(collateralToken.balanceOf(address(aaveAmo)), 0); + } + + function testAaveWithdrawCollateral_ShouldWithdrawSuccessfully() public { + uint256 depositAmount = 1000e18; + + // Mints collateral to Amo + vm.prank(collateralOwner); + collateralToken.mint(address(aaveAmo), depositAmount); + + // Owner deposits collateral to Aave Pool + vm.prank(owner); + aaveAmo.aaveDepositCollateral(address(collateralToken), depositAmount); + + // Check balances before withdrawal + assertApproxEqAbs( + aToken.balanceOf(address(aaveAmo)), + depositAmount, + 1e2 + ); // little error this is due to interest rate + assertEq(collateralToken.balanceOf(address(aaveAmo)), 0); + + uint256 withdrawAmount = aToken.balanceOf(address(aaveAmo)); + + // Owner withdraws collateral from Aave Pool + vm.prank(owner); + aaveAmo.aaveWithdrawCollateral( + address(collateralToken), + withdrawAmount + ); + assertEq(aToken.balanceOf(address(aaveAmo)), 0); + assertEq(collateralToken.balanceOf(address(aaveAmo)), withdrawAmount); + } + + function testAaveDeposit_ShouldRevertIfNotOwner() public { + uint256 depositAmount = 1e18; + + // Attempting to deposit as a non-owner should revert + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.aaveDepositCollateral(address(collateralToken), depositAmount); + } + + function testAaveWithdraw_ShouldRevertIfNotOwner() public { + uint256 withdrawAmount = 1e18; + + // Attempting to withdraw as a non-owner should revert + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.aaveWithdrawCollateral( + address(collateralToken), + withdrawAmount + ); + } + + /* ========== Aave Amo MINTER TESTS ========== */ + + function testReturnCollateralToMinter_ShouldWork() public { + uint256 returnAmount = 1000e18; + + // Mints collateral to Amo + vm.prank(collateralOwner); + collateralToken.mint(address(aaveAmo), returnAmount); + + // Owner returns collateral to the Amo Minter + vm.prank(owner); + aaveAmo.returnCollateralToMinter(returnAmount); + + // Verify pool received collateral + assertEq( + collateralToken.balanceOf(address(ubiquityPoolFacet)), + returnAmount + ); + } + + function testReturnCollateralToMinter_ShouldRevertIfNotOwner() public { + uint256 returnAmount = 1000e18; + + // Revert if a non-owner tries to return collateral + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.returnCollateralToMinter(returnAmount); + } + + function testSetAmoMinter_ShouldWorkWhenCalledByOwner() public { + // Set new Amo minter address + vm.prank(owner); + aaveAmo.setAmoMinter(newAmoMinterAddress); + + // Verify the new Amo minter address was set + assertEq(address(aaveAmo.amoMinter()), newAmoMinterAddress); + } + + function testSetAmoMinter_ShouldRevertIfNotOwner() public { + // Attempting to set a new Amo minter address as a non-owner should revert + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.setAmoMinter(newAmoMinterAddress); + } + + /* =========== Aave Amo REWARDS TESTS =========== */ + + function testClaimAllRewards_ShouldClaimRewardsSuccessfully() public { + uint256 depositAmount = 1000e18; + + // Mints collateral to Amo + vm.prank(collateralOwner); + collateralToken.mint(address(aaveAmo), depositAmount); + + // Owner deposits collateral to Aave Pool + vm.prank(owner); + aaveAmo.aaveDepositCollateral(address(collateralToken), depositAmount); + + // Specify assets to claim rewards for + address[] memory assets = new address[](1); + assets[0] = aavePool + .getReserveData(address(collateralToken)) + .aTokenAddress; + + // Claim rewards from Aave + vm.prank(owner); + aaveAmo.claimAllRewards(assets); + + // Verify the rewards were claimed successfully + assertTrue(true); + } + + /* ========== Aave Amo EMERGENCY TESTS ========== */ + + function testRecoverERC20_ShouldTransferERC20ToOwner() public { + uint256 tokenAmount = 1000e18; + + // Mint some tokens to AaveAmo + MockERC20 mockToken = new MockERC20("Mock Token", "MTK", 18); + mockToken.mint(address(aaveAmo), tokenAmount); + + // Recover tokens as the owner + vm.prank(owner); + aaveAmo.recoverERC20(address(mockToken), tokenAmount); + + // Check if the tokens were transferred to the owner + assertEq(mockToken.balanceOf(owner), tokenAmount); + } + + function testRecoverERC20_ShouldRevertIfNotOwner() public { + uint256 tokenAmount = 1000e18; + + // Revert if non-owner attempts to recover tokens + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.recoverERC20(address(collateralToken), tokenAmount); + } + + function testExecute_ShouldExecuteCallSuccessfully() public { + // Example of executing a simple call + vm.prank(owner); + (bool success, ) = aaveAmo.execute(owner, 0, ""); + + // Verify the call executed successfully + assertTrue(success); + } + + function testExecute_ShouldRevertIfNotOwner() public { + // Attempting to call execute as a non-owner should revert + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + aaveAmo.execute(owner, 0, ""); + } +} diff --git a/packages/contracts/test/amo/UbiquityAmoMinter.t.sol b/packages/contracts/test/amo/UbiquityAmoMinter.t.sol new file mode 100644 index 000000000..4613e0d79 --- /dev/null +++ b/packages/contracts/test/amo/UbiquityAmoMinter.t.sol @@ -0,0 +1,274 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +import "forge-std/Test.sol"; +import {DiamondTestSetup} from "../diamond/DiamondTestSetup.sol"; +import {UbiquityAmoMinter} from "../../src/dollar/core/UbiquityAmoMinter.sol"; +import {AaveAmo} from "../../src/dollar/amo/AaveAmo.sol"; +import {MockERC20} from "../../src/dollar/mocks/MockERC20.sol"; +import {IUbiquityPool} from "../../src/dollar/interfaces/IUbiquityPool.sol"; +import {MockChainLinkFeed} from "../../src/dollar/mocks/MockChainLinkFeed.sol"; + +contract UbiquityAmoMinterTest is DiamondTestSetup { + UbiquityAmoMinter amoMinter; + AaveAmo aaveAmo; + MockERC20 collateralToken; + MockChainLinkFeed collateralTokenPriceFeed; + + address newPoolAddress = address(4); // mock new pool address + address nonAmo = address(9999); + + function setUp() public override { + super.setUp(); + + // Initialize mock collateral token and price feed + collateralToken = new MockERC20("Mock Collateral", "MCT", 18); + collateralTokenPriceFeed = new MockChainLinkFeed(); + + // Deploy UbiquityAmoMinter contract + amoMinter = new UbiquityAmoMinter( + owner, + address(collateralToken), // Collateral token address + 0, // Collateral index + address(ubiquityPoolFacet) // Pool address + ); + + // Deploy AaveAmo contract + aaveAmo = new AaveAmo( + owner, + address(amoMinter), + address(1), + address(2) + ); + + // Enable AaveAmo as a valid Amo + vm.prank(owner); + amoMinter.enableAmo(address(aaveAmo)); + + vm.startPrank(admin); // Prank as admin for pool setup + + // Add collateral token to the pool with a ceiling + uint256 poolCeiling = 500_000e18; + ubiquityPoolFacet.addCollateralToken( + address(collateralToken), + address(collateralTokenPriceFeed), + poolCeiling + ); + + // Enable collateral and register Amo Minter + ubiquityPoolFacet.toggleCollateral(0); + ubiquityPoolFacet.addAmoMinter(address(amoMinter)); + + // Mint collateral to the pool + collateralToken.mint(address(ubiquityPoolFacet), 500_000e18); + + vm.stopPrank(); + } + + function testConstructor_ShouldInitializeCorrectly() public { + // Deploy a new instance of the UbiquityAmoMinter contract + UbiquityAmoMinter newAmoMinter = new UbiquityAmoMinter( + owner, + address(collateralToken), // Collateral token address + 0, // Collateral index + address(ubiquityPoolFacet) // Pool address + ); + + // Verify the owner is set correctly + assertEq(newAmoMinter.owner(), owner); + + // Verify the collateral token is set correctly + assertEq( + address(newAmoMinter.collateralToken()), + address(collateralToken) + ); + + // Verify the collateral index is set correctly + assertEq(newAmoMinter.collateralIndex(), 0); + + // Verify the pool address is set correctly + assertEq(address(newAmoMinter.pool()), address(ubiquityPoolFacet)); + + // Verify the missing decimals calculation + assertEq( + newAmoMinter.missingDecimals(), + uint256(18) - collateralToken.decimals() + ); + } + + function testConstructor_ShouldRevertIfOwnerIsZero() public { + // Ensure the constructor reverts if the owner address is zero + vm.expectRevert("Owner address cannot be zero"); + new UbiquityAmoMinter( + address(0), + address(collateralToken), // Collateral token address + 0, // Collateral index + address(ubiquityPoolFacet) // Pool address + ); + } + + function testConstructor_ShouldRevertIfPoolAddressIsZero() public { + // Ensure the constructor reverts if the pool address is zero + vm.expectRevert("Pool address cannot be zero"); + new UbiquityAmoMinter( + owner, + address(collateralToken), // Collateral token address + 0, // Collateral index + address(0) // Pool address + ); + } + + /* ========== Tests for Amo management ========== */ + + function testEnableAmo_ShouldWorkWhenCalledByOwner() public { + // Test enabling a new Amo + address newAmo = address(10); + vm.prank(owner); + amoMinter.enableAmo(newAmo); + + // Check if the new Amo is enabled + assertEq(amoMinter.Amos(newAmo), true); + } + + function testDisableAmo_ShouldWorkWhenCalledByOwner() public { + // Test disabling the AaveAmo + vm.prank(owner); + amoMinter.disableAmo(address(aaveAmo)); + + // Check if the Amo is disabled + assertEq(amoMinter.Amos(address(aaveAmo)), false); + } + + function testEnableAmo_ShouldRevertWhenCalledByNonOwner() public { + // Ensure only the owner can enable Amos + address newAmo = address(10); + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + amoMinter.enableAmo(newAmo); + } + + function testDisableAmo_ShouldRevertWhenCalledByNonOwner() public { + // Ensure only the owner can disable Amos + vm.prank(nonAmo); + vm.expectRevert("Ownable: caller is not the owner"); + amoMinter.disableAmo(address(aaveAmo)); + } + + /* ========== Tests for giveCollateralToAmo ========== */ + + function testGiveCollatToAmo_ShouldWorkWhenCalledByOwner() public { + uint256 collatAmount = 1000e18; + + // Owner gives collateral to the AaveAmo + vm.prank(owner); + amoMinter.giveCollateralToAmo(address(aaveAmo), collatAmount); + + // Verify the balances + assertEq( + amoMinter.collateralBorrowedBalances(address(aaveAmo)), + int256(collatAmount) + ); + assertEq( + amoMinter.collateralTotalBorrowedBalance(), + int256(collatAmount) + ); + } + + function testGiveCollatToAmo_ShouldRevertWhenNotValidAmo() public { + uint256 collatAmount = 1000e18; + + // Ensure giving collateral to a non-Amo address reverts + vm.prank(owner); + vm.expectRevert("Invalid Amo"); + amoMinter.giveCollateralToAmo(nonAmo, collatAmount); + } + + function testGiveCollatToAmo_ShouldRevertWhenExceedingBorrowCap() public { + uint256 collatAmount = 200000e18; // Exceeds the default borrow cap of 100_000 + + // Ensure exceeding the borrow cap reverts + vm.prank(owner); + vm.expectRevert("Borrow cap exceeded"); + amoMinter.giveCollateralToAmo(address(aaveAmo), collatAmount); + } + + /* ========== Tests for receiveCollateralFromAmo ========== */ + + // This function is actually intended to be called by the Amo, but we can test it by calling it directly + function testReceiveCollatFromAmo_ShouldWorkWhenCalledByValidAmo() public { + uint256 collatAmount = 1000e18; + + uint256 poolBalance = collateralToken.balanceOf( + address(ubiquityPoolFacet) + ); + + // First, give collateral to the Amo + vm.prank(owner); + amoMinter.giveCollateralToAmo(address(aaveAmo), collatAmount); + + // Amo returns collateral + vm.startPrank(address(aaveAmo)); + collateralToken.approve(address(amoMinter), collatAmount); + amoMinter.receiveCollateralFromAmo(collatAmount); + vm.stopPrank(); + + // Verify the balances + assertEq(amoMinter.collateralBorrowedBalances(address(aaveAmo)), 0); + assertEq(amoMinter.collateralTotalBorrowedBalance(), 0); + assertEq(collateralToken.balanceOf(address(aaveAmo)), 0); + assertEq(collateralToken.balanceOf(address(amoMinter)), 0); + assertEq( + poolBalance, + collateralToken.balanceOf(address(ubiquityPoolFacet)) + ); + } + + function testReceiveCollatFromAmo_ShouldRevertWhenNotValidAmo() public { + uint256 collatAmount = 1000e18; + + // Ensure non-Amo cannot return collateral + vm.prank(nonAmo); + vm.expectRevert("Invalid Amo"); + amoMinter.receiveCollateralFromAmo(collatAmount); + } + + /* ========== Tests for setCollateralBorrowCap ========== */ + + function testSetCollatBorrowCap_ShouldWorkWhenCalledByOwner() public { + uint256 newCap = 5000000e6; // new cap + + // Owner sets new collateral borrow cap + vm.prank(owner); + amoMinter.setCollateralBorrowCap(newCap); + + // Verify the collateral borrow cap was updated + assertEq(amoMinter.collateralBorrowCap(), int256(newCap)); + } + + function testSetCollatBorrowCap_ShouldRevertWhenCalledByNonOwner() public { + uint256 newCap = 5000000e6; // new cap + + // Ensure non-owner cannot set the cap + vm.prank(address(1234)); + vm.expectRevert("Ownable: caller is not the owner"); + amoMinter.setCollateralBorrowCap(newCap); + } + + /* ========== Tests for setPool ========== */ + + function testSetPool_ShouldWorkWhenCalledByOwner() public { + // Owner sets new pool + vm.prank(owner); + amoMinter.setPool(newPoolAddress); + + // Verify the pool address was updated + assertEq(address(amoMinter.pool()), newPoolAddress); + } + + function testSetPool_ShouldRevertWhenCalledByNonOwner() public { + // Ensure non-owner cannot set the pool + vm.prank(address(1234)); + vm.expectRevert("Ownable: caller is not the owner"); + amoMinter.setPool(newPoolAddress); + } +}