POA Network merged with the Gnosis Chain. More information about the merger.

Contract Address Details

0x2aba88B4F87d45F9582EC4eeC28998218A527590

Contract Name
HintoTips
Creator
0x37c98b–f81147 at 0x11df1f–8657f9
Balance
0 POA
Tokens
Fetching tokens...
Transactions
385 Transactions
Transfers
0 Transfers
Gas Used
75,733,137
Last Balance Update
28171000
Contract name:
HintoTips




Optimization enabled
false
Compiler version
v0.5.10+commit.5a6ea5b1




EVM Version
default




Verified at
2020-05-26T15:19:45.710989Z

Contract source code

// File: openzeppelin-solidity/contracts/GSN/Context.sol

pragma solidity ^0.5.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = _msgSender();
        emit OwnershipTransferred(address(0), _owner);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: contracts/HintoTips.sol

pragma solidity ^0.5.10;


contract HintoTips is Ownable {
    mapping(address => bool) public publishers;
    uint256 tipsCount;
    mapping(uint256 => Tip) public tips;

    struct Tip {
        address publisher;
        bytes32 tipCode;
        bytes32 tipMetaSha256Hash;
        bytes32[] recipients;
        bool isValid;
    }

    event ApprovePublisher(address publisher);
    event PublisherDisapproved(address publisher);
    event TipPublished(
        address publisher,
        bytes32 tipCode,
        uint256 tipId,
        bytes32[] indexed recipients
    );
    event TipVoided(uint256 tipId);

    modifier isPublisher() {
        require(
            publishers[msg.sender],
            "Only approved publishers can call this method"
        );
        _;
    }

    modifier tipExists(uint256 _tipId) {
        require(tipsCount > _tipId, "Tip with the given id does not exist");
        _;
    }
    
    constructor() public Ownable() {}

    function approvePublisher(address _publisher) external onlyOwner() {
        publishers[_publisher] = true;
        emit ApprovePublisher(_publisher);
    }

    function disapprovePublisher(address _publisher) external onlyOwner() {
        publishers[_publisher] = false;
        emit PublisherDisapproved(_publisher);
    }

    function publishTip(
        bytes32 _tipCode,
        bytes32 _tipMetaSha256Hash,
        bytes32[] calldata _recipients
    ) external isPublisher() {
        Tip memory tip = Tip(
            msg.sender,
            _tipCode,
            _tipMetaSha256Hash,
            _recipients,
            true
        );
        tips[tipsCount] = tip;
        emit TipPublished(msg.sender, _tipCode, tipsCount, _recipients);
        tipsCount++;
    }

    function invalidateTip(uint256 _tipId) external tipExists(_tipId) {
        require(
            msg.sender == owner() || tips[_tipId].publisher == msg.sender,
            "Only the contract owner or the tip publisher can unvalid it"
        );
        tips[_tipId].isValid = false;
        emit TipVoided(_tipId);
    }

    function getTipsCount() external view returns (uint256) {
        return tipsCount;
    }

    function getTip(uint256 _tipId)
        external
        view
        tipExists(_tipId)
        returns (address, bytes32, bytes32, bytes32[] memory, bool)
    {
        return (
            tips[_tipId].publisher,
            tips[_tipId].tipCode,
            tips[_tipId].tipMetaSha256Hash,
            tips[_tipId].recipients,
            tips[_tipId].isValid
        );
    }
}
        

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"publishers","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"disapprovePublisher","inputs":[{"type":"address","name":"_publisher"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""},{"type":"bytes32","name":""},{"type":"bytes32","name":""},{"type":"bytes32[]","name":""},{"type":"bool","name":""}],"name":"getTip","inputs":[{"type":"uint256","name":"_tipId"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getTipsCount","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"publisher"},{"type":"bytes32","name":"tipCode"},{"type":"bytes32","name":"tipMetaSha256Hash"},{"type":"bool","name":"isValid"}],"name":"tips","inputs":[{"type":"uint256","name":""}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"approvePublisher","inputs":[{"type":"address","name":"_publisher"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"invalidateTip","inputs":[{"type":"uint256","name":"_tipId"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"publishTip","inputs":[{"type":"bytes32","name":"_tipCode"},{"type":"bytes32","name":"_tipMetaSha256Hash"},{"type":"bytes32[]","name":"_recipients"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner"}],"constant":false},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"event","name":"ApprovePublisher","inputs":[{"type":"address","name":"publisher","indexed":false}],"anonymous":false},{"type":"event","name":"PublisherDisapproved","inputs":[{"type":"address","name":"publisher","indexed":false}],"anonymous":false},{"type":"event","name":"TipPublished","inputs":[{"type":"address","name":"publisher","indexed":false},{"type":"bytes32","name":"tipCode","indexed":false},{"type":"uint256","name":"tipId","indexed":false},{"type":"bytes32[]","name":"recipients","indexed":true}],"anonymous":false},{"type":"event","name":"TipVoided","inputs":[{"type":"uint256","name":"tipId","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a12247b011610071578063a12247b01461029e578063a5c68c59146102bc578063d9c39a4814610343578063e1b610d914610387578063f1732ef8146103b5578063f2fde38b14610442576100b4565b80630a4d85cd146100b9578063567b45ed146101155780635b703f5c14610159578063715018a6146102285780638da5cb5b146102325780638f32d59b1461027c575b600080fd5b6100fb600480360360208110156100cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610486565b604051808215151515815260200191505060405180910390f35b6101576004803603602081101561012b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104a6565b005b6101856004803603602081101561016f57600080fd5b81019080803590602001909291905050506105de565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019060200280838360005b838110156102105780820151818401526020810190506101f5565b50505050905001965050505050505060405180910390f35b610230610747565b005b61023a610880565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102846108a9565b604051808215151515815260200191505060405180910390f35b6102a6610907565b6040518082815260200191505060405180910390f35b6102e8600480360360208110156102d257600080fd5b8101908080359060200190929190505050610911565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018215151515815260200194505050505060405180910390f35b6103856004803603602081101561035957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061096e565b005b6103b36004803603602081101561039d57600080fd5b8101908080359060200190929190505050610aa5565b005b610440600480360360608110156103cb57600080fd5b810190808035906020019092919080359060200190929190803590602001906401000000008111156103fc57600080fd5b82018360208201111561040e57600080fd5b8035906020019184602083028401116401000000008311171561043057600080fd5b9091929391929390505050610c61565b005b6104846004803603602081101561045857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eef565b005b60016020528060005260406000206000915054906101000a900460ff1681565b6104ae6108a9565b610520576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f7b3db2dda9705ffe0b19ae3ef8d593d72f0f13ab4f8784c42a5035bd8bb9d65f81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600080600060606000858060025411610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061120f6024913960400191505060405180910390fd5b6003600088815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003600089815260200190815260200160002060010154600360008a815260200190815260200160002060020154600360008b8152602001908152602001600020600301600360008c815260200190815260200160002060040160009054906101000a900460ff168180548060200260200160405190810160405280929190818152602001828054801561072c57602002820191906000526020600020905b815481526020019060010190808311610718575b50505050509150955095509550955095505091939590929450565b61074f6108a9565b6107c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108eb610f75565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000600254905090565b60036020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060040160009054906101000a900460ff16905084565b6109766108a9565b6109e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fdf395142d9c1005448e00a212d72dd8fafa4c4fb7378a96356c89a976d0b9b2181604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b808060025411610b00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061120f6024913960400191505060405180910390fd5b610b08610880565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ba257503373ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610bf7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001806111d4603b913960400191505060405180910390fd5b60006003600084815260200190815260200160002060040160006101000a81548160ff0219169083151502179055507f0d9e16108323466f24873f2464a03b49500406357c0df02a1dbcf4b1566b1d1a826040518082815260200191505060405180910390a15050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d8152602001806111a7602d913960400191505060405180910390fd5b610d0b6110c1565b6040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001868152602001858152602001848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505081526020016001151581525090508060036000600254815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201556060820151816003019080519060200190610e1b92919061110e565b5060808201518160040160006101000a81548160ff021916908315150217905550905050828260405180838360200280828437808301925050509250505060405180910390207f18731124f9a6160e7efcff3bb3147acab4b1c6fb6278bef5d71c64ec09981c113387600254604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a26002600081548092919060010191905055505050505050565b610ef76108a9565b610f69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f7281610f7d565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611003576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111816026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000801916815260200160008019168152602001606081526020016000151581525090565b82805482825590600052602060002090810192821561114a579160200282015b8281111561114957825182559160200191906001019061112e565b5b509050611157919061115b565b5090565b61117d91905b80821115611179576000816000905550600101611161565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f6e6c7920617070726f766564207075626c6973686572732063616e2063616c6c2074686973206d6574686f644f6e6c792074686520636f6e7472616374206f776e6572206f722074686520746970207075626c69736865722063616e20756e76616c696420697454697020776974682074686520676976656e20696420646f6573206e6f74206578697374a265627a7a72305820ea83dd3675d026fb0ffe547939b9f7452ef5b90f776add936b6bfe1b3c26014f64736f6c634300050a0032