Support for truffle v5 - use contract at specific address
See original GitHub issueThe generated types don’t have function for use contract at a specific address: https://www.trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts#use-a-contract-at-a-specific-address.
import BN from 'bn.js'
import { ERC20TokenContract } from '../src/types/ERC20Token'
const ERC20Token: ERC20TokenContract = artifacts.require('ERC20Token')
contract('ERC20Token', (accounts: string[]) => {
it('test', async () => {
let token = await ERC20Token.new('tst', 'test', new BN(18))
await token.supply(accounts[0], accounts[1], new BN(10).pow(new BN(18)))
console.log(await token.totalSupply())
// typechain does not support this
// let token2 = await ERC20Token.at(token.address);
})
})
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Interact with your contracts - Truffle Suite
Use a contract at a specific address¶. If you already have an address for a contract, you can create a new abstraction to...
Read more >Add feature to deploy a contract at a specific address #5141
I am developing a contract, which can be easily developed using Truffle Suite. But I am having a problem when I am writing...
Read more >Interacting with Your Contracts - Truffle Suite
Every time you call a function against a contract on the Tezos blockchain, a transaction is recorded. Each transaction will cost you XTZ,...
Read more >How to write, test and deploy Ethereum smart contracts using ...
This article will look at writing, testing and deploying a smart contract using the Solidity programming language and Truffle.
Read more >How does a Truffle migration know the address of a contract ...
Managed to get an answer from the developer of the project. In case anyone else finds themselves here: Contract addresses are deterministic ...
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
After a while, I figure out I must include typechain outDir in
tsconfig.json
I add a PR to help others with the same issue https://github.com/ethereum-ts/TypeChain/pull/352
@ducquangkstn would you like to prepare & test a PR? We’re more versed in using ethers here 😃 This is the relevant file, it should be a simple matter of adding a static method declaration. You could even add some of the other contract static methods.