Ejemplo n.º 1
0
async def process_tokens_from_old_transfers(startBlockNumber: int, endBlockNumber: int, batchSize: int):
    databaseConnectionString = Database.create_psql_connection_string(username=os.environ["DB_USERNAME"], password=os.environ["DB_PASSWORD"], host=os.environ["DB_HOST"], port=os.environ["DB_PORT"], name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)
    s3manager = S3Manager(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    workQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-work-queue')
    tokenQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-token-queue')
    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
    requester = Requester()
    tokenMetadataProcessor = TokenMetadataProcessor(requester=requester, ethClient=ethClient, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    tokenOwnershipProcessor = TokenOwnershipProcessor(retriever=retriever)
    collectionProcessor = CollectionProcessor(requester=requester, ethClient=ethClient, openseaApiKey=openseaApiKey, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    tokenManager = TokenManager(saver=saver, retriever=retriever, tokenQueue=tokenQueue, collectionProcessor=collectionProcessor, tokenMetadataProcessor=tokenMetadataProcessor, tokenOwnershipProcessor=tokenOwnershipProcessor)
    revueApiKey = os.environ['REVUE_API_KEY']

    await database.connect()
    await workQueue.connect()
    await s3manager.connect()
    await tokenQueue.connect()
    cache = set()
    registryCache = set()
    currentBlockNumber = startBlockNumber
    while currentBlockNumber < endBlockNumber:
        start = currentBlockNumber
        end = min(currentBlockNumber + batchSize, endBlockNumber)
        currentBlockNumber = end
        logging.info(f'Working on {start}-{end}...')
        query = (
             sqlalchemy.select(TokenTransfersTable.c.registryAddress, TokenTransfersTable.c.tokenId)
             .where(TokenTransfersTable.c.blockNumber >= start)
             .where(TokenTransfersTable.c.blockNumber < end)
         )
        result = await database.execute(query=query,)
        tokensToProcess = set()
        collectionsToProcess = set()
        for (registryAddress, tokenId) in result:
            if (registryAddress, tokenId) in cache:
                continue
            cache.add((registryAddress, tokenId))
            tokensToProcess.add((registryAddress, tokenId))
            if registryAddress in registryCache:
                continue
            registryCache.add(registryAddress)
            collectionsToProcess.add(registryAddress)
        print('len(tokensToProcess)', len(tokensToProcess))
        print('len(collectionsToProcess)', len(collectionsToProcess))
        try:
            await _update_token_metadatas(tokensToProcess=tokensToProcess, tokenManager=tokenManager, retriever=retriever)
            await _update_collections(collectionsToProcess=collectionsToProcess, tokenManager=tokenManager, retriever=retriever)
        except:
            logging.error(f'Failed during: {start}-{end}')
            raise
    await database.disconnect()
    await workQueue.disconnect()
    await tokenQueue.disconnect()
    await s3manager.disconnect()
Ejemplo n.º 2
0
async def main():
    requestIdHolder = RequestIdHolder()
    name = os.environ.get('NAME', 'notd-api')
    version = os.environ.get('VERSION', 'local')
    environment = os.environ.get('ENV', 'dev')
    isRunningDebugMode = environment == 'dev'

    if isRunningDebugMode:
        logging.init_basic_logging()
    else:
        logging.init_json_logging(name=name, version=version, environment=environment, requestIdHolder=requestIdHolder)

    databaseConnectionString = Database.create_psql_connection_string(username=os.environ["DB_USERNAME"], password=os.environ["DB_PASSWORD"], host=os.environ["DB_HOST"], port=os.environ["DB_PORT"], name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)
    s3manager = S3Manager(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    workQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-work-queue')
    tokenQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-token-queue')
    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
    blockProcessor = BlockProcessor(ethClient=ethClient)
    requester = Requester()
    tokenMetadataProcessor = TokenMetadataProcessor(requester=requester, ethClient=ethClient, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    collectionProcessor = CollectionProcessor(requester=requester, ethClient=ethClient, openseaApiKey=openseaApiKey, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    tokenOwnershipProcessor = TokenOwnershipProcessor(retriever=retriever)
    collectionActivityProcessor = CollectionActivityProcessor(retriever=retriever)
    revueApiKey = os.environ['REVUE_API_KEY']
    tokenManager = TokenManager(saver=saver, retriever=retriever, tokenQueue=tokenQueue, collectionProcessor=collectionProcessor, tokenMetadataProcessor=tokenMetadataProcessor, tokenOwnershipProcessor=tokenOwnershipProcessor, collectionActivityProcessor=collectionActivityProcessor)
    notdManager = NotdManager(blockProcessor=blockProcessor, saver=saver, retriever=retriever, workQueue=workQueue, tokenManager=tokenManager, requester=requester, revueApiKey=revueApiKey)

    processor = NotdMessageProcessor(notdManager=notdManager)
    slackClient = SlackClient(webhookUrl=os.environ['SLACK_WEBHOOK_URL'], requester=requester, defaultSender='worker', defaultChannel='notd-notifications')
    workQueueProcessor = MessageQueueProcessor(queue=workQueue, messageProcessor=processor, slackClient=slackClient, requestIdHolder=requestIdHolder)
    tokenQueueProcessor = MessageQueueProcessor(queue=tokenQueue, messageProcessor=processor, slackClient=slackClient, requestIdHolder=requestIdHolder)

    await database.connect()
    await s3manager.connect()
    await workQueue.connect()
    await tokenQueue.connect()
    try:
        while True:
            hasProcessedWork = await workQueueProcessor.execute_batch(batchSize=3, longPollSeconds=1, shouldProcessInParallel=True)
            if hasProcessedWork:
                continue
            hasProcessedToken = await tokenQueueProcessor.execute_batch(batchSize=10, longPollSeconds=1, shouldProcessInParallel=True)
            if hasProcessedToken:
                continue
            logging.info('No message received.. sleeping')
            time.sleep(60)
    finally:
        await database.disconnect()
        await s3manager.disconnect()
        await workQueue.disconnect()
        await tokenQueue.disconnect()
        await requester.close_connections()
Ejemplo n.º 3
0
async def calculate_token_fields(startCollectionId: Optional[int], endCollectionId: Optional[int]):
    databaseConnectionString = Database.create_psql_connection_string(username=os.environ["DB_USERNAME"], password=os.environ["DB_PASSWORD"], host=os.environ["DB_HOST"], port=os.environ["DB_PORT"], name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    s3manager = S3Manager(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    bucketName = os.environ['S3_BUCKET']

    await database.connect()
    await s3manager.connect()
    query = TokenCollectionsTable.select()
    if startCollectionId:
        query = query.where(TokenCollectionsTable.c.collectionId >= startCollectionId)
    if endCollectionId:
        query = query.where(TokenCollectionsTable.c.collectionId < endCollectionId)
    collections = [collection_from_row(row) async for row in database.iterate(query=query)]
    rows = []
    fields = set()
    for collection in collections:
        logging.info(f'Working on {collection.address}')
        collectionDirectory = f'{bucketName}/token-metadatas/{collection.address}/'
        index = 0
        async for tokenFile in s3manager.generate_directory_files(s3Directory=collectionDirectory):
            logging.info(f'Working on file {tokenFile.bucket}/{tokenFile.path}')
            if index > 3:
                break
            try:
                tokenDict = json.loads(await s3manager.read_file(sourcePath=f'{tokenFile.bucket}/{tokenFile.path}'))
                tokenDict['tokenId'] = tokenFile.path.split('/')[2]
                if tokenDict.get('attributes'):
                    tokenDict['attributes'] = ",".join(list(set(key for attribute in tokenDict.get('attributes', []) for key in attribute.keys()))) if isinstance(tokenDict.get('attributes', []), List) else [attribute for attribute in tokenDict.get('attributes')]
                else:
                    tokenDict['attributes'] = None
                tokenDict['description'] = tokenDict["description"][:10] if tokenDict.get('description') else None
                tokenDict['collection'] = collection.address
                fields.update(tokenDict.keys())
                rows.append(tokenDict)
            except Exception as exception:
                logging.exception(exception)
            index += 1

    with open(f'./output{startCollectionId}-{endCollectionId}.tsv', 'w') as outFile:
        dictWriter = csv.DictWriter(outFile, fields, delimiter='\t')
        dictWriter.writeheader()
        dictWriter.writerows(rows)

    fieldCounts = defaultdict(int)
    for row in rows:
        for key, value in row.items():
            if value:
                fieldCounts[key] += 1
    print(fieldCounts)


    await database.disconnect()
    await s3manager.disconnect()
async def process_token_ownerships(startTokenId: int, endTokenId: int, batchSize: int):
    databaseConnectionString = Database.create_psql_connection_string(username=os.environ["DB_USERNAME"], password=os.environ["DB_PASSWORD"], host=os.environ["DB_HOST"], port=os.environ["DB_PORT"], name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)
    s3manager = S3Manager(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    workQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-work-queue')
    tokenQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-token-queue')
    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
    requester = Requester()
    tokenMetadataProcessor = TokenMetadataProcessor(requester=requester, ethClient=ethClient, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    tokenOwnershipProcessor = TokenOwnershipProcessor(retriever=retriever)
    collectionProcessor = CollectionProcessor(requester=requester, ethClient=ethClient, openseaApiKey=openseaApiKey, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    tokenManager = TokenManager(saver=saver, retriever=retriever, tokenQueue=tokenQueue, collectionProcessor=collectionProcessor, tokenMetadataProcessor=tokenMetadataProcessor, tokenOwnershipProcessor=tokenOwnershipProcessor)
    revueApiKey = os.environ['REVUE_API_KEY']
    slackClient = SlackClient(webhookUrl=os.environ['SLACK_WEBHOOK_URL'], requester=requester, defaultSender='worker', defaultChannel='notd-notifications')

    await database.connect()
    await workQueue.connect()
    await s3manager.connect()
    await tokenQueue.connect()

    await database.connect()
    await slackClient.post(text=f'process_token_ownerships → 🚧 started: {startTokenId}-{endTokenId}')
    try:
        currentTokenId = startTokenId
        while currentTokenId < endTokenId:
            start = currentTokenId
            end = min(currentTokenId + batchSize, endTokenId)
            currentTokenId = end
            logging.info(f'Working on {start}-{end}')
            query = TokenMetadatasTable.select() \
                .where(TokenMetadatasTable.c.tokenMetadataId >= start) \
                .where(TokenMetadatasTable.c.tokenMetadataId < end)
            tokenMetadatas = await retriever.query_token_metadatas(query=query)
            await asyncio.gather(*[process_token_ownership(tokenManager=tokenManager, registryAddress=tokenMetadata.registryAddress, tokenId=tokenMetadata.tokenId) for tokenMetadata in tokenMetadatas])
        await slackClient.post(text=f'process_token_ownerships → ✅ completed : {startTokenId}-{endTokenId}')
    except Exception as exception:
        await slackClient.post(text=f'process_token_ownerships → � error: {startTokenId}-{endTokenId}\n```{str(exception)}```')
        raise exception
    finally:
        await database.disconnect()
        await workQueue.disconnect()
        await tokenQueue.disconnect()
        await s3manager.disconnect()
Ejemplo n.º 5
0
async def process_collection(address: str, shouldDefer: bool):
    databaseConnectionString = Database.create_psql_connection_string(username=os.environ["DB_USERNAME"], password=os.environ["DB_PASSWORD"], host=os.environ["DB_HOST"], port=os.environ["DB_PORT"], name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)

    s3manager = S3Manager(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    workQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-work-queue')
    tokenQueue = SqsMessageQueue(region='eu-west-1', accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'], queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/notd-token-queue')
    requester = Requester()

    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
    blockProcessor = BlockProcessor(ethClient=ethClient)
    tokenMetadataProcessor = TokenMetadataProcessor(requester=requester, ethClient=ethClient, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    collectionProcessor = CollectionProcessor(requester=requester, ethClient=ethClient, openseaApiKey=openseaApiKey, s3manager=s3manager, bucketName=os.environ['S3_BUCKET'])
    revueApiKey = os.environ['REVUE_API_KEY']
    tokenManager = TokenManager(saver=saver, retriever=retriever, tokenQueue=tokenQueue, collectionProcessor=collectionProcessor, tokenMetadataProcessor=tokenMetadataProcessor)
    notdManager = NotdManager(blockProcessor=blockProcessor, saver=saver, retriever=retriever, workQueue=workQueue, tokenManager=tokenManager, requester=requester, revueApiKey=revueApiKey)

    await database.connect()
    await s3manager.connect()
    await workQueue.connect()
    await tokenQueue.connect()
    retrievedCollectionTokenMetadatas = await retriever.list_token_metadatas(
        fieldFilters=[
            StringFieldFilter(fieldName=TokenTransfersTable.c.registryAddress.key, eq=address),
        ],
    )
    for tokenMetadata in retrievedCollectionTokenMetadatas:
        if shouldDefer:
            await notdManager.update_token_metadata_deferred(registryAddress=address, tokenId=tokenMetadata.tokenId, shouldForce=True)
        else:
            await notdManager.update_token_metadata(registryAddress=address, tokenId=tokenMetadata.tokenId, shouldForce=True)
    await database.disconnect()
    await s3manager.disconnect()
    await workQueue.disconnect()
    await tokenQueue.disconnect()
    await requester.close_connections()
Ejemplo n.º 6
0
async def _reprocess_metadata_from_s3(
        tokenMetadataProcessor: TokenMetadataProcessor, s3manager: S3Manager,
        tokenManger: TokenManager, tokenMetadata: TokenMetadata):
    tokenDirectory = f'{os.environ["S3_BUCKET"]}/token-metadatas/{tokenMetadata.registryAddress}/{tokenMetadata.tokenId}/'
    tokenFile = None
    tokenMetadataFiles = [
        file async for file in s3manager.generate_directory_files(
            s3Directory=tokenDirectory)
    ]
    if len(tokenMetadataFiles) > 0:
        tokenFile = tokenMetadataFiles[-1]
        tokenMetadataJson = await s3manager.read_file(
            sourcePath=f'{tokenFile.bucket}/{tokenFile.path}')
        tokenMetadataDict = json.loads(tokenMetadataJson)
        if not tokenMetadataDict:
            await _reprocess_metadata(
                tokenMetadataProcessor=tokenMetadataProcessor,
                s3manager=s3manager,
                tokenManger=tokenManger,
                tokenMetadata=tokenMetadata)
            return
        logging.info(
            f'Updating tokenMetadata: {tokenMetadata.tokenMetadataId}')
        s3TokenMetadata = await tokenMetadataProcessor._get_token_metadata_from_data(
            registryAddress=tokenMetadata.registryAddress,
            tokenId=tokenMetadata.tokenId,
            metadataUrl=tokenMetadata.metadataUrl,
            tokenMetadataDict=tokenMetadataDict)
        await tokenManger.save_token_metadata(
            retrievedTokenMetadata=s3TokenMetadata)
        logging.info(f'Updated tokenMetadata: {tokenMetadata.tokenMetadataId}')
    else:
        await _reprocess_metadata(
            tokenMetadataProcessor=tokenMetadataProcessor,
            s3manager=s3manager,
            tokenManger=tokenManger,
            tokenMetadata=tokenMetadata)
Ejemplo n.º 7
0
async def main():
    s3manager = S3Manager(region='eu-west-1',
                          accessKeyId=os.environ['AWS_KEY'],
                          accessKeySecret=os.environ['AWS_SECRET'])
    requester = Requester()
    ethClient = RestEthClient(
        url=f'https://mainnet.infura.io/v3/{os.environ["INFURA_PROJECT_ID"]}',
        requester=requester)
    blockProcessor = BlockProcessor(ethClient=ethClient)
    requester = Requester()
    tokenMetadataProcessor = TokenMetadataProcessor(
        requester=requester,
        ethClient=ethClient,
        s3manager=s3manager,
        bucketName=os.environ['S3_BUCKET'])

    await s3manager.connect()
    result = tokenMetadataProcessor.get_default_token_metadata(
        registryAddress='0x57E9a39aE8eC404C08f88740A9e6E306f50c937f',
        tokenId=165)
    expected = RetrievedTokenMetadata(
        registryAddress='0x57E9a39aE8eC404C08f88740A9e6E306f50c937f',
        tokenId='165',
        metadataUrl=None,
        imageUrl=None,
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        name='#165',
        description=None,
        frameImageUrl=None,
        attributes=[])
    assert (result == expected)

    collection = Collection(
        address='0x495f947276749Ce646f68AC8c248420045cb7b5e',
        name='OpenSea Shared Storefront',
        symbol='OPENSTORE',
        description=None,
        imageUrl=None,
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug=None,
        url=None,
        discordUrl=None,
        bannerImageUrl=None,
        doesSupportErc721=False,
        doesSupportErc1155=True,
        collectionId=9,
        createdDate=datetime.datetime(2022, 2, 10, 15, 35, 27, 493515),
        updatedDate=datetime.datetime(2022, 3, 10, 11, 20, 43, 69095))
    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0x495f947276749Ce646f68AC8c248420045cb7b5e',
        tokenId=
        '1027194722486925029699656604254821663009080914619475021175016778814206246913',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0x495f947276749Ce646f68AC8c248420045cb7b5e',
        tokenId=
        '1027194722486925029699656604254821663009080914619475021175016778814206246913',
        metadataUrl=
        'https://api.opensea.io/api/v1/metadata/0x495f947276749Ce646f68AC8c248420045cb7b5e/1027194722486925029699656604254821663009080914619475021175016778814206246913',
        name='LegacyPunks #117 Richard the Lionheart',
        description=
        'Richard the Lionheart (1157-1199 AD), actually Richard I of England - but more commonly known as Lionheart due to his reputation as great military leader and warrior, was King of England from 1189 until his death in 1199 AD. Richard spent the majority of his life at war and eventually died in battle. He also ruled as Duke of Normandy, Aquitaine and Gascony, Lord of Cyprus, and Count of Poitiers, Anjou, Maine, and Nantes, and was overlord of Brittany at various times during the same period. Richard was a popular ruler and is perhaps best known for his attempt to retake Jerusalem from Saladin during the Third Crusade. Although, this Crusade did not successfully recapture Jerusalem, it achieved partial success in recapturing Acre, Jaffa, and reversing most of Saladin’s conquests. Regardless, Richard is much considered the winner of the Third Crusade after his famous victory at the Battle of Arsuf.',
        imageUrl=
        'https://lh3.googleusercontent.com/3u7F2lRRhj9y4dd2-o9R8sfU7dYW6UQN4Vc4BOoH1JyrT5cAHPDF40Q2aPycYn1ZDoin3CnCVRgD2yHe82KYlmVX8Lbbw_YaFp1YyQ',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        frameImageUrl=None,
        attributes=[])
    assert (result == expected)

    collection = Collection(
        address='0x93317e87a3a47821803caadc54ae418af80603da',
        name='Cameo Pass',
        symbol='CAMEOPASS',
        description=
        'Cameo Pass is a collection of NFTs granting access to Cameo in the metaverse,...',
        imageUrl=
        'https://openseauserdata.com/files/7572aef06110b4e365817f60d37eff0d.svg',
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='cameo-pass',
        url='http://pass.cameo.com',
        discordUrl='https://discord.gg/ssZeP6WBYg',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/HiSZHoavhCSzrmc2Un2y6QzSWk_wAWLz4sBr9G1Wjz6bGH8mDce_8rNlH-vRvM1xwbqS-_pSCsK99rrr8P-Es4FCkjvxETij8lojNw=s2500',
        doesSupportErc721=False,
        doesSupportErc1155=True,
        collectionId=64040,
        createdDate=datetime.datetime(2022, 4, 2, 21, 37, 1, 727907),
        updatedDate=datetime.datetime(2022, 4, 2, 21, 37, 1, 727907))

    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0x93317e87a3a47821803caadc54ae418af80603da',
        tokenId='2',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0x93317e87a3a47821803caadc54ae418af80603da',
        tokenId='2',
        metadataUrl=
        'ipfs://Qmbitpu7WNj76fhArU2yU2wqQbTnW7ASNJcm8Kf4F4GzL1/0000000000000000000000000000000000000000000000000000000000000002.json',
        name='gn',
        description='gn. Art by Vinnie Hager.',
        imageUrl='ipfs://QmQuqAAahKUw6BHXbEYAvz9N8UTaHPH5X1iK18LaLdUSqo/2.gif',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        frameImageUrl=None,
        attributes=[])
    assert (result == expected)

    collection = Collection(
        address='0x97fB6806AcbA833c5Ca80135D7d75BF3794b9df7',
        name='Lifetime Pass',
        symbol='LP',
        description=
        "The Lifetime Pass gives users lifetime access to Astroworld's Virtual Theme Park....",
        imageUrl=
        'https://gateway.pinata.cloud/ipfs/QmewxBAuXkvkV2YcskXK7GBcspX7MuMvNdMjbiRBNbekdf/',
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='astroworld-lifetime-pass-v2',
        url=None,
        discordUrl=None,
        bannerImageUrl=None,
        doesSupportErc721=True,
        doesSupportErc1155=False,
        collectionId=65389,
        createdDate=datetime.datetime(2022, 4, 7, 9, 24, 30, 369275),
        updatedDate=datetime.datetime(2022, 4, 7, 9, 24, 30, 369275))
    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0x97fB6806AcbA833c5Ca80135D7d75BF3794b9df7',
        tokenId='2',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0x97fB6806AcbA833c5Ca80135D7d75BF3794b9df7',
        tokenId='2',
        metadataUrl='ipfs://QmQNWCbw2SDPt21qs4gENSAhbxMYDrmf8ur6pxKz8Ra1MZ',
        name='Astroworld Lifetime Pass',
        description=
        "The Lifetime Pass gives users lifetime access to Astroworld's Virtual Theme Park. This NFT must be in your wallet at the time of each entry. Additionally, Astroworld LP holders will have exclusive access to Astroworld BETA and Astroworld related events that take place in Astroworld or IRL.",
        imageUrl=
        'https://gateway.pinata.cloud/ipfs/QmewxBAuXkvkV2YcskXK7GBcspX7MuMvNdMjbiRBNbekdf/',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        frameImageUrl=None,
        attributes=[])
    assert (result == expected)

    collection = Collection(
        address='0x4581649aF66BCCAeE81eebaE3DDc0511FE4C5312',
        name='TheAlienBoy',
        symbol='TABOY',
        description=
        'Each Alien Boy is unique and algorithmically generated by combining 182 properties ...',
        imageUrl=
        'https://lh3.googleusercontent.com/mnNWlPXlDTp8N1JP2kiCrTy-w0lGU0S1AX5sMm0ZhWjSTpIh4RTwXERNjz83aKI1uKjyqf8yZJlsId6TeUgvJRhwaWScJPdWZSlISJc=s120',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='thealienboy',
        url='https://www.thealienboy.com/',
        discordUrl='https://discord.gg/thealienboy',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/bWgbzHdOrgOtpDUm0LTIo4eH4JjzeDUsTce4qA3mrBkGw-wXYnWDQVxaKXBG28Y2kQ634cAFBYEfsBMpqggMirS9Vu6GKxAOeKnqJ00=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False,
        collectionId=40,
        createdDate=datetime.datetime(2022, 1, 31, 12, 23, 58, 978642),
        updatedDate=datetime.datetime(2022, 1, 31, 12, 23, 58, 978642))
    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0x4581649aF66BCCAeE81eebaE3DDc0511FE4C5312',
        tokenId='6574',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0x4581649aF66BCCAeE81eebaE3DDc0511FE4C5312',
        tokenId='6574',
        metadataUrl='https://api.thealienboy.com/metadata/6574',
        imageUrl=
        'https://gateway.pinata.cloud/ipfs/Qmburch4fp76L6oTfDjZF4Ybk3SzpFbbU52xjN8x42rVTS',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        name='Alien Boy 6574',
        description=
        'your Alien Boy has a unique DNA. yours is #0804080734090200350000  \nkeep it safe boy, you may need it someday.',
        frameImageUrl=None,
        attributes=[{
            'trait_type': 'background',
            'value': 'Tiger Orange'
        }, {
            'trait_type': 'skin',
            'value': 'Red'
        }, {
            'trait_type': 'face',
            'value': 'Scratch'
        }, {
            'trait_type': 'eyes',
            'value': 'Bloodshot'
        }, {
            'trait_type': 'body',
            'value': 'Miami Suit'
        }, {
            'trait_type': 'mouth',
            'value': 'Slime'
        }, {
            'trait_type': 'accessory',
            'value': 'Neon Sunglasses'
        }, {
            'trait_type': 'head',
            'value': 'Stickers'
        }, {
            'trait_type': 'first_encounter',
            'value': '1623776953',
            'display_type': 'date'
        }])
    assert (result == expected)

    collection = Collection(
        address='0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
        name='Uniswap V3 Positions NFT-V1',
        symbol='UNI-V3-POS',
        description='',
        imageUrl=
        'https://lh3.googleusercontent.com/8My7rmWHJCAi35QSp2IMf50NRNIRJelpEdassqIxiL6Q_m2SE2qG7QKIT_1wfXH2afDcACiWVGrt2jkfHqHKlElttUTdL6dmC9G0Mpk=s120',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='uniswap-v3-positions',
        url='https://uniswap.org/',
        discordUrl='https://discord.gg/FCfyBSbCU5',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/Xq98abLTjlFfzdIxsXNL0sVE2W-3FGcJ2TFUkphz9dh9wEH4rcUesMhE7RzEh_ivPCdL5KxkNVfyE5gb870OgqOLQnBP6sIL54-G0A=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False,
        collectionId=26,
        createdDate=datetime.datetime(2022, 1, 31, 0, 24, 59, 737286),
        updatedDate=datetime.datetime(2022, 1, 31, 0, 24, 59, 737286))
    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
        tokenId='48820',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
        tokenId='48820',
        metadataUrl=
        'data:application/json;base64,eyJuYW1lIjoiVW5pc3dhcCAtIDAuMyUgLSBVTkkvV0VUSCAtIDc2Ljk5ODw+MTE4LjYwIiwgImRlc2NyaXB0aW9uIjoiVGhpcyBORlQgcmVwcmVzZW50cyBhIGxpcXVpZGl0eSBwb3NpdGlvbiBpbiBhIFVuaXN3YXAgVjMgVU5JLVdFVEggcG9vbC4gVGhlIG93bmVyIG9mIHRoaXMgTkZUIGNhbiBtb2RpZnkgb3IgcmVkZWVtIHRoZSBwb3NpdGlvbi5cblxuUG9vbCBBZGRyZXNzOiAweDFkNDIwNjRmYzRiZWI1ZjhhYWY4NWY0NjE3YWU4YjNiNWI4YmQ4MDFcblVOSSBBZGRyZXNzOiAweDFmOTg0MGE4NWQ1YWY1YmYxZDE3NjJmOTI1YmRhZGRjNDIwMWY5ODRcbldFVEggQWRkcmVzczogMHhjMDJhYWEzOWIyMjNmZThkMGEwZTVjNGYyN2VhZDkwODNjNzU2Y2MyXG5GZWUgVGllcjogMC4zJVxuVG9rZW4gSUQ6IDQ4ODIwXG5cbuKaoO+4jyBESVNDTEFJTUVSOiBEdWUgZGlsaWdlbmNlIGlzIGltcGVyYXRpdmUgd2hlbiBhc3Nlc3NpbmcgdGhpcyBORlQuIE1ha2Ugc3VyZSB0b2tlbiBhZGR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N0cm9rZT0icmdiYSgyNTUsMjU1LDI1NSwwLjIpIiAvPjxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgZD0iTTggOUM4LjAwMDA0IDIyLjk0OTQgMTYuMjA5OSAyOCAyNyAyOCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgLz48Y2lyY2xlIHN0eWxlPSJ0cmFuc2Zvcm06dHJhbnNsYXRlM2QoOHB4LCAxNC4yNXB4LCAwcHgpIiBjeD0iMHB4IiBjeT0iMHB4IiByPSI0cHgiIGZpbGw9IndoaXRlIi8+PC9nPjwvc3ZnPg==',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        name='Uniswap - 0.3% - UNI/WETH - 76.998<>118.60',
        description=
        'This NFT represents a liquidity position in a Uniswap V3 UNI-WETH pool. The owner of this NFT can modify or redeem the position.\n\nPool Address: 0x1d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801\nUNI Address: 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984\nWETH Address: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\nFee Tier: 0.3%\nToken ID: 48820\n\n⚠️ DISCLAIMER: Due diligence is imperative when assessing this NFT. Make sure token addresses match the expected tokens, as token symbols may be imitated.',
        frameImageUrl=None,
        attributes=[])
    assert (result == expected)

    collection = Collection(
        address='0xE3f92992BB4F0f0D173623A52b2922d65172601d',
        name='Knights of Degen',
        symbol='KNIGHTS',
        description=
        '8,888 NFT Degens who love sports, betting, alpha and nfts ⚔️',
        imageUrl=
        'https://lh3.googleusercontent.com/yxdb_995UrIS6W9YIHMfMCRsdYRqcITlBvO5w7OoUx35rkClUeq9rPCvTMXdtw_zION07O_qRZSuNfZu6R6o8bI_KmbrfThhFtA4SBc=s120',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='knights-of-degen-official',
        url='https://www.knightsofdegen.io/',
        discordUrl='https://discord.gg/knightsofdegen',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/328JHSQ2nPpzfTxpZjV5xiiBp6R17GgUdjHJ7BF0mU-SH0Ou1LiiYmcET0WeHt26LD4tVXenIvYZD7VC8jV__bqRCiA_CzmWfwg7=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False,
        collectionId=41,
        createdDate=datetime.datetime(2022, 1, 31, 12, 27, 18, 712443),
        updatedDate=datetime.datetime(2022, 1, 31, 12, 27, 18, 712443))
    result = await tokenMetadataProcessor.retrieve_token_metadata(
        registryAddress='0xE3f92992BB4F0f0D173623A52b2922d65172601d',
        tokenId='4655',
        collection=collection)
    expected = RetrievedTokenMetadata(
        registryAddress='0xE3f92992BB4F0f0D173623A52b2922d65172601d',
        tokenId='4655',
        metadataUrl=
        'ipfs://QmZk6BfbKYswziCEdYaMqh7yQqtcmCnHhoNu3zDGKQjKpJ/4655',
        imageUrl=
        'ipfs://QmdFkX7SkgL9cDYPwt4CNpsQ5CSz74CF3MwswmGLKEgDMp/4655.png',
        animationUrl=None,
        youtubeUrl=None,
        backgroundColor=None,
        name='Knights of Degen #4655',
        description=
        'The Knights of Degen are 8,888 NFT degenerate gamblers that live their truest and darkest lives, free from oppression, and spend their days in the Degen Sports Bars watching and wagering on all sporting events.',
        frameImageUrl=None,
        attributes=[{
            'trait_type': 'Background',
            'value': 'Teal'
        }, {
            'trait_type': 'Eyes',
            'value': 'Blue'
        }, {
            'trait_type': 'Helmet',
            'value': 'Valkyrie Helmet - Silver'
        }, {
            'trait_type': 'Nose',
            'value': 'Normal'
        }, {
            'trait_type': 'Armor',
            'value': 'Chainmail - Silver'
        }, {
            'trait_type': 'Mouth',
            'value': 'Tongue Out'
        }, {
            'trait_type': 'Character',
            'value': 'Human'
        }, {
            'trait_type': 'Weapon',
            'value': 'None'
        }])
    assert (result == expected)

    await s3manager.disconnect()
Ejemplo n.º 8
0
    password=os.environ["DB_PASSWORD"],
    host=os.environ["DB_HOST"],
    port=os.environ["DB_PORT"],
    name=os.environ["DB_NAME"])
database = Database(connectionString=databaseConnectionString)
saver = Saver(database=database)
retriever = Retriever(database=database)

workQueue = SqsMessageQueue(
    region='eu-west-1',
    accessKeyId=os.environ['AWS_KEY'],
    accessKeySecret=os.environ['AWS_SECRET'],
    queueUrl='https://sqs.eu-west-1.amazonaws.com/097520841056/mdtp-work-queue'
)
s3Manager = S3Manager(region='eu-west-1',
                      accessKeyId=os.environ['AWS_KEY'],
                      accessKeySecret=os.environ['AWS_SECRET'])

# NOTE(krishan711): The AWS eth instance is much slower with getLogs so fails when calling ContractStore.get_latest_update_block_number
# awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
# ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
requester = Requester()
ethClient = RestEthClient(url=os.environ['ALCHEMY_MAINNET_URL'],
                          requester=requester)
rinkebyEthClient = RestEthClient(url=os.environ['ALCHEMY_URL'],
                                 requester=requester)
mumbaiEthClient = RestEthClient(url='https://matic-mumbai.chainstacklabs.com',
                                requester=requester)
contractStore = create_contract_store(ethClient=ethClient,
                                      rinkebyEthClient=rinkebyEthClient,
                                      mumbaiEthClient=mumbaiEthClient)
Ejemplo n.º 9
0
async def reprocess_metadata(startId: Optional[int], endId: Optional[int],
                             batchSize: Optional[int]):
    databaseConnectionString = Database.create_psql_connection_string(
        username=os.environ["DB_USERNAME"],
        password=os.environ["DB_PASSWORD"],
        host=os.environ["DB_HOST"],
        port=os.environ["DB_PORT"],
        name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)
    s3manager = S3Manager(region='eu-west-1',
                          accessKeyId=os.environ['AWS_KEY'],
                          accessKeySecret=os.environ['AWS_SECRET'])
    tokenQueue = SqsMessageQueue(
        region='eu-west-1',
        accessKeyId=os.environ['AWS_KEY'],
        accessKeySecret=os.environ['AWS_SECRET'],
        queueUrl=
        'https://sqs.eu-west-1.amazonaws.com/097520841056/notd-token-queue')
    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'],
                                accessKeySecret=os.environ['AWS_SECRET'])
    requester = Requester()
    ethClient = RestEthClient(
        url=
        'https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com',
        requester=awsRequester)
    tokenMetadataProcessor = TokenMetadataProcessor(
        requester=requester,
        ethClient=ethClient,
        s3manager=s3manager,
        bucketName=os.environ['S3_BUCKET'])
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    collectionProcessor = CollectionProcessor(
        requester=requester,
        ethClient=ethClient,
        openseaApiKey=openseaApiKey,
        s3manager=s3manager,
        bucketName=os.environ['S3_BUCKET'])
    tokenManger = TokenManager(saver=saver,
                               retriever=retriever,
                               tokenQueue=tokenQueue,
                               collectionProcessor=collectionProcessor,
                               tokenMetadataProcessor=tokenMetadataProcessor)

    await s3manager.connect()
    await tokenQueue.connect()
    await database.connect()
    if not startId:
        startId = 0
    if not endId:
        maxTokenMetadata = await retriever.list_token_metadatas(
            limit=1,
            orders=[
                Order(fieldName=TokenMetadatasTable.c.tokenMetadataId.key,
                      direction=Direction.DESCENDING)
            ])
        print(maxTokenMetadata)
        endId = maxTokenMetadata[0].tokenMetadataId + 1
    currentId = startId
    while currentId < endId:
        start = currentId
        end = min(currentId + batchSize, endId)
        query = TokenMetadatasTable.select()
        query = query.where(TokenMetadatasTable.c.tokenMetadataId >= start)
        query = query.where(TokenMetadatasTable.c.tokenMetadataId < end)
        query = query.where(
            TokenMetadatasTable.c.updatedDate < datetime.datetime(2022, 2, 13))
        query = query.order_by(TokenMetadatasTable.c.tokenMetadataId.asc())
        tokenMetadatasToChange = [
            token_metadata_from_row(row)
            for row in await database.execute(query=query)
        ]
        logging.info(f'Working on {start} - {end}')
        logging.info(f'Updating {len(tokenMetadatasToChange)} transfers...')
        await asyncio.gather(*[
            _reprocess_metadata_from_s3(
                tokenMetadataProcessor=tokenMetadataProcessor,
                s3manager=s3manager,
                tokenManger=tokenManger,
                tokenMetadata=tokenMetadata)
            for tokenMetadata in tokenMetadatasToChange
        ])
        currentId = currentId + batchSize

    await s3manager.disconnect()
    await tokenQueue.disconnect()
    await awsRequester.close_connections()
    await requester.close_connections()
    await database.disconnect()
Ejemplo n.º 10
0
async def reprocess_collections(startId: int, endId: int, batchSize: int):
    databaseConnectionString = Database.create_psql_connection_string(
        username=os.environ["DB_USERNAME"],
        password=os.environ["DB_PASSWORD"],
        host=os.environ["DB_HOST"],
        port=os.environ["DB_PORT"],
        name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database)
    retriever = Retriever(database)
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'],
                                accessKeySecret=os.environ['AWS_SECRET'])
    requester = Requester()
    # ethClient = RestEthClient(url=f'https://mainnet.infura.io/v3/{os.environ["INFURA_PROJECT_ID"]}', requester=requester)
    ethClient = RestEthClient(
        url=
        'https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com',
        requester=awsRequester)
    s3manager = S3Manager(region='eu-west-1',
                          accessKeyId=os.environ['AWS_KEY'],
                          accessKeySecret=os.environ['AWS_SECRET'])
    requester = Requester()
    collectionProcessor = CollectionProcessor(
        requester=requester,
        ethClient=ethClient,
        openseaApiKey=openseaApiKey,
        s3manager=s3manager,
        bucketName=os.environ['S3_BUCKET'])
    tokenManager = TokenManager(saver=saver,
                                retriever=retriever,
                                tokenQueue=None,
                                collectionProcessor=collectionProcessor,
                                tokenMetadataProcessor=None)

    await database.connect()
    await s3manager.connect()
    currentId = startId
    while currentId < endId:
        start = currentId
        end = min(currentId + batchSize, endId)
        logging.info(f'Working on {start} to {end}...')
        async with database.transaction():
            query = TokenCollectionsTable.select()
            query = query.where(TokenCollectionsTable.c.collectionId >= start)
            query = query.where(TokenCollectionsTable.c.collectionId < end)
            collectionsToChange = [
                collection_from_row(row)
                async for row in database.iterate(query=query)
            ]
            logging.info(f'Updating {len(collectionsToChange)} collections...')
            for collection in collectionsToChange:
                logging.info(f'Updating collection: {collection.address}')
                try:
                    await tokenManager.update_collection(
                        address=collection.address, shouldForce=True)
                except Exception as e:
                    logging.exception(
                        f'Error processing {collection.collectionId}: {e}')
        currentId = currentId + batchSize

    await database.disconnect()
    await s3manager.disconnect()
    await requester.close_connections()
    await awsRequester.close_connections()
Ejemplo n.º 11
0
async def main():
    requestIdHolder = RequestIdHolder()
    name = os.environ.get('NAME', 'mdtp-worker')
    version = os.environ.get('VERSION', 'local')
    environment = os.environ.get('ENV', 'dev')
    isRunningDebugMode = environment == 'dev'

    if isRunningDebugMode:
        logging.init_basic_logging()
    else:
        logging.init_json_logging(name=name,
                                  version=version,
                                  environment=environment,
                                  requestIdHolder=requestIdHolder)

    databaseConnectionString = Database.create_psql_connection_string(
        username=os.environ["DB_USERNAME"],
        password=os.environ["DB_PASSWORD"],
        host=os.environ["DB_HOST"],
        port=os.environ["DB_PORT"],
        name=os.environ["DB_NAME"])
    database = Database(connectionString=databaseConnectionString)
    saver = Saver(database=database)
    retriever = Retriever(database=database)

    workQueue = SqsMessageQueue(
        region='eu-west-1',
        accessKeyId=os.environ['AWS_KEY'],
        accessKeySecret=os.environ['AWS_SECRET'],
        queueUrl=
        'https://sqs.eu-west-1.amazonaws.com/097520841056/mdtp-work-queue')
    s3Manager = S3Manager(region='eu-west-1',
                          accessKeyId=os.environ['AWS_KEY'],
                          accessKeySecret=os.environ['AWS_SECRET'])

    # NOTE(krishan711): The AWS eth instance is much slower with getLogs so fails when calling ContractStore.get_latest_update_block_number
    # awsRequester = AwsRequester(accessKeyId=os.environ['AWS_KEY'], accessKeySecret=os.environ['AWS_SECRET'])
    # ethClient = RestEthClient(url='https://nd-foldvvlb25awde7kbqfvpgvrrm.ethereum.managedblockchain.eu-west-1.amazonaws.com', requester=awsRequester)
    requester = Requester()
    ethClient = RestEthClient(url=os.environ['ALCHEMY_MAINNET_URL'],
                              requester=requester)
    rinkebyEthClient = RestEthClient(url=os.environ['ALCHEMY_URL'],
                                     requester=requester)
    mumbaiEthClient = RestEthClient(
        url='https://matic-mumbai.chainstacklabs.com', requester=requester)
    contractStore = create_contract_store(ethClient=ethClient,
                                          rinkebyEthClient=rinkebyEthClient,
                                          mumbaiEthClient=mumbaiEthClient)

    infuraIpfsAuth = BasicAuthentication(
        username=os.environ['INFURA_IPFS_PROJECT_ID'],
        password=os.environ['INFURA_IPFS_PROJECT_SECRET'])
    infuraIpfsRequester = Requester(
        headers={'authorization': f'Basic {infuraIpfsAuth.to_string()}'})
    ipfsManager = IpfsManager(requester=infuraIpfsRequester)

    imageManager = ImageManager(requester=requester,
                                s3Manager=s3Manager,
                                ipfsManager=ipfsManager)
    manager = MdtpManager(requester=requester,
                          retriever=retriever,
                          saver=saver,
                          s3Manager=s3Manager,
                          contractStore=contractStore,
                          workQueue=workQueue,
                          imageManager=imageManager,
                          ipfsManager=ipfsManager)

    processor = MdtpMessageProcessor(manager=manager)
    slackClient = SlackClient(webhookUrl=os.environ['SLACK_WEBHOOK_URL'],
                              requester=requester,
                              defaultSender='worker',
                              defaultChannel='mdtp-notifications')
    messageQueueProcessor = MessageQueueProcessor(queue=workQueue,
                                                  messageProcessor=processor,
                                                  slackClient=slackClient)

    await database.connect()
    await s3Manager.connect()
    await workQueue.connect()
    await messageQueueProcessor.run()

    await requester.close_connections()
    await workQueue.disconnect()
    await s3Manager.disconnect()
    await database.disconnect()
Ejemplo n.º 12
0
async def main():
    s3Client = boto3.client(service_name='s3',
                            region_name='eu-west-1',
                            aws_access_key_id=os.environ['AWS_KEY'],
                            aws_secret_access_key=os.environ['AWS_SECRET'])
    s3manager = S3Manager(s3Client=s3Client)
    requester = Requester()
    ethClient = RestEthClient(
        url=f'https://mainnet.infura.io/v3/{os.environ["INFURA_PROJECT_ID"]}',
        requester=requester)
    requester = Requester()
    openseaApiKey = os.environ['OPENSEA_API_KEY']
    collectionProcessor = CollectionProcessor(
        requester=requester,
        ethClient=ethClient,
        s3manager=s3manager,
        openseaApiKey=openseaApiKey,
        bucketName=os.environ['S3_BUCKET'])

    #HAs No contractURI
    result = await collectionProcessor.retrieve_collection(
        '0xE3f92992BB4F0f0D173623A52b2922d65172601d')
    expected = RetrievedCollection(
        address='0xE3f92992BB4F0f0D173623A52b2922d65172601d',
        name='Knights of Degen',
        symbol='KNIGHTS',
        description=
        '8,888 NFT Degens who love sports, betting, alpha and nfts ⚔️',
        imageUrl=
        'https://lh3.googleusercontent.com/yxdb_995UrIS6W9YIHMfMCRsdYRqcITlBvO5w7OoUx35rkClUeq9rPCvTMXdtw_zION07O_qRZSuNfZu6R6o8bI_KmbrfThhFtA4SBc=s120',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='knights-of-degen-official',
        url='https://www.knightsofdegen.io/',
        discordUrl='https://discord.gg/knightsofdegen',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/328JHSQ2nPpzfTxpZjV5xiiBp6R17GgUdjHJ7BF0mU-SH0Ou1LiiYmcET0WeHt26LD4tVXenIvYZD7VC8jV__bqRCiA_CzmWfwg7=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False)
    assert (result == expected)

    result = await collectionProcessor.retrieve_collection(
        '0xd153f0014db6d1F339c6340d2C9F59214355D9d7')
    expected = RetrievedCollection(
        address='0xd153f0014db6d1F339c6340d2C9F59214355D9d7',
        name='Crypto Hobos',
        symbol='CryptoHobos',
        description=
        'Crypto Hobos Pet Partners: https://opensea.io/collection/crypto-hobos-pet-partners\n\nThe first generative NFT project to be painted by hand, Crypto Hobos fuses the fine art and profile picture genres of the NFT space.\nArtist Valiahmed Popov has destroyed the source paintings of the over 200 traits that comprise the project, and so the 8000 original Crypto Hobos now exist solely on the Ethereum blockchain in the form of ERC-721 tokens.',
        imageUrl=
        'https://lh3.googleusercontent.com/VLkOkaJ9QuVwHahQqHUrI5ZDVEqNBLCK_xEnMv4rBZ7kciwtlj_klhcwmvi5mM77hn5uSS10uVZH_9uNjkwpshppFhmNFc3a-r3YMuI=s120',
        twitterUsername='******',
        instagramUsername='******',
        wikiUrl=None,
        openseaSlug='crypto-hobos',
        url='https://cryptohobos.io/',
        discordUrl='https://discord.gg/uFpbRYxMeA',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/kiqCwFkf5RWIl_jiJJ5hiElKTV4UYXlcATldxYZ4zr0E2XHiaDOwixPGLs-Led2DFBgQx26dd3AmhON914jllitPE0zZu2dYWF4w=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False)
    assert (result == expected)

    #Has ContractURI
    result = await collectionProcessor.retrieve_collection(
        '0x3E3bF91740a8363D9433c8d3535B9b3C9E55f669')
    expected = RetrievedCollection(
        address='0x3E3bF91740a8363D9433c8d3535B9b3C9E55f669',
        name='Civit Illustrations',
        symbol='CIV20',
        description='Series of digital illustrations and animations',
        imageUrl='QmXKBRxpTFdRsqLDRUxXNoTJRChwcEQAqQVF8LXKaXmMTf',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='civit-illustrations',
        url=
        'https://app.rarible.com/collection/0x3e3bf91740a8363d9433c8d3535b9b3c9e55f669',
        discordUrl='https://discord.gg/CIVIT',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/zJOeUEKzl2Rs2JiGOxlZQR5WUru-6I-a8n_sp22USaBVxt0LxeYTe-xSfQhjIK8N6u1SyRaEfRWnyp9j-nDpPfeJWxNgSeDwziAI6Q=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False)
    assert (result == expected)

    result = await collectionProcessor.retrieve_collection(
        '0xDb68Df0e86Bc7C6176E6a2255a5365f51113BCe8')
    expected = RetrievedCollection(
        address='0xDb68Df0e86Bc7C6176E6a2255a5365f51113BCe8',
        name='Rope Makers United',
        symbol='RMU',
        description='Rope Makers United Storefront',
        imageUrl='https://rope.lol/images/RopeLogo3D.gif',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='rope-makers-united',
        url='https://rope.lol',
        discordUrl='https://discord.gg/kWE5G2',
        bannerImageUrl=None,
        doesSupportErc721=False,
        doesSupportErc1155=True)
    assert (result == expected)

    # Has no Name or Symbol
    result = await collectionProcessor.retrieve_collection(
        '0x12F01AF7FBEAFB088E1d3384BFf67390f41E8404')
    expected = RetrievedCollection(
        address='0x12F01AF7FBEAFB088E1d3384BFf67390f41E8404',
        name='FVCK_BAEIGE//',
        symbol=None,
        description='Collaborative contract between Baeige and Fvckrender',
        imageUrl=
        'https://lh3.googleusercontent.com/BJECOBeDJqpaVLWgxza8DYaP9SQGq6h7kLFsOUAlTk3G7naycl4GsjjALsnCPayhHTlctEkvChvpxhGWfDh0hiH2-xd9eUU_yBqmYQ=s120',
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='unidentified-contract-b46angemew',
        url=None,
        discordUrl=None,
        bannerImageUrl=
        'https://lh3.googleusercontent.com/BJECOBeDJqpaVLWgxza8DYaP9SQGq6h7kLFsOUAlTk3G7naycl4GsjjALsnCPayhHTlctEkvChvpxhGWfDh0hiH2-xd9eUU_yBqmYQ=s2500',
        doesSupportErc721=False,
        doesSupportErc1155=True)
    assert (result == expected)

    result = await collectionProcessor.retrieve_collection(
        '0x236E7Af5FcAb94770E621c97a1E58b4d0143E95B')
    expected = RetrievedCollection(
        address='0x236E7Af5FcAb94770E621c97a1E58b4d0143E95B',
        name="Ethernity's Master Collection",
        symbol=None,
        description=
        "Ethernity's Master Collection of Exclusive NFTs on Opensea.",
        imageUrl=
        'https://lh3.googleusercontent.com/GId53RudYB4l7e6Irj3_5JGyC3bwybdotwXAEgGaq4KCqjtfQChbolTQSJRYzb1bYrHM_G9xH4Il9vh_CM3ZPtMTwSgtkU5Wu7RVVQ=s120',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='ethernity-master',
        url='http://ethernity.io',
        discordUrl='https://discord.gg/EthernityChain',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/xWwplVCKh2mIkbsHObxlVWPkW-kT0vlptGihpjaqyU4zTvAD90BwkcnTe25sPQuNlreb3cfT_LgRlYiuqLVJD0YYYWipq1s42A0T=s2500',
        doesSupportErc721=False,
        doesSupportErc1155=True)
    assert (result == expected)

    #dynamic contractURI
    result = await collectionProcessor.retrieve_collection(
        '0x700CE4AB68aD109224Be3aC85f5A99213bf04f67')
    expected = RetrievedCollection(
        address='0x700CE4AB68aD109224Be3aC85f5A99213bf04f67',
        name='Microdoses',
        symbol='DOSES',
        description=
        'Smaller graphics and topical comics from Killer Acid, in small editions. ',
        imageUrl='ipfs://ipfs/QmQ52XALRGEfRKCjDryeqXkq5nnSnDuRaiGaLwhs3R77Dz',
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='microdoses',
        url=
        'https://app.rarible.com/collection/0x700ce4ab68ad109224be3ac85f5a99213bf04f67',
        discordUrl=None,
        bannerImageUrl=None,
        doesSupportErc721=False,
        doesSupportErc1155=True)

    result = await collectionProcessor.retrieve_collection(
        '0x48531836e57bc28d6fee33840f43826b889aa2fc')
    expected = RetrievedCollection(
        address='0x48531836e57bc28d6fee33840f43826b889aa2fc',
        name='Super Crypto Man',
        symbol='PIPPI',
        description=
        'New generation of Japanese sticker culture × NFT.Making 3D Collective NFT with Cryptoworld as a theme. ',
        imageUrl='ipfs://ipfs/QmUvzee6ZvY41S5W842fm8wiFr8ueqQSDimfLQhHyp76Tk',
        twitterUsername='******',
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='super-crypto-man',
        url=
        'https://app.rarible.com/collection/0x48531836e57bc28d6fee33840f43826b889aa2fc',
        discordUrl=None,
        bannerImageUrl=
        'https://lh3.googleusercontent.com/TvePJaCzrlt4m-kNSiD0HUkryq5wTYlU0vkugYC9F0CBhThEO2PGCN0m6BRawoNDF2RWNn3E0AixFsSefikyr-5tmWIZkLHoPmxQ-w=s2500',
        doesSupportErc721=False,
        doesSupportErc1155=True)

    result = await collectionProcessor.retrieve_collection(
        '0xDD97c0b7ED3DC93d09A681dE0E7228b5dfEAE463')
    expected = RetrievedCollection(
        address='0xDD97c0b7ED3DC93d09A681dE0E7228b5dfEAE463',
        name='Beanterra',
        symbol='BEANEL',
        description=
        'Beanels of Beanterra - Diverse and lovable creatures that roam the realm filled with lush landscapes, snow-capped mountains, and deep blue oceans.',
        imageUrl=
        'https://lh3.googleusercontent.com/ZT-Zq2CWSG0mBzzeeTCsAdMFVyu3au6sPyN_v3CVYXguuI19EL0JrB9QVgg-3tFMJxvg2FJbtpjM8iz5n77tC_gg4t37y-9UP7dQmmA=s120',
        twitterUsername=None,
        instagramUsername=None,
        wikiUrl=None,
        openseaSlug='beanterra',
        url='https://beanterra.io/',
        discordUrl='https://discord.gg/beanterra',
        bannerImageUrl=
        'https://lh3.googleusercontent.com/tBVqF5do5ZpKVqqM6qgcyU44u_Utin0JAH_ygwaqVXMDq3KtsfxG10xXtYliGz6rhjEfngx4eb8LA8IcHn7U2oH_5WlRt9JIUZea7Oc=s2500',
        doesSupportErc721=True,
        doesSupportErc1155=False)