aboutsummaryrefslogblamecommitdiffstats
path: root/packages/contracts/src/current/test/DummyToken/DummyToken.sol
blob: ab04f4d16407e54523caa448df2d385d109bf6b4 (plain) (tree)
1
2
3
4
                        
 

                                                          










                                          
              







                                            
                                                     

                 
     








                                                                             
pragma solidity ^0.4.18;

import { Mintable } from "../Mintable/Mintable.sol";
import { Ownable } from "../../utils/Ownable/Ownable.sol";

contract DummyToken is Mintable, Ownable {
    string public name;
    string public symbol;
    uint public decimals;

    function DummyToken(
        string _name,
        string _symbol,
        uint _decimals,
        uint _totalSupply)
        public
    {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;
        totalSupply = _totalSupply;
        balances[msg.sender] = _totalSupply;
    }

    function setBalance(address _target, uint _value)
        public
        onlyOwner
    {
        uint currBalance = balanceOf(_target);
        if (_value < currBalance) {
            totalSupply = safeSub(totalSupply, safeSub(currBalance, _value));
        } else {
            totalSupply = safeAdd(totalSupply, safeSub(_value, currBalance));
        }
        balances[_target] = _value;
    }
}