2023-08-01 17:07:31 +02:00
|
|
|
pragma solidity >=0.6.12;
|
|
|
|
|
|
|
|
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
// File-version: 1
|
|
|
|
|
2023-08-03 11:27:05 +02:00
|
|
|
// Methods for swapping tokens for each other.
|
|
|
|
|
2023-08-01 17:07:31 +02:00
|
|
|
interface ITokenSwap {
|
2023-08-03 11:27:05 +02:00
|
|
|
// Emitted when a new deposit has been made.
|
|
|
|
event Deposit(address indexed _token, uint256 _value);
|
|
|
|
|
|
|
|
// Default token used to access the token swap.
|
|
|
|
// Returns zero-address if no default token is defined.
|
|
|
|
function defaultToken() external returns (address);
|
2023-08-01 17:07:31 +02:00
|
|
|
|
|
|
|
// Add inToken liquidity to the tune of given value.
|
|
|
|
// Requires token approval for the corresponding value.
|
2023-08-03 11:27:05 +02:00
|
|
|
// If value is 0, up to the full approval MAY be used for the transfer.
|
2023-08-01 17:07:31 +02:00
|
|
|
function deposit(address _inToken, uint256 _value) external returns (uint256);
|
|
|
|
|
|
|
|
// Withdraw pending outToken balance of given value in the pool for the sender.
|
2023-08-03 11:27:05 +02:00
|
|
|
// May require token approval for defaultToken if used by contract as exchange for the withdrawal.
|
|
|
|
// If value is 0, up to the full approval value MAY be used for the transfer.
|
2023-08-01 17:07:31 +02:00
|
|
|
function withdraw(address _outToken, uint256 _value) external returns (uint256);
|
|
|
|
|
|
|
|
// Exchange inToken equalling given value for outToken.
|
|
|
|
// Requires token approval for the value of inToken.
|
2023-08-03 11:27:05 +02:00
|
|
|
// If value is 0, up to the full approval value MAY be used for the transfer.
|
2023-08-01 17:07:31 +02:00
|
|
|
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
|
|
|
|
}
|