@0xmonaco/contracts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # @0xmonaco/contracts
2
+
3
+ Smart contract ABIs and addresses for the Monaco protocol. This package provides the interface definitions and deployed addresses for all Monaco protocol contracts.
4
+
5
+ **Note:** This package currently only contains the Vault contract. Additional contracts will be added as they are deployed.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @0xmonaco/contracts
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Contract Addresses and ABIs
16
+
17
+ Access contract addresses and ABIs for different networks:
18
+
19
+ ```typescript
20
+ import { CONTRACT_ADDRESSES, CONTRACT_ABIS } from "@0xmonaco/contracts";
21
+
22
+ // Get contract addresses for Atlantic-2 testnet (chain ID 1328)
23
+ const atlanticAddresses = CONTRACT_ADDRESSES[1328];
24
+ const { vault: vaultAddress } = atlanticAddresses;
25
+
26
+ // Get contract addresses for Pacific-1 mainnet (chain ID 1329) - Coming Soon
27
+ // const pacificAddresses = CONTRACT_ADDRESSES[1329];
28
+
29
+ // Create contract instances using viem
30
+ import { createPublicClient, http } from "viem";
31
+
32
+ const client = createPublicClient({
33
+ chain: {
34
+ id: 1328, // Atlantic-2 testnet
35
+ name: "atlantic-2",
36
+ rpcUrls: {
37
+ default: { http: ["https://evm-rpc.testnet.sei.io"] },
38
+ public: { http: ["https://evm-rpc.testnet.sei.io"] },
39
+ },
40
+ },
41
+ transport: http(),
42
+ });
43
+
44
+ // Example of creating a contract instance
45
+ const vaultContract = {
46
+ address: vaultAddress,
47
+ abi: CONTRACT_ABIS.vault,
48
+ client,
49
+ };
50
+ ```
51
+
52
+ ## Contract Overview
53
+
54
+ ### Core Protocol Contracts
55
+
56
+ #### Vault
57
+
58
+ - Manages user balances and deposits
59
+ - Handles token transfers for trades
60
+ - Ensures secure fund management
61
+
62
+ **Note:** Additional contracts (CLOB, Order Book, State, Symphony Adapter) will be documented as they are deployed and integrated.
63
+
64
+ ## Network Support
65
+
66
+ The package currently supports the following networks:
67
+
68
+ - **Atlantic-2 (Testnet)**
69
+
70
+ - Chain ID: 1328
71
+ - Used for testing and development
72
+
73
+ - **Pacific-1 (Mainnet)**
74
+ - Chain ID: 1329
75
+ - Production environment (Coming Soon)
76
+
77
+ ## Contract Addresses
78
+
79
+ Each network has the following contracts deployed:
80
+
81
+ ```typescript
82
+ interface ContractAddresses {
83
+ /** Vault contract for managing user balances */
84
+ vault: string;
85
+ }
86
+ ```
87
+
88
+ ## Token Configuration
89
+
90
+ The package provides token configurations for different networks:
91
+
92
+ ```typescript
93
+ import { TESTNET_TOKENS } from "@0xmonaco/contracts";
94
+
95
+ // Access testnet tokens
96
+ const mockUSDC = TESTNET_TOKENS.MockUSDC;
97
+ const mockMTK = TESTNET_TOKENS.MockMTK;
98
+
99
+ // Use token information
100
+ console.log(`MockUSDC address: ${mockUSDC.address}`);
101
+ console.log(`MockUSDC decimals: ${mockUSDC.decimals}`);
102
+ ```
103
+
104
+ ### Available Tokens
105
+
106
+ #### Testnet (Atlantic-2)
107
+ - **MockUSDC**: `0x6A86dA986797D59A839D136dB490292Cd560C131` (6 decimals)
108
+ - **MockMTK**: `0x428F82f1ECa4AA6f6c75D77cBd2a9ceB94cde343` (18 decimals)
109
+
110
+
111
+
112
+ ## ABI Reference
113
+
114
+ The package exports a consolidated `CONTRACT_ABIS` object:
115
+
116
+ ```typescript
117
+ import { CONTRACT_ABIS } from "@0xmonaco/contracts";
118
+
119
+ const clobAbi = CONTRACT_ABIS.clob;
120
+ const vaultAbi = CONTRACT_ABIS.vault;
121
+ ```
122
+
123
+ Available ABIs in `CONTRACT_ABIS`:
124
+
125
+ - `vault`: Vault contract interface
126
+
127
+ ## Development
128
+
129
+ ### Adding New Contracts
130
+
131
+ 1. Create a new file in `src/abis/` for the contract ABI
132
+ 2. Export the ABI as a named constant
133
+ 3. Add the export to `src/abis/index.ts`
134
+ 4. Add the contract address to `CONTRACT_ADDRESSES` in `src/index.ts`
135
+
136
+ ### Updating Contract Addresses
137
+
138
+ When deploying new contracts:
139
+
140
+ 1. Update the addresses in `src/index.ts`
141
+ 2. Update the network documentation if needed
142
+ 3. Consider adding a migration guide for users
143
+
144
+ ### Best Practices
145
+
146
+ - Keep ABIs up to date with deployed contracts
147
+ - Document any breaking changes
148
+ - Maintain backward compatibility when possible
149
+ - Test contract interactions on testnet before mainnet deployment
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Contract ABIs
3
+ *
4
+ * This module exports all contract ABIs for the Monaco protocol.
5
+ * Each ABI provides type-safe contract interaction capabilities.
6
+ */
7
+ export { VAULT_ABI } from "./vault";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abis/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Contract ABIs
3
+ *
4
+ * This module exports all contract ABIs for the Monaco protocol.
5
+ * Each ABI provides type-safe contract interaction capabilities.
6
+ */
7
+ export { VAULT_ABI } from "./vault"; // Vault for managing user balances
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/abis/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC,CAAC,mCAAmC"}