cic-contracts/solidity/TokenRateChange.sol

30 lines
1.2 KiB
Solidity
Raw Normal View History

2023-08-01 15:50:09 +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
// Methods to detect tokens that are subject to continuous change, and
interface ITokenChangeRate {
// Time unit resolution for rate of change.
// A value of 0 indicates no rate of change,
function changeTimeUnit() external view returns(uint256);
// Rate of change per changeTimeUnit(), signed integer.
// An effective value of 0 indicates no rate of change.
function changeRate() external view returns (int256);
// Number of decimals with which the changeRate is defined.
// changeRate() should be divided by 10 ** changeRateDecimals() to obtain effective value
function changeRateDecimals() external view returns(uint8);
// Timestamp from when rate of change should be applied.
// A value of 0 indicates no rate of change,
function changeStartTime() external view returns(uint256);
// Calculate value with change rate applied for given amount of time units.
// Will calculate compounded change over the given amount of time units
function applyChange(int256 _value, uint256 _changeTimeUnits) external view returns(int256);
}