ContractFactory violates Liskov substitution principle
See original GitHub issueSuppose i have a simple contract
pragma solidity ^0.6.0;
contract MyContract {
constructor (address a) public {
}
}
Using typechain i obtain MyContractFactory
.
Unfortunately MyContractFactory
lacks functionality compared to the ethers ContractFactory
.
- new MyContractFactory(wallet).deploy(…) does not accept overrides as the last argument
- casting new MyContractFactory(wallet) as ContractFactory and then calling deploy with an incorrect number of arguments we do not get the proper error about argument count from ethers.
Suggested fix (not tested):
class MyContractFactory {
deploy(a: string, overrides: providers.TransactionRequest): Promise<MyContract>
deploy(...args: any[]): Promise<MyContract> {
super.deploy(...args) as Promise<MyContract>
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ContractFactory - Ethers.js
The Contract Factory sends a special type of transaction, an initcode transaction (i.e. the to field is null, and the data field is...
Read more >Xiwei Xu Ingo Weber Mark Staples - DOKUMEN.PUB
This book provides an excellent overview of the engineering aspects of block- chains. You will learn what blockchains are, the current options for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@quezak Sure. Here is the relevant code: https://github.com/ethers-io/ethers.js/blob/748f89660ac4bf60175f936da755cf1a0d370f46/src.ts/contract.ts#L798
📦 Released as
typechain-target-ethers@1.0.4