These are chat archives for Nethereum/Nethereum

5th
May 2018
Pari Hoxha
@phoxha
May 05 2018 02:31 UTC
Is it possible to add a message field in the TransferFunction for token? So when I transfer a token I want to include a message field to send a thank you note or some message.
Enigmatic
@EnigmaticUnreal_twitter
May 05 2018 04:34 UTC

@phoxha - That's possible as long as you have a corresponding parameter to allow for that.

E.g.
I've defined my transfer as: transfer(address _to, uint256 _value, string test)
https://ropsten.etherscan.io/tx/0x561c45856d4f80c9c108d98b30aa9947b480cfaf31d98593fe4d684020548a0c

The catch being the ERC20 standard interface accepts two parameters only (address, uint256), so you'll be doing this by means of an overrides, and users need to explicitly call the function with an additional parameter to enter a message.

Juan Blanco
@juanfranblanco
May 05 2018 05:00 UTC
one thing to note is that the interoperability goes out of the window as the signature is different
Enigmatic
@EnigmaticUnreal_twitter
May 05 2018 05:16 UTC

Indeed, tinkering with the standard will make it incompatible with ecosystem tools.

My example defined an override to accept an extra string param which raises an event, so MyCrypto etc will still be able to access the standard ERC20 transfer function. :D

Calling from MyCrypto (signature 0xa9059cbb):
https://ropsten.etherscan.io/tx/0x62176c26f41e10c49f292f49874ff760e2c76ecff94e19834791a6fba5a4bfa9

But yea, possibly a better way is to define a separate transfer, something like "transferWithMessage". :D

(feel free to correct me if I am wrong)
Juan Blanco
@juanfranblanco
May 05 2018 05:17 UTC
probably better that.. as your method won't be actually overriden
as it will have a different signature anyway
the signature "id" of the function is calculated based on the name and parameters
Juan Blanco
@juanfranblanco
May 05 2018 05:22 UTC
you may get away by extracting the msg.data in solidity and put some stuff at the end
but all depends on how the abi is handled
and how to find that extra data
Enigmatic
@EnigmaticUnreal_twitter
May 05 2018 05:26 UTC
Ah. So appending additional data at the end of the msg.data and extracting that piece to derive the string? That's an interesting one - Gonna play around a bit with that.
Juan Blanco
@juanfranblanco
May 05 2018 05:27 UTC
or.. you could create a proxy contract
with parameter at the front
it will be much easier
for the Transfer.. you could get away with it
as you only have the sender 32 bytes and the amount 32 bytes
(if i am not missing something)
then you pick the last one
after that :)
if you are working with dynamic stuff
that will be a nighmare
Enigmatic
@EnigmaticUnreal_twitter
May 05 2018 05:45 UTC
Cool! Was doing a quick mockup - I could create a signed raw transaction calling the transfer function signature with its relevant encoded parameters and additional data, then from solidity's end tinker with the extra stuff. Hmmmmmmmm I think I can do some stuff with this....... Hey thanks for passing the idea along Juan! :D
Juan Blanco
@juanfranblanco
May 05 2018 05:47 UTC
like i said if the values are not fixed.. it might get a bit complicated
but they are in the ledger
snowycrypto
@snowycrypto_twitter
May 05 2018 06:06 UTC
@juanfranblanco I'm using unity experimental now and starting from your example repo https://github.com/Nethereum/Unity3dSimpleSampleNet461
How can I add in Nethereum.HdWallet library to it?
I keep getting Assets/DecodeData.cs(44,3): error CS0012: The type 'NBitcoin.IRandom' is defined in an assembly that is not referenced. Consider adding a reference to assembly 'NBitcoin, Version=4.0.0.38, Culture=neutral, PublicKeyToken=null'
Enigmatic
@EnigmaticUnreal_twitter
May 05 2018 12:54 UTC
@snowycrypto_twitter - Might just be me being daft... Does nuget Nethereum.HDwallet work for Unity projects? It should also pull the required dependencies including NBitcoin.
snowycrypto
@snowycrypto_twitter
May 05 2018 17:19 UTC
You're not being daft at all
I did try nuget
Maybe I'm doing something wrong but couldn't get it to work
snowycrypto
@snowycrypto_twitter
May 05 2018 17:57 UTC
I'm using NugetForUnity
I'm having trouble downloading NBitcoin >= 4.0
It keeps downloading NBitcoin 1.0 and won't update