Add tokenquote interface

This commit is contained in:
lash
2023-08-03 14:13:26 +01:00
parent 48d69ce74c
commit b9a29b7827
7 changed files with 93 additions and 3 deletions

View File

@@ -638,7 +638,7 @@ Define limits of value amounts of tokens that individual addresses can
hold.
Limits are inclusive; a limit for 42 means transfer resulting in a token
balance \_higher\_ than 42 should be rejected.
balance *higher* than 42 should be rejected.
A return value of 0 indicates that the token is categorically not
accepted by the holder.
@@ -650,6 +650,9 @@ accepted by the holder.
#### Solidity interface definition
interface ITokenLimit {
// Returns limit of total value a holder will accept of a specific token.
// The value limit returned is inclusive; A limit of 42 means any operation resulting in a balance OVER 42 should be rejected.
// A value of 0 means that no value of the token is accepted.
function limitOf(address _token, address _holder) external view returns(uint256);
}
@@ -657,6 +660,29 @@ accepted by the holder.
- <git://holbrook.no/erc20-limiter.git>
### TokenQuote
Quote an output token value for a given value of input tokens.
Both input and output value is denominated in the smallest available
unit of respective tokens.
#### ERC165 Interface identifier
dbb21d40
#### Solidity interface definition
interface ITokenQuote {
// Returns, within a current context, what value of outTokens the given value of inTokens translates to.
// The values are given in smallest unit of each respective token.
function valueFor(address _outToken, address _inToken, uint256 value) external view returns (uint256);
}
#### Example implementation
- <git://holbrook.no/erc20-limiter.git>
### TokenRateChange
Enables detection of properties for CIC tokens that change value over