Files
tycho-execution/foundry/lib/balancer-labs/v2-interfaces/contracts/standalone-utils/IButtonWrapper.sol
2025-01-27 22:54:56 +05:30

121 lines
5.8 KiB
Solidity

// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity >=0.7.0 <0.9.0;
// Source: https://github.com/buttonwood-protocol/button-wrappers/blob/main/contracts/interfaces/IButtonWrapper.sol
// Interface definition for ButtonWrapper contract, which wraps an
// underlying ERC20 token into a new ERC20 with different characteristics.
// NOTE: "uAmount" => underlying token (wrapped) amount and
// "amount" => wrapper token amount
interface IButtonWrapper {
//--------------------------------------------------------------------------
// ButtonWrapper write methods
/// @notice Transfers underlying tokens from {msg.sender} to the contract and
/// mints wrapper tokens.
/// @param amount The amount of wrapper tokens to mint.
/// @return The amount of underlying tokens deposited.
function mint(uint256 amount) external returns (uint256);
/// @notice Transfers underlying tokens from {msg.sender} to the contract and
/// mints wrapper tokens to the specified beneficiary.
/// @param to The beneficiary account.
/// @param amount The amount of wrapper tokens to mint.
/// @return The amount of underlying tokens deposited.
function mintFor(address to, uint256 amount) external returns (uint256);
/// @notice Burns wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @param amount The amount of wrapper tokens to burn.
/// @return The amount of underlying tokens withdrawn.
function burn(uint256 amount) external returns (uint256);
/// @notice Burns wrapper tokens from {msg.sender} and transfers
/// the underlying tokens to the specified beneficiary.
/// @param to The beneficiary account.
/// @param amount The amount of wrapper tokens to burn.
/// @return The amount of underlying tokens withdrawn.
function burnTo(address to, uint256 amount) external returns (uint256);
/// @notice Burns all wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @return The amount of underlying tokens withdrawn.
function burnAll() external returns (uint256);
/// @notice Burns all wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @param to The beneficiary account.
/// @return The amount of underlying tokens withdrawn.
function burnAllTo(address to) external returns (uint256);
/// @notice Transfers underlying tokens from {msg.sender} to the contract and
/// mints wrapper tokens to the specified beneficiary.
/// @param uAmount The amount of underlying tokens to deposit.
/// @return The amount of wrapper tokens mint.
function deposit(uint256 uAmount) external returns (uint256);
/// @notice Transfers underlying tokens from {msg.sender} to the contract and
/// mints wrapper tokens to the specified beneficiary.
/// @param to The beneficiary account.
/// @param uAmount The amount of underlying tokens to deposit.
/// @return The amount of wrapper tokens mint.
function depositFor(address to, uint256 uAmount) external returns (uint256);
/// @notice Burns wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @param uAmount The amount of underlying tokens to withdraw.
/// @return The amount of wrapper tokens burnt.
function withdraw(uint256 uAmount) external returns (uint256);
/// @notice Burns wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back to the specified beneficiary.
/// @param to The beneficiary account.
/// @param uAmount The amount of underlying tokens to withdraw.
/// @return The amount of wrapper tokens burnt.
function withdrawTo(address to, uint256 uAmount) external returns (uint256);
/// @notice Burns all wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @return The amount of wrapper tokens burnt.
function withdrawAll() external returns (uint256);
/// @notice Burns all wrapper tokens from {msg.sender} and transfers
/// the underlying tokens back.
/// @param to The beneficiary account.
/// @return The amount of wrapper tokens burnt.
function withdrawAllTo(address to) external returns (uint256);
//--------------------------------------------------------------------------
// ButtonWrapper view methods
/// @return The address of the underlying token.
function underlying() external view returns (address);
/// @return The total underlying tokens held by the wrapper contract.
function totalUnderlying() external view returns (uint256);
/// @param who The account address.
/// @return The underlying token balance of the account.
function balanceOfUnderlying(address who) external view returns (uint256);
/// @param uAmount The amount of underlying tokens.
/// @return The amount of wrapper tokens exchangeable.
function underlyingToWrapper(uint256 uAmount) external view returns (uint256);
/// @param amount The amount of wrapper tokens.
/// @return The amount of underlying tokens exchangeable.
function wrapperToUnderlying(uint256 amount) external view returns (uint256);
}