@@ -832,6 +832,82 @@ def CallerTesterContract(web3, CALLER_TESTER_CONTRACT):
832
832
return web3 .eth .contract (** CALLER_TESTER_CONTRACT )
833
833
834
834
835
+ REVERT_CONTRACT_SOURCE = """
836
+ pragma solidity ^0.6.1;
837
+
838
+ contract RevertContract {
839
+ function normalFunction() public pure returns (bool) {
840
+ return true;
841
+ }
842
+
843
+ function revertFunction() public pure {
844
+ revert('Function has been reverted.');
845
+ }
846
+ }
847
+ """
848
+
849
+
850
+ REVERT_CONTRACT_BYTECODE = "608060405234801561001057600080fd5b5061010c806100206000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806383fcb85e146037578063d67e4b8414603f575b600080fd5b603d605f565b005b604560cd565b604051808215151515815260200191505060405180910390f35b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f46756e6374696f6e20686173206265656e2072657665727465642e000000000081525060200191505060405180910390fd5b6000600190509056fea26469706673582212206b3e8456a530e8c500866943d9e7c5e083be8e70bfd6f57502e9cb19b9ef3e4464736f6c63430006010033" # noqa: E501
851
+
852
+
853
+ REVERT_CONTRACT_RUNTIME_CODE = "6080604052348015600f57600080fd5b506004361060325760003560e01c806383fcb85e146037578063d67e4b8414603f575b600080fd5b603d605f565b005b604560cd565b604051808215151515815260200191505060405180910390f35b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f46756e6374696f6e20686173206265656e2072657665727465642e000000000081525060200191505060405180910390fd5b6000600190509056fea26469706673582212206b3e8456a530e8c500866943d9e7c5e083be8e70bfd6f57502e9cb19b9ef3e4464736f6c63430006010033" # noqa: E501
854
+
855
+
856
+ _REVERT_CONTRACT_ABI = json .loads ('''[
857
+ {
858
+ "inputs": [],
859
+ "name": "normalFunction",
860
+ "outputs": [
861
+ {
862
+ "internalType": "bool",
863
+ "name": "",
864
+ "type": "bool"
865
+ }
866
+ ],
867
+ "stateMutability": "pure",
868
+ "type": "function"
869
+ },
870
+ {
871
+ "inputs": [],
872
+ "name": "revertFunction",
873
+ "outputs": [],
874
+ "stateMutability": "pure",
875
+ "type": "function"
876
+ }
877
+ ]''' ) # noqa: E501
878
+
879
+
880
+ @pytest .fixture ()
881
+ def REVERT_CONTRACT_CODE ():
882
+ return REVERT_CONTRACT_BYTECODE
883
+
884
+
885
+ @pytest .fixture ()
886
+ def REVERT_CONTRACT_RUNTIME ():
887
+ return REVERT_CONTRACT_RUNTIME_CODE
888
+
889
+
890
+ @pytest .fixture ()
891
+ def REVERT_CONTRACT_ABI ():
892
+ return _REVERT_CONTRACT_ABI
893
+
894
+
895
+ @pytest .fixture ()
896
+ def REVERT_FUNCTION_CONTRACT (REVERT_CONTRACT_CODE ,
897
+ REVERT_CONTRACT_RUNTIME ,
898
+ REVERT_CONTRACT_ABI ):
899
+ return {
900
+ 'bytecode' : REVERT_CONTRACT_CODE ,
901
+ 'bytecode_runtime' : REVERT_CONTRACT_RUNTIME ,
902
+ 'abi' : REVERT_CONTRACT_ABI ,
903
+ }
904
+
905
+
906
+ @pytest .fixture ()
907
+ def RevertContract (web3 , REVERT_FUNCTION_CONTRACT ):
908
+ return web3 .eth .contract (** REVERT_FUNCTION_CONTRACT )
909
+
910
+
835
911
class LogFunctions :
836
912
LogAnonymous = 0
837
913
LogNoArguments = 1
0 commit comments