Address Contract Verified
Address
0x5dcebAD11045bC9aFf13BFb00df9e11776b1AF6a
Balance
0 ETH
Nonce
1
Code Size
2509 bytes
Creator
0xD891d7f6...B0C6 at tx 0xccb7937b...7abbeb
Indexed Transactions
0 (1 on-chain, 1.2% indexed)
Contract Bytecode
2509 bytes
0x60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b1461014b578063b66a0e5d14610160578063f2fde38b14610175578063f968f493146101a85761008e565b8063365b98b214610096578063380d831b146100dc578063440e1e69146100f15780637e1c0c09146101365761008e565b3661008e5761008c6101bd565b005b61008c6101bd565b3480156100a257600080fd5b506100c0600480360360208110156100b957600080fd5b5035610367565b604080516001600160a01b039092168252519081900360200190f35b3480156100e857600080fd5b5061008c610382565b3480156100fd57600080fd5b506101246004803603602081101561011457600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b34801561014257600080fd5b506101246104eb565b34801561015757600080fd5b506100c06104f1565b34801561016c57600080fd5b5061008c610500565b34801561018157600080fd5b5061008c6004803603602081101561019857600080fd5b50356001600160a01b03166106a8565b3480156101b457600080fd5b5061008c61070a565b6000600154600160a01b900460ff1660028111156101d757fe5b14610229576040805162461bcd60e51b815260206004820152601c60248201527f73616c652073746174653a2053616c65206973206e6f74206f70656e00000000604482015290519081900360640190fd5b6706f05b59d3b20000341015801561024a57506801158e460913d000003411155b6102855760405162461bcd60e51b81526004018080602001828103825260308152602001806108f06030913960400191505060405180910390fd5b61028d6107d2565b60055410156102cd5760405162461bcd60e51b81526004018080602001828103825260498152602001806108a76049913960600191505060405180910390fd5b6102d56107d2565b336000908152600260205260409020805490910190556102f36107d2565b600580549190910390556004805460010190819055600090815260036020526040902080546001600160a01b031916331790557f1c154442c084dbf047ab51a1823d5ff0b570036c07fd67d59aefabaa4b06448c61034f6107d2565b604080519182523360208301528051918290030190a1565b6003602052600090815260409020546001600160a01b031681565b6000546001600160a01b0316331461039957600080fd5b6000600154600160a01b900460ff1660028111156103b357fe5b146103ef5760405162461bcd60e51b81526004018080602001828103825260228152602001806109766022913960400191505060405180910390fd5b6001805460ff60a01b1916600160a01b1790556005541561049c57600154600080546005546040805163a9059cbb60e01b81526001600160a01b039384166004820152602481019290925251919093169263a9059cbb9260448083019360209390929083900390910190829087803b15801561046a57600080fd5b505af115801561047e573d6000803e3d6000fd5b505050506040513d602081101561049457600080fd5b505060006005555b600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156104d6573d6000803e3d6000fd5b50565b60026020526000908152604090205481565b60055481565b6000546001600160a01b031681565b6000546001600160a01b0316331461051757600080fd5b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561056257600080fd5b505afa158015610576573d6000803e3d6000fd5b505050506040513d602081101561058c57600080fd5b5051116105ca5760405162461bcd60e51b81526004018080602001828103825260328152602001806109446032913960400191505060405180910390fd5b60018054600160a01b900460ff1660028111156105e357fe5b1461061f5760405162461bcd60e51b81526004018080602001828103825260248152602001806109206024913960400191505060405180910390fd5b600154604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b505050506040513d602081101561069457600080fd5b50516005556001805460ff60a01b19169055565b6000546001600160a01b031633146106bf57600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000546001600160a01b0316331461072157600080fd5b60018054600160a01b900460ff16600281111561073a57fe5b1461078c576040805162461bcd60e51b815260206004820152601860248201527f73616c652073746174653a2053616c65206973206f70656e0000000000000000604482015290519081900360640190fd5b6001805460ff60a01b1916600160a11b1790556107a76107da565b6040517f27591baca3ab78e62a0cbf3b92bae5a04d5a1768b720a980d1f4671374c93c4c90600090a1565b610fa0340290565b60015b60045481116104d6576000818152600360209081526040808320546001546001600160a01b039182168086526002855283862054845163a9059cbb60e01b815260048101839052602481019190915293519095919092169363a9059cbb936044808201949293918390030190829087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505050506040513d602081101561088457600080fd5b50506001600160a01b03166000908152600260205260408120556001016107dd56fe746f6b656e733a20496e73756666696369656e7420746f6b656e2062616c616e6365206f662074686520636f6e74726163742c207472792077697468206c6f77657220616d6f756e74696e766573746d656e743a20507572636861736520616d6f756e74206973206e6f742077697468696e206c696d69747373616c652073746174653a205468652073616c65206973206f70656e20616c7265616479746f6b656e733a20496e73756666696369656e7420746f6b656e2062616c616e6365206f662074686520636f6e747261637473616c652073746174653a2053616c6520697320636c6f73656420616c7265616479a2646970667358221220fe26a6ddb8392cc1502f7b52850bf8da57978c4cdcad9d86a76f6c90eb875aa764736f6c634300060c0033
Verified Source Code Full Match
Compiler: v0.6.12+commit.27d51765
EVM: istanbul
Optimization: Yes (200 runs)
Owned.sol 24 lines
// "SPDX-License-Identifier: UNLICENSED "
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
Token.sol 128 lines
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
// ----------------------------------------------------------------------------
// 'Zeedex' token contract
// Symbol : ZDEX
// Name : Zeedex
// Total supply: 10,000,000 (10 million)
// Decimals : 18
// ----------------------------------------------------------------------------
import './SafeMath.sol';
import './ERC20contract.sol';
import './Owned.sol';
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Token is ERC20Interface, Owned {
using SafeMath for uint256;
string public symbol = "ZDEX";
string public name = "Zeedex";
uint256 public decimals = 18;
uint256 _totalSupply = 10 * 1000000 * 10 ** (decimals);
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
owner = msg.sender;
balances[address(owner)] = totalSupply();
emit Transfer(address(0),address(owner), totalSupply());
}
/** ERC20Interface function's implementation **/
function totalSupply() public override view returns (uint256){
return _totalSupply;
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public override view returns (uint256 balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint256 tokens) public override returns (bool success) {
// prevent transfer to 0x0, use burn instead
require(address(to) != address(0));
require(balances[msg.sender] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender,to,tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
// ------------------------------------------------------------------------
function approve(address spender, uint256 tokens) public override returns (bool success){
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender,spender,tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
balances[from] = balances[from].sub(tokens);
balances[to] = balances[to].add(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
emit Transfer(from,to,tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Burn the `_amount` amount of tokens from the calling `account`
// @params _amount the amount of tokens to burn
// ------------------------------------------------------------------------
function burnTokens(uint256 _amount) public {
_burn(_amount, msg.sender);
}
// ------------------------------------------------------------------------
// @dev Internal function that burns an amount of the token from a given account
// @param _amount The amount that will be burnt
// @param _account The tokens to burn from
// ------------------------------------------------------------------------
function _burn(uint256 _amount, address _account) internal {
require(balances[_account] >= _amount, "insufficient account balance");
_totalSupply = _totalSupply.sub(_amount);
balances[address(_account)] = balances[address(_account)].sub(_amount);
emit Transfer(address(_account), address(0), _amount);
}
}
SafeMath.sol 40 lines
// "SPDX-License-Identifier: UNLICENSED "
pragma solidity ^0.6.0;
/**
* @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;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
LockingSale.sol 97 lines
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
import './Owned.sol';
import './Token.sol';
contract ZeedexSale is Owned {
Token token;
enum State {_OPEN, _CLOSE, _UNLOCKED}
State saleState = State._CLOSE;
mapping(address => uint256) public tokenAllocation;
mapping(uint256 => address) public users;
uint256 totalUsers;
uint256 public totalTokens;
event TokensAllocated(uint256 tokens, address purchaser);
event TokensUnlocked();
constructor(address payable _owner, address _tokenAddress) public{
owner = _owner;
token = Token(_tokenAddress);
}
function startSale() external onlyOwner{
require(token.balanceOf(address(this)) > 0, "tokens: Insufficient token balance of the contract");
require(saleState == State._CLOSE, "sale state: The sale is open already");
totalTokens = token.balanceOf(address(this));
saleState = State._OPEN; // open sale but tokens are locked
}
function endSale() external onlyOwner{
require(saleState == State._OPEN, "sale state: Sale is closed already");
saleState = State._CLOSE;
if(totalTokens > 0){
token.transfer(owner, totalTokens);
totalTokens = 0;
}
owner.transfer(address(this).balance); // send all collected funds to the owner
}
function unlockTokens() external onlyOwner{
require(saleState == State._CLOSE, "sale state: Sale is open");
saleState = State._UNLOCKED;
sendTokens();
emit TokensUnlocked();
}
function sendTokens() internal{
for(uint256 i = 1; i<= totalUsers; i++){
address _to = users[i];
token.transfer(_to, tokenAllocation[_to]); // transfer tokens to the users
tokenAllocation[_to] = 0;
}
}
// receive ethers
fallback() external payable{
purchase();
}
// receive ethers with data
receive() external payable{
purchase();
}
function purchase() internal {
require(saleState == State._OPEN, "sale state: Sale is not open");
require(msg.value >= 0.5 ether && msg.value <= 20 ether, "investment: Purchase amount is not within limits");
require(totalTokens >= calculateTokens(), "tokens: Insufficient token balance of the contract, try with lower amount");
tokenAllocation[msg.sender] += calculateTokens();
totalTokens -= calculateTokens();
totalUsers++;
users[totalUsers] = msg.sender;
emit TokensAllocated(calculateTokens(), msg.sender);
}
function calculateTokens() internal returns(uint256 _tokens){
/* Calculations
1 eth = 4000 ZDEX tokens
1 * 10^18 = 4000 * 10 ^ 18
cancelling 10^18 on b.sides
1 wei = 4000 ZDEX parts
*/
return msg.value * (4000);
}
}
ERC20contract.sol 17 lines
// "SPDX-License-Identifier: UNLICENSED "
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() public virtual view returns (uint);
function balanceOf(address tokenOwner) public virtual view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public virtual view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public virtual returns (bool success);
function approve(address spender, uint256 tokens) public virtual returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public virtual returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
Read Contract
owner 0x8da5cb5b → address
tokenAllocation 0x440e1e69 → uint256
totalTokens 0x7e1c0c09 → uint256
users 0x365b98b2 → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
endSale 0x380d831b
No parameters
startSale 0xb66a0e5d
No parameters
transferOwnership 0xf2fde38b
address _newOwner
unlockTokens 0xf968f493
No parameters
Recent Transactions
This address has 1 on-chain transactions, but only 1.2% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →