Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd7b7a8
commit e594732
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |