-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BqETH subscription (no encryptor fees yet) #272
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - just some suggestions/comments.
Co-authored-by: Derek Pierre <[email protected]>
a2b139e
to
37033a8
Compare
Co-authored-by: Derek Pierre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base fee logic looks good to me!
* @notice Pays for a subscription | ||
*/ | ||
function payForSubscription() external { | ||
// require(endOfSubscription == 0, "Subscription already payed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// require(endOfSubscription == 0, "Subscription already payed"); | |
// require(endOfSubscription == 0, "Subscription already paid"); |
uint32 public constant INACTIVE_RITUAL_ID = type(uint32).max; | ||
|
||
// TODO: DAO Treasury | ||
// TODO: Should it be updatable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still in an experimentation phase for fee models, even within the context of a single adopter. So we need a way in the near-term, without involving the DAO Treasury, to make structural changes to individual subscription contracts, the grace periods, and corresponding powers granted to / removed from cohort admins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case contract could be upgradable and belong not to dao but some multisig
other similar options is create setters/getters for all parameters that can be changed by multisig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -39,9 +39,9 @@ contract ManagedAllowList is GlobalAllowList { | |||
*/ | |||
constructor( | |||
Coordinator _coordinator, | |||
IFeeModel _feeModel, | |||
UpfrontSubscriptionWithEncryptorsCap _subscription |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is IFeeModel.sol where the logic for encryptor annual credits will live, or will it be on a per-adopter basis for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both statements are correct, IFeeModel implementation can have credits and such contracts will be on a per-adopter basis for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass
|
||
function extendRitual(uint32 ritualId, uint32 duration) external { | ||
Ritual storage ritual = rituals[ritualId]; | ||
require(msg.sender == ritual.initiator, "Only initiator can extend ritual"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the moment this is fine, but in the future we may want to relax this restriction (cc @arjunhassard ). See the last discussion in #93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we tell BqETH that anyone can extend the ritual?
uint32 duration | ||
) external override { | ||
processPayment(initiator, ritualId, numberOfProviders, duration); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the code is the same than processRitualPayment()
, do you think we need a separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, FlatRateFeeModel
is just one fee model, for subscription is different
@@ -9,17 +9,35 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |||
* @notice IFeeModel | |||
*/ | |||
interface IFeeModel { | |||
function currency() external view returns (IERC20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing the currency()
interface here? Maybe it's because we're moving towards a credits system? In any case, functions to calculate cost are still defined with a reference currency token, so I'd keep this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because FeeModel is more flexible, just imagine fee model without payment
uint32 public constant INACTIVE_RITUAL_ID = type(uint32).max; | ||
|
||
// TODO: DAO Treasury | ||
// TODO: Should it be updatable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// TODO: DAO Treasury | ||
// TODO: Should it be updatable? | ||
address public immutable beneficiary; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this to treasury
. Beneficiary is a loaded term from the staking contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In one of the next PR I've changed it to Ownable contract to be able to transfer this role, and I'll rename rest to treasury in that PR 👍
Type of PR:
Required reviews:
What this does:
Issues fixed/closed:
Refs nucypher/tdec#169
Refs #262
Why it's needed:
Notes for reviewers:
Based on #271