Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

AP-794: Switch deploy-related tasks to typed interfaces #390

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

0xNeshi
Copy link
Contributor

@0xNeshi 0xNeshi commented Sep 22, 2023

Explanation of the solution

Use static Contract__factory.createInterface().encodeFunctionData instead of regular Contract_factory.interface.encodeFunctionData

With Contract_factory.interface.encodeFunctionData (interface is of generic type Interface):
image

With Contract__factory.createInterface().encodeFunctionData (interface is of specific type APTeamMultiSigInterface which enforces type-safety):
image

Without updating this, changes in function data or data types will not be registered by TS compiler, causing our tasks to fail during runtime, necessitating a debug session.

With this update, we catch errors during compile-time.

Instructions on making this work

  • run yarn or yarn install to install npm dependencies

@0xNeshi 0xNeshi added the enhancement New feature or request label Sep 22, 2023
@0xNeshi 0xNeshi self-assigned this Sep 22, 2023
@linear
Copy link

linear bot commented Sep 22, 2023

AP-794 Use static `Contract__factory.createInterface().encodeFunctionData` instead of regular `Contract_factory.interface.encodeFunctionData`

With Contract_factory.interface.encodeFunctionData(interface is of generic type Interface):

image.png

With Contract__factory.createInterface().encodeFunctionData(interface is of specific type APTeamMultiSigInterface which enforces type-safety):

image.png

Without updating this, changes in function data or data types will not be registered by TS compiler, causing our tasks to fail during runtime, necessitating a debug session.

With this update, we catch errors during compile-time.

@stevieraykatz stevieraykatz merged commit 99030bd into master Sep 22, 2023
1 check passed
@stevieraykatz stevieraykatz deleted the typed-interface branch September 22, 2023 19:06
@0xNeshi
Copy link
Contributor Author

0xNeshi commented Sep 25, 2023

I created an issue in the official typechain repo related to this change:
dethcrypto/TypeChain#872

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants