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

[ethergo] warn on multiple contracts with same type #996

Open
trajan0x opened this issue Jun 8, 2023 · 1 comment
Open

[ethergo] warn on multiple contracts with same type #996

trajan0x opened this issue Jun 8, 2023 · 1 comment

Comments

@trajan0x
Copy link
Contributor

trajan0x commented Jun 8, 2023

if this has more than one type

image
@trajan0x trajan0x added the small label Jun 24, 2024
@trajan0x trajan0x reopened this Jun 24, 2024
Copy link

greptile-apps bot commented Jun 24, 2024

To warn on multiple contracts with the same type, modify the init function in ethergo/example/contracttype.go to check for duplicates before appending to AllContractTypes.

func init() {
    seenTypes := make(map[contractTypeImpl]bool)
    for i := 0; i < len(_contractTypeImpl_index); i++ {
        contractType := contractTypeImpl(i)
        if seenTypes[contractType] {
            log.Printf("Warning: Duplicate contract type detected: %v", contractType)
        } else {
            seenTypes[contractType] = true
            AllContractTypes = append(AllContractTypes, contractType)
            // assert type is correct
            var _ contracts.ContractType = contractType
        }
    }
}

References

/ethergo/example/contracttype.go
/ethergo/contracts

Ask Greptile

@trajan0x trajan0x removed the small label Jun 24, 2024
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

No branches or pull requests

1 participant