Skip to content

Comments

Feat: Mint fee shares with pre-donation share price #1172

Closed
yan-man wants to merge 4 commits intodevfrom
feat/mint-feeAmount-accrual
Closed

Feat: Mint fee shares with pre-donation share price #1172
yan-man wants to merge 4 commits intodevfrom
feat/mint-feeAmount-accrual

Conversation

@yan-man
Copy link
Contributor

@yan-man yan-man commented Feb 3, 2026

No description provided.


address oldFeeReceiver = asset.feeReceiver;
if (oldFeeReceiver != config.feeReceiver) {
_mintFeeShares(asset, assetId);
Copy link
Contributor Author

@yan-man yan-man Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: if we call toAddedSharesDown after FEE_AMOUNT_SLOT is set, then we can avoid calling getUnrealizedFees twice, instead we can read from transient:

return totalAddedSupplierAssets - feeAmount;


emit IHub.UpdateAsset(assetId, drawnIndex, newDrawnRate, asset.realizedFees);
uint120 feeShares = FEE_SHARES_SLOT.tload().toUint120();
if (feeShares > 0) {
Copy link
Contributor Author

@yan-man yan-man Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: issue is that this still opens griefing vector for fees < 1 share

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

griefing allowed for > 1 also. here 100% of the fees can be griefed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, just meant it doesnt protect < 1 share either. so yep vector still present

@yan-man
Copy link
Contributor Author

yan-man commented Feb 3, 2026

see #1178

@yan-man yan-man closed this Feb 3, 2026
@yan-man yan-man deleted the feat/mint-feeAmount-accrual branch February 10, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants