|
| 1 | +// This older version of the Emitter contract can be use to keep the strict bytes test against it while we work on |
| 2 | +// updating the strict bytes checking to be compatible with newer solidity versions. |
| 3 | +// # See: https://github.com/ethereum/web3.py/issues/2301 |
| 4 | + |
| 5 | +pragma solidity ^0.4.21; |
| 6 | + |
| 7 | + |
| 8 | +contract Emitter { |
| 9 | + event LogAnonymous() anonymous; |
| 10 | + event LogNoArguments(); |
| 11 | + event LogSingleArg(uint arg0); |
| 12 | + event LogDoubleArg(uint arg0, uint arg1); |
| 13 | + event LogTripleArg(uint arg0, uint arg1, uint arg2); |
| 14 | + event LogQuadrupleArg(uint arg0, uint arg1, uint arg2, uint arg3); |
| 15 | + event LogString(string v); |
| 16 | + event LogBytes(bytes v); |
| 17 | + |
| 18 | + // Indexed |
| 19 | + event LogSingleWithIndex(uint indexed arg0); |
| 20 | + event LogSingleAnonymous(uint indexed arg0) anonymous; |
| 21 | + event LogDoubleWithIndex(uint arg0, uint indexed arg1); |
| 22 | + event LogDoubleAnonymous(uint arg0, uint indexed arg1) anonymous; |
| 23 | + event LogTripleWithIndex(uint arg0, uint indexed arg1, uint indexed arg2); |
| 24 | + event LogQuadrupleWithIndex(uint arg0, uint arg1, uint indexed arg2, uint indexed arg3); |
| 25 | + event LogDynamicArgs(string indexed arg0, string arg1); |
| 26 | + event LogListArgs(bytes2[] indexed arg0, bytes2[] arg1); |
| 27 | + event LogAddressIndexed(address indexed arg0, address arg1); |
| 28 | + event LogAddressNotIndexed(address arg0, address arg1); |
| 29 | + |
| 30 | + enum WhichEvent { |
| 31 | + LogAnonymous, |
| 32 | + LogNoArguments, |
| 33 | + LogSingleArg, |
| 34 | + LogDoubleArg, |
| 35 | + LogTripleArg, |
| 36 | + LogQuadrupleArg, |
| 37 | + LogSingleAnonymous, |
| 38 | + LogSingleWithIndex, |
| 39 | + LogDoubleAnonymous, |
| 40 | + LogDoubleWithIndex, |
| 41 | + LogTripleWithIndex, |
| 42 | + LogQuadrupleWithIndex, |
| 43 | + LogBytes, |
| 44 | + LogString, |
| 45 | + LogDynamicArgs, |
| 46 | + LogListArgs, |
| 47 | + LogAddressIndexed, |
| 48 | + LogAddressNotIndexed |
| 49 | + } |
| 50 | + |
| 51 | + function logNoArgs(WhichEvent which) public { |
| 52 | + if (which == WhichEvent.LogNoArguments) emit LogNoArguments(); |
| 53 | + else if (which == WhichEvent.LogAnonymous) emit LogAnonymous(); |
| 54 | + else revert("Didn't match any allowable event index"); |
| 55 | + } |
| 56 | + |
| 57 | + function logSingle(WhichEvent which, uint arg0) public { |
| 58 | + if (which == WhichEvent.LogSingleArg) emit LogSingleArg(arg0); |
| 59 | + else if (which == WhichEvent.LogSingleWithIndex) emit LogSingleWithIndex(arg0); |
| 60 | + else if (which == WhichEvent.LogSingleAnonymous) emit LogSingleAnonymous(arg0); |
| 61 | + else revert("Didn't match any allowable event index"); |
| 62 | + } |
| 63 | + |
| 64 | + function logDouble(WhichEvent which, uint arg0, uint arg1) public { |
| 65 | + if (which == WhichEvent.LogDoubleArg) emit LogDoubleArg(arg0, arg1); |
| 66 | + else if (which == WhichEvent.LogDoubleWithIndex) emit LogDoubleWithIndex(arg0, arg1); |
| 67 | + else if (which == WhichEvent.LogDoubleAnonymous) emit LogDoubleAnonymous(arg0, arg1); |
| 68 | + else revert("Didn't match any allowable event index"); |
| 69 | + } |
| 70 | + |
| 71 | + function logTriple(WhichEvent which, uint arg0, uint arg1, uint arg2) public { |
| 72 | + if (which == WhichEvent.LogTripleArg) emit LogTripleArg(arg0, arg1, arg2); |
| 73 | + else if (which == WhichEvent.LogTripleWithIndex) emit LogTripleWithIndex(arg0, arg1, arg2); |
| 74 | + else revert("Didn't match any allowable event index"); |
| 75 | + } |
| 76 | + |
| 77 | + function logQuadruple(WhichEvent which, uint arg0, uint arg1, uint arg2, uint arg3) public { |
| 78 | + if (which == WhichEvent.LogQuadrupleArg) emit LogQuadrupleArg(arg0, arg1, arg2, arg3); |
| 79 | + else if (which == WhichEvent.LogQuadrupleWithIndex) emit LogQuadrupleWithIndex(arg0, arg1, arg2, arg3); |
| 80 | + else revert("Didn't match any allowable event index"); |
| 81 | + } |
| 82 | + |
| 83 | + function logDynamicArgs(string arg0, string arg1) public { |
| 84 | + emit LogDynamicArgs(arg0, arg1); |
| 85 | + } |
| 86 | + |
| 87 | + function logListArgs(bytes2[] arg0, bytes2[] arg1) public { |
| 88 | + emit LogListArgs(arg0, arg1); |
| 89 | + } |
| 90 | + |
| 91 | + function logAddressIndexedArgs(address arg0, address arg1) public { |
| 92 | + emit LogAddressIndexed(arg0, arg1); |
| 93 | + } |
| 94 | + |
| 95 | + function logAddressNotIndexedArgs(address arg0, address arg1) public { |
| 96 | + emit LogAddressNotIndexed(arg0, arg1); |
| 97 | + } |
| 98 | + |
| 99 | + function logBytes(bytes v) public { |
| 100 | + emit LogBytes(v); |
| 101 | + } |
| 102 | + |
| 103 | + function logString(string v) public { |
| 104 | + emit LogString(v); |
| 105 | + } |
| 106 | +} |
0 commit comments