Skip to content

Commit

Permalink
Create ZenswapDistribution.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
zenswapnetwork committed Jul 15, 2018
1 parent dd7b7a8 commit e594732
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions ZenswapDistribution.sol
@@ -0,0 +1,71 @@
pragma solidity ^0.4.24;

interface token {
function transfer(address receiver, uint amount) external;
}

contract Ownable {

address public owner;

constructor() public {
owner = msg.sender;
}

modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}

contract ZenswapDistribution is Ownable {

token public tokenReward;

/**
* Constructor function
*
* Set the token smart contract address
*/
constructor() public {

tokenReward = token(0x0D1C63E12fDE9e5cADA3E272576183AbA9cfedA2);

}

/**
* Distribute token to multiple address
*
*/
function distributeToken(address[] _addresses, uint256[] _amount) public onlyOwner {

uint256 addressCount = _addresses.length;
uint256 amountCount = _amount.length;
require(addressCount == amountCount);

for (uint256 i = 0; i < addressCount; i++) {
uint256 _tokensAmount = _amount[i] * 10 ** uint256(18);
tokenReward.transfer(_addresses[i], _tokensAmount);
}
}

/**
* Withdraw an "amount" of available tokens in the contract
*
*/
function withdrawToken(address _address, uint256 _amount) public onlyOwner {

uint256 _tokensAmount = _amount * 10 ** uint256(18);
tokenReward.transfer(_address, _tokensAmount);
}

/**
* Set a token contract address
*
*/
function setTokenReward(address _address) public onlyOwner {

tokenReward = token(_address);
}

}

0 comments on commit e594732

Please sign in to comment.