Skip to content

Conversation

shark0der
Copy link
Contributor

Context

#1121

Changes proposed in this pull request

Move enums and structs into their interfaces instead of having them at file level.
The ClaimMethod enum and the following structs that were left as is are because they're being referenced in other contracts.

ICoverProducts: ProductInitializationParams
IStakingPool: AllocationRequest, BurnStakeParams
IPool: SwapDetails, Asset
ICover: PoolAllocationRequest, BuyCoverParams, Product, ProductType, PoolAllocation, CoverData, CoverSegment

Note: There's also a workaround that can be used sometimes to avoid clashes in the future by importing only the desired symbols from the target file using the following syntax: import { IIndividualClaims } from "./IIndividualClaims.sol";. This way the Configuration struct wouldn't be imported. This won't always work, for example if you import two files while both are importing of everything from IIndividualClaims.sol.

Test plan

Used the following script to generate a file that imports all interfaces:

cd contracts/interfaces
for i in *; do echo "import \"../../interfaces/$i\";"; done | grep -v IERC20.sol > ../ImportEverything.sol

IERC20 is excluded because of the ^0.5.0 pragma which breaks the import as there's more than one IERC20: one for 0.5 pragma, one for 0.8.

The generated contract compiled fine but I don't feel like it's a good idea to add it to git because:

  1. It needs to be constantly updated as we add new contracts
  2. It's not bulletproof - there can be still structs in other files (besides interfaces)

So instead of slowing down the compilation with newer files we should rather watch out for these issues when reviewing PRs.

Checklist

  • Rebased the base branch
  • Attached corresponding Github issue
  • Prefixed the name with the type of change (i.e. feat, chore, test)
  • Performed a self-review of my own code
  • Followed the style guidelines of this project
  • Made corresponding changes to the documentation
  • Didn't generate new warnings
  • Didn't generate failures on existing tests
  • Added tests that prove my fix is effective or that my feature works

Review

When reviewing a PR, please indicate intention in comments using the following emojis:

  • 🍰 = Nice to have but not essential.
  • 💡 = Suggestion or a comment based on personal opinion
  • 🔨 = I believe this should be changed.
  • 🤔 = I don’t understand something, do you mind giving me more context?
  • 🚀 = Feedback

@shark0der shark0der requested review from MilGard91 and rackstar June 20, 2024 17:20
@shark0der shark0der force-pushed the chore/data-types-namespacing branch from e355296 to e2dd99f Compare June 20, 2024 17:22
@shark0der shark0der linked an issue Jun 20, 2024 that may be closed by this pull request
Copy link
Contributor

@MilGard91 MilGard91 left a comment

Choose a reason for hiding this comment

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

LGTM

@MilGard91 MilGard91 merged commit c1a99a8 into feature/cover-products-contract-rebased Jun 27, 2024
@MilGard91 MilGard91 deleted the chore/data-types-namespacing branch June 27, 2024 07:31
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.

Structs and Enums not namespaced within interfaces
2 participants