Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add liquidation of DUSD in basic test #908

Merged
merged 2 commits into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion test/functional/feature_loan_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) DeFi Blockchain Developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""Test Loan - setcollateraltoken."""
"""Test Loan - loan basics."""

from test_framework.test_framework import DefiTestFramework

Expand Down Expand Up @@ -442,5 +442,21 @@ def run_test(self):
assert_equal(vaultInfo['collateralValue'], Decimal('4000.00000000'))
assert_equal(vaultInfo['loanValue'], Decimal('1500.0610730'))

# feed oracle
oracle1_prices = [{"currency": "USD", "tokenAmount": "10@TSLA"},
{"currency": "USD", "tokenAmount": "10@GOOGL"},
{"currency": "USD", "tokenAmount": "5@DFI"},
{"currency": "USD", "tokenAmount": "10@BTC"}]
timestamp = calendar.timegm(time.gmtime())
self.nodes[0].setoracledata(oracle_id1, timestamp, oracle1_prices)

self.nodes[0].generate(12)
self.sync_blocks()

vaultInfo = self.nodes[0].getvault(vaultId1)
assert_equal(vaultInfo['state'], 'inLiquidation')
assert_equal(len(vaultInfo['batches']), 1)
assert_equal(vaultInfo['batches'][0]['collaterals'], ['400.00000000@DFI'])

if __name__ == '__main__':
LoanTakeLoanTest().main()