@1inch/solidity-utils 1.2.1 → 1.2.5

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.
@@ -1,48 +0,0 @@
1
- const networks = {};
2
-
3
- if (process.env.MAINNET_RPC_URL && process.env.MAINNET_PRIVATE_KEY) {
4
- networks.mainnet = {
5
- url: process.env.MAINNET_RPC_URL,
6
- chainId: 1,
7
- gasPrice: 25000000000,
8
- accounts: [process.env.MAINNET_PRIVATE_KEY],
9
- };
10
- }
11
-
12
- if (process.env.BSC_RPC_URL && process.env.BSC_PRIVATE_KEY) {
13
- networks.bsc = {
14
- url: process.env.BSC_RPC_URL,
15
- chainId: 56,
16
- gasPrice: 10000000000,
17
- accounts: [process.env.BSC_PRIVATE_KEY],
18
- };
19
- }
20
-
21
- if (process.env.KOVAN_RPC_URL && process.env.KOVAN_PRIVATE_KEY) {
22
- networks.kovan = {
23
- url: process.env.KOVAN_RPC_URL,
24
- chainId: 42,
25
- gasPrice: 1000000000,
26
- accounts: [process.env.KOVAN_PRIVATE_KEY],
27
- };
28
- }
29
-
30
- if (process.env.MATIC_RPC_URL && process.env.MATIC_PRIVATE_KEY) {
31
- networks.matic = {
32
- url: process.env.MATIC_RPC_URL,
33
- chainId: 137,
34
- gasPrice: 1000000000,
35
- accounts: [process.env.MATIC_PRIVATE_KEY],
36
- };
37
- }
38
-
39
- if (process.env.ARBITRUM_RPC_URL && process.env.ARBITRUM_PRIVATE_KEY) {
40
- networks.arbitrum = {
41
- url: process.env.ARBITRUM_RPC_URL,
42
- chainId: 42161,
43
- gasPrice: 250000000,
44
- accounts: [process.env.ARBITRUM_PRIVATE_KEY],
45
- };
46
- }
47
-
48
- module.exports = networks;
package/test/asserts.js DELETED
@@ -1,88 +0,0 @@
1
- const { expect } = require('chai');
2
- const { assertThrowsAsync, assertRoughlyEqualValues } = require('../js/asserts.js');
3
-
4
- describe('assertThrowsAsync', async function () {
5
- async function action () {
6
- throw new Error('Test throw message');
7
- }
8
-
9
- it('shouldn\'t be thrown', async function () {
10
- try {
11
- await assertThrowsAsync(action, 'Test throw message');
12
- } catch (e) {
13
- expect(true).equal(false);
14
- }
15
- });
16
-
17
- it('should be thrown with no expected message', async function () {
18
- try {
19
- await assertThrowsAsync(action, 'Another test throw message');
20
- } catch (e) {
21
- expect(e.message).equal('expected \'Test throw message\' to include \'Another test throw message\'');
22
- return;
23
- }
24
- expect(true).equal(false);
25
- });
26
-
27
- it('should be thrown because function doesn\'t have throw', async function () {
28
- try {
29
- await assertThrowsAsync(async function () {}, 'Test throw message');
30
- } catch (e) {
31
- expect(e.message).equal('Should have thrown an error but didn\'t');
32
- return;
33
- }
34
- expect(true).equal(false);
35
- });
36
- });
37
-
38
- describe('assertRoughlyEqualValues', async function () {
39
- function shouldNotThrow (expected, actual, relativeDiff) {
40
- try {
41
- assertRoughlyEqualValues(expected, actual, relativeDiff);
42
- } catch (e) {
43
- expect(true).equal(false);
44
- }
45
- }
46
-
47
- function shouldThrow (expected, actual, relativeDiff) {
48
- try {
49
- assertRoughlyEqualValues(expected, actual, relativeDiff);
50
- } catch (e) {
51
- expect(e.message).equal(`${actual} != ${expected} with ${relativeDiff} precision: expected '${actual}' to equal '${expected}'`);
52
- return;
53
- }
54
- expect(true).equal(false);
55
- }
56
-
57
- it('should be work with expected = actual, any relativeDiff', async function () {
58
- shouldNotThrow(1000000, 1000000, 0.000001);
59
- });
60
-
61
- it('should be work with expected = actual, relativeDiff = 0', async function () {
62
- shouldNotThrow(1000000, 1000000, 0);
63
- });
64
-
65
- it('should be work with diff between expected and actual less than relativeDiff * expected', async function () {
66
- shouldNotThrow(1000001, 1000000, 1.000001);
67
- });
68
-
69
- it('should be work with negative diff between expected and actual less than relativeDiff * expected', async function () {
70
- shouldNotThrow(1000000, 1000001, 0.000001);
71
- });
72
-
73
- it('should be work with diff between expected and actual equals to relativeDiff', async function () {
74
- shouldNotThrow(1000000, 1000001, 1);
75
- });
76
-
77
- it('should be thrown with expected != actual with relativeDiff = 0', async function () {
78
- shouldThrow(1000000, 1000001, 0);
79
- });
80
-
81
- it('should be thrown with expected > actual more than relativeDiff * expected', async function () {
82
- shouldThrow(1000001, 1000000, 0.0000001);
83
- });
84
-
85
- it('should be thrown with expected < actual more than relativeDiff * expected', async function () {
86
- shouldThrow(1000000, 1000001, 0.0000001);
87
- });
88
- });
@@ -1,149 +0,0 @@
1
- const { expect } = require('chai');
2
- const { expectRevert, constants } = require('@openzeppelin/test-helpers');
3
-
4
- const AddressArrayMock = artifacts.require('AddressArrayMock');
5
-
6
- contract('AddressArray', async function ([wallet1, wallet2, wallet3]) {
7
- beforeEach(async function () {
8
- this.AddressArrayMock = await AddressArrayMock.new();
9
- });
10
-
11
- describe('length', async function () {
12
- it('should be calculate length 0', async function () {
13
- expect(await this.AddressArrayMock.length()).to.be.bignumber.equal('0');
14
- });
15
-
16
- it('should be calculate length 1', async function () {
17
- await this.AddressArrayMock.push(wallet1);
18
- expect(await this.AddressArrayMock.length()).to.be.bignumber.equal('1');
19
- });
20
- });
21
-
22
- describe('at', async function () {
23
- it('should be get from empty data', async function () {
24
- expect(await this.AddressArrayMock.at(0)).to.be.equal(constants.ZERO_ADDRESS);
25
- expect(await this.AddressArrayMock.at(1)).to.be.equal(constants.ZERO_ADDRESS);
26
- });
27
-
28
- it('should be get from data with 1 element', async function () {
29
- await this.AddressArrayMock.push(wallet1);
30
- expect(await this.AddressArrayMock.at(0)).to.be.equal(wallet1);
31
- expect(await this.AddressArrayMock.at(1)).to.be.equal(constants.ZERO_ADDRESS);
32
- });
33
-
34
- it('should be get from data with several elements', async function () {
35
- await this.AddressArrayMock.push(wallet1);
36
- await this.AddressArrayMock.push(wallet2);
37
- expect(await this.AddressArrayMock.at(0)).to.be.equal(wallet1);
38
- expect(await this.AddressArrayMock.at(1)).to.be.equal(wallet2);
39
- });
40
- });
41
-
42
- describe('get', async function () {
43
- it('should be get empty data', async function () {
44
- expect(await this.AddressArrayMock.get()).to.eql([]);
45
- });
46
-
47
- it('should be get from data with 1 element', async function () {
48
- await this.AddressArrayMock.push(wallet1);
49
- expect(await this.AddressArrayMock.get()).to.eql([wallet1]);
50
- });
51
-
52
- it('should be get from data with several elements', async function () {
53
- await this.AddressArrayMock.push(wallet1);
54
- await this.AddressArrayMock.push(wallet2);
55
- expect(await this.AddressArrayMock.get()).to.eql([wallet1, wallet2]);
56
- });
57
- });
58
-
59
- describe('push', async function () {
60
- it('should be push to empty data', async function () {
61
- const pushedIndex = await this.AddressArrayMock.push.call(wallet1);
62
- await this.AddressArrayMock.push(wallet1);
63
- expect(await this.AddressArrayMock.at(pushedIndex - 1)).to.be.equal(wallet1);
64
- });
65
-
66
- it('should be push to data with 1 element', async function () {
67
- await this.AddressArrayMock.push(wallet1);
68
- const pushedIndex = await this.AddressArrayMock.push.call(wallet2);
69
- await this.AddressArrayMock.push(wallet2);
70
- expect(await this.AddressArrayMock.at(pushedIndex - 1)).to.be.equal(wallet2);
71
- });
72
-
73
- it('should be get push to data with several elements', async function () {
74
- await this.AddressArrayMock.push(wallet1);
75
- await this.AddressArrayMock.push(wallet2);
76
- const pushedIndex = await this.AddressArrayMock.push.call(wallet3);
77
- await this.AddressArrayMock.push(wallet3);
78
- expect(await this.AddressArrayMock.at(pushedIndex - 1)).to.be.equal(wallet3);
79
- });
80
- });
81
-
82
- describe('pop', async function () {
83
- it('should be thrown when data is empty', async function () {
84
- await expectRevert(
85
- this.AddressArrayMock.pop(),
86
- 'AddressArray: popping from empty',
87
- );
88
- });
89
-
90
- it('should be pop in data with 1 element', async function () {
91
- await this.AddressArrayMock.push(wallet1);
92
- await this.AddressArrayMock.pop();
93
- expect(await this.AddressArrayMock.get()).to.eql([]);
94
- });
95
-
96
- it('should be pop in data with several elements', async function () {
97
- await this.AddressArrayMock.push(wallet1);
98
- await this.AddressArrayMock.push(wallet2);
99
- await this.AddressArrayMock.pop();
100
- expect(await this.AddressArrayMock.get()).to.eql([wallet1]);
101
- });
102
-
103
- it('should be several pops', async function () {
104
- await this.AddressArrayMock.push(wallet1);
105
- await this.AddressArrayMock.push(wallet2);
106
- await this.AddressArrayMock.push(wallet3);
107
- await this.AddressArrayMock.pop();
108
- expect(await this.AddressArrayMock.get()).to.eql([wallet1, wallet2]);
109
- });
110
-
111
- it('should be thrown when pops more than elements', async function () {
112
- await this.AddressArrayMock.push(wallet1);
113
- await this.AddressArrayMock.pop();
114
- await expectRevert(
115
- this.AddressArrayMock.pop(),
116
- 'AddressArray: popping from empty',
117
- );
118
- });
119
- });
120
-
121
- describe('set', async function () {
122
- it('should be thrown when set index less than data length', async function () {
123
- await expectRevert(
124
- this.AddressArrayMock.set(0, wallet1),
125
- 'AddressArray: index out of range',
126
- );
127
- });
128
-
129
- it('should be set to index 0 to data with 1 element', async function () {
130
- await this.AddressArrayMock.push(wallet1);
131
- await this.AddressArrayMock.set(0, wallet2);
132
- expect(await this.AddressArrayMock.get()).to.eql([wallet2]);
133
- });
134
-
135
- it('should be set to index 0 to data with several elements', async function () {
136
- await this.AddressArrayMock.push(wallet1);
137
- await this.AddressArrayMock.push(wallet2);
138
- await this.AddressArrayMock.set(0, wallet3);
139
- expect(await this.AddressArrayMock.get()).to.eql([wallet3, wallet2]);
140
- });
141
-
142
- it('should be set to index non-0 to data with several elements', async function () {
143
- await this.AddressArrayMock.push(wallet1);
144
- await this.AddressArrayMock.push(wallet2);
145
- await this.AddressArrayMock.set(1, wallet3);
146
- expect(await this.AddressArrayMock.get()).to.eql([wallet1, wallet3]);
147
- });
148
- });
149
- });
@@ -1,122 +0,0 @@
1
- const { expect } = require('chai');
2
- const { constants } = require('@openzeppelin/test-helpers');
3
-
4
- const AddressSetMock = artifacts.require('AddressSetMock');
5
-
6
- contract('AddressSet', async function ([wallet1, wallet2, wallet3]) {
7
- beforeEach(async function () {
8
- this.AddressSetMock = await AddressSetMock.new();
9
- });
10
-
11
- describe('length', async function () {
12
- it('should be calculate length 0', async function () {
13
- expect(await this.AddressSetMock.length()).to.be.bignumber.equal('0');
14
- });
15
-
16
- it('should be calculate length 1', async function () {
17
- await this.AddressSetMock.add(wallet1);
18
- expect(await this.AddressSetMock.length()).to.be.bignumber.equal('1');
19
- });
20
- });
21
-
22
- describe('at', async function () {
23
- it('should be get from empty data', async function () {
24
- expect(await this.AddressSetMock.at(0)).to.be.equal(constants.ZERO_ADDRESS);
25
- expect(await this.AddressSetMock.at(1)).to.be.equal(constants.ZERO_ADDRESS);
26
- });
27
-
28
- it('should be get from data with 1 element', async function () {
29
- await this.AddressSetMock.add(wallet1);
30
- expect(await this.AddressSetMock.at(0)).to.be.equal(wallet1);
31
- expect(await this.AddressSetMock.at(1)).to.be.equal(constants.ZERO_ADDRESS);
32
- });
33
-
34
- it('should be get from data with several elements', async function () {
35
- await this.AddressSetMock.add(wallet1);
36
- await this.AddressSetMock.add(wallet2);
37
- expect(await this.AddressSetMock.at(0)).to.be.equal(wallet1);
38
- expect(await this.AddressSetMock.at(1)).to.be.equal(wallet2);
39
- });
40
- });
41
-
42
- describe('contains', async function () {
43
- it('should be not contains in empty data', async function () {
44
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(false);
45
- expect(await this.AddressSetMock.contains(wallet2)).to.be.equal(false);
46
- expect(await this.AddressSetMock.contains(constants.ZERO_ADDRESS)).to.be.equal(false);
47
- });
48
-
49
- it('should be contains address', async function () {
50
- await this.AddressSetMock.add(wallet1);
51
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(true);
52
- expect(await this.AddressSetMock.contains(wallet2)).to.be.equal(false);
53
- expect(await this.AddressSetMock.contains(constants.ZERO_ADDRESS)).to.be.equal(false);
54
- });
55
-
56
- it('should be contains addresses', async function () {
57
- await this.AddressSetMock.add(wallet1);
58
- await this.AddressSetMock.add(wallet2);
59
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(true);
60
- expect(await this.AddressSetMock.contains(wallet2)).to.be.equal(true);
61
- expect(await this.AddressSetMock.contains(wallet3)).to.be.equal(false);
62
- expect(await this.AddressSetMock.contains(constants.ZERO_ADDRESS)).to.be.equal(false);
63
- });
64
- });
65
-
66
- describe('add', async function () {
67
- it('should be add to empty data', async function () {
68
- const isAdded = await this.AddressSetMock.add.call(wallet1);
69
- await this.AddressSetMock.add(wallet1);
70
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(isAdded);
71
- });
72
-
73
- it('should not be add a double element without another elements in data', async function () {
74
- await this.AddressSetMock.add(wallet1);
75
- expect(await this.AddressSetMock.add.call(wallet1)).to.be.equal(false);
76
- });
77
-
78
- it('should be add to data with 1 element', async function () {
79
- await this.AddressSetMock.add(wallet1);
80
- const isAdded = await this.AddressSetMock.add.call(wallet2);
81
- await this.AddressSetMock.add(wallet2);
82
- expect(await this.AddressSetMock.contains(wallet2)).to.be.equal(isAdded);
83
- });
84
-
85
- it('should not be add a double element with another elements in data', async function () {
86
- await this.AddressSetMock.add(wallet1);
87
- await this.AddressSetMock.add(wallet2);
88
- expect(await this.AddressSetMock.add.call(wallet2)).to.be.equal(false);
89
- });
90
- });
91
-
92
- describe('remove', async function () {
93
- it('should not be remove from empty data', async function () {
94
- const isRemoved = await this.AddressSetMock.remove.call(wallet1);
95
- expect(isRemoved).to.be.equal(false);
96
- });
97
-
98
- it('should be remove from data', async function () {
99
- await this.AddressSetMock.add(wallet1);
100
- const isRemoved = await this.AddressSetMock.remove.call(wallet1);
101
- await this.AddressSetMock.remove(wallet1);
102
- expect(isRemoved).to.be.equal(true);
103
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(false);
104
- });
105
-
106
- it('should not be remove element which is not in data', async function () {
107
- await this.AddressSetMock.add(wallet1);
108
- const isRemoved = await this.AddressSetMock.remove.call(wallet2);
109
- expect(isRemoved).to.be.equal(false);
110
- });
111
-
112
- it('should be remove from data and keep the remainder', async function () {
113
- await this.AddressSetMock.add(wallet1);
114
- await this.AddressSetMock.add(wallet2);
115
- const isRemoved = await this.AddressSetMock.remove.call(wallet1);
116
- await this.AddressSetMock.remove(wallet1);
117
- expect(isRemoved).to.be.equal(true);
118
- expect(await this.AddressSetMock.contains(wallet1)).to.be.equal(false);
119
- expect(await this.AddressSetMock.contains(wallet2)).to.be.equal(true);
120
- });
121
- });
122
- });
@@ -1,45 +0,0 @@
1
- const { expectRevert } = require('@openzeppelin/test-helpers');
2
-
3
- const RevertReasonParserTest = artifacts.require('RevertReasonParserTest');
4
-
5
- describe('RevertReasonParser', async () => {
6
- before(async function () {
7
- this.RevertReasonParserTest = await RevertReasonParserTest.new();
8
- });
9
-
10
- describe('parse', async function () {
11
- it('should be reverted with Invalid revert reason', async function () {
12
- await expectRevert(
13
- this.RevertReasonParserTest.testParseWithThrow(),
14
- 'Invalid revert reason',
15
- );
16
- });
17
-
18
- it('should be parsed as empty Error', async function () {
19
- await this.RevertReasonParserTest.testEmptyStringRevert();
20
- });
21
-
22
- it('should be parsed as Error', async function () {
23
- await this.RevertReasonParserTest.testNonEmptyRevert();
24
- });
25
-
26
- it('should be parsed as Unknown', async function () {
27
- await this.RevertReasonParserTest.testEmptyRevert();
28
- });
29
-
30
- it('should be parsed as Panic', async function () {
31
- await this.RevertReasonParserTest.testAssertion();
32
- });
33
-
34
- it('should be parsed as Error with long string', async function () {
35
- await this.RevertReasonParserTest.testLongStringRevert();
36
- });
37
-
38
- it('should be reverted in _test()', async function () {
39
- await expectRevert(
40
- this.RevertReasonParserTest.testWithThrow(),
41
- 'testFunctions without throw',
42
- );
43
- });
44
- });
45
- });
@@ -1,90 +0,0 @@
1
- const { expect } = require('chai');
2
-
3
- const StringUtilTest = artifacts.require('StringUtilTest');
4
-
5
- describe('StringUtil', async () => {
6
- const uint256TestValue = '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
7
- const uint128TestValue = '0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
8
- const veryLongArray = '0xffffffffffffffafafafbcbcbcbcbdeded' + 'aa'.repeat(50);
9
- const extremelyLongArray = '0x' + '0f'.repeat(1000);
10
- const emptyBytes = '0x';
11
- const singleByte = '0xaf';
12
-
13
- before(async () => {
14
- this.stringUtilTest = await StringUtilTest.new();
15
- });
16
-
17
- describe('Validity', async () => {
18
- it('Uint 256', () => test(uint256TestValue));
19
-
20
- it('Uint 128', () => test(uint128TestValue));
21
-
22
- it('Very long byte array', () => testBytes(veryLongArray));
23
-
24
- it('Extremely long byte array', () => testBytes(extremelyLongArray));
25
-
26
- it.skip('Empty bytes. Skipped until resolved: https://github.com/ChainSafe/web3.js/issues/4512', () => testBytes(emptyBytes));
27
-
28
- it('Single byte', () => testBytes(singleByte));
29
-
30
- const test = async (value) => {
31
- const result = await this.stringUtilTest.toHex(value, 0);
32
- const naiveResult = await this.stringUtilTest.toHexNaive(value, 0);
33
- expect(result.toLowerCase()).to.be.equal(value.toLowerCase());
34
- expect(result.toLowerCase()).to.be.equal(naiveResult.toLowerCase());
35
- };
36
-
37
- const testBytes = async (value) => {
38
- const result = await this.stringUtilTest.toHexBytes(value, 0);
39
- const naiveResult = await this.stringUtilTest.toHexNaiveBytes(value, 0);
40
- expect(result.toLowerCase()).to.be.equal(value.toLowerCase());
41
- expect(result.toLowerCase()).to.be.equal(naiveResult.toLowerCase());
42
- };
43
- });
44
-
45
- describe('Gas usage @skip-on-coverage', async () => {
46
- it('Uint 256', () => testGasUint256(uint256TestValue, 917));
47
-
48
- it('Uint 256 naive', () => testGasNaiveUint256(uint256TestValue, 14175));
49
-
50
- it('Uint 256 as bytes', () => testGasBytes(uint256TestValue, 792));
51
-
52
- it('Uint 256 as bytes naive', () => testGasNaiveBytes(uint256TestValue, 14050));
53
-
54
- it('Uint 128', () => testGasUint256(uint128TestValue, 917));
55
-
56
- it('Uint 128 naive', () => testGasNaiveUint256(uint128TestValue, 14175));
57
-
58
- it('Very long byte array gas', () => testGasBytes(veryLongArray, 1974));
59
-
60
- it('Very long byte array gas naive', () => testGasNaiveBytes(veryLongArray, 28972));
61
-
62
- it('Extremely long byte array gas', () => testGasBytes(extremelyLongArray, 19131));
63
-
64
- it('Extremely long byte array gas naive', () => testGasNaiveBytes(extremelyLongArray, 426795));
65
-
66
- it('Empty bytes', () => testGasBytes(emptyBytes, 201));
67
-
68
- it('Empty bytes naive', () => testGasNaiveBytes(emptyBytes, 406));
69
-
70
- it('Single byte', () => testGasBytes(singleByte, 792));
71
-
72
- it('Single byte naive', () => testGasNaiveBytes(singleByte, 832));
73
-
74
- const testGasUint256 = async (value, expectedGas) => {
75
- await this.stringUtilTest.toHex(value, expectedGas);
76
- };
77
-
78
- const testGasBytes = async (value, expectedGas) => {
79
- await this.stringUtilTest.toHexBytes(value, expectedGas);
80
- };
81
-
82
- const testGasNaiveUint256 = async (value, expectedGas) => {
83
- await this.stringUtilTest.toHexNaive(value, expectedGas);
84
- };
85
-
86
- const testGasNaiveBytes = async (value, expectedGas) => {
87
- await this.stringUtilTest.toHexNaiveBytes(value, expectedGas);
88
- };
89
- });
90
- });
@@ -1,45 +0,0 @@
1
- const { expect } = require('chai');
2
- const { profileEVM, gasspectEVM } = require('../js/profileEVM.js');
3
- const { ether } = require('@openzeppelin/test-helpers');
4
-
5
- const TokenMock = artifacts.require('TokenMock');
6
-
7
- contract('', function ([wallet1, wallet2]) {
8
- before(async function () {
9
- this.USDT = await TokenMock.new('USDT', 'USDT');
10
- });
11
-
12
- beforeEach(async function () {
13
- for (const addr of [wallet1, wallet2]) {
14
- await this.USDT.mint(addr, ether('1000'));
15
- }
16
- });
17
-
18
- describe('profileEVM', async function () {
19
- it('should be counted ERC20 Transfer', async function () {
20
- const receipt = await this.USDT.transfer(wallet2, ether('1'), { from: wallet1 });
21
- expect(await profileEVM(receipt.tx, ['STATICCALL', 'CALL', 'SSTORE', 'SLOAD']))
22
- .to.be.deep.equal([0, 0, 2, 2]);
23
- });
24
-
25
- it('should be counted ERC20 Approve', async function () {
26
- const receipt = await this.USDT.approve(wallet2, ether('1'), { from: wallet1 });
27
- expect(await profileEVM(receipt.tx, ['STATICCALL', 'CALL', 'SSTORE', 'SLOAD']))
28
- .to.be.deep.equal([0, 0, 1, 0]);
29
- });
30
- });
31
-
32
- describe('gasspectEVM', async function () {
33
- it('should be counted ERC20 Transfer', async function () {
34
- const receipt = await this.USDT.transfer(wallet2, ether('1'), { from: wallet1 });
35
- expect(await gasspectEVM(receipt.tx))
36
- .to.be.deep.equal(['0-0-SLOAD = 2100', '0-0-SSTORE = 2900', '0-0-SLOAD = 2100', '0-0-SSTORE = 2900', '0-0-LOG3 = 1756']);
37
- });
38
-
39
- it('should be counted ERC20 Approve', async function () {
40
- const receipt = await this.USDT.approve(wallet2, ether('1'), { from: wallet1 });
41
- expect(await gasspectEVM(receipt.tx))
42
- .to.be.deep.equal(['0-0-SSTORE = 2200', '0-0-LOG3 = 1756']);
43
- });
44
- });
45
- });