From 3b6e0b23a1b309fb1e2446eae73587179c62ba06 Mon Sep 17 00:00:00 2001 From: Juan Cazala Date: Wed, 18 Sep 2024 13:34:00 -0300 Subject: [PATCH 1/2] fix: erc721 abi --- subgraph.template.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subgraph.template.yaml b/subgraph.template.yaml index e24afbc..b4dddc7 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -90,6 +90,8 @@ dataSources: abis: - name: Marketplace file: ./abis/Marketplace.json + - name: ERC721 + file: ./abis/ERC721.json eventHandlers: - event: OrderCreated(bytes32,indexed uint256,indexed address,address,uint256,uint256) handler: handleOrderCreated @@ -118,6 +120,8 @@ dataSources: abis: - name: MarketplaceV2 file: ./abis/MarketplaceV2.json + - name: ERC721 + file: ./abis/ERC721.json eventHandlers: - event: OrderCreated(bytes32,indexed uint256,indexed address,address,uint256,uint256) handler: handleOrderCreated @@ -145,6 +149,8 @@ dataSources: abis: - name: ERC721Bid file: ./abis/ERC721Bid.json + - name: ERC721 + file: ./abis/ERC721.json eventHandlers: - event: BidCreated(bytes32,indexed address,indexed uint256,indexed address,uint256,uint256,bytes) handler: handleBidCreated @@ -172,6 +178,8 @@ dataSources: abis: - name: ERC721BidV2 file: ./abis/ERC721BidV2.json + - name: ERC721 + file: ./abis/ERC721.json eventHandlers: - event: BidCreated(bytes32,indexed address,indexed uint256,indexed address,uint256,uint256,bytes) handler: handleBidCreated @@ -359,6 +367,8 @@ templates: file: ./abis/CollectionStore.json - name: RaritiesWithOracle file: ./abis/RaritiesWithOracle.json + - name: ERC721 + file: ./abis/ERC721.json eventHandlers: - event: SetGlobalMinter(indexed address,bool) handler: handleSetGlobalMinter From 32dc4ba35dcb6b2bb9951f188d341f70a1ff8b3d Mon Sep 17 00:00:00 2001 From: Juan Cazala Date: Wed, 18 Sep 2024 16:33:40 -0300 Subject: [PATCH 2/2] chore: rebuild --- src/entities/ERC721Bid/ERC721.ts | 246 ++++++++++++++++++ src/entities/ERC721BidV2/ERC721.ts | 246 ++++++++++++++++++ src/entities/Marketplace/ERC721.ts | 246 ++++++++++++++++++ src/entities/MarketplaceV2/ERC721.ts | 246 ++++++++++++++++++ src/entities/templates/CollectionV2/ERC721.ts | 246 ++++++++++++++++++ 5 files changed, 1230 insertions(+) create mode 100644 src/entities/ERC721Bid/ERC721.ts create mode 100644 src/entities/ERC721BidV2/ERC721.ts create mode 100644 src/entities/Marketplace/ERC721.ts create mode 100644 src/entities/MarketplaceV2/ERC721.ts create mode 100644 src/entities/templates/CollectionV2/ERC721.ts diff --git a/src/entities/ERC721Bid/ERC721.ts b/src/entities/ERC721Bid/ERC721.ts new file mode 100644 index 0000000..a20d57c --- /dev/null +++ b/src/entities/ERC721Bid/ERC721.ts @@ -0,0 +1,246 @@ +// 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 Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } + + get operatorData(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class Transfer1 extends ethereum.Event { + get params(): Transfer1__Params { + return new Transfer1__Params(this); + } +} + +export class Transfer1__Params { + _event: Transfer1; + + constructor(event: Transfer1) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } +} + +export class Transfer2 extends ethereum.Event { + get params(): Transfer2__Params { + return new Transfer2__Params(this); + } +} + +export class Transfer2__Params { + _event: Transfer2; + + constructor(event: Transfer2) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Transfer3 extends ethereum.Event { + get params(): Transfer3__Params { + return new Transfer3__Params(this); + } +} + +export class Transfer3__Params { + _event: Transfer3; + + constructor(event: Transfer3) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +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 AddWearable extends ethereum.Event { + get params(): AddWearable__Params { + return new AddWearable__Params(this); + } +} + +export class AddWearable__Params { + _event: AddWearable; + + constructor(event: AddWearable) { + this._event = event; + } + + get _wearableIdKey(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _wearableId(): string { + return this._event.parameters[1].value.toString(); + } + + get _maxIssuance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class ERC721 extends ethereum.SmartContract { + static bind(address: Address): ERC721 { + return new ERC721("ERC721", address); + } + + ownerOf(_tokenId: BigInt): Address { + let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toAddress(); + } + + try_ownerOf(_tokenId: BigInt): ethereum.CallResult
{ + let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + tokenURI(_tokenId: BigInt): string { + let result = super.call("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toString(); + } + + try_tokenURI(_tokenId: BigInt): ethereum.CallResult { + let result = super.tryCall("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + balanceOf(_owner: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(_owner: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} diff --git a/src/entities/ERC721BidV2/ERC721.ts b/src/entities/ERC721BidV2/ERC721.ts new file mode 100644 index 0000000..a20d57c --- /dev/null +++ b/src/entities/ERC721BidV2/ERC721.ts @@ -0,0 +1,246 @@ +// 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 Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } + + get operatorData(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class Transfer1 extends ethereum.Event { + get params(): Transfer1__Params { + return new Transfer1__Params(this); + } +} + +export class Transfer1__Params { + _event: Transfer1; + + constructor(event: Transfer1) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } +} + +export class Transfer2 extends ethereum.Event { + get params(): Transfer2__Params { + return new Transfer2__Params(this); + } +} + +export class Transfer2__Params { + _event: Transfer2; + + constructor(event: Transfer2) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Transfer3 extends ethereum.Event { + get params(): Transfer3__Params { + return new Transfer3__Params(this); + } +} + +export class Transfer3__Params { + _event: Transfer3; + + constructor(event: Transfer3) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +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 AddWearable extends ethereum.Event { + get params(): AddWearable__Params { + return new AddWearable__Params(this); + } +} + +export class AddWearable__Params { + _event: AddWearable; + + constructor(event: AddWearable) { + this._event = event; + } + + get _wearableIdKey(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _wearableId(): string { + return this._event.parameters[1].value.toString(); + } + + get _maxIssuance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class ERC721 extends ethereum.SmartContract { + static bind(address: Address): ERC721 { + return new ERC721("ERC721", address); + } + + ownerOf(_tokenId: BigInt): Address { + let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toAddress(); + } + + try_ownerOf(_tokenId: BigInt): ethereum.CallResult
{ + let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + tokenURI(_tokenId: BigInt): string { + let result = super.call("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toString(); + } + + try_tokenURI(_tokenId: BigInt): ethereum.CallResult { + let result = super.tryCall("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + balanceOf(_owner: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(_owner: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} diff --git a/src/entities/Marketplace/ERC721.ts b/src/entities/Marketplace/ERC721.ts new file mode 100644 index 0000000..a20d57c --- /dev/null +++ b/src/entities/Marketplace/ERC721.ts @@ -0,0 +1,246 @@ +// 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 Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } + + get operatorData(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class Transfer1 extends ethereum.Event { + get params(): Transfer1__Params { + return new Transfer1__Params(this); + } +} + +export class Transfer1__Params { + _event: Transfer1; + + constructor(event: Transfer1) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } +} + +export class Transfer2 extends ethereum.Event { + get params(): Transfer2__Params { + return new Transfer2__Params(this); + } +} + +export class Transfer2__Params { + _event: Transfer2; + + constructor(event: Transfer2) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Transfer3 extends ethereum.Event { + get params(): Transfer3__Params { + return new Transfer3__Params(this); + } +} + +export class Transfer3__Params { + _event: Transfer3; + + constructor(event: Transfer3) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +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 AddWearable extends ethereum.Event { + get params(): AddWearable__Params { + return new AddWearable__Params(this); + } +} + +export class AddWearable__Params { + _event: AddWearable; + + constructor(event: AddWearable) { + this._event = event; + } + + get _wearableIdKey(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _wearableId(): string { + return this._event.parameters[1].value.toString(); + } + + get _maxIssuance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class ERC721 extends ethereum.SmartContract { + static bind(address: Address): ERC721 { + return new ERC721("ERC721", address); + } + + ownerOf(_tokenId: BigInt): Address { + let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toAddress(); + } + + try_ownerOf(_tokenId: BigInt): ethereum.CallResult
{ + let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + tokenURI(_tokenId: BigInt): string { + let result = super.call("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toString(); + } + + try_tokenURI(_tokenId: BigInt): ethereum.CallResult { + let result = super.tryCall("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + balanceOf(_owner: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(_owner: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} diff --git a/src/entities/MarketplaceV2/ERC721.ts b/src/entities/MarketplaceV2/ERC721.ts new file mode 100644 index 0000000..a20d57c --- /dev/null +++ b/src/entities/MarketplaceV2/ERC721.ts @@ -0,0 +1,246 @@ +// 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 Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } + + get operatorData(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class Transfer1 extends ethereum.Event { + get params(): Transfer1__Params { + return new Transfer1__Params(this); + } +} + +export class Transfer1__Params { + _event: Transfer1; + + constructor(event: Transfer1) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } +} + +export class Transfer2 extends ethereum.Event { + get params(): Transfer2__Params { + return new Transfer2__Params(this); + } +} + +export class Transfer2__Params { + _event: Transfer2; + + constructor(event: Transfer2) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Transfer3 extends ethereum.Event { + get params(): Transfer3__Params { + return new Transfer3__Params(this); + } +} + +export class Transfer3__Params { + _event: Transfer3; + + constructor(event: Transfer3) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +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 AddWearable extends ethereum.Event { + get params(): AddWearable__Params { + return new AddWearable__Params(this); + } +} + +export class AddWearable__Params { + _event: AddWearable; + + constructor(event: AddWearable) { + this._event = event; + } + + get _wearableIdKey(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _wearableId(): string { + return this._event.parameters[1].value.toString(); + } + + get _maxIssuance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class ERC721 extends ethereum.SmartContract { + static bind(address: Address): ERC721 { + return new ERC721("ERC721", address); + } + + ownerOf(_tokenId: BigInt): Address { + let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toAddress(); + } + + try_ownerOf(_tokenId: BigInt): ethereum.CallResult
{ + let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + tokenURI(_tokenId: BigInt): string { + let result = super.call("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toString(); + } + + try_tokenURI(_tokenId: BigInt): ethereum.CallResult { + let result = super.tryCall("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + balanceOf(_owner: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(_owner: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} diff --git a/src/entities/templates/CollectionV2/ERC721.ts b/src/entities/templates/CollectionV2/ERC721.ts new file mode 100644 index 0000000..a20d57c --- /dev/null +++ b/src/entities/templates/CollectionV2/ERC721.ts @@ -0,0 +1,246 @@ +// 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 Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } + + get operatorData(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class Transfer1 extends ethereum.Event { + get params(): Transfer1__Params { + return new Transfer1__Params(this); + } +} + +export class Transfer1__Params { + _event: Transfer1; + + constructor(event: Transfer1) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get operator(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get userData(): Bytes { + return this._event.parameters[4].value.toBytes(); + } +} + +export class Transfer2 extends ethereum.Event { + get params(): Transfer2__Params { + return new Transfer2__Params(this); + } +} + +export class Transfer2__Params { + _event: Transfer2; + + constructor(event: Transfer2) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Transfer3 extends ethereum.Event { + get params(): Transfer3__Params { + return new Transfer3__Params(this); + } +} + +export class Transfer3__Params { + _event: Transfer3; + + constructor(event: Transfer3) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +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 AddWearable extends ethereum.Event { + get params(): AddWearable__Params { + return new AddWearable__Params(this); + } +} + +export class AddWearable__Params { + _event: AddWearable; + + constructor(event: AddWearable) { + this._event = event; + } + + get _wearableIdKey(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _wearableId(): string { + return this._event.parameters[1].value.toString(); + } + + get _maxIssuance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class ERC721 extends ethereum.SmartContract { + static bind(address: Address): ERC721 { + return new ERC721("ERC721", address); + } + + ownerOf(_tokenId: BigInt): Address { + let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toAddress(); + } + + try_ownerOf(_tokenId: BigInt): ethereum.CallResult
{ + let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + tokenURI(_tokenId: BigInt): string { + let result = super.call("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + + return result[0].toString(); + } + + try_tokenURI(_tokenId: BigInt): ethereum.CallResult { + let result = super.tryCall("tokenURI", "tokenURI(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(_tokenId) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + balanceOf(_owner: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(_owner: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(_owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +}