Contract Address argument (Interface Types) #21
AnandK-2024
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When a function takes a
contract address
as an argument, it is better to pass aninterface or contract type
rather than araw address
. If the function is called elsewhere within the source code, the compiler will provide additional type safety guarantees.The benefits of using the TypeSafeAuction contract above can then be seen from the following example. If validateBet() is called with an address argument, or a contract type other than Validator, the compiler will throw this error:
Beta Was this translation helpful? Give feedback.
All reactions