Skip to content

Commit

Permalink
Merge pull request #86 from VenusProtocol/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
chechu authored Apr 10, 2024
2 parents 4456b2f + be7a154 commit 88f85a3
Show file tree
Hide file tree
Showing 40 changed files with 1,395 additions and 139 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## [2.0.0-dev.1](https://github.com/VenusProtocol/protocol-reserve/compare/v1.6.0-dev.2...v2.0.0-dev.1) (2024-04-10)


### ⚠ BREAKING CHANGES

* migrate to Solidity 0.8.25

### Features

* migrate to Solidity 0.8.25 ([3f3de1e](https://github.com/VenusProtocol/protocol-reserve/commit/3f3de1ec9ca3e7320a4bc554cadc9e315c640c68))

## [1.6.0-dev.2](https://github.com/VenusProtocol/protocol-reserve/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-04-05)


### Features

* added sweep function ([b4a075c](https://github.com/VenusProtocol/protocol-reserve/commit/b4a075c37c11ed8f343f1a390bd615e3a87348d0))
* updating deployment files ([a5b0ca5](https://github.com/VenusProtocol/protocol-reserve/commit/a5b0ca57669c66eba592751dcea3c80a6e5df5f3))
* updating deployment files ([977305e](https://github.com/VenusProtocol/protocol-reserve/commit/977305e8d5469402fff68c817c85754b50453ee2))
* updating deployment files ([a6d6f8a](https://github.com/VenusProtocol/protocol-reserve/commit/a6d6f8a6589b6c2718e38bd992ca1d667a78a954))


### Bug Fixes

* deployed new implemented with correct xvs addr ([b1c39a8](https://github.com/VenusProtocol/protocol-reserve/commit/b1c39a8141c4f5326220e7db0b6016726f32344a))
* deployed on testnet ([ac8e7a1](https://github.com/VenusProtocol/protocol-reserve/commit/ac8e7a1bce118c1c7fabfdb391d9a844fd05ae06))
* deployed XVSVaultTreasury Implementation ([ac61caf](https://github.com/VenusProtocol/protocol-reserve/commit/ac61cafb8ef888650af1211b1e55a1a78026bfac))
* fixed external deployment ([686cb1c](https://github.com/VenusProtocol/protocol-reserve/commit/686cb1c802ae05dff8e99bd27db6ee03dfc7e2fe))
* fixed netspec ([9d3947e](https://github.com/VenusProtocol/protocol-reserve/commit/9d3947e040d7dfd50838b1d3166f2f80c110d843))
* import venus-protocol deployments ([7798ab8](https://github.com/VenusProtocol/protocol-reserve/commit/7798ab882ae77d4d3c1f9af5893704fb2a516e3b))
* removed external deployment for bsctestnet ([176902d](https://github.com/VenusProtocol/protocol-reserve/commit/176902defa320c7a624b33e8dcf431b738861805))
* removed only ([47cd2b4](https://github.com/VenusProtocol/protocol-reserve/commit/47cd2b48cc4bea05deee282e2ad6a2d5bb32f4e1))
* reverted deployment ([8c2e5d9](https://github.com/VenusProtocol/protocol-reserve/commit/8c2e5d911d20fa9bde4ccb83aec1d6d909df1891))
* verified contract ([1f0e95b](https://github.com/VenusProtocol/protocol-reserve/commit/1f0e95be8e3987ca0b758ae7f81cb241fc0f6ff9))

## [1.6.0-dev.1](https://github.com/VenusProtocol/protocol-reserve/compare/v1.5.0...v1.6.0-dev.1) (2024-04-02)


### Features

* distrubute typechain contract types ([3ab7d80](https://github.com/VenusProtocol/protocol-reserve/commit/3ab7d80350767f4fa812be56f81656f87a03b6d1))

## [1.5.0](https://github.com/VenusProtocol/protocol-reserve/compare/v1.4.0...v1.5.0) (2024-04-02)


Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IComptroller.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.13;
pragma solidity ^0.8.25;

interface IComptroller {
function isComptroller() external view returns (bool);
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IConverterNetwork.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.13;
pragma solidity ^0.8.25;

import { IAbstractTokenConverter } from "../TokenConverter/IAbstractTokenConverter.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IIncomeDestination.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.13;
pragma solidity ^0.8.25;

interface IIncomeDestination {
function updateAssetsState(address comptroller, address asset) external;
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IPoolRegistry.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.13;
pragma solidity ^0.8.25;

interface IPoolRegistry {
/// @notice Get VToken in the Pool for an Asset
Expand Down
2 changes: 1 addition & 1 deletion contracts/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.13;
pragma solidity ^0.8.25;

interface IProtocolShareReserve {
/// @notice it represents the type of vToken income
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IRiskFund.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.13;
pragma solidity ^0.8.25;

Check warning on line 2 in contracts/Interfaces/IRiskFund.sol

View workflow job for this annotation

GitHub Actions / Lint

Found more than One contract per file. 2 contracts found!

Check warning on line 2 in contracts/Interfaces/IRiskFund.sol

View workflow job for this annotation

GitHub Actions / Lint

Found more than One contract per file. 2 contracts found!

/**
* @title IRiskFund
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IRiskFundConverter.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.13;
pragma solidity ^0.8.25;

interface IRiskFundConverter {
function updateAssetsState(address comptroller, address asset) external;
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IShortfall.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.13;
pragma solidity ^0.8.25;

/**
* @title IShortfall
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IVToken.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.13;
pragma solidity ^0.8.25;

interface IVToken {
function underlying() external view returns (address);
Expand Down
2 changes: 1 addition & 1 deletion contracts/Interfaces/IXVSVault.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.13;
pragma solidity ^0.8.25;

/// @title IXVSVaultProxy
/// @author Venus
Expand Down
2 changes: 1 addition & 1 deletion contracts/ProtocolReserve/ProtocolShareReserve.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.13;
pragma solidity 0.8.25;

import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/ProtocolReserve/RiskFundStorage.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.13;
pragma solidity 0.8.25;

Check warning on line 2 in contracts/ProtocolReserve/RiskFundStorage.sol

View workflow job for this annotation

GitHub Actions / Lint

Found more than One contract per file. 4 contracts found!

Check warning on line 2 in contracts/ProtocolReserve/RiskFundStorage.sol

View workflow job for this annotation

GitHub Actions / Lint

Found more than One contract per file. 4 contracts found!

import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/ProtocolReserve/RiskFundV2.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.13;
pragma solidity 0.8.25;

import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
Expand Down
28 changes: 27 additions & 1 deletion contracts/ProtocolReserve/XVSVaultTreasury.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.13;
pragma solidity 0.8.25;

import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
Expand Down Expand Up @@ -29,6 +29,9 @@ contract XVSVaultTreasury is AccessControlledV8, ReentrancyGuardUpgradeable {
/// @notice Emitted when funds transferred to XVSStore address
event FundsTransferredToXVSStore(address indexed xvsStore, uint256 amountMantissa);

/// @notice Event emitted when tokens are swept
event SweepToken(address indexed token, address indexed to, uint256 amount);

/// @notice Thrown when given input amount is zero
error InsufficientBalance();

Expand Down Expand Up @@ -83,6 +86,29 @@ contract XVSVaultTreasury is AccessControlledV8, ReentrancyGuardUpgradeable {
emit FundsTransferredToXVSStore(xvsStore, amountMantissa);
}

/// @notice Function to sweep tokens from the contract
/// @param tokenAddress Address of the asset(token)
/// @param to Address to which assets will be transferred
/// @param amount Amount need to sweep from the contract
/// @custom:event Emits SweepToken event on success
/// @custom:error ZeroAddressNotAllowed is thrown when tokenAddress/to address is zero
/// @custom:error ZeroValueNotAllowed is thrown when amount is zero
/// @custom:access Only Governance
function sweepToken(
address tokenAddress,
address to,
uint256 amount
) external onlyOwner nonReentrant {
ensureNonzeroAddress(tokenAddress);
ensureNonzeroAddress(to);
ensureNonzeroValue(amount);

IERC20Upgradeable token = IERC20Upgradeable(tokenAddress);
token.safeTransfer(to, amount);

emit SweepToken(tokenAddress, to, amount);
}

/// @dev XVS vault setter
/// @param xvsVault_ Address of the XVS vault
/// @custom:event XVSVaultUpdated emits on success
Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/Mocks/MockACM.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.13;
pragma solidity 0.8.25;

import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/Mocks/MockArraySorter.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.10;
pragma solidity 0.8.25;
import { sort } from "../../Utils/ArrayHelpers.sol";

contract MockArraySorter {
Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/Mocks/MockConverter.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.10;
pragma solidity 0.8.25;

import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
Expand Down
3 changes: 2 additions & 1 deletion contracts/Test/Mocks/MockDeflationaryToken.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity 0.8.13;
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

contract MockDeflatingToken {
string public constant NAME = "Deflating Test Token";
Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/Mocks/MockRiskFundConverter.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.13;
pragma solidity 0.8.25;

import { RiskFundConverter } from "../../TokenConverter/RiskFundConverter.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/Mocks/MockToken.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;
pragma solidity 0.8.25;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/Test/imports.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.13;
pragma solidity 0.8.25;

// This file is needed to make hardhat and typechain generate artifacts for
// contracts we depend on (e.g. in tests or deployments) but not use directly.
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenConverter/AbstractTokenConverter.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.13;
pragma solidity 0.8.25;

import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenConverter/ConverterNetwork.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.13;
pragma solidity 0.8.25;

import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
import { MaxLoopsLimitHelper } from "@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenConverter/IAbstractTokenConverter.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.13;
pragma solidity ^0.8.25;

import { ResilientOracle } from "@venusprotocol/oracle/contracts/ResilientOracle.sol";
import { IConverterNetwork } from "../Interfaces/IConverterNetwork.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenConverter/RiskFundConverter.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.13;
pragma solidity 0.8.25;

import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenConverter/SingleTokenConverter.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.13;
pragma solidity 0.8.25;

import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/Utils/ArrayHelpers.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.13;
pragma solidity 0.8.25;

/// @notice Used to sort addresses array based on their token balances
/// @param arr Array of token balances of different addresses
Expand Down
50 changes: 49 additions & 1 deletion deployments/bscmainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -10597,7 +10597,7 @@
]
},
"XVSVaultTreasury_Implementation": {
"address": "0xCA59D9e8889Bc6034CCD749c4Ddd09c865432bA8",
"address": "0xA95a4F34337d8FaC283C3e3D2a605b95DA916cD6",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -10735,6 +10735,31 @@
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "SweepToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -10877,6 +10902,29 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "sweepToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
Loading

0 comments on commit 88f85a3

Please sign in to comment.