quantumswap 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/.github/workflows/publish-npmjs.yaml +22 -0
- package/LICENSE +21 -0
- package/README.md +287 -0
- package/examples/_test-wallet.js +17 -0
- package/examples/deploy-IERC20.js +23 -0
- package/examples/deploy-QuantumSwapV2ERC20.js +23 -0
- package/examples/deploy-QuantumSwapV2Factory.js +23 -0
- package/examples/deploy-QuantumSwapV2Pair.js +23 -0
- package/examples/deploy-QuantumSwapV2Router02.js +23 -0
- package/examples/deploy-WQ.js +23 -0
- package/examples/events-IERC20.js +20 -0
- package/examples/events-QuantumSwapV2ERC20.js +20 -0
- package/examples/events-QuantumSwapV2Factory.js +20 -0
- package/examples/events-QuantumSwapV2Pair.js +20 -0
- package/examples/events-QuantumSwapV2Router02.js +20 -0
- package/examples/events-WQ.js +20 -0
- package/examples/offline-signing-IERC20.js +29 -0
- package/examples/offline-signing-QuantumSwapV2ERC20.js +29 -0
- package/examples/offline-signing-QuantumSwapV2Factory.js +29 -0
- package/examples/offline-signing-QuantumSwapV2Pair.js +29 -0
- package/examples/offline-signing-QuantumSwapV2Router02.js +29 -0
- package/examples/offline-signing-WQ.js +29 -0
- package/examples/read-operations-IERC20.js +19 -0
- package/examples/read-operations-QuantumSwapV2ERC20.js +19 -0
- package/examples/read-operations-QuantumSwapV2Factory.js +19 -0
- package/examples/read-operations-QuantumSwapV2Pair.js +19 -0
- package/examples/read-operations-QuantumSwapV2Router02.js +19 -0
- package/examples/read-operations-WQ.js +19 -0
- package/examples/walkthrough-dex-full-flow.js +226 -0
- package/examples/walkthrough-dex-full-flow.ts +231 -0
- package/examples/write-operations-IERC20.js +22 -0
- package/examples/write-operations-QuantumSwapV2ERC20.js +22 -0
- package/examples/write-operations-QuantumSwapV2Factory.js +22 -0
- package/examples/write-operations-QuantumSwapV2Pair.js +22 -0
- package/examples/write-operations-QuantumSwapV2Router02.js +22 -0
- package/examples/write-operations-WQ.js +22 -0
- package/index.d.ts +1 -0
- package/index.js +45 -0
- package/package.json +35 -0
- package/src/IERC20.d.ts +24 -0
- package/src/IERC20.js +348 -0
- package/src/IERC20__factory.d.ts +10 -0
- package/src/IERC20__factory.js +29 -0
- package/src/QuantumSwapV2ERC20.d.ts +24 -0
- package/src/QuantumSwapV2ERC20.js +353 -0
- package/src/QuantumSwapV2ERC20__factory.d.ts +10 -0
- package/src/QuantumSwapV2ERC20__factory.js +29 -0
- package/src/QuantumSwapV2Factory.d.ts +24 -0
- package/src/QuantumSwapV2Factory.js +310 -0
- package/src/QuantumSwapV2Factory__factory.d.ts +10 -0
- package/src/QuantumSwapV2Factory__factory.js +29 -0
- package/src/QuantumSwapV2Pair.d.ts +44 -0
- package/src/QuantumSwapV2Pair.js +847 -0
- package/src/QuantumSwapV2Pair__factory.d.ts +10 -0
- package/src/QuantumSwapV2Pair__factory.js +29 -0
- package/src/QuantumSwapV2Router02.d.ts +47 -0
- package/src/QuantumSwapV2Router02.js +1109 -0
- package/src/QuantumSwapV2Router02__factory.d.ts +10 -0
- package/src/QuantumSwapV2Router02__factory.js +29 -0
- package/src/WQ.d.ts +28 -0
- package/src/WQ.js +435 -0
- package/src/WQ__factory.d.ts +10 -0
- package/src/WQ__factory.js +29 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +15 -0
- package/src/quantumcoin-shims.d.ts +25 -0
- package/src/types.d.ts +3 -0
- package/src/types.js +3 -0
- package/test/e2e/IERC20.e2e.test.js +79 -0
- package/test/e2e/QuantumSwapV2ERC20.e2e.test.js +79 -0
- package/test/e2e/QuantumSwapV2Factory.e2e.test.js +79 -0
- package/test/e2e/QuantumSwapV2Pair.e2e.test.js +79 -0
- package/test/e2e/QuantumSwapV2Router02.e2e.test.js +79 -0
- package/test/e2e/WQ.e2e.test.js +79 -0
- package/test/e2e/all-contracts.e2e.test.js +103 -0
- package/test/e2e/dex-full-flow.e2e.test.js +353 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
import { ContractFactory, ContractRunner } from "quantumcoin";
|
|
3
|
+
import { QuantumSwapV2Router02 } from "./QuantumSwapV2Router02";
|
|
4
|
+
import type * as Types from "./types";
|
|
5
|
+
|
|
6
|
+
export declare class QuantumSwapV2Router02__factory extends ContractFactory {
|
|
7
|
+
constructor(runner: ContractRunner);
|
|
8
|
+
deploy(_factory: Types.AddressLike, _WETH: Types.AddressLike, overrides?: any): Promise<QuantumSwapV2Router02>;
|
|
9
|
+
static connect(address: string, runner?: ContractRunner): QuantumSwapV2Router02;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
const { ContractFactory, getCreateAddress } = require("quantumcoin");
|
|
3
|
+
const { QuantumSwapV2Router02 } = require("./QuantumSwapV2Router02");
|
|
4
|
+
|
|
5
|
+
class QuantumSwapV2Router02__factory extends ContractFactory {
|
|
6
|
+
constructor(runner) {
|
|
7
|
+
super(QuantumSwapV2Router02.abi, QuantumSwapV2Router02.bytecode, runner);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async deploy(_factory, _WETH, overrides) {
|
|
11
|
+
const signer = this.signer;
|
|
12
|
+
if (!signer) { throw new Error("missing signer"); }
|
|
13
|
+
const from = signer.getAddress ? await signer.getAddress() : signer.address;
|
|
14
|
+
const provider = signer.provider;
|
|
15
|
+
if (!provider || !provider.getTransactionCount) { throw new Error("missing provider"); }
|
|
16
|
+
let nonce;
|
|
17
|
+
try { nonce = await provider.getTransactionCount(from, "pending"); } catch { nonce = await provider.getTransactionCount(from, "latest"); }
|
|
18
|
+
const address = getCreateAddress({ from, nonce });
|
|
19
|
+
const txReq = this.getDeployTransaction(_factory, _WETH);
|
|
20
|
+
const tx = await signer.sendTransaction({ ...txReq, ...(overrides || {}), nonce });
|
|
21
|
+
return new QuantumSwapV2Router02(address, signer, tx);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static connect(address, runner) {
|
|
25
|
+
return QuantumSwapV2Router02.connect(address, runner);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { QuantumSwapV2Router02__factory };
|
package/src/WQ.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
import { Contract, ContractRunner, ContractTransactionResponse, TransactionResponse } from "quantumcoin";
|
|
3
|
+
import type * as Types from "./types";
|
|
4
|
+
|
|
5
|
+
export declare class WQ extends Contract {
|
|
6
|
+
static readonly abi: readonly any[];
|
|
7
|
+
static readonly bytecode: string;
|
|
8
|
+
static connect(address: string, runner?: ContractRunner): WQ;
|
|
9
|
+
constructor(address: string, runner?: ContractRunner, _deployTx?: TransactionResponse);
|
|
10
|
+
readonly populateTransaction: {
|
|
11
|
+
approve(guy: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
|
|
12
|
+
deposit(overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
|
|
13
|
+
transfer(dst: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
|
|
14
|
+
transferFrom(src: Types.AddressLike, dst: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
|
|
15
|
+
withdraw(wad: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
|
|
16
|
+
};
|
|
17
|
+
allowance(arg0: Types.AddressLike, arg1: Types.AddressLike): Promise<Types.Uint256>;
|
|
18
|
+
approve(guy: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
|
|
19
|
+
balanceOf(arg0: Types.AddressLike): Promise<Types.Uint256>;
|
|
20
|
+
decimals(): Promise<Types.Uint8>;
|
|
21
|
+
deposit(overrides?: any): Promise<ContractTransactionResponse>;
|
|
22
|
+
name(): Promise<string>;
|
|
23
|
+
symbol(): Promise<string>;
|
|
24
|
+
totalSupply(): Promise<Types.Uint256>;
|
|
25
|
+
transfer(dst: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
|
|
26
|
+
transferFrom(src: Types.AddressLike, dst: Types.AddressLike, wad: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
|
|
27
|
+
withdraw(wad: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
|
|
28
|
+
}
|
package/src/WQ.js
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
const { Contract } = require("quantumcoin");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WQ - A typed contract interface for WQ
|
|
6
|
+
*/
|
|
7
|
+
class WQ extends Contract {
|
|
8
|
+
static abi = [
|
|
9
|
+
{
|
|
10
|
+
"anonymous": false,
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"indexed": true,
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "src",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"indexed": true,
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "guy",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"indexed": false,
|
|
26
|
+
"internalType": "uint256",
|
|
27
|
+
"name": "wad",
|
|
28
|
+
"type": "uint256"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"name": "Approval",
|
|
32
|
+
"type": "event"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"anonymous": false,
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"indexed": true,
|
|
39
|
+
"internalType": "address",
|
|
40
|
+
"name": "dst",
|
|
41
|
+
"type": "address"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"indexed": false,
|
|
45
|
+
"internalType": "uint256",
|
|
46
|
+
"name": "wad",
|
|
47
|
+
"type": "uint256"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "Deposit",
|
|
51
|
+
"type": "event"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"anonymous": false,
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"indexed": true,
|
|
58
|
+
"internalType": "address",
|
|
59
|
+
"name": "src",
|
|
60
|
+
"type": "address"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": true,
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "dst",
|
|
66
|
+
"type": "address"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "uint256",
|
|
71
|
+
"name": "wad",
|
|
72
|
+
"type": "uint256"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "Transfer",
|
|
76
|
+
"type": "event"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"anonymous": false,
|
|
80
|
+
"inputs": [
|
|
81
|
+
{
|
|
82
|
+
"indexed": true,
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "src",
|
|
85
|
+
"type": "address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"indexed": false,
|
|
89
|
+
"internalType": "uint256",
|
|
90
|
+
"name": "wad",
|
|
91
|
+
"type": "uint256"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"name": "Withdrawal",
|
|
95
|
+
"type": "event"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"inputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "address",
|
|
101
|
+
"name": "",
|
|
102
|
+
"type": "address"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"internalType": "address",
|
|
106
|
+
"name": "",
|
|
107
|
+
"type": "address"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"name": "allowance",
|
|
111
|
+
"outputs": [
|
|
112
|
+
{
|
|
113
|
+
"internalType": "uint256",
|
|
114
|
+
"name": "",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"stateMutability": "view",
|
|
119
|
+
"type": "function"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"inputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "address",
|
|
125
|
+
"name": "guy",
|
|
126
|
+
"type": "address"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"internalType": "uint256",
|
|
130
|
+
"name": "wad",
|
|
131
|
+
"type": "uint256"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"name": "approve",
|
|
135
|
+
"outputs": [
|
|
136
|
+
{
|
|
137
|
+
"internalType": "bool",
|
|
138
|
+
"name": "",
|
|
139
|
+
"type": "bool"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"stateMutability": "nonpayable",
|
|
143
|
+
"type": "function"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"inputs": [
|
|
147
|
+
{
|
|
148
|
+
"internalType": "address",
|
|
149
|
+
"name": "",
|
|
150
|
+
"type": "address"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"name": "balanceOf",
|
|
154
|
+
"outputs": [
|
|
155
|
+
{
|
|
156
|
+
"internalType": "uint256",
|
|
157
|
+
"name": "",
|
|
158
|
+
"type": "uint256"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"stateMutability": "view",
|
|
162
|
+
"type": "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [],
|
|
166
|
+
"name": "decimals",
|
|
167
|
+
"outputs": [
|
|
168
|
+
{
|
|
169
|
+
"internalType": "uint8",
|
|
170
|
+
"name": "",
|
|
171
|
+
"type": "uint8"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"stateMutability": "view",
|
|
175
|
+
"type": "function"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"inputs": [],
|
|
179
|
+
"name": "deposit",
|
|
180
|
+
"outputs": [],
|
|
181
|
+
"stateMutability": "payable",
|
|
182
|
+
"type": "function"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"inputs": [],
|
|
186
|
+
"name": "name",
|
|
187
|
+
"outputs": [
|
|
188
|
+
{
|
|
189
|
+
"internalType": "string",
|
|
190
|
+
"name": "",
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"stateMutability": "view",
|
|
195
|
+
"type": "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [],
|
|
199
|
+
"name": "symbol",
|
|
200
|
+
"outputs": [
|
|
201
|
+
{
|
|
202
|
+
"internalType": "string",
|
|
203
|
+
"name": "",
|
|
204
|
+
"type": "string"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"stateMutability": "view",
|
|
208
|
+
"type": "function"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"inputs": [],
|
|
212
|
+
"name": "totalSupply",
|
|
213
|
+
"outputs": [
|
|
214
|
+
{
|
|
215
|
+
"internalType": "uint256",
|
|
216
|
+
"name": "",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"stateMutability": "view",
|
|
221
|
+
"type": "function"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"inputs": [
|
|
225
|
+
{
|
|
226
|
+
"internalType": "address",
|
|
227
|
+
"name": "dst",
|
|
228
|
+
"type": "address"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"internalType": "uint256",
|
|
232
|
+
"name": "wad",
|
|
233
|
+
"type": "uint256"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"name": "transfer",
|
|
237
|
+
"outputs": [
|
|
238
|
+
{
|
|
239
|
+
"internalType": "bool",
|
|
240
|
+
"name": "",
|
|
241
|
+
"type": "bool"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"stateMutability": "nonpayable",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [
|
|
249
|
+
{
|
|
250
|
+
"internalType": "address",
|
|
251
|
+
"name": "src",
|
|
252
|
+
"type": "address"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"internalType": "address",
|
|
256
|
+
"name": "dst",
|
|
257
|
+
"type": "address"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"internalType": "uint256",
|
|
261
|
+
"name": "wad",
|
|
262
|
+
"type": "uint256"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"name": "transferFrom",
|
|
266
|
+
"outputs": [
|
|
267
|
+
{
|
|
268
|
+
"internalType": "bool",
|
|
269
|
+
"name": "",
|
|
270
|
+
"type": "bool"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"stateMutability": "nonpayable",
|
|
274
|
+
"type": "function"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"inputs": [
|
|
278
|
+
{
|
|
279
|
+
"internalType": "uint256",
|
|
280
|
+
"name": "wad",
|
|
281
|
+
"type": "uint256"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"name": "withdraw",
|
|
285
|
+
"outputs": [],
|
|
286
|
+
"stateMutability": "nonpayable",
|
|
287
|
+
"type": "function"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"stateMutability": "payable",
|
|
291
|
+
"type": "receive"
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
static bytecode = "0x60806040526040518060400160405280600981526020017f57726170706564205100000000000000000000000000000000000000000000008152506000908051906020019061004f9291906100ca565b506040518060400160405280600281526020017f57510000000000000000000000000000000000000000000000000000000000008152506001908051906020019061009b9291906100ca565b506012600260006101000a81548160ff021916908360ff1602179055503480156100c457600080fd5b50610175565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826101005760008555610147565b82601f1061011957805160ff1916838001178555610147565b82800160010185558215610147579182015b8281111561014657825182559160200191906001019061012b565b5b5090506101549190610158565b5090565b5b80821115610171576000816000905550600101610159565b5090565b6108ef806101846000396000f3fe6080604052600436106100a05760003560e01c8063313ce56711610064578063313ce5671461026a57806370a082311461029857806395d89b41146102e7578063a9059cbb14610377578063d0e30db0146103d2578063dd62ed3e146103dc576100af565b806306fdde03146100b4578063095ea7b31461014457806318160ddd1461019f57806323b872dd146101ca5780632e1a7d4d1461022f576100af565b366100af576100ad610435565b005b600080fd5b3480156100c057600080fd5b506100c9610490565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b506101876004803603604081101561016757600080fd5b81019080803590602001909291908035906020019092919050505061052e565b60405180821515815260200191505060405180910390f35b3480156101ab57600080fd5b506101b461059c565b6040518082815260200191505060405180910390f35b3480156101d657600080fd5b50610217600480360360608110156101ed57600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506105a4565b60405180821515815260200191505060405180910390f35b34801561023b57600080fd5b506102686004803603602081101561025257600080fd5b8101908080359060200190929190505050610709565b005b34801561027657600080fd5b5061027f6107b6565b604051808260ff16815260200191505060405180910390f35b3480156102a457600080fd5b506102d1600480360360208110156102bb57600080fd5b81019080803590602001909291905050506107c9565b6040518082815260200191505060405180910390f35b3480156102f357600080fd5b506102fc6107e1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033c578082015181840152602081019050610321565b50505050905090810190601f1680156103695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038357600080fd5b506103ba6004803603604081101561039a57600080fd5b81019080803590602001909291908035906020019092919050505061087f565b60405180821515815260200191505060405180910390f35b6103da610435565b005b3480156103e857600080fd5b5061041f600480360360408110156103ff57600080fd5b810190808035906020019092919080359060200190929190505050610894565b6040518082815260200191505060405180910390f35b346003600033815260200190815260200160002060008282540192505081905550337fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105265780601f106104fb57610100808354040283529160200191610526565b820191906000526020600020905b81548152906001019060200180831161050957829003601f168201915b505050505081565b6000816004600033815260200190815260200160002060008581526020019081526020016000208190555082337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600047905090565b600081600360008681526020019081526020016000205410156105c657600080fd5b33841415801561061a57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6004600086815260200190815260200160002060003381526020019081526020016000205414155b15610683578160046000868152602001908152602001600020600033815260200190815260200160002054101561065057600080fd5b81600460008681526020019081526020016000206000338152602001908152602001600020600082825403925050819055505b81600360008681526020019081526020016000206000828254039250508190555081600360008581526020019081526020016000206000828254019250508190555082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b806003600033815260200190815260200160002054101561072957600080fd5b806003600033815260200190815260200160002060008282540392505081905550336108fc829081150290604051600060405180830381858888f1935050505015801561077a573d6000803e3d6000fd5b50337f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65826040518082815260200191505060405180910390a250565b600260009054906101000a900460ff1681565b60036020528060005260406000206000915090505481565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b505050505081565b600061088c3384846105a4565b905092915050565b600460205281600052604060002060205280600052604060002060009150915050548156fea2646970667358221220e6a100d0088383759832f6501e6cf6751a3c35ed6b4f90fdb6dc96e40bd369eb64736f6c63430007060033";
|
|
295
|
+
|
|
296
|
+
static connect(address, runner) {
|
|
297
|
+
return new WQ(address, runner);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
constructor(address, runner, _deployTx) {
|
|
301
|
+
super(address, WQ.abi, runner, WQ.bytecode);
|
|
302
|
+
this._deployTx = _deployTx;
|
|
303
|
+
|
|
304
|
+
// Typed populateTransaction helpers (offline signing / sendRawTransaction flows)
|
|
305
|
+
this.populateTransaction = {
|
|
306
|
+
approve: async (guy, wad, overrides) => {
|
|
307
|
+
const data = this.interface.encodeFunctionData("approve", [guy, wad]);
|
|
308
|
+
return { to: this.address, data, ...(overrides || {}) };
|
|
309
|
+
},
|
|
310
|
+
deposit: async (overrides) => {
|
|
311
|
+
const data = this.interface.encodeFunctionData("deposit", []);
|
|
312
|
+
return { to: this.address, data, ...(overrides || {}) };
|
|
313
|
+
},
|
|
314
|
+
transfer: async (dst, wad, overrides) => {
|
|
315
|
+
const data = this.interface.encodeFunctionData("transfer", [dst, wad]);
|
|
316
|
+
return { to: this.address, data, ...(overrides || {}) };
|
|
317
|
+
},
|
|
318
|
+
transferFrom: async (src, dst, wad, overrides) => {
|
|
319
|
+
const data = this.interface.encodeFunctionData("transferFrom", [src, dst, wad]);
|
|
320
|
+
return { to: this.address, data, ...(overrides || {}) };
|
|
321
|
+
},
|
|
322
|
+
withdraw: async (wad, overrides) => {
|
|
323
|
+
const data = this.interface.encodeFunctionData("withdraw", [wad]);
|
|
324
|
+
return { to: this.address, data, ...(overrides || {}) };
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* allowance
|
|
331
|
+
* @param {import("quantumcoin/types").AddressLike} arg
|
|
332
|
+
* @param {import("quantumcoin/types").AddressLike} arg
|
|
333
|
+
* @returns {Promise<import("quantumcoin/types").Uint256>}
|
|
334
|
+
*/
|
|
335
|
+
async allowance(arg0, arg1) {
|
|
336
|
+
const res = await this.call("allowance", [arg0, arg1]);
|
|
337
|
+
return Array.isArray(res) ? res[0] : res;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* approve
|
|
342
|
+
* @param {import("quantumcoin/types").AddressLike} guy
|
|
343
|
+
* @param {import("quantumcoin/types").Uint256Like} wad
|
|
344
|
+
* @returns {Promise<import("quantumcoin").ContractTransactionResponse>}
|
|
345
|
+
*/
|
|
346
|
+
async approve(guy, wad, overrides) {
|
|
347
|
+
return this.send("approve", [guy, wad], overrides);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* balanceOf
|
|
352
|
+
* @param {import("quantumcoin/types").AddressLike} arg
|
|
353
|
+
* @returns {Promise<import("quantumcoin/types").Uint256>}
|
|
354
|
+
*/
|
|
355
|
+
async balanceOf(arg0) {
|
|
356
|
+
const res = await this.call("balanceOf", [arg0]);
|
|
357
|
+
return Array.isArray(res) ? res[0] : res;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* decimals
|
|
362
|
+
* @returns {Promise<import("quantumcoin/types").Uint8>}
|
|
363
|
+
*/
|
|
364
|
+
async decimals() {
|
|
365
|
+
const res = await this.call("decimals", []);
|
|
366
|
+
return Array.isArray(res) ? res[0] : res;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* deposit
|
|
371
|
+
* @returns {Promise<import("quantumcoin").ContractTransactionResponse>}
|
|
372
|
+
*/
|
|
373
|
+
async deposit(overrides) {
|
|
374
|
+
return this.send("deposit", [], overrides);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* name
|
|
379
|
+
* @returns {Promise<string>}
|
|
380
|
+
*/
|
|
381
|
+
async name() {
|
|
382
|
+
const res = await this.call("name", []);
|
|
383
|
+
return Array.isArray(res) ? res[0] : res;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* symbol
|
|
388
|
+
* @returns {Promise<string>}
|
|
389
|
+
*/
|
|
390
|
+
async symbol() {
|
|
391
|
+
const res = await this.call("symbol", []);
|
|
392
|
+
return Array.isArray(res) ? res[0] : res;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* totalSupply
|
|
397
|
+
* @returns {Promise<import("quantumcoin/types").Uint256>}
|
|
398
|
+
*/
|
|
399
|
+
async totalSupply() {
|
|
400
|
+
const res = await this.call("totalSupply", []);
|
|
401
|
+
return Array.isArray(res) ? res[0] : res;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* transfer
|
|
406
|
+
* @param {import("quantumcoin/types").AddressLike} dst
|
|
407
|
+
* @param {import("quantumcoin/types").Uint256Like} wad
|
|
408
|
+
* @returns {Promise<import("quantumcoin").ContractTransactionResponse>}
|
|
409
|
+
*/
|
|
410
|
+
async transfer(dst, wad, overrides) {
|
|
411
|
+
return this.send("transfer", [dst, wad], overrides);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* transferFrom
|
|
416
|
+
* @param {import("quantumcoin/types").AddressLike} src
|
|
417
|
+
* @param {import("quantumcoin/types").AddressLike} dst
|
|
418
|
+
* @param {import("quantumcoin/types").Uint256Like} wad
|
|
419
|
+
* @returns {Promise<import("quantumcoin").ContractTransactionResponse>}
|
|
420
|
+
*/
|
|
421
|
+
async transferFrom(src, dst, wad, overrides) {
|
|
422
|
+
return this.send("transferFrom", [src, dst, wad], overrides);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* withdraw
|
|
427
|
+
* @param {import("quantumcoin/types").Uint256Like} wad
|
|
428
|
+
* @returns {Promise<import("quantumcoin").ContractTransactionResponse>}
|
|
429
|
+
*/
|
|
430
|
+
async withdraw(wad, overrides) {
|
|
431
|
+
return this.send("withdraw", [wad], overrides);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
module.exports = { WQ };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
import { ContractFactory, ContractRunner } from "quantumcoin";
|
|
3
|
+
import { WQ } from "./WQ";
|
|
4
|
+
import type * as Types from "./types";
|
|
5
|
+
|
|
6
|
+
export declare class WQ__factory extends ContractFactory {
|
|
7
|
+
constructor(runner: ContractRunner);
|
|
8
|
+
deploy(overrides?: any): Promise<WQ>;
|
|
9
|
+
static connect(address: string, runner?: ContractRunner): WQ;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
const { ContractFactory, getCreateAddress } = require("quantumcoin");
|
|
3
|
+
const { WQ } = require("./WQ");
|
|
4
|
+
|
|
5
|
+
class WQ__factory extends ContractFactory {
|
|
6
|
+
constructor(runner) {
|
|
7
|
+
super(WQ.abi, WQ.bytecode, runner);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async deploy(overrides) {
|
|
11
|
+
const signer = this.signer;
|
|
12
|
+
if (!signer) { throw new Error("missing signer"); }
|
|
13
|
+
const from = signer.getAddress ? await signer.getAddress() : signer.address;
|
|
14
|
+
const provider = signer.provider;
|
|
15
|
+
if (!provider || !provider.getTransactionCount) { throw new Error("missing provider"); }
|
|
16
|
+
let nonce;
|
|
17
|
+
try { nonce = await provider.getTransactionCount(from, "pending"); } catch { nonce = await provider.getTransactionCount(from, "latest"); }
|
|
18
|
+
const address = getCreateAddress({ from, nonce });
|
|
19
|
+
const txReq = this.getDeployTransaction();
|
|
20
|
+
const tx = await signer.sendTransaction({ ...txReq, ...(overrides || {}), nonce });
|
|
21
|
+
return new WQ(address, signer, tx);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static connect(address, runner) {
|
|
25
|
+
return WQ.connect(address, runner);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { WQ__factory };
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./IERC20";
|
|
4
|
+
export * from "./IERC20__factory";
|
|
5
|
+
export * from "./QuantumSwapV2ERC20";
|
|
6
|
+
export * from "./QuantumSwapV2ERC20__factory";
|
|
7
|
+
export * from "./QuantumSwapV2Factory";
|
|
8
|
+
export * from "./QuantumSwapV2Factory__factory";
|
|
9
|
+
export * from "./QuantumSwapV2Pair";
|
|
10
|
+
export * from "./QuantumSwapV2Pair__factory";
|
|
11
|
+
export * from "./QuantumSwapV2Router02";
|
|
12
|
+
export * from "./QuantumSwapV2Router02__factory";
|
|
13
|
+
export * from "./WQ";
|
|
14
|
+
export * from "./WQ__factory";
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Auto-generated by sdkgen
|
|
2
|
+
|
|
3
|
+
Object.assign(exports, require("./types"));
|
|
4
|
+
exports.IERC20 = require("./IERC20").IERC20;
|
|
5
|
+
exports.IERC20__factory = require("./IERC20__factory").IERC20__factory;
|
|
6
|
+
exports.QuantumSwapV2ERC20 = require("./QuantumSwapV2ERC20").QuantumSwapV2ERC20;
|
|
7
|
+
exports.QuantumSwapV2ERC20__factory = require("./QuantumSwapV2ERC20__factory").QuantumSwapV2ERC20__factory;
|
|
8
|
+
exports.QuantumSwapV2Factory = require("./QuantumSwapV2Factory").QuantumSwapV2Factory;
|
|
9
|
+
exports.QuantumSwapV2Factory__factory = require("./QuantumSwapV2Factory__factory").QuantumSwapV2Factory__factory;
|
|
10
|
+
exports.QuantumSwapV2Pair = require("./QuantumSwapV2Pair").QuantumSwapV2Pair;
|
|
11
|
+
exports.QuantumSwapV2Pair__factory = require("./QuantumSwapV2Pair__factory").QuantumSwapV2Pair__factory;
|
|
12
|
+
exports.QuantumSwapV2Router02 = require("./QuantumSwapV2Router02").QuantumSwapV2Router02;
|
|
13
|
+
exports.QuantumSwapV2Router02__factory = require("./QuantumSwapV2Router02__factory").QuantumSwapV2Router02__factory;
|
|
14
|
+
exports.WQ = require("./WQ").WQ;
|
|
15
|
+
exports.WQ__factory = require("./WQ__factory").WQ__factory;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare module "quantumcoin" {
|
|
2
|
+
export type ContractRunner = any;
|
|
3
|
+
export type TransactionResponse = any;
|
|
4
|
+
export type ContractTransactionResponse = any;
|
|
5
|
+
export type TransactionRequest = any;
|
|
6
|
+
|
|
7
|
+
export class Contract {
|
|
8
|
+
constructor(address: string, abi: any, runner?: any, bytecode?: any);
|
|
9
|
+
target: string;
|
|
10
|
+
address: string;
|
|
11
|
+
interface: any;
|
|
12
|
+
populateTransaction: any;
|
|
13
|
+
call(methodName: string, args: any[], overrides?: TransactionRequest): Promise<any>;
|
|
14
|
+
send(methodName: string, args: any[], overrides?: TransactionRequest): Promise<ContractTransactionResponse>;
|
|
15
|
+
deployTransaction(): TransactionResponse | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class ContractFactory {
|
|
19
|
+
signer: any;
|
|
20
|
+
constructor(abi: any, bytecode: string, signer: any);
|
|
21
|
+
getDeployTransaction(...args: any[]): TransactionRequest;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getCreateAddress(opts: { from: string; nonce: number }): string;
|
|
25
|
+
}
|
package/src/types.d.ts
ADDED
package/src/types.js
ADDED