forked from streamr-dev/DATAv2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
23 lines (19 loc) · 719 Bytes
/
Copy pathindex.ts
File metadata and controls
23 lines (19 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {
Contract,
ContractFactory,
Provider,
Signer,
} from "ethers"
import * as dataV2json from "./artifacts/contracts/DATAv2.sol/DATAv2.json"
import type { DATAv2 } from "./typechain/contracts/DATAv2"
export const { abi, bytecode } = dataV2json
export type { DATAv2 }
export function getTokenAt(address: string, signerOrProvider: Provider | Signer): DATAv2 {
return new Contract(address, abi, signerOrProvider) as unknown as DATAv2
}
export async function deployToken(signer: Signer): Promise<DATAv2> {
const factory = new ContractFactory(abi, bytecode, signer)
const contract = await factory.deploy() as unknown as DATAv2
await contract.waitForDeployment()
return contract
}