diff --git a/core/contracts/AcreRouter.sol b/core/contracts/AcreRouter.sol index 9063ed59f..c7224e324 100644 --- a/core/contracts/AcreRouter.sol +++ b/core/contracts/AcreRouter.sol @@ -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; } @@ -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 { @@ -40,11 +42,12 @@ 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; } @@ -52,4 +55,8 @@ contract AcreRouter is OwnableUpgradeable { emit VaultRemoved(vault); } + + function vaultsLength() external view returns (uint256) { + return vaults.length; + } } diff --git a/core/package.json b/core/package.json index 5e0d6a7dc..603cb8643 100644 --- a/core/package.json +++ b/core/package.json @@ -57,6 +57,6 @@ "typescript": "^5.3.2" }, "dependencies": { - "@openzeppelin/contracts-upgradeable": "^5.0.0" + "@openzeppelin/contracts": "^5.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b41a02bbc..362ab37be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,9 @@ importers: core: dependencies: - '@openzeppelin/contracts-upgradeable': + '@openzeppelin/contracts': specifier: ^5.0.0 - version: 5.0.0(@openzeppelin/contracts@5.0.0) + version: 5.0.0 devDependencies: '@nomicfoundation/hardhat-chai-matchers': specifier: ^2.0.2 @@ -4425,14 +4425,6 @@ packages: - supports-color dev: true - /@openzeppelin/contracts-upgradeable@5.0.0(@openzeppelin/contracts@5.0.0): - resolution: {integrity: sha512-D54RHzkOKHQ8xUssPgQe2d/U92mwaiBDY7qCCVGq6VqwQjsT3KekEQ3bonev+BLP30oZ0R1U6YC8/oLpizgC5Q==} - peerDependencies: - '@openzeppelin/contracts': 5.0.0 - dependencies: - '@openzeppelin/contracts': 5.0.0 - dev: false - /@openzeppelin/contracts@5.0.0: resolution: {integrity: sha512-bv2sdS6LKqVVMLI5+zqnNrNU/CA+6z6CmwFXm/MzmOPBRSO5reEJN7z0Gbzvs0/bv/MZZXNklubpwy3v2+azsw==} dev: false