hifi-finance / hifi

Monorepo implementing the Hifi fixed-rate, fixed-term lending protocol
https://app.hifi.finance
Other
105 stars 15 forks source link

[protocol] Issue concerning wrong param ordering in emitted `RepayBorrow` event #76

Closed scorpion9979 closed 2 years ago

scorpion9979 commented 2 years ago

From IBalanceSheetV1.sol#L51, we notice that RepayBorrow is defined to have payer is the first param of the event and borrower as the second. But if we go to BalanceSheetV1.sol#L628, we see that the emitted event has the params in the opposite order. I discovered this while investigating a bug in the subgraph that was causing the event-based debt amount calculation to return negative values.

PaulRBerg commented 2 years ago

Thanks for opening this issue, @scorpion9979. Looks like the links are stale now - that's because you shared the normal links that contain the main branch in the URL. To prevent this in the future, you could instead click CMD+Y (or "CTRL+Y" on Linux/ Windows) to obtain a permanent URL to the source code.

scorpion9979 commented 2 years ago

@paulrberg The links are now fixed.

PaulRBerg commented 2 years ago

Fixed in https://github.com/hifi-finance/hifi/commit/aef49d06dbb7d091e9e8008d58c3e6f19f53a903.

PaulRBerg commented 2 years ago

I was wondering why this hasn't been caught by our tests .. and I found that it was because the repayBorrowBehalf tests didn't check the RepayBorrow event.

Just added a passing test in https://github.com/hifi-finance/hifi/commit/f3cb5431edd53945d15557d26d3349858515156e.