@gitmyabi-stg/frxusd 0.0.1
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 +108 -0
- package/contracts/FrxUSD.d.ts +2397 -0
- package/contracts/FrxUSD.js +2554 -0
- package/contracts/FrxUSD.ts +3193 -0
- package/contracts/TransparentUpgradeableProxy.d.ts +185 -0
- package/contracts/TransparentUpgradeableProxy.js +238 -0
- package/contracts/TransparentUpgradeableProxy.ts +268 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +10 -0
- package/contracts/index.ts +5 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* TransparentUpgradeableProxy ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TransparentUpgradeableProxyAbi: readonly [{
|
|
8
|
+
readonly inputs: readonly [{
|
|
9
|
+
readonly internalType: "address";
|
|
10
|
+
readonly name: "_logic";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
}, {
|
|
13
|
+
readonly internalType: "address";
|
|
14
|
+
readonly name: "initialOwner";
|
|
15
|
+
readonly type: "address";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "bytes";
|
|
18
|
+
readonly name: "_data";
|
|
19
|
+
readonly type: "bytes";
|
|
20
|
+
}];
|
|
21
|
+
readonly stateMutability: "payable";
|
|
22
|
+
readonly type: "constructor";
|
|
23
|
+
}, {
|
|
24
|
+
readonly inputs: readonly [{
|
|
25
|
+
readonly internalType: "address";
|
|
26
|
+
readonly name: "target";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}];
|
|
29
|
+
readonly name: "AddressEmptyCode";
|
|
30
|
+
readonly type: "error";
|
|
31
|
+
}, {
|
|
32
|
+
readonly inputs: readonly [{
|
|
33
|
+
readonly internalType: "address";
|
|
34
|
+
readonly name: "admin";
|
|
35
|
+
readonly type: "address";
|
|
36
|
+
}];
|
|
37
|
+
readonly name: "ERC1967InvalidAdmin";
|
|
38
|
+
readonly type: "error";
|
|
39
|
+
}, {
|
|
40
|
+
readonly inputs: readonly [{
|
|
41
|
+
readonly internalType: "address";
|
|
42
|
+
readonly name: "implementation";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
}];
|
|
45
|
+
readonly name: "ERC1967InvalidImplementation";
|
|
46
|
+
readonly type: "error";
|
|
47
|
+
}, {
|
|
48
|
+
readonly inputs: readonly [];
|
|
49
|
+
readonly name: "ERC1967NonPayable";
|
|
50
|
+
readonly type: "error";
|
|
51
|
+
}, {
|
|
52
|
+
readonly inputs: readonly [];
|
|
53
|
+
readonly name: "FailedCall";
|
|
54
|
+
readonly type: "error";
|
|
55
|
+
}, {
|
|
56
|
+
readonly inputs: readonly [];
|
|
57
|
+
readonly name: "ProxyDeniedAdminAccess";
|
|
58
|
+
readonly type: "error";
|
|
59
|
+
}, {
|
|
60
|
+
readonly anonymous: false;
|
|
61
|
+
readonly inputs: readonly [{
|
|
62
|
+
readonly indexed: false;
|
|
63
|
+
readonly internalType: "address";
|
|
64
|
+
readonly name: "previousAdmin";
|
|
65
|
+
readonly type: "address";
|
|
66
|
+
}, {
|
|
67
|
+
readonly indexed: false;
|
|
68
|
+
readonly internalType: "address";
|
|
69
|
+
readonly name: "newAdmin";
|
|
70
|
+
readonly type: "address";
|
|
71
|
+
}];
|
|
72
|
+
readonly name: "AdminChanged";
|
|
73
|
+
readonly type: "event";
|
|
74
|
+
}, {
|
|
75
|
+
readonly anonymous: false;
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly indexed: true;
|
|
78
|
+
readonly internalType: "address";
|
|
79
|
+
readonly name: "implementation";
|
|
80
|
+
readonly type: "address";
|
|
81
|
+
}];
|
|
82
|
+
readonly name: "Upgraded";
|
|
83
|
+
readonly type: "event";
|
|
84
|
+
}, {
|
|
85
|
+
readonly stateMutability: "payable";
|
|
86
|
+
readonly type: "fallback";
|
|
87
|
+
}];
|
|
88
|
+
/**
|
|
89
|
+
* Type-safe ABI for TransparentUpgradeableProxy
|
|
90
|
+
*/
|
|
91
|
+
export type TransparentUpgradeableProxyAbi = typeof TransparentUpgradeableProxyAbi;
|
|
92
|
+
/**
|
|
93
|
+
* Contract instance type for TransparentUpgradeableProxy
|
|
94
|
+
*/
|
|
95
|
+
export type TransparentUpgradeableProxyContract = any;
|
|
96
|
+
/**
|
|
97
|
+
* TransparentUpgradeableProxy Contract Class
|
|
98
|
+
*
|
|
99
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
104
|
+
* import { mainnet } from 'viem/chains';
|
|
105
|
+
* import { TransparentUpgradeableProxy } from 'TransparentUpgradeableProxy';
|
|
106
|
+
*
|
|
107
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
108
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
109
|
+
*
|
|
110
|
+
* const contract = new TransparentUpgradeableProxy('0x...', { publicClient, walletClient });
|
|
111
|
+
*
|
|
112
|
+
* // Read functions
|
|
113
|
+
* const result = await contract.balanceOf('0x...');
|
|
114
|
+
*
|
|
115
|
+
* // Write functions
|
|
116
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
117
|
+
*
|
|
118
|
+
* // Simulate transactions (dry-run)
|
|
119
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
120
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
121
|
+
*
|
|
122
|
+
* // Watch events
|
|
123
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
124
|
+
* console.log('Transfer event:', event);
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare class TransparentUpgradeableProxy {
|
|
129
|
+
private contract;
|
|
130
|
+
private contractAddress;
|
|
131
|
+
private publicClient;
|
|
132
|
+
constructor(address: Address, clients: {
|
|
133
|
+
publicClient: PublicClient;
|
|
134
|
+
walletClient?: WalletClient;
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Get the contract address
|
|
138
|
+
*/
|
|
139
|
+
get address(): Address;
|
|
140
|
+
/**
|
|
141
|
+
* Get the underlying viem contract instance.
|
|
142
|
+
*/
|
|
143
|
+
getContract(): TransparentUpgradeableProxyContract;
|
|
144
|
+
/**
|
|
145
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
146
|
+
*
|
|
147
|
+
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
148
|
+
*/
|
|
149
|
+
get simulate(): {};
|
|
150
|
+
/**
|
|
151
|
+
* Watch contract events
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* // Watch all Transfer events
|
|
155
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
156
|
+
* console.log('Transfer:', event);
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* // Stop watching
|
|
160
|
+
* unwatch();
|
|
161
|
+
*/
|
|
162
|
+
get watch(): {
|
|
163
|
+
/**
|
|
164
|
+
* Watch AdminChanged events
|
|
165
|
+
* @param callback Function to call when event is emitted
|
|
166
|
+
* @param filter Optional filter for indexed parameters
|
|
167
|
+
* @returns Unwatch function to stop listening
|
|
168
|
+
*/
|
|
169
|
+
AdminChanged: (callback: (event: {
|
|
170
|
+
previousAdmin: `0x${string}`;
|
|
171
|
+
newAdmin: `0x${string}`;
|
|
172
|
+
}) => void) => () => void;
|
|
173
|
+
/**
|
|
174
|
+
* Watch Upgraded events
|
|
175
|
+
* @param callback Function to call when event is emitted
|
|
176
|
+
* @param filter Optional filter for indexed parameters
|
|
177
|
+
* @returns Unwatch function to stop listening
|
|
178
|
+
*/
|
|
179
|
+
Upgraded: (callback: (event: {
|
|
180
|
+
implementation: `0x${string}`;
|
|
181
|
+
}) => void, filter?: {
|
|
182
|
+
implementation?: `0x${string}` | `0x${string}`[] | null;
|
|
183
|
+
}) => () => void;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransparentUpgradeableProxy = exports.TransparentUpgradeableProxyAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* TransparentUpgradeableProxy ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.TransparentUpgradeableProxyAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "_logic",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "initialOwner",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "bytes",
|
|
25
|
+
"name": "_data",
|
|
26
|
+
"type": "bytes"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "payable",
|
|
30
|
+
"type": "constructor"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"internalType": "address",
|
|
36
|
+
"name": "target",
|
|
37
|
+
"type": "address"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"name": "AddressEmptyCode",
|
|
41
|
+
"type": "error"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"inputs": [
|
|
45
|
+
{
|
|
46
|
+
"internalType": "address",
|
|
47
|
+
"name": "admin",
|
|
48
|
+
"type": "address"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"name": "ERC1967InvalidAdmin",
|
|
52
|
+
"type": "error"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"internalType": "address",
|
|
58
|
+
"name": "implementation",
|
|
59
|
+
"type": "address"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"name": "ERC1967InvalidImplementation",
|
|
63
|
+
"type": "error"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"inputs": [],
|
|
67
|
+
"name": "ERC1967NonPayable",
|
|
68
|
+
"type": "error"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"inputs": [],
|
|
72
|
+
"name": "FailedCall",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"inputs": [],
|
|
77
|
+
"name": "ProxyDeniedAdminAccess",
|
|
78
|
+
"type": "error"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"anonymous": false,
|
|
82
|
+
"inputs": [
|
|
83
|
+
{
|
|
84
|
+
"indexed": false,
|
|
85
|
+
"internalType": "address",
|
|
86
|
+
"name": "previousAdmin",
|
|
87
|
+
"type": "address"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"indexed": false,
|
|
91
|
+
"internalType": "address",
|
|
92
|
+
"name": "newAdmin",
|
|
93
|
+
"type": "address"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"name": "AdminChanged",
|
|
97
|
+
"type": "event"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"anonymous": false,
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"indexed": true,
|
|
104
|
+
"internalType": "address",
|
|
105
|
+
"name": "implementation",
|
|
106
|
+
"type": "address"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"name": "Upgraded",
|
|
110
|
+
"type": "event"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"stateMutability": "payable",
|
|
114
|
+
"type": "fallback"
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
/**
|
|
118
|
+
* TransparentUpgradeableProxy Contract Class
|
|
119
|
+
*
|
|
120
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
125
|
+
* import { mainnet } from 'viem/chains';
|
|
126
|
+
* import { TransparentUpgradeableProxy } from 'TransparentUpgradeableProxy';
|
|
127
|
+
*
|
|
128
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
129
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
130
|
+
*
|
|
131
|
+
* const contract = new TransparentUpgradeableProxy('0x...', { publicClient, walletClient });
|
|
132
|
+
*
|
|
133
|
+
* // Read functions
|
|
134
|
+
* const result = await contract.balanceOf('0x...');
|
|
135
|
+
*
|
|
136
|
+
* // Write functions
|
|
137
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
138
|
+
*
|
|
139
|
+
* // Simulate transactions (dry-run)
|
|
140
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
141
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
142
|
+
*
|
|
143
|
+
* // Watch events
|
|
144
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
145
|
+
* console.log('Transfer event:', event);
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
class TransparentUpgradeableProxy {
|
|
150
|
+
constructor(address, clients) {
|
|
151
|
+
this.contractAddress = address;
|
|
152
|
+
this.publicClient = clients.publicClient;
|
|
153
|
+
this.contract = (0, viem_1.getContract)({
|
|
154
|
+
address,
|
|
155
|
+
abi: exports.TransparentUpgradeableProxyAbi,
|
|
156
|
+
client: {
|
|
157
|
+
public: clients.publicClient,
|
|
158
|
+
wallet: clients.walletClient,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get the contract address
|
|
164
|
+
*/
|
|
165
|
+
get address() {
|
|
166
|
+
return this.contractAddress;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get the underlying viem contract instance.
|
|
170
|
+
*/
|
|
171
|
+
getContract() {
|
|
172
|
+
return this.contract;
|
|
173
|
+
}
|
|
174
|
+
// No read functions
|
|
175
|
+
// No write functions
|
|
176
|
+
/**
|
|
177
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
178
|
+
*
|
|
179
|
+
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
180
|
+
*/
|
|
181
|
+
get simulate() {
|
|
182
|
+
return {};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Watch contract events
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* // Watch all Transfer events
|
|
189
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
190
|
+
* console.log('Transfer:', event);
|
|
191
|
+
* });
|
|
192
|
+
*
|
|
193
|
+
* // Stop watching
|
|
194
|
+
* unwatch();
|
|
195
|
+
*/
|
|
196
|
+
get watch() {
|
|
197
|
+
return {
|
|
198
|
+
/**
|
|
199
|
+
* Watch AdminChanged events
|
|
200
|
+
* @param callback Function to call when event is emitted
|
|
201
|
+
* @param filter Optional filter for indexed parameters
|
|
202
|
+
* @returns Unwatch function to stop listening
|
|
203
|
+
*/
|
|
204
|
+
AdminChanged: (callback) => {
|
|
205
|
+
return this.publicClient.watchContractEvent({
|
|
206
|
+
address: this.contractAddress,
|
|
207
|
+
abi: exports.TransparentUpgradeableProxyAbi,
|
|
208
|
+
eventName: 'AdminChanged',
|
|
209
|
+
onLogs: (logs) => {
|
|
210
|
+
logs.forEach((log) => {
|
|
211
|
+
callback(log.args);
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Watch Upgraded events
|
|
218
|
+
* @param callback Function to call when event is emitted
|
|
219
|
+
* @param filter Optional filter for indexed parameters
|
|
220
|
+
* @returns Unwatch function to stop listening
|
|
221
|
+
*/
|
|
222
|
+
Upgraded: (callback, filter) => {
|
|
223
|
+
return this.publicClient.watchContractEvent({
|
|
224
|
+
address: this.contractAddress,
|
|
225
|
+
abi: exports.TransparentUpgradeableProxyAbi,
|
|
226
|
+
eventName: 'Upgraded',
|
|
227
|
+
args: filter,
|
|
228
|
+
onLogs: (logs) => {
|
|
229
|
+
logs.forEach((log) => {
|
|
230
|
+
callback(log.args);
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.TransparentUpgradeableProxy = TransparentUpgradeableProxy;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TransparentUpgradeableProxy ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const TransparentUpgradeableProxyAbi = [
|
|
10
|
+
{
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "_logic",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"internalType": "address",
|
|
19
|
+
"name": "initialOwner",
|
|
20
|
+
"type": "address"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "bytes",
|
|
24
|
+
"name": "_data",
|
|
25
|
+
"type": "bytes"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"stateMutability": "payable",
|
|
29
|
+
"type": "constructor"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"inputs": [
|
|
33
|
+
{
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "target",
|
|
36
|
+
"type": "address"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"name": "AddressEmptyCode",
|
|
40
|
+
"type": "error"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"inputs": [
|
|
44
|
+
{
|
|
45
|
+
"internalType": "address",
|
|
46
|
+
"name": "admin",
|
|
47
|
+
"type": "address"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "ERC1967InvalidAdmin",
|
|
51
|
+
"type": "error"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [
|
|
55
|
+
{
|
|
56
|
+
"internalType": "address",
|
|
57
|
+
"name": "implementation",
|
|
58
|
+
"type": "address"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "ERC1967InvalidImplementation",
|
|
62
|
+
"type": "error"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [],
|
|
66
|
+
"name": "ERC1967NonPayable",
|
|
67
|
+
"type": "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [],
|
|
71
|
+
"name": "FailedCall",
|
|
72
|
+
"type": "error"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"inputs": [],
|
|
76
|
+
"name": "ProxyDeniedAdminAccess",
|
|
77
|
+
"type": "error"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"anonymous": false,
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"indexed": false,
|
|
84
|
+
"internalType": "address",
|
|
85
|
+
"name": "previousAdmin",
|
|
86
|
+
"type": "address"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"indexed": false,
|
|
90
|
+
"internalType": "address",
|
|
91
|
+
"name": "newAdmin",
|
|
92
|
+
"type": "address"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"name": "AdminChanged",
|
|
96
|
+
"type": "event"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"anonymous": false,
|
|
100
|
+
"inputs": [
|
|
101
|
+
{
|
|
102
|
+
"indexed": true,
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "implementation",
|
|
105
|
+
"type": "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "Upgraded",
|
|
109
|
+
"type": "event"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"stateMutability": "payable",
|
|
113
|
+
"type": "fallback"
|
|
114
|
+
}
|
|
115
|
+
] as const satisfies Abi;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Type-safe ABI for TransparentUpgradeableProxy
|
|
119
|
+
*/
|
|
120
|
+
export type TransparentUpgradeableProxyAbi = typeof TransparentUpgradeableProxyAbi;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Contract instance type for TransparentUpgradeableProxy
|
|
124
|
+
*/
|
|
125
|
+
// Use any for contract type to avoid complex viem type issues
|
|
126
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
127
|
+
export type TransparentUpgradeableProxyContract = any;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* TransparentUpgradeableProxy Contract Class
|
|
131
|
+
*
|
|
132
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
137
|
+
* import { mainnet } from 'viem/chains';
|
|
138
|
+
* import { TransparentUpgradeableProxy } from 'TransparentUpgradeableProxy';
|
|
139
|
+
*
|
|
140
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
141
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
142
|
+
*
|
|
143
|
+
* const contract = new TransparentUpgradeableProxy('0x...', { publicClient, walletClient });
|
|
144
|
+
*
|
|
145
|
+
* // Read functions
|
|
146
|
+
* const result = await contract.balanceOf('0x...');
|
|
147
|
+
*
|
|
148
|
+
* // Write functions
|
|
149
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
150
|
+
*
|
|
151
|
+
* // Simulate transactions (dry-run)
|
|
152
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
153
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
154
|
+
*
|
|
155
|
+
* // Watch events
|
|
156
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
157
|
+
* console.log('Transfer event:', event);
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export class TransparentUpgradeableProxy {
|
|
162
|
+
private contract: TransparentUpgradeableProxyContract;
|
|
163
|
+
private contractAddress: Address;
|
|
164
|
+
private publicClient: PublicClient;
|
|
165
|
+
|
|
166
|
+
constructor(
|
|
167
|
+
address: Address,
|
|
168
|
+
clients: {
|
|
169
|
+
publicClient: PublicClient;
|
|
170
|
+
walletClient?: WalletClient;
|
|
171
|
+
}
|
|
172
|
+
) {
|
|
173
|
+
this.contractAddress = address;
|
|
174
|
+
this.publicClient = clients.publicClient;
|
|
175
|
+
this.contract = getContract({
|
|
176
|
+
address,
|
|
177
|
+
abi: TransparentUpgradeableProxyAbi,
|
|
178
|
+
client: {
|
|
179
|
+
public: clients.publicClient,
|
|
180
|
+
wallet: clients.walletClient,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Get the contract address
|
|
187
|
+
*/
|
|
188
|
+
get address(): Address {
|
|
189
|
+
return this.contractAddress;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get the underlying viem contract instance.
|
|
194
|
+
*/
|
|
195
|
+
getContract(): TransparentUpgradeableProxyContract {
|
|
196
|
+
return this.contract;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// No read functions
|
|
200
|
+
|
|
201
|
+
// No write functions
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
207
|
+
*
|
|
208
|
+
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
209
|
+
*/
|
|
210
|
+
get simulate() {
|
|
211
|
+
return {};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Watch contract events
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // Watch all Transfer events
|
|
219
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
220
|
+
* console.log('Transfer:', event);
|
|
221
|
+
* });
|
|
222
|
+
*
|
|
223
|
+
* // Stop watching
|
|
224
|
+
* unwatch();
|
|
225
|
+
*/
|
|
226
|
+
get watch() {
|
|
227
|
+
return {
|
|
228
|
+
/**
|
|
229
|
+
* Watch AdminChanged events
|
|
230
|
+
* @param callback Function to call when event is emitted
|
|
231
|
+
* @param filter Optional filter for indexed parameters
|
|
232
|
+
* @returns Unwatch function to stop listening
|
|
233
|
+
*/
|
|
234
|
+
AdminChanged: (callback: (event: { previousAdmin: `0x${string}`; newAdmin: `0x${string}` }) => void) => {
|
|
235
|
+
return this.publicClient.watchContractEvent({
|
|
236
|
+
address: this.contractAddress,
|
|
237
|
+
abi: TransparentUpgradeableProxyAbi,
|
|
238
|
+
eventName: 'AdminChanged',
|
|
239
|
+
|
|
240
|
+
onLogs: (logs: any[]) => {
|
|
241
|
+
logs.forEach((log: any) => {
|
|
242
|
+
callback(log.args as any);
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
}) as () => void;
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* Watch Upgraded events
|
|
249
|
+
* @param callback Function to call when event is emitted
|
|
250
|
+
* @param filter Optional filter for indexed parameters
|
|
251
|
+
* @returns Unwatch function to stop listening
|
|
252
|
+
*/
|
|
253
|
+
Upgraded: (callback: (event: { implementation: `0x${string}` }) => void, filter?: { implementation?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
254
|
+
return this.publicClient.watchContractEvent({
|
|
255
|
+
address: this.contractAddress,
|
|
256
|
+
abi: TransparentUpgradeableProxyAbi,
|
|
257
|
+
eventName: 'Upgraded',
|
|
258
|
+
args: filter as any,
|
|
259
|
+
onLogs: (logs: any[]) => {
|
|
260
|
+
logs.forEach((log: any) => {
|
|
261
|
+
callback(log.args as any);
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
}) as () => void;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FrxUSDAbi, FrxUSD } from './FrxUSD';
|
|
2
|
+
export type { FrxUSDAbi as FrxUSDAbiType, FrxUSDContract } from './FrxUSD';
|
|
3
|
+
export { TransparentUpgradeableProxyAbi, TransparentUpgradeableProxy } from './TransparentUpgradeableProxy';
|
|
4
|
+
export type { TransparentUpgradeableProxyAbi as TransparentUpgradeableProxyAbiType, TransparentUpgradeableProxyContract } from './TransparentUpgradeableProxy';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransparentUpgradeableProxy = exports.TransparentUpgradeableProxyAbi = exports.FrxUSD = exports.FrxUSDAbi = void 0;
|
|
4
|
+
// Auto-generated exports for all contracts
|
|
5
|
+
var FrxUSD_1 = require("./FrxUSD");
|
|
6
|
+
Object.defineProperty(exports, "FrxUSDAbi", { enumerable: true, get: function () { return FrxUSD_1.FrxUSDAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "FrxUSD", { enumerable: true, get: function () { return FrxUSD_1.FrxUSD; } });
|
|
8
|
+
var TransparentUpgradeableProxy_1 = require("./TransparentUpgradeableProxy");
|
|
9
|
+
Object.defineProperty(exports, "TransparentUpgradeableProxyAbi", { enumerable: true, get: function () { return TransparentUpgradeableProxy_1.TransparentUpgradeableProxyAbi; } });
|
|
10
|
+
Object.defineProperty(exports, "TransparentUpgradeableProxy", { enumerable: true, get: function () { return TransparentUpgradeableProxy_1.TransparentUpgradeableProxy; } });
|