Skip to content

Commit

Permalink
Extract IFiatToken interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Jun 19, 2024
1 parent 635c6ea commit e60232b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
7 changes: 1 addition & 6 deletions contracts/tokenbridge/arbitrum/gateway/L2USDCGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

import "./L2ArbitrumGateway.sol";
import {L1USDCGateway} from "../../ethereum/gateway/L1USDCGateway.sol";
import {L1USDCGateway, IFiatToken} from "../../ethereum/gateway/L1USDCGateway.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
Expand Down Expand Up @@ -199,8 +199,3 @@ contract L2USDCGateway is L2ArbitrumGateway {
return true;
}
}

interface IFiatToken {
function burn(uint256 _amount) external;
function mint(address _to, uint256 _amount) external;
}
14 changes: 4 additions & 10 deletions contracts/tokenbridge/ethereum/gateway/L1USDCGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TokenGateway,
IERC20
} from "./L1ArbitrumExtendedGateway.sol";
import {IFiatToken} from "../../libraries/IFiatToken.sol";

/**
* @title Custom gateway for USDC implementing Bridged USDC Standard.
Expand Down Expand Up @@ -84,8 +85,8 @@ contract L1USDCGateway is L1ArbitrumExtendedGateway {

/**
* @notice Pauses deposits. This can only be called by the owner.
* @dev Pausing is prerequisite for burning escrowed USDC tokens. Incoming withdrawals are not affected.
* It is onetime permanent action. Pausing the withdrawals needs to be done separately on the child chain.
* @dev Pausing is permanent and can't be undone. Pausing is prerequisite for burning escrowed USDC tokens.
* Incoming withdrawals are not affected. Pausing the withdrawals needs to be done separately on the child chain.
*/
function pauseDeposits() external onlyOwner {
if (depositsPaused) {
Expand Down Expand Up @@ -117,7 +118,7 @@ contract L1USDCGateway is L1ArbitrumExtendedGateway {
revert L1USDCGateway_L2SupplyNotSet();
}

Burnable(l1USDC).burn(_amountToBurn);
IFiatToken(l1USDC).burn(_amountToBurn);
emit GatewayUsdcBurned(_amountToBurn);
}

Expand Down Expand Up @@ -175,10 +176,3 @@ contract L1USDCGateway is L1ArbitrumExtendedGateway {
return l2USDC;
}
}

interface Burnable {
/**
* @notice Circle's referent USDC implementation exposes burn function of this signature.
*/
function burn(uint256 _amount) external;
}
15 changes: 15 additions & 0 deletions contracts/tokenbridge/libraries/IFiatToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >0.6.0 <0.9.0;

/**
* @title IFiatToken
* @dev Part of the interface that is used in Circle's referent implementation of the USDC
* Ref: https://github.com/circlefin/stablecoin-evm
*
* This interface is used in the L1USDCGateway, L1OrbitUSDCGateway and L2USDCGateway contracts.
*/
interface IFiatToken {
function burn(uint256 _amount) external;
function mint(address _to, uint256 _amount) external;
}

0 comments on commit e60232b

Please sign in to comment.