@@ -53,84 +53,92 @@ private async void Load() {
5353 // Debug.Log("total supply: "+_token.ValueFromDecimals(_totalSupply));
5454
5555 // // standard calls
56- // Debug.Log("\nStandard ERC20 Data");
57- // BigInteger _balance = await _token.GetBalanceOf("0x34221445c2dd9fd3f41a8a8bfa7d49ec898e0ef4");
58- // BigInteger _allowance = await _token.GetAllowance("0xbd0dbb9fddc73b6ebffc7c09cfae1b19d6dece40", Constants.ADDR_UNISWAPV2);
59- // Debug.Log("balance: "+_token.ValueFromDecimals(_balance));
60- // Debug.Log("allowance: "+_token.ValueFromDecimals(_allowance));
56+ Debug . Log ( "\n Standard ERC20 Data" ) ;
57+ BigInteger _balance = await _token . GetBalanceOf ( "0x34221445c2dd9fd3f41a8a8bfa7d49ec898e0ef4" ) ;
58+ BigInteger _allowance = await _token . GetAllowance ( "0xbd0dbb9fddc73b6ebffc7c09cfae1b19d6dece40" , Constants . ADDR_UNISWAPV2 ) ;
59+ Debug . Log ( "balance: " + _token . ValueFromDecimals ( _balance ) ) ;
60+ Debug . Log ( "allowance: " + _token . ValueFromDecimals ( _allowance ) ) ;
6161
6262 // var _out = await _token.CallFunction("isSniper(address)", new string[]{"bool"}, new string[]{"0x34221445c2dd9fd3f41a8a8bfa7d49ec898e0ef4"});
6363 // bool _isSniper = (bool)_out[0];
6464 // Debug.Log(_isSniper);
6565
66- // var _out = await _token.CallFunction("totalSupply()", new string[]{"int "});
67- // BigInteger _supply = (BigInteger)_out[0];
68- // Debug.Log(_out[0]);
66+ var _out = await _token . CallFunction ( "totalSupply()" , new string [ ] { "uint " } ) ;
67+ BigInteger _supply = ( BigInteger ) _out [ 0 ] ;
68+ Debug . Log ( _out [ 0 ] ) ;
6969
70- // Debug.Log("TEST: getUint256()");
71- // var _out = await _token.CallFunction("getUint256()", new string[]{"uint"});
72- // Debug.Log("returned: "+_out[0]);
73-
74- // Debug.Log("TEST: getUint128()");
75- // _out = await _token.CallFunction("getUint128()", new string[]{"uint128 "});
76- // Debug.Log("returned: "+_out[0]);
77-
78- // Debug.Log("TEST: getUint64()");
79- // _out = await _token.CallFunction("getUint64()", new string[]{"uint64 "});
80- // Debug.Log("returned: "+_out[0]);
81-
82- // Debug.Log("TEST: getUint32()");
83- // _out = await _token.CallFunction("getUint32()", new string[]{"uint32 "});
84- // Debug.Log("returned: "+_out[0]);
85-
86- // Debug.Log("TEST: getUint16()");
87- // _out = await _token.CallFunction("getUint16()", new string[]{"uint16 "});
88- // Debug.Log("returned: "+_out[0]);
89-
90- // Debug.Log("TEST: getUint8()");
91- // _out = await _token.CallFunction("getUint8()", new string[]{"uint8 "});
92- // Debug.Log("returned: "+_out[0]);
93-
94- // Debug.Log("TEST: getUint()");
95- // _out = await _token.CallFunction("getUint()", new string[]{"uint"});
96- // Debug.Log("returned: "+_out[0]);
97-
98- // Debug.Log("TEST: getDataStruct()");
99- // var _out = await _token.CallFunction("getDataStruct()", new string[]{"struct(uint,string,bool,address)"});
100- // foreach(object _o in _out) {
101- // Debug.Log(_o);
102- // }
70+ Debug . Log ( "TEST: getUint256()" ) ;
71+ _out = await _token . CallFunction ( "getUint256()" , new string [ ] { "uint" } ) ;
72+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
73+
74+ Debug . Log ( "TEST: getUint128()" ) ;
75+ _out = await _token . CallFunction ( "getUint128()" , new string [ ] { "uint " } ) ;
76+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
77+
78+ Debug . Log ( "TEST: getUint64()" ) ;
79+ _out = await _token . CallFunction ( "getUint64()" , new string [ ] { "uint " } ) ;
80+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
81+
82+ Debug . Log ( "TEST: getUint32()" ) ;
83+ _out = await _token . CallFunction ( "getUint32()" , new string [ ] { "uint " } ) ;
84+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
85+
86+ Debug . Log ( "TEST: getUint16()" ) ;
87+ _out = await _token . CallFunction ( "getUint16()" , new string [ ] { "uint " } ) ;
88+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
89+
90+ Debug . Log ( "TEST: getUint8()" ) ;
91+ _out = await _token . CallFunction ( "getUint8()" , new string [ ] { "uint " } ) ;
92+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
93+
94+ Debug . Log ( "TEST: getUint()" ) ;
95+ _out = await _token . CallFunction ( "getUint()" , new string [ ] { "uint" } ) ;
96+ Debug . Log ( "returned: " + _out [ 0 ] ) ;
97+
98+ Debug . Log ( "TEST: getDataStruct()" ) ;
99+ _out = await _token . CallFunction ( "getDataStruct()" , new string [ ] { "struct(uint,string,bool,address)" } ) ;
100+ foreach ( object _o in _out ) {
101+ Debug . Log ( _o ) ;
102+ }
103103
104- // Debug.Log("TEST: getPrimitiveMultiReturnData()");
105- // var _out = await _token.CallFunction("getPrimitiveMultiReturnData()", new string[]{"uint","string","bool","address"});
106- // Debug.Log("returned length: "+_out.Count);
107- // foreach(object _o in _out) {
108- // Debug.Log(_o);
109- // }
110-
111- // Debug.Log("TEST: getStructMultiReturnData()");
112- // var _out = await _token.CallFunction("getStructMultiReturnData()", new string[]{"uint","string","bool","address","struct(uint,string,bool,address)"});
113- // foreach(object _o in _out) {
114- // Debug.Log(_o);
115- // }
116-
117- // Debug.Log("TEST: getStructArr()");
118- // var _out = await _token.CallFunction("getStructArr(DataStruct[] memory _arr)", new string[]{"struct[](uint,string,bool,address)"}, new string[]{});
119- // foreach(object _o in _out) {
120- // Debug.Log(_o);
121- // }
122-
123- // Debug.Log("TEST: getUintArr()");
124- // var _out = await _token.CallFunction("getUintArr(uint256[])", new string[]{"uint[]"}, new string[]{"uint[](12415,23431,3555523)"});
125- // BigInteger[] _intarr = (BigInteger[])_out[0];
126- // foreach(BigInteger _int in _intarr) {
127- // Debug.Log(_int);
128- // }
104+ Debug . Log ( "TEST: getPrimitiveMultiReturnData()" ) ;
105+ _out = await _token . CallFunction ( "getPrimitiveMultiReturnData()" , new string [ ] { "uint" , "string" , "bool" , "address" } ) ;
106+ Debug . Log ( "returned length: " + _out . Count ) ;
107+ foreach ( object _o in _out ) {
108+ Debug . Log ( _o ) ;
109+ }
110+
111+ Debug . Log ( "TEST: getStructMultiReturnData()" ) ;
112+ _out = await _token . CallFunction ( "getStructMultiReturnData()" , new string [ ] { "uint" , "string" , "bool" , "address" , "struct(uint,string,bool,address)" } ) ;
113+ foreach ( object _o in _out ) {
114+ Debug . Log ( _o ) ;
115+ }
116+
117+ Debug . Log ( "TEST: getUintArr()" ) ;
118+ _out = await _token . CallFunction ( "getUintArr(uint256[])" , new string [ ] { "uint[]" } , new string [ ] { "uint[](12415,23431,3555523)" } ) ;
119+ BigInteger [ ] _intarr = ( BigInteger [ ] ) _out [ 0 ] ;
120+ foreach ( BigInteger _int in _intarr ) {
121+ Debug . Log ( _int ) ;
122+ }
129123
130124 Debug . Log ( "TEST: getStrArr()" ) ;
131- var _out = await _token . CallFunction ( "getStrArr(string[])" , new string [ ] { "string[]" } , new string [ ] { "string[](abcqest,123,341agf3)" } ) ;
132- BigInteger [ ] _strarr = ( BigInteger [ ] ) _out [ 0 ] ;
133- foreach ( BigInteger _s in _strarr ) {
125+ _out = await _token . CallFunction ( "getStrArr(string[])" , new string [ ] { "string[]" } , new string [ ] { "string[](abcqest,123,341agf3)" } ) ;
126+ string [ ] _strarr = ( string [ ] ) _out [ 0 ] ;
127+ foreach ( string _s in _strarr ) {
128+ Debug . Log ( _s ) ;
129+ }
130+
131+ Debug . Log ( "TEST: getBoolArr()" ) ;
132+ _out = await _token . CallFunction ( "getBoolArr(bool[])" , new string [ ] { "bool[]" } , new string [ ] { "bool[](0,1,1)" } ) ;
133+ bool [ ] _boolarr = ( bool [ ] ) _out [ 0 ] ;
134+ foreach ( bool _s in _boolarr ) {
135+ Debug . Log ( _s ) ;
136+ }
137+
138+ Debug . Log ( "TEST: getAddrArr()" ) ;
139+ _out = await _token . CallFunction ( "getAddrArr(address[])" , new string [ ] { "address[]" } , new string [ ] { "address[](0x4C9B1DB55c8A89cb0312C8fD84B0cB650E648618,0x1A2933fbA0c6e959c9A2D2c933f3f8AD4aa9f06e)" } ) ;
140+ string [ ] _addrarr = ( string [ ] ) _out [ 0 ] ;
141+ foreach ( string _s in _addrarr ) {
134142 Debug . Log ( _s ) ;
135143 }
136144 }
@@ -143,4 +151,22 @@ private async void GetChainId() {
143151
144152 #endregion
145153 }
146- }
154+ }
155+ /*
156+ 0000000000000000000000000000000000000000000000000000000000000020
157+ 0000000000000000000000000000000000000000000000000000000000000002 (arrlen)
158+ 0000000000000000000000000000000000000000000000000000000000000040 (arrptr) 64 <- count from this line
159+ 0000000000000000000000000000000000000000000000000000000000000100 (arrptr2) 256
160+ 000000000000000000000000000000000000000000000000000000000000007b (int)
161+ 0000000000000000000000000000000000000000000000000000000000000080 (strptr)
162+ 0000000000000000000000000000000000000000000000000000000000000001 (bool)
163+ 000000000000000000000000250e75b9f33940506d1cf31fab63cfaa5ad98c95 (address)
164+ 0000000000000000000000000000000000000000000000000000000000000009 (strlen)
165+ 737472696e677661720000000000000000000000000000000000000000000000 (string)
166+ 000000000000000000000000000000000000000000000000000000000000007b (int)
167+ 0000000000000000000000000000000000000000000000000000000000000080 (strptr)
168+ 0000000000000000000000000000000000000000000000000000000000000001 (bool)
169+ 000000000000000000000000250e75b9f33940506d1cf31fab63cfaa5ad98c95 (address)
170+ 0000000000000000000000000000000000000000000000000000000000000009 (strlen)
171+ 737472696e677661720000000000000000000000000000000000000000000000 (string)
172+ */
0 commit comments