32 lines
1.4 KiB
Solidity
32 lines
1.4 KiB
Solidity
pragma solidity >=0.6.12;
|
|
|
|
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
// File-version: 1
|
|
|
|
// Methods for swapping tokens for each other.
|
|
|
|
interface ITokenSwap {
|
|
// 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);
|
|
|
|
// Add inToken liquidity to the tune of given value.
|
|
// Requires token approval for the corresponding value.
|
|
// If value is 0, up to the full approval MAY be used for the transfer.
|
|
function deposit(address _inToken, uint256 _value) external returns (uint256);
|
|
|
|
// Withdraw pending outToken balance of given value in the pool for the sender.
|
|
// 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.
|
|
function withdraw(address _outToken, uint256 _value) external returns (uint256);
|
|
|
|
// Exchange inToken equalling given value for outToken.
|
|
// Requires token approval for the value of inToken.
|
|
// If value is 0, up to the full approval value MAY be used for the transfer.
|
|
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
|
|
}
|