Skip to content

[Lesson 32] [Fund subscription] Question about importing abstract contract containing constant variables #2954

Answered by NikolayPIvanov
tcrin asked this question in Q&A
Discussion options

You must be logged in to vote

From what I know so far, this has to do with how constants are stored in Solidity - at compile-time they become part of the bytecode - reference to Solidity docs

This means that in your example, LOCAL_CHAIN_ID which is part of CodeConstants contract is nowhere in the bytecode of the FundSubscription contract. I think that if you inherit CodeConstants your code will compile

contract FundSubscription is Script, CodeConstants {
  ...
}

If you wish to have something that you do not need to inherit, check out libraries.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@tcrin
Comment options

@EngrPips
Comment options

Answer selected by tcrin
Comment options

You must be logged in to vote
6 replies
@heheboii11
Comment options

@tcrin
Comment options

@EngrPips
Comment options

@tcrin
Comment options

@EngrPips
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants