These are chat archives for Nethereum/Nethereum

17th
Nov 2017
Rickard Öh
@kalasp_twitter
Nov 17 2017 07:16
@EdsonAlcala @kaista82_twitter no I havent solved it. I am using web3/metamask/truffle from the exact same machine that I cant get Nethereum working on. Would be happy to provide you with examples if you have the time to help me. I could for example set up a VM and PM you the credentialswhere I show the error.
gaitchs gangmei
@gaitchs
Nov 17 2017 07:47
finally set up a unity game engine wallet to check balance with private key input
need help setting it up to display a token balance and not ethereum
how do i display a specific token balance ?
gaitchs gangmei
@gaitchs
Nov 17 2017 07:58
do i need to write my get balance contract function ?
this contract
cryptodeveloperin
@cryptodeveloperin
Nov 17 2017 09:36
Hi,
I have to create multiple ether address for my users and then need to transfer ether between each other. so can you provide me the details how can i achieve this?
For netherum, what installation i have to do?
Thanks
Juan Blanco
@juanfranblanco
Nov 17 2017 11:36
My
@gaitchs yes you will need to create your own
Juan Blanco
@juanfranblanco
Nov 17 2017 11:42
@cryptodeveloperin check this sample https://github.com/Nethereum/MultipleAccountTransferSample
Juan Blanco
@juanfranblanco
Nov 17 2017 11:48
@triston_abhi_twitter no you don't need it, Infura does that
@tatigo on vscode you need to save all files when compiling all
@kalasp_twitter you don't need to mine in Azure
Juan Blanco
@juanfranblanco
Nov 17 2017 11:53
When deploying a BaaS the mining process starts straight away
You will need to fund your account with ether using the provided faucet
Then will be the same as
@Art1987 for multisigs contracts depends on the implementation
Gnosis has a good one
Juan Blanco
@juanfranblanco
Nov 17 2017 12:01
To name a few
gaitchs gangmei
@gaitchs
Nov 17 2017 12:40
there is no balance checking function
gaitchs gangmei
@gaitchs
Nov 17 2017 12:58
how to call this contract for balance

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }

contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;

// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;

// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);

// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);

/**
 * Constrctor function
 *
 * Initializes contract with initial supply tokens to the creator of the contract
 */
function TokenERC20(
    uint256 initialSupply,
    string tokenName,
    string tokenSymbol
) public {
    totalSupply = initialSupply * 10 ** uint256(decimals);  // Update total supply with the decimal amount
    balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens
    name = tokenName;                                   // Set the name for display purposes
    symbol = tokenSymbol;                               // Set the symbol for display purposes
}

/**
 * Internal transfer, only can be called by this contract
 */
function _transfer(address _from, address _to, uint _value) internal {
    // Prevent transfer to 0x0 address. Use burn() instead
    require(_to != 0x0);
    // Check if the sender has enough
    require(balanceOf[_from] >= _value);
    // Check for overflows
    require(balanceOf[_to] + _value > balanceOf[_to]);
    // Save this for an assertion in the future
    uint previousBalances = balanceOf[_from] + balanceOf[_to];
    // Subtract from the sender
    balanceOf[_from] -= _value;
    // Add the same to the recipient
    balanceOf[_to] += _value;
    Transfer(_from, _to, _value);
    // Asserts are used to use static analysis to find bugs in your code. They should never fail
    assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}

/**
 * Transfer tokens
 *
 * Send `_value` tokens to `_to` from your account
 *
 * @param _to The address of the recipient
 * @param _value the amount to send
 */
function transfer(address _to, uint256 _value) public {
    _transfer(msg.sender, _to, _value);
}

/**
 * Transfer tokens from other address
 *
 * Send `_value` tokens to `_to` in behalf of `_from`
 *
 * @param _from The address of the sender
 * @param _to The address of the recipient
 * @param _value the amount to send
 */
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    require(_value <= allowance[_from][msg.sender]);     // Check allowance
    allowance[_from][msg.sender] -= _value;
    _transfer(_from, _to, _value);
    return true;
}

/**
 * Set allowance for other address
 *
 * Allows `_spender` to spend no more than `_value` tokens in your behalf
 *
 * @param _spender The address authorized to spend
 * @param _value the max amount they can spend
 */
function approve(address _spender, uint256 _value) public
    returns (bool success) {
    allowance[msg.sender][_spender] = _value;
    return true;
}

/**
 * Set allowance for other address and notify
 *
 * Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
 *
 * @param _spender The address authorized to spend
 * @param _value the max amount they can spend
 * @param _extraData some extra information to send to the approved contract
 */
funct
how to call this contract balance function ?
Juan Blanco
@juanfranblanco
Nov 17 2017 14:16
balanceOf
gaitchs gangmei
@gaitchs
Nov 17 2017 14:21
balanceOf[private key/ address] ?
Paul Gadi
@polats
Nov 17 2017 15:39
hi guys i was able to check ETH and custom token balance using Nethereum on Unity, you can check the code here: https://github.com/polats/unity3d-blockchain-wallet/blob/master/Assets/Scripts/WalletManager.cs#L284-L316
kai
@kaista82_twitter
Nov 17 2017 15:40
balanceof address most likely (a guess)
Paul Gadi
@polats
Nov 17 2017 15:44
need some help troubleshooting an issue though -- i'm trying to transfer tokens from one wallet to another using TransactionSignedUnityRequest, but the transaction doesn't seem to push through. I get the error "replacement transaction underpriced". My code for doing the transfer is here: https://github.com/polats/unity3d-blockchain-wallet/blob/master/Assets/Scripts/TokenContractService.cs#L135-L176
Juan Blanco
@juanfranblanco
Nov 17 2017 16:08
Address
Check the erc20 contract code / ABI if in doubt
@polats you are using the same nonce
Increase it to match the number of transactions
Paul Gadi
@polats
Nov 17 2017 16:19
thanks @juanfranblanco , how do i change the nonce?