Requested changes from PR 29#44
Conversation
|
|
||
| function updateRegistryFeeShare(uint256 _registryFeeShare) external onlyOwner { | ||
| registryFeeShare = _registryFeeShare; | ||
| totalFeeShare = creatorFeeShare + registryFeeShare; |
There was a problem hiding this comment.
totalFeeShare can become zero if divided by zero
Add require(totalFeeShare > 0) after updating fee shares, or validate individual shares.
| vm.stopPrank(); | ||
| } | ||
|
|
||
| function test_claimRegistryFee() public { |
There was a problem hiding this comment.
claimCreatorFee and claimRegistryFee track separate claimedAt timestamps and compute fees using current fee shares (not the shares at subscription time)
users could set high register fee and drain balance.
the old design didn't have this issue as it computed and transferred fee splits at subscription time.
to fix: Store fee shares in the Subscription struct at subscribe time and use those for claims, and use single claimedAt. Make sure fee share changes only affect future subscriptions, so users aren't setting fees very high then returning normal to be able to drain the contract
There was a problem hiding this comment.
already merged (deadlines...) but will fix
Summary
Addresses requested changes from PR #29 audit review. Implements pull-payment model for fees (claim vs. immediate transfer), subscription cancellation with prorated refunds, typo fix, zero-address validation, and additional tests. README and RPC API refs updated.
Changes
Asset
claimCreatorFeeandclaimRegistryFeeinstead of immediate transfer.subscriptionsnow mapsbytes32(id)toSubscription { startTime, endTime, subscriptionPrice }; uses nonces andEnumerableSetfor subscribers.claimCreatorFee(subscriber); registry claims viaclaimRegistryFee(subscriber)on the Asset (registry calls it viaclaimRegistryFee(assetId, subscriber)).cancelSubscription()allows users to cancel and receive prorated refund.revokeSubscription(owner) also triggers prorated refund.onlyRegsitryOrOwner→onlyRegistryOrOwner._owner == address(0)or_tokenAddress == address(0).AssetRegistry
getFees(uint256 _value)returning(creatorFee, registryFee).claimRegistryFee(assetId, subscriber)to pull registry share.viewSubscription(bytes32)→viewMySubscription(bytes32),getSubscription(bytes32)→getMySubscription(bytes32).Interfaces
Tests
claimRegistryFeetests.Documentation
registries_*.jsonupdates.