Contract Overview
Balance: 1.1978935 Ether
Transactions: 10 txns
 Latest 10 txns

TxHash Age From To Value [TxFee]
0xadf8b7e4327d51c3765c802c8d2ba725d82abd986d0565094dbb48a567a55633239 days 15 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d001 Ether0.00456496
0x78d419af24268302a0a7c26b16102fa623f4671588c401a8c0d37d8990ec49ab239 days 15 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000.01 Ether0.004572
0xe7436058ca2b18a58a3c302c523d3b13072ae09b5503ff7b7553fbf3c1565699239 days 16 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000.2 Ether0.00456496
0xcf1de6dadf212bbba26bf4ae08759ffaebf80bbc3899ff421a68539c24bc1724239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000.1 Ether0.004572
0xa76e39821d2b1ba2da9420d50e37ef22d1de7fb3cdd87c213d14c90e637a561a239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000.1 Ether0.004572
0xc9a12cf2c878320381ef15f4b14ca3e09455273a94ec49e5776141cb530ea201239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d001 Ether0.00527146
0x37ebdcffdf093b320a4bf78466097d226a511f5e2a75b68d5c6a7ab5c6884b3e239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000 Ether0.00204888
0xd26151ecefc01b35cd817958c79156648c1ab3d2709625070bd539caccc6ebd4239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000 Ether0.00152376
0x0d7e204719f42916e40d7d32b2d0349f13317a328168afc2dca3c36f04332f1b239 days 17 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN   0x8fff60b4b170910131152a6c49311525a3a31d000 Ether0.00131936
0x84e0b27d3521ff8bb6bc3992cd7151be40531ed351b886b885b83506dcb74586239 days 18 hrs ago0x4ef4c85dc5b358b9690338b44962c4d69829fa81  IN    Contract Creation0 Ether0.05651526
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Note: There is limited (beta) support for tracking Internal Transactions on Rinkeby

 Latest 9 Internal Transactions

ParentTxHash Block Age From To Value
0xadf8b7e4327d51c3765c802c8d2ba725d82abd986d0565094dbb48a567a556331287799239 days 15 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.0040355 Ether
0x78d419af24268302a0a7c26b16102fa623f4671588c401a8c0d37d8990ec49ab1287778239 days 15 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.0040355 Ether
0xe7436058ca2b18a58a3c302c523d3b13072ae09b5503ff7b7553fbf3c15656991287571239 days 16 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.0040355 Ether
0x53ee97d1779272862405b579acdc4c5b4ad9b1922b1dd624374c35a5bf7868f11287419239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x4ef4c85dc5b358b9690338b44962c4d69829fa810.0959645 Ether
0xcf1de6dadf212bbba26bf4ae08759ffaebf80bbc3899ff421a68539c24bc17241287415239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.0040355 Ether
0xf731825a02e6614e900e8f22a2bd0b409b0076ebbe22770478b5a29d45be78831287391239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x4ef4c85dc5b358b9690338b44962c4d69829fa810.0959645 Ether
0xa76e39821d2b1ba2da9420d50e37ef22d1de7fb3cdd87c213d14c90e637a561a1287386239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.0040355 Ether
0xa58b891d28046949f9a588df97a7360b7fd91a655aae6d92f7ce192bdb184e8a1287380239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x4ef4c85dc5b358b9690338b44962c4d69829fa810.998 Ether
0xc9a12cf2c878320381ef15f4b14ca3e09455273a94ec49e5776141cb530ea2011287376239 days 17 hrs ago0x8fff60b4b170910131152a6c49311525a3a31d000x84c2da0a8c5828d4b568c55679e48f0c476d80040.002 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Similar match)
Note: Displaying similar matching verified source code at contract 0x1ceec6877e0c8f0f1c3906b15e66dbb094ec85be(excluding Constructor Arguments if any)
Contract Name: minter
Compiler Version: v0.4.18+commit.9cf6e910
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.16;
//User interface at http://www.staticoin.com
//Full source code at https://github.com/genkifs/staticoin
/** @title owned. */
contract owned  {
  address owner;
  function owned() {
    owner = msg.sender;
  }
  function changeOwner(address newOwner) onlyOwner {
    owner = newOwner;
  }
  modifier onlyOwner() {
    if (msg.sender==owner) 
    _;
  }
}

/** @title mortal. */
contract mortal is owned() {
  function kill() onlyOwner {
    if (msg.sender == owner) selfdestruct(owner);
  }
}

/** @title DSMath. */
contract DSMath {

	// Copyright (C) 2015, 2016, 2017  DappHub, LLC

	// Licensed under the Apache License, Version 2.0 (the "License").
	// You may not use this file except in compliance with the License.

	// Unless required by applicable law or agreed to in writing, software
	// distributed under the License is distributed on an "AS IS" BASIS,
	// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND (express or implied).
    
	// /*
    // uint128 functions (h is for half)
    //  */

    function hmore(uint128 x, uint128 y) constant internal returns (bool) {
        return x>y;
    }

    function hless(uint128 x, uint128 y) constant internal returns (bool) {
        return x<y;
    }

    function hadd(uint128 x, uint128 y) constant internal returns (uint128 z) {
        require((z = x + y) >= x);
    }

    function hsub(uint128 x, uint128 y) constant internal returns (uint128 z) {
        require((z = x - y) <= x);
    }

    function hmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        require(y == 0 ||(z = x * y)/ y == x);
    }

    function hdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = x / y;
    }

    function hmin(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x <= y ? x : y;
    }

    function hmax(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x >= y ? x : y;
    }

    // /*
    // int256 functions
    //  */

    /*
    WAD math
     */
    uint64 constant WAD_Dec=18;
    uint128 constant WAD = 10 ** 18;

    function wmore(uint128 x, uint128 y) constant internal returns (bool) {
        return hmore(x, y);
    }

    function wless(uint128 x, uint128 y) constant internal returns (bool) {
        return hless(x, y);
    }

    function wadd(uint128 x, uint128 y) constant  returns (uint128) {
        return hadd(x, y);
    }

    function wsub(uint128 x, uint128 y) constant   returns (uint128) {
        return hsub(x, y);
    }

    function wmul(uint128 x, uint128 y) constant returns (uint128 z) {
        z = cast((uint256(x) * y + WAD / 2) / WAD);
    }

    function wdiv(uint128 x, uint128 y) constant internal  returns (uint128 z) {
        z = cast((uint256(x) * WAD + y / 2) / y);
    }

    function wmin(uint128 x, uint128 y) constant internal  returns (uint128) {
        return hmin(x, y);
    }

    function wmax(uint128 x, uint128 y) constant internal  returns (uint128) {
        return hmax(x, y);
    }

    function cast(uint256 x) constant internal returns (uint128 z) {
        assert((z = uint128(x)) == x);
    }
	
}
 
/** @title I_minter. */
contract I_minter { 
    event EventCreateStatic(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventRedeemStatic(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventCreateRisk(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventRedeemRisk(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventBankrupt();

    function Leverage() constant returns (uint128)  {}
    function RiskPrice(uint128 _currentPrice,uint128 _StaticTotal,uint128 _RiskTotal, uint128 _ETHTotal) constant returns (uint128 price)  {}
    function RiskPrice(uint128 _currentPrice) constant returns (uint128 price)  {}     
    function PriceReturn(uint _TransID,uint128 _Price) {}
    function NewStatic() external payable returns (uint _TransID)  {}
    function NewStaticAdr(address _Risk) external payable returns (uint _TransID)  {}
    function NewRisk() external payable returns (uint _TransID)  {}
    function NewRiskAdr(address _Risk) external payable returns (uint _TransID)  {}
    function RetRisk(uint128 _Quantity) external payable returns (uint _TransID)  {}
    function RetStatic(uint128 _Quantity) external payable returns (uint _TransID)  {}
    function Strike() constant returns (uint128)  {}
}

/** @title I_Pricer. */
contract I_Pricer {
    uint128 public lastPrice;
    I_minter public mint;
    string public sURL;
    mapping (bytes32 => uint) RevTransaction;

    function setMinter(address _newAddress) {}
    function __callback(bytes32 myid, string result) {}
    function queryCost() constant returns (uint128 _value) {}
    function QuickPrice() payable {}
    function requestPrice(uint _actionID) payable returns (uint _TrasID) {}
    function collectFee() returns(bool) {}
    function () {
        //if ether is sent to this address, send it back.
        revert();
    }
}

/** @title I_coin. */
contract I_coin is mortal {

    event EventClear();

	I_minter public mint;
    string public name;                   //fancy name: eg Simon Bucks
    uint8 public decimals=18;                //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
    string public symbol;                 //An identifier: eg SBX
    string public version = '';       //human 0.1 standard. Just an arbitrary versioning scheme.
	
    function mintCoin(address target, uint256 mintedAmount) returns (bool success) {}
    function meltCoin(address target, uint256 meltedAmount) returns (bool success) {}
    function approveAndCall(address _spender, uint256 _value, bytes _extraData){}

    function setMinter(address _minter) {}   
	function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {}    
	function decreaseApproval (address _spender, uint256 _subtractedValue) 	returns (bool success) {} 

    // @param _owner The address from which the balance will be retrieved
    // @return The balance
    function balanceOf(address _owner) constant returns (uint256 balance) {}    


    // @notice send `_value` token to `_to` from `msg.sender`
    // @param _to The address of the recipient
    // @param _value The amount of token to be transferred
    // @return Whether the transfer was successful or not
    function transfer(address _to, uint256 _value) returns (bool success) {}


    // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
    // @param _from The address of the sender
    // @param _to The address of the recipient
    // @param _value The amount of token to be transferred
    // @return Whether the transfer was successful or not
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}

    // @notice `msg.sender` approves `_addr` to spend `_value` tokens
    // @param _spender The address of the account able to transfer the tokens
    // @param _value The amount of wei to be approved for transfer
    // @return Whether the approval was successful or not
    function approve(address _spender, uint256 _value) returns (bool success) {}

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
	
	// @param _owner The address of the account owning tokens
    // @param _spender The address of the account able to transfer the tokens
    // @return Amount of remaining tokens allowed to spent
    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
	
	mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;

	// @return total amount of tokens
    uint256 public totalSupply;
}

/** @title DSBaseActor. */
contract DSBaseActor {
   /*
   Copyright 2016 Nexus Development, LLC

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   */

    bool _ds_mutex;
    modifier mutex() {
        assert(!_ds_mutex);
        _ds_mutex = true;
        _;
        _ds_mutex = false;
    }
	
    function tryExec( address target, bytes calldata, uint256 value)
			mutex()
            internal
            returns (bool call_ret)
    {
		/** @dev Requests new StatiCoins be made for a given address
          * @param target where the ETH is sent to.
          * @param calldata
          * @param value
          * @return True if ETH is transfered
        */
        return target.call.value(value)(calldata);
    }
	
    function exec( address target, bytes calldata, uint256 value)
             internal
    {
        assert(tryExec(target, calldata, value));
    }
}

/** @title canFreeze. */
contract canFreeze is owned { 
	//Copyright (c) 2017 GenkiFS
	//Basically a "break glass in case of emergency"
    bool public frozen=false;
    modifier LockIfFrozen() {
        require(!frozen);
        _;
    }
    function Freeze() onlyOwner {
        // fixes the price and allows everyone to redeem their coins at the current value
		// only becomes false when all ETH has been claimed or the pricer contract is changed
        frozen=true;
    }
}

/** @title oneWrite. */
contract oneWrite {  
	//  Adds modifies that allow one function to be called only once
	//Copyright (c) 2017 GenkiFS
  bool written = false;
  function oneWrite() {
	/** @dev Constuctor, make sure written=false initally
	*/
    written = false;
  }
  modifier LockIfUnwritten() {
    require(written);
    _;
  }
  modifier writeOnce() {
    if (!written){
        written=true;
        _;
    }
  }
}

/** @title pricerControl. */
contract pricerControl is canFreeze {
	//  Copyright (c) 2017 GenkiFS
	//  Controls the Pricer contract for minter.  Allows updates to be made in the future by swapping the pricer contract
	//  Although this is not expected, web addresses, API's, new oracles could require adjusments to the pricer contract
	//  A delay of 2 days is implemented to allow coinholders to redeem their coins if they do not agree with the new contract
	//  A new pricer contract unfreezes the minter (allowing a live price to be used)
    I_Pricer public pricer;
    address public future;
    uint256 public releaseTime;
    uint public PRICER_DELAY = 2; // days updated when coins are set
    event EventAddressChange(address indexed _from, address indexed _to, uint _timeChange);

    function setPricer(address newAddress) onlyOwner {
		/** @dev Changes the Pricer contract, after a certain delay
          * @param newAddress Allows coins to be created and sent to other people
          * @return transaction ID which can be viewed in the pending mapping
        */
        releaseTime = now + PRICER_DELAY;
        future = newAddress;
        EventAddressChange(pricer, future, releaseTime);
    }  

    modifier updates() {
        if (now > releaseTime  && pricer != future){
            update();
            //log0('Updating');
        }
        _;
    }

    modifier onlyPricer() {
      require(msg.sender==address(pricer));
      _;
    }

    function update() internal {
        pricer =  I_Pricer(future);
		frozen = false;
    }
}

/** @title minter. */	
contract minter is I_minter, DSBaseActor, oneWrite, pricerControl, DSMath{ //
	// Copyright (c) 2017 GenkiFS
	// This contract is the controller for the StatiCoin contracts.  
	// Users have 4(+2) functions they can call to mint/melt Static/Risk coins which then calls the Pricer contract
	// after a delay the Pricer contract will call back to the PriceReturn() function
	// this will then call one of the functions ActionNewStatic, ActionNewRisk, ActionRetStatic, ActionRetRisk
	// which will then call the Static or Risk ERC20 contracts to mint/melt new tokens
	// Transfer of tokens is handled by the ERC20 contracts, ETH is stored here.  
    enum Action {NewStatic, RetStatic, NewRisk, RetRisk} // Enum of what users can do
    struct Trans { // Struct
        uint128 amount; // Amount sent by the user (Can be either ETH or number of returned coins)
        address holder; // Address of the user
        Action action;  // Type of action requested (mint/melt a Risk/StatiCoin)
	bytes32 pricerID;  // ID for the pricer function
    }
    uint128 public lastPrice; //Storage of the last price returned by the Pricer contract
    uint128 public PendingETH; //Amount of eth to be added to the contract
    uint public TransID=0; // An increasing counter to keep track of transactions requested
    uint public TransCompleted; // Last transaction removed
    string public Currency; // Name of underlying base currency
    I_coin public Static;  // ERC20 token interface for the StatiCoin
    I_coin public Risk;  // ERC20 token interface for the Risk coin
    uint128 public Multiplier;//=15*10**(17); // default ratio for Risk price
    uint128 public levToll=5*10**(18-1);//0.5  // this plus the multiplier defines the maximum leverage
    uint128 public mintFee = 2*10**(18-3); //0.002 Used to pay oricalize and for marketing contract which is in both parties interest.
    mapping (uint => Trans[]) public pending; // A mapping of pending transactions

    event EventCreateStatic(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventRedeemStatic(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventCreateRisk(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventRedeemRisk(address indexed _from, uint128 _value, uint _transactionID, uint _Price); 
    event EventBankrupt();	//Called when no more ETH is in the contract and everything needs to be manually reset.  
	
    function minter(string _currency, uint128 _Multiplier) { //,uint8 _DecimalPlaces
        // CONSTRUCTOR  
        Currency=_currency;
        Multiplier = _Multiplier;
        // can't add new contracts here as it gives out of gas messages.  Too much code.
    }	

    function () {
        //if ETH is just sent to this address then we cannot determine if it's for StatiCoins or RiskCoins, so send it back.
        revert();
    }

    function Bailout() 
			external 
			payable 
			{
        /** @dev Allows extra ETH to be added to the benefit of both types of coin holders
          * @return nothing
        */
    }
		
    function NewStatic() 
			external 
			payable 
			returns (uint _TransID) {
		/** @dev Requests new StatiCoins be made for the sender.  
		  * This cannot be called by a contract.  Only a simple wallet (with 0 codesize).
		  * Contracts must use the Approve, transferFrom pattern and move coins from wallets
		  * @return transaction ID which can be viewed in the pending mapping
		*/
		_TransID=NewCoinInternal(msg.sender,cast(msg.value),Action.NewStatic);
		//log0('NewStatic');
    }
	
    function NewStaticAdr(address _user) 
			external 
			payable 
			returns (uint _TransID)  {  
		/** @dev Requests new StatiCoins be made for a given address.  
		  * The address cannot be a contract, only a simple wallet (with 0 codesize).
		  * Contracts must use the Approve, transferFrom pattern and move coins from wallets
        	  * @param _user Allows coins to be created and sent to other people
         	  * @return transaction ID which can be viewed in the pending mapping
       		 */
		_TransID=NewCoinInternal(_user,cast(msg.value),Action.NewStatic);
		//log0('NewStatic');
    }
	
    function NewRisk() 
			external 
			payable 
			returns (uint _TransID)  {
        /** @dev Requests new Riskcoins be made for the sender.  
		  * This cannot be called by a contract, only a simple wallet (with 0 codesize).
		  * Contracts must use the Approve, transferFrom pattern and move coins from wallets
          * @return transaction ID which can be viewed in the pending mapping
          */
		_TransID=NewCoinInternal(msg.sender,cast(msg.value),Action.NewRisk);
        //log0('NewRisk');
    }

    function NewRiskAdr(address _user) 
			external 
			payable 
			returns (uint _TransID)  {
        /** @dev Requests new Riskcoins be made for a given address.  
		  * The address cannot be a contract, only a simple wallet (with 0 codesize).
		  * Contracts must use the Approve, transferFrom pattern and move coins from wallets
          * @param _user Allows coins to be created and sent to other people
          * @return transaction ID which can be viewed in the pending mapping
          */
		_TransID=NewCoinInternal(_user,cast(msg.value),Action.NewRisk);
        //log0('NewRisk');
    }

    function RetRisk(uint128 _Quantity) 
			external 
			payable 
			LockIfUnwritten  
			returns (uint _TransID)  {
        /** @dev Returns Riskcoins.  Needs a bit of eth sent to pay the pricer contract and the excess is returned.  
		  * The address cannot be a contract, only a simple wallet (with 0 codesize).
          * @param _Quantity Amount of coins being returned
		  * @return transaction ID which can be viewed in the pending mapping
        */
        if(frozen){
            //Skip the pricer contract
            TransID++;
			ActionRetRisk(Trans(_Quantity,msg.sender,Action.RetRisk,0),TransID,lastPrice);
			_TransID=TransID;
        } else {
            //Only returned when Risk price is positive
			_TransID=RetCoinInternal(_Quantity,cast(msg.value),msg.sender,Action.RetRisk);
        }
		//log0('RetRisk');
    }

    function RetStatic(uint128 _Quantity) 
			external 
			payable 
			LockIfUnwritten  
			returns (uint _TransID)  {
        /** @dev Returns StatiCoins,  Needs a bit of eth sent to pay the pricer contract
          * @param _Quantity Amount of coins being returned
		  * @return transaction ID which can be viewed in the pending mapping
        */
        if(frozen){
            //Skip the pricer contract
			TransID++;
            ActionRetStatic(Trans(_Quantity,msg.sender,Action.RetStatic,0),TransID,lastPrice);
			_TransID=TransID;
        } else {
            //Static can be returned at any time
			_TransID=RetCoinInternal(_Quantity,cast(msg.value),msg.sender,Action.RetStatic);
        }
		//log0('RetStatic');
    }
	
	//****************************//
	// Constant functions (Ones that don't write to the blockchain)
    function StaticEthAvailable() 
			constant 
			returns (uint128)  {
		/** @dev Returns the total amount of eth that can be sent to buy StatiCoins
		  * @return amount of Eth
       		*/
	return StaticEthAvailable(cast(Risk.totalSupply()), wsub(cast(this.balance),PendingETH));
    }

	function StaticEthAvailable(uint128 _RiskTotal, uint128 _TotalETH) 
			constant 
			returns (uint128)  {
		/** @dev Returns the total amount of eth that can be sent to buy StatiCoins allows users to test arbitrary amounts of RiskTotal and ETH contained in the contract
		  * @param _RiskTotal Quantity of 
          * @param  _TotalETH Total value of ETH in the contract
		  * @return amount of Eth
        */
		// (Multiplier+levToll)*_RiskTotal - _TotalETH
		uint128 temp = wmul(wadd(Multiplier,levToll),_RiskTotal);
		if(wless(_TotalETH,temp)){
			return wsub(temp ,_TotalETH);
		} else {
			return 0;
		}
    }

	function RiskPrice(uint128 _currentPrice,uint128 _StaticTotal,uint128 _RiskTotal, uint128 _ETHTotal) 
			constant 
			returns (uint128 price)  {
	    /** @dev Allows users to query various hypothetical prices of RiskCoins in terms of base currency
          * @param _currentPrice Current price of ETH in Base currency.
          * @param _StaticTotal Total quantity of StatiCoins issued.
          * @param _RiskTotal Total quantity of invetor coins issued.
          * @param _ETHTotal Total quantity of ETH in the contract.
          * @return price of RiskCoins 
        */
        if(_ETHTotal == 0 || _RiskTotal==0){
			//Return the default price of _currentPrice * Multiplier
            return wmul( _currentPrice , Multiplier); 
        } else {
            if(hmore( wmul(_ETHTotal , _currentPrice),_StaticTotal)){ //_ETHTotal*_currentPrice>_StaticTotal
				//Risk price is positive
                return wdiv(wsub(wmul(_ETHTotal , _currentPrice) , _StaticTotal) , _RiskTotal); // (_ETHTotal * _currentPrice) - _StaticTotal) / _RiskTotal
            } else  {
				//RiskPrice is negative
                return 0;
            }
        }       
    }

    function LastRiskPrice() 
			constant 
			returns (uint128 price)  {
	   	/** @dev Allows users to query the last price of RiskCoins in terms of base currency
        	*   @return price of RiskCoins 
        	*/
        return RiskPrice(lastPrice);
    }     	   	
	
    function RiskPrice(uint128 _currentPrice) 
			constant 
			returns (uint128 price)  {
	    	/** @dev Allows users to query price of RiskCoins in terms of base currency, using current quantities of coins
          	  * @param _currentPrice Current price of ETH in Base currency.
	      	  * @return price of RiskCoins 
        	*/
        return RiskPrice(_currentPrice,cast(Static.totalSupply()),cast(Risk.totalSupply()),wsub(cast(this.balance),PendingETH));
    }     

	function Leverage() public 
			constant 
			returns (uint128)  {
		/** @dev Returns the ratio at which Riskcoin grows in value for the equivalent growth in ETH price
		* @return ratio
        	*/
        if(Risk.totalSupply()>0){
            return wdiv(wsub(cast(this.balance),PendingETH) , cast(Risk.totalSupply())); //  this.balance/Risk.totalSupply
        }else{
            return 0;
        }
    }

    function Strike() public 
			constant 
			returns (uint128)  {
		/** @dev Returns the current price at which the Risk price goes negative
		* @return Risk price in underlying per ETH
        	*/ 
        if(this.balance>0){
            return wdiv(cast(Static.totalSupply()) , cast(this.balance)); //Static.totalSupply / this.balance
        }else{
            return 0;            
        }
    }

	//****************************//
	// Only owner can access the following functions
    function setFee(uint128 _newFee) 
			onlyOwner {
        /** @dev Allows the minting fee to be changed, only owner can modify
	  * Fee is only charged on coin creation
          * @param _newFee Size of new fee
          * return nothing 
        */
        mintFee=_newFee;
    }

    function setCoins(address newRisk,address newStatic) 
			updates 
			onlyOwner 
			writeOnce {
        /** @dev only owner can modify once, Triggers the pricer to be updated 
          * @param newRisk Address of Riskcoin contract
          * @param newStatic Address of StatiCoin contract
          * return nothing 
        */
        Risk=I_coin(newRisk);
        Static=I_coin(newStatic);
	    PRICER_DELAY = 2 days;
    }
	
	//****************************//	
	// Only Pricer can access the following function
    function PriceReturn(uint _TransID,uint128 _Price) 
			onlyPricer {
	    	/** @dev Return function for the Pricer contract only.  Controls melting and minting of new coins.
             	 * @param _TransID Tranasction ID issued by the minter.
          	 * @param _Price Quantity of Base currency per ETH delivered by the Pricer contract
         	 * Nothing returned.  One of 4 functions is implemented
        	*/
	Trans memory details=pending[_TransID][0];//Get the details for this transaction. 
        if(0==_Price||frozen){ //If there is an error in pricing or contract is frozen, use the old price
            _Price=lastPrice;
        } else {
		if(Static.totalSupply()>0 && Risk.totalSupply()>0) {// dont update if there are coins missing
			lastPrice=_Price; // otherwise update the last price
		}
        }
	//Mint some new StatiCoins
        if(Action.NewStatic==details.action){
            ActionNewStatic(details,_TransID, _Price);
        }
	//Melt some old StatiCoins
        if(Action.RetStatic==details.action){
            ActionRetStatic(details,_TransID, _Price);
        }
	//Mint some new Riskcoins
        if(Action.NewRisk==details.action){
            ActionNewRisk(details,_TransID, _Price);
        }
	//Melt some old Riskcoins
        if(Action.RetRisk==details.action){
            ActionRetRisk(details,_TransID, _Price);
        }
	//Remove the transaction from the blockchain (saving some gas)
	TransCompleted=_TransID;
	delete pending[_TransID];
    }
	
	//****************************//
    // Only internal functions now
    function ActionNewStatic(Trans _details, uint _TransID, uint128 _Price) 
			internal {
		/** @dev Internal function to create new StatiCoins based on transaction data in the Pending queue.  If not enough spare StatiCoins are available then ETH is refunded.
         	 * @param _details Structure holding the amount sent (in ETH), the address of the person to sent to, and the type of request.
         	 * @param _TransID ID of the transaction (as stored in this contract).
         	 * @param _Price Current 24 hour average price as returned by the oracle in the pricer contract.
         	 * @return function returns nothing, but adds StatiCoins to the users address and events are created
        	*/
	//log0('NewStatic');
            
    	//if(Action.NewStatic<>_details.action){revert();}  //already checked

	uint128 CurRiskPrice=RiskPrice(_Price);
	uint128 AmountReturn;
	uint128 AmountMint;

	//Calculates the amount of ETH that can be added to create StatiCoins (excluding the amount already sent and stored in the contract)
	uint128 StaticAvail = StaticEthAvailable(cast(Risk.totalSupply()), wsub(cast(this.balance),PendingETH)); 
						
	// If the amount sent is less than the Static amount available, everything is fine.  Nothing needs to be returned.  
	if (wless(_details.amount,StaticAvail)) {
		// restrictions do not hamper the creation of a StatiCoin
		AmountMint = _details.amount;
		AmountReturn = 0;
	} else {
		// Amount of Static is less than amount requested.  
		// Take all the StatiCoins available.
		// Maybe there is zero Static available, so all will be returned.
		AmountMint = StaticAvail;
		AmountReturn = wsub(_details.amount , StaticAvail) ;
	}	
			
	if(0 == CurRiskPrice){
		// return all the ETH
		AmountReturn = _details.amount;
		//AmountMint = 0; //not required as Risk price = 0
	}
			
	//Static can be added when Risk price is positive and leverage is below the limit
            if(CurRiskPrice > 0  && StaticAvail>0 ){
                // Dont create if CurRiskPrice is 0 or there is no Static available (leverage is too high)
		//log0('leverageOK');
                Static.mintCoin(_details.holder, uint256(wmul(AmountMint , _Price))); //request coins from the Static creator contract
                EventCreateStatic(_details.holder, wmul(AmountMint , _Price), _TransID, _Price); // Event giving the holder address, coins created, transaction id, and price 
		PendingETH=wsub(PendingETH,AmountMint);
            } 

	if (AmountReturn>0) {
                // return some money because not enough StatiCoins are available
		bytes memory calldata; // define a blank `bytes`
                exec(_details.holder,calldata, AmountReturn);  //Refund ETH from this contract
		PendingETH=wsub(PendingETH,AmountReturn);
	}	
    }

    function ActionNewRisk(Trans _details, uint _TransID,uint128 _Price) 
			internal {
		/** @dev Internal function to create new Risk coins based on transaction data in the Pending queue.  Risk coins can only be created if the price is above zero
         	 * @param _details Structure holding the amount sent (in ETH), the address of the person to sent to, and the type of request.
        	 * @param _TransID ID of the transaction (as stored in this contract).
         	 * @param _Price Current 24 hour average price as returned by the oracle in the pricer contract.
         	 * @return function returns nothing, but adds Riskcoins to the users address and events are created
        	*/
        //log0('NewRisk');
        //if(Action.NewRisk<>_details.action){revert();}  //already checked
	// Get the Risk price using the amount of ETH in the contract before this transaction existed
	uint128 CurRiskPrice;
	if(wless(cast(this.balance),PendingETH)){
		CurRiskPrice=0;
	} else {
		CurRiskPrice=RiskPrice(_Price,cast(Static.totalSupply()),cast(Risk.totalSupply()),wsub(cast(this.balance),PendingETH));
	}
        if(CurRiskPrice>0){
            uint128 quantity=wdiv(wmul(_details.amount , _Price),CurRiskPrice);  // No of Riskcoins =  _details.amount * _Price / CurRiskPrice
            Risk.mintCoin(_details.holder, uint256(quantity) );  //request coins from the Riskcoin creator contract
            EventCreateRisk(_details.holder, quantity, _TransID, _Price); // Event giving the holder address, coins created, transaction id, and price 
        } else {
            // Don't create if CurRiskPrice is 0, Return all the ETH originally sent
            bytes memory calldata; // define a blank `bytes`
            exec(_details.holder,calldata, _details.amount);
        }
	PendingETH=wsub(PendingETH,_details.amount);
    }


    function ActionRetStatic(Trans _details, uint _TransID,uint128 _Price) 
			internal {
		/** @dev Internal function to Return StatiCoins based on transaction data in the Pending queue.  Static can be returned at any time.
          * @param _details Structure holding the amount sent (in ETH), the address of the person to sent to, and the type of request.
          * @param _TransID ID of the transaction (as stored in this contract).
          * @param _Price Current 24 hour average price as returned by the oracle in the pricer contract.
          * @return function returns nothing, but removes StatiCoins from the user's address, sends ETH and events are created
        */
		//if(Action.RetStatic<>_details.action){revert();}  //already checked
		//log0('RetStatic');
		uint128 _ETHReturned;
		if(0==Risk.totalSupply()){_Price=lastPrice;} //No Risk coins for balance so use fixed price
        _ETHReturned = wdiv(_details.amount , _Price); //_details.amount / _Price
        if (Static.meltCoin(_details.holder,_details.amount)){
            // deducted first, will add back if Returning ETH goes wrong.
            EventRedeemStatic(_details.holder,_details.amount ,_TransID, _Price);
            if (wless(cast(this.balance),_ETHReturned)) {
                 _ETHReturned=cast(this.balance);//Not enough ETH available.  Return all Eth in the contract
            }
			bytes memory calldata; // define a blank `bytes`
            if (tryExec(_details.holder, calldata, _ETHReturned)) { 
				//ETH returned successfully
			} else {
				// there was an error, so add back the amount previously deducted
				Static.mintCoin(_details.holder,_details.amount); //Add back the amount requested
				EventCreateStatic(_details.holder,_details.amount ,_TransID, _Price);  //redo the creation event
			}
			if ( 0==this.balance) {
				Bankrupt();
			}
        }        
    }

    function ActionRetRisk(Trans _details, uint _TransID,uint128 _Price) 
			internal {
		/** @dev Internal function to Return Riskcoins based on transaction data in the Pending queue.  Riskcoins can be returned so long as the Risk price is greater than 0.
          * @param _details Structure holding the amount sent (in ETH), the address of the person to sent to, and the type of request.
          * @param _TransID ID of the transaction (as stored in this contract).
          * @param _Price Current 24 hour average price as returned by the oracle in the Pricer contract.
          * @return function returns nothing, but removes RiskCoins from the users address, sends ETH and events are created
        */        
		//if(Action.RetRisk<>_details.action){revert();}  //already checked
		//log0('RetRisk');
        uint128 _ETHReturned;
		uint128 CurRiskPrice;
		// no StatiCoins, so all Risk coins are worth the same, so _ETHReturned = _details.amount / _RiskTotal * _ETHTotal
		CurRiskPrice=RiskPrice(_Price);
        if(CurRiskPrice>0){
            _ETHReturned = wdiv( wmul(_details.amount , CurRiskPrice) , _Price); // _details.amount * CurRiskPrice / _Price
            if (Risk.meltCoin(_details.holder,_details.amount )){
                // Coins are deducted first, will add back if returning ETH goes wrong.
                EventRedeemRisk(_details.holder,_details.amount ,_TransID, _Price);
                if ( wless(cast(this.balance),_ETHReturned)) { // should never happen, but just in case
                     _ETHReturned=cast(this.balance);
                }
				bytes memory calldata; // define a blank `bytes`
                if (tryExec(_details.holder, calldata, _ETHReturned)) { 
					//Returning ETH went ok.  
                } else {
                    // there was an error, so add back the amount previously deducted from the Riskcoin contract
                    Risk.mintCoin(_details.holder,_details.amount);
                    EventCreateRisk(_details.holder,_details.amount ,_TransID, _Price);
                }
            } 
        }  else {
            // Risk price is zero so can't do anything.  Call back and delete the transaction from the contract
        }
    }

	function IsWallet(address _address) 
			internal 
			returns(bool){
		/**
		* @dev checks that _address is not a contract.  
		* @param _address to check 
		* @return True if not a contract, 
		*/		
		uint codeLength;
		assembly {
            // Retrieve the size of the code on target address, this needs assembly .
            codeLength := extcodesize(_address)
        }
		return(0==codeLength);		
    } 

	function RetCoinInternal(uint128 _Quantity, uint128 _AmountETH, address _user, Action _action) 
			internal 
			updates 
			returns (uint _TransID)  {
        /** @dev Requests coins be melted and ETH returned
		  * @param _Quantity of Static or Risk coins to be melted
		  * @param _AmountETH Amount of ETH sent to this contract to cover oracle fee.  Excess is returned.
          * @param _user Address to whom the returned ETH will be sent.
		  * @param _action Allows Static or Risk coins to be returned
		  * @return transaction ID which can be viewed in the Pending mapping
        */
		require(IsWallet(_user));
		uint128 refund;
        	uint128 Fee=pricer.queryCost();  //Get the cost of querying the pricer contract
		if(wless(_AmountETH,Fee)){
			revert();  //log0('Not enough ETH to mint');
			} else {
			refund=wsub(_AmountETH,Fee);//Returning coins has had too much ETH sent, so return it.
		}
		if(0==_Quantity){revert();}// quantity has to be non zero
		TransID++;

		uint PricerID = pricer.requestPrice.value(uint256(Fee))(TransID);  //Ask the pricer to get the price.  The Fee also cover calling the function PriceReturn at a later time.
		pending[TransID].push(Trans(_Quantity,_user,_action,bytes32(PricerID)));  //Add a transaction to the Pending queue.
		_TransID=TransID;  //return the transaction ID to the user 
		_user.transfer(uint256(refund)); //Return ETH if too much has been sent to cover the pricer
    }
		
	function NewCoinInternal(address _user, uint128 _amount, Action _action) 
			internal 
			updates 
			LockIfUnwritten 
			LockIfFrozen  
			returns (uint _TransID)  {
		/** @dev Requests new coins be made
          	  * @param _user Address for whom the coins are to be created
          	  * @param _amount Amount of eth sent to this contract
		  * @param _action Allows Static or Risk coins to be minted
		  * @return transaction ID which can be viewed in the pending mapping
       		*/
       	require(pricer==future);
	require(IsWallet(_user));
	uint128 toCredit;
        uint128 Fee=wmax(wmul(_amount,mintFee),pricer.queryCost()); // fee is the maxium of the pricer query cost and a mintFee% of value sent
        if(wless(_amount,Fee)) revert(); //log0('Not enough ETH to mint');
		TransID++;
        	uint PricerID = pricer.requestPrice.value(uint256(Fee))(TransID); //Ask the pricer to return the price
		toCredit=wsub(_amount,Fee);
		pending[TransID].push(Trans(toCredit,_user,_action,bytes32(PricerID))); //Store the transaction ID and data ready for later recall
		PendingETH=wadd(PendingETH,toCredit);
        	_TransID=TransID;//return the transaction ID for this contract to the user 		
	} 

    function Bankrupt() 
			internal {
			EventBankrupt();
			// Reset the contract
			Static.kill();  //delete all current Static tokens
			Risk.kill();  //delete all current Risk tokens
			//need to create new coins externally, too much gas is used if done here.  
			frozen=false;
			written=false;  // Reset the writeOnce and LockIfUnwritten modifiers
    }
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"_currentPrice","type":"uint128"},{"name":"_StaticTotal","type":"uint128"},{"name":"_RiskTotal","type":"uint128"},{"name":"_ETHTotal","type":"uint128"}],"name":"RiskPrice","outputs":[{"name":"price","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPrice","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"frozen","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"mintFee","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"NewRisk","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"TransCompleted","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newAddress","type":"address"}],"name":"setPricer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Static","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newFee","type":"uint128"}],"name":"setFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_Quantity","type":"uint128"}],"name":"RetStatic","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"Bailout","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"Leverage","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_Quantity","type":"uint128"}],"name":"RetRisk","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"newRisk","type":"address"},{"name":"newStatic","type":"address"}],"name":"setCoins","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_currentPrice","type":"uint128"}],"name":"RiskPrice","outputs":[{"name":"price","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint128"},{"name":"y","type":"uint128"}],"name":"wsub","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Risk","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"Freeze","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Currency","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint128"},{"name":"y","type":"uint128"}],"name":"wadd","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"NewStatic","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"}],"name":"NewRiskAdr","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"Strike","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint128"},{"name":"y","type":"uint128"}],"name":"wmul","outputs":[{"name":"z","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TransID","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"}],"name":"NewStaticAdr","outputs":[{"name":"_TransID","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"future","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"pending","outputs":[{"name":"amount","type":"uint128"},{"name":"holder","type":"address"},{"name":"action","type":"uint8"},{"name":"pricerID","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pricer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"changeOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"LastRiskPrice","outputs":[{"name":"price","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"levToll","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"releaseTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_TransID","type":"uint256"},{"name":"_Price","type":"uint128"}],"name":"PriceReturn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"StaticEthAvailable","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PRICER_DELAY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_RiskTotal","type":"uint128"},{"name":"_TotalETH","type":"uint128"}],"name":"StaticEthAvailable","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PendingETH","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Multiplier","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_currency","type":"string"},{"name":"_Multiplier","type":"uint128"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_value","type":"uint128"},{"indexed":false,"name":"_transactionID","type":"uint256"},{"indexed":false,"name":"_Price","type":"uint256"}],"name":"EventCreateStatic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_value","type":"uint128"},{"indexed":false,"name":"_transactionID","type":"uint256"},{"indexed":false,"name":"_Price","type":"uint256"}],"name":"EventRedeemStatic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_value","type":"uint128"},{"indexed":false,"name":"_transactionID","type":"uint256"},{"indexed":false,"name":"_Price","type":"uint256"}],"name":"EventCreateRisk","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_value","type":"uint128"},{"indexed":false,"name":"_transactionID","type":"uint256"},{"indexed":false,"name":"_Price","type":"uint256"}],"name":"EventRedeemRisk","type":"event"},{"anonymous":false,"inputs":[],"name":"EventBankrupt","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_timeChange","type":"uint256"}],"name":"EventAddressChange","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526000805461ff0060b060020a60ff0201191681556002600455600655600b80547706f05b59d3b20000000000000000000000000000000000006001608060020a03909116179055600c80546001608060020a03191666071afd498d000017905534156200007057600080fd5b6040516200284638038062002846833981016040528080518201919060200180516000805461010060b060020a0319166201000033600160a060020a031602179055915060089050828051620000cb929160200190620000f3565b50600b80546001608060020a0319166001608060020a03929092169190911790555062000198565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200013657805160ff191683800117855562000166565b8280016001018555821562000166579182015b828111156200016657825182559160200191906001019062000149565b506200017492915062000178565b5090565b6200019591905b808211156200017457600081556001016200017f565b90565b61269e80620001a86000396000f3006060604052600436106101c85763ffffffff60e060020a6000350416626f91d281146101d8578063053f14da14610225578063054f7d9c1461023857806313966db51461025f578063199f4045146102725780631c67a7aa1461028c578063293903701461029f57806331b8b100146102c05780633687f24a146102ef5780633cad71cf1461030e57806343acd7bc1461032257806343e0dfdd1461032a578063450b60791461033d5780634863ed97146103515780635040012814610376578063523d897e146103955780635f429ba5146103ba578063615acbae146103cd5780636942eac7146103e057806369a046f21461046a5780637af0ed7e1461048f5780637e7388b11461049757806381531c64146104ab5780638f1eda37146104be57806399eb975c146104e3578063a046c5f6146104f6578063a2ec258f1461050a578063a30a71711461051d578063a6138ed914610583578063a6f9dae114610596578063aa4ee730146105b5578063abbc5d2a146105c8578063b91d4001146105db578063e5d02cd0146105ee578063ec4baa8314610610578063ed6b40c014610623578063f1914dc514610636578063fd2e9caf1461065b578063fd9b87631461066e575b34156101d357600080fd5b600080fd5b34156101e357600080fd5b6102096001608060020a0360043581169060243581169060443581169060643516610681565b6040516001608060020a03909116815260200160405180910390f35b341561023057600080fd5b610209610703565b341561024357600080fd5b61024b610712565b604051901515815260200160405180910390f35b341561026a57600080fd5b610209610722565b61027a610731565b60405190815260200160405180910390f35b341561029757600080fd5b61027a61074c565b34156102aa57600080fd5b6102be600160a060020a0360043516610752565b005b34156102cb57600080fd5b6102d36107e8565b604051600160a060020a03909116815260200160405180910390f35b34156102fa57600080fd5b6102be6001608060020a03600435166107f7565b61027a6001608060020a036004351661083d565b6102be6108e2565b341561033557600080fd5b6102096108e4565b61027a6001608060020a0360043516610a01565b341561035c57600080fd5b6102be600160a060020a0360043581169060243516610a95565b341561038157600080fd5b6102096001608060020a0360043516610b4a565b34156103a057600080fd5b6102096001608060020a0360043581169060243516610c05565b34156103c557600080fd5b6102d3610c1a565b34156103d857600080fd5b6102be610c29565b34156103eb57600080fd5b6103f3610c6e565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561042f578082015183820152602001610417565b50505050905090810190601f16801561045c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047557600080fd5b6102096001608060020a0360043581169060243516610d0c565b61027a610d18565b61027a600160a060020a0360043516610d2e565b34156104b657600080fd5b610209610d3d565b34156104c957600080fd5b6102096001608060020a0360043581169060243516610db4565b34156104ee57600080fd5b61027a610de2565b61027a600160a060020a0360043516610de8565b341561051557600080fd5b6102d3610df7565b341561052857600080fd5b610536600435602435610e06565b6040516001608060020a0385168152600160a060020a03841660208201526040810183600381111561056457fe5b60ff168152602081019290925250604090810193509150505180910390f35b341561058e57600080fd5b6102d3610e66565b34156105a157600080fd5b6102be600160a060020a0360043516610e75565b34156105c057600080fd5b610209610ec6565b34156105d357600080fd5b610209610ede565b34156105e657600080fd5b61027a610ef4565b34156105f957600080fd5b6102be6004356001608060020a0360243516610efa565b341561061b57600080fd5b61020961118c565b341561062e57600080fd5b61027a6111f9565b341561064157600080fd5b6102096001608060020a03600435811690602435166111ff565b341561066657600080fd5b61020961125c565b341561067957600080fd5b610209611272565b60006001608060020a03821615806106a057506001608060020a038316155b156106c357600b546106bc9086906001608060020a0316610db4565b90506106fb565b6106d66106d08387610db4565b85611281565b156106f7576106bc6106f16106eb8488610db4565b86610c05565b84611292565b5060005b949350505050565b6005546001608060020a031681565b60005460b060020a900460ff1681565b600c546001608060020a031681565b600061074733610740346112d5565b60026112e8565b905090565b60075481565b60005433600160a060020a03908116620100009092041614156107e557600454420160038190556002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169190911791829055600154918116929116907f72511fb4cdbe5b0188562edd69ff06f12e0966e9246eefc6754e67ba0de954a69060405190815260200160405180910390a35b50565b600954600160a060020a031681565b60005433600160a060020a03908116620100009092041614156107e557600c80546001608060020a0383166fffffffffffffffffffffffffffffffff1990911617905550565b60008054610100900460ff16151561085457600080fd5b60005460b060020a900460ff16156108c5576006805460010190556108bc608060405190810160409081526001608060020a0385168252600160a060020a033316602083015281016001815260006020909101526006546005546001608060020a0316611602565b506006546108dd565b6108da826108d2346112d5565b336001611903565b90505b919050565b565b600a546000908190600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561093057600080fd5b6102c65a03f1151561094157600080fd5b5050506040518051905011156109fa576109f361098261096a30600160a060020a0316316112d5565b600554608060020a90046001608060020a0316610c05565b600a546109ee90600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b6102c65a03f115156109df57600080fd5b505050604051805190506112d5565b611292565b90506109fe565b5060005b90565b60008054610100900460ff161515610a1857600080fd5b60005460b060020a900460ff1615610a80576006805460010190556108bc608060405190810160409081526001608060020a0385168252600160a060020a033316602083015281016003815260006020909101526006546005546001608060020a0316611bc9565b6108da82610a8d346112d5565b336003611903565b60035442118015610ab75750600254600154600160a060020a03908116911614155b15610ac457610ac4611e61565b60005433600160a060020a0390811662010000909204161415610b4657600054610100900460ff161515610b46576000805461ff001916610100179055600a8054600160a060020a0380851673ffffffffffffffffffffffffffffffffffffffff199283161790925560098054928416929091169190911790556202a3006004555b5050565b6009546000906108da908390610b9e90600160a060020a03166318160ddd85604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b600a54610bea90600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b610c0061096a30600160a060020a0316316112d5565b610681565b6000610c118383611eb2565b90505b92915050565b600a54600160a060020a031681565b60005433600160a060020a03908116620100009092041614156108e2576000805476ff00000000000000000000000000000000000000000000191660b060020a179055565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d045780601f10610cd957610100808354040283529160200191610d04565b820191906000526020600020905b815481529060010190602001808311610ce757829003601f168201915b505050505081565b6000610c118383611ece565b600061074733610d27346112d5565b60006112e8565b60006108da82610740346112d5565b60008030600160a060020a03163111156109fa576009546109f390610da190600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b6109ee30600160a060020a0316316112d5565b6000610c11670de0b6b3a76400006001608060020a03858116908516026706f05b59d3b20000015b046112d5565b60065481565b60006108da82610d27346112d5565b600254600160a060020a031681565b600d60205281600052604060002081815481101515610e2157fe5b60009182526020909120600390910201805460018201546002909201546001608060020a039091169350600160a060020a038216925060a060020a90910460ff169084565b600154600160a060020a031681565b60005433600160a060020a03908116620100009092041614156107e55760008054600160a060020a038316620100000275ffffffffffffffffffffffffffffffffffffffff00001990911617905550565b600554600090610747906001608060020a0316610b4a565b600b54608060020a90046001608060020a031681565b60035481565b610f02612594565b60015433600160a060020a03908116911614610f1d57600080fd5b6000838152600d6020526040812080549091908110610f3857fe5b90600052602060002090600302016080604051908101604090815282546001608060020a031682526001830154600160a060020a03811660208401529192919083019060a060020a900460ff166003811115610f9057fe5b6003811115610f9b57fe5b81526002919091015460209091015290506001608060020a0382161580610fcb575060005460b060020a900460ff165b15610fe3576005546001608060020a031691506110e1565b600954600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561102d57600080fd5b6102c65a03f1151561103e57600080fd5b505050604051805190501180156110b75750600a54600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561109a57600080fd5b6102c65a03f115156110ab57600080fd5b50505060405180519050115b156110e157600580546fffffffffffffffffffffffffffffffff19166001608060020a0384161790555b806040015160038111156110f157fe5b151561110257611102818484611eea565b8060400151600381111561111257fe5b6001141561112557611125818484611602565b8060400151600381111561113557fe5b6002141561114857611148818484612176565b8060400151600381111561115857fe5b6003141561116b5761116b818484611bc9565b60078390556000838152600d60205260408120611187916125bb565b505050565b600a54600090610747906111de90600160a060020a03166318160ddd84604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b6111f461096a30600160a060020a0316316112d5565b6111ff565b60045481565b600b54600090819061122e90611228906001608060020a0380821691608060020a900416610d0c565b85610db4565b905061123a838261238d565b15611250576112498184610c05565b9150611255565b600091505b5092915050565b600554608060020a90046001608060020a031681565b600b546001608060020a031681565b6001608060020a0390811691161190565b6000610c116001608060020a038316600281046001608060020a0316670de0b6b3a76400006001608060020a0316866001608060020a03160201811515610ddc57fe5b806001608060020a03811681146108dd57fe5b600080600080600354421180156113105750600254600154600160a060020a03908116911614155b1561131d5761131d611e61565b600054610100900460ff16151561133357600080fd5b60005460b060020a900460ff161561134a57600080fd5b600254600154600160a060020a0390811691161461136757600080fd5b61137087612399565b151561137b57600080fd5b600c546113fe906113969088906001608060020a0316610db4565b600154600160a060020a031663fd557d396000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156113de57600080fd5b6102c65a03f115156113ef57600080fd5b5050506040518051905061239e565b915061140a868361238d565b1561141457600080fd5b6006805460019081019182905554600160a060020a03169063cd7c92e3906001608060020a0385169060006040516020015260405160e060020a63ffffffff851602815260048101919091526024016020604051808303818588803b151561147b57600080fd5b6125ee5a03f1151561148c57600080fd5b505050506040518051905090506114a38683610c05565b6006546000908152600d60205260409020805491945090600181016114c883826125dc565b91600052602060002090600302016000608060405190810160405280876001608060020a031681526020018b600160a060020a0316815260200189600381111561150e57fe5b8152602001859052919050815181546fffffffffffffffffffffffffffffffff19166001608060020a0391909116178155602082015160018201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055604082015160018201805474ff0000000000000000000000000000000000000000191660a060020a8360038111156115a757fe5b0217905550606082015160029091015550506005546115d7906001608060020a03608060020a9091041684610d0c565b600580546001608060020a03928316608060020a029216919091179055505060065495945050505050565b600061160c612608565b600a54600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561165457600080fd5b6102c65a03f1151561166557600080fd5b505050604051805115159050611684576005546001608060020a031692505b61168f855184611292565b600954909250600160a060020a0316633188da5f6020870151875160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526001608060020a03166024820152604401602060405180830381600087803b15156116ff57600080fd5b6102c65a03f1151561171057600080fd5b50505060405180519050156118fc578460200151600160a060020a03167f6fd7c035b051359dd43c2afdd6a7cd91e94ff855b47178226114ae6ad62019158651868660405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a26117ac6117a630600160a060020a0316316112d5565b8361238d565b156117c7576117c430600160a060020a0316316112d5565b91505b6117df856020015182846001608060020a03166123aa565b156117e9576118e3565b600954600160a060020a031663ec1553d16020870151875160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526001608060020a03166024820152604401602060405180830381600087803b151561185657600080fd5b6102c65a03f1151561186757600080fd5b505050604051805150506020850151600160a060020a03167fb0acd745b723702a9bfc3ecc8b4646c5ac97f4e1e23159ef5d4f1d9e4a5bc20d8651868660405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a25b600160a060020a0330163115156118fc576118fc612452565b5050505050565b6000806000806003544211801561192b5750600254600154600160a060020a03908116911614155b1561193857611938611e61565b61194186612399565b151561194c57600080fd5b600154600160a060020a031663fd557d396000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561199457600080fd5b6102c65a03f115156119a557600080fd5b5050506040518051905091506119bb878361238d565b156119c557600080fd5b6119cf8783610c05565b92506001608060020a03881615156119e657600080fd5b6006805460019081019182905554600160a060020a03169063cd7c92e3906001608060020a0385169060006040516020015260405160e060020a63ffffffff851602815260048101919091526024016020604051808303818588803b1515611a4d57600080fd5b6125ee5a03f11515611a5e57600080fd5b5050505060405180516006546000908152600d602052604090208054919350915060018101611a8d83826125dc565b916000526020600020906003020160006080604051908101604052808c6001608060020a031681526020018a600160a060020a03168152602001896003811115611ad357fe5b8152602001859052919050815181546fffffffffffffffffffffffffffffffff19166001608060020a0391909116178155602082015160018201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055604082015160018201805474ff0000000000000000000000000000000000000000191660a060020a836003811115611b6c57fe5b0217905550606082015160029091015550506006549350600160a060020a0386166001608060020a03841680156108fc0290604051600060405180830381858888f193505050501515611bbe57600080fd5b505050949350505050565b600080611bd4612608565b611bdd84610b4a565b91506000826001608060020a03161115611e5957611c05611bff875184610db4565b85611292565b600a54909350600160a060020a0316633188da5f6020880151885160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526001608060020a03166024820152604401602060405180830381600087803b1515611c7557600080fd5b6102c65a03f11515611c8657600080fd5b5050506040518051905015611e59578560200151600160a060020a03167f2bf29ddb760902da82c4a7d4c99ea87ebe386522729cd506a4132616a2d31d498751878760405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a2611d22611d1c30600160a060020a0316316112d5565b8461238d565b15611d3d57611d3a30600160a060020a0316316112d5565b92505b611d55866020015182856001608060020a03166123aa565b15611d5f57611e59565b600a54600160a060020a031663ec1553d16020880151885160006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526001608060020a03166024820152604401602060405180830381600087803b1515611dcc57600080fd5b6102c65a03f11515611ddd57600080fd5b505050604051805150506020860151600160a060020a03167f4767d305988b74d0d1c7ee0df66fa1609b9c4602fda0a1bf8a62525e4a8712878751878760405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a25b505050505050565b6002546001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790556000805476ff0000000000000000000000000000000000000000000019169055565b8082036001608060020a038084169082161115610c1457600080fd5b8082016001608060020a038084169082161015610c1457600080fd5b600080600080611ef8612608565b611f0186610b4a565b600a54909550611f54906111de90600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b9150611f6188518361238d565b15611f73578751925060009350611f87565b819250611f84886000015183610c05565b93505b6001608060020a0385161515611f9c57875193505b6000856001608060020a0316118015611fbe57506000826001608060020a0316115b1561210757600954600160a060020a031663ec1553d160208a0151611fe3868a610db4565b6001608060020a031660006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561203857600080fd5b6102c65a03f1151561204957600080fd5b505050604051805150506020880151600160a060020a03167fb0acd745b723702a9bfc3ecc8b4646c5ac97f4e1e23159ef5d4f1d9e4a5bc20d61208c8589610db4565b898960405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a26005546120e990608060020a90046001608060020a031684610c05565b600580546001608060020a03928316608060020a0292169190911790555b6000846001608060020a0316111561216c57612131886020015182866001608060020a0316612547565b60055461214e90608060020a90046001608060020a031685610c05565b600580546001608060020a03928316608060020a0292169190911790555b5050505050505050565b600080612181612608565b6121af61219730600160a060020a0316316112d5565b600554608060020a90046001608060020a031661238d565b156121bd5760009250612212565b60095461220f908590610b9e90600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ce57600080fd5b92505b6000836001608060020a03161115612331576122326106f1875186610db4565b600a54909250600160a060020a031663ec1553d16020880151846001608060020a031660006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156122a157600080fd5b6102c65a03f115156122b257600080fd5b505050604051805150506020860151600160a060020a03167f4767d305988b74d0d1c7ee0df66fa1609b9c4602fda0a1bf8a62525e4a87128783878760405180846001608060020a03166001608060020a03168152602001838152602001826001608060020a03168152602001935050505060405180910390a261234a565b61234a86602001518288516001608060020a0316612547565b60055461236890608060020a90046001608060020a03168751610c05565b600580546001608060020a03928316608060020a029216919091179055505050505050565b6000610c11838361255a565b3b1590565b6000610c11838361256b565b6000805460ff16156123b857fe5b6000805460ff19166001179055600160a060020a038416828460405180828051906020019080838360005b838110156123fb5780820151838201526020016123e3565b50505050905090810190601f1680156124285780820380516001836020036101000a031916815260200191505b5091505060006040518083038185876187965a03f16000805460ff19169055979650505050505050565b7f1e8b0d0312f1460e51ac6b837afad37961ea4017b27d965346bda0e1df6c78c260405160405180910390a1600954600160a060020a03166341c0e1b56040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156124bd57600080fd5b6102c65a03f115156124ce57600080fd5b5050600a54600160a060020a031690506341c0e1b56040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561251157600080fd5b6102c65a03f1151561252257600080fd5b50506000805476ff0000000000000000000000000000000000000000ff001916905550565b6125528383836123aa565b151561118757fe5b6001608060020a0390811691161090565b6000816001608060020a0316836001608060020a0316101561258d5781610c11565b5090919050565b60806040519081016040908152600080835260208301819052908201819052606082015290565b50805460008255600302906000526020600020908101906107e5919061261a565b81548183558181151161118757600302816003028360005260206000209182019101611187919061261a565b60206040519081016040526000815290565b6109fe91905b8082111561266e5780546fffffffffffffffffffffffffffffffff1916815560018101805474ffffffffffffffffffffffffffffffffffffffffff1916905560006002820155600301612620565b50905600a165627a7a72305820cc8ad722da94a4f89fa805cc1d3248ef62f9a48b458581469342d58ad326603a0029000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000014d1120d7b160000000000000000000000000000000000000000000000000000000000000000000d4554484a5059204d696e74657200000000000000000000000000000000000000

   Swarm Source:
bzzr://cc8ad722da94a4f89fa805cc1d3248ef62f9a48b458581469342d58ad326603a

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward