Conversation
contracts/v3/alchemix/Alchemist.sol
Outdated
| if (_totalCredit < _amount) { | ||
| uint256 _remainingAmount = _amount.sub(_totalCredit); | ||
| _cdp.totalDebt = _cdp.totalDebt.add(_remainingAmount).add( | ||
| _remainingAmount.mul(borrowFee).div(PERCENT_RESOLUTION) |
There was a problem hiding this comment.
The Debt is increased with _remainingAmount.mul(borrowFee).div(PERCENT_RESOLUTION)
However nothing else is done with this amount.
For comparison function harvest() has this call to do something with the fees:
if (_feeAmount > 0) {
token.safeTransfer(rewards, _feeAmount);
}There was a problem hiding this comment.
@gpersoon I have updated the code. The fee will be sent to reward address now
There was a problem hiding this comment.
I think the number of xtoken send should also be subtracted with the _borrowFeeAmount
something like:
_amount = _amount.sub(__borrowFeeAmount);
Otherwise, who is paying for the fees?
(please doublecheck if my hunch is correct)
There was a problem hiding this comment.
_amount should be the same.
Otherwise, who is paying for the fees?
The fee is paid by the user. The user needs to clear debt to get its collateral back
| }); | ||
|
|
||
| // describe('mint', () => { | ||
| // let depositAmt = parseEther('5000'); |
There was a problem hiding this comment.
The test for mint() is commented out.
While it is extra important because it includes the borrowFee now, so some additional test will be necessary.
There was a problem hiding this comment.
There is issue for setting whitelist in Transmuter. I cannot figure out why it is failing in the test
There was a problem hiding this comment.
I do see you have an additional setWhitelist that isn't in the original.
metavault/test/v3/Alchemist.test.js
Lines 798 to 800 in 2ae878e
There was a problem hiding this comment.
yes. I added it for debugging because setWhitelist is not working at line 811
metavault/test/v3/Alchemist.test.js
Line 811 in 2ae878e
No description provided.