Sponsored:   Color - Revolutionizing the Dapp Ecosystem, Bounty & Airdrop, Get 240,000 COL NOW!
Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 238 txns
Token Tracker: Beercoin (🍺)
Misc
Address Watch: Add To Watch List
Contract Creator: 0x5199ca9cac93bce0f6c4c9135f7165921a0e7973at txn 0xb1c04a07dd0c7dca49c875b52bf3e001771305dabdddd0549d8a1878b9703f76
Token Balances:
 Latest 25 txns from a total Of 238 transactions

TxHash Age From To Value [TxFee]
0xdbd6276154756b6cd57404b975fc61d36cbb1966aae1456cbb21dd7c2195fc4613 days 14 hrs ago0x0e4345dd827aaecfb1b326900bb7e045bd680459  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.0000683865
0xf0af65be70e427f3c1e5af4019442f50cf89b8646b14c55c67db87685cbe71bf25 days 23 hrs ago0x8ba3a0474d83352af2ccbc95ebe24bcdba2900ad  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000027086195
0x9a76b7fb056525abd06e1d89a435c36376761c8072242a228c6d2515dfc6b6bf33 days 13 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000910776
0xf7fc9006b1650ec570c679e7c26e9c5ed10a0f350653ee9a8f6c77d21ea87a5c33 days 13 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000947125
0x2a1557cd224c691268dc246315ecbf304c8ef78c8ed5bd58ca81cf1c06b009c239 days 14 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000596784
0x913a85b00c610eaf6acc05355617a7ba894c942cb7b17e1962cb8e5d03a46a2b39 days 15 hrs ago0x073f6c5a3da4ec57fe418fa5ea2903f0c8199594  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000268836
0x1175ffa61359585b56c8600de6f6bb1fbdc1bf6c678c4c93109c6e799d1559f739 days 15 hrs ago0x073f6c5a3da4ec57fe418fa5ea2903f0c8199594  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000625764
0xc3368a31ad0bd0899988b641797a3eb1c4d7118d301c962f1384e38131e4e34b43 days 23 hrs ago0xc206e7ce29560d0c6d40f354331987e77ea0af39  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.001520403
0x7e939a53795c7104cb01fa07450df41ae852874be682b8ff80257acee6b637c048 days 19 hrs ago0xadb55d6def09fd697467da6c14405380d8ed639a  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000111249
0x3a76409a488bdbdbe4cd52a26cd42ab6bcc07385694a5a6f90da2a0727b2b6e349 days 14 hrs ago0x805846d1746eb25a95c204e01a7fd94a67afcfb4  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000037083
0xa1344cbbfc887b85742061f26627f4b658a4e4ba4c5be27df31f33fc8b18924349 days 18 hrs ago0x406f4533b2f6209812d7ef9c7d69b8c54217c208  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000252
0x22884c74cacf481ea55bf15a5c504788b5d207d8cb563fd7c1650351e835ab8452 days 1 hr ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.00007577
0x5c69e91f0b9a8f8f18c5773cea6e0af371518e77e64c66b590de688764f1d10953 days 7 hrs ago0x663f677b511734b15818b0c5d39271c2b09e6eff  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000037083
0xe5a165d16c3861262261e60dcb0f7ba51393bb8dbe395b126861d4b018f7a33e53 days 23 hrs ago0x88fc8939b9355a70aa34f2e22b6a1bb49e3d454e  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000037083
0xbaaff8006491d8f0739fac73f83fc9d66bebbd686bd22cde8ba5fa2a805b1d6054 days 48 mins ago0xcade7563154dfcacdad907a9d74cf4aa19a113fe  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000364581
0x36ac58955a779af13ccba9c37f5bd120c75314d7884ae8d607cca86db63c39f254 days 12 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000037885
0xcc90af2c213944ac8db56d9b9d7e4d299e95d7664b556ad43306c9d7ef49f68c56 days 12 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000037885
0x32d93ac6a1fe8f7018bff87c90c32ff0a807332735811f48b15d53b30766530856 days 17 hrs ago0xcade7563154dfcacdad907a9d74cf4aa19a113fe  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000185415
0x0cf7408725cf310ee28616d9cafccf7523ce83574f87fe24af7edc17f3ffa94256 days 17 hrs ago0xcade7563154dfcacdad907a9d74cf4aa19a113fe  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.00052083
0xa8d47d03cd4957cae59d2aeb51ed312a73928ee804c5a2ad926837231be09f3556 days 18 hrs ago0xcade7563154dfcacdad907a9d74cf4aa19a113fe  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000153
0x9f2d626045b3254193fcf19f91a9f13788d774c4ffbf55666ad78d7cd3df260156 days 18 hrs ago0xcade7563154dfcacdad907a9d74cf4aa19a113fe  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.001520403
0xedfd23bbfc40ceaa95b913497bbf5ce6964ea4dffd12f721070a639a692c4faf58 days 2 hrs ago0x5ae7ff3b29ad0c6b536775fd1c0fa57e03e6804f  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.00037083
0xc1bf8ce226515e3b884c9c984e584781f5f4dbcb439206ba1a8dfa02cb0af38a58 days 6 hrs ago0xb4814aae751165d391e7c85c5e0daa0a457540d6  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000353328
0xedbe96e2b83d544999e896458f1934deffe696e4c912e0f1152cd16b58684f0058 days 6 hrs ago0xee6f50857865e16f3918aad19c825d87811c909e  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.000593328
0xb20eb9b5000e2925759dcf18052205a2536665e75bf3e9f8b350613e64c3b27f60 days 13 hrs ago0x5199ca9cac93bce0f6c4c9135f7165921a0e7973  IN   0x7367a68039d4704f30bfbf6d948020c3b07dfc590 Ether0.00011254
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The compiled contract might be susceptible to EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity compiler bugs.

Contract Source Code Verified (Exact match)
Contract Name: Beercoin
Compiler Version: v0.4.19+commit.c4cbbb05
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.19;


/**
 * A contract containing the fundamental state variables of the Beercoin
 */
contract InternalBeercoin {
    // As 18 decimal places will be used, the constants are multiplied by 10^18
    uint256 internal constant INITIAL_SUPPLY = 15496000000 * 10**18;
    uint256 internal constant DIAMOND_VALUE = 10000 * 10**18;
    uint256 internal constant GOLD_VALUE = 100 * 10**18;
    uint256 internal constant SILVER_VALUE = 10 * 10**18;
    uint256 internal constant BRONZE_VALUE = 1 * 10**18;

    // In addition to the initial total supply of 15496000000 Beercoins,
    // more Beercoins will only be added by scanning bottle caps.
    // 20800000000 bottle caps will be eventually produced.
    //
    // Within 10000 bottle caps,
    // 1 (i.e. every 10000th cap in total) has a value of 10000 ("Diamond") Beercoins,
    // 9 (i.e. every 1000th cap in total) have a value of 100 ("Gold") Beercoins,
    // 990 (i.e. every 10th cap in total) have a value of 10 ("Silver") Beercoins,
    // 9000 (i.e. every remaining cap) have a value of 1 ("Bronze") Beercoin.
    //
    // Therefore one bottle cap has an average Beercoin value of
    // (1 * 10000 + 9 * 100 + 990 * 10 + 9000 * 1) / 10000 = 2.98.
    //
    // This means the total Beercoin value of all bottle caps that will
    // be eventually produced equals 20800000000 * 2.98 = 61984000000.
    uint64 internal producibleCaps = 20800000000;

    // The  amounts of diamond, gold, silver, and bronze caps are stored
    // as a single 256-bit value divided into four sections of 64 bits.
    //
    // Bits 255 to 192 are used for the amount of diamond caps,
    // bits 191 to 128 are used for the amount of gold caps,
    // bits 127 to 64 are used for the amount of silver caps,
    // bits 63 to 0 are used for the amount of bronze caps.
    //
    // For example, the following numbers represent a single cap of a certain type:
    // 0x0000000000000001000000000000000000000000000000000000000000000000 (diamond)
    // 0x0000000000000000000000000000000100000000000000000000000000000000 (gold)
    // 0x0000000000000000000000000000000000000000000000010000000000000000 (silver)
    // 0x0000000000000000000000000000000000000000000000000000000000000001 (bronze)
    uint256 internal packedProducedCaps = 0;
    uint256 internal packedScannedCaps = 0;

    // The amount of irreversibly burnt Beercoins
    uint256 internal burntValue = 0;
}


/**
 * A contract containing functions to understand the packed low-level data
 */
contract ExplorableBeercoin is InternalBeercoin {
    /**
     * The amount of caps that can still be produced
     */
    function unproducedCaps() public view returns (uint64) {
        return producibleCaps;
    }

    /**
     * The amount of caps that is produced but not yet scanned
     */
    function unscannedCaps() public view returns (uint64) {
        uint256 caps = packedProducedCaps - packedScannedCaps;
        uint64 amount = uint64(caps >> 192);
        amount += uint64(caps >> 128);
        amount += uint64(caps >> 64);
        amount += uint64(caps);
        return amount;
    }

    /**
     * The amount of all caps produced so far
     */
    function producedCaps() public view returns (uint64) {
        uint256 caps = packedProducedCaps;
        uint64 amount = uint64(caps >> 192);
        amount += uint64(caps >> 128);
        amount += uint64(caps >> 64);
        amount += uint64(caps);
        return amount;
    }

    /**
     * The amount of all caps scanned so far
     */
    function scannedCaps() public view returns (uint64) {
        uint256 caps = packedScannedCaps;
        uint64 amount = uint64(caps >> 192);
        amount += uint64(caps >> 128);
        amount += uint64(caps >> 64);
        amount += uint64(caps);
        return amount;
    }

    /**
     * The amount of diamond caps produced so far
     */
    function producedDiamondCaps() public view returns (uint64) {
        return uint64(packedProducedCaps >> 192);
    }

    /**
     * The amount of diamond caps scanned so far
     */
    function scannedDiamondCaps() public view returns (uint64) {
        return uint64(packedScannedCaps >> 192);
    }

    /**
     * The amount of gold caps produced so far
     */
    function producedGoldCaps() public view returns (uint64) {
        return uint64(packedProducedCaps >> 128);
    }

    /**
     * The amount of gold caps scanned so far
     */
    function scannedGoldCaps() public view returns (uint64) {
        return uint64(packedScannedCaps >> 128);
    }

    /**
     * The amount of silver caps produced so far
     */
    function producedSilverCaps() public view returns (uint64) {
        return uint64(packedProducedCaps >> 64);
    }

    /**
     * The amount of silver caps scanned so far
     */
    function scannedSilverCaps() public view returns (uint64) {
        return uint64(packedScannedCaps >> 64);
    }

    /**
     * The amount of bronze caps produced so far
     */
    function producedBronzeCaps() public view returns (uint64) {
        return uint64(packedProducedCaps);
    }

    /**
     * The amount of bronze caps scanned so far
     */
    function scannedBronzeCaps() public view returns (uint64) {
        return uint64(packedScannedCaps);
    }
}


/**
 * A contract implementing all standard ERC20 functionality for the Beercoin
 */
contract ERC20Beercoin is ExplorableBeercoin {
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

    mapping (address => uint256) internal balances;
    mapping (address => mapping (address => uint256)) internal allowances;

    /**
     * Beercoin's name
     */
    function name() public pure returns (string) {
        return "Beercoin";
    }

    /**
     * Beercoin's symbol
     */
    function symbol() public pure returns (string) {
        return "🍺";
    }

    /**
     * Beercoin's decimal places
     */
    function decimals() public pure returns (uint8) {
        return 18;
    }

    /**
     * The current total supply of Beercoins
     */
    function totalSupply() public view returns (uint256) {
        uint256 caps = packedScannedCaps;
        uint256 supply = INITIAL_SUPPLY;
        supply += (caps >> 192) * DIAMOND_VALUE;
        supply += ((caps >> 128) & 0xFFFFFFFFFFFFFFFF) * GOLD_VALUE;
        supply += ((caps >> 64) & 0xFFFFFFFFFFFFFFFF) * SILVER_VALUE;
        supply += (caps & 0xFFFFFFFFFFFFFFFF) * BRONZE_VALUE;
        return supply - burntValue;
    }

    /**
     * Check the balance of a Beercoin user
     *
     * @param _owner the user to check
     */
    function balanceOf(address _owner) public view returns (uint256) {
        return balances[_owner];
    }

    /**
     * Transfer Beercoins to another user
     *
     * @param _to the address of the recipient
     * @param _value the amount to send
     */
    function transfer(address _to, uint256 _value) public returns (bool) {
        require(_to != 0x0);

        uint256 balanceFrom = balances[msg.sender];

        require(_value <= balanceFrom);

        uint256 oldBalanceTo = balances[_to];
        uint256 newBalanceTo = oldBalanceTo + _value;

        require(oldBalanceTo <= newBalanceTo);

        balances[msg.sender] = balanceFrom - _value;
        balances[_to] = newBalanceTo;

        Transfer(msg.sender, _to, _value);

        return true;
    }

    /**
     * Transfer Beercoins from other address if a respective allowance exists
     *
     * @param _from the address of the sender
     * @param _to the address of the recipient
     * @param _value the amount to send
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
        require(_to != 0x0);

        uint256 balanceFrom = balances[_from];
        uint256 allowanceFrom = allowances[_from][msg.sender];

        require(_value <= balanceFrom);
        require(_value <= allowanceFrom);

        uint256 oldBalanceTo = balances[_to];
        uint256 newBalanceTo = oldBalanceTo + _value;

        require(oldBalanceTo <= newBalanceTo);

        balances[_from] = balanceFrom - _value;
        balances[_to] = newBalanceTo;
        allowances[_from][msg.sender] = allowanceFrom - _value;

        Transfer(_from, _to, _value);

        return true;
    }

    /**
     * Allow another user to spend a certain amount of Beercoins on your behalf
     *
     * @param _spender the address of the user authorized to spend
     * @param _value the maximum amount that can be spent on your behalf
     */
    function approve(address _spender, uint256 _value) public returns (bool) {
        allowances[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    /**
     * The amount of Beercoins that can be spent by a user on behalf of another
     *
     * @param _owner the address of the user user whose Beercoins are spent
     * @param _spender the address of the user who executes the transaction
     */
    function allowance(address _owner, address _spender) public view returns (uint256) {
        return allowances[_owner][_spender];
    }
}


/**
 * A contract that defines a master with special debiting abilities
 * required for operating a user-friendly Beercoin redemption system
 */
contract MasteredBeercoin is ERC20Beercoin {
    address internal beercoinMaster;
    mapping (address => bool) internal directDebitAllowances;

    /**
     * Construct the MasteredBeercoin contract
     * and make the sender the master
     */
    function MasteredBeercoin() public {
        beercoinMaster = msg.sender;
    }

    /**
     * Restrict to the master only
     */
    modifier onlyMaster {
        require(msg.sender == beercoinMaster);
        _;
    }

    /**
     * The master of the Beercoin
     */
    function master() public view returns (address) {
        return beercoinMaster;
    }

    /**
     * Declare a master at another address
     *
     * @param newMaster the new owner's address
     */
    function declareNewMaster(address newMaster) public onlyMaster {
        beercoinMaster = newMaster;
    }

    /**
     * Allow the master to withdraw Beercoins from your
     * account so you don't have to send Beercoins yourself
     */
    function allowDirectDebit() public {
        directDebitAllowances[msg.sender] = true;
    }

    /**
     * Forbid the master to withdraw Beercoins from you account
     */
    function forbidDirectDebit() public {
        directDebitAllowances[msg.sender] = false;
    }

    /**
     * Check whether a user allows direct debits by the master
     *
     * @param user the user to check
     */
    function directDebitAllowance(address user) public view returns (bool) {
        return directDebitAllowances[user];
    }

    /**
     * Withdraw Beercoins from multiple users
     *
     * Beercoins are only withdrawn this way if and only if
     * a user deliberately wants it to happen by initiating
     * a transaction on a plattform operated by the owner
     *
     * @param users the addresses of the users to take Beercoins from
     * @param values the respective amounts to take
     */
    function debit(address[] users, uint256[] values) public onlyMaster returns (bool) {
        require(users.length == values.length);

        uint256 oldBalance = balances[msg.sender];
        uint256 newBalance = oldBalance;

        address currentUser;
        uint256 currentValue;
        uint256 currentBalance;
        for (uint256 i = 0; i < users.length; ++i) {
            currentUser = users[i];
            currentValue = values[i];
            currentBalance = balances[currentUser];

            require(directDebitAllowances[currentUser]);
            require(currentValue <= currentBalance);
            balances[currentUser] = currentBalance - currentValue;
            
            newBalance += currentValue;

            Transfer(currentUser, msg.sender, currentValue);
        }

        require(oldBalance <= newBalance);
        balances[msg.sender] = newBalance;

        return true;
    }

    /**
     * Withdraw Beercoins from multiple users
     *
     * Beercoins are only withdrawn this way if and only if
     * a user deliberately wants it to happen by initiating
     * a transaction on a plattform operated by the owner
     *
     * @param users the addresses of the users to take Beercoins from
     * @param value the amount to take from each user
     */
    function debitEqually(address[] users, uint256 value) public onlyMaster returns (bool) {
        uint256 oldBalance = balances[msg.sender];
        uint256 newBalance = oldBalance + (users.length * value);

        require(oldBalance <= newBalance);
        balances[msg.sender] = newBalance;

        address currentUser;
        uint256 currentBalance;
        for (uint256 i = 0; i < users.length; ++i) {
            currentUser = users[i];
            currentBalance = balances[currentUser];

            require(directDebitAllowances[currentUser]);
            require(value <= currentBalance);
            balances[currentUser] = currentBalance - value;

            Transfer(currentUser, msg.sender, value);
        }

        return true;
    }

    /**
     * Send Beercoins to multiple users
     *
     * @param users the addresses of the users to send Beercoins to
     * @param values the respective amounts to send
     */
    function credit(address[] users, uint256[] values) public onlyMaster returns (bool) {
        require(users.length == values.length);

        uint256 balance = balances[msg.sender];
        uint256 totalValue = 0;

        address currentUser;
        uint256 currentValue;
        uint256 currentOldBalance;
        uint256 currentNewBalance;
        for (uint256 i = 0; i < users.length; ++i) {
            currentUser = users[i];
            currentValue = values[i];
            currentOldBalance = balances[currentUser];
            currentNewBalance = currentOldBalance + currentValue;

            require(currentOldBalance <= currentNewBalance);
            balances[currentUser] = currentNewBalance;

            totalValue += currentValue;

            Transfer(msg.sender, currentUser, currentValue);
        }

        require(totalValue <= balance);
        balances[msg.sender] = balance - totalValue;

        return true;
    }

    /**
     * Send Beercoins to multiple users
     *
     * @param users the addresses of the users to send Beercoins to
     * @param value the amounts to send to each user
     */
    function creditEqually(address[] users, uint256 value) public onlyMaster returns (bool) {
        uint256 balance = balances[msg.sender];
        uint256 totalValue = users.length * value;

        require(totalValue <= balance);
        balances[msg.sender] = balance - totalValue;

        address currentUser;
        uint256 currentOldBalance;
        uint256 currentNewBalance;
        for (uint256 i = 0; i < users.length; ++i) {
            currentUser = users[i];
            currentOldBalance = balances[currentUser];
            currentNewBalance = currentOldBalance + value;

            require(currentOldBalance <= currentNewBalance);
            balances[currentUser] = currentNewBalance;

            Transfer(msg.sender, currentUser, value);
        }

        return true;
    }
}


/**
 * A contract that defines the central business logic
 * which also mirrors the life of a Beercoin
 */
contract Beercoin is MasteredBeercoin {
    event Produce(uint256 newCaps);
    event Scan(address[] users, uint256[] caps);
    event Burn(uint256 value);

    /**
     * Construct the Beercoin contract and
     * assign the initial supply to the creator
     */
    function Beercoin() public {
        balances[msg.sender] = INITIAL_SUPPLY;
    }

    /**
     * Increase the amounts of produced diamond, gold, silver, and
     * bronze bottle caps in respect to their occurrence probabilities
     *
     * This function is called if and only if a brewery has actually
     * ordered codes to produce the specified amount of bottle caps
     *
     * @param numberOfCaps the number of bottle caps to be produced
     */
    function produce(uint64 numberOfCaps) public onlyMaster returns (bool) {
        require(numberOfCaps <= producibleCaps);

        uint256 producedCaps = packedProducedCaps;

        uint64 targetTotalCaps = numberOfCaps;
        targetTotalCaps += uint64(producedCaps >> 192);
        targetTotalCaps += uint64(producedCaps >> 128);
        targetTotalCaps += uint64(producedCaps >> 64);
        targetTotalCaps += uint64(producedCaps);

        uint64 targetDiamondCaps = (targetTotalCaps - (targetTotalCaps % 10000)) / 10000;
        uint64 targetGoldCaps = ((targetTotalCaps - (targetTotalCaps % 1000)) / 1000) - targetDiamondCaps;
        uint64 targetSilverCaps = ((targetTotalCaps - (targetTotalCaps % 10)) / 10) - targetDiamondCaps - targetGoldCaps;
        uint64 targetBronzeCaps = targetTotalCaps - targetDiamondCaps - targetGoldCaps - targetSilverCaps;

        uint256 targetProducedCaps = 0;
        targetProducedCaps |= uint256(targetDiamondCaps) << 192;
        targetProducedCaps |= uint256(targetGoldCaps) << 128;
        targetProducedCaps |= uint256(targetSilverCaps) << 64;
        targetProducedCaps |= uint256(targetBronzeCaps);

        producibleCaps -= numberOfCaps;
        packedProducedCaps = targetProducedCaps;

        Produce(targetProducedCaps - producedCaps);

        return true;
    }

    /**
     * Approve scans of multiple users and grant Beercoins
     *
     * This function is called periodically to mass-transfer Beercoins to
     * multiple users if and only if each of them has scanned codes that
     * our server has never verified before for the same or another user
     *
     * @param users the addresses of the users who scanned valid codes
     * @param caps the amounts of caps the users have scanned as single 256-bit values
     */
    function scan(address[] users, uint256[] caps) public onlyMaster returns (bool) {
        require(users.length == caps.length);

        uint256 scannedCaps = packedScannedCaps;

        uint256 currentCaps;
        uint256 capsValue;
        for (uint256 i = 0; i < users.length; ++i) {
            currentCaps = caps[i];

            capsValue = DIAMOND_VALUE * (currentCaps >> 192);
            capsValue += GOLD_VALUE * ((currentCaps >> 128) & 0xFFFFFFFFFFFFFFFF);
            capsValue += SILVER_VALUE * ((currentCaps >> 64) & 0xFFFFFFFFFFFFFFFF);
            capsValue += BRONZE_VALUE * (currentCaps & 0xFFFFFFFFFFFFFFFF);

            balances[users[i]] += capsValue;
            scannedCaps += currentCaps;
        }

        require(scannedCaps <= packedProducedCaps);
        packedScannedCaps = scannedCaps;

        Scan(users, caps);

        return true;
    }

    /**
     * Remove Beercoins from the system irreversibly
     *
     * @param value the amount of Beercoins to burn
     */
    function burn(uint256 value) public onlyMaster returns (bool) {
        uint256 balance = balances[msg.sender];
        require(value <= balance);

        balances[msg.sender] = balance - value;
        burntValue += value;

        Burn(value);

        return true;
    }
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"user","type":"address"}],"name":"directDebitAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"producedCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"producedDiamondCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"forbidDirectDebit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"producedSilverCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"producedGoldCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"burn","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"scannedBronzeCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scannedCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newMaster","type":"address"}],"name":"declareNewMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"producedBronzeCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scannedDiamondCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unproducedCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unscannedCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"users","type":"address[]"},{"name":"value","type":"uint256"}],"name":"debitEqually","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"scannedSilverCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"users","type":"address[]"},{"name":"value","type":"uint256"}],"name":"creditEqually","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"users","type":"address[]"},{"name":"values","type":"uint256[]"}],"name":"debit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"allowDirectDebit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"users","type":"address[]"},{"name":"caps","type":"uint256[]"}],"name":"scan","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"numberOfCaps","type":"uint64"}],"name":"produce","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"scannedGoldCaps","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"users","type":"address[]"},{"name":"values","type":"uint256[]"}],"name":"credit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"master","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newCaps","type":"uint256"}],"name":"Produce","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"users","type":"address[]"},{"indexed":false,"name":"caps","type":"uint256[]"}],"name":"Scan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526000805467ffffffffffffffff19166404d7c6d00017815560018190556002819055600355341561003457600080fd5b60068054600160a060020a033316600160a060020a0319909116811790915560009081526004602052604090206b3211fda33de48ff98800000090556116258061007f6000396000f3006060604052600436106101a05763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630628769381146101a557806306fdde03146101d857806307336e3514610262578063095ea7b3146102925780630e53bf67146102b457806318160ddd146102c75780631b2212f5146102ec57806323b872dd14610301578063266fc4361461032957806330e6c3331461033c578063313ce5671461034f57806342966c681461037857806344b88a6d1461038e5780634509052f146103a15780634b2f9eb7146103b457806367ea43bd146103d35780636854df55146103e65780636f7495cb146103f95780636fbf466c1461040c57806370a082311461041f5780637634ecc01461043e57806378ec0adf1461048f57806383b40eb7146104a257806395d89b41146104f357806397c06deb146105065780639933a24a14610595578063a534a920146105a8578063a9059cbb14610637578063bc25415c14610659578063bf3da86514610679578063c89b50c71461068c578063dd62ed3e1461071b578063ee97f7f314610740575b600080fd5b34156101b057600080fd5b6101c4600160a060020a036004351661076f565b604051901515815260200160405180910390f35b34156101e357600080fd5b6101eb61078d565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561022757808201518382015260200161020f565b50505050905090810190601f1680156102545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026d57600080fd5b6102756107ce565b60405167ffffffffffffffff909116815260200160405180910390f35b341561029d57600080fd5b6101c4600160a060020a03600435166024356107f1565b34156102bf57600080fd5b61027561085d565b34156102d257600080fd5b6102da61086a565b60405190815260200160405180910390f35b34156102f757600080fd5b6102ff6108e3565b005b341561030c57600080fd5b6101c4600160a060020a0360043581169060243516604435610905565b341561033457600080fd5b610275610a14565b341561034757600080fd5b610275610a26565b341561035a57600080fd5b610362610a33565b60405160ff909116815260200160405180910390f35b341561038357600080fd5b6101c4600435610a38565b341561039957600080fd5b610275610ae2565b34156103ac57600080fd5b610275610ae8565b34156103bf57600080fd5b6102ff600160a060020a0360043516610b0b565b34156103de57600080fd5b610275610b55565b34156103f157600080fd5b610275610b5b565b341561040457600080fd5b610275610b68565b341561041757600080fd5b610275610b78565b341561042a57600080fd5b6102da600160a060020a0360043516610ba2565b341561044957600080fd5b6101c460046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610bbd92505050565b341561049a57600080fd5b610275610cf2565b34156104ad57600080fd5b6101c460046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610d0492505050565b34156104fe57600080fd5b6101eb610e25565b341561051157600080fd5b6101c4600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610e6695505050505050565b34156105a057600080fd5b6102ff610fc3565b34156105b357600080fd5b6101c4600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610fe895505050505050565b341561064257600080fd5b6101c4600160a060020a03600435166024356111c7565b341561066457600080fd5b6101c467ffffffffffffffff6004351661128e565b341561068457600080fd5b610275611435565b341561069757600080fd5b6101c460046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061144295505050505050565b341561072657600080fd5b6102da600160a060020a036004358116906024351661158d565b341561074b57600080fd5b6107536115b8565b604051600160a060020a03909116815260200160405180910390f35b600160a060020a031660009081526007602052604090205460ff1690565b6107956115c7565b60408051908101604052600881527f42656572636f696e0000000000000000000000000000000000000000000000006020820152905090565b60015460c060020a8104608060020a820401680100000000000000008204010190565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015460c060020a900490565b60025460035467ffffffffffffffff808316670de0b6b3a7640000026801000000000000000084048216678ac7230489e8000002608060020a85049290921668056bc75e2d631000000260c060020a90940469021e19e0c9bab240000002939093010191909101036b3211fda33de48ff9880000000190565b600160a060020a0333166000908152600760205260409020805460ff19169055565b600080808080600160a060020a038716151561092057600080fd5b600160a060020a03808916600090815260046020908152604080832054600583528184203390951684529390915290205490945092508386111561096357600080fd5b8286111561097057600080fd5b5050600160a060020a0385166000908152600460205260409020548481018082111561099b57600080fd5b600160a060020a0380891660008181526004602090815260408083208b8a0390558b851680845281842087905584845260058352818420339096168452949091529081902089870390556000805160206115da8339815191529089905190815260200160405180910390a3506001979650505050505050565b60015468010000000000000000900490565b600154608060020a900490565b601290565b600654600090819033600160a060020a03908116911614610a5857600080fd5b50600160a060020a03331660009081526004602052604090205480831115610a7f57600080fd5b600160a060020a03331660009081526004602052604090819020848303905560038054850190557fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb9084905190815260200160405180910390a150600192915050565b60025490565b60025460c060020a8104608060020a820401680100000000000000008204010190565b60065433600160a060020a03908116911614610b2657600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015490565b60025460c060020a900490565b60005467ffffffffffffffff1690565b60025460015460c060020a919003908104608060020a820401680100000000000000008204010190565b600160a060020a031660009081526004602052604090205490565b6006546000908190819081908190819033600160a060020a03908116911614610be557600080fd5b600160a060020a0333166000908152600460205260409020549450868851028501935083851115610c1557600080fd5b50600160a060020a03331660009081526004602052604081208490555b8751811015610ce457878181518110610c4757fe5b90602001906020020151600160a060020a038116600090815260046020908152604080832054600790925290912054919450925060ff161515610c8957600080fd5b81871115610c9657600080fd5b600160a060020a03808416600081815260046020526040908190208a8603905533909216916000805160206115da833981519152908a905190815260200160405180910390a3600101610c32565b506001979650505050505050565b60025468010000000000000000900490565b60065460009081908190819081908190819033600160a060020a03908116911614610d2e57600080fd5b600160a060020a033316600090815260046020526040902054955087895102945085851115610d5c57600080fd5b50600160a060020a033316600090815260046020526040812085870390555b8851811015610e1657888181518110610d9057fe5b90602001906020020151600160a060020a0381166000908152600460205260409020549094509250878301915081831115610dca57600080fd5b600160a060020a038085166000818152600460205260409081902085905590913316906000805160206115da833981519152908b905190815260200160405180910390a3600101610d7b565b50600198975050505050505050565b610e2d6115c7565b60408051908101604052600481527ff09f8dba000000000000000000000000000000000000000000000000000000006020820152905090565b60065460009081908190819081908190819033600160a060020a03908116911614610e9057600080fd5b8751895114610e9e57600080fd5b50600160a060020a03331660009081526004602052604081205495508594505b8851811015610f8c57888181518110610ed357fe5b906020019060200201519350878181518110610eeb57fe5b90602001906020020151600160a060020a038516600090815260046020908152604080832054600790925290912054919450925060ff161515610f2d57600080fd5b81831115610f3a57600080fd5b600160a060020a038085166000818152600460205260409081902086860390559685019633909216916000805160206115da8339815191529086905190815260200160405180910390a3600101610ebe565b84861115610f9957600080fd5b50505033600160a060020a0316600090815260046020526040902091909155506001949350505050565b600160a060020a0333166000908152600760205260409020805460ff19166001179055565b600654600090819081908190819033600160a060020a0390811691161461100e57600080fd5b855187511461101c57600080fd5b50600254925060005b86518110156110eb5785818151811061103a57fe5b90602001906020020151925060c060020a830469021e19e0c9bab240000002608060020a840467ffffffffffffffff90811668056bc75e2d6310000002919091016801000000000000000085048216678ac7230489e800000201908416670de0b6b3a76400000201915081600460008984815181106110b557fe5b90602001906020020151600160a060020a0316815260208101919091526040016000208054909101905592820192600101611025565b6001548411156110fa57600080fd5b60028490557fdf9f92fb62c3da8cef6b817fa08d8a9fbd8726964b86a3640e35ba7df533b6298787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561116657808201518382015260200161114e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156111a557808201518382015260200161118d565b5050505090500194505050505060405180910390a15060019695505050505050565b6000808080600160a060020a03861615156111e157600080fd5b600160a060020a03331660009081526004602052604090205492508285111561120957600080fd5b5050600160a060020a0384166000908152600460205260409020548381018082111561123457600080fd5b600160a060020a03338116600081815260046020526040808220898803905592891680825290839020849055916000805160206115da8339815191529088905190815260200160405180910390a350600195945050505050565b600654600090819081908190819081908190819033600160a060020a039081169116146112ba57600080fd5b60005467ffffffffffffffff908116908a1611156112d757600080fd5b600154965060c060020a87048901608060020a880401680100000000000000008804018701955061271067ffffffffffffffff808816829006880316049450846103e867ffffffffffffffff888116829006890316040393508385600a67ffffffffffffffff8981168290068a031604030392508284868803030391506000905060c08567ffffffffffffffff169060020a028117905060808467ffffffffffffffff169060020a028117905060408367ffffffffffffffff169060020a02811790508167ffffffffffffffff1681179050886000808282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550806001819055507f8e47a7a9f75060856558083a56a8969ecca26177786055e4f3a0d2eea227d67787820360405190815260200160405180910390a150600198975050505050505050565b600254608060020a900490565b600654600090819081908190819081908190819033600160a060020a0390811691161461146e57600080fd5b88518a511461147c57600080fd5b50600160a060020a03331660009081526004602052604081205496509450845b8951811015611553578981815181106114b157fe5b9060200190602002015194508881815181106114c957fe5b90602001906020020151600160a060020a038616600090815260046020526040902054909450925082840191508183111561150357600080fd5b600160a060020a03808616600081815260046020526040908190208590559786019790913316906000805160206115da8339815191529087905190815260200160405180910390a360010161149c565b8686111561156057600080fd5b50505033600160a060020a0316600090815260046020526040902092909303909155506001949350505050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600654600160a060020a031690565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820bc9f64cea4d31ef8a9ad99d5a705b573f2beab4f553f567d78d8e32a4be400170029

   Swarm Source:
bzzr://bc9f64cea4d31ef8a9ad99d5a705b573f2beab4f553f567d78d8e32a4be40017

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.