Skip to content

Commit

Permalink
chore: rename graphTask to greTask
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Jan 12, 2024
1 parent 2bc2a5b commit eac5fa4
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions packages/contracts/tasks/bridge/deposits.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { ethers } from 'ethers'
import { Table } from 'console-table-printer'
import { L1ToL2MessageStatus } from '@arbitrum/sdk'
import { getL1ToL2MessageStatus } from '@graphprotocol/sdk'

graphTask('bridge:deposits', 'List deposits initiated on L1GraphTokenGateway')
greTask('bridge:deposits', 'List deposits initiated on L1GraphTokenGateway')
.addOptionalParam('startBlock', 'Start block for the search')
.addOptionalParam('endBlock', 'End block for the search')
.setAction(async (taskArgs, hre) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/bridge/to-l2.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { BigNumber } from 'ethers'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { sendToL2 } from '@graphprotocol/sdk'
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'

graphTask('bridge:send-to-l2', 'Bridge GRT tokens from L1 to L2')
greTask('bridge:send-to-l2', 'Bridge GRT tokens from L1 to L2')
.addParam('amount', 'Amount of tokens to bridge')
.addOptionalParam('sender', 'Address of the sender. L1 deployer if empty.')
.addOptionalParam('recipient', 'Receiving address in L2. Same to L1 address if empty.')
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/bridge/withdrawals.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ethers } from 'ethers'
import { Table } from 'console-table-printer'
import { L2ToL1MessageStatus } from '@arbitrum/sdk'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { getL2ToL1MessageStatus } from '@graphprotocol/sdk'

graphTask('bridge:withdrawals', 'List withdrawals initiated on L2GraphTokenGateway')
greTask('bridge:withdrawals', 'List withdrawals initiated on L2GraphTokenGateway')
.addOptionalParam('startBlock', 'Start block for the search')
.addOptionalParam('endBlock', 'End block for the search')
.setAction(async (taskArgs, hre) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/contract/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DeployType, GraphNetworkAddressBook, confirm, deploy } from '@graphprotocol/sdk'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'

graphTask('contract:deploy', 'Deploy a contract')
greTask('contract:deploy', 'Deploy a contract')
.addPositionalParam('contract', 'Name of the contract to deploy')
.addPositionalParam(
'init',
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/contract/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { DeployType, GraphNetworkAddressBook, deploy } from '@graphprotocol/sdk'

graphTask('contract:upgrade', 'Upgrades a contract')
greTask('contract:upgrade', 'Upgrades a contract')
.addParam('contract', 'Name of the contract to upgrade')
.addOptionalVariadicPositionalParam(
'init',
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/deployment/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
writeConfig,
confirm,
} from '@graphprotocol/sdk'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'

graphTask('update-config', 'Update graph config parameters with onchain data')
greTask('update-config', 'Update graph config parameters with onchain data')
.addFlag('dryRun', "Only print the changes, don't write them to the config file")
.addFlag('skipConfirmation', 'Skip confirmation prompt on write actions.')
.setAction(async (taskArgs, hre) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/contracts/tasks/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import glob from 'glob'
import fs from 'fs'
import { runScriptWithHardhat } from 'hardhat/internal/util/scripts-runner'
import { isGraphL1ChainId } from '@graphprotocol/sdk'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'

const CONFIG_TESTS = 'test/e2e/deployment/config/**/*.test.ts'
const INIT_TESTS = 'test/e2e/deployment/init/**/*.test.ts'
Expand Down Expand Up @@ -33,7 +33,7 @@ const setGraphConfig = async (args: TaskArguments, hre: HardhatRuntimeEnvironmen
}
}

graphTask('e2e', 'Run all e2e tests')
greTask('e2e', 'Run all e2e tests')
.addFlag('skipBridge', 'Skip bridge tests')
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
let testFiles = [
Expand All @@ -54,7 +54,7 @@ graphTask('e2e', 'Run all e2e tests')
})
})

graphTask('e2e:config', 'Run deployment configuration e2e tests').setAction(
greTask('e2e:config', 'Run deployment configuration e2e tests').setAction(
async (args, hre: HardhatRuntimeEnvironment) => {
const files = new glob.GlobSync(CONFIG_TESTS).found

Expand All @@ -68,7 +68,7 @@ graphTask('e2e:config', 'Run deployment configuration e2e tests').setAction(
},
)

graphTask('e2e:init', 'Run deployment initialization e2e tests').setAction(
greTask('e2e:init', 'Run deployment initialization e2e tests').setAction(
async (args, hre: HardhatRuntimeEnvironment) => {
const files = new glob.GlobSync(INIT_TESTS).found

Expand All @@ -82,7 +82,7 @@ graphTask('e2e:init', 'Run deployment initialization e2e tests').setAction(
},
)

graphTask('e2e:scenario', 'Run scenario scripts and e2e tests')
greTask('e2e:scenario', 'Run scenario scripts and e2e tests')
.addPositionalParam('scenario', 'Name of the scenario to run')
.addFlag('skipScript', "Don't run scenario script")
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
Expand Down Expand Up @@ -118,7 +118,7 @@ graphTask('e2e:scenario', 'Run scenario scripts and e2e tests')
}
})

graphTask('e2e:upgrade', 'Run upgrade tests')
greTask('e2e:upgrade', 'Run upgrade tests')
.addPositionalParam('upgrade', 'Name of the upgrade to run')
.addFlag('post', 'Wether to run pre/post upgrade scripts')
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/migrate/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { configureL1Bridge, configureL2Bridge, setPausedBridge } from '@graphprotocol/sdk'

graphTask('migrate:bridge', 'Configure and unpause bridge')
greTask('migrate:bridge', 'Configure and unpause bridge')
.addOptionalParam(
'arbitrumAddressBook',
'The path to the address book file for Arbitrum deployments',
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/migrate/nitro.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { subtask, task } from 'hardhat/config'
import fs from 'fs'
import { execSync } from 'child_process'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { helpers } from '@graphprotocol/sdk'

graphTask(
greTask(
'migrate:nitro:fund-accounts',
'Funds protocol accounts on Arbitrum Nitro testnodes',
).setAction(async (taskArgs, hre) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/tasks/migrate/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
deployGraphNetwork,
setPausedProtocol,
} from '@graphprotocol/sdk'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import { ContractTransaction } from 'ethers'

graphTask('migrate', 'Deploy protocol contracts')
greTask('migrate', 'Deploy protocol contracts')
.addFlag('skipConfirmation', 'Skip confirmation prompt on write actions')
.addFlag('skipPostDeploy', 'Skip accepting ownership and unpausing protocol after deploying')
.addFlag('force', 'Deploy contract even if its already deployed')
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/tasks/verify/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as types from 'hardhat/internal/core/params/argumentTypes'
import { submitSourcesToSourcify } from './sourcify'
import { isFullyQualifiedName, parseFullyQualifiedName } from 'hardhat/utils/contract-names'
import { TASK_COMPILE } from 'hardhat/builtin-tasks/task-names'
import { graphTask } from '@graphprotocol/sdk/gre'
import { greTask } from '@graphprotocol/sdk/gre'
import fs from 'fs'
import path from 'path'
import { HardhatRuntimeEnvironment } from 'hardhat/types/runtime'
Expand Down Expand Up @@ -32,7 +32,7 @@ task('sourcify', 'Verifies contract on sourcify')
})
})

graphTask('sourcifyAll', 'Verifies all contracts on sourcify').setAction(async (_args, hre) => {
greTask('sourcifyAll', 'Verifies all contracts on sourcify').setAction(async (_args, hre) => {
const chainId = hre.network.config.chainId
const chainName = hre.network.name

Expand Down Expand Up @@ -68,7 +68,7 @@ graphTask('sourcifyAll', 'Verifies all contracts on sourcify').setAction(async (
}
})

graphTask('verifyAll', 'Verifies all contracts on etherscan').setAction(async (args, hre) => {
greTask('verifyAll', 'Verifies all contracts on etherscan').setAction(async (args, hre) => {
const chainId = hre.network.config.chainId
const chainName = hre.network.name

Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/gre/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ The priority for the address book is:

GRE accepts a few parameters when being initialized. When using GRE in the context of a hardhat task these parameters would typically be configured as task options.

In order to simplify the creation of hardhat tasks that will make use of GRE and would require several options to be defined we provide a convenience method: `graphTask`. This is a drop in replacement for hardhat's `task` that includes GRE related boilerplate, you can still customize the task as you would do with `task`.
In order to simplify the creation of hardhat tasks that will make use of GRE and would require several options to be defined we provide a convenience method: `greTask`. This is a drop in replacement for hardhat's `task` that includes GRE related boilerplate, you can still customize the task as you would do with `task`.

you avoid having to define GRE's options on all of your tasks.

Here is an example of a task using this convenience method:

```ts
import { graphTask } from '../../gre/gre'
import { greTask } from '../../gre/gre'

graphTask('hello-world', 'Say hi!', async (args, hre) => {
greTask('hello-world', 'Say hi!', async (args, hre) => {
console.log('hello world')
const graph = hre.graph(args)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/gre/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ extendEnvironment(greExtendEnvironment)

// Exports
export * from './types'
export { graphTask } from './tasks/task'
export { greTask as greTask } from './task'
export { getGREOptsFromArgv } from './helpers/argv'
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function grePrefix(text: string): string {
return `[GRE] ${text}`
}

export function graphTask(
export function greTask(
name: string,
description?: string | undefined,
action?: ActionType<unknown> | undefined,
Expand Down

0 comments on commit eac5fa4

Please sign in to comment.