Skip to content

Commit

Permalink
Merge pull request #57 from smartcontractkit/FUN-1234
Browse files Browse the repository at this point in the history
Update to Functions Contracts v1.3.0
  • Loading branch information
justinkaseman authored Mar 18, 2024
2 parents 957b2d2 + b5ac24b commit a0a9157
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 117 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-cooks-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/functions-toolkit': minor
---

Update to Functions Contracts v1.3.0
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions src/localFunctionsTestnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
simulatedSecretsKeys,
DEFAULT_MAX_ON_CHAIN_RESPONSE_BYTES,
numberOfSimulatedNodeExecutions,
simulatedLinkUsdPrice,
} from './simulationConfig'
import {
LinkTokenSource,
Expand Down Expand Up @@ -367,9 +368,12 @@ export const deployFunctionsOracle = async (deployer: Wallet): Promise<Functions
MockV3AggregatorSource.bytecode,
deployer,
)
const linkPriceFeed = await linkPriceFeedFactory
const linkEthPriceFeed = await linkPriceFeedFactory
.connect(deployer)
.deploy(18, simulatedLinkEthPrice)
const linkUsdPriceFeed = await linkPriceFeedFactory
.connect(deployer)
.deploy(8, simulatedLinkUsdPrice)

const routerFactory = new ContractFactory(
FunctionsRouterSource.abi,
Expand All @@ -387,14 +391,23 @@ export const deployFunctionsOracle = async (deployer: Wallet): Promise<Functions
)
const mockCoordinator = await mockCoordinatorFactory
.connect(deployer)
.deploy(router.address, simulatedCoordinatorConfig, linkPriceFeed.address)
.deploy(
router.address,
simulatedCoordinatorConfig,
linkEthPriceFeed.address,
linkUsdPriceFeed.address,
)

const allowlistFactory = new ContractFactory(
TermsOfServiceAllowListSource.abi,
TermsOfServiceAllowListSource.bytecode,
deployer,
)
const allowlist = await allowlistFactory.connect(deployer).deploy(simulatedAllowListConfig)
const initialAllowedSenders: string[] = []
const initialBlockedSenders: string[] = []
const allowlist = await allowlistFactory
.connect(deployer)
.deploy(simulatedAllowListConfig, initialAllowedSenders, initialBlockedSenders)

const setAllowListIdTx = await router.setAllowListId(
utils.formatBytes32String(simulatedAllowListId),
Expand Down
9 changes: 7 additions & 2 deletions src/simulationConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const simulatedLinkEthPrice = BigInt('1000000000000000')
export const simulatedLinkEthPrice = BigInt('6000000000000000')
export const simulatedLinkUsdPrice = BigInt('1500000000')

export const simulatedDonId = 'local-functions-testnet'

Expand All @@ -20,10 +21,14 @@ export const simulatedCoordinatorConfig = {
gasOverheadBeforeCallback: 44_615,
gasOverheadAfterCallback: 44_615,
requestTimeoutSeconds: 0, // 300 is used on actual mainnet & testnet blockchains
donFee: 0,
donFeeCentsUsd: 0,
maxSupportedRequestDataVersion: 1,
fulfillmentGasPriceOverEstimationBP: 0,
fallbackNativePerUnitLink: BigInt('5000000000000000'),
minimumEstimateGasPriceWei: 1000000000, // 1 gwei
fallbackUsdPerUnitLink: 1400000000,
fallbackUsdPerUnitLinkDecimals: 8,
operationFeeCentsUsd: 0,
}

export const simulatedAllowListConfig = {
Expand Down
Loading

0 comments on commit a0a9157

Please sign in to comment.