ERC-20
Overview
Max Total Supply
999,999,999.999999999999999978 PRYZ
Holders
692
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
PryzeToken
Compiler Version
v0.4.18+commit.9cf6e910
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-05-14 */ pragma solidity 0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /// @title A library for implementing a generic state machine pattern. library StateMachineLib { struct Stage { // The id of the next stage bytes32 nextId; // The identifiers for the available functions in each stage mapping(bytes4 => bool) allowedFunctions; } struct State { // The current stage id bytes32 currentStageId; // A callback that is called when entering this stage function(bytes32) internal onTransition; // Checks if a stage id is valid mapping(bytes32 => bool) validStage; // Maps stage ids to their Stage structs mapping(bytes32 => Stage) stages; } /// @dev Creates and sets the initial stage. It has to be called before creating any transitions. /// @param stageId The id of the (new) stage to set as initial stage. function setInitialStage(State storage self, bytes32 stageId) internal { self.validStage[stageId] = true; self.currentStageId = stageId; } /// @dev Creates a transition from 'fromId' to 'toId'. If fromId already had a nextId, it deletes the now unreachable stage. /// @param fromId The id of the stage from which the transition begins. /// @param toId The id of the stage that will be reachable from "fromId". function createTransition(State storage self, bytes32 fromId, bytes32 toId) internal { require(self.validStage[fromId]); Stage storage from = self.stages[fromId]; // Invalidate the stage that won't be reachable any more if (from.nextId != 0) { self.validStage[from.nextId] = false; delete self.stages[from.nextId]; } from.nextId = toId; self.validStage[toId] = true; } /// @dev Goes to the next stage if posible (if the next stage is valid) function goToNextStage(State storage self) internal { Stage storage current = self.stages[self.currentStageId]; require(self.validStage[current.nextId]); self.currentStageId = current.nextId; self.onTransition(current.nextId); } /// @dev Checks if the a function is allowed in the current stage. /// @param selector A function selector (bytes4[keccak256(functionSignature)]) /// @return true If the function is allowed in the current stage function checkAllowedFunction(State storage self, bytes4 selector) internal constant returns(bool) { return self.stages[self.currentStageId].allowedFunctions[selector]; } /// @dev Allow a function in the given stage. /// @param stageId The id of the stage /// @param selector A function selector (bytes4[keccak256(functionSignature)]) function allowFunction(State storage self, bytes32 stageId, bytes4 selector) internal { require(self.validStage[stageId]); self.stages[stageId].allowedFunctions[selector] = true; } } contract StateMachine { using StateMachineLib for StateMachineLib.State; event LogTransition(bytes32 indexed stageId, uint256 blockNumber); StateMachineLib.State internal state; /* This modifier performs the conditional transitions and checks that the function * to be executed is allowed in the current stage */ modifier checkAllowed { conditionalTransitions(); require(state.checkAllowedFunction(msg.sig)); _; } function StateMachine() public { // Register the startConditions function and the onTransition callback state.onTransition = onTransition; } /// @dev Gets the current stage id. /// @return The current stage id. function getCurrentStageId() public view returns(bytes32) { return state.currentStageId; } /// @dev Performs conditional transitions. Can be called by anyone. function conditionalTransitions() public { bytes32 nextId = state.stages[state.currentStageId].nextId; while (state.validStage[nextId]) { StateMachineLib.Stage storage next = state.stages[nextId]; // If the next stage's condition is true, go to next stage and continue if (startConditions(nextId)) { state.goToNextStage(); nextId = next.nextId; } else { break; } } } /// @dev Determines whether the conditions for transitioning to the given stage are met. /// @return true if the conditions are met for the given stageId. False by default (must override in child contracts). function startConditions(bytes32) internal constant returns(bool) { return false; } /// @dev Callback called when there is a stage transition. It should be overridden for additional functionality. function onTransition(bytes32 stageId) internal { LogTransition(stageId, block.number); } } /// @title A contract that implements the state machine pattern and adds time dependant transitions. contract TimedStateMachine is StateMachine { event LogSetStageStartTime(bytes32 indexed stageId, uint256 startTime); // Stores the start timestamp for each stage (the value is 0 if the stage doesn't have a start timestamp). mapping(bytes32 => uint256) internal startTime; /// @dev This function overrides the startConditions function in the parent class in order to enable automatic transitions that depend on the timestamp. function startConditions(bytes32 stageId) internal constant returns(bool) { // Get the startTime for stage uint256 start = startTime[stageId]; // If the startTime is set and has already passed, return true. return start != 0 && block.timestamp > start; } /// @dev Sets the starting timestamp for a stage. /// @param stageId The id of the stage for which we want to set the start timestamp. /// @param timestamp The start timestamp for the given stage. It should be bigger than the current one. function setStageStartTime(bytes32 stageId, uint256 timestamp) internal { require(state.validStage[stageId]); require(timestamp > block.timestamp); startTime[stageId] = timestamp; LogSetStageStartTime(stageId, timestamp); } /// @dev Returns the timestamp for the given stage id. /// @param stageId The id of the stage for which we want to set the start timestamp. function getStageStartTime(bytes32 stageId) public view returns(uint256) { return startTime[stageId]; } } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract DetailedERC20 is ERC20 { string public name; string public symbol; uint8 public decimals; function DetailedERC20(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; } } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } } contract ERC223Basic is ERC20Basic { /** * @dev Transfer the specified amount of tokens to the specified address. * Now with a new parameter _data. * * @param _to Receiver address. * @param _value Amount of tokens that will be transferred. * @param _data Transaction metadata. */ function transfer(address _to, uint _value, bytes _data) public returns (bool); /** * @dev triggered when transfer is successfully called. * * @param _from Sender address. * @param _to Receiver address. * @param _value Amount of tokens that will be transferred. * @param _data Transaction metadata. */ event Transfer(address indexed _from, address indexed _to, uint256 indexed _value, bytes _data); } /// @title Contract that supports the receival of ERC223 tokens. contract ERC223ReceivingContract { /// @dev Standard ERC223 function that will handle incoming token transfers. /// @param _from Token sender address. /// @param _value Amount of tokens. /// @param _data Transaction metadata. function tokenFallback(address _from, uint _value, bytes _data); } /** * @title ERC223 standard token implementation. */ contract ERC223BasicToken is ERC223Basic, BasicToken { /** * @dev Transfer the specified amount of tokens to the specified address. * Invokes the `tokenFallback` function if the recipient is a contract. * The token transfer fails if the recipient is a contract * but does not implement the `tokenFallback` function * or the fallback function to receive funds. * * @param _to Receiver address. * @param _value Amount of tokens that will be transferred. * @param _data Transaction metadata. */ function transfer(address _to, uint _value, bytes _data) public returns (bool) { // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . uint codeLength; assembly { // Retrieve the size of the code on target address, this needs assembly . codeLength := extcodesize(_to) } require(super.transfer(_to, _value)); if(codeLength>0) { ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Transfer the specified amount of tokens to the specified address. * Invokes the `tokenFallback` function if the recipient is a contract. * The token transfer fails if the recipient is a contract * but does not implement the `tokenFallback` function * or the fallback function to receive funds. * * @param _to Receiver address. * @param _value Amount of tokens that will be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { bytes memory empty; require(transfer(_to, _value, empty)); return true; } } /// @title Token for the Pryze project. contract PryzeToken is DetailedERC20, MintableToken, ERC223BasicToken { string constant NAME = "Pryze"; string constant SYMBOL = "PRYZ"; uint8 constant DECIMALS = 18; //// @dev Constructor that sets details of the ERC20 token. function PryzeToken() DetailedERC20(NAME, SYMBOL, DECIMALS) public {} } contract Whitelistable is Ownable { event LogUserRegistered(address indexed sender, address indexed userAddress); event LogUserUnregistered(address indexed sender, address indexed userAddress); mapping(address => bool) public whitelisted; function registerUser(address userAddress) public onlyOwner { require(userAddress != 0); whitelisted[userAddress] = true; LogUserRegistered(msg.sender, userAddress); } function unregisterUser(address userAddress) public onlyOwner { require(whitelisted[userAddress] == true); whitelisted[userAddress] = false; LogUserUnregistered(msg.sender, userAddress); } } contract DisbursementHandler is Ownable { struct Disbursement { uint256 timestamp; uint256 tokens; } event LogSetup(address indexed vestor, uint256 tokens, uint256 timestamp); event LogChangeTimestamp(address indexed vestor, uint256 index, uint256 timestamp); event LogWithdraw(address indexed to, uint256 value); ERC20 public token; mapping(address => Disbursement[]) public disbursements; mapping(address => uint256) public withdrawnTokens; function DisbursementHandler(address _token) public { token = ERC20(_token); } /// @dev Called by the sale contract to create a disbursement. /// @param vestor The address of the beneficiary. /// @param tokens Amount of tokens to be locked. /// @param timestamp Funds will be locked until this timestamp. function setupDisbursement( address vestor, uint256 tokens, uint256 timestamp ) public onlyOwner { require(block.timestamp < timestamp); disbursements[vestor].push(Disbursement(timestamp, tokens)); LogSetup(vestor, timestamp, tokens); } /// @dev Change an existing disbursement. /// @param vestor The address of the beneficiary. /// @param timestamp Funds will be locked until this timestamp. /// @param index Index of the DisbursementVesting in the vesting array. function changeTimestamp( address vestor, uint256 index, uint256 timestamp ) public onlyOwner { require(block.timestamp < timestamp); require(index < disbursements[vestor].length); disbursements[vestor][index].timestamp = timestamp; LogChangeTimestamp(vestor, index, timestamp); } /// @dev Transfers tokens to a given address /// @param to Address of token receiver /// @param value Number of tokens to transfer function withdraw(address to, uint256 value) public { uint256 maxTokens = calcMaxWithdraw(); uint256 withdrawAmount = value < maxTokens ? value : maxTokens; withdrawnTokens[msg.sender] = SafeMath.add(withdrawnTokens[msg.sender], withdrawAmount); token.transfer(to, withdrawAmount); LogWithdraw(to, value); } /// @dev Calculates the maximum amount of vested tokens /// @return Number of vested tokens to withdraw function calcMaxWithdraw() public constant returns (uint256) { uint256 maxTokens = 0; Disbursement[] storage temp = disbursements[msg.sender]; for (uint256 i = 0; i < temp.length; i++) { if (block.timestamp > temp[i].timestamp) { maxTokens = SafeMath.add(maxTokens, temp[i].tokens); } } maxTokens = SafeMath.sub(maxTokens, withdrawnTokens[msg.sender]); return maxTokens; } } /// @title Sale base contract contract Sale is Ownable, TimedStateMachine { using SafeMath for uint256; event LogContribution(address indexed contributor, uint256 amountSent, uint256 excessRefunded); event LogTokenAllocation(address indexed contributor, uint256 contribution, uint256 tokens); event LogDisbursement(address indexed beneficiary, uint256 tokens); // Stages for the state machine bytes32 public constant SETUP = "setup"; bytes32 public constant SETUP_DONE = "setupDone"; bytes32 public constant SALE_IN_PROGRESS = "saleInProgress"; bytes32 public constant SALE_ENDED = "saleEnded"; mapping(address => uint256) public contributions; uint256 public weiContributed = 0; uint256 public contributionCap; // Wallet where funds will be sent address public wallet; MintableToken public token; DisbursementHandler public disbursementHandler; function Sale( address _wallet, uint256 _contributionCap ) public { require(_wallet != 0); require(_contributionCap != 0); wallet = _wallet; token = createTokenContract(); disbursementHandler = new DisbursementHandler(token); contributionCap = _contributionCap; setupStages(); } function() external payable { contribute(); } /// @dev Sets the start timestamp for the SALE_IN_PROGRESS stage. /// @param timestamp The start timestamp. function setSaleStartTime(uint256 timestamp) external onlyOwner checkAllowed { // require(_startTime < getStageStartTime(SALE_ENDED)); setStageStartTime(SALE_IN_PROGRESS, timestamp); } /// @dev Sets the start timestamp for the SALE_ENDED stage. /// @param timestamp The start timestamp. function setSaleEndTime(uint256 timestamp) external onlyOwner checkAllowed { require(getStageStartTime(SALE_IN_PROGRESS) < timestamp); setStageStartTime(SALE_ENDED, timestamp); } /// @dev Called in the SETUP stage, check configurations and to go to the SETUP_DONE stage. function setupDone() public onlyOwner checkAllowed { uint256 _startTime = getStageStartTime(SALE_IN_PROGRESS); uint256 _endTime = getStageStartTime(SALE_ENDED); require(block.timestamp < _startTime); require(_startTime < _endTime); state.goToNextStage(); } /// @dev Called by users to contribute ETH to the sale. function contribute() public payable checkAllowed { require(msg.value > 0); uint256 contributionLimit = getContributionLimit(msg.sender); require(contributionLimit > 0); // Check that the user is allowed to contribute uint256 totalContribution = contributions[msg.sender].add(msg.value); uint256 excess = 0; // Check if it goes over the eth cap for the sale. if (weiContributed.add(msg.value) > contributionCap) { // Subtract the excess excess = weiContributed.add(msg.value).sub(contributionCap); totalContribution = totalContribution.sub(excess); } // Check if it goes over the contribution limit of the user. if (totalContribution > contributionLimit) { excess = excess.add(totalContribution).sub(contributionLimit); contributions[msg.sender] = contributionLimit; } else { contributions[msg.sender] = totalContribution; } // We are only able to refund up to msg.value because the contract will not contain ether excess = excess < msg.value ? excess : msg.value; weiContributed = weiContributed.add(msg.value).sub(excess); if (excess > 0) { msg.sender.transfer(excess); } wallet.transfer(this.balance); assert(contributions[msg.sender] <= contributionLimit); LogContribution(msg.sender, msg.value, excess); } /// @dev Create a disbursement of tokens. /// @param beneficiary The beneficiary of the disbursement. /// @param tokenAmount Amount of tokens to be locked. /// @param timestamp Tokens will be locked until this timestamp. function distributeTimelockedTokens( address beneficiary, uint256 tokenAmount, uint256 timestamp ) external onlyOwner checkAllowed { disbursementHandler.setupDisbursement( beneficiary, tokenAmount, timestamp ); token.mint(disbursementHandler, tokenAmount); LogDisbursement(beneficiary, tokenAmount); } function setupStages() internal { // Set the stages state.setInitialStage(SETUP); state.createTransition(SETUP, SETUP_DONE); state.createTransition(SETUP_DONE, SALE_IN_PROGRESS); state.createTransition(SALE_IN_PROGRESS, SALE_ENDED); // The selectors should be hardcoded state.allowFunction(SETUP, this.distributeTimelockedTokens.selector); state.allowFunction(SETUP, this.setSaleStartTime.selector); state.allowFunction(SETUP, this.setSaleEndTime.selector); state.allowFunction(SETUP, this.setupDone.selector); state.allowFunction(SALE_IN_PROGRESS, this.contribute.selector); state.allowFunction(SALE_IN_PROGRESS, 0); // fallback } // Override in the child sales function createTokenContract() internal returns (MintableToken); function getContributionLimit(address userAddress) internal returns (uint256); /// @dev Stage start conditions. function startConditions(bytes32 stageId) internal constant returns (bool) { // If the cap has been reached, end the sale. if (stageId == SALE_ENDED && contributionCap == weiContributed) { return true; } return super.startConditions(stageId); } /// @dev State transitions callbacks. function onTransition(bytes32 stageId) internal { if (stageId == SALE_ENDED) { onSaleEnded(); } super.onTransition(stageId); } /// @dev Callback that gets called when entering the SALE_ENDED stage. function onSaleEnded() internal {} } contract PryzeSale is Sale, Whitelistable { uint256 public constant PRESALE_WEI = 10695.303 ether; // Amount raised in the presale uint256 public constant PRESALE_WEI_WITH_BONUS = 10695.303 ether * 1.5; // Amount raised in the presale times the bonus uint256 public constant MAX_WEI = 24695.303 ether; // Max wei to raise, including PRESALE_WEI uint256 public constant WEI_CAP = 14000 ether; // MAX_WEI - PRESALE_WEI uint256 public constant MAX_TOKENS = 400000000 * 1000000000000000000; // 4mm times 10^18 (18 decimals) uint256 public presaleWeiContributed = 0; uint256 private weiAllocated = 0; mapping(address => uint256) public presaleContributions; function PryzeSale( address _wallet ) Sale(_wallet, WEI_CAP) public { } /// @dev Sets the presale contribution for a contributor. /// @param _contributor The contributor. /// @param _amount The amount contributed in the presale (without the bonus). function presaleContribute(address _contributor, uint256 _amount) external onlyOwner checkAllowed { // If presale contribution is already set, replace the amount in the presaleWeiContributed variable if (presaleContributions[_contributor] != 0) { presaleWeiContributed = presaleWeiContributed.sub(presaleContributions[_contributor]); } presaleWeiContributed = presaleWeiContributed.add(_amount); require(presaleWeiContributed <= PRESALE_WEI); presaleContributions[_contributor] = _amount; } /// @dev Called to allocate the tokens depending on eth contributed. /// @param contributor The address of the contributor. function allocateTokens(address contributor) external checkAllowed { require(presaleContributions[contributor] != 0 || contributions[contributor] != 0); uint256 tokensToAllocate = calculateAllocation(contributor); // We keep a record of how much wei contributed has already been used for allocations weiAllocated = weiAllocated.add(presaleContributions[contributor]).add(contributions[contributor]); // Set contributions to 0 presaleContributions[contributor] = 0; contributions[contributor] = 0; // Mint the respective tokens to the contributor token.mint(contributor, tokensToAllocate); // If all tokens were allocated, stop minting functionality if (weiAllocated == PRESALE_WEI.add(weiContributed)) { token.finishMinting(); } } function setupDone() public onlyOwner checkAllowed { require(presaleWeiContributed == PRESALE_WEI); super.setupDone(); } /// @dev Calculate the PRYZ allocation for the given contributor. The allocation is proportional to the amount of wei contributed. /// @param contributor The address of the contributor /// @return The amount of tokens to allocate function calculateAllocation(address contributor) public constant returns (uint256) { uint256 presale = presaleContributions[contributor].mul(15).div(10); // Multiply by 1.5 uint256 totalContribution = presale.add(contributions[contributor]); return totalContribution.mul(MAX_TOKENS).div(PRESALE_WEI_WITH_BONUS.add(weiContributed)); } function setupStages() internal { super.setupStages(); state.allowFunction(SETUP, this.presaleContribute.selector); state.allowFunction(SALE_ENDED, this.allocateTokens.selector); } function createTokenContract() internal returns(MintableToken) { return new PryzeToken(); } function getContributionLimit(address userAddress) internal returns (uint256) { // No contribution cap if whitelisted return whitelisted[userAddress] ? 2**256 - 1 : 0; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_value","type":"uint256"},{"indexed":false,"name":"_data","type":"bytes"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
Contract Creation Code
60606040526006805460a060020a60ff0219169055341561001f57600080fd5b604080519081016040908152600582527f5072797a6500000000000000000000000000000000000000000000000000000060208301528051908101604052600481527f5052595a0000000000000000000000000000000000000000000000000000000060208201526012600183805161009c9291602001906100e7565b5060028280516100b09291602001906100e7565b506003805460ff191660ff92909216919091179055505060068054600160a060020a03191633600160a060020a0316179055610182565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061012857805160ff1916838001178555610155565b82800160010185558215610155579182015b8281111561015557825182559160200191906001019061013a565b50610161929150610165565b5090565b61017f91905b80821115610161576000815560010161016b565b90565b610e8480620001926000396000f3006060604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100f557806306fdde031461011c578063095ea7b3146101a657806318160ddd146101c857806323b872dd146101ed578063313ce5671461021557806340c10f191461023e578063661884631461026057806370a08231146102825780637d64bcb4146102a15780638da5cb5b146102b457806395d89b41146102e3578063a9059cbb146102f6578063be45fd6214610318578063d73dd6231461037d578063dd62ed3e1461039f578063f2fde38b146103c4575b600080fd5b341561010057600080fd5b6101086103e5565b604051901515815260200160405180910390f35b341561012757600080fd5b61012f6103f5565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561016b578082015183820152602001610153565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b610108600160a060020a0360043516602435610493565b34156101d357600080fd5b6101db6104ff565b60405190815260200160405180910390f35b34156101f857600080fd5b610108600160a060020a0360043581169060243516604435610505565b341561022057600080fd5b610228610687565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b610108600160a060020a0360043516602435610690565b341561026b57600080fd5b610108600160a060020a036004351660243561079d565b341561028d57600080fd5b6101db600160a060020a0360043516610897565b34156102ac57600080fd5b6101086108b2565b34156102bf57600080fd5b6102c761093d565b604051600160a060020a03909116815260200160405180910390f35b34156102ee57600080fd5b61012f61094c565b341561030157600080fd5b610108600160a060020a03600435166024356109b7565b341561032357600080fd5b61010860048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506109e195505050505050565b341561038857600080fd5b610108600160a060020a0360043516602435610bb9565b34156103aa57600080fd5b6101db600160a060020a0360043581169060243516610c5d565b34156103cf57600080fd5b6103e3600160a060020a0360043516610c88565b005b60065460a060020a900460ff1681565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561048b5780601f106104605761010080835404028352916020019161048b565b820191906000526020600020905b81548152906001019060200180831161046e57829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561051c57600080fd5b600160a060020a03841660009081526004602052604090205482111561054157600080fd5b600160a060020a038085166000908152600560209081526040808320339094168352929052205482111561057457600080fd5b600160a060020a03841660009081526004602052604090205461059d908363ffffffff610d2316565b600160a060020a0380861660009081526004602052604080822093909355908516815220546105d2908363ffffffff610d3516565b600160a060020a0380851660009081526004602090815260408083209490945587831682526005815283822033909316825291909152205461061a908363ffffffff610d2316565b600160a060020a03808616600081815260056020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60035460ff1681565b60065460009033600160a060020a039081169116146106ae57600080fd5b60065460a060020a900460ff16156106c557600080fd5b6000546106d8908363ffffffff610d3516565b6000908155600160a060020a038416815260046020526040902054610703908363ffffffff610d3516565b600160a060020a0384166000818152600460205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054808311156107fa57600160a060020a033381166000908152600560209081526040808320938816835292905290812055610831565b61080a818463ffffffff610d2316565b600160a060020a033381166000908152600560209081526040808320938916835292905220555b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526004602052604090205490565b60065460009033600160a060020a039081169116146108d057600080fd5b60065460a060020a900460ff16156108e757600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600654600160a060020a031681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561048b5780601f106104605761010080835404028352916020019161048b565b60006109c1610e46565b6109cc8484836109e1565b15156109d757600080fd5b5060019392505050565b6000833b816109f08686610d4b565b15156109fb57600080fd5b6000821115610b00575084600160a060020a03811663c0ee0b8a3387876040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a9e578082015183820152602001610a86565b50505050905090810190601f168015610acb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515610aeb57600080fd5b6102c65a03f11515610afc57600080fd5b5050505b8486600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405160208082528190810183818151815260200191508051906020019080838360005b83811015610b73578082015183820152602001610b5b565b50505050905090810190601f168015610ba05780820380516001836020036101000a031916815260200191505b509250505060405180910390a450600195945050505050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054610bf1908363ffffffff610d3516565b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60065433600160a060020a03908116911614610ca357600080fd5b600160a060020a0381161515610cb857600080fd5b600654600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610d2f57fe5b50900390565b600082820183811015610d4457fe5b9392505050565b6000600160a060020a0383161515610d6257600080fd5b600160a060020a033316600090815260046020526040902054821115610d8757600080fd5b600160a060020a033316600090815260046020526040902054610db0908363ffffffff610d2316565b600160a060020a033381166000908152600460205260408082209390935590851681522054610de5908363ffffffff610d3516565b600160a060020a0380851660008181526004602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b602060405190810160405260008152905600a165627a7a7230582029a4bad5db5948a5519fed495d14cc1b4f8a726640389348345147c84fa9fb820029
Deployed Bytecode
0x6060604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100f557806306fdde031461011c578063095ea7b3146101a657806318160ddd146101c857806323b872dd146101ed578063313ce5671461021557806340c10f191461023e578063661884631461026057806370a08231146102825780637d64bcb4146102a15780638da5cb5b146102b457806395d89b41146102e3578063a9059cbb146102f6578063be45fd6214610318578063d73dd6231461037d578063dd62ed3e1461039f578063f2fde38b146103c4575b600080fd5b341561010057600080fd5b6101086103e5565b604051901515815260200160405180910390f35b341561012757600080fd5b61012f6103f5565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561016b578082015183820152602001610153565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b610108600160a060020a0360043516602435610493565b34156101d357600080fd5b6101db6104ff565b60405190815260200160405180910390f35b34156101f857600080fd5b610108600160a060020a0360043581169060243516604435610505565b341561022057600080fd5b610228610687565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b610108600160a060020a0360043516602435610690565b341561026b57600080fd5b610108600160a060020a036004351660243561079d565b341561028d57600080fd5b6101db600160a060020a0360043516610897565b34156102ac57600080fd5b6101086108b2565b34156102bf57600080fd5b6102c761093d565b604051600160a060020a03909116815260200160405180910390f35b34156102ee57600080fd5b61012f61094c565b341561030157600080fd5b610108600160a060020a03600435166024356109b7565b341561032357600080fd5b61010860048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506109e195505050505050565b341561038857600080fd5b610108600160a060020a0360043516602435610bb9565b34156103aa57600080fd5b6101db600160a060020a0360043581169060243516610c5d565b34156103cf57600080fd5b6103e3600160a060020a0360043516610c88565b005b60065460a060020a900460ff1681565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561048b5780601f106104605761010080835404028352916020019161048b565b820191906000526020600020905b81548152906001019060200180831161046e57829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561051c57600080fd5b600160a060020a03841660009081526004602052604090205482111561054157600080fd5b600160a060020a038085166000908152600560209081526040808320339094168352929052205482111561057457600080fd5b600160a060020a03841660009081526004602052604090205461059d908363ffffffff610d2316565b600160a060020a0380861660009081526004602052604080822093909355908516815220546105d2908363ffffffff610d3516565b600160a060020a0380851660009081526004602090815260408083209490945587831682526005815283822033909316825291909152205461061a908363ffffffff610d2316565b600160a060020a03808616600081815260056020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60035460ff1681565b60065460009033600160a060020a039081169116146106ae57600080fd5b60065460a060020a900460ff16156106c557600080fd5b6000546106d8908363ffffffff610d3516565b6000908155600160a060020a038416815260046020526040902054610703908363ffffffff610d3516565b600160a060020a0384166000818152600460205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054808311156107fa57600160a060020a033381166000908152600560209081526040808320938816835292905290812055610831565b61080a818463ffffffff610d2316565b600160a060020a033381166000908152600560209081526040808320938916835292905220555b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526004602052604090205490565b60065460009033600160a060020a039081169116146108d057600080fd5b60065460a060020a900460ff16156108e757600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600654600160a060020a031681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561048b5780601f106104605761010080835404028352916020019161048b565b60006109c1610e46565b6109cc8484836109e1565b15156109d757600080fd5b5060019392505050565b6000833b816109f08686610d4b565b15156109fb57600080fd5b6000821115610b00575084600160a060020a03811663c0ee0b8a3387876040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a9e578082015183820152602001610a86565b50505050905090810190601f168015610acb5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515610aeb57600080fd5b6102c65a03f11515610afc57600080fd5b5050505b8486600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405160208082528190810183818151815260200191508051906020019080838360005b83811015610b73578082015183820152602001610b5b565b50505050905090810190601f168015610ba05780820380516001836020036101000a031916815260200191505b509250505060405180910390a450600195945050505050565b600160a060020a033381166000908152600560209081526040808320938616835292905290812054610bf1908363ffffffff610d3516565b600160a060020a0333811660008181526005602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60065433600160a060020a03908116911614610ca357600080fd5b600160a060020a0381161515610cb857600080fd5b600654600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610d2f57fe5b50900390565b600082820183811015610d4457fe5b9392505050565b6000600160a060020a0383161515610d6257600080fd5b600160a060020a033316600090815260046020526040902054821115610d8757600080fd5b600160a060020a033316600090815260046020526040902054610db0908363ffffffff610d2316565b600160a060020a033381166000908152600460205260408082209390935590851681522054610de5908363ffffffff610d3516565b600160a060020a0380851660008181526004602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b602060405190810160405260008152905600a165627a7a7230582029a4bad5db5948a5519fed495d14cc1b4f8a726640389348345147c84fa9fb820029
Swarm Source
bzzr://29a4bad5db5948a5519fed495d14cc1b4f8a726640389348345147c84fa9fb82
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.