@bouncetech/contracts 1.0.4 → 1.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 CHANGED
@@ -20,7 +20,13 @@ pnpm add @bouncetech/contracts
20
20
  import {
21
21
  ALL_ADDRESSES,
22
22
  FACTORY_ADDRESS,
23
+ GLOBAL_STORAGE_ADDRESS,
24
+ GLOBAL_STORAGE_HELPER_ADDRESS,
25
+ HYPERLIQUID_HANDLER_ADDRESS,
26
+ LEVERAGED_TOKEN_HELPER_ADDRESS,
23
27
  LEVERAGED_TOKEN_IMPLEMENTATION_ADDRESS,
28
+ REFERRALS_ADDRESS,
29
+ USDC_ADDRESS,
24
30
  } from "@bouncetech/contracts";
25
31
 
26
32
  // Use all addresses
@@ -28,7 +34,9 @@ console.log(ALL_ADDRESSES.Factory);
28
34
 
29
35
  // Or import specific addresses
30
36
  const factoryAddress = FACTORY_ADDRESS;
37
+ const globalStorageAddress = GLOBAL_STORAGE_ADDRESS;
31
38
  const leveragedTokenAddress = LEVERAGED_TOKEN_IMPLEMENTATION_ADDRESS;
39
+ const usdcAddress = USDC_ADDRESS;
32
40
  ```
33
41
 
34
42
  ### Import Contract ABIs
@@ -42,6 +50,7 @@ import {
42
50
  HYPERLIQUID_HANDLER_ABI,
43
51
  LEVERAGED_TOKEN_HELPER_ABI,
44
52
  REFERRALS_ABI,
53
+ USDC_ABI,
45
54
  } from "@bouncetech/contracts";
46
55
 
47
56
  // Use with ethers.js
@@ -72,8 +81,9 @@ The following contracts are available through this package:
72
81
  - **LeveragedTokenHelper**
73
82
  - **LeveragedTokenImplementation**
74
83
  - **Referrals**
84
+ - **USDC**
75
85
 
76
- For the latest contract addresses, see `addresses.json` in the package or import them programmatically using the exported address constants.
86
+ For the latest contract addresses, import them programmatically using the exported address constants.
77
87
 
78
88
  ### Available ABIs
79
89
 
@@ -86,29 +96,7 @@ The following ABIs are available:
86
96
  - `LEVERAGED_TOKEN_ABI` - Leveraged Token contract ABI
87
97
  - `LEVERAGED_TOKEN_HELPER_ABI` - LeveragedTokenHelper contract ABI
88
98
  - `REFERRALS_ABI` - Referrals contract ABI
89
-
90
- ## Python Usage
91
-
92
- Python users can access the same contract addresses and ABIs directly from this npm package, ensuring a **single source of truth**. The Python package reads directly from the published npm package via CDN:
93
-
94
- ```python
95
- import json
96
- import urllib.request
97
-
98
- # Fetch addresses
99
- with urllib.request.urlopen(
100
- "https://unpkg.com/@bouncetech/contracts@1.0.3/addresses.json"
101
- ) as response:
102
- addresses = json.loads(response.read())
103
-
104
- # Fetch ABIs
105
- with urllib.request.urlopen(
106
- "https://unpkg.com/@bouncetech/contracts@1.0.3/abis/factory-abi.json"
107
- ) as response:
108
- factory_abi = json.loads(response.read())
109
- ```
110
-
111
- **Note:** Update the version `@1.0.3` as needed to the lastest version.
99
+ - `USDC_ABI` - USDC (ERC20) contract ABI
112
100
 
113
101
  ## Updating
114
102
 
@@ -0,0 +1,171 @@
1
+ export declare const erc20Abi: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "allowance";
4
+ readonly inputs: readonly [{
5
+ readonly name: "owner";
6
+ readonly type: "address";
7
+ readonly internalType: "address";
8
+ }, {
9
+ readonly name: "spender";
10
+ readonly type: "address";
11
+ readonly internalType: "address";
12
+ }];
13
+ readonly outputs: readonly [{
14
+ readonly name: "";
15
+ readonly type: "uint256";
16
+ readonly internalType: "uint256";
17
+ }];
18
+ readonly stateMutability: "view";
19
+ }, {
20
+ readonly type: "function";
21
+ readonly name: "approve";
22
+ readonly inputs: readonly [{
23
+ readonly name: "spender";
24
+ readonly type: "address";
25
+ readonly internalType: "address";
26
+ }, {
27
+ readonly name: "value";
28
+ readonly type: "uint256";
29
+ readonly internalType: "uint256";
30
+ }];
31
+ readonly outputs: readonly [{
32
+ readonly name: "";
33
+ readonly type: "bool";
34
+ readonly internalType: "bool";
35
+ }];
36
+ readonly stateMutability: "nonpayable";
37
+ }, {
38
+ readonly type: "function";
39
+ readonly name: "balanceOf";
40
+ readonly inputs: readonly [{
41
+ readonly name: "account";
42
+ readonly type: "address";
43
+ readonly internalType: "address";
44
+ }];
45
+ readonly outputs: readonly [{
46
+ readonly name: "";
47
+ readonly type: "uint256";
48
+ readonly internalType: "uint256";
49
+ }];
50
+ readonly stateMutability: "view";
51
+ }, {
52
+ readonly type: "function";
53
+ readonly name: "decimals";
54
+ readonly inputs: readonly [];
55
+ readonly outputs: readonly [{
56
+ readonly name: "";
57
+ readonly type: "uint8";
58
+ readonly internalType: "uint8";
59
+ }];
60
+ readonly stateMutability: "view";
61
+ }, {
62
+ readonly type: "function";
63
+ readonly name: "name";
64
+ readonly inputs: readonly [];
65
+ readonly outputs: readonly [{
66
+ readonly name: "";
67
+ readonly type: "string";
68
+ readonly internalType: "string";
69
+ }];
70
+ readonly stateMutability: "view";
71
+ }, {
72
+ readonly type: "function";
73
+ readonly name: "symbol";
74
+ readonly inputs: readonly [];
75
+ readonly outputs: readonly [{
76
+ readonly name: "";
77
+ readonly type: "string";
78
+ readonly internalType: "string";
79
+ }];
80
+ readonly stateMutability: "view";
81
+ }, {
82
+ readonly type: "function";
83
+ readonly name: "totalSupply";
84
+ readonly inputs: readonly [];
85
+ readonly outputs: readonly [{
86
+ readonly name: "";
87
+ readonly type: "uint256";
88
+ readonly internalType: "uint256";
89
+ }];
90
+ readonly stateMutability: "view";
91
+ }, {
92
+ readonly type: "function";
93
+ readonly name: "transfer";
94
+ readonly inputs: readonly [{
95
+ readonly name: "to";
96
+ readonly type: "address";
97
+ readonly internalType: "address";
98
+ }, {
99
+ readonly name: "value";
100
+ readonly type: "uint256";
101
+ readonly internalType: "uint256";
102
+ }];
103
+ readonly outputs: readonly [{
104
+ readonly name: "";
105
+ readonly type: "bool";
106
+ readonly internalType: "bool";
107
+ }];
108
+ readonly stateMutability: "nonpayable";
109
+ }, {
110
+ readonly type: "function";
111
+ readonly name: "transferFrom";
112
+ readonly inputs: readonly [{
113
+ readonly name: "from";
114
+ readonly type: "address";
115
+ readonly internalType: "address";
116
+ }, {
117
+ readonly name: "to";
118
+ readonly type: "address";
119
+ readonly internalType: "address";
120
+ }, {
121
+ readonly name: "value";
122
+ readonly type: "uint256";
123
+ readonly internalType: "uint256";
124
+ }];
125
+ readonly outputs: readonly [{
126
+ readonly name: "";
127
+ readonly type: "bool";
128
+ readonly internalType: "bool";
129
+ }];
130
+ readonly stateMutability: "nonpayable";
131
+ }, {
132
+ readonly type: "event";
133
+ readonly name: "Approval";
134
+ readonly inputs: readonly [{
135
+ readonly name: "owner";
136
+ readonly type: "address";
137
+ readonly indexed: true;
138
+ readonly internalType: "address";
139
+ }, {
140
+ readonly name: "spender";
141
+ readonly type: "address";
142
+ readonly indexed: true;
143
+ readonly internalType: "address";
144
+ }, {
145
+ readonly name: "value";
146
+ readonly type: "uint256";
147
+ readonly indexed: false;
148
+ readonly internalType: "uint256";
149
+ }];
150
+ readonly anonymous: false;
151
+ }, {
152
+ readonly type: "event";
153
+ readonly name: "Transfer";
154
+ readonly inputs: readonly [{
155
+ readonly name: "from";
156
+ readonly type: "address";
157
+ readonly indexed: true;
158
+ readonly internalType: "address";
159
+ }, {
160
+ readonly name: "to";
161
+ readonly type: "address";
162
+ readonly indexed: true;
163
+ readonly internalType: "address";
164
+ }, {
165
+ readonly name: "value";
166
+ readonly type: "uint256";
167
+ readonly indexed: false;
168
+ readonly internalType: "uint256";
169
+ }];
170
+ readonly anonymous: false;
171
+ }];
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.erc20Abi = void 0;
4
+ exports.erc20Abi = [
5
+ {
6
+ type: "function",
7
+ name: "allowance",
8
+ inputs: [
9
+ { name: "owner", type: "address", internalType: "address" },
10
+ { name: "spender", type: "address", internalType: "address" },
11
+ ],
12
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
13
+ stateMutability: "view",
14
+ },
15
+ {
16
+ type: "function",
17
+ name: "approve",
18
+ inputs: [
19
+ { name: "spender", type: "address", internalType: "address" },
20
+ { name: "value", type: "uint256", internalType: "uint256" },
21
+ ],
22
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
23
+ stateMutability: "nonpayable",
24
+ },
25
+ {
26
+ type: "function",
27
+ name: "balanceOf",
28
+ inputs: [{ name: "account", type: "address", internalType: "address" }],
29
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
30
+ stateMutability: "view",
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "decimals",
35
+ inputs: [],
36
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
37
+ stateMutability: "view",
38
+ },
39
+ {
40
+ type: "function",
41
+ name: "name",
42
+ inputs: [],
43
+ outputs: [{ name: "", type: "string", internalType: "string" }],
44
+ stateMutability: "view",
45
+ },
46
+ {
47
+ type: "function",
48
+ name: "symbol",
49
+ inputs: [],
50
+ outputs: [{ name: "", type: "string", internalType: "string" }],
51
+ stateMutability: "view",
52
+ },
53
+ {
54
+ type: "function",
55
+ name: "totalSupply",
56
+ inputs: [],
57
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
58
+ stateMutability: "view",
59
+ },
60
+ {
61
+ type: "function",
62
+ name: "transfer",
63
+ inputs: [
64
+ { name: "to", type: "address", internalType: "address" },
65
+ { name: "value", type: "uint256", internalType: "uint256" },
66
+ ],
67
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
68
+ stateMutability: "nonpayable",
69
+ },
70
+ {
71
+ type: "function",
72
+ name: "transferFrom",
73
+ inputs: [
74
+ { name: "from", type: "address", internalType: "address" },
75
+ { name: "to", type: "address", internalType: "address" },
76
+ { name: "value", type: "uint256", internalType: "uint256" },
77
+ ],
78
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
79
+ stateMutability: "nonpayable",
80
+ },
81
+ {
82
+ type: "event",
83
+ name: "Approval",
84
+ inputs: [
85
+ {
86
+ name: "owner",
87
+ type: "address",
88
+ indexed: true,
89
+ internalType: "address",
90
+ },
91
+ {
92
+ name: "spender",
93
+ type: "address",
94
+ indexed: true,
95
+ internalType: "address",
96
+ },
97
+ {
98
+ name: "value",
99
+ type: "uint256",
100
+ indexed: false,
101
+ internalType: "uint256",
102
+ },
103
+ ],
104
+ anonymous: false,
105
+ },
106
+ {
107
+ type: "event",
108
+ name: "Transfer",
109
+ inputs: [
110
+ {
111
+ name: "from",
112
+ type: "address",
113
+ indexed: true,
114
+ internalType: "address",
115
+ },
116
+ {
117
+ name: "to",
118
+ type: "address",
119
+ indexed: true,
120
+ internalType: "address",
121
+ },
122
+ {
123
+ name: "value",
124
+ type: "uint256",
125
+ indexed: false,
126
+ internalType: "uint256",
127
+ },
128
+ ],
129
+ anonymous: false,
130
+ },
131
+ ];
@@ -0,0 +1,149 @@
1
+ export declare const factoryAbi: readonly [{
2
+ readonly type: "constructor";
3
+ readonly inputs: readonly [{
4
+ readonly name: "globalStorage_";
5
+ readonly type: "address";
6
+ readonly internalType: "address";
7
+ }];
8
+ readonly stateMutability: "nonpayable";
9
+ }, {
10
+ readonly type: "function";
11
+ readonly name: "createLt";
12
+ readonly inputs: readonly [{
13
+ readonly name: "marketId_";
14
+ readonly type: "uint32";
15
+ readonly internalType: "uint32";
16
+ }, {
17
+ readonly name: "targetLeverage_";
18
+ readonly type: "uint256";
19
+ readonly internalType: "uint256";
20
+ }, {
21
+ readonly name: "isLong_";
22
+ readonly type: "bool";
23
+ readonly internalType: "bool";
24
+ }];
25
+ readonly outputs: readonly [{
26
+ readonly name: "";
27
+ readonly type: "address";
28
+ readonly internalType: "address";
29
+ }];
30
+ readonly stateMutability: "nonpayable";
31
+ }, {
32
+ readonly type: "function";
33
+ readonly name: "lt";
34
+ readonly inputs: readonly [{
35
+ readonly name: "";
36
+ readonly type: "uint32";
37
+ readonly internalType: "uint32";
38
+ }, {
39
+ readonly name: "";
40
+ readonly type: "uint256";
41
+ readonly internalType: "uint256";
42
+ }, {
43
+ readonly name: "";
44
+ readonly type: "bool";
45
+ readonly internalType: "bool";
46
+ }];
47
+ readonly outputs: readonly [{
48
+ readonly name: "";
49
+ readonly type: "address";
50
+ readonly internalType: "address";
51
+ }];
52
+ readonly stateMutability: "view";
53
+ }, {
54
+ readonly type: "function";
55
+ readonly name: "ltExists";
56
+ readonly inputs: readonly [{
57
+ readonly name: "";
58
+ readonly type: "address";
59
+ readonly internalType: "address";
60
+ }];
61
+ readonly outputs: readonly [{
62
+ readonly name: "";
63
+ readonly type: "bool";
64
+ readonly internalType: "bool";
65
+ }];
66
+ readonly stateMutability: "view";
67
+ }, {
68
+ readonly type: "function";
69
+ readonly name: "lts";
70
+ readonly inputs: readonly [];
71
+ readonly outputs: readonly [{
72
+ readonly name: "";
73
+ readonly type: "address[]";
74
+ readonly internalType: "address[]";
75
+ }];
76
+ readonly stateMutability: "view";
77
+ }, {
78
+ readonly type: "function";
79
+ readonly name: "redeployLt";
80
+ readonly inputs: readonly [{
81
+ readonly name: "ltAddress_";
82
+ readonly type: "address";
83
+ readonly internalType: "address";
84
+ }];
85
+ readonly outputs: readonly [];
86
+ readonly stateMutability: "nonpayable";
87
+ }, {
88
+ readonly type: "event";
89
+ readonly name: "CreateLeveragedToken";
90
+ readonly inputs: readonly [{
91
+ readonly name: "creator";
92
+ readonly type: "address";
93
+ readonly indexed: true;
94
+ readonly internalType: "address";
95
+ }, {
96
+ readonly name: "token";
97
+ readonly type: "address";
98
+ readonly indexed: true;
99
+ readonly internalType: "address";
100
+ }, {
101
+ readonly name: "marketId";
102
+ readonly type: "uint32";
103
+ readonly indexed: true;
104
+ readonly internalType: "uint32";
105
+ }, {
106
+ readonly name: "targetLeverage";
107
+ readonly type: "uint256";
108
+ readonly indexed: false;
109
+ readonly internalType: "uint256";
110
+ }, {
111
+ readonly name: "isLong";
112
+ readonly type: "bool";
113
+ readonly indexed: false;
114
+ readonly internalType: "bool";
115
+ }];
116
+ readonly anonymous: false;
117
+ }, {
118
+ readonly type: "error";
119
+ readonly name: "AlreadyCreated";
120
+ readonly inputs: readonly [];
121
+ }, {
122
+ readonly type: "error";
123
+ readonly name: "InvalidLeverage";
124
+ readonly inputs: readonly [];
125
+ }, {
126
+ readonly type: "error";
127
+ readonly name: "NotLeveragedToken";
128
+ readonly inputs: readonly [];
129
+ }, {
130
+ readonly type: "error";
131
+ readonly name: "NotOwner";
132
+ readonly inputs: readonly [];
133
+ }, {
134
+ readonly type: "error";
135
+ readonly name: "PrecompileLib__PerpAssetInfoPrecompileFailed";
136
+ readonly inputs: readonly [];
137
+ }, {
138
+ readonly type: "error";
139
+ readonly name: "SafeERC20FailedOperation";
140
+ readonly inputs: readonly [{
141
+ readonly name: "token";
142
+ readonly type: "address";
143
+ readonly internalType: "address";
144
+ }];
145
+ }, {
146
+ readonly type: "error";
147
+ readonly name: "StillHasMargin";
148
+ readonly inputs: readonly [];
149
+ }];