abstract contract _Vote is ERC20_Utils, Uni_Price_v2 { using SafeMath for uint256;
address public DeFiat_Gov; //governance contract
string public voteName; // name to describe the vote uint256 public voteStart; // UTC timestamp for voteStart uint256 public voteEnd; // UTC timestamp for voteEnd bool public decisionActivated; // track whether decision has been activated
uint256 public quorum; // x / 100 = required % of votes / voting power for vote to be actionable uint256 public totalVotes; // total votes cast uint256[] public voteChoices; // array of choices to vote for address public rewardToken; // address of reward token uint256 public rewardAmount; // amount of token reward
uint internal stackPointer; // pointer for staking pool ...
//Structs struct PoolMetrics { address stakedToken; uint256 staked; // sum of tokens staked in the contract uint256 stakingFee; // entry fee
uint256 stakingPoints;
address rewardToken; uint256 rewards; // current rewards in the pool
uint256 startTime; // when the pool opens uint256 closingTime; // when the pool closes. uint256 duration; // duration of the staking uint256 lastEvent; // last time metrics were updated.
uint256 ratePerToken; // CALCULATED pool reward Rate per Token (calculated based on total stake and time) }
struct UserMetrics { uint256 stake; // native token stake (balanceOf) uint256 stakingPoints; // staking points at lastEvent uint256 poolPoints; // pool point at lastEvent uint256 lastEvent;
uint256 rewardAccrued; // accrued rewards over time based on staking points ...
/*Readme: This contract needs to be registered as a "governor" in the governing contract. Below are the functions that can be used to generate a vote
COPY PASTE THESE //== SET EXTERNAL VARIABLES on the DeFiat_Gov contract == function setActorLevel(address _address, uint256 _newLevel) external; function changeBurnRate(uint _burnRate) external; function changeFeeRate(uint _feeRate) external; function setFeeDestination(address _nextDest) external;
//== SET EXTERNAL VARIABLES on the DeFiat_Points contract == function setTxTreshold(uint _amount) external; function overrideDiscount(address _address, uint256 _newDiscount) external; function overrideLoyaltyPoints(address _address, uint256 _newPoints) external; function setDiscountTranches(uint256 _tranche, uint256 _pointsNeeded) external; } */
/** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ function _constructor(string memory name, string memory symbol) internal { _name = name; _symbol = symbol; _decimals = 18; }
// File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath{ /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure re...
// This contract secures votes via locking of tokens in the contract abstract contract _LockVote is ERC20_Utils {
address public owner; // contract deployer address public DeFiat_Gov; //governance contract
bytes32 public voteName; // name to describe the vote uint256 public voteStart; // UTC timestamp for voteStart uint256 public voteEnd; // UTC timestamp for voteEnd bool public decisionActivated; // track whether decision has been activated
uint256 public quorum; // x / 100 = required % of votes / voting power for vote to be actionable uint256 public totalVotes; // total votes cast uint256[] public voteChoices; // array of choices to vote for mapping (address => uint256) public votes; // address => user vote choice mapping (address => uint256) public votingTokens; // address => locke...