These are chat archives for Nethereum/Nethereum

7th
Feb 2018
She Jong Shon
@kkagill
Feb 07 2018 08:10
hey Juan I have a function returning multiple arrays and used a DTO to map those, but I am not getting any data when I called CallDeserializingToObjectAsync. I've tested the same code with Remix and it returned data. I guess there is a problem with my DTO. Could you take a look at it?
Solidity:
  struct BetterBettingInfo {    
      uint256 matchId;    
      uint homeTeamScore;
      uint awayTeamScore;     
      uint bettingPrice;
      bool isWinner;    
  }

  mapping(address => BetterBettingInfo[]) public betterBettingInfo;

function getBetterBettingInfo(address _better) public constant returns (uint256[] matchId, 
                                                                          uint[] homeTeamScore, 
                                                                          uint[] awayTeamScore, 
                                                                          uint[] bettingPrice, 
                                                                          bool[] isWinner) {
    uint length = betterBettingInfo[_better].length;
    uint256[] memory matchIds = new uint256[](length);
    uint[] memory homeTeamScores = new uint[](length);
    uint[] memory awayTeamScores = new uint[](length);
    uint[] memory bettingPrices = new uint[](length);
    bool[] memory isWinners = new bool[](length);

    for (uint i = 0; i < length; i++) {
      matchId[i] = betterBettingInfo[_better][i].matchId;
      homeTeamScore[i] = betterBettingInfo[_better][i].homeTeamScore;
      awayTeamScore[i] = betterBettingInfo[_better][i].awayTeamScore;
      bettingPrice[i] = betterBettingInfo[_better][i].bettingPrice;
      isWinner[i] = betterBettingInfo[_better][i].isWinner;
    }

    return (matchIds, homeTeamScores, awayTeamScores, bettingPrices, isWinners);
  }

DTO:
[FunctionOutput]
    public class GetBetterBettingInfo
    {
        [Parameter("uint256[]", "matchId", 1)]
        public List<BigInteger> MatchId { get; set; }

        [Parameter("uint[]", "homeTeamScore", 2)]
        public List<uint> HomeTeamScore { get; set; }

        [Parameter("uint[]", "awayTeamScore", 3)]
        public List<uint> AwayTeamScore { get; set; }

        [Parameter("uint[]", "bettingPrice", 4)]
        public List<uint> BettingPrice { get; set; }

        [Parameter("bool[]", "isWinner", 5)]
        public List<bool> IsWinner { get; set; }
    }   

Calls:
var functionGetBetterBettingInfo = contract.GetFunction("getBetterBettingInfo");
 var result = await functionGetBetterBettingInfo.CallDeserializingToObjectAsync<GetBetterBettingInfo>(senderAddress);
Juan Blanco
@juanfranblanco
Feb 07 2018 12:32
@bluuman yeah
@KevinSmall yes, but Ethereum are moving to POS
Juan Blanco
@juanfranblanco
Feb 07 2018 12:44
@kkagill
DesignBrian
@Thought_2Life_twitter
Feb 07 2018 13:53
Jaun what is your perspective on Oracles. I am developing an app that needs to verify an event is true prior to executing the rest of the code. Now the event happens off chain. So my options were oraclizing or perhaps crowd sourcing for the answer by the users and or rewarding honesty.
I don't like too much oraclizing because it introduces a somewhat a semi centralized concept. Just wanted to know your perspective on it.
@juanfranblanco
She Jong Shon
@kkagill
Feb 07 2018 14:11
@juanfranblanco Any thoughts on my DTO please?
l-vitall
@l-vitall
Feb 07 2018 16:47
Hi Juan,
is there an ability to generate public keys without private key in NEthereum? I mean the case like ExtPubKey pubKey = privateKey.Neuter() in Bitcoin where pubKey can be used to generate other public keys that are derived from the same private key. The private key can be safely stored offline in this case. I checked the HdWallet project and tests but it seems that there is no functionality like described yet, is it planned to support in future? Thanks.
singlr
@singlr
Feb 07 2018 19:35
@juanfranblanco
public class Program
    {
        private static string SXXCoinContractAddress = "0x9B5865db270aAd400F908775428eef2581040343";
        private static string SXXCoinSymbol = "SXX";

        static void Main(string[] args)
        {
            var web3 = new Web3();
            var coinRegistry = new CoinTokenRegistryService(web3, SXXCoinContractAddress);
            var coinTokenService = coinRegistry.GetEthTokenServiceAsync(SXXCoinSymbol).Result;
            var coinTransferEvent = coinTokenService.GetTransferEvent();
            var filterId = coinTransferEvent.CreateFilterAsync(new BlockParameter(1729503)).Result;

            var transfers = coinTokenService.GetTransferEvent().GetAllChanges<Transfer>(filterId).Result;

            var logger = log4net.LogManager.GetLogger("coinBlockLogger",typeof(Program));
            foreach (var transfer in transfers)
            {
                logger.Debug($"From:{transfer.Event.AddressFrom},To:{transfer.Event.AddressTo},Amount:{transfer.Event.Value}");                
            }            
        }
    }
@juanfranblanco invalid argument 0: non-string address at index 0
@juanfranblanco when calling GetTransferEvent throw an exception :invalid argument 0: non-string address at index 0