Skip to content

Commit d50df36

Browse files
committed
remove owner
1 parent 7b565bc commit d50df36

13 files changed

Lines changed: 17 additions & 205 deletions

src/@types/AccessList.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export interface AccessListUser {
1010
tokenId: number
1111
block: number
1212
txId: string
13-
timestamp: number
1413
}

src/components/Indexer/processor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
NewAccessListEventProcessor,
2121
AddressAddedEventProcessor,
2222
AddressRemovedEventProcessor,
23-
AccessListOwnershipTransferredEventProcessor,
2423
ProcessorConstructor
2524
} from './processors/index.js'
2625
import { findEventByKey } from './utils.js'
@@ -43,8 +42,7 @@ const EVENT_PROCESSOR_MAP: Record<string, ProcessorConstructor> = {
4342
[EVENTS.EXCHANGE_RATE_CHANGED]: ExchangeRateChangedEventProcessor,
4443
[EVENTS.NEW_ACCESS_LIST]: NewAccessListEventProcessor,
4544
[EVENTS.ADDRESS_ADDED]: AddressAddedEventProcessor,
46-
[EVENTS.ADDRESS_REMOVED]: AddressRemovedEventProcessor,
47-
[EVENTS.ACCESS_LIST_OWNERSHIP_TRANSFERRED]: AccessListOwnershipTransferredEventProcessor
45+
[EVENTS.ADDRESS_REMOVED]: AddressRemovedEventProcessor
4846
}
4947

5048
const processorInstances = new Map<string, BaseEventProcessor>()

src/components/Indexer/processors/AccessListOwnershipTransferredEventProcessor.ts

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

src/components/Indexer/processors/AddressAddedEventProcessor.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ export class AddressAddedEventProcessor extends BaseEventProcessor {
2323
const wallet = decoded.args[0].toString().toLowerCase()
2424
const tokenId = Number(decoded.args[1])
2525
const contractAddress = event.address.toLowerCase()
26-
const block = await provider.getBlock(event.blockNumber)
27-
const timestamp = block?.timestamp ?? Math.floor(Date.now() / 1000)
2826

2927
const { accessList } = await this.getDatabase()
3028
const result = await accessList.addUser(chainId, contractAddress, {
3129
wallet,
3230
tokenId,
3331
block: event.blockNumber,
34-
txId: event.transactionHash,
35-
timestamp
32+
txId: event.transactionHash
3633
})
3734

3835
INDEXER_LOGGER.logMessage(

src/components/Indexer/processors/NewAccessListEventProcessor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class NewAccessListEventProcessor extends BaseEventProcessor {
2222
if (!decoded) return null
2323

2424
const contractAddress = decoded.args[0].toString().toLowerCase()
25-
const owner = decoded.args[1].toString().toLowerCase()
2625

2726
let transferable = false
2827
try {
@@ -43,14 +42,13 @@ export class NewAccessListEventProcessor extends BaseEventProcessor {
4342
const result = await accessList.create(
4443
chainId,
4544
contractAddress,
46-
owner,
4745
transferable,
4846
event.blockNumber,
4947
event.transactionHash
5048
)
5149

5250
INDEXER_LOGGER.logMessage(
53-
`[NewAccessList] Indexed access list ${contractAddress} on chain ${chainId} (owner=${owner}, transferable=${transferable})`
51+
`[NewAccessList] Indexed access list ${contractAddress} on chain ${chainId} (transferable=${transferable})`
5452
)
5553
return result
5654
} catch (err) {

src/components/Indexer/processors/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export * from './OrderStartedEventProcessor.js'
1515
export * from './NewAccessListEventProcessor.js'
1616
export * from './AddressAddedEventProcessor.js'
1717
export * from './AddressRemovedEventProcessor.js'
18-
export * from './AccessListOwnershipTransferredEventProcessor.js'
1918
export * from './BaseProcessor.js'
2019

2120
export type ProcessorConstructor = new (

src/components/database/BaseDatabase.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export abstract class AbstractAccessListDatabase extends AbstractDatabase {
4343
abstract create(
4444
chainId: number,
4545
contractAddress: string,
46-
owner: string,
4746
transferable: boolean,
4847
block: number,
4948
txId: string
@@ -64,14 +63,6 @@ export abstract class AbstractAccessListDatabase extends AbstractDatabase {
6463
txId: string
6564
): Promise<any>
6665

67-
abstract updateOwner(
68-
chainId: number,
69-
contractAddress: string,
70-
owner: string,
71-
block: number,
72-
txId: string
73-
): Promise<any>
74-
7566
abstract searchByWallet(wallet: string, chainId?: number): Promise<any[]>
7667
abstract delete(chainId: number, contractAddress: string): Promise<any>
7768
}

src/components/database/ElasticSchemas.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ export const elasticSchemas: ElasticsearchSchemas = {
173173
properties: {
174174
chainId: { type: 'integer' },
175175
contractAddress: { type: 'keyword' },
176-
owner: { type: 'keyword' },
177176
factoryDeployed: { type: 'boolean' },
178177
transferable: { type: 'boolean' },
179178
users: {
@@ -182,8 +181,7 @@ export const elasticSchemas: ElasticsearchSchemas = {
182181
wallet: { type: 'keyword' },
183182
tokenId: { type: 'long' },
184183
block: { type: 'long' },
185-
txId: { type: 'keyword' },
186-
timestamp: { type: 'long' }
184+
txId: { type: 'keyword' }
187185
}
188186
},
189187
lastUpdatedBlock: { type: 'long' },

src/components/database/ElasticSearchDatabase.ts

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,6 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10531053
properties: {
10541054
chainId: { type: 'integer' },
10551055
contractAddress: { type: 'keyword' },
1056-
owner: { type: 'keyword' },
10571056
factoryDeployed: { type: 'boolean' },
10581057
transferable: { type: 'boolean' },
10591058
users: {
@@ -1062,8 +1061,7 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10621061
wallet: { type: 'keyword' },
10631062
tokenId: { type: 'long' },
10641063
block: { type: 'long' },
1065-
txId: { type: 'keyword' },
1066-
timestamp: { type: 'long' }
1064+
txId: { type: 'keyword' }
10671065
}
10681066
},
10691067
lastUpdatedBlock: { type: 'long' },
@@ -1081,13 +1079,11 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10811079
async create(
10821080
chainId: number,
10831081
contractAddress: string,
1084-
owner: string,
10851082
transferable: boolean,
10861083
block: number,
10871084
txId: string
10881085
) {
10891086
const id = this.docId(chainId, contractAddress)
1090-
const lowerOwner = owner.toLowerCase()
10911087
const lowerContract = contractAddress.toLowerCase()
10921088
try {
10931089
await this.client.update({
@@ -1097,18 +1093,16 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
10971093
script: {
10981094
source: `
10991095
ctx._source.factoryDeployed = true;
1100-
ctx._source.owner = params.owner;
11011096
ctx._source.transferable = params.transferable;
11021097
ctx._source.lastUpdatedBlock = params.block;
11031098
ctx._source.lastTxId = params.txId;
11041099
`,
11051100
lang: 'painless',
1106-
params: { owner: lowerOwner, transferable, block, txId }
1101+
params: { transferable, block, txId }
11071102
},
11081103
upsert: {
11091104
chainId,
11101105
contractAddress: lowerContract,
1111-
owner: lowerOwner,
11121106
factoryDeployed: true,
11131107
transferable,
11141108
users: [],
@@ -1181,7 +1175,6 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
11811175
upsert: {
11821176
chainId,
11831177
contractAddress: lowerContract,
1184-
owner: '',
11851178
factoryDeployed: false,
11861179
transferable: false,
11871180
users: [normalized],
@@ -1253,47 +1246,6 @@ export class ElasticsearchAccessListDatabase extends AbstractAccessListDatabase
12531246
}
12541247
}
12551248

1256-
async updateOwner(
1257-
chainId: number,
1258-
contractAddress: string,
1259-
owner: string,
1260-
block: number,
1261-
txId: string
1262-
) {
1263-
const id = this.docId(chainId, contractAddress)
1264-
try {
1265-
await this.client.update({
1266-
index: this.index,
1267-
id,
1268-
body: {
1269-
script: {
1270-
source: `
1271-
ctx._source.owner = params.owner;
1272-
ctx._source.lastUpdatedBlock = params.block;
1273-
ctx._source.lastTxId = params.txId;
1274-
`,
1275-
lang: 'painless',
1276-
params: { owner: owner.toLowerCase(), block, txId }
1277-
}
1278-
},
1279-
refresh: 'wait_for'
1280-
})
1281-
return { id }
1282-
} catch (error) {
1283-
if (error?.meta?.statusCode === 404) {
1284-
return null
1285-
}
1286-
const errorMsg = `Error when updating owner on access list ${id}: ${error.message}`
1287-
DATABASE_LOGGER.logMessageWithEmoji(
1288-
errorMsg,
1289-
true,
1290-
GENERIC_EMOJIS.EMOJI_CROSS_MARK,
1291-
LOG_LEVELS_STR.LEVEL_ERROR
1292-
)
1293-
return null
1294-
}
1295-
}
1296-
12971249
async searchByWallet(wallet: string, chainId?: number): Promise<any[]> {
12981250
const lowerWallet = wallet.toLowerCase()
12991251
const filters: any[] = [

src/components/database/TypesenseDatabase.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -965,21 +965,18 @@ export class TypesenseAccessListDatabase extends AbstractAccessListDatabase {
965965
async create(
966966
chainId: number,
967967
contractAddress: string,
968-
owner: string,
969968
transferable: boolean,
970969
block: number,
971970
txId: string
972971
) {
973972
const id = this.docId(chainId, contractAddress)
974973
const lowerContract = contractAddress.toLowerCase()
975-
const lowerOwner = owner.toLowerCase()
976974
try {
977975
const existing: any = await this.retrieve(chainId, contractAddress)
978976
const doc = {
979977
id,
980978
chainId,
981979
contractAddress: lowerContract,
982-
owner: lowerOwner,
983980
factoryDeployed: true,
984981
transferable,
985982
users: existing?.users ?? [],
@@ -1025,7 +1022,6 @@ export class TypesenseAccessListDatabase extends AbstractAccessListDatabase {
10251022
id,
10261023
chainId,
10271024
contractAddress: lowerContract,
1028-
owner: existing?.owner ?? '',
10291025
factoryDeployed: existing?.factoryDeployed ?? false,
10301026
transferable: existing?.transferable ?? false,
10311027
users: nextUsers,
@@ -1069,29 +1065,6 @@ export class TypesenseAccessListDatabase extends AbstractAccessListDatabase {
10691065
}
10701066
}
10711067

1072-
async updateOwner(
1073-
chainId: number,
1074-
contractAddress: string,
1075-
owner: string,
1076-
block: number,
1077-
txId: string
1078-
) {
1079-
const id = this.docId(chainId, contractAddress)
1080-
try {
1081-
return await this.provider.collections(this.schema.name).documents().update(id, {
1082-
owner: owner.toLowerCase(),
1083-
lastUpdatedBlock: block,
1084-
lastTxId: txId
1085-
})
1086-
} catch (error) {
1087-
if (error instanceof TypesenseError && error.httpStatus === 404) {
1088-
return null
1089-
}
1090-
this.logError(`updating owner on access list ${id}`, error)
1091-
return null
1092-
}
1093-
}
1094-
10951068
async searchByWallet(wallet: string, chainId?: number): Promise<any[]> {
10961069
const lowerWallet = wallet.toLowerCase()
10971070
try {

0 commit comments

Comments
 (0)