Skip to content

Commit

Permalink
Replacing OZ upgradable lib to a non-upgradable one
Browse files Browse the repository at this point in the history
Upgradability will be handled down the road in a separate PR(s)
  • Loading branch information
dimpar committed Dec 6, 2023
1 parent 3246552 commit a3ba20f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
13 changes: 10 additions & 3 deletions core/contracts/AcreRouter.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.21;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/// @title AcreRouter
/// @notice AcreRouter is a contract that routes TBTC from stBTC (Acre) to
/// a given vault and back. Vaults supply yield strategies with TBTC that
/// generate yield for Bitcoin holders.
contract AcreRouter is OwnableUpgradeable {
contract AcreRouter is Ownable {
struct Vault {
bool approved;
}
Expand All @@ -24,6 +24,8 @@ contract AcreRouter is OwnableUpgradeable {
event VaultAdded(address indexed vault);
event VaultRemoved(address indexed vault);

constructor() Ownable(msg.sender) {}

/// @notice Adds a vault to the list of approved vaults.
/// @param vault Address of the vault to add.
function addVault(address vault) external onlyOwner {
Expand All @@ -40,16 +42,21 @@ contract AcreRouter is OwnableUpgradeable {
function removeVault(address vault) external onlyOwner {
require(vaultsInfo[vault].approved, "Not a vault");

delete vaultsInfo[vault];
vaultsInfo[vault].approved = false;

for (uint256 i = 0; i < vaults.length; i++) {
if (vaults[i] == vault) {
vaults[i] = vaults[vaults.length - 1];
// slither-disable-next-line costly-loop
vaults.pop();
break;
}
}

emit VaultRemoved(vault);
}

function vaultsLength() external view returns (uint256) {
return vaults.length;
}
}
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"@openzeppelin/contracts-upgradeable": "^5.0.0"
"@openzeppelin/contracts": "^5.0.0"
}
}
12 changes: 2 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a3ba20f

Please sign in to comment.