-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
258 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
contracts/accumulators/proto/venus/VenusIsolatedSBAccumulator.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity =0.8.13; | ||
|
||
import "../compound/CompoundV2SBAccumulator.sol"; | ||
|
||
interface VToken { | ||
function badDebt() external view returns (uint256); | ||
} | ||
|
||
contract VenusIsolatedSBAccumulator is CompoundV2SBAccumulator { | ||
constructor( | ||
IAveragingStrategy averagingStrategy_, | ||
address comptroller_, | ||
uint8 decimals_, | ||
uint256 updateTheshold_, | ||
uint256 minUpdateDelay_, | ||
uint256 maxUpdateDelay_ | ||
) | ||
CompoundV2SBAccumulator( | ||
averagingStrategy_, | ||
comptroller_, | ||
decimals_, | ||
updateTheshold_, | ||
minUpdateDelay_, | ||
maxUpdateDelay_ | ||
) | ||
{} | ||
|
||
function borrowsForCToken(ICToken cToken) internal view virtual override returns (uint256) { | ||
uint256 totalBorrows = super.borrowsForCToken(cToken); | ||
|
||
return totalBorrows + VToken(address(cToken)).badDebt(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.5.0 <0.9.0; | ||
|
||
library EtherAsTokenLibrary { | ||
address internal constant ETHER_AS_TOKEN = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); | ||
} |
30 changes: 30 additions & 0 deletions
30
contracts/test/accumulators/VenusIsolatedSBAccumulatorStub.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity =0.8.13; | ||
|
||
import "../../accumulators/proto/venus/VenusIsolatedSBAccumulator.sol"; | ||
|
||
contract VenusIsolatedSBAccumulatorStub is VenusIsolatedSBAccumulator { | ||
constructor( | ||
IAveragingStrategy averagingStrategy_, | ||
address comptroller_, | ||
uint8 decimals_, | ||
uint256 updateTheshold_, | ||
uint256 minUpdateDelay_, | ||
uint256 maxUpdateDelay_ | ||
) | ||
VenusIsolatedSBAccumulator( | ||
averagingStrategy_, | ||
comptroller_, | ||
decimals_, | ||
updateTheshold_, | ||
minUpdateDelay_, | ||
maxUpdateDelay_ | ||
) | ||
{} | ||
|
||
function stubFetchLiquidity( | ||
bytes memory data | ||
) public view returns (uint112 tokenLiquidity, uint112 quoteTokenLiquidity) { | ||
return fetchLiquidity(data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters