Remove extraneous whitespace.

This commit is contained in:
David Braun 2016-11-21 11:37:14 -05:00
parent 04e43c62ea
commit 7efbe40c9c
3 changed files with 103 additions and 105 deletions

View File

@ -247,4 +247,3 @@ module.exports = {
formatOutputString: formatOutputString,
formatOutputAddress: formatOutputAddress
};

View File

@ -33,13 +33,13 @@ SolidityType.prototype.staticPartLength = function (name) {
/**
* Should be used to determine if type is dynamic array
* eg:
* eg:
* "type[]" => true
* "type[4]" => false
*
* @method isDynamicArray
* @param {String} name
* @return {Bool} true if the type is dynamic array
* @return {Bool} true if the type is dynamic array
*/
SolidityType.prototype.isDynamicArray = function (name) {
var nestedTypes = this.nestedTypes(name);
@ -48,13 +48,13 @@ SolidityType.prototype.isDynamicArray = function (name) {
/**
* Should be used to determine if type is static array
* eg:
* eg:
* "type[]" => false
* "type[4]" => true
*
* @method isStaticArray
* @param {String} name
* @return {Bool} true if the type is static array
* @return {Bool} true if the type is static array
*/
SolidityType.prototype.isStaticArray = function (name) {
var nestedTypes = this.nestedTypes(name);
@ -63,7 +63,7 @@ SolidityType.prototype.isStaticArray = function (name) {
/**
* Should return length of static array
* eg.
* eg.
* "int[32]" => 32
* "int256[14]" => 14
* "int[2][3]" => 3
@ -138,7 +138,7 @@ SolidityType.prototype.nestedTypes = function (name) {
* Should be used to encode the value
*
* @method encode
* @param {Object} value
* @param {Object} value
* @param {String} name
* @return {String} encoded value
*/
@ -152,7 +152,7 @@ SolidityType.prototype.encode = function (value, name) {
var result = [];
result.push(f.formatInputInt(length).encode());
value.forEach(function (v) {
result.push(self.encode(v, nestedName));
});
@ -228,12 +228,12 @@ SolidityType.prototype.decode = function (bytes, offset, name) {
return result;
})();
} else if (this.isDynamicType(name)) {
return (function () {
var dynamicOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes
var length = parseInt('0x' + bytes.substr(dynamicOffset * 2, 64)); // in bytes
var roundedLength = Math.floor((length + 31) / 32); // in int
return self._outputFormatter(new SolidityParam(bytes.substr(dynamicOffset * 2, ( 1 + roundedLength) * 64), 0));
})();
}

View File

@ -14,17 +14,17 @@ describe('lib/solidity/coder', function () {
};
test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
test({ type: 'address[2]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
test({ type: 'address[2]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' });
test({ type: 'address[]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
test({ type: 'address[]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' });
test({ type: 'address[][2]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
test({ type: 'address[][2]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
value: '0000000000000000000000000000000000000000000000000000000000000040' +
'00000000000000000000000000000000000000000000000000000000000000a0' +
@ -34,15 +34,15 @@ describe('lib/solidity/coder', function () {
'0000000000000000000000000000000000000000000000000000000000000002' + /* a0 */
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c4' });
test({ type: 'address[2][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
test({ type: 'address[2][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' + /* 20 */
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c2' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c4' });
test({ type: 'address[][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
test({ type: 'address[][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' + /* 20 */
@ -57,13 +57,13 @@ describe('lib/solidity/coder', function () {
test({ type: 'bool', expected: true, value: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ type: 'bool', expected: false, value: '0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bool[2]', expected: [true, false],
value: '0000000000000000000000000000000000000000000000000000000000000001' +
value: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bool[]', expected: [true, true, false],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'int', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
@ -75,7 +75,7 @@ describe('lib/solidity/coder', function () {
test({ type: 'int256', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
test({ type: 'int8', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
test({ type: 'int8[2]', expected: [new bn(16), new bn(2)],
value: '0000000000000000000000000000000000000000000000000000000000000010' +
value: '0000000000000000000000000000000000000000000000000000000000000010' +
'0000000000000000000000000000000000000000000000000000000000000002'});
test({ type: 'int32', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
test({ type: 'int64', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
@ -83,10 +83,10 @@ describe('lib/solidity/coder', function () {
test({ type: 'int[]', expected: [], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'int[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'int256[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'int[]', expected: [new bn(1), new bn(2), new bn(3)],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
@ -95,19 +95,19 @@ describe('lib/solidity/coder', function () {
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'int[3][]', expected: [[new bn(1), new bn(2), new bn(3)], [new bn(4), new bn(5), new bn(6)]],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005' +
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005' +
'0000000000000000000000000000000000000000000000000000000000000006'});
test({ type: 'uint', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ type: 'uint', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ type: 'uint', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
test({ type: 'uint', expected: new bn('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'),
test({ type: 'uint', expected: new bn('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'),
value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
test({ type: 'uint256', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ type: 'uint256', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
@ -118,10 +118,10 @@ describe('lib/solidity/coder', function () {
test({ type: 'uint[]', expected: [], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'uint[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'uint256[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'uint[]', expected: [new bn(1), new bn(2), new bn(3)],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
@ -130,57 +130,57 @@ describe('lib/solidity/coder', function () {
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003'});
test({ type: 'uint[3][]', expected: [[new bn(1), new bn(2), new bn(3)], [new bn(4), new bn(5), new bn(6)]],
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005' +
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005' +
'0000000000000000000000000000000000000000000000000000000000000006'});
test({ type: 'bytes', expected: '0x6761766f66796f726b',
test({ type: 'bytes', expected: '0x6761766f66796f726b',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ type: 'bytes', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
test({ type: 'bytes', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
test({ type: 'bytes', expected: '0x131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000060' +
'0000000000000000000000000000000000000000000000000000000000000060' +
'131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
test({ type: 'bytes', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
test({ type: 'bytes[2]', expected: ['0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134a',
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'],
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'],
value: '0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134a' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
test({ type: 'bytes[][2]', expected: [['0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134a'],
['0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134c',
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134d']],
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134d']],
value: '0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000001' + // 40 //
'00000000000000000000000000000000000000000000000000000000000000e0' +
'00000000000000000000000000000000000000000000000000000000000000e0' +
'0000000000000000000000000000000000000000000000000000000000000002' + // 80 //
'0000000000000000000000000000000000000000000000000000000000000120' +
'0000000000000000000000000000000000000000000000000000000000000180' +
'0000000000000000000000000000000000000000000000000000000000000120' +
'0000000000000000000000000000000000000000000000000000000000000180' +
'0000000000000000000000000000000000000000000000000000000000000020' + // e0 //
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134a' +
@ -191,40 +191,40 @@ describe('lib/solidity/coder', function () {
'0000000000000000000000000000000000000000000000000000000000000020' + // 180 //
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134d'});
test({ type: 'bytes1', expected: '0xcf',
test({ type: 'bytes1', expected: '0xcf',
value: 'cf00000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bytes1[4]', expected: ['0xcf', '0x68', '0x4d', '0xfb'],
test({ type: 'bytes1[4]', expected: ['0xcf', '0x68', '0x4d', '0xfb'],
value: 'cf00000000000000000000000000000000000000000000000000000000000000' +
'6800000000000000000000000000000000000000000000000000000000000000' +
'4d00000000000000000000000000000000000000000000000000000000000000' +
'fb00000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bytes32', expected: '0x6761766f66796f726b0000000000000000000000000000000000000000000000',
test({ type: 'bytes32', expected: '0x6761766f66796f726b0000000000000000000000000000000000000000000000',
value: '6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ type: 'bytes64', expected: '0xc3a40000c3a40000000000000000000000000000000000000000000000000000' +
'c3a40000c3a40000000000000000000000000000000000000000000000000000',
'c3a40000c3a40000000000000000000000000000000000000000000000000000',
value: 'c3a40000c3a40000000000000000000000000000000000000000000000000000' +
'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'gavofyork', value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'ää',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000008' +
'0000000000000000000000000000000000000000000000000000000000000008' +
'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'ü',
test({ type: 'string', expected: 'ü',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c3bc000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'Ã',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c383000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bytes', expected: '0xc3a40000c3a4',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000006' +
'0000000000000000000000000000000000000000000000000000000000000006' +
'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
test({ type: 'bytes32', expected: '0xc3a40000c3a40000000000000000000000000000000000000000000000000000',
value: 'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
@ -235,18 +235,18 @@ describe('lib/solidity/coder', function () {
test({ type: 'ureal', expected: new bn(1), value: '0000000000000000000000000000000100000000000000000000000000000000'});
test({ type: 'ureal', expected: new bn(2.125), value: '0000000000000000000000000000000220000000000000000000000000000000'});
test({ type: 'ureal', expected: new bn(8.5), value: '0000000000000000000000000000000880000000000000000000000000000000'});
test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
test({ type: 'string', expected: 'welcome to ethereum. welcome to ethereum. welcome to ethereum.',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'000000000000000000000000000000000000000000000000000000000000003e' +
'77656c636f6d6520746f20657468657265756d2e2077656c636f6d6520746f20' +
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'000000000000000000000000000000000000000000000000000000000000003e' +
'77656c636f6d6520746f20657468657265756d2e2077656c636f6d6520746f20' +
'657468657265756d2e2077656c636f6d6520746f20657468657265756d2e0000'});
test({ type: 'bytes', expected: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1',
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'000000000000000000000000000000000000000000000000000000000000009f' +
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' +
@ -266,52 +266,52 @@ describe('lib/solidity/coder', function () {
};
test({ types: ['address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1'],
test({ types: ['address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1'],
values: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
test({ types: ['address', 'address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
values: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
test({ types: ['address', 'address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
values: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3'});
test({ types: ['bool[2]', 'bool[3]'], expected: [[true, false], [false, false, true]],
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000000' +
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000001'});
test({ types: ['int[2]', 'int256[3]'], expected: [[new bn(1), new bn(2)], [new bn(3), new bn(4), new bn(5)]],
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005'});
test({ types: ['int'], expected: [new bn(1)], values: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ types: ['uint[2]', 'uint256[3]'], expected: [[new bn(1), new bn(2)], [new bn(3), new bn(4), new bn(5)]],
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'0000000000000000000000000000000000000000000000000000000000000004' +
'0000000000000000000000000000000000000000000000000000000000000005'});
test({ types: ['uint'], expected: [new bn(1)], values: '0000000000000000000000000000000000000000000000000000000000000001'});
test({ types: ['bytes', 'bytes'], expected: ['0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134c'],
'0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134c'],
values: '0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000020' +
'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134c'});
test({ types: ['int', 'string', 'int'], expected: [new bn(1), 'gavofyork', new bn(5)],
values: '0000000000000000000000000000000000000000000000000000000000000001' +
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'0000000000000000000000000000000000000000000000000000000000000060' +
'0000000000000000000000000000000000000000000000000000000000000005' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ types: ['bytes32', 'int'], expected: ['0x6761766f66796f726b0000000000000000000000000000000000000000000000', new bn(5)],
values: '6761766f66796f726b0000000000000000000000000000000000000000000000' +
values: '6761766f66796f726b0000000000000000000000000000000000000000000000' +
'0000000000000000000000000000000000000000000000000000000000000005'});
test({ types: ['int', 'bytes32'], expected: [new bn(5), '0x6761766f66796f726b0000000000000000000000000000000000000000000000'],
values: '0000000000000000000000000000000000000000000000000000000000000005' +
values: '0000000000000000000000000000000000000000000000000000000000000005' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ types: ['int', 'string', 'int', 'int', 'int', 'int[]'], expected: [new bn(1), 'gavofyork', new bn(2), new bn(3), new bn(4),
test({ types: ['int', 'string', 'int', 'int', 'int', 'int[]'], expected: [new bn(1), 'gavofyork', new bn(2), new bn(3), new bn(4),
[new bn(5), new bn(6), new bn(7)]],
values: '0000000000000000000000000000000000000000000000000000000000000001' +
'00000000000000000000000000000000000000000000000000000000000000c0' +
@ -334,15 +334,14 @@ describe('lib/solidity/coder', function () {
'431a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
],
values: '0000000000000000000000000000000000000000000000000000000000000005' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'00000000000000000000000000000000000000000000000000000000000000e0' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000080' +
'0000000000000000000000000000000000000000000000000000000000000003' +
'00000000000000000000000000000000000000000000000000000000000000e0' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'0000000000000000000000000000000000000000000000000000000000000040' +
'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
'431a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
});
});