Skip to content
Verified contractPartial

Messages

Address0xbca021a5b83ef3109acf4858f1d0e36f5ad15306
Balance

0 ETH

 

Transactions

3

 

Compiler

solc 0.1.3

 

Same code

Only this contract

 

Details

Compiler
solc 0.1.3+commit.028f561d
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: no, runtime code: yes
Verified on Sourcify
Created in block
54,384
Creation transaction
0xde1a62249e…cb5e23feb0

Messages.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Messages {
    struct Message {
        uint64 time;
        string contents;
    }

    mapping (address => mapping (bytes32 => Message)) public messages;
    mapping (address => bytes32[]) public hashes;
    uint public nonce;

    function deleteMessage(bytes32 h) {
        delete messages[msg.sender][h];
        for (uint i = 0; i < hashes[msg.sender].length; i++) {
            if (hashes[msg.sender][i] == h) {
                delete hashes[msg.sender][i];
            }
        }
    }

    function sendMessage(address to, string contents) {
        uint id;
        bytes32 h;
        Message m;
        id = nonce++;
        h = bytes32(id);
        m.time = 4;
        m.contents = contents;
        messages[to][h] = m;
    }

    function getMessageHashes() returns (bytes32[]) {
        return hashes[msg.sender];
    }

    function getMessageTime(bytes32 h) returns (uint) {
        return messages[msg.sender][h].time;
    }

    function getMessageContents(bytes32 h) returns (string) {
        return messages[msg.sender][h].contents;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.