@0xmonaco/contracts 1.0.90 → 1.0.92
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 +19 -82
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @0xmonaco/contracts
|
|
2
2
|
|
|
3
|
-
Smart contract ABIs and
|
|
4
|
-
|
|
5
|
-
**Note:** This package currently only contains the Vault contract. Additional contracts will be added as they are deployed.
|
|
3
|
+
Smart contract ABIs and sweeper deposit-address helpers for the Monaco protocol. Resolve deployed addresses, such as the vault, through the Monaco SDK.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -10,40 +8,27 @@ Smart contract ABIs and addresses for the Monaco protocol. This package provides
|
|
|
10
8
|
npm install @0xmonaco/contracts
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
**Note:** This package is typically installed as a dependency of `@0xmonaco/core` or `@0xmonaco/types`, but you can install it directly if you only need contract ABIs
|
|
11
|
+
**Note:** This package is typically installed as a dependency of `@0xmonaco/core` or `@0xmonaco/types`, but you can install it directly if you only need contract ABIs.
|
|
14
12
|
|
|
15
13
|
## Usage
|
|
16
14
|
|
|
17
|
-
### Contract
|
|
15
|
+
### Contract ABIs
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Use `CONTRACT_ABIS` with the vault address the Monaco SDK resolves for the network:
|
|
20
18
|
|
|
21
19
|
```typescript
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
// Get contract addresses for Atlantic-2 testnet (chain ID 1328)
|
|
25
|
-
const atlanticAddresses = CONTRACT_ADDRESSES[1328];
|
|
26
|
-
const { vault: vaultAddress } = atlanticAddresses;
|
|
27
|
-
|
|
28
|
-
// Get contract addresses for Pacific-1 mainnet (chain ID 1329) - Coming Soon
|
|
29
|
-
// const pacificAddresses = CONTRACT_ADDRESSES[1329];
|
|
30
|
-
|
|
31
|
-
// Create contract instances using viem
|
|
20
|
+
import { CONTRACT_ABIS } from "@0xmonaco/contracts";
|
|
32
21
|
import { createPublicClient, http } from "viem";
|
|
22
|
+
import { sei } from "viem/chains";
|
|
23
|
+
|
|
24
|
+
// Resolve the vault address from the Monaco SDK (Sei mainnet, chain ID 1329)
|
|
25
|
+
const vaultAddress = await sdk.vault.getVaultAddress();
|
|
33
26
|
|
|
34
27
|
const client = createPublicClient({
|
|
35
|
-
chain:
|
|
36
|
-
|
|
37
|
-
name: "atlantic-2",
|
|
38
|
-
rpcUrls: {
|
|
39
|
-
default: { http: ["https://evm-rpc.testnet.sei.io"] },
|
|
40
|
-
public: { http: ["https://evm-rpc.testnet.sei.io"] },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
transport: http(),
|
|
28
|
+
chain: sei,
|
|
29
|
+
transport: http("https://evm-rpc.sei-apis.com"),
|
|
44
30
|
});
|
|
45
31
|
|
|
46
|
-
// Example of creating a contract instance
|
|
47
32
|
const vaultContract = {
|
|
48
33
|
address: vaultAddress,
|
|
49
34
|
abi: CONTRACT_ABIS.vault,
|
|
@@ -61,55 +46,15 @@ const vaultContract = {
|
|
|
61
46
|
- Handles token transfers for trades
|
|
62
47
|
- Ensures secure fund management
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## Network Support
|
|
49
|
+
#### Sweeper
|
|
67
50
|
|
|
68
|
-
|
|
51
|
+
- Per-(application, user) deposit addresses created through a CREATE2 factory
|
|
52
|
+
- `predictSweeperAddress` and the related helpers derive an address before it is deployed
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- Chain ID: 1328
|
|
73
|
-
- Used for testing and development
|
|
54
|
+
## Network Support
|
|
74
55
|
|
|
75
|
-
- **
|
|
56
|
+
- **Sei mainnet (`pacific-1`)**
|
|
76
57
|
- Chain ID: 1329
|
|
77
|
-
- Production environment (Coming Soon)
|
|
78
|
-
|
|
79
|
-
## Contract Addresses
|
|
80
|
-
|
|
81
|
-
Each network has the following contracts deployed:
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
interface ContractAddresses {
|
|
85
|
-
/** Vault contract for managing user balances */
|
|
86
|
-
vault: string;
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Token Configuration
|
|
91
|
-
|
|
92
|
-
The package provides token configurations for different networks:
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
import { TESTNET_TOKENS } from "@0xmonaco/contracts";
|
|
96
|
-
|
|
97
|
-
// Access testnet tokens
|
|
98
|
-
const mockUSDC = TESTNET_TOKENS.MockUSDC;
|
|
99
|
-
const mockMTK = TESTNET_TOKENS.MockMTK;
|
|
100
|
-
|
|
101
|
-
// Use token information
|
|
102
|
-
console.log(`MockUSDC address: ${mockUSDC.address}`);
|
|
103
|
-
console.log(`MockUSDC decimals: ${mockUSDC.decimals}`);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Available Tokens
|
|
107
|
-
|
|
108
|
-
#### Testnet (Atlantic-2)
|
|
109
|
-
- **MockUSDC**: `0x6A86dA986797D59A839D136dB490292Cd560C131` (6 decimals)
|
|
110
|
-
- **MockMTK**: `0x428F82f1ECa4AA6f6c75D77cBd2a9ceB94cde343` (18 decimals)
|
|
111
|
-
|
|
112
|
-
|
|
113
58
|
|
|
114
59
|
## ABI Reference
|
|
115
60
|
|
|
@@ -118,13 +63,14 @@ The package exports a consolidated `CONTRACT_ABIS` object:
|
|
|
118
63
|
```typescript
|
|
119
64
|
import { CONTRACT_ABIS } from "@0xmonaco/contracts";
|
|
120
65
|
|
|
121
|
-
const clobAbi = CONTRACT_ABIS.clob;
|
|
122
66
|
const vaultAbi = CONTRACT_ABIS.vault;
|
|
123
67
|
```
|
|
124
68
|
|
|
125
69
|
Available ABIs in `CONTRACT_ABIS`:
|
|
126
70
|
|
|
127
71
|
- `vault`: Vault contract interface
|
|
72
|
+
- `sweeper`: Per-(application, user) sweeper deposit address interface
|
|
73
|
+
- `sweeperFactory`: CREATE2 sweeper factory interface
|
|
128
74
|
|
|
129
75
|
## Development
|
|
130
76
|
|
|
@@ -133,19 +79,10 @@ Available ABIs in `CONTRACT_ABIS`:
|
|
|
133
79
|
1. Create a new file in `src/abis/` for the contract ABI
|
|
134
80
|
2. Export the ABI as a named constant
|
|
135
81
|
3. Add the export to `src/abis/index.ts`
|
|
136
|
-
4. Add the
|
|
137
|
-
|
|
138
|
-
### Updating Contract Addresses
|
|
139
|
-
|
|
140
|
-
When deploying new contracts:
|
|
141
|
-
|
|
142
|
-
1. Update the addresses in `src/index.ts`
|
|
143
|
-
2. Update the network documentation if needed
|
|
144
|
-
3. Consider adding a migration guide for users
|
|
82
|
+
4. Add the ABI to `CONTRACT_ABIS` in `src/index.ts`
|
|
145
83
|
|
|
146
84
|
### Best Practices
|
|
147
85
|
|
|
148
86
|
- Keep ABIs up to date with deployed contracts
|
|
149
87
|
- Document any breaking changes
|
|
150
88
|
- Maintain backward compatibility when possible
|
|
151
|
-
- Test contract interactions on testnet before mainnet deployment
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ export { type DepositTarget, encodeDepositApplicationData, type Hex, predictSwee
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
|
-
* import { CONTRACT_ABIS
|
|
8
|
+
* import { CONTRACT_ABIS } from '@0xmonaco/contracts';
|
|
9
9
|
*
|
|
10
|
-
* //
|
|
10
|
+
* // Pair the ABI with the vault address the Monaco SDK resolves
|
|
11
11
|
* const vaultContract = {
|
|
12
|
-
* address:
|
|
12
|
+
* address: await sdk.vault.getVaultAddress(),
|
|
13
13
|
* abi: CONTRACT_ABIS.vault,
|
|
14
14
|
* };
|
|
15
15
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,11 @@ export { encodeDepositApplicationData, predictSweeperAddress, sweeperCloneInitCo
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
|
-
* import { CONTRACT_ABIS
|
|
16
|
+
* import { CONTRACT_ABIS } from '@0xmonaco/contracts';
|
|
17
17
|
*
|
|
18
|
-
* //
|
|
18
|
+
* // Pair the ABI with the vault address the Monaco SDK resolves
|
|
19
19
|
* const vaultContract = {
|
|
20
|
-
* address:
|
|
20
|
+
* address: await sdk.vault.getVaultAddress(),
|
|
21
21
|
* abi: CONTRACT_ABIS.vault,
|
|
22
22
|
* };
|
|
23
23
|
* ```
|