DeFiCh / ain

DeFi Blockchain - enabling decentralized finance on Bitcoin
https://defichain.com
MIT License
401 stars 119 forks source link

50% DFI check in TakeLoan only correct for taking new DUSD loans #1480

Closed kuegi closed 2 years ago

kuegi commented 2 years ago

From what I understood, the logic should be: "if there are DUSD loans in the vault, you need 50% of the required collateral in DFI" but in https://github.com/DeFiCh/ain/blob/b5d203db396e0a71cd0038668cdbc00c44446392/src/masternodes/mn_checks.cpp#L3238-L3240 the "hasDUSDLoans" doesn't check for existing loans in the vault, but only for the new loans to be taken. This means its possible to take dToken loans when there are already DUSD loans existing, but not 50% DFI collateral.

Is this intented or a bug?

defichain-bot commented 2 years ago

@kuegi: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/ain/blob/master/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.
kuegi commented 2 years ago

Seems like a misunderstanding on my side. works like intented. -> closing the issue.