Vault creation fee uses current creation fee for refund instead of creation fee paid
- Dominant language
- C++
- Stars
- 397
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
When a user closes their vault, it should refund 50% of the creation fee. At the moment, the 50% of the current creation fee is refunded.
https://github.com/DeFiCh/ain/blob/0989ff6fde4530a83fa2c3649c2642615e36714d/src/masternodes/mn_checks.cpp#L2858
This means that if the creation fee is changed, then users may be refunded more/less than 50% of the creation fee that they paid.
**Scenario 1**
- User A creates vault with 2 DFI
- Creation fee is increased to 4 DFI
- User A closes vault, receives $\frac{4}{2}$ = 2 DFI as refund, but should have received 1 DFI
**Scenario 2**
- User A creates vault with 2 DFI
- Creation fee is decreased to 0 DFI
- User A closes vault, receives $\frac{0}{2}$ = 0 DFI as refund, but should have received 1 DFI
The node should keep track of the creation fee paid for the vault, and return 50% of the fee paid instead.
Contributor guide
Assessment
This issue has not been assessed yet.