Skip to content
Verified contractPartial

UserComments

Address0xf75a8e70da328ba79482632774dde52d316ecffa
Balance

0 ETH

 

Transactions

24

 

Compiler

solc 0.4.18

 

Same code

Only this contract

 

Details

Compiler
solc 0.4.18+commit.9cf6e910
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
4,472,272
Creation transaction
0xe167ac8d9d…7c7ad9d8a9

UserComments.sol

pragma solidity 0.4.18;

/// @title User Comments
/// @author Mark Beylin <[email protected]>

contract UserComments {
    event CommentAdded(string _comment, address _from, address _to, uint _time);

    struct Comment{
      string comment;
      address from;
      address to;
      bool aboutBounty;
      uint bountyId;
      uint time;
    }

    Comment[] public comments;

    modifier isValidCommentIndex(uint i){
      require (i < comments.length);
      _;
    }

    function addComment(string _comment, address _to, bool _aboutBounty, uint _bountyId)
    public
    {
      if (_aboutBounty){
        comments.push(Comment(_comment, msg.sender, address(0), _aboutBounty, _bountyId, block.timestamp));
      } else {
        comments.push(Comment(_comment, msg.sender, _to, _aboutBounty, _bountyId, block.timestamp));
      }
      CommentAdded(_comment, msg.sender, _to, block.timestamp);
    }

    function numComments()
    public
    constant
    returns (uint){
      return comments.length;
    }

    function getComment(uint _commentId)
    isValidCommentIndex(_commentId)
    public
    constant
    returns (string, address, address, bool, uint, uint){
      return (comments[_commentId].comment,
              comments[_commentId].from,
              comments[_commentId].to,
              comments[_commentId].aboutBounty,
              comments[_commentId].bountyId,
              comments[_commentId].time);
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.