Skip to content
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

IFeeModel/Subscription contract should be provided as a contract address #342

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

derekpierre
Copy link
Member

Type of PR:

  • Bugfix
  • Feature
  • Documentation
  • Other

Required reviews:

  • 1
  • 2
  • 3

What this does:
SubscriptionContracts/Fee Models are per adopter i.e. the address used is different every time. Therefore, parameters that take this value should take the value as a

Issues fixed/closed:

  • Fixes #...

Why it's needed:

Explain how this PR fits in the greater context of the NuCypher Network.
E.g., if this PR address a nucypher/productdev issue, let reviewers know!

Notes for reviewers:

What should reviewers focus on?
Is there a particular commit/function/section of your PR that requires more attention from reviewers?

@derekpierre derekpierre changed the title [WIP] IFeeModel/Subscription contracts should be provided as contract addresses [WIP] IFeeModel/Subscription contract should be provided as contract addresses Jan 21, 2025
@derekpierre derekpierre changed the title [WIP] IFeeModel/Subscription contract should be provided as contract addresses [WIP] IFeeModel/Subscription contract should be provided as a contract address Jan 21, 2025
@derekpierre derekpierre changed the title [WIP] IFeeModel/Subscription contract should be provided as a contract address IFeeModel/Subscription contract should be provided as a contract address Jan 22, 2025
@derekpierre derekpierre self-assigned this Jan 22, 2025
@derekpierre derekpierre marked this pull request as ready for review January 22, 2025 18:46
# if using a subcription, duration needs to be calculated
if fee_model == "StandardSubscription":
# if using a subscription, duration needs to be calculated
if fee_model_contract.contract_type.name == "StandardSubscription":
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this will work? My understanding is that in L114, ape will instantiate fee_model_contract as a generic Contract, so I'm unsure that fee_model_contract.contract_type.name will be available for this check.

Copy link
Member Author

@derekpierre derekpierre Jan 23, 2025

Choose a reason for hiding this comment

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

Yep. Tested it in ape-console and by running the command using Marlin's subscription contract and then quitting once the time came to sign a tx. You can try it out.

Using Contract(...) should automatically fetch the information from the ape-etherscan configured explorer, if it can't get it locally - https://github.com/ApeWorX/ape/blob/v0.8.14/src/ape/managers/chain.py#L1339. It can obtain the ABI from the explorer.

This has been further improved in newer Ape versions as well - https://docs.apeworx.io/ape/stable/userguides/contracts.html#from-any-address (not our current version, but shows that the pattern holds moving forward).

…sses instead of by name. Subscription contracts are different for each adopter.
@derekpierre derekpierre force-pushed the provide-subscription-address branch from c8728f9 to 1983a67 Compare January 23, 2025 18:35
@derekpierre derekpierre merged commit cb53054 into nucypher:main Jan 24, 2025
2 checks passed
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.

3 participants