These are chat archives for Nethereum/Nethereum

26th
Jun 2018
tmyngu11
@tmyngu11
Jun 26 2018 02:49
is there a way for nethereum with unity to handle functions that return multiple things?
@tmyngu11 in the same as Nethereum normal use FunctionOutput DTO
these can be generated for you using vscode
tmyngu11
@tmyngu11
Jun 26 2018 15:50

I did that, I made a class with the same outputs as the solitidy function and called
function.DecodeDTOTypeOutput<MyClass>(result);

but it gives me an error
"IndexOutOfRangeException: Array index is out of range.
System.Numerics.BigInteger..ctor (System.Byte[] value)
Nethereum.ABI.Decoders.IntTypeDecoder.DecodeBigInteger (System.Byte[] encoded)
Nethereum.ABI.Decoders.IntTypeDecoder.DecodeInt (System.Byte[] encoded)
Nethereum.ABI.Decoders.BoolTypeDecoder.Decode (System.Byte[] encoded, System.Type type)..."

is it because I'm using BigInteger for uint256? should i be using something else?
Stef Heyenrath
@StefH
Jun 26 2018 15:53
@tmyngu11 Did you generate the C# classes using vscode or another tool?
If you want a full development environment, you can take a look at https://github.com/mstack/bootcamp-blockchain-smartcontracts/tree/master/Lab%202 which provides building blocks and a project which can autogenerate C# classes based on the Solidity contract.
tmyngu11
@tmyngu11
Jun 26 2018 15:56
oh I hand wrote it. I'll definitely check that out after work.
thanks!!
Alexander Voronkov
@UnimaginaryUnit
Jun 26 2018 19:36

Good evening everyone!
I'm trying to use solidity .net code generator and keep getting this error, though the JSON seems fine:

Error generating code:
Unexpected token o in JSON at position 1

Could anyone help me with this?

Stef Heyenrath
@StefH
Jun 26 2018 19:37
@UnimaginaryUnit Can you post your full contract here?
Alexander Voronkov
@UnimaginaryUnit
Jun 26 2018 19:37
It's quite a long one, I think it might not be convinient
I'll make a gist
Stef Heyenrath
@StefH
Jun 26 2018 19:37
OK
Stef Heyenrath
@StefH
Jun 26 2018 19:41

First file is broken; you can delete that one.

And can you also add the 2 dependency contracts?

Alexander Voronkov
@UnimaginaryUnit
Jun 26 2018 19:43
I added a part of the first file, because the whole one is very large
Sure, I'll add them in a sec
I updated the gist
Stef Heyenrath
@StefH
Jun 26 2018 20:01

@UnimaginaryUnit : Using the solc compiler directly, I'm able to compile your contract into C# generated code.

See this project here: https://github.com/StefH/Solidity-Examples/tree/master/SmartContracts/Examples/ArtifactOwnership which also includes a simple .NET console app. (Note that I only deployed the contract on my local Ganache and executed 1 function).

And see https://github.com/mstack/bootcamp-blockchain-smartcontracts [specifically Lab 2) for a tutorial on how to use the project template to generate C# service interfaces and classes.

Alexander Voronkov
@UnimaginaryUnit
Jun 26 2018 20:03
I think it might be something with truffle migrate, I'll try to directly use solc instead. Thank you a lot!