/* Copyright 2017-2018 RigoBlock, Rigo Investment Sagl. 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. */ pragma solidity ^0.4.21; pragma experimental "v0.5.0"; /// @title Casper - Interface of the casper contract. /// @author Gabriele Rigo - /// @notice ptublic casper functions expressed as external interface Casper { // EVENTS event Deposit( address indexed _from, uint128 indexed _validator_index, address _validation_address, uint128 _start_dyn, uint128 _amount ); event Vote( address indexed _from, uint128 indexed _validator_index, bytes32 indexed _target_hash, uint128 _target_epoch, uint128 _source_epoch ); event Logout( address indexed _from, uint128 indexed _validator_index, uint128 _end_dyn ); event Withdraw( address indexed _to, uint128 indexed _validator_index, uint128 _amount ); event Slash( address indexed _from, address indexed _offender, uint128 indexed _offender_index, uint128 _bounty, uint128 _destroyed ); event Epoch( uint128 indexed _number, bytes32 indexed _checkpoint_hash, bool _is_justified, bool _is_finalized ); // CORE FUNCTIONS function initiate_epoch(uint128 epoch) external; function deposit(address validation_addr, address withdrawal_addr) external payable; function logout(bytes logout_msg) external; function withdraw(uint128 validator_index) external; function vote(bytes vote_msg) external; function slash(bytes vote_msg_1, bytes vote_msg_2) external; // CONSTANT PUBLIC FUNCTIONS function main_hash_voted_frac() constant external returns (fixed); // returns a decimal function deposit_size(uint128 _validator_index) constant external returns (uint128); // returns wei value function get_total_curdyn_deposits() constant external returns (uint128); // returns wei value function get_total_prevdyn_deposits() constant external returns (uint128); //returns wei value function recommended_source_epoch() constant external returns (uint128); function recommended_target_hash() constant external returns (bytes32); // IMPLIED CONSTANT PUBLIC FUNCTIONS /// @notice they get auto-generated by viper when a variable is declared external function validators__deposit(uint128 arg0) constant external returns (fixed); // returns a decimal function validators__start_dynasty(uint128 arg0) constant external returns (uint128); function validatos__end_dynasty(uint128 arg0) constant external returns (uint128); function validators__addr(uint128 arg0) constant external returns (address); function validators__withdrawal_address(uint128 arg0) constant external returns (address); function checkpoint_hashes(uint128 arg0) constant external returns (bytes32); function nextValidatorIndex() constant external returns (uint128); function validator_indexes(address arg0) constant external returns (uint128); function dynasty() constant external returns (uint128); function next_dynasty_wei_delta() external returns (fixed); // returns a decimal function second_next_dynasty_wei_delta() external returns (fixed); // returns a decimal function dynasty_start_epoch(uint128 arg0) constant external returns (uint128); function dynasty_in_epoch(uint128 arg0) constant external returns (uint128); function votes__cur_dyn_votes(uint128 arg0, uint128 arg1) constant external returns (fixed); // returns a decimal function votes__prev_dyn_votes(uint128 arg0, uint128 arg1) constant external returns (fixed); // returns a decimal function votes__vote_bitmap(uint128 arg0, bytes arg1, uint128 arg2) constant external returns (uint256); function votes__is_justified(uint128 arg0) constant external returns (bool); function votes__is_finalized(uint128 arg0) constant external returns (bool); function main_hash_justified() constant external returns (bool); function deposit_scale_factor(uint128 arg0) constant external returns (fixed); //returns a decimal function last_nonvoter_rescale() constant external returns (fixed); //returns a decimal function last_voter_rescale() constant external returns (fixed); //returns a decimal function epoch_length() constant external returns (uint128); function withdrawal_delay() constant external returns (uint128); function current_epoch() constant external returns (uint128); function last_finalized_epoch() constant external returns (uint128); function last_justified_epoch() constant external returns (uint128); function expected_source_epoch() constant external returns (uint128); function reward_factor() constant external returns (fixed); //returns a decimal function base_interest_factor() constant external returns (fixed); //returns a decimal function base_penalty_factor() constant external returns (fixed); //returns a decimal }