Skip to content

Commit a2be98f

Browse files
committed
Update cli curation scripts
1 parent 26f0b87 commit a2be98f

File tree

5 files changed

+251
-10
lines changed

5 files changed

+251
-10
lines changed

cli/commands/simulations/curatorSimulation.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const curateOnSubgraphs = async (
5656
for (let i = 0; i < txData.length; i++) {
5757
const subgraph = txData[i]
5858
const graphAccount = cli.walletAddress
59-
const signal = subgraph.signal.replace(/"/g, '')
60-
const tokens = parseGRT(signal)
59+
const tokens = parseGRT(subgraph.signal)
60+
const minNSignal = parseGRT(`0`)
6161
const gns = cli.contracts.GNS
6262

6363
logger.log(`Minting nSignal for ${graphAccount}-${firstSubgraphNumber}...`)
@@ -66,12 +66,19 @@ const curateOnSubgraphs = async (
6666
graphAccount,
6767
firstSubgraphNumber,
6868
tokens,
69+
minNSignal,
6970
])
7071
firstSubgraphNumber++
7172
}
7273
}
7374

74-
const createAndSignal = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> => {
75+
const create = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> => {
76+
const txData = parseCreateSubgraphsCSV(__dirname + cliArgs.path)
77+
logger.log(`Running create for ${txData.length} subgraphs`)
78+
await createSubgraphs(cli, txData)
79+
}
80+
81+
const signal = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> => {
7582
// First approve the GNS
7683
const maxUint = '115792089237316195423570985008687907853269984665640564039457584007913129639935'
7784
const gnsAddr = cli.contracts.GNS.address
@@ -81,8 +88,7 @@ const createAndSignal = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<v
8188
await sendTransaction(cli.wallet, graphToken, 'approve', [gnsAddr, maxUint])
8289

8390
const txData = parseCreateSubgraphsCSV(__dirname + cliArgs.path)
84-
logger.log(`Running createAndSignal for ${txData.length} subgraphs`)
85-
await createSubgraphs(cli, txData)
91+
logger.log(`Running signal for ${txData.length} subgraphs`)
8692
await curateOnSubgraphs(cli, txData, cliArgs.firstSubgraphNumber)
8793
}
8894

@@ -102,7 +108,7 @@ const unsignal = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> =>
102108
const account = txData[i].account
103109
const subgraphNumber = txData[i].subgraphNumber
104110
logger.log(`Burning ${formatGRT(burnAmount)} nSignal for ${account}-${subgraphNumber}...`)
105-
await sendTransaction(cli.wallet, gns, 'burnNSignal', [account, subgraphNumber, burnAmount])
111+
await sendTransaction(cli.wallet, gns, 'burnNSignal', [account, subgraphNumber, burnAmount, 0])
106112
}
107113
}
108114
export const curatorSimulationCommand = {
@@ -111,8 +117,23 @@ export const curatorSimulationCommand = {
111117
builder: (yargs: Argv): yargs.Argv => {
112118
return yargs
113119
.command({
114-
command: 'createAndSignal',
120+
command: 'create',
115121
describe: 'Create and signal on subgraphs by reading data from a csv file',
122+
builder: (yargs: Argv) => {
123+
return yargs.option('path', {
124+
description: 'Path of the csv file relative to this folder',
125+
type: 'string',
126+
requiresArg: true,
127+
demandOption: true,
128+
})
129+
},
130+
handler: async (argv: CLIArgs): Promise<void> => {
131+
return create(await loadEnv(argv), argv)
132+
},
133+
})
134+
.command({
135+
command: 'signal',
136+
describe: 'Signal on a bunch of subgraphs by reading data from a CSV',
116137
builder: (yargs: Argv) => {
117138
return yargs
118139
.option('path', {
@@ -129,7 +150,7 @@ export const curatorSimulationCommand = {
129150
})
130151
},
131152
handler: async (argv: CLIArgs): Promise<void> => {
132-
return createAndSignal(await loadEnv(argv), argv)
153+
return signal(await loadEnv(argv), argv)
133154
},
134155
})
135156
.command({

cli/defaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export const local = {
99
accountNumber: '0',
1010
}
1111
export const defaultOverrides: Overrides = {
12-
// gasPrice: utils.parseUnits('25', 'gwei'), // auto
13-
// gasLimit: 2000000, // auto
12+
gasPrice: utils.parseUnits('25', 'gwei'), // auto
13+
gasLimit: 2000000, // auto
1414
}
1515

1616
export const cliOpts = {

0 commit comments

Comments
 (0)