-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from ethereum-ts/kk/rryter-merge
- Loading branch information
Showing
12 changed files
with
407 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import * as ethers from 'ethers' | ||
import { Dai } from '../types/ethers-contracts/Dai' | ||
|
||
const abi = require('../abi/dai.json') | ||
import { utils, ethers } from 'ethers' | ||
import { DaiFactory } from '../types/ethers-contracts/DaiFactory' | ||
|
||
const RPC_HOST = 'https://mainnet.infura.io/v3/6d6c70e65c77429482df5b64a4d0c943' | ||
const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F' | ||
|
||
async function main() { | ||
const provider = new ethers.providers.JsonRpcProvider(RPC_HOST) | ||
const formatEther = ethers.utils.formatEther | ||
|
||
const dai = (new ethers.Contract(DAI_ADDRESS, abi, provider) as any) as Dai | ||
const balance = await dai.functions.balanceOf('0x70b144972C5Ef6CB941A5379240B74239c418CD4') | ||
const dai = DaiFactory.connect(DAI_ADDRESS, provider) | ||
const balance = await dai.balanceOf('0x70b144972C5Ef6CB941A5379240B74239c418CD4') | ||
|
||
console.log(`Our DAI balance is: ${formatEther(balance[0])}`) | ||
console.log(`Our DAI balance is: ${utils.formatEther(balance)}`) | ||
} | ||
|
||
main().catch(e => { | ||
main().catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters