@@ -75,41 +75,7 @@ def preview(self, safe_tx: SafeTx, events=True, call_trace=False, reset=True):
75
75
events = False
76
76
call_trace = False
77
77
78
- """
79
- Dry run a Safe transaction in a forked network environment.
80
- """
81
- if reset :
82
- chain .reset ()
83
-
84
- tx = copy (safe_tx )
85
- safe = Contract .from_abi ('Gnosis Safe' , self .address , self .get_contract ().abi )
86
- # Replace pending nonce with the subsequent nonce, this could change the safe_tx_hash
87
- tx .safe_nonce = safe .nonce ()
88
- # Forge signatures from the needed amount of owners, skip the one which submits the tx
89
- # Owners must be sorted numerically, sorting as checksum addresses may yield wrong order
90
- threshold = safe .getThreshold ()
91
- sorted_owners = sorted (safe .getOwners (), key = lambda x : int (x , 16 ))
92
- owners = [accounts .at (owner , force = True ) for owner in sorted_owners [:threshold ]]
93
- for owner in owners :
94
- safe .approveHash (tx .safe_tx_hash , {'from' : owner })
95
-
96
- # Signautres are encoded as [bytes32 r, bytes32 s, bytes8 v]
97
- # Pre-validated signatures are encoded as r=owner, s unused and v=1.
98
- # https://docs.gnosis.io/safe/docs/contracts_signatures/#pre-validated-signatures
99
- tx .signatures = b'' .join ([encode_abi (['address' , 'uint' ], [str (owner ), 0 ]) + b'\x01 ' for owner in owners ])
100
- payload = tx .w3_tx .buildTransaction ({'gas' : str (chain .block_gas_limit )})
101
- receipt = owners [0 ].transfer (payload ['to' ], payload ['value' ], gas_limit = payload ['gas' ], data = payload ['data' ])
102
-
103
- if 'ExecutionSuccess' not in receipt .events :
104
- receipt .info ()
105
- receipt .call_trace (True )
106
- raise ApeSafe .ExecutionFailure ()
107
- if events :
108
- receipt .info ()
109
- if call_trace :
110
- receipt .call_trace (True )
111
- return receipt
112
-
78
+ return super ().preview (safe_tx , events , call_trace , reset )
113
79
114
80
def get_signer (self , signer : Optional [Union [LocalAccount , str ]] = None ) -> LocalAccount :
115
81
if not self .is_ci :
0 commit comments