Skip to content

Commit

Permalink
Document deprecations (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
DefiCake authored Apr 19, 2024
1 parent 13ada4f commit a5b15f1
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-ads-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fuel-bridge/solidity-contracts': patch
---

Add deprecation notices and use better folder grouping
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct Message {

/// @title FuelMessagePortal
/// @notice The Fuel Message Portal contract sends messages to and from Fuel
/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelMessagePortalV3
contract FuelMessagePortal is
Initializable,
PausableUpgradeable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.9;
import "../../FuelMessagePortal.sol";

/// @custom:oz-upgrades-unsafe-allow constructor state-variable-immutable
/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelMessagePortalV3
contract FuelMessagePortalV2 is FuelMessagePortal {
error GlobalDepositLimit();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;

/// @custom:deprecation THIS CONTRACT IS DEPRECATED
abstract contract FuelBridgeBaseV2 {
error FuelContractIsNotBridge();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import {FuelBridgeBase} from "./FuelBridgeBase.sol";
import {FuelMessagePortal, CommonPredicates} from "../../fuelchain/FuelMessagePortal.sol";
import {FuelMessagesEnabledUpgradeable} from "../FuelMessagesEnabledUpgradeable.sol";
import {FuelBridgeBase} from "../FuelBridgeBase/FuelBridgeBase.sol";
import {FuelMessagePortal, CommonPredicates} from "../../../fuelchain/FuelMessagePortal.sol";
import {FuelMessagesEnabledUpgradeable} from "../../FuelMessagesEnabledUpgradeable.sol";

/// @title FuelERC20Gateway
/// @notice The L1 side of the general ERC20 gateway with Fuel
/// @dev This contract can be used as a template for future gateways to Fuel
/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelERC20GatewayV4
contract FuelERC20Gateway is
Initializable,
FuelBridgeBase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;

import "../FuelERC20Gateway.sol";
import "./FuelBridgeBaseV2.sol";
import "./FuelERC20Gateway.sol";
import "../FuelBridgeBase/FuelBridgeBaseV2.sol";

/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelERC20GatewayV4
contract FuelERC20GatewayV2 is FuelERC20Gateway, FuelBridgeBaseV2 {
using SafeERC20Upgradeable for IERC20Upgradeable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;

import "../v2/FuelERC20GatewayV2.sol";
import "./FuelERC20GatewayV2.sol";

/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelERC20GatewayV4
contract FuelERC20GatewayV3 is FuelERC20GatewayV2 {
using SafeERC20Upgradeable for IERC20Upgradeable;

Expand All @@ -14,12 +15,7 @@ contract FuelERC20GatewayV3 is FuelERC20GatewayV2 {
mapping(address => uint256) public depositLimitGlobal;
mapping(address => uint256) public depositTotals;

function setGlobalDepositLimit(address token, uint256 limit)
external
payable
virtual
onlyRole(DEFAULT_ADMIN_ROLE)
{
function setGlobalDepositLimit(address token, uint256 limit) external payable virtual onlyRole(DEFAULT_ADMIN_ROLE) {
depositLimitGlobal[token] = limit;
}

Expand All @@ -28,11 +24,12 @@ contract FuelERC20GatewayV3 is FuelERC20GatewayV2 {
/// @param fuelContractId ID of the contract on Fuel that manages the deposited tokens
/// @param amount Amount of tokens to deposit
/// @param messageData The data of the message to send for deposit
function _deposit(address tokenAddress, bytes32 fuelContractId, uint256 amount, bytes memory messageData)
internal
virtual
override
{
function _deposit(
address tokenAddress,
bytes32 fuelContractId,
uint256 amount,
bytes memory messageData
) internal virtual override {
////////////
// Checks //
////////////
Expand Down Expand Up @@ -68,13 +65,12 @@ contract FuelERC20GatewayV3 is FuelERC20GatewayV2 {
/// @param amount Amount of tokens to withdraw
/// @param tokenId Discriminator for ERC721 / ERC1155 tokens. For ERC20, it must be 0
/// @dev Made payable to reduce gas costs
function finalizeWithdrawal(address to, address tokenAddress, uint256 amount, uint256 tokenId)
external
payable
override
whenNotPaused
onlyFromPortal
{
function finalizeWithdrawal(
address to,
address tokenAddress,
uint256 amount,
uint256 tokenId
) external payable override whenNotPaused onlyFromPortal {
////////////
// Checks //
////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import {FuelERC20GatewayV3} from "../v3/FuelERC20GatewayV3.sol";
import {CommonPredicates} from "../../../lib/CommonPredicates.sol";
import {FuelMessagePortal} from "../../../fuelchain/FuelMessagePortal.sol";
import {FuelBridgeBase} from "../FuelBridgeBase.sol";
import {FuelBridgeBase} from "../FuelBridgeBase/FuelBridgeBase.sol";
import {FuelMessagesEnabledUpgradeable} from "../../FuelMessagesEnabledUpgradeable.sol";

/// @title FuelERC20GatewayV4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import {FuelBridgeBase} from "./FuelBridgeBase.sol";
import {FuelMessagePortal, CommonPredicates} from "../../fuelchain/FuelMessagePortal.sol";
import {FuelMessagesEnabledUpgradeable} from "../FuelMessagesEnabledUpgradeable.sol";

import "hardhat/console.sol";
import {FuelBridgeBase} from "../FuelBridgeBase/FuelBridgeBase.sol";
import {FuelMessagePortal, CommonPredicates} from "../../../fuelchain/FuelMessagePortal.sol";
import {FuelMessagesEnabledUpgradeable} from "../../FuelMessagesEnabledUpgradeable.sol";

/// @title FuelERC721Gateway
/// @notice The L1 side of the general ERC721 gateway with Fuel
/// @dev This contract can be used as a template for future gateways to Fuel

/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelERC20GatewayV4
contract FuelERC721Gateway is
Initializable,
FuelBridgeBase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;

import "../FuelERC721Gateway.sol";
import "./FuelBridgeBaseV2.sol";
import "./FuelERC721Gateway.sol";
import "../FuelBridgeBase/FuelBridgeBaseV2.sol";

/// @custom:deprecation THIS CONTRACT IS DEPRECATED. CHECK FuelERC20GatewayV4
contract FuelERC721GatewayV2 is FuelERC721Gateway, FuelBridgeBaseV2 {
function registerAsReceiver(address tokenAddress) external payable virtual override onlyFromPortal {
bytes32 sender = messageSender();
Expand Down

0 comments on commit a5b15f1

Please sign in to comment.