Skip to main content

cast/cmd/safe/
contracts.rs

1// The Safe ABI fixes the number of transaction hash fields.
2#![allow(clippy::too_many_arguments)]
3
4use alloy_primitives::{Address, address};
5use alloy_sol_types::sol;
6
7pub(super) const SAFE_V1_4_1: Address = address!("41675C099F32341bf84BFc5382aF534df5C7461a");
8pub(super) const SAFE_L2_V1_4_1: Address = address!("29fcB43b46531BcA003ddC8FCB67FFE91900C762");
9pub(super) const SAFE_PROXY_FACTORY_V1_4_1: Address =
10    address!("4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67");
11pub(super) const COMPATIBILITY_FALLBACK_HANDLER_V1_4_1: Address =
12    address!("fd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99");
13pub(super) const SIMULATE_TX_ACCESSOR_V1_4_1: Address =
14    address!("3d4BA2E0884aa488718476ca2FB8Efc291A46199");
15pub(super) const SENTINEL_OWNER: Address = address!("0000000000000000000000000000000000000001");
16pub(super) const PREDETERMINED_SALT_NONCE: &str =
17    "0xb1073742015cbcf5a3a4d9d1ae33ecf619439710b89475f92e2abd2117e90f90";
18
19sol! {
20    #[sol(rpc)]
21    interface ISafe {
22        function nonce() external view returns (uint256);
23
24        function setup(
25            address[] calldata owners,
26            uint256 threshold,
27            address to,
28            bytes calldata data,
29            address fallbackHandler,
30            address paymentToken,
31            uint256 payment,
32            address payable paymentReceiver
33        ) external;
34
35        function getTransactionHash(
36            address to,
37            uint256 value,
38            bytes calldata data,
39            uint8 operation,
40            uint256 safeTxGas,
41            uint256 baseGas,
42            uint256 gasPrice,
43            address gasToken,
44            address refundReceiver,
45            uint256 nonce
46        ) external view returns (bytes32);
47
48        function simulateAndRevert(address targetContract, bytes calldata calldataPayload) external;
49
50        function execTransaction(
51            address to,
52            uint256 value,
53            bytes calldata data,
54            uint8 operation,
55            uint256 safeTxGas,
56            uint256 baseGas,
57            uint256 gasPrice,
58            address gasToken,
59            address payable refundReceiver,
60            bytes calldata signatures
61        ) external payable returns (bool success);
62
63        event ExecutionSuccess(bytes32 indexed txHash, uint256 payment);
64        event ExecutionFailure(bytes32 indexed txHash, uint256 payment);
65    }
66
67    interface ISimulateTxAccessor {
68        function simulate(
69            address to,
70            uint256 value,
71            bytes calldata data,
72            uint8 operation
73        ) external returns (uint256 estimate, bool success, bytes memory returnData);
74    }
75
76    #[sol(rpc)]
77    interface ISafeProxyFactory {
78        event ProxyCreation(address indexed proxy, address singleton);
79
80        function createProxyWithNonce(
81            address singleton,
82            bytes memory initializer,
83            uint256 saltNonce
84        ) public returns (address proxy);
85    }
86}