* add additional tests that attempt to borrow funds from the insolvent market(should fail), and attempt to borrow funds from the not insolvent market (it will fail, but shouldn't). The not insolvent market should continue to processs borrows
* remove unused code
* make tests less specific for string contains
* add new get total reserves for denoms functionality
* start utilizing GetTotalReservesForDenoms in ValidateBorrow
* update tests for Borrow to not fail when borrowing from an insolvent market
* use get total reseves in GetTotalReservesForDenoms for reusability
* refactor GetTotalReservesForDenoms to GetTotalReservesByCoinDenoms for more clarity
* change the structure for new and old tests and add more verbosity for other tests
* remove print
* remove unneeded code
* add paren
* adjust structure again after initial PR
* remove duplicate test case with invalid test name, and update to use error contains in places where it was validating if true for strings contains
* no need for keeper method
* add additional tests that attempt to borrow funds from the insolvent market(should fail), and attempt to borrow funds from the not insolvent market (it will fail, but shouldn't). The not insolvent market should continue to processs borrows
* remove unused code
* make tests less specific for string contains
* change the structure for new and old tests and add more verbosity for other tests
* remove print
* remove unneeded code
* add paren
* remove duplicate test case with invalid test name, and update to use error contains in places where it was validating if true for strings contains
---------
Co-authored-by: Sam Sheffield <sam.sheffield@kavalabs.io>
Module reserve represents fractional balances, so it should be hidden to consumers to not have a misleading total balance that doubles the fractional balances. This modifies GetBalance() and SpendableCoin() to always return zero coins when fetching the reserve address balance for fractional amounts.
Change GetBalance() to return full balances instead of spendable to align behavior with x/bank. Add SpendableCoin() method with support of akava for use in x/evm.
Emits the **total** akava amount for both ukava and akava send/mint/burns. If both akava,ukava are sent (not possible via x/evm nor cosmos messages but still an edge case), then the sum is emitted. No other denoms are emitted by x/precisebank as they will be emitted by the underlying x/bank
Fix reserve minting an extra coin when the recipient module both carries fractional over to integer balance AND remainder is insufficient. Adjusts fractional carry to simply send from reserve, instead of doing an additional mint. Add invariant to ensure reserve matches exactly with fractional balances + remainder, failing on both insufficient and excess funds.
Implement GetBalance for extended balances which passes through to `x/bank` for non-extended denoms. This diverges from `x/evmutil` behavior which will panic on non-"akava" calls.
Add bank / account keeper mocks for testing, with mockery config for [mockery package setup](https://vektra.github.io/mockery/latest/migrating_to_packages/)
- Validate total fractional amounts in genesis type
- Validate against fractional balances such that `(sum(balances) + remainder) % conversionFactor == 0`
- Add new utility type `SplitBalance` for splitting up full balances into each
* optimize cdp begin blocker by removing unnecessary checks, reusing data
and prefix stores in loops, and reducing number of repeated calculations
* fix panic for new cdp types if both previous accural time and global
interest factor are not set
* do not touch global interest factor if no CDP's exist; revert to panic
if global interest factor is not found since this is an unreachable
state by normal keeper operation -- it can only be reached if store
is modified outside of public interface and normal operation
* optimize pricefeed endblocker to iterate all markets only once to remove
overhead of opening and closing iterator for each market individually.
In addition, extend tests to cover 100% of abci and price updating
behavior.
* use test cases that can't be confused with mean to ensure median is
always used