public void DecodeTest() { var raw = Utils.ToByteArray( "080195310200020457494343bc834003045749434382dcbd84cf9bff0046304402204a53817db48777bca9db6f8512c1abc8c3f1b7feceaddb40db7d65df3113c5bc02202f3d5f274b1e1cd9f0560b8593d9961d77d04816523efa781c0ea26130ccaab2"); var decodedTx = new Wicc.Tx.CoinStakeTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.CoinStakeTx() { Version = 1, TxUid = new RegId(0, 2), ValidHeight = 2865, Fees = 1000000, StakeType = BalanceOpType.STAKE, CoinSymbol = TokenSymbol.WICC, CoinAmount = 2100000000000000, }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.StakeType == tx.StakeType); Assert.IsTrue(decodedTx.CoinSymbol == tx.CoinSymbol); Assert.IsTrue(decodedTx.CoinAmount == tx.CoinAmount); Assert.IsTrue(decodedTx.Signature.ToString() == "304402204a53817db48777bca9db6f8512c1abc8c3f1b7feceaddb40db7d65df3113c5bc02202f3d5f274b1e1cd9f0560b8593d9961d77d04816523efa781c0ea26130ccaab2"); }
public void DecodeTest() { var raw = Utils.ToByteArray( "55018d8128058cf53782080457494343858c2004575553440457494343aed6c100a591e700463044022025cfc4fae2ac2c328f420e189b46dfec9b3ffe159976eca88e9c7ce8e530c5a40220012ca9a56ad0d2d780e90f009d58931c7e36c28107249ecb6495d4ffd0dd1d61"); var decodedTx = new Wicc.Tx.DexSellLimitOrderTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.DexSellLimitOrderTx() { TxUid = new RegId(228151, 392), ValidHeight = 229672, Fees = 100000, CoinSymbol = new TokenSymbol("WUSD"), AssetSymbol = new TokenSymbol("WICC"), AskPrice = 80000000, AssetAmount = 100000000, }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.CoinSymbol == tx.CoinSymbol); Assert.IsTrue(decodedTx.AssetSymbol == tx.AssetSymbol); Assert.IsTrue(decodedTx.AskPrice == tx.AskPrice); Assert.IsTrue(decodedTx.AssetAmount == tx.AssetAmount); Assert.IsTrue(decodedTx.Signature.ToString() == "3044022025cfc4fae2ac2c328f420e189b46dfec9b3ffe159976eca88e9c7ce8e530c5a40220012ca9a56ad0d2d780e90f009d58931c7e36c28107249ecb6495d4ffd0dd1d61"); }
public void DecodeTest() { var raw = Utils.ToByteArray( "590187e75d03827403045749434383e1ac000216ba0ad41fe1c330da0903c0863c60b0de82b899b1ab04ba82b1c91b5d0cbc50c346853a48a441f4622c28bbcf708" + "abe1ff660d12ddcd79880aa54c96dd9da4f8580f4698580f469aed6c100f5a5681084f390f386bf30f89462cd453cb87d72f3415888a5936f521c3ea8fc59281433" + "6afc3e7538453359623b032439f8ac04be108f552f3cf6fd074b51ed84fae74984fae749aed6c1004630440220589da3b9d5cf2e2cd4433e6a7191ef56a0b4d8a8e" + "0d0a2f093b6eebf1284c02402203c1b317c380aff1968f064855dc4827ffb5f152a3c9f9e31be67334ac7b7219f"); var decodedTx = new Wicc.Tx.DexSettleTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.DexSettleTx() { TxUid = new RegId(500, 3), ValidHeight = 144477, Fees = 10000000, DealItems = new Vector <DealItem>() { new DealItem() { BuyOrderId = new uint256("50bc0c5d1bc9b182ba04abb199b882deb0603c86c00309da30c3e11fd40aba16"), SellOrderId = new uint256("4fdad96dc954aa8098d7dc2dd160f61fbe8a70cfbb282c62f441a4483a8546c3"), DealAssetAmount = 100000000, DealCoinAmount = 12614377, DealPrice = 12614377 }, new DealItem() { BuyOrderId = new uint256("fca83e1c526f93a5885841f3727db83c45cd6294f830bf86f390f3841068a5f5"), SellOrderId = new uint256("ed514b07fdf63c2f558f10be04acf83924033b6259334538753efc6a33142859"), DealAssetAmount = 100000000, DealCoinAmount = 12514377, DealPrice = 12514377 }, } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.DealItems.Count == tx.DealItems.Count); for (int i = 0; i < decodedTx.DealItems.Count; i++) { Assert.IsTrue(decodedTx.DealItems[i].BuyOrderId == tx.DealItems[i].BuyOrderId); Assert.IsTrue(decodedTx.DealItems[i].SellOrderId == tx.DealItems[i].SellOrderId); Assert.IsTrue(decodedTx.DealItems[i].DealAssetAmount == tx.DealItems[i].DealAssetAmount); Assert.IsTrue(decodedTx.DealItems[i].DealCoinAmount == tx.DealItems[i].DealCoinAmount); Assert.IsTrue(decodedTx.DealItems[i].DealPrice == tx.DealItems[i].DealPrice); } Assert.IsTrue(decodedTx.Signature.ToString() == "30440220589da3b9d5cf2e2cd4433e6a7191ef56a0b4d8a8e0d0a2f093b6eebf1284c02402203c1b317c380aff1968f064855dc4827ffb5f152a3c9f9e31be67334ac7b7219f"); }
public void DecodeTest() { var raw = Utils.ToByteArray( "150187d6752102f99b0d9ed0ddf9c66b413ce4c7456ff4f65cb5e182e4edcde8983b3e286b76110457494343bc834" + "000000000000000000000000000000000000000000000000000000000000000000" + "10457494343d0f9b4b7000457555344849ac89b0046304402206b63e8b2e465f96" + "ed5d7d7536c272ce7fd65adc986510201cc39a2ec0625d82d02207385ec9e39941" + "79c0e0d6f11a5a676b466ab569a26fb20b09792d2232164fbe5"); var decodedTx = new Wicc.Tx.CdpStakeTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.CdpStakeTx() { TxUid = new PubKeyId("02f99b0d9ed0ddf9c66b413ce4c7456ff4f65cb5e182e4edcde8983b3e286b7611"), ValidHeight = 142325, Fees = 1000000, CdpTxid = new uint256(), ScoinSymbol = TokenSymbol.WUSD, ScoinToMint = 1400000000, AssetToStake = new Vector <Wicc.Tx.CdpStakeAsset>() { new Wicc.Tx.CdpStakeAsset() { AssetSymbol = TokenSymbol.WICC, AssetAmount = 22000000000 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.CdpTxid == tx.CdpTxid); Assert.IsTrue(decodedTx.ScoinSymbol == tx.ScoinSymbol); Assert.IsTrue(decodedTx.ScoinToMint == tx.ScoinToMint); Assert.IsTrue(decodedTx.AssetToStake.Count == tx.AssetToStake.Count); for (int i = 0; i < decodedTx.AssetToStake.Count; i++) { Assert.IsTrue(decodedTx.AssetToStake[i].AssetSymbol == tx.AssetToStake[i].AssetSymbol); Assert.IsTrue(decodedTx.AssetToStake[i].AssetAmount == tx.AssetToStake[i].AssetAmount); } Assert.IsTrue(decodedTx.Signature.ToString() == "304402206b63e8b2e465f96ed5d7d7536c272ce7fd65adc986510201cc39a2ec0625d82d02207385ec9e3994179c0e0d6f11a5a676b466ab569a26fb20b09792d2232164fbe5"); }
public void DecodeTest() { var raw = Utils.ToByteArray("160181822a0480e84803045749434383e1ac00c6dfa7a893ba912e4b079a14fceba5b59e5369a99d8c5df2e07107245257384dcd" + "10010457494343d3b2aae08f00463044022034324a0cbaaf9659d140dd109fd47ab6af45e75bd0ac2a2b2e79f49b8b39e1d902202873" + "0a522210f8cf2913be7eb76ba374ce5ef8bd7d7000b449de1a9f75e5e94d"); var decodedTx = new Wicc.Tx.CdpRedeemTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.CdpRedeemTx() { TxUid = new RegId(29896, 3), ValidHeight = 33194, Fees = 10000000, CdpTxid = new uint256("4d385752240771e0f25d8c9da969539eb5a5ebfc149a074b2e91ba93a8a7dfc6"), ScoinToRepay = 10000, AssetToRedeem = new Vector <Wicc.Tx.CdpStakeAsset>() { new Wicc.Tx.CdpStakeAsset() { AssetSymbol = TokenSymbol.WICC, AssetAmount = 2900000000000 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.CdpTxid == tx.CdpTxid); Assert.IsTrue(decodedTx.ScoinToRepay == tx.ScoinToRepay); Assert.IsTrue(decodedTx.AssetToRedeem.Count == tx.AssetToRedeem.Count); for (int i = 0; i < decodedTx.AssetToRedeem.Count; i++) { Assert.IsTrue(decodedTx.AssetToRedeem[i].AssetSymbol == tx.AssetToRedeem[i].AssetSymbol); Assert.IsTrue(decodedTx.AssetToRedeem[i].AssetAmount == tx.AssetToRedeem[i].AssetAmount); } Assert.IsTrue(decodedTx.Signature.ToString() == "3044022034324a0cbaaf9659d140dd109fd47ab6af45e75bd0ac2a2b2e79f49b8b39e1d9022028730a522210f8cf2913be7eb76ba374ce5ef8bd7d7000b449de1a9f75e5e94d"); }
public void DecodeTest() { var raw = Utils.ToByteArray("0b018cfa39020001045749434383e1ac0001048cf47a410457494343f09eeb600046304402200ec7e3ccdc87e74be72bcf612bd136380b3bf0cdc6d7e3602e9de94c7e9707a1022030f35baf756435d2574a7186c14954a21b677c719c3ca05b46443ec4f9c96af7"); var decodedTx = new Wicc.Tx.CoinTransferTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.CoinTransferTx() { TxUid = new RegId(0, 1), ValidHeight = 228793, Fees = 10000000, Memo = "", Transfers = new Vector <SingleTransfer>() { new SingleTransfer() { ToUid = new RegId(228090, 65), CoinAmount = 237500000 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.Memo == tx.Memo); Assert.IsTrue(decodedTx.Transfers.Count == tx.Transfers.Count); for (int i = 0; i < decodedTx.Transfers.Count; i++) { Assert.IsTrue(decodedTx.Transfers[i].ToUid == tx.Transfers[i].ToUid); Assert.IsTrue(decodedTx.Transfers[i].CoinAmount == tx.Transfers[i].CoinAmount); Assert.IsTrue(decodedTx.Transfers[i].CoinSymbol == tx.Transfers[i].CoinSymbol); } Assert.IsTrue(decodedTx.Signature.ToString() == "304402200ec7e3ccdc87e74be72bcf612bd136380b3bf0cdc6d7e3602e9de94c7e9707a1022030f35baf756435d2574a7186c14954a21b677c719c3ca05b46443ec4f9c96af7"); }
public void DecodeTest() { var raw = Utils.ToByteArray( "11018eb209000204574752540355534400e1f505000000000457494343035553442352ba0000000000"); var decodedTx = new Wicc.Tx.BlockPriceMedianTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.BlockPriceMedianTx() { ValidHeight = 252297, Version = 1, MedianPricePoints = new Vector <PricePoint>() { new PricePoint() { LeftToken = new TokenSymbol("WGRT"), RightToken = new TokenSymbol("USD"), Price = 100000000 }, new PricePoint() { LeftToken = new TokenSymbol("WICC"), RightToken = new TokenSymbol("USD"), Price = 12210723 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.MedianPricePoints.Count == tx.MedianPricePoints.Count); Assert.IsTrue(decodedTx.MedianPricePoints[0].LeftToken == tx.MedianPricePoints[0].LeftToken); Assert.IsTrue(decodedTx.MedianPricePoints[0].RightToken == tx.MedianPricePoints[0].RightToken); Assert.IsTrue(decodedTx.MedianPricePoints[0].Price == tx.MedianPricePoints[0].Price); Assert.IsTrue(decodedTx.MedianPricePoints[1].LeftToken == tx.MedianPricePoints[1].LeftToken); Assert.IsTrue(decodedTx.MedianPricePoints[1].RightToken == tx.MedianPricePoints[1].RightToken); Assert.IsTrue(decodedTx.MedianPricePoints[1].Price == tx.MedianPricePoints[1].Price); }
public void DecodeTest() { var raw = Utils.ToByteArray("0d018eb20902000b020457494343000000000000000004575553440000000000000000829761"); var decodedTx = new Wicc.Tx.UCoinBlockRewardTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.UCoinBlockRewardTx() { TxUid = new RegId(0, 11), ValidHeight = 252297, InflatedBcoins = 52321, RewardFees = new Vector <RewardFee>() { new RewardFee() { Token = new TokenSymbol("WICC"), Amount = 0 }, new RewardFee() { Token = new TokenSymbol("WUSD"), Amount = 0 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.InflatedBcoins == tx.InflatedBcoins); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.RewardFees.Count == tx.RewardFees.Count); Assert.IsTrue(decodedTx.RewardFees[0].Token == tx.RewardFees[0].Token); Assert.IsTrue(decodedTx.RewardFees[0].Amount == tx.RewardFees[0].Amount); Assert.IsTrue(decodedTx.RewardFees[1].Token == tx.RewardFees[1].Token); Assert.IsTrue(decodedTx.RewardFees[1].Amount == tx.RewardFees[1].Amount); }
public void DecodeTest() { var raw = Utils.ToByteArray("01010200060001"); var decodedTx = new Wicc.Tx.BlockRewardTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.BlockRewardTx() { RewardFees = 0, TxUid = new RegId(0, 6), ValidHeight = 1 }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.RewardFees == tx.RewardFees); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); }
public void DecodeTest() { var raw = Utils.ToByteArray( "0601000200010b01210389e1bdfeab629107631fdc27f75c2d0bd47d2a09930d9c95935fe7b15a14506caedee5fa9bbf0001210393f920474be2babf0a4679e3e1341c4e" + "b8e31b22e19fc341ef5c0a74102b1b62aedee5fa9bbf00012103c2511372f6d68b1b7f46e2d5426efdb1c32eb7826f23f012acfee6176e072f0daedee5fa9bbf00012102" + "1de59471052acba560185e9e8f0d8029fe0214180afe8a750204c44e5c385da1aedee5fa9bbf0001210267a77cfab55a3cedf0576393b90d307da1c6745970f286d40c35" + "6853443df9e6aedee5fa9bbf000121035eaee0cce88f4d3b8af6e71797f36750608b9425607e02ce03e8f08cad5b19aeaedee5fa9bbf000121036c670e382df168387083" + "152e257f528bb7a7136900ea684550843a5347d89a04aedee5fa9bbf00012102f06edeb3d0a0cd01c44999ccbdc2126f65c1e0dcb09742e03336cfae2175d8bdaedee5fa" + "9bbf0001210236f8aae8a5e4d4daab49e0b48723258a74dade6380c104a7759ec5d4a45aa186aedee5fa9bbf000121022a55aac2432590f1111f151cbb27c7a4417d0d85" + "e5e4c24805943b90842b8710aedee5fa9bbf00012102e45a86ca60b7d0a53e9612228d5d9bee83056b6b57c1d58f7216a5060e6a3752aedee5fa9bbf00cd102102fc0033" + "e19b9999997331c98652607299b0aaf20ed2dd6f0975d03cff3aecdeec"); var decodedTx = new Wicc.Tx.DelegateVoteTx(); var serialize = new NBitcoin.Wicc.Commons.Serialize(raw); serialize.ReadWrite(decodedTx); var tx = new Wicc.Tx.DelegateVoteTx() { ValidHeight = 0, Version = 1, Fees = 10000, TxUid = new RegId(0, 1), CandidateVotes = new Vector <Vote>() { new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("0389e1bdfeab629107631fdc27f75c2d0bd47d2a09930d9c95935fe7b15a14506c"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("0393f920474be2babf0a4679e3e1341c4eb8e31b22e19fc341ef5c0a74102b1b62"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("03c2511372f6d68b1b7f46e2d5426efdb1c32eb7826f23f012acfee6176e072f0d"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("021de59471052acba560185e9e8f0d8029fe0214180afe8a750204c44e5c385da1"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("0267a77cfab55a3cedf0576393b90d307da1c6745970f286d40c356853443df9e6"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("035eaee0cce88f4d3b8af6e71797f36750608b9425607e02ce03e8f08cad5b19ae"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("036c670e382df168387083152e257f528bb7a7136900ea684550843a5347d89a04"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("02f06edeb3d0a0cd01c44999ccbdc2126f65c1e0dcb09742e03336cfae2175d8bd"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("0236f8aae8a5e4d4daab49e0b48723258a74dade6380c104a7759ec5d4a45aa186"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("022a55aac2432590f1111f151cbb27c7a4417d0d85e5e4c24805943b90842b8710"), VotedBcoins = 210000000000000 }, new Vote() { VoteType = VoteType.ADD_BCOIN, CandidateUid = new PubKeyId("02e45a86ca60b7d0a53e9612228d5d9bee83056b6b57c1d58f7216a5060e6a3752"), VotedBcoins = 210000000000000 } } }; Assert.IsTrue(decodedTx.ValidHeight == tx.ValidHeight); Assert.IsTrue(decodedTx.Version == tx.Version); Assert.IsTrue(decodedTx.TxType == tx.TxType); Assert.IsTrue(decodedTx.TxUid == tx.TxUid); Assert.IsTrue(decodedTx.Fees == tx.Fees); Assert.IsTrue(decodedTx.CandidateVotes.Count == tx.CandidateVotes.Count); for (int i = 0; i < decodedTx.CandidateVotes.Count; i++) { Assert.IsTrue(decodedTx.CandidateVotes[i].VoteType == tx.CandidateVotes[i].VoteType); Assert.IsTrue(decodedTx.CandidateVotes[i].CandidateUid == tx.CandidateVotes[i].CandidateUid); Assert.IsTrue(decodedTx.CandidateVotes[i].VotedBcoins == tx.CandidateVotes[i].VotedBcoins); } }