Skip to content

Commit ea451bf

Browse files
committed
Use loaded contracts in cli
1 parent 83537d7 commit ea451bf

File tree

4 files changed

+6
-159
lines changed

4 files changed

+6
-159
lines changed

scripts/cli/commands/contracts/curation.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,18 @@ export const mint = async (cli: CLIEnvironment, cliArgs: CLIArgs) => {
1111
const subgraphID = cliArgs.subgraphID
1212
const amount = parseGRT(cliArgs.amount)
1313

14-
const curationEntry = cli.addressBook.getEntry('Curation')
15-
const graphTokenEntry = cli.addressBook.getEntry('GraphToken')
16-
17-
const curation = getContractAt('Curation', curationEntry.address).connect(cli.wallet)
18-
const graphToken = getContractAt('GraphToken', graphTokenEntry.address).connect(cli.wallet)
14+
const curation = cli.contracts.Curation
15+
const graphToken = cli.contracts.GraphToken
1916

2017
logger.log('First calling approve() to ensure curation contract can call transferFrom()...')
21-
await sendTransaction(cli.wallet, graphToken, 'approve', ...[curationEntry.address, amount])
18+
await sendTransaction(cli.wallet, graphToken, 'approve', ...[curation.address, amount])
2219
logger.log(`Signaling on ${subgraphID} with ${cliArgs.amount} tokens...`)
2320
await sendTransaction(cli.wallet, curation, 'mint', ...[subgraphID, amount])
2421
}
2522
export const burn = async (cli: CLIEnvironment, cliArgs: CLIArgs) => {
2623
const subgraphID = cliArgs.subgraphID
2724
const amount = parseGRT(cliArgs.amount)
28-
29-
const curationEntry = cli.addressBook.getEntry('Curation')
30-
const curation = getContractAt('Curation', curationEntry.address).connect(cli.wallet)
25+
const curation = cli.contracts.Curation
3126

3227
logger.log(`Burning signal on ${subgraphID} with ${cliArgs.amount} tokens...`)
3328
await sendTransaction(cli.wallet, curation, 'burn', ...[subgraphID, amount])

scripts/cli/commands/contracts/service-registry.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ const logger = consola.create({})
88
export const register = async (cli: CLIEnvironment, cliArgs: CLIArgs) => {
99
const url = cliArgs.url
1010
const geoHash = cliArgs.geoHash
11-
12-
const addressEntry = cli.addressBook.getEntry('ServiceRegistry')
13-
const serviceRegistry = getContractAt('ServiceRegistry', addressEntry.address).connect(cli.wallet)
11+
const serviceRegistry = cli.contracts.ServiceRegistry
1412

1513
logger.log(`Registering indexer ${cli.walletAddress} with url ${url} and geoHash ${geoHash}`)
1614
await sendTransaction(cli.wallet, serviceRegistry, 'register', ...[url, geoHash])
1715
}
1816
export const unregister = async (cli: CLIEnvironment, cliArgs: CLIArgs) => {
19-
const addressEntry = cli.addressBook.getEntry('ServiceRegistry')
20-
const serviceRegistry = getContractAt('ServiceRegistry', addressEntry.address).connect(cli.wallet)
17+
const serviceRegistry = cli.contracts.ServiceRegistry
2118

2219
logger.log(`Unregistering indexer ${cli.walletAddress}`)
2320
await sendTransaction(cli.wallet, serviceRegistry, 'unregister')

scripts/contracts/curation.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

scripts/contracts/service-registry.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)