From 6f88786e940941975ab130610b8cae57bc4f9e9e Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio Date: Thu, 4 Apr 2024 17:00:36 -0300 Subject: [PATCH] feat: Add new rarity --- README.md | 18 +- schema.graphql | 1 + src/entities/Marketplace/CollectionStore.ts | 601 -------------------- subgraph.template.yaml | 6 +- 4 files changed, 13 insertions(+), 613 deletions(-) delete mode 100644 src/entities/Marketplace/CollectionStore.ts diff --git a/README.md b/README.md index e9d2844..9d0bdb4 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,19 @@ | Network | Provider | URL | Current | Previous | | ---------- | --------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| Mainnet | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-mainnet/playground | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA |QmcyYqqmE3egvtZReHk1aVxmZawxRSECuj1PcZLgMVzHSp | -| Mainnet | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-ethereum-mainnet | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA |QmP2EQebbD9W8AaphRTzNUL7NLdMH8FdqNNWtqUiNg2VkB | +| Mainnet | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-mainnet/playground | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA | QmcyYqqmE3egvtZReHk1aVxmZawxRSECuj1PcZLgMVzHSp | +| Mainnet | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-ethereum-mainnet | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA | QmP2EQebbD9W8AaphRTzNUL7NLdMH8FdqNNWtqUiNg2VkB | | Sepolia | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-sepolia/playground | QmSYyRTthY69mSHxkAY6ym3beCWQr97NwecWdpxjiHypKh | QmWQZiMSV5AnUPN34NFmAYtxGntxewMUUwuS9r5vBpc5Ys | | Sepolia | Graph Studio | https://api.studio.thegraph.com/query/49472/collections-ethereum-sepolia/version/latest | QmSYyRTthY69mSHxkAY6ym3beCWQr97NwecWdpxjiHypKh | QmWQZiMSV5AnUPN34NFmAYtxGntxewMUUwuS9r5vBpc5Ys | | Goerli | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-goerli/playground | QmZXxk89ZunJvXNsckSioadZNQW7VBydrGfXTqS2ivzHqU | QmUvtxgRKdFf1zcZZLrJ5nZ6HyoUYKPtByGQigP4rHxwSj | | Goerli | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-ethereum-goerli | QmZXxk89ZunJvXNsckSioadZNQW7VBydrGfXTqS2ivzHqU | QmUvtxgRKdFf1zcZZLrJ5nZ6HyoUYKPtByGQigP4rHxwSj | | Matic | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mainnet/playground | QmPAV5PzFgu7iaiSYYmRTPGFR4ADGfeKSTPqTPt5eKVAVv | QmdavX3eGWLYCjjzYAZv924hyoLv8f9Rg6FxHD7kAJ4fXn | -| Matic | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet | QmPAV5PzFgu7iaiSYYmRTPGFR4ADGfeKSTPqTPt5eKVAVv |QmXEwSeNTT5xHRQPcTUDQJayjjfhcbaxYf2o7ycuYf8YF7 | -| Matic Temp | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet-temp | QmTKztw187jUHZ33S2pndtyo68K462XwewcvMVAVH7mwZR |Qmf3igvJs24gozdwCwnDyPNz9DEBQMPQRFmEhUzEvgxZSq | -| Mumbai | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mumbai/playground | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai | QmRpCReFLwhB4tATJhur1MEjsPY1Rgo2yVrd5oinnjCrAy | -| Mumbai | Hosted Service | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mumbai | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai | QmegTREYw1Li3DYMAcCVJDcoBuquoCFKDUCzxrxyGhWwUW | +| Matic | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet | QmPAV5PzFgu7iaiSYYmRTPGFR4ADGfeKSTPqTPt5eKVAVv | QmXEwSeNTT5xHRQPcTUDQJayjjfhcbaxYf2o7ycuYf8YF7 | +| Matic Temp | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet-temp | QmTKztw187jUHZ33S2pndtyo68K462XwewcvMVAVH7mwZR | Qmf3igvJs24gozdwCwnDyPNz9DEBQMPQRFmEhUzEvgxZSq | +| Mumbai | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mumbai/playground | QmdqoM3jpJWWbK1EMTZcSE5WJgiUaoSpKcSLeQRHhqQSea | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai | +| Mumbai | Hosted Service | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mumbai | QmdqoM3jpJWWbK1EMTZcSE5WJgiUaoSpKcSLeQRHhqQSea | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai | -Using [The Graph](https://thegraph.com) and [Satsuma](https://www.satsuma.xyz/) +Using [The Graph](https://thegraph.com) and [Alchemy](https://www.alchemy.com/) ### Install @@ -30,9 +30,9 @@ Tests are defined inside the `./tests` directory and executed using: npm test ``` -> **Take into consideration:** +> **Take into consideration:** > ->`Postgres 14` is required to run tests locally because `graph-node`, the underlying engine to index the subgraph, needs it. +> `Postgres 14` is required to run tests locally because `graph-node`, the underlying engine to index the subgraph, needs it. An alternative to run tests locally without installing Postgres is through `Docker. To run them, use the following command: diff --git a/schema.graphql b/schema.graphql index 8524e50..77fc329 100644 --- a/schema.graphql +++ b/schema.graphql @@ -216,6 +216,7 @@ enum WearableRarity @entity { legendary mythic unique + exotic } enum WearableBodyShape @entity { diff --git a/src/entities/Marketplace/CollectionStore.ts b/src/entities/Marketplace/CollectionStore.ts deleted file mode 100644 index 4bd8e80..0000000 --- a/src/entities/Marketplace/CollectionStore.ts +++ /dev/null @@ -1,601 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class Bought extends ethereum.Event { - get params(): Bought__Params { - return new Bought__Params(this); - } -} - -export class Bought__Params { - _event: Bought; - - constructor(event: Bought) { - this._event = event; - } - - get _itemsToBuy(): Array { - return this._event.parameters[0].value.toTupleArray< - Bought_itemsToBuyStruct - >(); - } -} - -export class Bought_itemsToBuyStruct extends ethereum.Tuple { - get collection(): Address { - return this[0].toAddress(); - } - - get ids(): Array { - return this[1].toBigIntArray(); - } - - get prices(): Array { - return this[2].toBigIntArray(); - } - - get beneficiaries(): Array
{ - return this[3].toAddressArray(); - } -} - -export class MetaTransactionExecuted extends ethereum.Event { - get params(): MetaTransactionExecuted__Params { - return new MetaTransactionExecuted__Params(this); - } -} - -export class MetaTransactionExecuted__Params { - _event: MetaTransactionExecuted; - - constructor(event: MetaTransactionExecuted) { - this._event = event; - } - - get userAddress(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get relayerAddress(): Address { - return this._event.parameters[1].value.toAddress(); - } - - get functionSignature(): Bytes { - return this._event.parameters[2].value.toBytes(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class SetFee extends ethereum.Event { - get params(): SetFee__Params { - return new SetFee__Params(this); - } -} - -export class SetFee__Params { - _event: SetFee; - - constructor(event: SetFee) { - this._event = event; - } - - get _oldFee(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get _newFee(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } -} - -export class SetFeeOwner extends ethereum.Event { - get params(): SetFeeOwner__Params { - return new SetFeeOwner__Params(this); - } -} - -export class SetFeeOwner__Params { - _event: SetFeeOwner; - - constructor(event: SetFeeOwner) { - this._event = event; - } - - get _oldFeeOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get _newFeeOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class CollectionStore__getItemBuyDataResult { - value0: BigInt; - value1: Address; - - constructor(value0: BigInt, value1: Address) { - this.value0 = value0; - this.value1 = value1; - } - - toMap(): TypedMap { - let map = new TypedMap(); - map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); - map.set("value1", ethereum.Value.fromAddress(this.value1)); - return map; - } -} - -export class CollectionStore extends ethereum.SmartContract { - static bind(address: Address): CollectionStore { - return new CollectionStore("CollectionStore", address); - } - - BASE_FEE(): BigInt { - let result = super.call("BASE_FEE", "BASE_FEE():(uint256)", []); - - return result[0].toBigInt(); - } - - try_BASE_FEE(): ethereum.CallResult { - let result = super.tryCall("BASE_FEE", "BASE_FEE():(uint256)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - acceptedToken(): Address { - let result = super.call("acceptedToken", "acceptedToken():(address)", []); - - return result[0].toAddress(); - } - - try_acceptedToken(): ethereum.CallResult
{ - let result = super.tryCall( - "acceptedToken", - "acceptedToken():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - domainSeparator(): Bytes { - let result = super.call( - "domainSeparator", - "domainSeparator():(bytes32)", - [] - ); - - return result[0].toBytes(); - } - - try_domainSeparator(): ethereum.CallResult { - let result = super.tryCall( - "domainSeparator", - "domainSeparator():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } - - fee(): BigInt { - let result = super.call("fee", "fee():(uint256)", []); - - return result[0].toBigInt(); - } - - try_fee(): ethereum.CallResult { - let result = super.tryCall("fee", "fee():(uint256)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - feeOwner(): Address { - let result = super.call("feeOwner", "feeOwner():(address)", []); - - return result[0].toAddress(); - } - - try_feeOwner(): ethereum.CallResult
{ - let result = super.tryCall("feeOwner", "feeOwner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getChainId(): BigInt { - let result = super.call("getChainId", "getChainId():(uint256)", []); - - return result[0].toBigInt(); - } - - try_getChainId(): ethereum.CallResult { - let result = super.tryCall("getChainId", "getChainId():(uint256)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - getItemBuyData( - _collection: Address, - _itemId: BigInt - ): CollectionStore__getItemBuyDataResult { - let result = super.call( - "getItemBuyData", - "getItemBuyData(address,uint256):(uint256,address)", - [ - ethereum.Value.fromAddress(_collection), - ethereum.Value.fromUnsignedBigInt(_itemId) - ] - ); - - return new CollectionStore__getItemBuyDataResult( - result[0].toBigInt(), - result[1].toAddress() - ); - } - - try_getItemBuyData( - _collection: Address, - _itemId: BigInt - ): ethereum.CallResult { - let result = super.tryCall( - "getItemBuyData", - "getItemBuyData(address,uint256):(uint256,address)", - [ - ethereum.Value.fromAddress(_collection), - ethereum.Value.fromUnsignedBigInt(_itemId) - ] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue( - new CollectionStore__getItemBuyDataResult( - value[0].toBigInt(), - value[1].toAddress() - ) - ); - } - - getNonce(user: Address): BigInt { - let result = super.call("getNonce", "getNonce(address):(uint256)", [ - ethereum.Value.fromAddress(user) - ]); - - return result[0].toBigInt(); - } - - try_getNonce(user: Address): ethereum.CallResult { - let result = super.tryCall("getNonce", "getNonce(address):(uint256)", [ - ethereum.Value.fromAddress(user) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } -} - -export class ConstructorCall extends ethereum.Call { - get inputs(): ConstructorCall__Inputs { - return new ConstructorCall__Inputs(this); - } - - get outputs(): ConstructorCall__Outputs { - return new ConstructorCall__Outputs(this); - } -} - -export class ConstructorCall__Inputs { - _call: ConstructorCall; - - constructor(call: ConstructorCall) { - this._call = call; - } - - get _owner(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _acceptedToken(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _feeOwner(): Address { - return this._call.inputValues[2].value.toAddress(); - } - - get _fee(): BigInt { - return this._call.inputValues[3].value.toBigInt(); - } -} - -export class ConstructorCall__Outputs { - _call: ConstructorCall; - - constructor(call: ConstructorCall) { - this._call = call; - } -} - -export class BuyCall extends ethereum.Call { - get inputs(): BuyCall__Inputs { - return new BuyCall__Inputs(this); - } - - get outputs(): BuyCall__Outputs { - return new BuyCall__Outputs(this); - } -} - -export class BuyCall__Inputs { - _call: BuyCall; - - constructor(call: BuyCall) { - this._call = call; - } - - get _itemsToBuy(): Array { - return this._call.inputValues[0].value.toTupleArray< - BuyCall_itemsToBuyStruct - >(); - } -} - -export class BuyCall__Outputs { - _call: BuyCall; - - constructor(call: BuyCall) { - this._call = call; - } -} - -export class BuyCall_itemsToBuyStruct extends ethereum.Tuple { - get collection(): Address { - return this[0].toAddress(); - } - - get ids(): Array { - return this[1].toBigIntArray(); - } - - get prices(): Array { - return this[2].toBigIntArray(); - } - - get beneficiaries(): Array
{ - return this[3].toAddressArray(); - } -} - -export class ExecuteMetaTransactionCall extends ethereum.Call { - get inputs(): ExecuteMetaTransactionCall__Inputs { - return new ExecuteMetaTransactionCall__Inputs(this); - } - - get outputs(): ExecuteMetaTransactionCall__Outputs { - return new ExecuteMetaTransactionCall__Outputs(this); - } -} - -export class ExecuteMetaTransactionCall__Inputs { - _call: ExecuteMetaTransactionCall; - - constructor(call: ExecuteMetaTransactionCall) { - this._call = call; - } - - get userAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get functionSignature(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } - - get sigR(): Bytes { - return this._call.inputValues[2].value.toBytes(); - } - - get sigS(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } - - get sigV(): i32 { - return this._call.inputValues[4].value.toI32(); - } -} - -export class ExecuteMetaTransactionCall__Outputs { - _call: ExecuteMetaTransactionCall; - - constructor(call: ExecuteMetaTransactionCall) { - this._call = call; - } - - get value0(): Bytes { - return this._call.outputValues[0].value.toBytes(); - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SetFeeCall extends ethereum.Call { - get inputs(): SetFeeCall__Inputs { - return new SetFeeCall__Inputs(this); - } - - get outputs(): SetFeeCall__Outputs { - return new SetFeeCall__Outputs(this); - } -} - -export class SetFeeCall__Inputs { - _call: SetFeeCall; - - constructor(call: SetFeeCall) { - this._call = call; - } - - get _newFee(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } -} - -export class SetFeeCall__Outputs { - _call: SetFeeCall; - - constructor(call: SetFeeCall) { - this._call = call; - } -} - -export class SetFeeOwnerCall extends ethereum.Call { - get inputs(): SetFeeOwnerCall__Inputs { - return new SetFeeOwnerCall__Inputs(this); - } - - get outputs(): SetFeeOwnerCall__Outputs { - return new SetFeeOwnerCall__Outputs(this); - } -} - -export class SetFeeOwnerCall__Inputs { - _call: SetFeeOwnerCall; - - constructor(call: SetFeeOwnerCall) { - this._call = call; - } - - get _newFeeOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetFeeOwnerCall__Outputs { - _call: SetFeeOwnerCall; - - constructor(call: SetFeeOwnerCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 48844db..e24afbc 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -1,10 +1,10 @@ -specVersion: 0.0.2 +specVersion: 0.0.4 description: Decentraland collections # features: # - grafting # graft: -# base: QmY4hQRkXCtKRGP3aCYn4ES8kv1MmeHfov5gSK4EvTbzwz # Subgraph ID of base subgraph -# block: 37597980 # Block number +# base: QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai # Subgraph ID of base subgraph +# block: 47827000 # Block number repository: https://github.com/decentraland/collections-graph schema: file: ./schema.graphql