diff --git a/test/functional/feature_higher_collateral_factor.py b/test/functional/feature_higher_collateral_factor.py index f921a5bcb9..61e5c1071e 100644 --- a/test/functional/feature_higher_collateral_factor.py +++ b/test/functional/feature_higher_collateral_factor.py @@ -142,21 +142,21 @@ def take_dusd_loan(self): self.nodes[0].generate(1) # Deposit DUSD and DFI to vault - self.nodes[0].deposittovault(vault_id, self.address, f"1.5@{self.symbolDFI}") + self.nodes[0].deposittovault(vault_id, self.address, f"2.235@{self.symbolDFI}") self.nodes[0].generate(1) self.nodes[0].deposittovault(vault_id, self.address, f"1.5@{self.symbolDUSD}") self.nodes[0].generate(1) # Take DUSD loan greater than collateral amount - self.nodes[0].takeloan({ "vaultId": vault_id, "amounts": f"2.49@{self.symbolDUSD}"}) + self.nodes[0].takeloan({ "vaultId": vault_id, "amounts": f"2.98@{self.symbolDUSD}"}) self.nodes[0].generate(1) # Check that we are on 150% collateral ratio vault = self.nodes[0].getvault(vault_id) assert_equal(vault['collateralRatio'], 150) assert_equal(vault['informativeRatio'], Decimal('150.00000000')) - assert_equal(vault['collateralValue'], Decimal('3.73500000')) - assert_equal(vault['loanValue'], Decimal('2.49000000')) + assert_equal(vault['collateralValue'], Decimal('4.47000000')) + assert_equal(vault['loanValue'], Decimal('2.98000000')) def take_multiple_loans(self): diff --git a/test/functional/feature_loan_priceupdate.py b/test/functional/feature_loan_priceupdate.py index e08f5cd7e4..1d2b3ed2b3 100755 --- a/test/functional/feature_loan_priceupdate.py +++ b/test/functional/feature_loan_priceupdate.py @@ -9,7 +9,7 @@ from test_framework.test_framework import DefiTestFramework from decimal import Decimal, ROUND_DOWN -from test_framework.util import assert_equal +from test_framework.util import assert_equal, assert_raises_rpc_error import calendar import time @@ -254,11 +254,7 @@ def run_test(self): self.nodes[0].generate(1) takenLoanAmount += loanAmount - try: - self.nodes[0].withdrawfromvault(vaultId1, account, "900@DFI") - except JSONRPCException as e: - errorString = e.error['message'] - assert("At least 50% of the collateral must be in DFI" in errorString) + assert_raises_rpc_error(-32600, "At least 50% of the minimum required collateral must be in DFI", self.nodes[0].withdrawfromvault, vaultId1, account, "900@DFI") vault = self.nodes[0].getvault(vaultId1) self.nodes[0].withdrawfromvault(vaultId1, account, "100@BTC") diff --git a/test/functional/feature_negative_interest.py b/test/functional/feature_negative_interest.py index bbe6014649..4da02842df 100755 --- a/test/functional/feature_negative_interest.py +++ b/test/functional/feature_negative_interest.py @@ -44,6 +44,10 @@ def createTokens(self): self.idDFI = list(self.nodes[0].gettoken(self.symbolDFI).keys())[0] + # Create loan scheme + self.nodes[0].createloanscheme(150, 1, 'LOAN1') + self.nodes[0].generate(1) + self.nodes[0].setcollateraltoken({ 'token': self.idDFI, 'factor': 1, @@ -172,9 +176,6 @@ def setup(self): # Loan scheme interest->1% and loantoken interest-> -1% # Resulting interest must be 0. def vault_interest_zero(self): - # Create loan scheme - self.nodes[0].createloanscheme(150, 1, 'LOAN1') - self.nodes[0].generate(1) # Init vault (create, deposit takeloan) self.nodes[0].utxostoaccount({self.account0: "4000@DFI"})