Skip to main content

perpl_sdk/
abi.rs

1pub const DEX_REVISION: &str = env!("DEX_REVISION");
2
3#[allow(clippy::too_many_arguments)]
4pub mod dex {
5    alloy::sol!(
6        #[derive(Debug)]
7        #[sol(rpc)]
8        Exchange,
9        "abi/dex/Exchange.json"
10    );
11}
12
13#[allow(clippy::too_many_arguments)]
14pub mod erc1967_proxy {
15    alloy::sol!(
16        #[derive(Debug)]
17        #[sol(rpc)]
18        ERC1967Proxy,
19        "abi/dex/ERC1967Proxy.json"
20    );
21}
22
23#[allow(clippy::too_many_arguments)]
24pub mod errors {
25    alloy::sol!(
26        #[derive(Debug)]
27        #[sol(rpc)]
28        Exchange,
29        "abi/dex/Errors.abi.json"
30    );
31}
32
33/// Owner setters that existed before v1.1.7.4, when fees were a per-contract
34/// pair rather than a keyed schedule.
35///
36/// Removed from the exchange ABI by that release, so they are declared here to
37/// drive [`crate::testing::TestExchange::new_at_previous_version`]. Calling
38/// them against a current deployment reverts on the unknown selector.
39#[cfg(feature = "testing")]
40#[allow(clippy::too_many_arguments)]
41pub mod dex_legacy {
42    alloy::sol! {
43        #[sol(rpc)]
44        interface LegacyExchange {
45            function setTakerFee(uint256 perpId, uint256 takerFeePer100K) external;
46            function setMakerFee(uint256 perpId, uint256 makerFeePer100K) external;
47            // Pre-v1.1.7.4 `addContract`: carries two genesis-fee args the
48            // v1.1.7.4 signature dropped, so it is a distinct selector reachable
49            // only against the previous generation.
50            function addContract(
51                string name,
52                string symbol,
53                uint256 perpId,
54                uint256 basePricePNS,
55                uint256 priceDecimals,
56                uint256 lotDecimals,
57                uint256 takerFeePer100K,
58                uint256 makerFeePer100K,
59                uint256 initMarginFracHdths,
60                uint256 maintMarginFracHdths
61            ) external;
62        }
63    }
64}
65
66#[allow(clippy::too_many_arguments)]
67pub mod testing {
68    alloy::sol!(
69        /// Test ERC-20 token to use as an exchange collateral token.
70        #[derive(Debug)]
71        #[sol(rpc)]
72        TestToken,
73        "abi/testing/TestToken.json"
74    );
75}