This file contains 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
pragma solidity ^0.4.8; | |
// import "./StandardToken.sol"; | |
import 'zeppelin-solidity/contracts/token/VestedToken.sol'; | |
import 'zeppelin-solidity/contracts/SafeMath.sol'; | |
contract CDTToken is VestedToken { | |
using SafeMath for uint; | |
//FIELDS | |
//CONSTANTS |
This file contains 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
0x0092781f6397a37ed76038503741aa6CaCEFf90D |
This file contains 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
0x87252ea7D298b1c822e791931AFeFb2a6DDD00f7 |
This file contains 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
# evaluate the equation y=x^3+x+5 for x | |
def qeval(x): | |
return x^3+x+5 |
This file contains 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
// example grpc for fetching minimal slashing data from Prsym's slasher | |
address := "<slasher_address>:<slasher_port>" | |
conn, err := grpc.Dial(address, grpc.WithInsecure()) | |
if err != nil { | |
fmt.Printf("%s", err.Error()) | |
return | |
} | |
defer conn.Close() | |
client := slashpb.NewSlasherClient(conn) |
This file contains 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
def get_attestation_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], Sequence[Gwei]]: | |
""" | |
Return attestation reward/penalty deltas for each validator. | |
""" | |
source_rewards, source_penalties = get_source_deltas(state) | |
target_rewards, target_penalties = get_target_deltas(state) | |
head_rewards, head_penalties = get_head_deltas(state) | |
inclusion_delay_rewards, _ = get_inclusion_delay_deltas(state) | |
_, inactivity_penalties = get_inactivity_penalty_deltas(state) |
This file contains 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
def get_attestation_component_deltas(state: BeaconState, | |
attestations: Sequence[PendingAttestation] | |
) -> Tuple[Sequence[Gwei], Sequence[Gwei]]: | |
""" | |
Helper with shared logic for use by get source, target, and head deltas functions | |
""" | |
rewards = [Gwei(0)] * len(state.validators) | |
penalties = [Gwei(0)] * len(state.validators) | |
total_balance = get_total_active_balance(state) | |
unslashed_attesting_indices = get_unslashed_attesting_indices(state, attestations) |
This file contains 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
def get_attestation_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], Sequence[Gwei]]: | |
""" | |
Return attestation reward/penalty deltas for each validator. | |
""" | |
source_rewards, source_penalties = get_source_deltas(state) | |
target_rewards, target_penalties = get_target_deltas(state) | |
head_rewards, head_penalties = get_head_deltas(state) | |
inclusion_delay_rewards, _ = get_inclusion_delay_deltas(state) | |
_, inactivity_penalties = get_inactivity_penalty_deltas(state) |
This file contains 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
def get_base_reward(state: BeaconState, index: ValidatorIndex) -> Gwei: | |
total_balance = get_total_active_balance(state) | |
effective_balance = state.validators[index].effective_balance | |
return Gwei(effective_balance * BASE_REWARD_FACTOR // integer_squareroot(total_balance) // BASE_REWARDS_PER_EPOCH) |
This file contains 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
def is_in_inactivity_leak(state: BeaconState) -> bool: | |
return get_finality_delay(state) > MIN_EPOCHS_TO_INACTIVITY_PENALTY |
OlderNewer