@coset-dev/contracts 1.0.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,57 @@
1
+ # Sample Hardhat 3 Beta Project (`mocha` and `ethers`)
2
+
3
+ This project showcases a Hardhat 3 Beta project using `mocha` for tests and the `ethers` library for Ethereum interactions.
4
+
5
+ To learn more about the Hardhat 3 Beta, please visit the [Getting Started guide](https://hardhat.org/docs/getting-started#getting-started-with-hardhat-3). To share your feedback, join our [Hardhat 3 Beta](https://hardhat.org/hardhat3-beta-telegram-group) Telegram group or [open an issue](https://github.com/NomicFoundation/hardhat/issues/new) in our GitHub issue tracker.
6
+
7
+ ## Project Overview
8
+
9
+ This example project includes:
10
+
11
+ - A simple Hardhat configuration file.
12
+ - Foundry-compatible Solidity unit tests.
13
+ - TypeScript integration tests using `mocha` and ethers.js
14
+ - Examples demonstrating how to connect to different types of networks, including locally simulating OP mainnet.
15
+
16
+ ## Usage
17
+
18
+ ### Running Tests
19
+
20
+ To run all the tests in the project, execute the following command:
21
+
22
+ ```shell
23
+ npx hardhat test
24
+ ```
25
+
26
+ You can also selectively run the Solidity or `mocha` tests:
27
+
28
+ ```shell
29
+ npx hardhat test solidity
30
+ npx hardhat test mocha
31
+ ```
32
+
33
+ ### Make a deployment to Sepolia
34
+
35
+ This project includes an example Ignition module to deploy the contract. You can deploy this module to a locally simulated chain or to Sepolia.
36
+
37
+ To run the deployment to a local chain:
38
+
39
+ ```shell
40
+ npx hardhat ignition deploy ignition/modules/Counter.ts
41
+ ```
42
+
43
+ To run the deployment to Sepolia, you need an account with funds to send the transaction. The provided Hardhat configuration includes a Configuration Variable called `SEPOLIA_PRIVATE_KEY`, which you can use to set the private key of the account you want to use.
44
+
45
+ You can set the `SEPOLIA_PRIVATE_KEY` variable using the `hardhat-keystore` plugin or by setting it as an environment variable.
46
+
47
+ To set the `SEPOLIA_PRIVATE_KEY` config variable using `hardhat-keystore`:
48
+
49
+ ```shell
50
+ npx hardhat keystore set SEPOLIA_PRIVATE_KEY
51
+ ```
52
+
53
+ After setting the variable, you can run the deployment with the Sepolia network:
54
+
55
+ ```shell
56
+ npx hardhat ignition deploy --network sepolia ignition/modules/Counter.ts
57
+ ```
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "namespace": "@coset-dev",
3
+ "name": "@coset-dev/contracts",
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "module": "types/ethers-contracts/index.ts",
7
+ "scripts": {
8
+ "test": "hardhat test",
9
+ "node": "hardhat node",
10
+ "build": "hardhat compile",
11
+ "reset": "rm -rf artifacts cache",
12
+ "prepublishOnly": "hardhat compile",
13
+ "verify": "npx hardhat run scripts/verify.ts",
14
+ "deploy:mainnet": "npx hardhat run scripts/deploy.ts --network mantle",
15
+ "deploy:testnet": "npx hardhat run scripts/deploy.ts --network mantle-testnet"
16
+ },
17
+ "files": [
18
+ "types"
19
+ ],
20
+ "author": "Halil Beycan",
21
+ "license": "MIT",
22
+ "homepage": "https://github.com/CosetDev/contracts",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/CosetDev/contracts.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/CosetDev/contracts/issues"
29
+ },
30
+ "devDependencies": {
31
+ "@nomicfoundation/hardhat-ethers": "^4.0.3",
32
+ "@nomicfoundation/hardhat-ignition": "^3.0.6",
33
+ "@nomicfoundation/hardhat-toolbox-mocha-ethers": "^3.0.2",
34
+ "@nomicfoundation/hardhat-verify": "^3.0.8",
35
+ "@types/chai": "^4.3.20",
36
+ "@types/chai-as-promised": "^8.0.2",
37
+ "@types/mocha": "^10.0.10",
38
+ "@types/node": "^22.19.3",
39
+ "chai": "^5.3.3",
40
+ "ethers": "^6.16.0",
41
+ "forge-std": "github:foundry-rs/forge-std#v1.9.4",
42
+ "hardhat": "^3.1.0",
43
+ "mocha": "^11.7.5",
44
+ "typescript": "~5.8.0"
45
+ },
46
+ "dependencies": {
47
+ "@openzeppelin/contracts": "^5.4.0",
48
+ "dotenv": "^17.2.3"
49
+ }
50
+ }
@@ -0,0 +1,306 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, ContractRunner, ContractMethod, Listener } from "ethers"
5
+ import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "./common.js"
6
+
7
+
8
+ export interface OracleInterface extends Interface {
9
+ getFunction(nameOrSignature: "MAX_DATA_SIZE" | "dataUpdatePrice" | "factory" | "getData" | "getDataWithoutCheck" | "getProvider" | "history" | "historyCount" | "isActive" | "lastUpdateTimestamp" | "provider" | "recommendedUpdateDuration" | "setDataUpdatePrice" | "setOracleStatus" | "setRecommendedUpdateDuration" | "updateData"): FunctionFragment;
10
+
11
+ getEvent(nameOrSignatureOrTopic: "DataUpdated"): EventFragment;
12
+
13
+ encodeFunctionData(functionFragment: 'MAX_DATA_SIZE', values?: undefined): string;
14
+ encodeFunctionData(functionFragment: 'dataUpdatePrice', values?: undefined): string;
15
+ encodeFunctionData(functionFragment: 'factory', values?: undefined): string;
16
+ encodeFunctionData(functionFragment: 'getData', values?: undefined): string;
17
+ encodeFunctionData(functionFragment: 'getDataWithoutCheck', values?: undefined): string;
18
+ encodeFunctionData(functionFragment: 'getProvider', values?: undefined): string;
19
+ encodeFunctionData(functionFragment: 'history', values: [BigNumberish]): string;
20
+ encodeFunctionData(functionFragment: 'historyCount', values?: undefined): string;
21
+ encodeFunctionData(functionFragment: 'isActive', values?: undefined): string;
22
+ encodeFunctionData(functionFragment: 'lastUpdateTimestamp', values?: undefined): string;
23
+ encodeFunctionData(functionFragment: 'provider', values?: undefined): string;
24
+ encodeFunctionData(functionFragment: 'recommendedUpdateDuration', values?: undefined): string;
25
+ encodeFunctionData(functionFragment: 'setDataUpdatePrice', values: [BigNumberish]): string;
26
+ encodeFunctionData(functionFragment: 'setOracleStatus', values: [boolean]): string;
27
+ encodeFunctionData(functionFragment: 'setRecommendedUpdateDuration', values: [BigNumberish]): string;
28
+ encodeFunctionData(functionFragment: 'updateData', values: [BytesLike]): string;
29
+
30
+ decodeFunctionResult(functionFragment: 'MAX_DATA_SIZE', data: BytesLike): Result;
31
+ decodeFunctionResult(functionFragment: 'dataUpdatePrice', data: BytesLike): Result;
32
+ decodeFunctionResult(functionFragment: 'factory', data: BytesLike): Result;
33
+ decodeFunctionResult(functionFragment: 'getData', data: BytesLike): Result;
34
+ decodeFunctionResult(functionFragment: 'getDataWithoutCheck', data: BytesLike): Result;
35
+ decodeFunctionResult(functionFragment: 'getProvider', data: BytesLike): Result;
36
+ decodeFunctionResult(functionFragment: 'history', data: BytesLike): Result;
37
+ decodeFunctionResult(functionFragment: 'historyCount', data: BytesLike): Result;
38
+ decodeFunctionResult(functionFragment: 'isActive', data: BytesLike): Result;
39
+ decodeFunctionResult(functionFragment: 'lastUpdateTimestamp', data: BytesLike): Result;
40
+ decodeFunctionResult(functionFragment: 'provider', data: BytesLike): Result;
41
+ decodeFunctionResult(functionFragment: 'recommendedUpdateDuration', data: BytesLike): Result;
42
+ decodeFunctionResult(functionFragment: 'setDataUpdatePrice', data: BytesLike): Result;
43
+ decodeFunctionResult(functionFragment: 'setOracleStatus', data: BytesLike): Result;
44
+ decodeFunctionResult(functionFragment: 'setRecommendedUpdateDuration', data: BytesLike): Result;
45
+ decodeFunctionResult(functionFragment: 'updateData', data: BytesLike): Result;
46
+ }
47
+
48
+
49
+ export namespace DataUpdatedEvent {
50
+ export type InputTuple = [data: BytesLike, timestamp: BigNumberish];
51
+ export type OutputTuple = [data: string, timestamp: bigint];
52
+ export interface OutputObject {data: string, timestamp: bigint };
53
+ export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>
54
+ export type Filter = TypedDeferredTopicFilter<Event>
55
+ export type Log = TypedEventLog<Event>
56
+ export type LogDescription = TypedLogDescription<Event>
57
+ }
58
+
59
+
60
+
61
+ export interface Oracle extends BaseContract {
62
+
63
+ connect(runner?: ContractRunner | null): Oracle;
64
+ waitForDeployment(): Promise<this>;
65
+
66
+ interface: OracleInterface;
67
+
68
+
69
+ queryFilter<TCEvent extends TypedContractEvent>(
70
+ event: TCEvent,
71
+ fromBlockOrBlockhash?: string | number | undefined,
72
+ toBlock?: string | number | undefined,
73
+ ): Promise<Array<TypedEventLog<TCEvent>>>
74
+ queryFilter<TCEvent extends TypedContractEvent>(
75
+ filter: TypedDeferredTopicFilter<TCEvent>,
76
+ fromBlockOrBlockhash?: string | number | undefined,
77
+ toBlock?: string | number | undefined
78
+ ): Promise<Array<TypedEventLog<TCEvent>>>;
79
+
80
+ on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>
81
+ on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>
82
+
83
+ once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>
84
+ once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>
85
+
86
+ listeners<TCEvent extends TypedContractEvent>(
87
+ event: TCEvent
88
+ ): Promise<Array<TypedListener<TCEvent>>>;
89
+ listeners(eventName?: string): Promise<Array<Listener>>
90
+ removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>
91
+
92
+
93
+
94
+
95
+ MAX_DATA_SIZE: TypedContractMethod<
96
+ [],
97
+ [bigint],
98
+ 'view'
99
+ >
100
+
101
+
102
+
103
+ dataUpdatePrice: TypedContractMethod<
104
+ [],
105
+ [bigint],
106
+ 'view'
107
+ >
108
+
109
+
110
+
111
+ factory: TypedContractMethod<
112
+ [],
113
+ [string],
114
+ 'view'
115
+ >
116
+
117
+
118
+
119
+ getData: TypedContractMethod<
120
+ [],
121
+ [string],
122
+ 'view'
123
+ >
124
+
125
+
126
+
127
+ getDataWithoutCheck: TypedContractMethod<
128
+ [],
129
+ [string],
130
+ 'view'
131
+ >
132
+
133
+
134
+
135
+ getProvider: TypedContractMethod<
136
+ [],
137
+ [string],
138
+ 'view'
139
+ >
140
+
141
+
142
+
143
+ history: TypedContractMethod<
144
+ [arg0: BigNumberish, ],
145
+ [[string, bigint] & {data: string, timestamp: bigint }],
146
+ 'view'
147
+ >
148
+
149
+
150
+
151
+ historyCount: TypedContractMethod<
152
+ [],
153
+ [bigint],
154
+ 'view'
155
+ >
156
+
157
+
158
+
159
+ isActive: TypedContractMethod<
160
+ [],
161
+ [boolean],
162
+ 'view'
163
+ >
164
+
165
+
166
+
167
+ lastUpdateTimestamp: TypedContractMethod<
168
+ [],
169
+ [bigint],
170
+ 'view'
171
+ >
172
+
173
+
174
+
175
+ recommendedUpdateDuration: TypedContractMethod<
176
+ [],
177
+ [bigint],
178
+ 'view'
179
+ >
180
+
181
+
182
+
183
+ setDataUpdatePrice: TypedContractMethod<
184
+ [_price: BigNumberish, ],
185
+ [void],
186
+ 'nonpayable'
187
+ >
188
+
189
+
190
+
191
+ setOracleStatus: TypedContractMethod<
192
+ [_isActive: boolean, ],
193
+ [void],
194
+ 'nonpayable'
195
+ >
196
+
197
+
198
+
199
+ setRecommendedUpdateDuration: TypedContractMethod<
200
+ [_duration: BigNumberish, ],
201
+ [void],
202
+ 'nonpayable'
203
+ >
204
+
205
+
206
+
207
+ updateData: TypedContractMethod<
208
+ [_data: BytesLike, ],
209
+ [void],
210
+ 'payable'
211
+ >
212
+
213
+
214
+
215
+ getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
216
+
217
+ getFunction(nameOrSignature: 'MAX_DATA_SIZE'): TypedContractMethod<
218
+ [],
219
+ [bigint],
220
+ 'view'
221
+ >;
222
+ getFunction(nameOrSignature: 'dataUpdatePrice'): TypedContractMethod<
223
+ [],
224
+ [bigint],
225
+ 'view'
226
+ >;
227
+ getFunction(nameOrSignature: 'factory'): TypedContractMethod<
228
+ [],
229
+ [string],
230
+ 'view'
231
+ >;
232
+ getFunction(nameOrSignature: 'getData'): TypedContractMethod<
233
+ [],
234
+ [string],
235
+ 'view'
236
+ >;
237
+ getFunction(nameOrSignature: 'getDataWithoutCheck'): TypedContractMethod<
238
+ [],
239
+ [string],
240
+ 'view'
241
+ >;
242
+ getFunction(nameOrSignature: 'getProvider'): TypedContractMethod<
243
+ [],
244
+ [string],
245
+ 'view'
246
+ >;
247
+ getFunction(nameOrSignature: 'history'): TypedContractMethod<
248
+ [arg0: BigNumberish, ],
249
+ [[string, bigint] & {data: string, timestamp: bigint }],
250
+ 'view'
251
+ >;
252
+ getFunction(nameOrSignature: 'historyCount'): TypedContractMethod<
253
+ [],
254
+ [bigint],
255
+ 'view'
256
+ >;
257
+ getFunction(nameOrSignature: 'isActive'): TypedContractMethod<
258
+ [],
259
+ [boolean],
260
+ 'view'
261
+ >;
262
+ getFunction(nameOrSignature: 'lastUpdateTimestamp'): TypedContractMethod<
263
+ [],
264
+ [bigint],
265
+ 'view'
266
+ >;
267
+ getFunction(nameOrSignature: 'provider'): TypedContractMethod<
268
+ [],
269
+ [string],
270
+ 'view'
271
+ >;
272
+ getFunction(nameOrSignature: 'recommendedUpdateDuration'): TypedContractMethod<
273
+ [],
274
+ [bigint],
275
+ 'view'
276
+ >;
277
+ getFunction(nameOrSignature: 'setDataUpdatePrice'): TypedContractMethod<
278
+ [_price: BigNumberish, ],
279
+ [void],
280
+ 'nonpayable'
281
+ >;
282
+ getFunction(nameOrSignature: 'setOracleStatus'): TypedContractMethod<
283
+ [_isActive: boolean, ],
284
+ [void],
285
+ 'nonpayable'
286
+ >;
287
+ getFunction(nameOrSignature: 'setRecommendedUpdateDuration'): TypedContractMethod<
288
+ [_duration: BigNumberish, ],
289
+ [void],
290
+ 'nonpayable'
291
+ >;
292
+ getFunction(nameOrSignature: 'updateData'): TypedContractMethod<
293
+ [_data: BytesLike, ],
294
+ [void],
295
+ 'payable'
296
+ >;
297
+
298
+ getEvent(key: 'DataUpdated'): TypedContractEvent<DataUpdatedEvent.InputTuple, DataUpdatedEvent.OutputTuple, DataUpdatedEvent.OutputObject>;
299
+
300
+ filters: {
301
+
302
+ 'DataUpdated(bytes,uint256)': TypedContractEvent<DataUpdatedEvent.InputTuple, DataUpdatedEvent.OutputTuple, DataUpdatedEvent.OutputObject>;
303
+ DataUpdated: TypedContractEvent<DataUpdatedEvent.InputTuple, DataUpdatedEvent.OutputTuple, DataUpdatedEvent.OutputObject>;
304
+
305
+ };
306
+ }