Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function initiateServiceAgreement({
coordinatorAddress,
normalizedRequest,
oracleSignature,
saJson,
expectedAddress,
}: Args) {
const provider = createProvider()
const signer = provider.getSigner(DEVNET_ADDRESS)
const coordinatorFactory = new Coordinator__factory(signer)
const coordinator = coordinatorFactory.attach(coordinatorAddress)
console.log('Creating service agreement to initiate with...')
const sa: ServiceAgreement = {
aggFulfillSelector: saJson.aggFulfillSelector,
aggInitiateJobSelector: saJson.aggInitiateJobSelector,
aggregator: saJson.aggregator,
expiration: saJson.expiration,
oracles: saJson.oracles,
payment: saJson.payment,
endAt: Math.round(new Date(saJson.endAt).getTime() / 1000), // end date in seconds
requestDigest: ethers.utils.keccak256(
ethers.utils.toUtf8Bytes(normalizedRequest),
),
}
export function getSolidityVersions(): [string, string][] {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const config: App = require('@chainlink/contracts/app.config.json')
return Object.entries(config.compilerSettings.versions).filter(([, v]) =>
config.publicVersions.find((pv) => pv === v),
)
}
return Object.entries(config.compilerSettings.versions).filter(([, v]) =>
config.publicVersions.find((pv) => pv === v),
)