contract SVCToken is ERC20 {
    uint256 public burned;
    
    string private constant NAME = "SVC Token";
    string private constant SYMBOL = "SVC";
    uint8 private constant DECIMALS = 18;
    uint256 private constant INITIAL_SUPPLY = 10717656*10**20;

    constructor () public ERC20(NAME, SYMBOL, DECIMALS) {
        _mint(msg.sender, INITIAL_SUPPLY);
    }
    
    function burn(uint256 value) public returns(bool) {
        burned = burned.add(value);
        _burn(msg.sender, value);
        return true;
    }

    function burnFrom(address from, uint256 value) public returns(bool) {
        burned = burned.add(value);
        _burnFrom(from, value);
        return true;
    }
    
    function isContract(address _addr) private view returns (bool) {
        uint256 length;
        assembly {
            //retrieve the size of the code on target address, this needs assembly
            length := extcodesize(_addr)
        }
        return (length > 0);
    }

    // Token holder can notify a contract that it has been approved
    // to spend _value of tokens
    // @param to The Resonance contract address
    // @param value: The constant of 100 * 10**18
    // @param inviterAddress The inviter
    function participantFission(address to, uint256 value, address inviterAddress) public returns (bool) {
        require(to != address(0) && to != address(this), "invalid contract address!");
        require(balanceOf(msg.sender) >= value, "have no enough token!");

        if(approve(to, value) && isContract(to)) {
            Resonance receiver = Resonance(to);
            receiver.participantFission(msg.sender, inviterAddress);
        }
        return true;
    }
}
function participantFission(address to, uint256 value, address inviterAddress) public returns (bool) {
    require(to != address(0) && to != address(this), "invalid contract address!");
    require(balanceOf(msg.sender) >= value, "have no enough token!");

    if(approve(to, value) && isContract(to)) {
        Resonance receiver = Resonance(to);
        receiver.participantFission(msg.sender, inviterAddress);
    }
    return true;
}

// Token holder can notify a contract that it has been approved
// to spend _value of tokens
// @param to The Resonance contract address
// @param value: The constant of 100 * 10**18
// @param inviterAddress The inviter