Skip to content
Verified contractPartial

GiftCard2017

Address0x2a0dc33d1bfc8e210bca025a363c5168ef0453b2
Balance

0 ETH

 

Transactions

4

 

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,585,022
Creation transaction
0x5ca4c56e0b…4358fcfe07

GiftCard2017.sol

pragma solidity ^0.4.18;

contract GiftCard2017{
    address owner;
    mapping (address => uint256) public authorizations;
    
    /// Constructor sets owner.
    function GiftCard2017() public {
        owner = msg.sender;
    }
    
    /// Redeems authorized ETH.
    function () public {
        uint256 _redemption = authorizations[msg.sender];   // Amount mEth available to redeem.
        require (_redemption > 0);
        authorizations[msg.sender] = 0;                     // Clear authorization.
        msg.sender.transfer(_redemption * 1e15);            // convert mEth to wei for transfer()
    }
    
    /// Contract owner deposits ETH.
    function deposit() public payable OwnerOnly {
    }
    
    /// Contract owner withdraws ETH.
    function withdraw(uint256 _amount) public OwnerOnly {
        owner.transfer(_amount);
    }

    /// Contract owner authorizes redemptions in units of 1/1000 ETH.    
    function authorize(address _addr, uint256 _amount_mEth) public OwnerOnly {
        require (this.balance >= _amount_mEth);
        authorizations[_addr] = _amount_mEth;
    }
    
    /// Check that message came from the contract owner.
    modifier OwnerOnly () {
        require (msg.sender == owner);
        _;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.