@@ -23,9 +23,10 @@ class AgeUsdBankSpec extends PropSpec with Matchers
2323 ageUsdBank.getStableCoinPrice shouldBe 2309468
2424
2525 // redeem stable coin
26- testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
26+ val unsignedTx = testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
2727 txBuilder.buildStableCoinExchangeTransaction(100 )
2828 })
29+ unsignedTx.getOutputs.size() shouldBe 4
2930
3031 // mint stable coin
3132 testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
@@ -41,9 +42,20 @@ class AgeUsdBankSpec extends PropSpec with Matchers
4142 testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
4243 txBuilder.buildReserveCoinExchangeTransaction(- 1000 )
4344 })
45+
46+ // use additional fee for redeeming
47+ val additionalFeeTx = testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
48+ txBuilder.withAdditionalFee(address, 1000L * 1000L * 100L ).buildReserveCoinExchangeTransaction(1000 )
49+ })
50+ additionalFeeTx.getOutputs.size() shouldBe 5
51+
52+ // use additional fee for minting
53+ testAgeUsdTransaction(ageUsdBank, { txBuilder : AgeUsdExchangeTransactionBuilder =>
54+ txBuilder.withAdditionalFee(address, 1000L * 1000L * 100L ).buildReserveCoinExchangeTransaction(- 1000 )
55+ })
4456 }
4557
46- private def testAgeUsdTransaction (ageUsdBank : AgeUsdBank , action : AgeUsdExchangeTransactionBuilder => UnsignedTransaction ) = {
58+ private def testAgeUsdTransaction (ageUsdBank : AgeUsdBank , action : AgeUsdExchangeTransactionBuilder => UnsignedTransaction ): UnsignedTransaction = {
4759 val data = MockData (
4860 Seq (
4961 loadNodeResponse(" ageusd/response_Box1.json" ),
@@ -65,11 +77,12 @@ class AgeUsdBankSpec extends PropSpec with Matchers
6577 }
6678
6779 unsignedTransaction.getDataInputs.size() shouldBe 1
68- unsignedTransaction.getOutputs.size() shouldBe 4
6980 checkSmartContractRun(unsignedTransaction) shouldBe true
7081 ergoClient.execute { ctx : BlockchainContext =>
7182 ctx.newProverBuilder().withSecretStorage(storage).build().sign(unsignedTransaction)
7283 }
84+
85+ unsignedTransaction
7386 }
7487
7588 def checkSmartContractRun (unsignedTransaction : UnsignedTransaction ): Boolean = {
0 commit comments