From e1ad2d984b5bd6a801f1e303068029bd2f314e60 Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Thu, 23 Jun 2022 11:18:06 +0100 Subject: [PATCH] Add get / list pending DUSD swaps calls --- test/functional/feature_futures.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/functional/feature_futures.py b/test/functional/feature_futures.py index f695183814..ac9861c7b7 100755 --- a/test/functional/feature_futures.py +++ b/test/functional/feature_futures.py @@ -1153,11 +1153,22 @@ def dfi_to_dusd(self): self.nodes[0].futureswap(address, f'1@{self.symbolDFI}', f'{self.symbolDUSD}') self.nodes[0].generate(1) + # Check list pending swaps + result = self.nodes[0].listpendingdusdswaps() + assert_equal(len(result), 1) + assert_equal(result[0]['owner'], address) + assert_equal(result[0]['amount'], Decimal('1.00000000')) + + # Check get pending swaps + result = self.nodes[0].getpendingdusdswaps(address) + assert_equal(result['owner'], address) + assert_equal(result['amount'], Decimal('1.00000000')) + # Move to swap height next_futures_block = self.nodes[0].getblockcount() + (self.futures_interval_dusd - ((self.nodes[0].getblockcount() - self.start_block_dusd) % self.futures_interval_dusd)) self.nodes[0].generate(next_futures_block - self.nodes[0].getblockcount()) - # Check refund in history + # Check swap in history result = self.nodes[0].listaccounthistory('all', {"maxBlockHeight":self.nodes[0].getblockcount(), 'depth':1, 'txtype':'q'}) assert_equal(result[0]['owner'], address) assert_equal(result[0]['type'], 'FutureSwapExecution') @@ -1167,6 +1178,12 @@ def dfi_to_dusd(self): result = self.nodes[0].getaccount(address)[1] assert_equal(result, f'0.99000000@{self.symbolDUSD}') + # Check get/list calls now empty + list = self.nodes[0].listpendingdusdswaps() + get = self.nodes[0].getpendingdusdswaps(address) + assert_equal(list, []) + assert_equal(get, {}) + # Test swap when DFIP2203 disabled self.nodes[0].setgov({"ATTRIBUTES":{ 'v0/params/dfip2203/active': 'false',