Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
54d42a0
feat: single factory for bnb chain
Debugger022 Jun 10, 2025
a4eadc2
feat: separate wrappers for core and isolated pools
Debugger022 Jun 10, 2025
b71d4ad
feat: update interface
Debugger022 Jun 10, 2025
317d77a
refactor: rename comptroller interface
Debugger022 Jun 11, 2025
0790ebf
fix: lint
Debugger022 Jun 11, 2025
3967140
refactor: removing unused functions
Debugger022 Jun 11, 2025
b9d7bb9
fix: lint
Debugger022 Jun 11, 2025
a650344
feat: update deployment script for factory
Debugger022 Jun 11, 2025
33c6f56
feat: updated VenusERC4626 contracts for Core and Isolated
Debugger022 Jun 11, 2025
e8c47a2
feat: abstract contract for VenusERC4626
Debugger022 Jun 11, 2025
c55995f
refactor: separated initialize logic
Debugger022 Jun 17, 2025
aa4c7b4
test: tests for VenusERC4626Isolated
Debugger022 Jun 17, 2025
3b57fe3
refactor: change initialize logic for Core wrapper
Debugger022 Jun 18, 2025
75c937b
fix: minor changes
Debugger022 Jun 18, 2025
5e846b4
test: tests for VenusERC4626Core
Debugger022 Jun 18, 2025
a71fa9d
add deployment chain id for networks
Debugger022 Jun 20, 2025
2f95779
feat: updating deployment files
Debugger022 Jun 20, 2025
e8fd665
refactor: align solidity version and some minor changes
Debugger022 Jun 20, 2025
2f91b86
Merge branch 'main' into feat/VEN-3174
Debugger022 Jun 24, 2025
f289c15
fix: detailed natspec comments
Debugger022 Jun 26, 2025
f65eb09
fix: correct storage layout
Debugger022 Jun 26, 2025
98e05be
refactor: remove isCore param
Debugger022 Jun 26, 2025
81e7994
fix: use interface instead of abstract contract
Debugger022 Jun 26, 2025
199de53
fix: minor fixes
Debugger022 Jun 30, 2025
666f288
refactor: remove try-catch
Debugger022 Jun 30, 2025
f238e6e
refactor: make coreComptroller immutable
Debugger022 Jul 1, 2025
e33dfad
refactor: add storage gap in VenusERC4626
Debugger022 Jul 1, 2025
7184421
refactor: make xvsAddress immutable
Debugger022 Jul 1, 2025
b602274
fix: update deployment script
Debugger022 Jul 1, 2025
b23cf0d
fix: minor fix
Debugger022 Jul 2, 2025
3abc1ba
feat: add check for vBNB
Debugger022 Jul 3, 2025
4668f44
feat: vew-05
Debugger022 Jul 21, 2025
18e5f42
feat: vew-06 and vew-08
Debugger022 Jul 21, 2025
74f607f
feat: vew-09
Debugger022 Jul 21, 2025
f5dd69b
feat: vew-07 and vew-12
Debugger022 Jul 21, 2025
f2e1457
feat: vew-01 and vew-10
Debugger022 Jul 21, 2025
9827ccc
feat: vew-02 and vew-03
Debugger022 Jul 21, 2025
2f7dd00
feat: vew-04
Debugger022 Jul 21, 2025
8d561e6
feat: vew-14
Debugger022 Jul 21, 2025
2500fab
fix: vew-03
chechu Jul 25, 2025
32e2cbc
feat: I01
Debugger022 Jul 29, 2025
31d358f
fix: vew-08
Debugger022 Jul 29, 2025
b835b64
Merge pull request #5 from VenusProtocol/feat/audit-mitigations
Debugger022 Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions contracts/ERC4626/Interfaces/IComptroller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@ pragma solidity 0.8.25;

import { Action } from "@venusprotocol/isolated-pools/contracts/ComptrollerInterface.sol";
import { RewardsDistributor } from "@venusprotocol/isolated-pools/contracts/Rewards/RewardsDistributor.sol";
import { VTokenInterface } from "./VTokenInterface.sol";

/**
* @title IComptroller
* @author Venus
* @notice Combined interface for the `Comptroller` contract, including both core and view functions.
*/
interface IComptroller {
function claimVenus(
address[] calldata holders,
VTokenInterface[] calldata vTokens,
bool borrowers,
bool suppliers
) external;

function actionPaused(address market, Action action) external view returns (bool);

function getRewardDistributors() external view returns (RewardsDistributor[] memory);

function supplyCaps(address) external view returns (uint256);

function markets(address) external view returns (bool, uint256);

function getXVSAddress() external view returns (address);
}
2 changes: 1 addition & 1 deletion contracts/ERC4626/Interfaces/IProtocolShareReserve.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
pragma solidity 0.8.25;

interface IProtocolShareReserve {
/// @notice it represents the type of vToken income
Expand Down
27 changes: 27 additions & 0 deletions contracts/ERC4626/Interfaces/VTokenInterface.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pragma solidity 0.8.25;

import { IComptroller } from "./IComptroller.sol";

interface VTokenInterface {
function mint(uint256 mintAmount) external returns (uint256);

function redeem(uint256 redeemTokens) external returns (uint256);

function redeemUnderlying(uint256 redeemAmount) external returns (uint256);

function accrueInterest() external returns (uint256);

function balanceOf(address owner) external view returns (uint256);

function comptroller() external view returns (IComptroller);

function totalSupply() external view returns (uint256);

function underlying() external view returns (address);

function getCash() external view returns (uint256);

function exchangeRateStored() external view returns (uint256);

function totalReserves() external view returns (uint256);
}
69 changes: 69 additions & 0 deletions contracts/ERC4626/VenusERC4626Core.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

import { VenusERC4626 } from "./Base/VenusERC4626.sol";
import { IERC20Upgradeable, SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IProtocolShareReserve } from "./Interfaces/IProtocolShareReserve.sol";
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
import { VTokenInterface } from "./Interfaces/VTokenInterface.sol";

/// @title VenusERC4626Core
/// @notice ERC4626 wrapper for Venus Core Pool vTokens
contract VenusERC4626Core is VenusERC4626 {
/// @notice Immutable XVS token address
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable XVS_ADDRESS;

/// @notice Constructor
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(address xvsAddress_) {
ensureNonzeroAddress(xvsAddress_);
XVS_ADDRESS = xvsAddress_;
_disableInitializers();
}

/// @notice Initializes the VenusERC4626Core contract
/// @dev `initialize2` should be invoked to complete the configuration of the vault
/// @param vToken_ The address of the vToken to be wrapped
function initialize(address vToken_) public virtual initializer {
__VenusERC4626_init(vToken_);
}

/// @inheritdoc VenusERC4626
function claimRewards() external override {
address[] memory holders = new address[](1);
holders[0] = address(this);
VTokenInterface[] memory vTokens = new VTokenInterface[](1);
vTokens[0] = vToken;
comptroller.claimVenus(holders, vTokens, false, true);

IERC20Upgradeable xvs = IERC20Upgradeable(XVS_ADDRESS);
uint256 rewardAmount = xvs.balanceOf(address(this));

if (rewardAmount > 0) {
SafeERC20Upgradeable.safeTransfer(xvs, rewardRecipient, rewardAmount);
Comment thread
GitGuru7 marked this conversation as resolved.

try
IProtocolShareReserve(rewardRecipient).updateAssetsState(
address(comptroller),
XVS_ADDRESS,
IProtocolShareReserve.IncomeType.ERC4626_WRAPPER_REWARDS
)
{} catch {}

Check warning on line 52 in contracts/ERC4626/VenusERC4626Core.sol

View workflow job for this annotation

GitHub Actions / Lint

Code contains empty blocks

Check warning on line 52 in contracts/ERC4626/VenusERC4626Core.sol

View workflow job for this annotation

GitHub Actions / Lint

Code contains empty blocks

emit ClaimRewards(rewardAmount, XVS_ADDRESS);
}
}

/// @notice second function to invoke to complete the initialization
/// @param accessControlManager_ The address of the access control manager
/// @param rewardRecipient_ The address that will receive rewards
/// @param vaultOwner_ The owner of the vault
function initialize2(
address accessControlManager_,
address rewardRecipient_,
address vaultOwner_
) public virtual reinitializer(2) {
__VenusERC4626_init2(accessControlManager_, rewardRecipient_, vaultOwner_);
}
}
Loading
Loading