mm_contract 1.0.0 → 1.0.2

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/demo/test_abi.js DELETED
@@ -1,448 +0,0 @@
1
- module.exports = [
2
- {
3
- "constant": false,
4
- "inputs": [
5
- {
6
- "name": "_tokenAddress",
7
- "type": "address"
8
- },
9
- {
10
- "name": "_to",
11
- "type": "address[]"
12
- },
13
- {
14
- "name": "_value",
15
- "type": "uint256[]"
16
- }
17
- ],
18
- "name": "multisendToken",
19
- "outputs": [],
20
- "payable": true,
21
- "stateMutability": "payable",
22
- "type": "function"
23
- },
24
- {
25
- "constant": true,
26
- "inputs": [],
27
- "name": "receiverAddress",
28
- "outputs": [
29
- {
30
- "name": "",
31
- "type": "address"
32
- }
33
- ],
34
- "payable": false,
35
- "stateMutability": "view",
36
- "type": "function"
37
- },
38
- {
39
- "constant": false,
40
- "inputs": [
41
- {
42
- "name": "_tokenAddress",
43
- "type": "address"
44
- },
45
- {
46
- "name": "_to",
47
- "type": "address[]"
48
- },
49
- {
50
- "name": "_value",
51
- "type": "uint256"
52
- }
53
- ],
54
- "name": "drop",
55
- "outputs": [],
56
- "payable": true,
57
- "stateMutability": "payable",
58
- "type": "function"
59
- },
60
- {
61
- "constant": false,
62
- "inputs": [
63
- {
64
- "name": "_to",
65
- "type": "address[]"
66
- },
67
- {
68
- "name": "_value",
69
- "type": "uint256[]"
70
- }
71
- ],
72
- "name": "mutiSendETHWithDifferentValue",
73
- "outputs": [],
74
- "payable": true,
75
- "stateMutability": "payable",
76
- "type": "function"
77
- },
78
- {
79
- "constant": false,
80
- "inputs": [
81
- {
82
- "name": "_tokenAddress",
83
- "type": "address"
84
- },
85
- {
86
- "name": "_to",
87
- "type": "address[]"
88
- },
89
- {
90
- "name": "_value",
91
- "type": "uint256"
92
- }
93
- ],
94
- "name": "mutiSendCoinWithSameValue",
95
- "outputs": [],
96
- "payable": true,
97
- "stateMutability": "payable",
98
- "type": "function"
99
- },
100
- {
101
- "constant": false,
102
- "inputs": [
103
- {
104
- "name": "_to",
105
- "type": "address[]"
106
- },
107
- {
108
- "name": "_value",
109
- "type": "uint256"
110
- }
111
- ],
112
- "name": "mutiSendETHWithSameValue",
113
- "outputs": [],
114
- "payable": true,
115
- "stateMutability": "payable",
116
- "type": "function"
117
- },
118
- {
119
- "constant": false,
120
- "inputs": [
121
- {
122
- "name": "_fee",
123
- "type": "uint256"
124
- }
125
- ],
126
- "name": "setVIPFee",
127
- "outputs": [],
128
- "payable": false,
129
- "stateMutability": "nonpayable",
130
- "type": "function"
131
- },
132
- {
133
- "constant": true,
134
- "inputs": [],
135
- "name": "getReceiverAddress",
136
- "outputs": [
137
- {
138
- "name": "",
139
- "type": "address"
140
- }
141
- ],
142
- "payable": false,
143
- "stateMutability": "view",
144
- "type": "function"
145
- },
146
- {
147
- "constant": false,
148
- "inputs": [
149
- {
150
- "name": "_tokenAddress",
151
- "type": "address"
152
- },
153
- {
154
- "name": "_to",
155
- "type": "address[]"
156
- },
157
- {
158
- "name": "_value",
159
- "type": "uint256[]"
160
- }
161
- ],
162
- "name": "mutiSendCoinWithDifferentValue",
163
- "outputs": [],
164
- "payable": true,
165
- "stateMutability": "payable",
166
- "type": "function"
167
- },
168
- {
169
- "constant": false,
170
- "inputs": [
171
- {
172
- "name": "_spender",
173
- "type": "address"
174
- }
175
- ],
176
- "name": "balanceOf",
177
- "outputs": [],
178
- "payable": true,
179
- "stateMutability": "payable",
180
- "type": "function"
181
- },
182
- {
183
- "constant": false,
184
- "inputs": [
185
- {
186
- "name": "_spender",
187
- "type": "address"
188
- },
189
- {
190
- "name": "_value",
191
- "type": "uint"
192
- }
193
- ],
194
- "name": "approve",
195
- "outputs": [],
196
- "payable": true,
197
- "stateMutability": "payable",
198
- "type": "function"
199
- },
200
- {
201
- "constant": false,
202
- "inputs": [
203
- {
204
- "name": "_addr",
205
- "type": "address"
206
- }
207
- ],
208
- "name": "setReceiverAddress",
209
- "outputs": [],
210
- "payable": false,
211
- "stateMutability": "nonpayable",
212
- "type": "function"
213
- },
214
- {
215
- "constant": true,
216
- "inputs": [],
217
- "name": "owner",
218
- "outputs": [
219
- {
220
- "name": "",
221
- "type": "address"
222
- }
223
- ],
224
- "payable": false,
225
- "stateMutability": "view",
226
- "type": "function"
227
- },
228
- {
229
- "constant": false,
230
- "inputs": [],
231
- "name": "registerVIP",
232
- "outputs": [],
233
- "payable": true,
234
- "stateMutability": "payable",
235
- "type": "function"
236
- },
237
- {
238
- "constant": true,
239
- "inputs": [
240
- {
241
- "name": "",
242
- "type": "address"
243
- }
244
- ],
245
- "name": "vipList",
246
- "outputs": [
247
- {
248
- "name": "",
249
- "type": "bool"
250
- }
251
- ],
252
- "payable": false,
253
- "stateMutability": "view",
254
- "type": "function"
255
- },
256
- {
257
- "constant": false,
258
- "inputs": [
259
- {
260
- "name": "_to",
261
- "type": "address[]"
262
- },
263
- {
264
- "name": "_value",
265
- "type": "uint256[]"
266
- }
267
- ],
268
- "name": "multisend",
269
- "outputs": [],
270
- "payable": true,
271
- "stateMutability": "payable",
272
- "type": "function"
273
- },
274
- {
275
- "constant": false,
276
- "inputs": [
277
- {
278
- "name": "_vipList",
279
- "type": "address[]"
280
- }
281
- ],
282
- "name": "addToVIPList",
283
- "outputs": [],
284
- "payable": false,
285
- "stateMutability": "nonpayable",
286
- "type": "function"
287
- },
288
- {
289
- "constant": true,
290
- "inputs": [],
291
- "name": "txFee",
292
- "outputs": [
293
- {
294
- "name": "",
295
- "type": "uint256"
296
- }
297
- ],
298
- "payable": false,
299
- "stateMutability": "view",
300
- "type": "function"
301
- },
302
- {
303
- "constant": false,
304
- "inputs": [
305
- {
306
- "name": "_fee",
307
- "type": "uint256"
308
- }
309
- ],
310
- "name": "setTxFee",
311
- "outputs": [],
312
- "payable": false,
313
- "stateMutability": "nonpayable",
314
- "type": "function"
315
- },
316
- {
317
- "constant": true,
318
- "inputs": [],
319
- "name": "VIPFee",
320
- "outputs": [
321
- {
322
- "name": "",
323
- "type": "uint256"
324
- }
325
- ],
326
- "payable": false,
327
- "stateMutability": "view",
328
- "type": "function"
329
- },
330
- {
331
- "constant": false,
332
- "inputs": [
333
- {
334
- "name": "newOwner",
335
- "type": "address"
336
- }
337
- ],
338
- "name": "transferOwnership",
339
- "outputs": [],
340
- "payable": false,
341
- "stateMutability": "nonpayable",
342
- "type": "function"
343
- },
344
- {
345
- "constant": true,
346
- "inputs": [
347
- {
348
- "name": "_addr",
349
- "type": "address"
350
- }
351
- ],
352
- "name": "isVIP",
353
- "outputs": [
354
- {
355
- "name": "",
356
- "type": "bool"
357
- }
358
- ],
359
- "payable": false,
360
- "stateMutability": "view",
361
- "type": "function"
362
- },
363
- {
364
- "constant": false,
365
- "inputs": [
366
- {
367
- "name": "_vipList",
368
- "type": "address[]"
369
- }
370
- ],
371
- "name": "removeFromVIPList",
372
- "outputs": [],
373
- "payable": false,
374
- "stateMutability": "nonpayable",
375
- "type": "function"
376
- },
377
- {
378
- "constant": false,
379
- "inputs": [
380
- {
381
- "name": "_tokenAddress",
382
- "type": "address"
383
- }
384
- ],
385
- "name": "getBalance",
386
- "outputs": [],
387
- "payable": false,
388
- "stateMutability": "nonpayable",
389
- "type": "function"
390
- },
391
- {
392
- "constant": false,
393
- "inputs": [
394
- {
395
- "name": "_to",
396
- "type": "address[]"
397
- },
398
- {
399
- "name": "_value",
400
- "type": "uint256"
401
- }
402
- ],
403
- "name": "sendEth",
404
- "outputs": [],
405
- "payable": true,
406
- "stateMutability": "payable",
407
- "type": "function"
408
- },
409
- {
410
- "anonymous": false,
411
- "inputs": [
412
- {
413
- "indexed": false,
414
- "name": "token",
415
- "type": "address"
416
- },
417
- {
418
- "indexed": false,
419
- "name": "total",
420
- "type": "uint256"
421
- }
422
- ],
423
- "name": "LogTokenMultiSent",
424
- "type": "event"
425
- },
426
- {
427
- "anonymous": false,
428
- "inputs": [
429
- {
430
- "indexed": false,
431
- "name": "token",
432
- "type": "address"
433
- },
434
- {
435
- "indexed": false,
436
- "name": "receiver",
437
- "type": "address"
438
- },
439
- {
440
- "indexed": false,
441
- "name": "balance",
442
- "type": "uint256"
443
- }
444
- ],
445
- "name": "LogGetToken",
446
- "type": "event"
447
- }
448
- ]
package/sol/assets.sol DELETED
@@ -1,2 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0
2
- pragma solidity >=0.7.0 <0.9.0;
package/sol/erc20.sol DELETED
@@ -1,23 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0
2
- pragma solidity >=0.7.0 <0.9.0;
3
-
4
- /**
5
- * @title ERC20
6
- * @dev 这是ERC20的标准接口,用于第三方应用调用时
7
- */
8
- abstract contract ERC20 {
9
- function name() external virtual view returns (string memory);
10
- function symbol() external virtual view returns (string memory);
11
- function decimals() external virtual view returns (uint256);
12
- function totalSupply() external virtual view returns (uint256);
13
-
14
- function balanceOf(address who) external virtual view returns (uint256);
15
- function transfer(address to, uint256 value) external virtual returns (bool);
16
- function transferFrom(address _from, address _to, uint _value) external virtual returns (bool success);
17
- function approve(address _spender, uint _value) external virtual returns (bool success);
18
- function allowance(address _owner, address _spender) external virtual view returns (uint remaining);
19
- function transferBath(address _from, address[] memory _to, uint256[] memory _value) external virtual returns(bool);
20
-
21
- event Transfer(address indexed _from, address indexed _to, uint _value);
22
- event Approval(address indexed _owner, address indexed _spender, uint _value);
23
- }
package/sol/erc721.sol DELETED
@@ -1,40 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0
2
- pragma solidity >=0.7.0 <0.9.0;
3
-
4
- /**
5
- * @title ERC721
6
- * @dev 这是ERC721的标准接口
7
- */
8
- abstract contract ERC721 {
9
- // 查询用户持有token总数
10
- function balanceOf(address _who) external virtual view returns (uint256 _balance);
11
- // 查询tokenId的持有人
12
- function ownerOf(uint256 _tokenId) external virtual view returns (address _owner);
13
- // 转账tokenId给某人
14
- function transfer(address _to, uint256 _tokenId) external virtual;
15
- // 授权tokenId给某人
16
- function approve(address _to, uint256 _tokenId) external virtual;
17
- // 取得tokenId所有权
18
- function takeOwnership(uint256 _tokenId) external virtual;
19
- // 从持有人安全转移tokenId给某人
20
- function safeTransferFrom(address _from, address _to, uint256 _tokenId) external virtual;
21
- // 从持有人安全转移tokenId和数据给某人
22
- function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) external virtual;
23
- // 从持有人转移tokenId给某人
24
- function transferFrom(address _from, address to, uint256 _tokenId) external virtual;
25
- // 查询tokenId的操作人
26
- function getApproved(uint256 _tokenId) external virtual view returns (address operator);
27
- // 设置当前持有者所有tokenId给可操作人权限
28
- function setApprovalForAll(address _operator, bool _approved) external virtual;
29
- // 查询某人是否有授权操作
30
- function isApprovedForAll(address _owner, address _operator) external virtual view returns (bool);
31
- // 批量转账给某些人
32
- function transferBath(address _from, address[] memory _to, uint256[] memory _tokenId) external virtual returns(bool);
33
-
34
- // 事件通知——转账
35
- event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
36
- // 事件通知——授权
37
- event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
38
- // 事件通知——授权所有
39
- event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
40
- }
package/sol/ownable.sol DELETED
@@ -1,42 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0
2
- pragma solidity >=0.7.0 <0.9.0;
3
-
4
- /**
5
- * @title Ownable
6
- * @dev The Ownable contract has an owner address, and provides basic authorization control
7
- * functions, this simplifies the implementation of "user permissions".
8
- */
9
- contract Ownable {
10
- address public owner;
11
-
12
- event OwnershipTransferred(
13
- address indexed previousOwner,
14
- address indexed newOwner
15
- );
16
-
17
- /**
18
- * @dev The Ownable constructor sets the original `owner` of the contract to the sender
19
- * account.
20
- */
21
- constructor() {
22
- owner = msg.sender;
23
- }
24
-
25
- /**
26
- * @dev Throws if called by any account other than the owner.
27
- */
28
- modifier onlyOwner() {
29
- require(msg.sender == owner);
30
- _;
31
- }
32
-
33
- /**
34
- * @dev Allows the current owner to transfer control of the contract to a newOwner.
35
- * @param newOwner The address to transfer ownership to.
36
- */
37
- function transferOwnership(address newOwner) public onlyOwner {
38
- require(newOwner != address(0));
39
- emit OwnershipTransferred(owner, newOwner);
40
- owner = newOwner;
41
- }
42
- }
package/sol/safeMath.sol DELETED
@@ -1,118 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0
2
- pragma solidity >=0.7.0 <0.9.0;
3
-
4
- /* 安全数学模块 */
5
-
6
- /**
7
- * @title SafeMath
8
- * @dev Math operations with safety checks that throw on error
9
- */
10
- library SafeMath {
11
-
12
- /**
13
- * @dev Multiplies two numbers, throws on overflow.
14
- */
15
- function mul(uint256 a, uint256 b) internal pure returns (uint256) {
16
- if (a == 0) {
17
- return 0;
18
- }
19
- uint256 c = a * b;
20
- assert(c / a == b);
21
- return c;
22
- }
23
-
24
- /**
25
- * @dev Integer division of two numbers, truncating the quotient.
26
- */
27
- function div(uint256 a, uint256 b) internal pure returns (uint256) {
28
- // assert(b > 0); // Solidity automatically throws when dividing by 0
29
- uint256 c = a / b;
30
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
31
- return c;
32
- }
33
-
34
- /**
35
- * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
36
- */
37
- function sub(uint256 a, uint256 b) internal pure returns (uint256) {
38
- assert(b <= a);
39
- return a - b;
40
- }
41
-
42
- /**
43
- * @dev Adds two numbers, throws on overflow.
44
- */
45
- function add(uint256 a, uint256 b) internal pure returns (uint256) {
46
- uint256 c = a + b;
47
- assert(c >= a);
48
- return c;
49
- }
50
- }
51
-
52
- /**
53
- * @title SafeMath32
54
- * @dev SafeMath library implemented for uint32
55
- */
56
- library SafeMath32 {
57
-
58
- function mul(uint32 a, uint32 b) internal pure returns (uint32) {
59
- if (a == 0) {
60
- return 0;
61
- }
62
- uint32 c = a * b;
63
- assert(c / a == b);
64
- return c;
65
- }
66
-
67
- function div(uint32 a, uint32 b) internal pure returns (uint32) {
68
- // assert(b > 0); // Solidity automatically throws when dividing by 0
69
- uint32 c = a / b;
70
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
71
- return c;
72
- }
73
-
74
- function sub(uint32 a, uint32 b) internal pure returns (uint32) {
75
- assert(b <= a);
76
- return a - b;
77
- }
78
-
79
- function add(uint32 a, uint32 b) internal pure returns (uint32) {
80
- uint32 c = a + b;
81
- assert(c >= a);
82
- return c;
83
- }
84
- }
85
-
86
- /**
87
- * @title SafeMath16
88
- * @dev SafeMath library implemented for uint16
89
- */
90
- library SafeMath16 {
91
-
92
- function mul(uint16 a, uint16 b) internal pure returns (uint16) {
93
- if (a == 0) {
94
- return 0;
95
- }
96
- uint16 c = a * b;
97
- assert(c / a == b);
98
- return c;
99
- }
100
-
101
- function div(uint16 a, uint16 b) internal pure returns (uint16) {
102
- // assert(b > 0); // Solidity automatically throws when dividing by 0
103
- uint16 c = a / b;
104
- // assert(a == b * c + a % b); // There is no case in which this doesn't hold
105
- return c;
106
- }
107
-
108
- function sub(uint16 a, uint16 b) internal pure returns (uint16) {
109
- assert(b <= a);
110
- return a - b;
111
- }
112
-
113
- function add(uint16 a, uint16 b) internal pure returns (uint16) {
114
- uint16 c = a + b;
115
- assert(c >= a);
116
- return c;
117
- }
118
- }
@@ -1,2 +0,0 @@
1
- ��Ͷ��Լ��ַ��0x6667f3288afab8f28CAb234936dEE5366afC811b
2
- token��Լ��ַ��0xa38b183722d60f70bd7ab44065154339aca3b49e
package/test.js DELETED
@@ -1,13 +0,0 @@
1
- 'use strict';
2
- const assert = require('assert');
3
- const mm_contract = require('./index.js');
4
-
5
- // 验证导出为构造函数
6
- assert.strictEqual(typeof mm_contract, 'function', '应导出构造函数');
7
-
8
- // 默认构造(eth 类型)不抛错并返回实例
9
- const eth = new mm_contract({});
10
- assert.ok(eth, 'eth 实例应创建成功');
11
- assert.ok(eth.config, '实例应包含 config');
12
-
13
- console.log('mm_contract 模块测试通过');