async Task TransferringAssetAppliesSingleFixedCommision() { await using var fxBuyer = await TestAccount.CreateAsync(_network); await using var fxSeller = await TestAccount.CreateAsync(_network); await using var fxBenefactor = await TestAccount.CreateAsync(_network); await using var fxPaymentToken = await TestToken.CreateAsync(_network, fx => fx.Params.GrantKycEndorsement = null, fxBenefactor, fxBuyer, fxSeller); await using var fxAsset = await TestAsset.CreateAsync(_network, fx => { fx.Params.Royalties = new FixedRoyalty[] { new FixedRoyalty(fxBenefactor, fxPaymentToken, 10) }; fx.Params.GrantKycEndorsement = null; }, fxBuyer, fxSeller); Assert.Equal(ResponseCode.Success, fxAsset.Record.Status); var movedAsset = new Asset(fxAsset, 1); await fxPaymentToken.Client.TransferTokensAsync(fxPaymentToken, fxPaymentToken.TreasuryAccount, fxBuyer, 100, fxPaymentToken.TreasuryAccount); await fxPaymentToken.Client.TransferAssetAsync(movedAsset, fxAsset.TreasuryAccount, fxSeller, fxAsset.TreasuryAccount); await AssertHg.AssetBalanceAsync(fxAsset, fxBuyer, 0); await AssertHg.AssetBalanceAsync(fxAsset, fxSeller, 1); await AssertHg.AssetBalanceAsync(fxAsset, fxBenefactor, 0); await AssertHg.AssetBalanceAsync(fxAsset, fxAsset.TreasuryAccount, fxAsset.Metadata.Length - 1); await AssertHg.AssetBalanceAsync(fxAsset, fxPaymentToken.TreasuryAccount, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxBuyer, 100); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxSeller, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxBenefactor, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxAsset.TreasuryAccount, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxPaymentToken.TreasuryAccount, fxPaymentToken.Params.Circulation - 100); var record = await fxAsset.Client.TransferWithRecordAsync(new TransferParams { AssetTransfers = new[] { new AssetTransfer(movedAsset, fxSeller, fxBuyer) }, TokenTransfers = new[] { new TokenTransfer(fxPaymentToken, fxBuyer, -100), new TokenTransfer(fxPaymentToken, fxSeller, 100), }, Signatory = new Signatory(fxBuyer, fxSeller) }); Assert.Equal(ResponseCode.Success, record.Status); Assert.False(record.Hash.IsEmpty); Assert.NotNull(record.Concensus); Assert.NotNull(record.CurrentExchangeRate); Assert.NotNull(record.NextExchangeRate); Assert.Empty(record.Memo); Assert.InRange(record.Fee, 0UL, ulong.MaxValue); Assert.Equal(_network.Payer, record.Id.Address); Assert.Equal(3, record.TokenTransfers.Count); Assert.Contains(new TokenTransfer(fxPaymentToken, fxBuyer, -100), record.TokenTransfers); Assert.Contains(new TokenTransfer(fxPaymentToken, fxSeller, 90), record.TokenTransfers); Assert.Contains(new TokenTransfer(fxPaymentToken, fxBenefactor, 10), record.TokenTransfers); Assert.Single(record.AssetTransfers); Assert.Contains(new AssetTransfer(movedAsset, fxSeller, fxBuyer), record.AssetTransfers); Assert.Empty(record.Associations); Assert.Single(record.Royalties); AssertHg.ContainsRoyalty(fxPaymentToken, fxSeller, fxBenefactor, 10, record.Royalties); await AssertHg.AssetBalanceAsync(fxAsset, fxBuyer, 1); await AssertHg.AssetBalanceAsync(fxAsset, fxSeller, 0); await AssertHg.AssetBalanceAsync(fxAsset, fxBenefactor, 0); await AssertHg.AssetBalanceAsync(fxAsset, fxAsset.TreasuryAccount, fxAsset.Metadata.Length - 1); await AssertHg.AssetBalanceAsync(fxAsset, fxPaymentToken.TreasuryAccount, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxBuyer, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxSeller, 90); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxBenefactor, 10); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxAsset.TreasuryAccount, 0); await AssertHg.TokenBalanceAsync(fxPaymentToken, fxPaymentToken.TreasuryAccount, fxPaymentToken.Params.Circulation - 100); }