-
Notifications
You must be signed in to change notification settings - Fork 139
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
Define contract from two files #1267
Comments
@friedger Since it's an edge case that will only be used for pox contracts (and maybe other boot contracts), are we sure that pox-4 will be tested with clarinet? Also, since this is only for boot contracts, I wonder if we want to hard code this logic for boot contracts or if we want to let anyone do it in the Clarinet.toml, which might a bit weird I guess 🤔 |
@hugocaillard I have seen different cases where changes needs to be made between testnet and mainnet. For example, all contract that reference a SIP trait or when mock/debug functions are used. It can help improve the process of testnet mainnet switching in general. |
@friedger Ok I see. So the need for pox-4 is not just to concat two files, but to do it conditionally depending on the env? [contracts.pox-4]
[mainnet]
paths = ['contracts/pox-mainnet.clar', 'contracts/pox-4.clar']
[testnet]
paths = ['contracts/pox-testnet.clar', 'contracts/pox-4.clar']
[devnet]
paths = ['contracts/pox-testnet.clar', 'contracts/pox-4.clar']
clarity_version = 2
epoch = 2.4 |
For traits, the referenced contracts are different like SP123.sip-10-trait vs ST987.trait-sip10 The deployed code will be different. Your suggestion would be a great solution. |
@friedger The recommended way is to handle it with clarinet is to add |
@friedger While we work on a standard to "embed" or "concatenate" contracts – at the Clarity or Clarinet level – do you think we could get pox-4.clar to avoid the issue completely and leverage It could define the constants like so in (define-constant PREPARE_CYCLE_LENGTH (if is-in-mainnet u100 u50)) |
I'll try to push for that solution |
Hey @friedger. I'm closing for now feel free to re-open at any point if needed |
Is your feature request related to a problem? Please describe.
pox-4 contract is the concatenation of pox-4.clar and pox-mainnet.clar or pox-testnet.clar
There is currently no way to define this in Clarinet.toml
Describe the solution you'd like
It would be nice to use a list of path and the resulting contract code consists of the concatenation of the listed files.
Describe alternatives you've considered
Currently, we duplicate the code and add unit tests to ensure the the two copies stay in sync
Additional context
stacks-network/stacks-core#4094 (comment)
The text was updated successfully, but these errors were encountered: