Skip to content

Commit

Permalink
updated with latest changes. added link available
Browse files Browse the repository at this point in the history
updated yarn
  • Loading branch information
RodrigoAD committed Feb 8, 2022
1 parent 1b6d892 commit cfee50b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import AbstractCommand, { makeAbstractCommand } from '.'
import { Result } from '@chainlink/gauntlet-core'
import { TerraCommand, TransactionResponse } from '@chainlink/gauntlet-terra'
import { logger } from '@chainlink/gauntlet-core/dist/utils'

export type InspectionInput<CommandInput, Expected> = {
commandInput?: CommandInput
Expand Down Expand Up @@ -38,7 +39,6 @@ export const instructionToInspectCommand = <CommandInput, Expected>(
const id = `${inspectInstruction.command.contract}:${inspectInstruction.command.id}`
return class Command extends TerraCommand {
static id = id
command: AbstractCommand

constructor(flags, args) {
super(flags, args)
Expand All @@ -57,9 +57,10 @@ export const instructionToInspectCommand = <CommandInput, Expected>(
),
)

logger.loading('Fetching contract information...')
const data = await Promise.all(
commands.map(async (command) => {
command.invokeMiddlewares(command, command.middlewares)
await command.invokeMiddlewares(command, command.middlewares)
const { data } = await command.execute()
return data
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { getRDD } from '../../../../lib/rdd'
import { InspectInstruction, InspectionInput, instructionToInspectCommand } from '../../../abstract/inspectionWrapper'
import { getOffchainConfigInput, OffchainConfig } from '../setConfig'

const MIN_LINK_AVAILABLE = '100'

type Expected = {
description: string
decimals: string | number
Expand All @@ -12,9 +14,10 @@ type Expected = {
billingAccessController: string
requesterAccessController: string
link: string
linkAvailable: string
billing: {
observationPaymentGjuels: string
recommendedGasPrice: string
recommendedGasPriceUluna: string
transmissionPaymentGjuels: string
}
offchainConfig: OffchainConfig
Expand All @@ -41,10 +44,11 @@ const makeInput = async (flags: any, args: string[]): Promise<InspectionInput<an
billingAccessController,
requesterAccessController,
link,
linkAvailable: MIN_LINK_AVAILABLE,
offchainConfig,
billing: {
observationPaymentGjuels: info.billing.observationPaymentGjuels,
recommendedGasPrice: info.billing.recommendedGasPrice,
recommendedGasPriceUluna: info.billing.recommendedGasPriceUluna,
transmissionPaymentGjuels: info.billing.transmissionPaymentGjuels,
},
},
Expand All @@ -62,6 +66,7 @@ const makeOnchainData = (instructionsData: any[]): Expected => {
const billingAC = instructionsData[5]
const requesterAC = instructionsData[6]
const link = instructionsData[7]
const linkAvailable = instructionsData[8]

return {
description,
Expand All @@ -72,11 +77,12 @@ const makeOnchainData = (instructionsData: any[]): Expected => {
billingAccessController: billingAC,
requesterAccessController: requesterAC,
link,
linkAvailable: linkAvailable.amount,
offchainConfig: {} as OffchainConfig,
billing: {
observationPaymentGjuels: billing.observation_payment,
transmissionPaymentGjuels: 'INFO NOT AVAILABLE IN CONTRACT',
recommendedGasPrice: billing.recommended_gas_price,
observationPaymentGjuels: billing.observation_payment_gjuels,
transmissionPaymentGjuels: billing.transmission_payment_gjuels,
recommendedGasPriceUluna: billing.recommended_gas_price_uluna,
},
}
}
Expand All @@ -97,6 +103,7 @@ const inspect = (expected: Expected, onchainData: Expected): boolean => {
'Requester Access Controller',
),
inspection.makeInspection(onchainData.link, expected.link, 'LINK'),
inspection.makeInspection(onchainData.linkAvailable, expected.linkAvailable, 'LINK Available'),
inspection.makeInspection(onchainData.minAnswer, expected.minAnswer, 'Min Answer'),
inspection.makeInspection(onchainData.maxAnswer, expected.maxAnswer, 'Max Answer'),
inspection.makeInspection(
Expand All @@ -105,8 +112,8 @@ const inspect = (expected: Expected, onchainData: Expected): boolean => {
'Observation Payment',
),
inspection.makeInspection(
onchainData.billing.recommendedGasPrice,
expected.billing.recommendedGasPrice,
onchainData.billing.recommendedGasPriceUluna,
expected.billing.recommendedGasPriceUluna,
'Recommended Gas Price',
),
inspection.makeInspection(
Expand Down Expand Up @@ -156,6 +163,10 @@ const instruction: InspectInstruction<any, Expected> = {
contract: 'ocr2',
function: 'link_token',
},
{
contract: 'ocr2',
function: 'link_available_for_payment',
},
],
makeInput,
makeOnchainData,
Expand Down
2 changes: 1 addition & 1 deletion packages-ts/gauntlet-terra-contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const commands = {

;(async () => {
try {
const networkPossiblePaths = ['./networks', './packages-ts/gauntlet-terra-contracts/networks']
const networkPossiblePaths = ['./packages-ts/gauntlet-terra-contracts/networks']
const networkPath = networkPossiblePaths.filter((networkPath) =>
existsSync(path.join(process.cwd(), networkPath)),
)[0]
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@ [email protected]:
micromatch "^4.0.2"
pkg-dir "^4.2.0"

follow-redirects@^1.14.0, follow-redirects@^1.14.4:
follow-redirects@^1.14.4:
version "1.14.7"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
Expand Down

0 comments on commit cfee50b

Please sign in to comment.