@zircuit/ovault-evm 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -0
- package/dist/addresses.d.ts +41 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +48 -0
- package/dist/contracts/EIP2612.d.ts +14 -0
- package/dist/contracts/EIP2612.d.ts.map +1 -0
- package/dist/contracts/EIP2612.js +38 -0
- package/dist/contracts/ERC20.d.ts +169 -0
- package/dist/contracts/ERC20.d.ts.map +1 -0
- package/dist/contracts/ERC20.js +222 -0
- package/dist/contracts/ERC4626.d.ts +2020 -0
- package/dist/contracts/ERC4626.d.ts.map +1 -0
- package/dist/contracts/ERC4626.js +2638 -0
- package/dist/contracts/OFT.d.ts +1736 -0
- package/dist/contracts/OFT.d.ts.map +1 -0
- package/dist/contracts/OFT.js +2251 -0
- package/dist/contracts/OVaultComposer.d.ts +94 -0
- package/dist/contracts/OVaultComposer.d.ts.map +1 -0
- package/dist/contracts/OVaultComposer.js +1629 -0
- package/dist/contracts/OVaultComposerSync.d.ts +528 -0
- package/dist/contracts/OVaultComposerSync.d.ts.map +1 -0
- package/dist/contracts/OVaultComposerSync.js +682 -0
- package/dist/contracts/OVaultComposerSyncNative.d.ts +560 -0
- package/dist/contracts/OVaultComposerSyncNative.d.ts.map +1 -0
- package/dist/contracts/OVaultComposerSyncNative.js +723 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/oVaultSync/index.d.ts +3 -0
- package/dist/oVaultSync/index.d.ts.map +1 -0
- package/dist/oVaultSync/index.js +2 -0
- package/dist/oVaultSync/tracking.d.ts +46 -0
- package/dist/oVaultSync/tracking.d.ts.map +1 -0
- package/dist/oVaultSync/tracking.js +458 -0
- package/dist/oVaultSync/transfer.d.ts +116 -0
- package/dist/oVaultSync/transfer.d.ts.map +1 -0
- package/dist/oVaultSync/transfer.js +515 -0
- package/dist/types.d.ts +202 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/package.json +51 -0
- package/src/addresses.ts +100 -0
- package/src/contracts/EIP2612.ts +38 -0
- package/src/contracts/ERC20.ts +222 -0
- package/src/contracts/ERC4626.ts +2638 -0
- package/src/contracts/OFT.ts +2251 -0
- package/src/contracts/OVaultComposer.ts +1629 -0
- package/src/contracts/OVaultComposerSync.ts +682 -0
- package/src/index.ts +3 -0
- package/src/oVaultSync/index.ts +2 -0
- package/src/oVaultSync/tracking.ts +614 -0
- package/src/oVaultSync/transfer.ts +742 -0
- package/src/types.ts +260 -0
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
## Installation
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
pnpm add @zircuit/ovault-evm
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @zircuit/ovault-evm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## OVault SDK
|
|
12
|
+
|
|
13
|
+
This is an SDK to make depositing/redeeming on OVaults simple.
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
All information required can be retrieved by calling `OVaultSyncMessageBuilder.generateOVaultInputs`.
|
|
18
|
+
|
|
19
|
+
You pass a `GenerateOVaultSyncInputsProps` object (see `src/types.ts`). Key points:
|
|
20
|
+
|
|
21
|
+
- **`amount` is an unscaled string** (e.g. `"1.23"`)
|
|
22
|
+
- **`tokenLocalDecimals`** is required to parse the unscaled amount into local-chain units
|
|
23
|
+
- **`tokenHubDecimals`** should be the asset/share decimals on the **hub chain** (used for `previewDeposit` / `previewRedeem`)
|
|
24
|
+
- **`txArgs`** is now an object: `{ base: [...], permitParams: [...] | null }`
|
|
25
|
+
- Optional **EIP-2612** support via `supportsEip2612` + `sendWithPermit` / `depositAndSendWithPermit`
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
{
|
|
29
|
+
srcEid: number,
|
|
30
|
+
hubEid: number,
|
|
31
|
+
dstEid: number,
|
|
32
|
+
walletAddress: `0x${string}`,
|
|
33
|
+
dstAddress?: `0x${string}`, // If no dstAddress is supplied, it's assumed to be the same as the source wallet address
|
|
34
|
+
vaultAddress: `0x${string}`,
|
|
35
|
+
composerAddress: `0x${string}`,
|
|
36
|
+
oftHubAddress: `0x${string}`, // hub-chain underlying OFT (used for hub redeem quotes/fees)
|
|
37
|
+
vaultTokenAddress: `0x${string}`, // source-chain VaultToken (shares) OFT address (used for spoke redeem quotes/fees)
|
|
38
|
+
hubChain: Chain, // This is a Viem chain definition
|
|
39
|
+
sourceChain: Chain, // This is a Viem chain definition
|
|
40
|
+
operation: OVaultSyncOperations,
|
|
41
|
+
amount: string, // unscaled string (e.g. "1.23")
|
|
42
|
+
tokenLocalDecimals: number,
|
|
43
|
+
tokenHubDecimals?: number,
|
|
44
|
+
slippage: number, // such as 0.01 for 1% slippage
|
|
45
|
+
buffer?: number, // optional fee buffer (e.g. 0.3 => +30%)
|
|
46
|
+
referralCode?: string, // optional referral code forwarded via oftCmd
|
|
47
|
+
oftAddress: `0x${string}`, // source-chain OFT/OFTAdapter address
|
|
48
|
+
tokenAddress: `0x${string}`, // source-chain ERC20 address (or 0x0 for native)
|
|
49
|
+
supportsEip2612?: boolean,
|
|
50
|
+
requiresZeroApprovalReset?: boolean,
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For full information about the input object check `GenerateOVaultSyncInputsProps` in `src/types.ts`.
|
|
55
|
+
|
|
56
|
+
You will receive an `OVaultSyncInputs` object back containing all information you need to build the transaction.
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
#### Base Functionality
|
|
61
|
+
|
|
62
|
+
Below is an example of how to deposit tokens using the Viem client on a server side environment.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const input = {
|
|
66
|
+
srcEid: 40245, // eid for base-sepolia
|
|
67
|
+
hubEid: 40231, // eid for arbitrum-sepolia
|
|
68
|
+
dstEid: 40245, // eid for base-sepolia
|
|
69
|
+
|
|
70
|
+
// Optional. If dstAddress is not specified it will default to the walletAddress on the dst chain
|
|
71
|
+
dstAddress: "0x0000000000000000000000000000000000000000",
|
|
72
|
+
walletAddress: "0x0000000000000000000000000000000000000000",
|
|
73
|
+
vaultAddress: "0x0000000000000000000000000000000000000000",
|
|
74
|
+
|
|
75
|
+
// Address of the OVault Composer on the Hub Chain. Should implement IVaultComposerSync
|
|
76
|
+
composerAddress: "0x0000000000000000000000000000000000000000",
|
|
77
|
+
oftHubAddress: "0x0000000000000000000000000000000000000000",
|
|
78
|
+
vaultTokenAddress: "0x0000000000000000000000000000000000000000",
|
|
79
|
+
|
|
80
|
+
// Supply the Viem Chain Definitions for the hub and source chain. This is so the sdk can
|
|
81
|
+
// quote fees and perform read operations
|
|
82
|
+
hubChain: arbitrumSepolia,
|
|
83
|
+
sourceChain: baseSepolia,
|
|
84
|
+
operation: OVaultSyncOperations.DEPOSIT,
|
|
85
|
+
amount: "1.0", // unscaled string
|
|
86
|
+
tokenLocalDecimals: 18,
|
|
87
|
+
tokenHubDecimals: 18,
|
|
88
|
+
slippage: 0.01, // 1% slippage
|
|
89
|
+
|
|
90
|
+
// Address of the token/oft. The token is an ERC20. They can be the same address.
|
|
91
|
+
tokenAddress: "0x0000000000000000000000000000000000000000",
|
|
92
|
+
oftAddress: "0x0000000000000000000000000000000000000000",
|
|
93
|
+
} as const;
|
|
94
|
+
|
|
95
|
+
const inputs = await OVaultSyncMessageBuilder.generateOVaultInputs(input);
|
|
96
|
+
const account = privateKeyToAccount("YOUR PRIVATE KEY HERE");
|
|
97
|
+
|
|
98
|
+
const walletClient = createWalletClient({
|
|
99
|
+
account,
|
|
100
|
+
chain: srcChain.chain,
|
|
101
|
+
transport: http(),
|
|
102
|
+
}).extend(publicActions);
|
|
103
|
+
|
|
104
|
+
if (inputs.approval) {
|
|
105
|
+
// Approve token if required
|
|
106
|
+
const approvalTx = await walletClient.writeContract({
|
|
107
|
+
address: inputs.approval.tokenAddress,
|
|
108
|
+
abi: ERC20Abi,
|
|
109
|
+
functionName: "approve",
|
|
110
|
+
args: [inputs.approval.spender, inputs.approval.amount],
|
|
111
|
+
});
|
|
112
|
+
await walletClient.waitForTransactionReceipt({ hash: approvalTx });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const tx = await walletClient.writeContract({
|
|
116
|
+
address: inputs.contractAddress,
|
|
117
|
+
abi: inputs.abi,
|
|
118
|
+
value: inputs.messageFee.nativeFee,
|
|
119
|
+
functionName: inputs.contractFunctionName,
|
|
120
|
+
args: inputs.txArgs.base as any,
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For more example usage see `test/sdk/transfer.test.ts`.
|
|
125
|
+
|
|
126
|
+
## Tracking transactions
|
|
127
|
+
|
|
128
|
+
To track cross-chain progress, use:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { trackOVaultSyncTransaction } from "@zircuit/ovault-evm"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`trackOVaultSyncTransaction(txHash, { sourceChain, hubChain, dstChain }, withdrawalInfo?)`
|
|
135
|
+
|
|
136
|
+
If you are tracking withdrawals where multiple messages may exist, you can provide `withdrawalInfo` (`OVaultWithdrawalInfo`) so the tracker can pick the correct message index.
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
- **Build/typecheck**: `npm run -s sdk:build`
|
|
141
|
+
- **Run SDK tests**: `npm run -s sdk:test`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Chain as ViemChain } from "viem";
|
|
2
|
+
export type SupportedChainName = "ethereum" | "base";
|
|
3
|
+
export interface ChainMeta {
|
|
4
|
+
/** LayerZero Endpoint ID */
|
|
5
|
+
eid: number;
|
|
6
|
+
/** viem Chain object */
|
|
7
|
+
viemChain: ViemChain;
|
|
8
|
+
}
|
|
9
|
+
export declare const CHAINS: Record<SupportedChainName, ChainMeta>;
|
|
10
|
+
export type SupportedToken = "usdc" | "usdt";
|
|
11
|
+
interface ClusterChainDeployment {
|
|
12
|
+
/** UnderlyingOFT (hub) or UnderlyingOFTAdapter (spoke) */
|
|
13
|
+
oft: `0x${string}`;
|
|
14
|
+
/** Vault (hub) or VaultToken (spoke) */
|
|
15
|
+
vault: `0x${string}`;
|
|
16
|
+
/** Underlying ERC-20 token address on this chain */
|
|
17
|
+
token: `0x${string}`;
|
|
18
|
+
}
|
|
19
|
+
interface HubChainDeployment extends ClusterChainDeployment {
|
|
20
|
+
composer: `0x${string}`;
|
|
21
|
+
}
|
|
22
|
+
interface ClusterConfig {
|
|
23
|
+
hubChain: "base";
|
|
24
|
+
/** Token decimals on the hub chain */
|
|
25
|
+
hubDecimals: number;
|
|
26
|
+
/** Whether the token requires resetting approval to 0 before setting a new value (e.g. USDT) */
|
|
27
|
+
requiresZeroApprovalReset: boolean;
|
|
28
|
+
/** Per-chain deployments keyed by chain name */
|
|
29
|
+
chains: Partial<Record<SupportedChainName, ClusterChainDeployment>> & {
|
|
30
|
+
/** Hub chain always present and includes composer */
|
|
31
|
+
base: HubChainDeployment;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Built-in address registry
|
|
36
|
+
*
|
|
37
|
+
* Hub chain is always **Base** for all clusters.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CLUSTERS: Record<SupportedToken, ClusterConfig>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../src/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAO/C,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,wBAAwB;IACxB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAG/C,CAAC;AAMX,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAM7C,UAAU,sBAAsB;IAC9B,0DAA0D;IAC1D,GAAG,EAAE,KAAK,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,oDAAoD;IACpD,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,kBAAmB,SAAQ,sBAAsB;IACzD,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,yBAAyB,EAAE,OAAO,CAAC;IACnC,gDAAgD;IAChD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC,GAAG;QACpE,qDAAqD;QACrD,IAAI,EAAE,kBAAkB,CAAC;KAC1B,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,CAqC1D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { mainnet, base } from "viem/chains";
|
|
2
|
+
export const CHAINS = {
|
|
3
|
+
ethereum: { eid: 30101, viemChain: mainnet },
|
|
4
|
+
base: { eid: 30184, viemChain: base },
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Built-in address registry
|
|
8
|
+
*
|
|
9
|
+
* Hub chain is always **Base** for all clusters.
|
|
10
|
+
*/
|
|
11
|
+
export const CLUSTERS = {
|
|
12
|
+
usdc: {
|
|
13
|
+
hubChain: "base",
|
|
14
|
+
hubDecimals: 6,
|
|
15
|
+
requiresZeroApprovalReset: false,
|
|
16
|
+
chains: {
|
|
17
|
+
base: {
|
|
18
|
+
oft: "0xd7aBC360dfcF1B6dD0a03138235e12A2bc1c1C8B",
|
|
19
|
+
vault: "0x03067bbD0d41E3Fe4A0bb6ca67c99e7352Da4CAE",
|
|
20
|
+
composer: "0xBb801ED781dF31F660cC743bEf7Bb9D04B030923",
|
|
21
|
+
token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
22
|
+
},
|
|
23
|
+
ethereum: {
|
|
24
|
+
oft: "0xd58E8c1c83d598aD76B5f0E26B4a25cdB885d190",
|
|
25
|
+
vault: "0x07C898e77310870770f88d18a01009cB65A1c1a9",
|
|
26
|
+
token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
usdt: {
|
|
31
|
+
hubChain: "base",
|
|
32
|
+
hubDecimals: 6,
|
|
33
|
+
requiresZeroApprovalReset: true,
|
|
34
|
+
chains: {
|
|
35
|
+
base: {
|
|
36
|
+
oft: "0x264D6474802Ef8bc1bc05F89F7d640D1E93c5330",
|
|
37
|
+
vault: "0x25d90ABd6c1E8DCCD40932D2fdD2Cd381bfc832D",
|
|
38
|
+
composer: "0x16cE6D9576A411911e62b6073F1cc9d1347ad96B",
|
|
39
|
+
token: "0x820266ecC2D268B0fBbD2aA3a1bdf28d12582Bbc",
|
|
40
|
+
},
|
|
41
|
+
ethereum: {
|
|
42
|
+
oft: "0x2D342De4c58a871b3525740C58a1C112D5835865",
|
|
43
|
+
vault: "0x8ADbeA709B31A564f9750A280EC2690aD1cf470A",
|
|
44
|
+
token: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EIP2612.d.ts","sourceRoot":"","sources":["../../src/contracts/EIP2612.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;GAqCvB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const EIP2612_ABI = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{ name: "owner", type: "address" },
|
|
5
|
+
{ name: "spender", type: "address" },
|
|
6
|
+
{ name: "value", type: "uint256" },
|
|
7
|
+
{ name: "deadline", type: "uint256" },
|
|
8
|
+
{ name: "v", type: "uint8" },
|
|
9
|
+
{ name: "r", type: "bytes32" },
|
|
10
|
+
{ name: "s", type: "bytes32" },
|
|
11
|
+
],
|
|
12
|
+
name: "permit",
|
|
13
|
+
outputs: [],
|
|
14
|
+
stateMutability: "nonpayable",
|
|
15
|
+
type: "function",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
inputs: [{ name: "owner", type: "address" }],
|
|
19
|
+
name: "nonces",
|
|
20
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
21
|
+
stateMutability: "view",
|
|
22
|
+
type: "function",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
inputs: [],
|
|
26
|
+
name: "DOMAIN_SEPARATOR",
|
|
27
|
+
outputs: [{ name: "", type: "bytes32" }],
|
|
28
|
+
stateMutability: "view",
|
|
29
|
+
type: "function",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
inputs: [],
|
|
33
|
+
name: "version",
|
|
34
|
+
outputs: [{ name: "", type: "string" }],
|
|
35
|
+
stateMutability: "view",
|
|
36
|
+
type: "function",
|
|
37
|
+
},
|
|
38
|
+
];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export declare const ERC20Abi: readonly [{
|
|
2
|
+
readonly constant: true;
|
|
3
|
+
readonly inputs: readonly [];
|
|
4
|
+
readonly name: "name";
|
|
5
|
+
readonly outputs: readonly [{
|
|
6
|
+
readonly name: "";
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
}];
|
|
9
|
+
readonly payable: false;
|
|
10
|
+
readonly stateMutability: "view";
|
|
11
|
+
readonly type: "function";
|
|
12
|
+
}, {
|
|
13
|
+
readonly constant: false;
|
|
14
|
+
readonly inputs: readonly [{
|
|
15
|
+
readonly name: "_spender";
|
|
16
|
+
readonly type: "address";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "_value";
|
|
19
|
+
readonly type: "uint256";
|
|
20
|
+
}];
|
|
21
|
+
readonly name: "approve";
|
|
22
|
+
readonly outputs: readonly [{
|
|
23
|
+
readonly name: "";
|
|
24
|
+
readonly type: "bool";
|
|
25
|
+
}];
|
|
26
|
+
readonly payable: false;
|
|
27
|
+
readonly stateMutability: "nonpayable";
|
|
28
|
+
readonly type: "function";
|
|
29
|
+
}, {
|
|
30
|
+
readonly constant: true;
|
|
31
|
+
readonly inputs: readonly [];
|
|
32
|
+
readonly name: "totalSupply";
|
|
33
|
+
readonly outputs: readonly [{
|
|
34
|
+
readonly name: "";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}];
|
|
37
|
+
readonly payable: false;
|
|
38
|
+
readonly stateMutability: "view";
|
|
39
|
+
readonly type: "function";
|
|
40
|
+
}, {
|
|
41
|
+
readonly constant: false;
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly name: "_from";
|
|
44
|
+
readonly type: "address";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "_to";
|
|
47
|
+
readonly type: "address";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "_value";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}];
|
|
52
|
+
readonly name: "transferFrom";
|
|
53
|
+
readonly outputs: readonly [{
|
|
54
|
+
readonly name: "";
|
|
55
|
+
readonly type: "bool";
|
|
56
|
+
}];
|
|
57
|
+
readonly payable: false;
|
|
58
|
+
readonly stateMutability: "nonpayable";
|
|
59
|
+
readonly type: "function";
|
|
60
|
+
}, {
|
|
61
|
+
readonly constant: true;
|
|
62
|
+
readonly inputs: readonly [];
|
|
63
|
+
readonly name: "decimals";
|
|
64
|
+
readonly outputs: readonly [{
|
|
65
|
+
readonly name: "";
|
|
66
|
+
readonly type: "uint8";
|
|
67
|
+
}];
|
|
68
|
+
readonly payable: false;
|
|
69
|
+
readonly stateMutability: "view";
|
|
70
|
+
readonly type: "function";
|
|
71
|
+
}, {
|
|
72
|
+
readonly constant: true;
|
|
73
|
+
readonly inputs: readonly [{
|
|
74
|
+
readonly name: "_owner";
|
|
75
|
+
readonly type: "address";
|
|
76
|
+
}];
|
|
77
|
+
readonly name: "balanceOf";
|
|
78
|
+
readonly outputs: readonly [{
|
|
79
|
+
readonly name: "balance";
|
|
80
|
+
readonly type: "uint256";
|
|
81
|
+
}];
|
|
82
|
+
readonly payable: false;
|
|
83
|
+
readonly stateMutability: "view";
|
|
84
|
+
readonly type: "function";
|
|
85
|
+
}, {
|
|
86
|
+
readonly constant: true;
|
|
87
|
+
readonly inputs: readonly [];
|
|
88
|
+
readonly name: "symbol";
|
|
89
|
+
readonly outputs: readonly [{
|
|
90
|
+
readonly name: "";
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
}];
|
|
93
|
+
readonly payable: false;
|
|
94
|
+
readonly stateMutability: "view";
|
|
95
|
+
readonly type: "function";
|
|
96
|
+
}, {
|
|
97
|
+
readonly constant: false;
|
|
98
|
+
readonly inputs: readonly [{
|
|
99
|
+
readonly name: "_to";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "_value";
|
|
103
|
+
readonly type: "uint256";
|
|
104
|
+
}];
|
|
105
|
+
readonly name: "transfer";
|
|
106
|
+
readonly outputs: readonly [{
|
|
107
|
+
readonly name: "";
|
|
108
|
+
readonly type: "bool";
|
|
109
|
+
}];
|
|
110
|
+
readonly payable: false;
|
|
111
|
+
readonly stateMutability: "nonpayable";
|
|
112
|
+
readonly type: "function";
|
|
113
|
+
}, {
|
|
114
|
+
readonly constant: true;
|
|
115
|
+
readonly inputs: readonly [{
|
|
116
|
+
readonly name: "_owner";
|
|
117
|
+
readonly type: "address";
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "_spender";
|
|
120
|
+
readonly type: "address";
|
|
121
|
+
}];
|
|
122
|
+
readonly name: "allowance";
|
|
123
|
+
readonly outputs: readonly [{
|
|
124
|
+
readonly name: "";
|
|
125
|
+
readonly type: "uint256";
|
|
126
|
+
}];
|
|
127
|
+
readonly payable: false;
|
|
128
|
+
readonly stateMutability: "view";
|
|
129
|
+
readonly type: "function";
|
|
130
|
+
}, {
|
|
131
|
+
readonly payable: true;
|
|
132
|
+
readonly stateMutability: "payable";
|
|
133
|
+
readonly type: "fallback";
|
|
134
|
+
}, {
|
|
135
|
+
readonly anonymous: false;
|
|
136
|
+
readonly inputs: readonly [{
|
|
137
|
+
readonly indexed: true;
|
|
138
|
+
readonly name: "owner";
|
|
139
|
+
readonly type: "address";
|
|
140
|
+
}, {
|
|
141
|
+
readonly indexed: true;
|
|
142
|
+
readonly name: "spender";
|
|
143
|
+
readonly type: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly indexed: false;
|
|
146
|
+
readonly name: "value";
|
|
147
|
+
readonly type: "uint256";
|
|
148
|
+
}];
|
|
149
|
+
readonly name: "Approval";
|
|
150
|
+
readonly type: "event";
|
|
151
|
+
}, {
|
|
152
|
+
readonly anonymous: false;
|
|
153
|
+
readonly inputs: readonly [{
|
|
154
|
+
readonly indexed: true;
|
|
155
|
+
readonly name: "from";
|
|
156
|
+
readonly type: "address";
|
|
157
|
+
}, {
|
|
158
|
+
readonly indexed: true;
|
|
159
|
+
readonly name: "to";
|
|
160
|
+
readonly type: "address";
|
|
161
|
+
}, {
|
|
162
|
+
readonly indexed: false;
|
|
163
|
+
readonly name: "value";
|
|
164
|
+
readonly type: "uint256";
|
|
165
|
+
}];
|
|
166
|
+
readonly name: "Transfer";
|
|
167
|
+
readonly type: "event";
|
|
168
|
+
}];
|
|
169
|
+
//# sourceMappingURL=ERC20.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20.d.ts","sourceRoot":"","sources":["../../src/contracts/ERC20.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6NX,CAAC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
export const ERC20Abi = [
|
|
2
|
+
{
|
|
3
|
+
constant: true,
|
|
4
|
+
inputs: [],
|
|
5
|
+
name: "name",
|
|
6
|
+
outputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "string",
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
payable: false,
|
|
13
|
+
stateMutability: "view",
|
|
14
|
+
type: "function",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
constant: false,
|
|
18
|
+
inputs: [
|
|
19
|
+
{
|
|
20
|
+
name: "_spender",
|
|
21
|
+
type: "address",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "_value",
|
|
25
|
+
type: "uint256",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
name: "approve",
|
|
29
|
+
outputs: [
|
|
30
|
+
{
|
|
31
|
+
name: "",
|
|
32
|
+
type: "bool",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
payable: false,
|
|
36
|
+
stateMutability: "nonpayable",
|
|
37
|
+
type: "function",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
constant: true,
|
|
41
|
+
inputs: [],
|
|
42
|
+
name: "totalSupply",
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
name: "",
|
|
46
|
+
type: "uint256",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
payable: false,
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
type: "function",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
constant: false,
|
|
55
|
+
inputs: [
|
|
56
|
+
{
|
|
57
|
+
name: "_from",
|
|
58
|
+
type: "address",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "_to",
|
|
62
|
+
type: "address",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "_value",
|
|
66
|
+
type: "uint256",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
name: "transferFrom",
|
|
70
|
+
outputs: [
|
|
71
|
+
{
|
|
72
|
+
name: "",
|
|
73
|
+
type: "bool",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
payable: false,
|
|
77
|
+
stateMutability: "nonpayable",
|
|
78
|
+
type: "function",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
constant: true,
|
|
82
|
+
inputs: [],
|
|
83
|
+
name: "decimals",
|
|
84
|
+
outputs: [
|
|
85
|
+
{
|
|
86
|
+
name: "",
|
|
87
|
+
type: "uint8",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
payable: false,
|
|
91
|
+
stateMutability: "view",
|
|
92
|
+
type: "function",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
constant: true,
|
|
96
|
+
inputs: [
|
|
97
|
+
{
|
|
98
|
+
name: "_owner",
|
|
99
|
+
type: "address",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
name: "balanceOf",
|
|
103
|
+
outputs: [
|
|
104
|
+
{
|
|
105
|
+
name: "balance",
|
|
106
|
+
type: "uint256",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
payable: false,
|
|
110
|
+
stateMutability: "view",
|
|
111
|
+
type: "function",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
constant: true,
|
|
115
|
+
inputs: [],
|
|
116
|
+
name: "symbol",
|
|
117
|
+
outputs: [
|
|
118
|
+
{
|
|
119
|
+
name: "",
|
|
120
|
+
type: "string",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
payable: false,
|
|
124
|
+
stateMutability: "view",
|
|
125
|
+
type: "function",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
constant: false,
|
|
129
|
+
inputs: [
|
|
130
|
+
{
|
|
131
|
+
name: "_to",
|
|
132
|
+
type: "address",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "_value",
|
|
136
|
+
type: "uint256",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
name: "transfer",
|
|
140
|
+
outputs: [
|
|
141
|
+
{
|
|
142
|
+
name: "",
|
|
143
|
+
type: "bool",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
payable: false,
|
|
147
|
+
stateMutability: "nonpayable",
|
|
148
|
+
type: "function",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
constant: true,
|
|
152
|
+
inputs: [
|
|
153
|
+
{
|
|
154
|
+
name: "_owner",
|
|
155
|
+
type: "address",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "_spender",
|
|
159
|
+
type: "address",
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
name: "allowance",
|
|
163
|
+
outputs: [
|
|
164
|
+
{
|
|
165
|
+
name: "",
|
|
166
|
+
type: "uint256",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
payable: false,
|
|
170
|
+
stateMutability: "view",
|
|
171
|
+
type: "function",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
payable: true,
|
|
175
|
+
stateMutability: "payable",
|
|
176
|
+
type: "fallback",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
anonymous: false,
|
|
180
|
+
inputs: [
|
|
181
|
+
{
|
|
182
|
+
indexed: true,
|
|
183
|
+
name: "owner",
|
|
184
|
+
type: "address",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
indexed: true,
|
|
188
|
+
name: "spender",
|
|
189
|
+
type: "address",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
indexed: false,
|
|
193
|
+
name: "value",
|
|
194
|
+
type: "uint256",
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
name: "Approval",
|
|
198
|
+
type: "event",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
anonymous: false,
|
|
202
|
+
inputs: [
|
|
203
|
+
{
|
|
204
|
+
indexed: true,
|
|
205
|
+
name: "from",
|
|
206
|
+
type: "address",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
indexed: true,
|
|
210
|
+
name: "to",
|
|
211
|
+
type: "address",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
indexed: false,
|
|
215
|
+
name: "value",
|
|
216
|
+
type: "uint256",
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
name: "Transfer",
|
|
220
|
+
type: "event",
|
|
221
|
+
},
|
|
222
|
+
];
|