Skip to content

Commit

Permalink
*: Remove unused connext vector impl and related dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fordN committed Jan 6, 2022
1 parent e2d0ad5 commit f7fa658
Show file tree
Hide file tree
Showing 11 changed files with 1,337 additions and 5,695 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Options:
[boolean] [default: false]
--free-query-auth-token Auth token that clients can use to query for free
[array]
--use-vector Whether to use Vector for query fees [boolean]
--client-signer-address Address that signs query fee receipts from a known
client [string]
```
Expand Down Expand Up @@ -189,7 +188,6 @@ Query Fees
agent [string]
--vector-event-server-port Port to serve the vector event server at
[number] [default: 8001]
--use-vector Whether to use Vector for query fees [boolean]
--allocation-exchange-contract Address of the contract to submit query fee
vouchers to [string] [default: "auto"]
--collect-receipts-endpoint Client endpoint for collecting receipts
Expand Down
97 changes: 22 additions & 75 deletions packages/indexer-agent/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ import { Network } from '../network'
import { Indexer } from '../indexer'
import { providers, Wallet } from 'ethers'
import { startCostModelAutomation } from '../cost'
import {
bindAllocationExchangeContract,
TransferReceiptCollector,
} from '../query-fees'
import { bindAllocationExchangeContract } from '../query-fees'
import { AllocationReceiptCollector } from '../query-fees/allocations'
import { createSyncingServer } from '../syncing-server'

Expand Down Expand Up @@ -355,33 +352,18 @@ export default {
default: 8001,
group: 'Query Fees',
})
.option('use-vector', {
description: 'Whether to use Vector for query fees',
type: 'boolean',
required: false,
implies: [
'vector-node',
'vector-router',
'vector-transfer-definition',
'vector-event-server',
'vector-event-server-port',
],
group: 'Query Fees',
})
.option('allocation-exchange-contract', {
description: 'Address of the contract to submit query fee vouchers to',
type: 'string',
required: false,
default: 'auto',
conflicts: ['use-vector'],
implies: ['collect-receipts-endpoint'],
group: 'Query Fees',
})
.option('collect-receipts-endpoint', {
description: 'Client endpoint for collecting receipts',
type: 'string',
required: false,
conflicts: ['use-vector'],
implies: ['allocation-exchange-contract'],
group: 'Query Fees',
})
Expand All @@ -391,7 +373,6 @@ export default {
type: 'number',
default: 2160,
required: false,
conflicts: ['use-vector'],
implies: ['allocation-exchange-contract'],
group: 'Query Fees',
})
Expand Down Expand Up @@ -718,63 +699,29 @@ export default {
metrics,
})

let receiptCollector

if (argv.useVector) {
// Identify the Graph transfer definition address
// TODO: Pick it from the `contracts`
const vectorTransferDefinition = toAddress(
argv.vectorTransferDefinition === 'auto'
? ethereum.network.chainId === 1
? '0x0000000000000000000000000000000000000000'
: '0x87b1A09EfE2DA4022fc4a152D10dd2Df36c67544'
: argv.vectorTransferDefinition,
)
// Identify the allocation exchange contract address
// TODO: Pick it from the `contracts`
const allocationExchangeContract = toAddress(
argv.allocationExchangeContract === 'auto'
? ethereum.network.chainId === 1
? '0x4a53cf3b3EdA545dc61dee0cA21eA8996C94385f' // mainnet
: '0x58Ce0A0f41449E349C1A91Dd9F3D9286Bf32c161' // rinkeby
: argv.allocationExchangeContract,
)

// Automatically sync the status of receipt transfers to the db
receiptCollector = await TransferReceiptCollector.create({
logger,
ethereum,
metrics,
const receiptCollector = new AllocationReceiptCollector({
logger,
network,
models: queryFeeModels,
collectEndpoint: new URL(argv.collectReceiptsEndpoint),
allocationExchange: bindAllocationExchangeContract(
wallet,
contracts,
vector: {
nodeUrl: argv.vectorNode,
routerIdentifier: argv.vectorRouter,
transferDefinition: vectorTransferDefinition,
eventServer: {
url: argv.vectorEventServer,
port: argv.vectorEventServerPort,
},
},
models: queryFeeModels,
})
await receiptCollector.queuePendingTransfersFromDatabase()
} else {
// Identify the allocation exchange contract address
// TODO: Pick it from the `contracts`
const allocationExchangeContract = toAddress(
argv.allocationExchangeContract === 'auto'
? ethereum.network.chainId === 1
? '0x4a53cf3b3EdA545dc61dee0cA21eA8996C94385f' // mainnet
: '0x58Ce0A0f41449E349C1A91Dd9F3D9286Bf32c161' // rinkeby
: argv.allocationExchangeContract,
)

receiptCollector = new AllocationReceiptCollector({
logger,
network,
models: queryFeeModels,
collectEndpoint: new URL(argv.collectReceiptsEndpoint),
allocationExchange: bindAllocationExchangeContract(
wallet,
allocationExchangeContract,
),
allocationClaimThreshold: parseGRT(argv.rebateClaimThreshold),
voucherExpiration: argv.voucherExpiration,
})
await receiptCollector.queuePendingReceiptsFromDatabase()
}
allocationExchangeContract,
),
allocationClaimThreshold: parseGRT(argv.rebateClaimThreshold),
voucherExpiration: argv.voucherExpiration,
})
await receiptCollector.queuePendingReceiptsFromDatabase()

await startAgent({
logger,
Expand Down
1 change: 0 additions & 1 deletion packages/indexer-agent/src/query-fees/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Allocation } from '@graphprotocol/indexer-common'

export * from './transfers'
export * from './allocations'
export * from './allocation-exchange'

Expand Down
Loading

0 comments on commit f7fa658

Please sign in to comment.