@rev-net/core-v6 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +14 -0
- package/RISKS.md +9 -1
- package/package.json +1 -1
- package/src/REVDeployer.sol +29 -10
- package/src/REVLoans.sol +18 -6
- package/src/REVOwner.sol +3 -1
- package/test/TestTerminalEncodingInHash.t.sol +326 -0
- package/test/audit/CodexREVOwnerRemoteSurplusCurrencyMismatch.t.sol +142 -0
- package/test/audit/SupportsInterfaceTest.t.sol +51 -0
- package/test/audit/TestFeeAllowanceLeak.t.sol +197 -0
- package/test/audit/TestLoansAndDeployerFixes.t.sol +576 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.28;
|
|
3
|
+
|
|
4
|
+
import "forge-std/Test.sol";
|
|
5
|
+
import "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
6
|
+
import {IJBBuybackHookRegistry} from "@bananapus/buyback-hook-v6/src/interfaces/IJBBuybackHookRegistry.sol";
|
|
7
|
+
import {IJBCashOutHook} from "@bananapus/core-v6/src/interfaces/IJBCashOutHook.sol";
|
|
8
|
+
import {IJBRulesetDataHook} from "@bananapus/core-v6/src/interfaces/IJBRulesetDataHook.sol";
|
|
9
|
+
import {JBBeforeCashOutRecordedContext} from "@bananapus/core-v6/src/structs/JBBeforeCashOutRecordedContext.sol";
|
|
10
|
+
import {JBBeforePayRecordedContext} from "@bananapus/core-v6/src/structs/JBBeforePayRecordedContext.sol";
|
|
11
|
+
import {JBCashOutHookSpecification} from "@bananapus/core-v6/src/structs/JBCashOutHookSpecification.sol";
|
|
12
|
+
import {JBPayHookSpecification} from "@bananapus/core-v6/src/structs/JBPayHookSpecification.sol";
|
|
13
|
+
import {JBTokenAmount} from "@bananapus/core-v6/src/structs/JBTokenAmount.sol";
|
|
14
|
+
import {JBRuleset} from "@bananapus/core-v6/src/structs/JBRuleset.sol";
|
|
15
|
+
import {IJBSuckerRegistry} from "@bananapus/suckers-v6/src/interfaces/IJBSuckerRegistry.sol";
|
|
16
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
17
|
+
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
|
|
18
|
+
|
|
19
|
+
import {REVOwner} from "../../src/REVOwner.sol";
|
|
20
|
+
|
|
21
|
+
contract CurrencyAwareSuckerRegistry {
|
|
22
|
+
uint256 public expectedCurrency;
|
|
23
|
+
uint256 public remoteSupply;
|
|
24
|
+
uint256 public remoteSurplus;
|
|
25
|
+
|
|
26
|
+
function setRemoteValues(uint256 currency, uint256 supply, uint256 surplus) external {
|
|
27
|
+
expectedCurrency = currency;
|
|
28
|
+
remoteSupply = supply;
|
|
29
|
+
remoteSurplus = surplus;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isSuckerOf(uint256, address) external pure returns (bool) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function remoteTotalSupplyOf(uint256) external view returns (uint256) {
|
|
37
|
+
return remoteSupply;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function remoteSurplusOf(uint256, uint256, uint256 currency) external view returns (uint256) {
|
|
41
|
+
return currency == expectedCurrency ? remoteSurplus : 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
contract EchoBuybackRegistry is IJBRulesetDataHook {
|
|
46
|
+
function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata context)
|
|
47
|
+
external
|
|
48
|
+
pure
|
|
49
|
+
returns (
|
|
50
|
+
uint256 cashOutTaxRate,
|
|
51
|
+
uint256 cashOutCount,
|
|
52
|
+
uint256 totalSupply,
|
|
53
|
+
uint256 effectiveSurplusValue,
|
|
54
|
+
JBCashOutHookSpecification[] memory hookSpecifications
|
|
55
|
+
)
|
|
56
|
+
{
|
|
57
|
+
cashOutTaxRate = context.cashOutTaxRate;
|
|
58
|
+
cashOutCount = context.cashOutCount;
|
|
59
|
+
totalSupply = context.totalSupply;
|
|
60
|
+
effectiveSurplusValue = context.surplus.value;
|
|
61
|
+
hookSpecifications = new JBCashOutHookSpecification[](0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
|
|
65
|
+
external
|
|
66
|
+
pure
|
|
67
|
+
returns (uint256 weight, JBPayHookSpecification[] memory hookSpecifications)
|
|
68
|
+
{
|
|
69
|
+
weight = context.weight;
|
|
70
|
+
hookSpecifications = new JBPayHookSpecification[](0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function hasMintPermissionFor(uint256, JBRuleset calldata, address) external pure returns (bool) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function setPoolFor(uint256, PoolKey calldata, uint256, address) external pure {}
|
|
78
|
+
function setPoolFor(uint256, uint24, int24, uint256, address) external pure {}
|
|
79
|
+
function initializePoolFor(uint256, uint24, int24, uint256, address, uint160) external pure {}
|
|
80
|
+
|
|
81
|
+
function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
|
|
82
|
+
return interfaceId == type(IJBRulesetDataHook).interfaceId || interfaceId == type(IERC165).interfaceId;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
contract CodexREVOwnerRemoteSurplusCurrencyMismatchTest is TestBaseWorkflow {
|
|
87
|
+
REVOwner internal ownerHook;
|
|
88
|
+
CurrencyAwareSuckerRegistry internal suckerRegistry;
|
|
89
|
+
EchoBuybackRegistry internal buybackRegistry;
|
|
90
|
+
|
|
91
|
+
uint32 internal constant ETH_CURRENCY = 1;
|
|
92
|
+
|
|
93
|
+
function setUp() public override {
|
|
94
|
+
super.setUp();
|
|
95
|
+
|
|
96
|
+
suckerRegistry = new CurrencyAwareSuckerRegistry();
|
|
97
|
+
buybackRegistry = new EchoBuybackRegistry();
|
|
98
|
+
|
|
99
|
+
ownerHook = new REVOwner(
|
|
100
|
+
IJBBuybackHookRegistry(address(buybackRegistry)),
|
|
101
|
+
jbDirectory(),
|
|
102
|
+
999_999,
|
|
103
|
+
IJBSuckerRegistry(address(suckerRegistry)),
|
|
104
|
+
address(0),
|
|
105
|
+
address(0)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function test_beforeCashOutRecordedWith_usesTokenAddressInsteadOfCurrencyForRemoteSurplus() public {
|
|
110
|
+
suckerRegistry.setRemoteValues(ETH_CURRENCY, 500 ether, 900 ether);
|
|
111
|
+
|
|
112
|
+
address usdToken = address(0xBEEF);
|
|
113
|
+
|
|
114
|
+
JBBeforeCashOutRecordedContext memory context = JBBeforeCashOutRecordedContext({
|
|
115
|
+
terminal: address(jbMultiTerminal()),
|
|
116
|
+
holder: address(0xCAFE),
|
|
117
|
+
projectId: 1,
|
|
118
|
+
rulesetId: 0,
|
|
119
|
+
cashOutCount: 100 ether,
|
|
120
|
+
totalSupply: 1000 ether,
|
|
121
|
+
surplus: JBTokenAmount({token: usdToken, value: 100 ether, decimals: 18, currency: ETH_CURRENCY}),
|
|
122
|
+
useTotalSurplus: true,
|
|
123
|
+
cashOutTaxRate: 0,
|
|
124
|
+
beneficiaryIsFeeless: false,
|
|
125
|
+
metadata: ""
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
(,, uint256 returnedSupply, uint256 returnedSurplus,) = ownerHook.beforeCashOutRecordedWith(context);
|
|
129
|
+
|
|
130
|
+
assertEq(returnedSupply, 1500 ether, "remote supply should still be included");
|
|
131
|
+
assertEq(
|
|
132
|
+
returnedSurplus,
|
|
133
|
+
100 ether,
|
|
134
|
+
"remote surplus is incorrectly dropped because REVOwner keys by token address instead of currency"
|
|
135
|
+
);
|
|
136
|
+
assertEq(
|
|
137
|
+
suckerRegistry.remoteSurplusOf(1, 18, ETH_CURRENCY),
|
|
138
|
+
900 ether,
|
|
139
|
+
"registry confirms surplus exists for the requested currency"
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.28;
|
|
3
|
+
|
|
4
|
+
import {Test} from "forge-std/Test.sol";
|
|
5
|
+
import {IJBBuybackHookRegistry} from "@bananapus/buyback-hook-v6/src/interfaces/IJBBuybackHookRegistry.sol";
|
|
6
|
+
import {IJBCashOutHook} from "@bananapus/core-v6/src/interfaces/IJBCashOutHook.sol";
|
|
7
|
+
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBRulesetDataHook} from "@bananapus/core-v6/src/interfaces/IJBRulesetDataHook.sol";
|
|
9
|
+
import {IJBSuckerRegistry} from "@bananapus/suckers-v6/src/interfaces/IJBSuckerRegistry.sol";
|
|
10
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
11
|
+
|
|
12
|
+
import {REVOwner} from "../../src/REVOwner.sol";
|
|
13
|
+
|
|
14
|
+
/// @notice Regression test for missing IERC165 support: REVOwner.supportsInterface omits IERC165.
|
|
15
|
+
contract AuditFixL17Test is Test {
|
|
16
|
+
REVOwner revOwner;
|
|
17
|
+
|
|
18
|
+
function setUp() public {
|
|
19
|
+
revOwner = new REVOwner(
|
|
20
|
+
IJBBuybackHookRegistry(makeAddr("buybackHook")),
|
|
21
|
+
IJBDirectory(makeAddr("directory")),
|
|
22
|
+
1, // feeRevnetId
|
|
23
|
+
IJBSuckerRegistry(makeAddr("suckerRegistry")),
|
|
24
|
+
makeAddr("loans"),
|
|
25
|
+
makeAddr("hiddenTokens")
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// @notice supportsInterface returns true for IERC165 (0x01ffc9a7).
|
|
30
|
+
function test_supportsInterface_IERC165() public view {
|
|
31
|
+
assertTrue(revOwner.supportsInterface(type(IERC165).interfaceId), "should support IERC165");
|
|
32
|
+
assertEq(type(IERC165).interfaceId, bytes4(0x01ffc9a7), "IERC165 interface ID should be 0x01ffc9a7");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// @notice supportsInterface returns true for IJBRulesetDataHook.
|
|
36
|
+
function test_supportsInterface_IJBRulesetDataHook() public view {
|
|
37
|
+
assertTrue(
|
|
38
|
+
revOwner.supportsInterface(type(IJBRulesetDataHook).interfaceId), "should support IJBRulesetDataHook"
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// @notice supportsInterface returns true for IJBCashOutHook.
|
|
43
|
+
function test_supportsInterface_IJBCashOutHook() public view {
|
|
44
|
+
assertTrue(revOwner.supportsInterface(type(IJBCashOutHook).interfaceId), "should support IJBCashOutHook");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// @notice supportsInterface returns false for an unsupported interface.
|
|
48
|
+
function test_supportsInterface_unsupported() public view {
|
|
49
|
+
assertFalse(revOwner.supportsInterface(bytes4(0xdeadbeef)), "should not support random interface");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.28;
|
|
3
|
+
|
|
4
|
+
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
5
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
|
+
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBTerminal} from "@bananapus/core-v6/src/interfaces/IJBTerminal.sol";
|
|
9
|
+
import {IJBPayoutTerminal} from "@bananapus/core-v6/src/interfaces/IJBPayoutTerminal.sol";
|
|
10
|
+
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
11
|
+
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
12
|
+
import {JBRuleset} from "@bananapus/core-v6/src/structs/JBRuleset.sol";
|
|
13
|
+
import {JBPayHookSpecification} from "@bananapus/core-v6/src/structs/JBPayHookSpecification.sol";
|
|
14
|
+
import {REVLoanSource} from "../../src/structs/REVLoanSource.sol";
|
|
15
|
+
import {REVLoansFeeRecovery} from "../REVLoansFeeRecovery.t.sol";
|
|
16
|
+
|
|
17
|
+
contract StickyAllowanceFeeTerminal is ERC165, IJBPayoutTerminal {
|
|
18
|
+
IERC20 public immutable token;
|
|
19
|
+
address public immutable loans;
|
|
20
|
+
address public thief;
|
|
21
|
+
uint256 public stealAmount;
|
|
22
|
+
|
|
23
|
+
constructor(IERC20 _token, address _loans) {
|
|
24
|
+
token = _token;
|
|
25
|
+
loans = _loans;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function configureSteal(address _thief, uint256 _stealAmount) external {
|
|
29
|
+
thief = _thief;
|
|
30
|
+
stealAmount = _stealAmount;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function pay(
|
|
34
|
+
uint256,
|
|
35
|
+
address,
|
|
36
|
+
uint256,
|
|
37
|
+
address,
|
|
38
|
+
uint256,
|
|
39
|
+
string calldata,
|
|
40
|
+
bytes calldata
|
|
41
|
+
)
|
|
42
|
+
external
|
|
43
|
+
payable
|
|
44
|
+
override
|
|
45
|
+
returns (uint256)
|
|
46
|
+
{
|
|
47
|
+
uint256 amount = stealAmount;
|
|
48
|
+
if (amount != 0) {
|
|
49
|
+
stealAmount = 0;
|
|
50
|
+
token.transferFrom(loans, thief, amount);
|
|
51
|
+
}
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function accountingContextForTokenOf(uint256, address) external view override returns (JBAccountingContext memory) {
|
|
56
|
+
return JBAccountingContext({token: address(token), decimals: 6, currency: uint32(uint160(address(token)))});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function accountingContextsOf(uint256) external pure override returns (JBAccountingContext[] memory) {
|
|
60
|
+
return new JBAccountingContext[](0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function addAccountingContextsFor(uint256, JBAccountingContext[] calldata) external override {}
|
|
64
|
+
|
|
65
|
+
function addToBalanceOf(
|
|
66
|
+
uint256,
|
|
67
|
+
address,
|
|
68
|
+
uint256,
|
|
69
|
+
bool,
|
|
70
|
+
string calldata,
|
|
71
|
+
bytes calldata
|
|
72
|
+
)
|
|
73
|
+
external
|
|
74
|
+
payable
|
|
75
|
+
override
|
|
76
|
+
{}
|
|
77
|
+
|
|
78
|
+
function currentSurplusOf(uint256, address[] calldata, uint256, uint256) external pure override returns (uint256) {
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function migrateBalanceOf(uint256, address, IJBTerminal) external pure override returns (uint256) {
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function sendPayoutsOf(uint256, address, uint256, uint256, uint256) external pure override returns (uint256) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function useAllowanceOf(
|
|
91
|
+
uint256,
|
|
92
|
+
address,
|
|
93
|
+
uint256,
|
|
94
|
+
uint256,
|
|
95
|
+
uint256,
|
|
96
|
+
address payable,
|
|
97
|
+
address payable,
|
|
98
|
+
string calldata
|
|
99
|
+
)
|
|
100
|
+
external
|
|
101
|
+
pure
|
|
102
|
+
override
|
|
103
|
+
returns (uint256)
|
|
104
|
+
{
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function previewPayFor(
|
|
109
|
+
uint256,
|
|
110
|
+
address,
|
|
111
|
+
uint256,
|
|
112
|
+
address,
|
|
113
|
+
bytes calldata
|
|
114
|
+
)
|
|
115
|
+
external
|
|
116
|
+
pure
|
|
117
|
+
override
|
|
118
|
+
returns (JBRuleset memory, uint256, uint256, JBPayHookSpecification[] memory)
|
|
119
|
+
{
|
|
120
|
+
JBRuleset memory ruleset;
|
|
121
|
+
return (ruleset, 0, 0, new JBPayHookSpecification[](0));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function supportsInterface(bytes4 interfaceId) public view override(ERC165, IERC165) returns (bool) {
|
|
125
|
+
return interfaceId == type(IJBTerminal).interfaceId || interfaceId == type(IJBPayoutTerminal).interfaceId
|
|
126
|
+
|| super.supportsInterface(interfaceId);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
contract TestFeeAllowanceLeak is REVLoansFeeRecovery {
|
|
131
|
+
StickyAllowanceFeeTerminal internal stickyFeeTerminal;
|
|
132
|
+
address internal attacker = makeAddr("attacker");
|
|
133
|
+
|
|
134
|
+
function _stickyFeeTerminal() internal returns (StickyAllowanceFeeTerminal) {
|
|
135
|
+
if (address(stickyFeeTerminal) == address(0)) {
|
|
136
|
+
stickyFeeTerminal = new StickyAllowanceFeeTerminal(TOKEN, address(LOANS_CONTRACT));
|
|
137
|
+
}
|
|
138
|
+
return stickyFeeTerminal;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// @notice Verifies that stale allowance is cleared — the original exploit no longer works.
|
|
142
|
+
/// @dev Previously, a sticky fee terminal could accumulate reusable allowance across borrows.
|
|
143
|
+
/// After the fix (_afterTransferTo clears allowance on success), the allowance is zero.
|
|
144
|
+
function test_feeTerminalCannotHarvestStaleAllowanceAfterFix() public {
|
|
145
|
+
StickyAllowanceFeeTerminal terminal = _stickyFeeTerminal();
|
|
146
|
+
|
|
147
|
+
vm.mockCall(
|
|
148
|
+
address(jbDirectory()),
|
|
149
|
+
abi.encodeWithSelector(IJBDirectory.primaryTerminalOf.selector, FEE_PROJECT_ID, address(TOKEN)),
|
|
150
|
+
abi.encode(address(terminal))
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
REVLoanSource memory source = REVLoanSource({token: address(TOKEN), terminal: jbMultiTerminal()});
|
|
154
|
+
uint256 payAmount = 1_000_000;
|
|
155
|
+
|
|
156
|
+
deal(address(TOKEN), USER, payAmount * 2);
|
|
157
|
+
|
|
158
|
+
vm.startPrank(USER);
|
|
159
|
+
TOKEN.approve(address(jbMultiTerminal()), payAmount * 2);
|
|
160
|
+
uint256 firstTokenCount = jbMultiTerminal().pay(REVNET_ID, address(TOKEN), payAmount, USER, 0, "", "");
|
|
161
|
+
vm.stopPrank();
|
|
162
|
+
|
|
163
|
+
_mockLoanPermission(USER);
|
|
164
|
+
vm.prank(USER);
|
|
165
|
+
LOANS_CONTRACT.borrowFrom(REVNET_ID, source, 0, firstTokenCount, payable(USER), 25, USER);
|
|
166
|
+
|
|
167
|
+
// Allowance is now cleared after successful fee payment.
|
|
168
|
+
uint256 allowanceAfterBorrow = TOKEN.allowance(address(LOANS_CONTRACT), address(stickyFeeTerminal));
|
|
169
|
+
assertEq(allowanceAfterBorrow, 0, "no stale allowance after successful borrow");
|
|
170
|
+
|
|
171
|
+
// The uncollected fee is still parked in REVLoans (terminal didn't pull it),
|
|
172
|
+
// but there's no allowance for the terminal to steal it later.
|
|
173
|
+
uint256 loansBalance = TOKEN.balanceOf(address(LOANS_CONTRACT));
|
|
174
|
+
assertGt(loansBalance, 0, "uncollected fee is parked in REVLoans");
|
|
175
|
+
|
|
176
|
+
// Second borrow — terminal tries to steal but can't because allowance is 0.
|
|
177
|
+
vm.prank(USER);
|
|
178
|
+
uint256 secondTokenCount = jbMultiTerminal().pay(REVNET_ID, address(TOKEN), payAmount, USER, 0, "", "");
|
|
179
|
+
|
|
180
|
+
terminal.configureSteal(attacker, loansBalance);
|
|
181
|
+
|
|
182
|
+
_mockLoanPermission(USER);
|
|
183
|
+
vm.prank(USER);
|
|
184
|
+
LOANS_CONTRACT.borrowFrom(REVNET_ID, source, 0, secondTokenCount, payable(USER), 25, USER);
|
|
185
|
+
|
|
186
|
+
// The attacker gets nothing — the steal attempt fails silently (transferFrom reverts,
|
|
187
|
+
// caught by _tryPayFee's try-catch).
|
|
188
|
+
assertEq(TOKEN.balanceOf(attacker), 0, "attacker cannot drain stale allowance");
|
|
189
|
+
|
|
190
|
+
// And the current borrow also leaves zero allowance.
|
|
191
|
+
assertEq(
|
|
192
|
+
TOKEN.allowance(address(LOANS_CONTRACT), address(terminal)),
|
|
193
|
+
0,
|
|
194
|
+
"no fresh stale allowance after second borrow"
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|