public static LedgerStruct.PeersMigrationInfo getPeersMigrationInfoInner(LedgerStruct.Channel _c) { LedgerStruct.PeerProfile[] peerProfiles = _c.peerProfiles; BasicMethods.assert(peerProfiles.Length == 2, "Illegal peerProfiles length"); LedgerStruct.PeerProfile peer0 = peerProfiles[0]; LedgerStruct.PeerProfile peer1 = peerProfiles[1]; LedgerStruct.PeerState peerState0 = peer0.state; LedgerStruct.PeerState peerState1 = peer1.state; LedgerStruct.PeersMigrationInfo peersMigrationInfo = new LedgerStruct.PeersMigrationInfo(); peersMigrationInfo.peerAddr = new byte[2][]; peersMigrationInfo.deposit = new BigInteger[2]; peersMigrationInfo.withdrawal = new BigInteger[2]; peersMigrationInfo.seqNum = new BigInteger[2]; peersMigrationInfo.transferOut = new BigInteger[2]; peersMigrationInfo.pendingPayout = new BigInteger[2]; byte[][] peerAddr = peersMigrationInfo.peerAddr; peerAddr[0] = peer0.peerAddr; peerAddr[1] = peer1.peerAddr; BigInteger[] deposit = peersMigrationInfo.deposit; deposit[0] = peer0.deposit; deposit[1] = peer1.deposit; BigInteger[] withdrawal = peersMigrationInfo.withdrawal; withdrawal[0] = peer0.withdrawal; withdrawal[1] = peer1.withdrawal; BigInteger[] seqNum = peersMigrationInfo.seqNum; seqNum[0] = peerState0.seqNum; seqNum[1] = peerState1.seqNum; BigInteger[] transferOut = peersMigrationInfo.transferOut; transferOut[0] = peerState0.transferOut; transferOut[1] = peerState1.transferOut; BigInteger[] pendingPayout = peersMigrationInfo.pendingPayout; pendingPayout[0] = peerState0.pendingPayOut; pendingPayout[1] = peerState1.pendingPayOut; return(peersMigrationInfo); }
public static LedgerStruct.Channel _importPeersMigrationInfo(LedgerStruct.Channel _c, byte[] _fromLedgerAddr, byte[] _channelId) { BasicMethods.assert(BasicMethods._isLegalAddress(_fromLedgerAddr), "invalid contract address"); BasicMethods.assert(BasicMethods._isByte32(_channelId), "invalid _channelId"); object[] input = new object[] { _channelId }; DynamicCallContract dyncall = (DynamicCallContract)_fromLedgerAddr.ToDelegate(); LedgerStruct.PeersMigrationInfo args = (LedgerStruct.PeersMigrationInfo)dyncall("getPeersMigrationInfo", input); byte[][] peerAddr = args.peerAddr; BigInteger[] deposit = args.deposit; BigInteger[] withdrawal = args.withdrawal; BigInteger[] seqNum = args.seqNum; BigInteger[] transferOut = args.transferOut; BigInteger[] pendingPayout = args.pendingPayout; LedgerStruct.PeerProfile[] peerProfiles = _c.peerProfiles; for (int i = 0; i < 2; i++) { LedgerStruct.PeerProfile originalPeerProfile = peerProfiles[i]; LedgerStruct.PeerState originaPeerState = originalPeerProfile.state; LedgerStruct.PeerState peerState = new LedgerStruct.PeerState { seqNum = seqNum[i], transferOut = transferOut[i], nextPayIdListHash = originaPeerState.nextPayIdListHash, lastPayResolveDeadline = originaPeerState.lastPayResolveDeadline, pendingPayOut = pendingPayout[i] }; LedgerStruct.PeerProfile peerProfile = new LedgerStruct.PeerProfile() { peerAddr = peerAddr[i], deposit = deposit[i], withdrawal = withdrawal[i], state = peerState }; peerProfiles[i] = peerProfile; } return(_c); }