aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/current/test/MaliciousToken/MaliciousToken.sol
blob: 9e502616cdd78c7bd5f12d0e5c8fae1641c2ae82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pragma solidity ^0.4.18;

import { ERC20Token } from "../../tokens/ERC20Token/ERC20Token.sol";

contract MaliciousToken is ERC20Token {
    uint8 stateToUpdate = 1;  // Not null so that change only requires 5000 gas

    function updateState()
        internal
    {
        stateToUpdate++;
    }

    function balanceOf(address _owner)
        public
        constant
        returns (uint)
    {
        updateState();
        return balances[_owner];
    }

    function allowance(address _owner, address _spender)
        public
        constant
        returns (uint)
    {
        updateState();
        return allowed[_owner][_spender];
    }
}