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

Collateral increases in value and should be able to be withdrawn #988

Merged
merged 24 commits into from
Jan 21, 2022
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d558f46
Scenario where BTC increase and price and should be able to be withdrawn
Jouzo Dec 14, 2021
866b94e
Check that 50% of the collateralization comes from DFI only when DFI …
Jouzo Dec 14, 2021
dd3cc25
Remove unused var
Jouzo Dec 14, 2021
8ce3833
Merge branch 'master' into fix/withdraw_collateral
Jouzo Dec 20, 2021
a513f26
Adds guard against fortcanninghill height
Jouzo Dec 22, 2021
9864ee1
Merge branch 'master' into fix/withdraw_collateral
Jouzo Dec 22, 2021
cbc911d
Add other test scenario
Jouzo Dec 22, 2021
24dc3a8
Check that DFI is 50% of collateralized value of loans in withdrawfro…
Jouzo Dec 23, 2021
819c831
Add test for takeloan
Jouzo Dec 23, 2021
151130d
Use MultiplyAmounts to guard against overflow
Jouzo Dec 23, 2021
0e3d6b6
Fix MultiplyAmounts call
Jouzo Dec 23, 2021
41c6cc6
Withdraw more DFI in test
Jouzo Dec 23, 2021
75f6d21
Merge branch 'master' into fix/withdraw_collateral
Jouzo Dec 23, 2021
301a8ca
Merge branch 'master' into fix/withdraw_collateral
Jouzo Dec 24, 2021
6f388d6
Merge branch 'master' into fix/withdraw_collateral
Jouzo Dec 28, 2021
2bed180
Merge branch 'master' into fix/withdraw_collateral
Jouzo Jan 6, 2022
c565aaa
Add collateral value overflow test
Jouzo Jan 12, 2022
5ae120f
Merge branch 'master' into fix/withdraw_collateral
Jouzo Jan 12, 2022
fb43b3a
Merge branch 'master' into fix/withdraw_collateral
prasannavl Jan 17, 2022
addd633
Merge branch 'master' into fix/withdraw_collateral
Jouzo Jan 18, 2022
a9ad091
Update error message
Jouzo Jan 18, 2022
97c819b
Merge branch 'master' of https://github.com/DeFiCh/ain into fix/withd…
Jouzo Jan 19, 2022
621b8f8
Use arith_uint256 instead of MultiplyAmounts
Jouzo Jan 19, 2022
6f467ec
Merge branch 'master' into fix/withdraw_collateral
prasannavl Jan 20, 2022
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
2 changes: 1 addition & 1 deletion src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ class CCustomTxApplyVisitor : public CCustomTxVisitor
if (col.nTokenId == DCT_ID{0})
totalDFI += col.nValue;

if (totalDFI < collateralsLoans.val->totalCollaterals / 2)
if (totalDFI < collateralsLoans.val->totalCollaterals / 2 && obj.amount.nTokenId == DCT_ID{0})
Jouzo marked this conversation as resolved.
Show resolved Hide resolved
return Res::Err("At least 50%% of the vault must be in DFI");

if (collateralsLoans.val->ratio() < scheme->ratio)
Expand Down