Created
September 12, 2016 02:20
-
-
Save HCharlanes/54e775ffcffbc0fc618e652a7554b84d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @title Stablecoin Token API. Extension of the Token standard (https://github.com/ethereum/EIPs/issues/20) | |
/// @author Hadrien Charlanes - <[email protected]> | |
contract StablecoinTokenAPI { | |
/// @dev Getters of the conversion rates between USDcents and Wei | |
function getUSDcentstoWEIPrice(uint amountInUSDCents) constant returns (uint purchasePricesInWei); | |
function getWEItoUSDCentsPrice(uint amountinWei) constant returns (uint purchasePriceinUSDCents); | |
///@dev Return if a convertion ETH -> USD will be successful | |
///@param amountInWei WEI amount willing to be converted | |
function convertibleInUSD (uint amountInWei) constant public returns (bool); | |
//Extra Stablecoin Token functions | |
/// @dev Purchase Stablecoins with ETH. This converts an ETH stable value into a USD stable value. | |
function convertToUSD() returns (uint amountInUSDCents); | |
/// @dev Withdraw stablecoins for ETH. This converts back an USD stable value into a ETH stable value. | |
/// @param amountInUSDCents amount of stablecoins withdrawn & deleted. | |
function convertToETH (uint amountInUSDCents) returns (uint amountinWei); | |
// Conversion events. | |
event Purchase(address indexed from, uint256 value); | |
event Withdraw(address indexed from, uint256 value); | |
//Events and public variables that keep track of your service status | |
//Public bool and event shot when the service has been stopped. | |
bool public serviceStopped; | |
uint public price100kETHUSDAtStop; | |
event Stopped(); | |
//Public bool and event shot when the service has been stopped to prevent the system from collapsing. | |
bool public servicePrevStopped; | |
event PreventiveStop(uint stopTime); | |
//Public bool and event shot when the service has refunded. | |
bool public serviceRefunded; | |
event Refunded (); | |
//creator of the stablecoin service | |
address public creator; | |
//Standard Token functions. | |
function totalSupply() constant returns (uint256 supply); | |
//Note: balanceOf(address(this)) is the equivalent of this.balance. | |
function balanceOf(address owner) constant returns (uint256 balance); | |
function transfer(address to, uint256 value) returns (bool success); | |
function transferFrom(address from, address to, uint256 value) returns (bool success); | |
function approve(address spender, uint256 value) returns (bool success); | |
function allowance(address owner, address spender) constant returns (uint256 remaining); | |
//Standard Token Events | |
event Transfer(address indexed from, address indexed to, uint256 value); | |
event Approval(address indexed owner, address indexed spender, uint256 value); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment