contract ADVToken is IERC20 {

    using SafeMath for uint256;

    // Token properties
    string public name = "ADV Token";
    string public symbol = "ADV";
    uint public decimals = 18;

    uint public _totalSupply = 0;

    // Balances for each account
    mapping (address => uint256) balances;

    // Owner of account approves the transfer of an amount to another account
    mapping (address => mapping(address => uint256)) allowed;

    // Owner of Token
    address public owner;
    address public main;

    // modifier to allow only owner has full control on the function
    modifier auth {
        require(msg.sender == owner || msg.sender == main);
        _;
    }

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

    // Constructor
    // @notice HaloTestToken Contract
    // @return the transaction address
    constructor() public payable {
        owner = msg.sender;
    }

    function setOwner(address _owner) public onlyOwner {
        require(_owner != address(0x0));
        owner = _owner;
    }

    function setMain(address _main) public onlyOwner {
        require(_main != address(0x0));
        main = _main;
    }

    // @return total tokens supplied
    function totalSupply() public view returns (uint) {
        return _totalSupply;
    }

    // What is the balance of a particular account?
    // @param who The address of the particular account
    // @return the balanace the particular account
    function balanceOf(address who) public view returns (uint balance) {
        return balances[who];
    }

    // @notice send `value` token to `to` from `msg.sender`
    // @param to The address of the recipient
    // @param value The amount of token to be transferred
    // @return the transaction address and send the event as Transfer
    function transfer(address to, uint256 value) public returns (bool success){
        require (
            balances[msg.sender] >= value && value > 0
        );
        balances[msg.sender] = balances[msg.sender].sub(value);
        balances[to] = balances[to].add(value);
        emit Transfer(msg.sender, to, value);
        return true;
    }

    // @notice send `value` token to `to` from `from`
    // @param from The address of the sender
    // @param to The address of the recipient
    // @param value The amount of token to be transferred
    // @return the transaction address and send the event as Transfer
    function transferFrom(address from, address to, uint256 value) public returns (bool success){
        require (
            allowed[from][msg.sender] >= value && balances[from] >= value && value > 0
        );
        balances[from] = balances[from].sub(value);
        balances[to] = balances[to].add(value);
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
        emit Transfer(from, to, value);
        return true;
    }

    // Allow spender to withdraw from your account, multiple times, up to the value amount.
    // If this function is called again it overwrites the current allowance with value.
    // @param spender The address of the sender
    // @param value The amount to be approved
    // @return the transaction address and send the event as Approval
    function approve(address spender, uint256 value) public returns (bool success){
        require (
            balances[msg.sender] >= value && value > 0
        );
        allowed[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    // Check the allowed value for the spender to withdraw from owner
    // @param owner The address of the owner
    // @param spender The address of the spender
    // @return the amount which spender is still allowed to withdraw from owner
    function allowance(address _owner, address spender) public view returns (uint remaining) {
        return allowed[_owner][spender];
    }

   function mint(address account, uint256 amount) public auth {
        require(account != address(0), "ERC20: mint to the zero address");

        _totalSupply = _totalSupply.add(amount);
        balances[account] = balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    function burn(address account, uint256 amount) public auth {
        require(account != address(0), "ERC20: burn from the zero address");
        require(amount >= balances[account], "ERC20: burn amount exceeds balance");

        balances[account] = balances[account].sub(amount);
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }
}
function transferFrom(address from, address to, uint256 value) public returns (bool success){
    require (
        allowed[from][msg.sender] >= value && balances[from] >= value && value > 0
    );
    balances[from] = balances[from].sub(value);
    balances[to] = balances[to].add(value);
    allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
    emit Transfer(from, to, value);
    return true;
}

// @notice send `value` token to `to` from `from`
// @param from The address of the sender
// @param to The address of the recipient
// @param value The amount of token to be transferred
// @return the transaction address and send the event as Transfer