Feat: Mint fee shares with pre-donation share price #1172
Feat: Mint fee shares with pre-donation share price #1172
Conversation
|
|
||
| address oldFeeReceiver = asset.feeReceiver; | ||
| if (oldFeeReceiver != config.feeReceiver) { | ||
| _mintFeeShares(asset, assetId); |
There was a problem hiding this comment.
note: bc I opted to combine into updateDrawnRateAndMintFeeShares rather than split into 2 separate fns, this means that old fee receiver can lose fees accrued since last action. Shouldnt be much lost though now given fees are accrued on every action. Did this to avoid having to always remember to call mintFeeShares after updateDrawnRate and associated mental overhead of that
another option is to leave a restricted mintFeeShares action in place so gov can call that before changing feeReceiver
| asset.realizedFees += asset.getUnrealizedFees(drawnIndex).toUint120(); | ||
| uint256 feeAmount = asset.getUnrealizedFees(drawnIndex); | ||
| FEE_AMOUNT_SLOT.tstore(feeAmount); | ||
| uint256 feeShares = asset.toAddedSharesDown(feeAmount); |
There was a problem hiding this comment.
note: if we call toAddedSharesDown after FEE_AMOUNT_SLOT is set, then we can avoid calling getUnrealizedFees twice, instead we can read from transient:
aave-v4/src/hub/libraries/AssetLogic.sol
Line 108 in 8caf672
|
|
||
| emit IHub.UpdateAsset(assetId, drawnIndex, newDrawnRate, asset.realizedFees); | ||
| uint120 feeShares = FEE_SHARES_SLOT.tload().toUint120(); | ||
| if (feeShares > 0) { |
There was a problem hiding this comment.
note: issue is that this still opens griefing vector for fees < 1 share
There was a problem hiding this comment.
griefing allowed for > 1 also. here 100% of the fees can be griefed
There was a problem hiding this comment.
yeah, just meant it doesnt protect < 1 share either. so yep vector still present
|
see #1178 |
No description provided.