-
Notifications
You must be signed in to change notification settings - Fork 11
/
runtimes.ts
54 lines (41 loc) · 1.5 KB
/
runtimes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { BigNumber } from '@ethersproject/bignumber';
import { TransactionRequest } from '@ethersproject/providers';
import { senderAccount } from './signer';
export enum RuntimeType {
EOA = 'EOA',
ERC20 = 'ERC20',
ERC721 = 'ERC721',
GREETER = 'GREETER',
}
export interface Runtime {
// Estimates the base runtime transaction gas limit
EstimateBaseTx(): Promise<BigNumber>;
// Fetches the average gas price in the network
GetGasPrice(): Promise<BigNumber>;
// Returns the value of each cycle transaction, if any
GetValue(): BigNumber;
// Constructs the specific runtime transactions
ConstructTransactions(
accounts: senderAccount[],
numTxs: number
): Promise<TransactionRequest[]>;
// Returns the start message for the user output
GetStartMessage(): string;
}
export interface InitializedRuntime extends Runtime {
// Initializes the runtime
Initialize(): Promise<void>;
}
export interface TokenRuntime extends Runtime, InitializedRuntime {
// Returns the transfer token value
GetTransferValue(): number;
// Returns the token balance for the specified address
GetTokenBalance(address: string): Promise<number>;
// Returns the suppliers token balance
GetSupplierBalance(): Promise<number>;
// Returns the token name
GetTokenSymbol(): string;
// Funds the specified account
FundAccount(address: string, amount: number): Promise<void>;
}
export interface NFTRuntime extends Runtime, InitializedRuntime {}