Skip to content

Commit 133fa09

Browse files
authored
Merge pull request #8 from smartcontractkit/feat/update-contracts
2 parents 8cc9ac5 + 7f03558 commit 133fa09

13 files changed

+1290
-1329
lines changed

.changeset/fifty-flowers-reflect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/functions-toolkit': minor
3+
---
4+
5+
Updated to latest Functions contracts

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const estimatedCostInJuels: BigInt = await subscriptionManager.estimateFunctions
233233
donId, // ID of the DON to which the Functions request will be sent
234234
subscriptionId, // Subscription ID
235235
callbackGasLimit, // Total gas used by the consumer contract's callback
236-
gasPriceGwei, // Gas price in gWei
236+
gasPriceWei, // Gas price in wei
237237
})
238238
```
239239

src/SubscriptionManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export class SubscriptionManager {
472472
donId,
473473
subscriptionId,
474474
callbackGasLimit,
475-
gasPriceGwei,
475+
gasPriceWei,
476476
}: EstimateCostConfig): Promise<BigInt> {
477477
if (typeof donId !== 'string') {
478478
throw Error('donId has invalid type')
@@ -488,8 +488,8 @@ export class SubscriptionManager {
488488
throw Error('Invalid callbackGasLimit')
489489
}
490490

491-
if (typeof gasPriceGwei !== 'bigint' || gasPriceGwei <= 0) {
492-
throw Error('Invalid gasPriceGwei')
491+
if (typeof gasPriceWei !== 'bigint' || gasPriceWei <= 0) {
492+
throw Error('Invalid gasPriceWei')
493493
}
494494

495495
let functionsCoordinatorAddress: string
@@ -520,7 +520,7 @@ export class SubscriptionManager {
520520
subscriptionId,
521521
[],
522522
callbackGasLimit,
523-
gasPriceGwei,
523+
gasPriceWei,
524524
)
525525
return BigInt(estimatedCostInJuels.toString())
526526
} catch (error) {

src/localFunctionsTestnet.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
LinkTokenSource,
1919
MockV3AggregatorSource,
2020
FunctionsRouterSource,
21-
MockFunctionsCoordinatorSource,
21+
FunctionsCoordinatorTestHelperSource,
2222
TermsOfServiceAllowListSource,
2323
FunctionsClientExampleSource,
2424
} from './v1_contract_sources'
@@ -173,13 +173,9 @@ const handleOracleRequest = async (
173173
errorHexstring,
174174
)
175175

176-
const transmitters31AddressArray = Array(31).fill('0x0000000000000000000000000000000000000000')
177-
simulatedTransmitters.forEach((transmitter, i) => {
178-
transmitters31AddressArray[i] = transmitter
179-
})
180176
const reportTx = await mockCoordinator
181177
.connect(admin)
182-
.callReport(encodedReport, transmitters31AddressArray, { gasLimit: callReportGasLimit })
178+
.callReport(encodedReport, { gasLimit: callReportGasLimit })
183179
await reportTx.wait(1)
184180
}
185181

@@ -288,8 +284,8 @@ export const deployFunctionsOracle = async (deployer: Wallet): Promise<Functions
288284
.deploy(linkToken.address, simulatedRouterConfig)
289285

290286
const mockCoordinatorFactory = new ContractFactory(
291-
MockFunctionsCoordinatorSource.abi,
292-
MockFunctionsCoordinatorSource.bytecode,
287+
FunctionsCoordinatorTestHelperSource.abi,
288+
FunctionsCoordinatorTestHelperSource.bytecode,
293289
deployer,
294290
)
295291
const mockCoordinator = await mockCoordinatorFactory
@@ -332,7 +328,6 @@ export const deployFunctionsOracle = async (deployer: Wallet): Promise<Functions
332328
.setThresholdPublicKey(
333329
'0x' + Buffer.from(simulatedSecretsKeys.thresholdKeys.publicKey).toString('hex'),
334330
)
335-
await mockCoordinator.connect(deployer).setTransmitters(simulatedTransmitters)
336331

337332
return { linkToken, router, mockCoordinator, exampleClient }
338333
}

src/simulationConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export const simulatedRouterConfig = {
1010
handleOracleFulfillmentSelector: '0x0ca76175', // handleOracleFulfillment(bytes32 requestId, bytes memory response, bytes memory err)
1111
gasForCallExactCheck: 5000,
1212
maxCallbackGasLimits: [300_000, 500_000, 1_000_000],
13+
subscriptionDepositMinimumRequests: 0,
14+
subscriptionDepositJuels: 0,
1315
}
1416

1517
export const simulatedCoordinatorConfig = {

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export type EstimateCostConfig = {
8383
donId: string
8484
subscriptionId: BigInt | number | string
8585
callbackGasLimit: number
86-
gasPriceGwei: BigInt
86+
gasPriceWei: BigInt
8787
}
8888

8989
export type SubscriptionInfo = {

src/v1_contract_sources/FunctionsCoordinator.ts

Lines changed: 7 additions & 82 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)