Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2630] Remove ankrBNB Reward Distributor #416

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions contracts/Comptroller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{
// PoolRegistry, immutable to save on gas
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable poolRegistry;

Check warning on line 50 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Immutable variables name are set to be in capitalized SNAKE_CASE

/// @notice Emitted when an account enters a market
event MarketEntered(VToken indexed vToken, address indexed account);
Expand Down Expand Up @@ -382,7 +382,7 @@
* @param redeemAmount The amount of the underlying asset being redeemed
* @param redeemTokens The number of tokens being redeemed
*/
function redeemVerify(address vToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external {

Check warning on line 385 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Variable "redeemAmount" is unused

Check warning on line 385 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Variable "redeemTokens" is unused
if (address(prime) != address(0)) {
prime.accrueInterestAndUpdateScore(redeemer, vToken);
}
Expand Down Expand Up @@ -865,7 +865,7 @@

for (uint256 i; i < marketsCount; ++i) {
(, uint256 borrowBalance, ) = _safeGetAccountSnapshot(borrowMarkets[i], borrower);
require(borrowBalance == 0, "Nonzero borrow balance after liquidation");

Check warning on line 868 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements
}
}

Expand All @@ -877,8 +877,8 @@
*/
function setCloseFactor(uint256 newCloseFactorMantissa) external {
_checkAccessAllowed("setCloseFactor(uint256)");
require(MAX_CLOSE_FACTOR_MANTISSA >= newCloseFactorMantissa, "Close factor greater than maximum close factor");

Check warning on line 880 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements
require(MIN_CLOSE_FACTOR_MANTISSA <= newCloseFactorMantissa, "Close factor smaller than minimum close factor");

Check warning on line 881 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements

uint256 oldCloseFactorMantissa = closeFactorMantissa;
closeFactorMantissa = newCloseFactorMantissa;
Expand Down Expand Up @@ -953,7 +953,7 @@
* @custom:access Controlled by AccessControlManager
*/
function setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external {
require(newLiquidationIncentiveMantissa >= MANTISSA_ONE, "liquidation incentive should be greater than 1e18");

Check warning on line 956 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements

_checkAccessAllowed("setLiquidationIncentive(uint256)");

Expand Down Expand Up @@ -981,7 +981,7 @@
revert MarketAlreadyListed(address(vToken));
}

require(vToken.isVToken(), "Comptroller: Invalid vToken"); // Sanity check to make sure its really a VToken

Check warning on line 984 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements

Market storage newMarket = markets[address(vToken)];
newMarket.isListed = true;
Expand Down Expand Up @@ -1015,7 +1015,7 @@
uint256 numMarkets = vTokens.length;
uint256 numBorrowCaps = newBorrowCaps.length;

require(numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input");

Check warning on line 1018 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements

_ensureMaxLoops(numMarkets);

Expand All @@ -1039,7 +1039,7 @@
_checkAccessAllowed("setMarketSupplyCaps(address[],uint256[])");
uint256 vTokensCount = vTokens.length;

require(vTokensCount != 0, "invalid number of markets");

Check warning on line 1042 in contracts/Comptroller.sol

View workflow job for this annotation

GitHub Actions / Lint

Use Custom Errors instead of require statements
require(vTokensCount == newSupplyCaps.length, "invalid number of markets");

_ensureMaxLoops(vTokensCount);
Expand Down Expand Up @@ -1115,6 +1115,22 @@
emit NewRewardsDistributor(address(_rewardsDistributor), address(_rewardsDistributor.rewardToken()));
}

function removeRewardsDistributor(RewardsDistributor _rewardsDistributor) external onlyOwner {
require(rewardsDistributorExists[address(_rewardsDistributor)], "not exists");

uint256 rewardsDistributorsLen = rewardsDistributors.length;

for (uint256 i; i < rewardsDistributorsLen; ++i) {
if (rewardsDistributors[i] == _rewardsDistributor) {
rewardsDistributors[i] = rewardsDistributors[rewardsDistributorsLen - 1];
rewardsDistributors.pop();
break;
}
}

rewardsDistributorExists[address(_rewardsDistributor)] = false;
}

/**
* @notice Sets a new price oracle for the Comptroller
* @dev Only callable by the admin
Expand Down
23 changes: 18 additions & 5 deletions deployments/bsctestnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
]
},
"ComptrollerImpl": {
"address": "0x2CF0e211c99dFd28892cf80D142aA27a9042Dbf4",
"address": "0x6F16a377323ab1e34a9a7a06a4E68EbcCeB10A72",
"abi": [
{
"inputs": [
Expand All @@ -131,7 +131,7 @@
"type": "address"
},
{
"internalType": "enum ComptrollerStorage.Action",
"internalType": "enum Action",
"name": "action",
"type": "uint8"
}
Expand Down Expand Up @@ -393,7 +393,7 @@
},
{
"indexed": false,
"internalType": "enum ComptrollerStorage.Action",
"internalType": "enum Action",
"name": "action",
"type": "uint8"
},
Expand Down Expand Up @@ -845,7 +845,7 @@
"type": "address"
},
{
"internalType": "enum ComptrollerStorage.Action",
"internalType": "enum Action",
"name": "action",
"type": "uint8"
}
Expand Down Expand Up @@ -1771,6 +1771,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract RewardsDistributor",
"name": "_rewardsDistributor",
"type": "address"
}
],
"name": "removeRewardsDistributor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
Expand Down Expand Up @@ -1865,7 +1878,7 @@
"type": "address[]"
},
{
"internalType": "enum ComptrollerStorage.Action[]",
"internalType": "enum Action[]",
"name": "actionsList",
"type": "uint8[]"
},
Expand Down
162 changes: 90 additions & 72 deletions deployments/bsctestnet/ComptrollerImpl.json

Large diffs are not rendered by default.

Loading
Loading