mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
updated interest redirection tests
This commit is contained in:
parent
223690f5f1
commit
0f06c3b72e
|
@ -404,6 +404,7 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
|||
function _resetDataOnZeroBalance(address user) internal returns (bool) {
|
||||
//if the user has 0 principal balance, the interest stream redirection gets reset
|
||||
_interestRedirectionAddresses[user] = address(0);
|
||||
_interestRedirectionIndexes[user] = 0;
|
||||
|
||||
//emits a InterestStreamRedirected event to notify that the redirection has been reset
|
||||
emit InterestStreamRedirected(user, address(0), 0, 0);
|
||||
|
|
|
@ -49,14 +49,13 @@ const almostEqualOrEqual = function (
|
|||
key === 'marketStableRate' ||
|
||||
key === 'symbol' ||
|
||||
key === 'aTokenAddress' ||
|
||||
key === 'initialATokenExchangeRate' ||
|
||||
key === 'decimals'
|
||||
) {
|
||||
// skipping consistency check on accessory data
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.assert(actual[key] != undefined, `Property ${key} is undefined in the actual data`);
|
||||
expect(expected[key] != undefined, `Property ${key} is undefined in the expected data`);
|
||||
|
||||
|
@ -682,7 +681,7 @@ export const redirectInterestStream = async (
|
|||
const {userData: toDataAfter} = await getContractsData(reserve, to, testEnv);
|
||||
|
||||
const [expectedFromData, expectedToData] = calcExpectedUsersDataAfterRedirectInterest(
|
||||
reserveDataBefore,
|
||||
reserveDataBefore,
|
||||
fromDataBefore,
|
||||
toDataBefore,
|
||||
user.address,
|
||||
|
@ -692,7 +691,10 @@ export const redirectInterestStream = async (
|
|||
txTimestamp
|
||||
);
|
||||
|
||||
console.log("Checking from data");
|
||||
|
||||
expectEqual(fromDataAfter, expectedFromData);
|
||||
console.log("Checking to data");
|
||||
expectEqual(toDataAfter, expectedToData);
|
||||
|
||||
// truffleAssert.eventEmitted(txResult, 'InterestStreamRedirected', (ev: any) => {
|
||||
|
|
|
@ -82,7 +82,7 @@ export const getUserData = async (
|
|||
return {
|
||||
scaledATokenBalance: new BigNumber(scaledATokenBalance),
|
||||
interestRedirectionAddress,
|
||||
interestRedirectionIndex,
|
||||
interestRedirectionIndex: new BigNumber(interestRedirectionIndex),
|
||||
redirectionAddressRedirectedBalance: new BigNumber(redirectionAddressRedirectedBalance),
|
||||
redirectedBalance: new BigNumber(redirectedBalance),
|
||||
currentATokenBalance: new BigNumber(userData.currentATokenBalance.toString()),
|
||||
|
@ -136,6 +136,6 @@ const getATokenUserData = async (reserve: string, user: string, pool: LendingPoo
|
|||
scaledATokenBalance.toString(),
|
||||
redirectionAddressRedirectedBalance.toString(),
|
||||
interestRedirectionAddress,
|
||||
interestRedirectionIndex
|
||||
interestRedirectionIndex.toString()
|
||||
];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user