Пример #1
0
        public Deposit Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                              RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var id         = context.DecodeKeccak();
            var units      = context.DecodeUInt();
            var expiryTime = context.DecodeUInt();
            var value      = context.DecodeUInt256();

            return(new Deposit(id, units, expiryTime, value));
        }
Пример #2
0
        public NdmConfig Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var enabled = context.DecodeBool();
            var storeConfigInDatabase = context.DecodeBool();
            var id                        = context.DecodeString();
            var filesPath                 = context.DecodeString();
            var fileMaxSize               = context.DecodeUlong();
            var providerName              = context.DecodeString();
            var persistence               = context.DecodeString();
            var verifyP2PSignature        = context.DecodeBool();
            var providerAddress           = context.DecodeString();
            var providerColdWalletAddress = context.DecodeString();
            var consumerAddress           = context.DecodeString();
            var contractAddress           = context.DecodeString();
            var receiptRequestThreshold   = context.DecodeUInt256();
            var receiptsMergeThreshold    = context.DecodeUInt256();
            var paymentClaimThreshold     = context.DecodeUInt256();
            var blockConfirmations        = context.DecodeUInt();

            return(new NdmConfig
            {
                Enabled = enabled,
                StoreConfigInDatabase = storeConfigInDatabase,
                Id = id,
                FilesPath = filesPath,
                FileMaxSize = fileMaxSize,
                ProviderName = providerName,
                Persistence = persistence,
                VerifyP2PSignature = verifyP2PSignature,
                ProviderAddress = providerAddress,
                ProviderColdWalletAddress = providerColdWalletAddress,
                ConsumerAddress = consumerAddress,
                ContractAddress = contractAddress,
                ReceiptRequestThreshold = receiptRequestThreshold,
                ReceiptsMergeThreshold = receiptsMergeThreshold,
                PaymentClaimThreshold = paymentClaimThreshold,
                BlockConfirmations = blockConfirmations
            });
        }
Пример #3
0
        public DataDeliveryReceipt Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                          RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var statusCode    = (StatusCodes)context.DecodeInt();
            var consumedUnits = context.DecodeUInt();
            var unpaidUnits   = context.DecodeUInt();
            var signature     = SignatureDecoder.DecodeSignature(context);

            return(new DataDeliveryReceipt(statusCode, consumedUnits, unpaidUnits, signature));
        }
Пример #4
0
        public DataDeliveryReceiptRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                                 RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var number       = context.DecodeUInt();
            var depositId    = context.DecodeKeccak();
            var unitsRange   = Nethermind.Core.Encoding.Rlp.Decode <UnitsRange>(context);
            var isSettlement = context.DecodeBool();
            var receipts     = Nethermind.Core.Encoding.Rlp.DecodeArray <DataDeliveryReceiptToMerge>(context);

            return(new DataDeliveryReceiptRequest(number, depositId, unitsRange, isSettlement, receipts));
        }
Пример #5
0
        public EthRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var id              = context.DecodeKeccak();
            var host            = context.DecodeString();
            var address         = context.DecodeAddress();
            var value           = context.DecodeUInt256();
            var requestedAt     = DateTimeOffset.FromUnixTimeSeconds(context.DecodeLong()).UtcDateTime;
            var transactionHash = context.DecodeKeccak();

            return(new EthRequest(id, host, address, value, requestedAt, transactionHash));
        }
        public DataRequest Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                  RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var headerId   = context.DecodeKeccak();
            var units      = context.DecodeUInt();
            var value      = context.DecodeUInt256();
            var expiryTime = context.DecodeUInt();
            var salt       = context.DecodeByteArray();
            var provider   = context.DecodeAddress();
            var consumer   = context.DecodeAddress();
            var signature  = SignatureDecoder.DecodeSignature(context);

            return(new DataRequest(headerId, units, value, expiryTime, salt, provider, consumer, signature));
        }
Пример #7
0
        public DepositApproval Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                      RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var id         = context.DecodeKeccak();
            var headerId   = context.DecodeKeccak();
            var headerName = context.DecodeString();
            var kyc        = context.DecodeString();
            var consumer   = context.DecodeAddress();
            var provider   = context.DecodeAddress();
            var timestamp  = context.DecodeUlong();
            var state      = (DepositApprovalState)context.DecodeInt();

            return(new DepositApproval(id, headerId, headerName, kyc, consumer, provider, timestamp, state));
        }
        public DataDeliveryReceiptDetails Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                                 RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var id             = context.DecodeKeccak();
            var sessionId      = context.DecodeKeccak();
            var dataHeaderId   = context.DecodeKeccak();
            var consumerNodeId = new PublicKey(context.DecodeByteArray());
            var request        = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceiptRequest>(context);
            var receipt        = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceipt>(context);
            var timestamp      = context.DecodeUlong();
            var isClaimed      = context.DecodeBool();

            return(new DataDeliveryReceiptDetails(id, sessionId, dataHeaderId, consumerNodeId, request, receipt,
                                                  timestamp, isClaimed));
        }
Пример #9
0
        public ConsumerSession Decode(Nethermind.Core.Encoding.Rlp.DecoderContext context,
                                      RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var sequenceLength = context.ReadSequenceLength();

            if (sequenceLength == 0)
            {
                return(null);
            }

            var id                        = context.DecodeKeccak();
            var depositId                 = context.DecodeKeccak();
            var dataHeaderId              = context.DecodeKeccak();
            var consumerAddress           = context.DecodeAddress();
            var consumerNodeId            = new PublicKey(context.DecodeByteArray());
            var providerAddress           = context.DecodeAddress();
            var providerNodeId            = new PublicKey(context.DecodeByteArray());
            var state                     = (SessionState)context.DecodeInt();
            var startUnitsFromProvider    = context.DecodeUInt();
            var startUnitsFromConsumer    = context.DecodeUInt();
            var startTimestamp            = context.DecodeUlong();
            var finishTimestamp           = context.DecodeUlong();
            var consumedUnits             = context.DecodeUInt();
            var unpaidUnits               = context.DecodeUInt();
            var paidUnits                 = context.DecodeUInt();
            var settledUnits              = context.DecodeUInt();
            var consumedUnitsFromProvider = context.DecodeUInt();
            var dataAvailability          = (DataAvailability)context.DecodeInt();
            var streamEnabled             = context.DecodeBool();
            var subscriptions             = context.DecodeArray(c => c.DecodeString());

            return(new ConsumerSession(id, depositId, dataHeaderId, consumerAddress, consumerNodeId, providerAddress,
                                       providerNodeId, state, startUnitsFromProvider, startUnitsFromConsumer, startTimestamp, finishTimestamp,
                                       consumedUnits, unpaidUnits, paidUnits, settledUnits, consumedUnitsFromProvider, dataAvailability,
                                       streamEnabled, subscriptions));
        }