forked from transmissions11/libcompound
-
Notifications
You must be signed in to change notification settings - Fork 1
/
LibCompound.t.sol
46 lines (33 loc) · 1.56 KB
/
LibCompound.t.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
40
41
42
43
44
45
46
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {CERC20} from "../interfaces/CERC20.sol";
import {LibCompound} from "../LibCompound.sol";
contract LibCompoundTest is DSTestPlus {
CERC20 cDAI = CERC20(address(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643));
address cDAIHolder = 0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56;
/*///////////////////////////////////////////////////////////////
CORRECTNESS TESTS
//////////////////////////////////////////////////////////////*/
function testCompoundExchangeRateCorrectness() public {
assertEq(LibCompound.viewExchangeRate(cDAI), cDAI.exchangeRateCurrent());
}
function testCompoundBalanceOfUnderlyingCorrectness() public {
assertEq(LibCompound.viewUnderlyingBalanceOf(cDAI, cDAIHolder), cDAI.balanceOfUnderlying(cDAIHolder));
}
/*///////////////////////////////////////////////////////////////
GAS SNAPSHOT TESTS
//////////////////////////////////////////////////////////////*/
function testCompoundBalanceOfUnderlyingViewGas() public view {
LibCompound.viewUnderlyingBalanceOf(cDAI, cDAIHolder);
}
function testCompoundBalanceOfUnderlyingMutatingGas() public {
cDAI.balanceOfUnderlying(cDAIHolder);
}
function testCompoundExchangeRateViewGas() public view {
LibCompound.viewExchangeRate(cDAI);
}
function testCompoundExchangeRateMutatingGas() public {
cDAI.exchangeRateCurrent();
}
}