Conversation
Forge Build Sizes
🔕 Unchanged
|
♻️ Forge Gas SnapshotsSeems like you are not measuring gas of any operations yet. 🤔 |
🌈 Test ResultsNo files changed, compilation skipped
Ran 7 tests for test/GhoDirectMinter.t.sol:GHODirectMinter_Test
[PASS] test_mintAndSupply_council(uint256) (runs: 256, μ: 245222, ~: 244950)
[PASS] test_mintAndSupply_owner(uint256) (runs: 256, μ: 242921, ~: 242649)
[PASS] test_mintAndSupply_rando() (gas: 18366)
[PASS] test_transferExcessToTreasury() (gas: 919147)
[PASS] test_withdrawAndBurn_council(uint256,uint256) (runs: 256, μ: 309765, ~: 311012)
[PASS] test_withdrawAndBurn_owner(uint256,uint256) (runs: 256, μ: 305510, ~: 306757)
[PASS] test_withdrawAndBurn_rando() (gas: 18266)
Suite result: ok. 7 passed; 0 failed; 0 skipped; finished in 1.08s (1.95s CPU time)
Ran 13 tests for test/GhoDirectMinterV4.t.sol:GHODirectMinterV4_Test
[PASS] test_mintAndSupply_council(uint256) (runs: 256, μ: 124534, ~: 124248)
[PASS] test_mintAndSupply_exceedsBucketCapacity() (gas: 98089)
[PASS] test_mintAndSupply_owner(uint256) (runs: 256, μ: 122326, ~: 122040)
[PASS] test_mintAndSupply_revertsWith_InvalidCaller() (gas: 18255)
[PASS] test_mintAndSupply_zeroAmount() (gas: 21755)
[PASS] test_setup() (gas: 80064)
[PASS] test_transferExcessToTreasury() (gas: 355290)
[PASS] test_transferExcessToTreasury_noExcess(uint256) (runs: 256, μ: 119511, ~: 119225)
[PASS] test_withdrawAndBurn_council(uint256,uint256) (runs: 256, μ: 166955, ~: 167387)
[PASS] test_withdrawAndBurn_exceedsSpokeBalance() (gas: 110547)
[PASS] test_withdrawAndBurn_owner(uint256,uint256) (runs: 256, μ: 162748, ~: 163180)
[PASS] test_withdrawAndBurn_rando() (gas: 18322)
[PASS] test_withdrawAndBurn_zeroBalance() (gas: 52408)
Suite result: ok. 13 passed; 0 failed; 0 skipped; finished in 1.08s (1.13s CPU time)
Ran 2 test suites in 1.08s (2.16s CPU time): 20 tests passed, 0 failed, 0 skipped (20 total tests) |
🔮 Coverage report
|
| /// @notice Transfers excess GHO interest (added shares above facilitator bucket level) to the fee receiver. | ||
| /// @dev Callable by anyone. | ||
| /// @dev Due to rounding in the share conversion, the amount transferred may be slightly less than the true excess. | ||
| /// This is neglectable and should not have any impact on the system. |
There was a problem hiding this comment.
| /// This is neglectable and should not have any impact on the system. | |
| /// @dev This is negligible and should not have any impact on the system. |
Dev tag and word change, but perhaps fine as is
| import {Initializable} from "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; | ||
| import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; | ||
| import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
| import { | ||
| UpgradeableOwnableWithGuardian | ||
| } from "solidity-utils/contracts/access-control/UpgradeableOwnableWithGuardian.sol"; |
There was a problem hiding this comment.
| import {Initializable} from "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; | |
| import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; | |
| import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; | |
| import { | |
| UpgradeableOwnableWithGuardian | |
| } from "solidity-utils/contracts/access-control/UpgradeableOwnableWithGuardian.sol"; | |
| import { | |
| UpgradeableOwnableWithGuardian | |
| } from "solidity-utils/contracts/access-control/UpgradeableOwnableWithGuardian.sol"; | |
| import {Initializable} from "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; | |
| import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; | |
| import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; |
| HUB = IHub(hub_); | ||
| ASSET_ID = HUB.getAssetId(gho_); // reverts on invalid `underlying` | ||
| GHO = IGhoToken(gho_); | ||
| _disableInitializers(); |
There was a problem hiding this comment.
@miguelmtzinf had wanted this as first line of constructor on another PR of mine. I'm personally fine like this, but just checking if that's the convention we want
| /// @dev Constructor. | ||
| /// @param hub_ The address of the Aave v4 Hub. | ||
| /// @param gho_ The address of the GHO token. | ||
| constructor(address hub_, address gho_) { |
There was a problem hiding this comment.
What do we think about having this more flexible so it can mint GHO to multiple hubs if needed?
Is that unnecessary?
| _withdrawAndBurn(supplyAmount, withdrawAmount, council); | ||
| } | ||
|
|
||
| function test_withdrawAndBurn_rando() external { |
There was a problem hiding this comment.
| function test_withdrawAndBurn_rando() external { | |
| function test_withdrawAndBurn_revertsWith_InvalidCaller() external { |
| uint256 excess = spokeAddedAssets - level; | ||
| uint256 expectedShares = hub.previewAddByAssets(ghoAssetId, excess); | ||
|
|
||
| minter.transferExcessToTreasury(); |
There was a problem hiding this comment.
Do you want to ensure we are actually transferring at least 1 share here? This works even if it's a nop (ofc as you know since you have a test showcasing)
Add GhoDirectMinterV4, a GHO facilitator that injects (mints) and removes (burns) GHO from an Aave v4 Hub. The minter is expected to be registered as a spoke on the Hub with infinite addCap. mintAndSupply mints GHO and adds it as liquidity to the Hub, withdrawAndBurn removes GHO liquidity and burns it, and transferExcessToTreasury transfers excess interest (added shares above the facilitator bucket level) to the Hub's fee receiver.