forked from aave-dao/aave-v3-origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMockScaledToken.sol
39 lines (33 loc) · 1.09 KB
/
MockScaledToken.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '../../protocol/tokenization/base/ScaledBalanceTokenBase.sol';
import '../../protocol/libraries/math/WadRayMath.sol';
contract MockScaledToken is ScaledBalanceTokenBase {
using WadRayMath for uint256;
constructor(IPool pool) ScaledBalanceTokenBase(pool, 'A', 'A', 6) {
// Intentionally left blank
}
function setStorage(
address alice,
address bob,
uint256 previousIndex,
uint256 aliceScaledBalance,
uint256 bobScaledBalance
) public {
_userState[alice].additionalData = uint128(previousIndex);
_userState[bob].additionalData = uint128(previousIndex);
_userState[alice].balance = uint128(aliceScaledBalance);
_userState[bob].balance = uint128(bobScaledBalance);
}
function transferWithIndex(
address sender,
address recipient,
uint256 amount,
uint256 newIndex
) public {
_transfer(sender, recipient, amount, newIndex);
}
function getBalanceOf(uint256 scaledBalance, uint256 newIndex) internal pure returns (uint256) {
return scaledBalance.rayMul(newIndex);
}
}