Birthday

Welcome to the Ethereum Birthday website! The goal of this site is to show then contract’s address in order to use the Smart Contract.

The Birthday Smart Contract allows you to define a date and send an amount of ether to the contract. Simply execute the function birthday(date) with your birthday in timestamp and send an amount of ether to it. It must be less than or equal 1 year.

When your birthday comes, you’ll be able to get the present by executing the function checkBirthday(). Remember to execute it with a google calendar reminder.

The address of the contract is: 0xdccf47eb04e2aee2b14a5548d93822cb418ee58f

And you can execute it with parity, mist or remix.ethereum.com.

The source code is the following:

pragma solidity 0.4.15;

contract Birthday {
   struct User {
      uint256 amount;
      uint256 date;
   }

   mapping(address => User) public balances;

   /// @notice Main function to set a time to receive the ether
   /// @param _date When is your next birthday. Must be less than 1 year
   function birthday(uint256 _date) payable {
      require(_date > now);
      require(_date - now = now) {
         msg.sender.transfer(balances[msg.sender].amount);
      }
   }
}

And the ABI is:

[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"amount","type":"uint256"},{"name":"date","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_date","type":"uint256"}],"name":"birthday","outputs":[],"payable":true,"type":"function","stateMutability":"payable"},{"constant":false,"inputs":[],"name":"checkBirthday","outputs":[],"payable":false,"type":"function","stateMutability":"nonpayable"}]
Advertisements