Skip to content

Commit 2cc698e

Browse files
authored
Do not add payable to events in ABI translator (#145)
1 parent 6653cbc commit 2cc698e

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

abi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function update (compilerVersion, abi) {
1818
hasFallback = true;
1919
}
2020

21-
// add 'payable' to everything
22-
if (semver.lt(compilerVersion, '0.4.0')) {
21+
// add 'payable' to everything except events
22+
if (item.type !== 'event' && semver.lt(compilerVersion, '0.4.0')) {
2323
item.payable = true;
2424
}
2525
}

test/abi.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ tape('ABI translator', function (t) {
1010
st.deepEqual(abi.update('0.1.1', []), [ { inputs: [], payable: true, type: 'constructor' }, { payable: true, type: 'fallback' } ]);
1111
st.end();
1212
});
13+
t.test('0.3.6 (constructor)', function (st) {
14+
var input = [ { inputs: [], type: 'constructor' } ];
15+
st.deepEqual(abi.update('0.3.6', input), [ { inputs: [], payable: true, type: 'constructor' }, { payable: true, type: 'fallback' } ]);
16+
st.end();
17+
});
18+
t.test('0.3.6 (function)', function (st) {
19+
var input = [ { inputs: [], type: 'function' } ];
20+
st.deepEqual(abi.update('0.3.6', input), [ { inputs: [], payable: true, type: 'function' }, { payable: true, type: 'fallback' } ]);
21+
st.end();
22+
});
23+
t.test('0.3.6 (event)', function (st) {
24+
var input = [ { inputs: [], type: 'event' } ];
25+
st.deepEqual(abi.update('0.3.6', input), [ { inputs: [], type: 'event' }, { payable: true, type: 'fallback' } ]);
26+
st.end();
27+
});
1328
t.test('0.4.0 (has fallback)', function (st) {
1429
var input = [ { inputs: [], type: 'constructor' } ];
1530
st.deepEqual(abi.update('0.4.0', input), [ { inputs: [], payable: true, type: 'constructor' } ]);

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
require('./package.js');
2+
require('./abi.js');
23
require('./cli.js');
34
require('./determinism.js');
4-
require('./abi.js');

0 commit comments

Comments
 (0)