Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use gre task for hardhat tasks #915

Merged
merged 17 commits into from
Jan 15, 2024
Merged

chore: use gre task for hardhat tasks #915

merged 17 commits into from
Jan 15, 2024

Conversation

tmigone
Copy link
Contributor

@tmigone tmigone commented Jan 12, 2024

This PR changes our hardhat tasks using GRE to use greTask instead of hardhat's task. This greatly reduces boilerplate when defining the tasks:

// Before
import { task } from 'hardhat/config'

task('hello-world', 'Say hi!')
  .addOptionalParam('addressBook', 'Path to the address book file.')
  .addOptionalParam('graphConfig', 'Path to the graph config file for the network specified using --network.')
  .addOptionalParam('l1GraphConfig', 'Path to the graph config file for the L1 network.')
  .addOptionalParam('l2GraphConfig', 'Path to the graph config file for the L2 network.')
  .setAction(async (args, hre) => {
    console.log('hello world')
    const graph = hre.graph(args)
})

// After
import { greTask } from '@graphprotocol/sdk/gre'

greTask('hello-world', 'Say hi!')
  .setAction((args, hre) => {
    console.log('hello world')
    const graph = hre.graph(args)
})

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
@tmigone tmigone marked this pull request as draft January 12, 2024 17:57
@tmigone tmigone changed the base branch from main to tmigone/delete-cli January 12, 2024 17:57
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8210a6f) 92.69% compared to head (eac5fa4) 92.69%.
Report is 3 commits behind head on main.

❗ Current head eac5fa4 differs from pull request most recent head 489d799. Consider uploading reports for the commit 489d799 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #915   +/-   ##
=======================================
  Coverage   92.69%   92.69%           
=======================================
  Files          46       46           
  Lines        2369     2369           
  Branches      426      426           
=======================================
  Hits         2196     2196           
  Misses        173      173           
Flag Coverage Δ
unittests 92.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
@tmigone tmigone marked this pull request as ready for review January 12, 2024 18:29
action?: ActionType<unknown> | undefined,
): ConfigurableTaskDefinition {
return task(name, description, action)
.addOptionalParam('addressBook', grePrefix('Path to the address book file.'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following where the default values are now, or we don't have defaults anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, is it via hardhat config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah defaults are set via hardhat config. Setting a default value on task parameters means that the hardhat config values will always be overwritten and i think that's less flexible in general.

Maikol
Maikol previously approved these changes Jan 15, 2024
Base automatically changed from tmigone/delete-cli to main January 15, 2024 18:46
@tmigone tmigone dismissed Maikol’s stale review January 15, 2024 18:46

The base branch was changed.

@tmigone tmigone merged commit 510409a into main Jan 15, 2024
6 checks passed
@tmigone tmigone deleted the tmigone/gre-task branch January 15, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants