Is there any trick to view the details of the incoming transaction on the Safe(Wallet) page
https://app.safe.global/.
Currently, the transaction is shown as hex-encoded, which gives no idea what to sign for.
2 Answers
Using the first 4 bytes of the hex-encoded transaction data:
0x79fcd8ee0000000000000000000000005f6e161db566aa8c4f3b087d17fc42e865a11d7e00000000000000000000000000000000000000000000001c30731cec03200000
i.e., 0x79fcd8ee
, we can get the function signature using openchain.xyz as:
increaseSupply(address,uint256)
Using Python Script
Now, you can get the ABI of increaseSupply()
function from the contract shown as "Interact with" i.e., 0xf1D2788800b3019868afe35991D360d6Ab81061c
.
As, it's a proxy contract, so the ABI of the function can be fetched from the corresponding implementation contract i.e., 0xADbaB4c2967F3Cc0c29a26A4eCb576994f6389fE
:
So, provided with the ABI of increaseSupply()
function, here is the minimal python script utilizing web3.py library, that you can use to decode the parameters:
from web3 import Web3
rpc_url = "https://base-sepolia-rpc.publicnode.com"
web3 = Web3(Web3.HTTPProvider(rpc_url))
tx_hex_data = "0x79fcd8ee0000000000000000000000005f6e161db566aa8c4f3b087d17fc42e865a11d7e00000000000000000000000000000000000000000000001c30731cec03200000"
increaseSupply_abi = """[{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increaseSupply","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]"""
gnosis_safe_contract = web3.eth.contract(abi=increaseSupply_abi)
decoded_input = gnosis_safe_contract.decode_function_input(tx_hex_data)
decoded_function = decoded_input[0]
decoded_params = decoded_input[1]
wallet = decoded_params["_wallet"]
value = decoded_params["_value"]
print("wallet:", wallet)
print("value (in Wei):", value)
print("value (in Ether):", web3.from_wei(value, 'ether'))
OUTPUT
Using CLI
You can use the cast calldata-decode
command of Foundry:
cast calldata-decode "increaseSupply(address,uint256)" 0x79fcd8ee0000000000000000000000005f6e161db566aa8c4f3b087d17fc42e865a11d7e00000000000000000000000000000000000000000000001c30731cec03200000
OUTPUT
-
Thank you for the detailed answer! What I am looking for is if there is a Safe (Wallet) setting that makes it easier to get the TX details. Commented Jul 18 at 21:24
-
As per this article, there’s currently no easy UI-way of doing this. Commented Jul 19 at 4:34
-
I’ll also add a way to do this via CLI using Foundry cast command. Commented Jul 19 at 4:37