-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBathToken.sol
760 lines (658 loc) · 25 KB
/
BathToken.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
// SPDX-License-Identifier: BUSL-1.1
/// @author Rubicon DeFi Inc. - bghughes.eth
/// @notice This contract represents a single-asset liquidity pool for Rubicon Pools
/// @notice Any user can deposit assets into this pool and earn yield from successful strategist market making with their liquidity
/// @notice This contract looks to both BathPairs and the BathHouse as its admin
pragma solidity =0.7.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/IBathHouse.sol";
import "../interfaces/IRubiconMarket.sol";
import "../interfaces/IBathBuddy.sol";
contract BathToken {
using SafeMath for uint256;
/// *** Storage Variables ***
/// @notice The initialization status of the Bath Token
bool public initialized;
/// @notice ** ERC-20 **
string public symbol;
string public name;
uint8 public decimals;
/// @notice The RubiconMarket.sol instance that all pool liquidity is intially directed to as market-making offers
address public RubiconMarketAddress;
/// @notice The Bath House admin of the Bath Token
address public bathHouse;
/// @notice The withdrawal fee recipient, typically the Bath Token itself
address public feeTo;
/// @notice The underlying ERC-20 token which is the core asset of the Bath Token vault
IERC20 public underlyingToken;
/// @notice The basis point fee rate that is paid on withdrawing the underlyingToken and bonusTokens
uint256 public feeBPS;
/// @notice ** ERC-20 **
uint256 public totalSupply;
/// @notice The amount of underlying deposits that are outstanding attempting market-making on the order book for yield
/// @dev quantity of underlyingToken that is in the orderbook that the pool still has a claim on
/// @dev The underlyingToken is effectively mark-to-marketed when it enters the book and it could be returned at a loss due to poor strategist performance
/// @dev outstandingAmount is NOT inclusive of any non-underlyingToken assets sitting on the Bath Tokens that have filled to here and are awaiting rebalancing to the underlyingToken by strategists
uint256 public outstandingAmount;
/// @dev Intentionally unused DEPRECATED STORAGE VARIABLE to maintain contiguous state on proxy-wrapped contracts. Consider it a beautiful scar of incremental progress 📈
/// @dev Keeping deprecated variables maintains consistent network-agnostic contract abis when moving to new chains and versions
uint256[] deprecatedStorageArray; // Kept in to avoid storage collision bathTokens that are proxy upgraded
/// @dev Intentionally unused DEPRECATED STORAGE VARIABLE to maintain contiguous state on proxy-wrapped contracts. Consider it a beautiful scar of incremental progress 📈
mapping(uint256 => uint256) deprecatedMapping; // Kept in to avoid storage collision on bathTokens that are upgraded
// *******************************************
/// @notice ** ERC-20 **
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/// @notice EIP-2612
bytes32 public DOMAIN_SEPARATOR;
/// @notice EIP-2612
/// @dev keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH =
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
/// @notice EIP-2612
mapping(address => uint256) public nonces;
/// @notice Array of Bonus ERC-20 tokens that are given as liquidity incentives to pool withdrawers
address[] public bonusTokens;
/// @notice Address of the OZ Vesting Wallet which acts as means to vest bonusToken incentives to pool HODLers
IBathBuddy public rewardsVestingWallet;
/// *** Events ***
/// @notice ** ERC-20 **
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/// @notice ** ERC-20 **
event Transfer(address indexed from, address indexed to, uint256 value);
/// @notice Time of Bath Token instantiation
event LogInit(uint256 timeOfInit);
/// @notice Log details about a pool deposit
event LogDeposit(
uint256 depositedAmt,
IERC20 asset,
uint256 sharesReceived,
address depositor,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice Log details about a pool withdraw
event LogWithdraw(
uint256 amountWithdrawn,
IERC20 asset,
uint256 sharesWithdrawn,
address withdrawer,
uint256 fee,
address feeTo,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice Log details about a pool rebalance
event LogRebalance(
IERC20 pool_asset,
address destination,
IERC20 transferAsset,
uint256 rebalAmt,
uint256 stratReward,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice Log details about a pool order canceled in the Rubicon Market book
event LogPoolCancel(
uint256 orderId,
IERC20 pool_asset,
uint256 outstandingAmountToCancel,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice Log details about a pool order placed in the Rubicon Market book
event LogPoolOffer(
uint256 id,
IERC20 pool_asset,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice Log the credit to outstanding amount for funds that have been filled market-making
event LogRemoveFilledTradeAmount(
IERC20 pool_asset,
uint256 fillAmount,
uint256 underlyingBalance,
uint256 outstandingAmount,
uint256 totalSupply
);
/// @notice * EIP 4626 *
event Deposit(
address indexed caller,
address indexed owner,
uint256 assets,
uint256 shares
);
/// @notice * EIP 4626 *
event Withdraw(
address indexed caller,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/// *** Constructor ***
/// @notice Proxy-safe initialization of storage; the constructor
function initialize(
ERC20 token,
address market,
address _feeTo
) external {
require(!initialized);
string memory _symbol = string(
abi.encodePacked(("bath"), token.symbol())
);
symbol = _symbol;
underlyingToken = token;
RubiconMarketAddress = market;
bathHouse = msg.sender; //NOTE: assumed admin is creator on BathHouse
uint256 chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)
)
);
name = string(abi.encodePacked(_symbol, (" v1")));
decimals = token.decimals(); // v1 Change - 4626 Adherence
// Add infinite approval of Rubicon Market for this asset
IERC20(address(token)).approve(RubiconMarketAddress, 2**256 - 1);
emit LogInit(block.timestamp);
feeTo = address(this); //This contract is the fee recipient, rewarding HODLers
feeBPS = 3; //Fee set to 3 BPS initially
// Complete constract instantiation
initialized = true;
}
/// *** Modifiers ***
modifier onlyPair() {
require(
IBathHouse(bathHouse).isApprovedPair(msg.sender) == true,
"not an approved pair - bathToken"
);
_;
}
modifier onlyBathHouse() {
require(
msg.sender == bathHouse,
"caller is not bathHouse - BathToken.sol"
);
_;
}
/// *** External Functions - Only Bath House / Admin ***
/// @notice Admin-only function to set a Bath Token's market address
function setMarket(address newRubiconMarket) external onlyBathHouse {
RubiconMarketAddress = newRubiconMarket;
}
/// @notice Admin-only function to set a Bath Token's Bath House admin
function setBathHouse(address newBathHouse) external onlyBathHouse {
bathHouse = newBathHouse;
}
/// @notice Admin-only function to approve Bath Token's RubiconMarketAddress with the maximum integer value (infinite approval)
function approveMarket() external onlyBathHouse {
underlyingToken.approve(RubiconMarketAddress, 2**256 - 1);
}
/// @notice Admin-only function to set a Bath Token's feeBPS
function setFeeBPS(uint256 _feeBPS) external onlyBathHouse {
feeBPS = _feeBPS;
}
/// @notice Admin-only function to set a Bath Token's fee recipient, typically the pool itself
function setFeeTo(address _feeTo) external onlyBathHouse {
feeTo = _feeTo;
}
/// @notice Admin-only function to add a bonus token to bonusTokens for pool incentives
function setBonusToken(address newBonusERC20) external onlyBathHouse {
bonusTokens.push(newBonusERC20);
}
/// *** External Functions - Only Approved Bath Pair / Strategist Contract ***
/// ** Rubicon Market Functions **
/// @notice The function for a strategist to cancel an outstanding Market Offer
function cancel(uint256 id, uint256 amt) external onlyPair {
outstandingAmount = outstandingAmount.sub(amt);
IRubiconMarket(RubiconMarketAddress).cancel(id);
emit LogPoolCancel(
id,
IERC20(underlyingToken),
amt,
underlyingBalance(),
outstandingAmount,
totalSupply
);
}
/// @notice A function called by BathPair to maintain proper accounting of outstandingAmount
function removeFilledTradeAmount(uint256 amt) external onlyPair {
outstandingAmount = outstandingAmount.sub(amt);
emit LogRemoveFilledTradeAmount(
IERC20(underlyingToken),
amt,
underlyingBalance(),
outstandingAmount,
totalSupply
);
}
/// @notice The function that places a bid and/or ask in the orderbook for a given pair from this pool
function placeOffer(
uint256 pay_amt,
ERC20 pay_gem,
uint256 buy_amt,
ERC20 buy_gem
) external onlyPair returns (uint256) {
// Place an offer in RubiconMarket
// If incomplete offer return 0
if (
pay_amt == 0 ||
pay_gem == ERC20(0) ||
buy_amt == 0 ||
buy_gem == ERC20(0)
) {
return 0;
}
uint256 id = IRubiconMarket(RubiconMarketAddress).offer(
pay_amt,
pay_gem,
buy_amt,
buy_gem,
0,
false
);
outstandingAmount = outstandingAmount.add(pay_amt);
emit LogPoolOffer(
id,
IERC20(underlyingToken),
underlyingBalance(),
outstandingAmount,
totalSupply
);
return (id);
}
/// @notice This function returns filled orders to the correct liquidity pool and sends strategist rewards to the Bath Pair
/// @dev Sends non-underlyingToken fill elsewhere in the Pools system, typically it's sister asset within a trading pair (e.g. ETH-USDC)
/// @dev Strategists presently accrue rewards in the filled asset not underlyingToken
function rebalance(
address destination,
address filledAssetToRebalance, /* sister or fill asset */
uint256 stratProportion,
uint256 rebalAmt
) external onlyPair {
uint256 stratReward = (stratProportion.mul(rebalAmt)).div(10000);
IERC20(filledAssetToRebalance).transfer(
destination,
rebalAmt.sub(stratReward)
);
IERC20(filledAssetToRebalance).transfer(msg.sender, stratReward);
emit LogRebalance(
IERC20(underlyingToken),
destination,
IERC20(filledAssetToRebalance),
rebalAmt,
stratReward,
underlyingBalance(),
outstandingAmount,
totalSupply
);
}
/// *** EIP 4626 Implementation ***
// https://eips.ethereum.org/EIPS/eip-4626#specification
/// @notice Withdraw your bathTokens for the underlyingToken
function withdraw(uint256 _shares)
external
returns (uint256 amountWithdrawn)
{
return _withdraw(_shares, msg.sender);
}
/// @notice * EIP 4626 *
function asset() public view returns (address assetTokenAddress) {
assetTokenAddress = address(underlyingToken);
}
/// @notice * EIP 4626 *
function totalAssets() public view returns (uint256 totalManagedAssets) {
return underlyingBalance();
}
/// @notice * EIP 4626 *
function convertToShares(uint256 assets)
public
view
returns (uint256 shares)
{
// Note: Inflationary tokens may affect this logic
(totalSupply == 0) ? shares = assets : shares = (
assets.mul(totalSupply)
).div(totalAssets());
}
// Note: MUST NOT be inclusive of any fees that are charged against assets in the Vault.
/// @notice * EIP 4626 *
function convertToAssets(uint256 shares)
public
view
returns (uint256 assets)
{
assets = (totalAssets().mul(shares)).div(totalSupply);
}
// Note: Unused function param to adhere to standard
/// @notice * EIP 4626 *
function maxDeposit(address receiver)
public
pure
returns (uint256 maxAssets)
{
maxAssets = 2**256 - 1; // No limit on deposits in current implementation = Max UINT
}
/// @notice * EIP 4626 *
function previewDeposit(uint256 assets)
public
view
returns (uint256 shares)
{
// The exact same logic is used, no deposit fee - only difference is deflationary token check (rare condition and probably redundant)
shares = convertToShares(assets);
}
// Single asset override to reflect old functionality
function deposit(uint256 assets) public returns (uint256 shares) {
// Note: msg.sender is the same throughout the same contract context
return _deposit(assets, msg.sender);
}
/// @notice * EIP 4626 *
function deposit(uint256 assets, address receiver)
public
returns (uint256 shares)
{
return _deposit(assets, receiver);
}
// Note: Unused function param to adhere to standard
/// @notice * EIP 4626 *
function maxMint(address receiver) public pure returns (uint256 maxShares) {
maxShares = 2**256 - 1; // No limit on shares that could be created via deposit in current implementation - Max UINT
}
// Given I want these shares, how much do I have to deposit
/// @notice * EIP 4626 *
function previewMint(uint256 shares) public view returns (uint256 assets) {
(totalSupply == 0) ? assets = shares : assets = (
shares.mul(totalAssets())
).div(totalSupply);
}
// Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
/// @notice * EIP 4626 *
function mint(uint256 shares, address receiver)
public
returns (uint256 assets)
{
assets = previewMint(shares);
uint256 _shares = _deposit(assets, receiver);
require(_shares == shares, "did not mint expected share count");
}
// A user can withdraw whatever they hold
/// @notice * EIP 4626 *
function maxWithdraw(address owner)
public
view
returns (uint256 maxAssets)
{
if (totalSupply == 0) {
maxAssets = 0;
} else {
uint256 ownerShares = balanceOf[owner];
maxAssets = convertToAssets(ownerShares);
}
}
/// @notice * EIP 4626 *
function previewWithdraw(uint256 assets)
public
view
returns (uint256 shares)
{
if (totalSupply == 0) {
shares = 0;
} else {
uint256 amountWithdrawn;
uint256 _fee = assets.mul(feeBPS).div(10000);
amountWithdrawn = assets.sub(_fee);
shares = convertToShares(amountWithdrawn);
}
}
/// @notice * EIP 4626 *
function withdraw(
uint256 assets,
address receiver,
address owner
) public returns (uint256 shares) {
require(
owner == msg.sender,
"This implementation does not support non-sender owners from withdrawing user shares"
);
uint256 expectedShares = previewWithdraw(assets);
uint256 assetsReceived = _withdraw(expectedShares, receiver);
require(
assetsReceived >= assets,
"You cannot withdraw the amount of assets you expected"
);
shares = expectedShares;
}
// Constraint: msg.sender is owner of shares when withdrawing
/// @notice * EIP 4626 *
function maxRedeem(address owner) public view returns (uint256 maxShares) {
return balanceOf[owner];
}
// Constraint: msg.sender is owner of shares when withdrawing
/// @notice * EIP 4626 *
function previewRedeem(uint256 shares)
public
view
returns (uint256 assets)
{
uint256 r = (underlyingBalance().mul(shares)).div(totalSupply);
uint256 _fee = r.mul(feeBPS).div(10000);
assets = r.sub(_fee);
}
/// @notice * EIP 4626 *
function redeem(
uint256 shares,
address receiver,
address owner
) public returns (uint256 assets) {
require(
owner == msg.sender,
"This implementation does not support non-sender owners from withdrawing user shares"
);
assets = _withdraw(shares, receiver);
}
/// *** Internal Functions ***
/// @notice Deposit assets for the user and mint Bath Token shares to receiver
function _deposit(uint256 assets, address receiver)
internal
returns (uint256 shares)
{
uint256 _pool = underlyingBalance();
uint256 _before = underlyingToken.balanceOf(address(this));
// **Assume caller is depositor**
underlyingToken.transferFrom(msg.sender, address(this), assets);
uint256 _after = underlyingToken.balanceOf(address(this));
assets = _after.sub(_before); // Additional check for deflationary tokens
(totalSupply == 0) ? shares = assets : shares = (
assets.mul(totalSupply)
).div(_pool);
// Send shares to designated target
_mint(receiver, shares);
emit LogDeposit(
assets,
underlyingToken,
shares,
msg.sender,
underlyingBalance(),
outstandingAmount,
totalSupply
);
emit Deposit(msg.sender, msg.sender, assets, shares);
}
/// @notice Withdraw share for the user and send underlyingToken to receiver with any accrued yield and incentive tokens
function _withdraw(uint256 _shares, address receiver)
internal
returns (uint256 amountWithdrawn)
{
uint256 _initialTotalSupply = totalSupply;
// Distribute network rewards first in order to handle bonus token == underlying token case; it only releases vested tokens in this call
distributeBonusTokenRewards(receiver, _shares, _initialTotalSupply);
uint256 r = (underlyingBalance().mul(_shares)).div(_initialTotalSupply);
_burn(msg.sender, _shares);
uint256 _fee = r.mul(feeBPS).div(10000);
// If FeeTo == address(0) then the fee is effectively accrued by the pool
if (feeTo != address(0)) {
underlyingToken.transfer(feeTo, _fee);
}
amountWithdrawn = r.sub(_fee);
underlyingToken.transfer(receiver, amountWithdrawn);
emit LogWithdraw(
amountWithdrawn,
underlyingToken,
_shares,
msg.sender,
_fee,
feeTo,
underlyingBalance(),
outstandingAmount,
totalSupply
);
emit Withdraw(
msg.sender,
receiver,
msg.sender,
amountWithdrawn,
_shares
);
}
/// @notice Function to distibute non-underlyingToken Bath Token incentives to pool withdrawers
/// @dev Note that bonusTokens adhere to the same feeTo and feeBPS pattern. Fees sit on BathBuddy to act as effectively accrued to the pool.
function distributeBonusTokenRewards(
address receiver,
uint256 sharesWithdrawn,
uint256 initialTotalSupply
) internal {
if (bonusTokens.length > 0) {
for (uint256 index = 0; index < bonusTokens.length; index++) {
IERC20 token = IERC20(bonusTokens[index]);
// Note: Shares already burned in Bath Token _withdraw
// Pair each bonus token with a lightly adapted OZ Vesting wallet. Each time a user withdraws, they
// are released their relative share of this pool, of vested BathBuddy rewards
// The BathBuddy pool should accrue ERC-20 rewards just like OZ VestingWallet and simply just release the withdrawer's relative share of releaseable() tokens
if (rewardsVestingWallet != IBathBuddy(0)) {
rewardsVestingWallet.release(
(token),
receiver,
sharesWithdrawn,
initialTotalSupply,
feeBPS
);
}
}
}
}
/// *** ERC - 20 Standard ***
function _mint(address to, uint256 value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(
address owner,
address spender,
uint256 value
) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(
address from,
address to,
uint256 value
) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool) {
if (allowance[from][msg.sender] != uint256(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(
value
);
}
_transfer(from, to, value);
return true;
}
/// @notice EIP 2612
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "bathToken: EXPIRED");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(
abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(
recoveredAddress != address(0) && recoveredAddress == owner,
"bathToken: INVALID_SIGNATURE"
);
_approve(owner, spender, value);
}
/// *** View Functions ***
/// @notice The underlying ERC-20 that this bathToken handles
function underlyingERC20() external view returns (address) {
return address(underlyingToken);
}
/// @notice The best-guess total claim on assets the Bath Token has
/// @dev returns the amount of underlying ERC20 tokens in this pool in addition to any tokens that are outstanding in the Rubicon order book seeking market-making yield (outstandingAmount)
function underlyingBalance() public view returns (uint256) {
uint256 _pool = IERC20(underlyingToken).balanceOf(address(this));
return _pool.add(outstandingAmount);
}
}