Token swap interface implementation
This commit is contained in:
@@ -471,6 +471,9 @@ Solidity interface definition
|
||||
// Tokens are successfully minted; by who, to whom and how much
|
||||
event Mint(address indexed _minter, address indexed _beneficiary, uint256 value);
|
||||
|
||||
// The given token has been successfully minted; by who, to whom and how much
|
||||
event Mint(address indexed _minter, address indexed _beneficiary, address indexed _token, uint256 value);
|
||||
|
||||
// Mint the specified value of tokens to the specified recipient
|
||||
function mintTo(address _beneficiary, uint256 value) external returns (bool);
|
||||
|
||||
@@ -628,33 +631,33 @@ Solidity interface definition
|
||||
Reference implementations
|
||||
- <git://holbrook.no/erc20-demurrage-token.git>
|
||||
|
||||
### TokenVend
|
||||
### TokenSwap
|
||||
|
||||
This interface defines the mechanism for which a specific ERC20 token
|
||||
may be exchanged for a different ERC20 token.
|
||||
|
||||
A typical use-case is generation of voting tokens based on a momentary
|
||||
voucher balance. This is especially useful if the original ERC20 token
|
||||
is subject to decay (demurrage).
|
||||
|
||||
The tokens used for exchange **SHOULD** be locked for the full duration
|
||||
of holding the vended tokens.
|
||||
|
||||
The withdrawal function may or may not allow partial withdrawals.
|
||||
Token swap interface that can fit token escrow aswell as token swap
|
||||
contracts.
|
||||
|
||||
ERC165 Interface identifier
|
||||
8a13249c
|
||||
9e2d0236
|
||||
|
||||
Solidity interface definition
|
||||
interface ITokenVend {
|
||||
// A new vended token has been created.
|
||||
event TokenCreated(uint256 indexed _tokenIdx, uint256 indexed _supply, address _token);
|
||||
interface ITokenSwap {
|
||||
// Add inToken liquidity of the full balance of the sender
|
||||
// Requires token approval for the balance.
|
||||
function deposit(address _inToken) external returns (uint256);
|
||||
|
||||
// Create corresponding vended tokens for the control token balance of the caller.
|
||||
function getFor(address _token) external returns (uint256);
|
||||
// Add inToken liquidity to the tune of given value.
|
||||
// Requires token approval for the corresponding value.
|
||||
function deposit(address _inToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Recover control tokens that were used to retrieve the corresponding vended tokens.
|
||||
function withdrawFor(address _token) external returns (uint256);
|
||||
// Withdraw any pending outToken balance in the pool for the sender.
|
||||
function withdraw(address _outToken) external returns (uint256);
|
||||
|
||||
// Withdraw pending outToken balance of given value in the pool for the sender.
|
||||
function withdraw(address _outToken, uint256 _value) external returns (uint256);
|
||||
|
||||
// Exchange inToken equalling given value for outToken.
|
||||
// Requires token approval for the value of inToken.
|
||||
function withdraw(address _outToken, address _inToken, uint256 _value) external returns (uint256);
|
||||
}
|
||||
|
||||
Reference implementations
|
||||
|
||||
Reference in New Issue
Block a user