Beispiel #1
0
        public void Deserialize_Basic_Log_Success()
        {
            var network             = new SmartContractsPoATest();
            var primitiveSerializer = new ContractPrimitiveSerializer(network);

            var testStruct = new TestLog
            {
                Id      = uint.MaxValue,
                Name    = "Test ID",
                Data    = 0xAA,
                Datas   = new byte[] { 0xBB, 0xCC, 0xDD },
                Truth   = true,
                Address = "0x0000000000000000000000000000000000000001".HexToAddress()
            };

            var testBytes = primitiveSerializer.Serialize(testStruct);

            var     serializer      = new ApiLogDeserializer(primitiveSerializer, network);
            dynamic deserializedLog = serializer.DeserializeLogData(testBytes, typeof(TestLog));

            Assert.Equal(testStruct.Id, deserializedLog.Id);
            Assert.Equal(testStruct.Name, deserializedLog.Name);
            Assert.Equal(testStruct.Data, deserializedLog.Data);
            Assert.True(testStruct.Datas.SequenceEqual((byte[])deserializedLog.Datas));
            Assert.Equal(testStruct.Truth, deserializedLog.Truth);
            Assert.Equal(testStruct.Address.ToUint160().ToBase58Address(network), deserializedLog.Address);
        }
Beispiel #2
0
        public void Actual_Withdrawal_Passes()
        {
            Transaction withdrawal = new SmartContractsPoATest().CreateTransaction("01000000019eb9793f7c69bd31d4b03518f349e70384f8f20456556b4be0f941dbaebec9d400000000fdfe0000483045022100f6d3d20ebfe9b336a1432e06365c549a3dac5b411cb0fe2cd6dd46b09530adf202206e65df4c8f18f66f65409652463300c8b1b90ad69486c9ebabd58987baeeb7fd01483045022100e399eec964ccc1d99b1a0b285031284e7c4a4b0aa678dd52ea4698973c326622022011814dddddcd4a43fd4a223509de4815e2d687814c5fc5abde68ec3801026fe1014c69522102eef7619de25578c9717a289d08c61d4598b2bd81d2ee5db3072a07fa2d121e6521027ce19209dd1212a6a4fc2b7ddf678c6dea40b596457f934f73f3dcc5d0d9ee552103093239d5344ddb4c69c46c75bd629519e0b68d2cfc1a86cd63115fd068f202ba53aeffffffff03c0dc8743fd1a070017a91442938bb61378468a38629c4ffa1521759d0283578700e1f505000000001976a9148732134e7953ebfe51f65d455612a4245f9610ae88ac0000000000000000226a2009422af22360465d208f70e4c86284e538706db5db5dae1c2c4fcad5eef928eb00000000");

            rule.CheckTransaction(new MempoolValidationContext(withdrawal, null));
        }