From e9af49f9ab98863caa129e7ca1828e292d29b09a Mon Sep 17 00:00:00 2001 From: yuetloo Date: Tue, 1 Mar 2022 18:24:38 -0500 Subject: [PATCH] subgraph mapping for UniversalRecipientRegistry --- contracts/scripts/deployRecipientRegistry.ts | 67 ++ subgraph/abis/UniversalRecipientRegistry.json | 243 +++++++ subgraph/config/arbitrum-rinkeby.json | 3 +- subgraph/config/arbitrum.json | 3 +- subgraph/config/hardhat.json | 3 +- subgraph/config/rinkeby.json | 3 +- subgraph/config/xdai.json | 3 +- .../UniversalRecipientRegistry.ts | 638 ++++++++++++++++++ subgraph/generated/schema.ts | 17 + subgraph/subgraph.template.yaml | 24 + 10 files changed, 999 insertions(+), 5 deletions(-) create mode 100644 contracts/scripts/deployRecipientRegistry.ts create mode 100644 subgraph/abis/UniversalRecipientRegistry.json create mode 100644 subgraph/generated/UniversalRecipientRegistry/UniversalRecipientRegistry.ts diff --git a/contracts/scripts/deployRecipientRegistry.ts b/contracts/scripts/deployRecipientRegistry.ts new file mode 100644 index 000000000..233a480b8 --- /dev/null +++ b/contracts/scripts/deployRecipientRegistry.ts @@ -0,0 +1,67 @@ +import { ethers } from 'hardhat' +import { UNIT } from '../utils/constants' +import { RecipientRegistryFactory } from '../utils/recipient-registry-factory' + +/* + * Deploy a new recipient registry. + * The following environment variables must be set to run the script + * + * RECIPIENT_REGISTRY_TYPE - default is simple, values can be simple, optimistic, universal + * FUNDING_ROUND_FACTORY_ADDRESS - address of the funding round factory + * WALLET_PRIVATE_KEY - private key of the account that will fund this transaction + * JSONRPC_HTTP_URL - URL to connect to the node + * + * For example, to run the script on rinkeby network: + * From the contracts folder: + * npx hardhat run --network rinkeby scripts/deployRecipientRegistry.ts + * + */ +async function main() { + const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple' + const fundingRoundFactoryAddress = process.env.FUNDING_ROUND_FACTORY_ADDRESS + const challengePeriodDuration = process.env.CHALLENGE_PERIOD_IN_SECONDS || 300 + const baseDeposit = process.env.BASE_DEPOSIT || UNIT.div(10).toString() + + if (!fundingRoundFactoryAddress) { + console.log('Environment variable FUNDING_ROUND_FACTORY_ADDRESS not set') + return + } + const fundingRoundFactory = await ethers.getContractAt( + 'FundingRoundFactory', + fundingRoundFactoryAddress + ) + const factoryOwner = await fundingRoundFactory.owner() + + console.log('*******************') + console.log(`Deploying a new ${recipientRegistryType} recipient registry!`) + console.log(` challenge period in seconds: ${challengePeriodDuration}`) + console.log(` baseDeposit ${baseDeposit}`) + console.log(` fundingRoundFactoryAddress ${fundingRoundFactoryAddress}`) + console.log(` fundingRoundFactoryOwner ${factoryOwner}`) + const [deployer] = await ethers.getSigners() + + const recipientRegistry = await RecipientRegistryFactory.deploy( + recipientRegistryType, + { + controller: fundingRoundFactory.address, + baseDeposit, + challengePeriodDuration, + }, + deployer + ) + console.log(` recipientRegistry address: ${recipientRegistry.address}`) + + const setRecipientRegistryTx = await fundingRoundFactory.setRecipientRegistry( + recipientRegistry.address + ) + + await setRecipientRegistryTx.wait() + console.log('*******************') +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/subgraph/abis/UniversalRecipientRegistry.json b/subgraph/abis/UniversalRecipientRegistry.json new file mode 100644 index 000000000..45c70b38d --- /dev/null +++ b/subgraph/abis/UniversalRecipientRegistry.json @@ -0,0 +1,243 @@ +[ + { + "inputs": [ + { "internalType": "uint256", "name": "_baseDeposit", "type": "uint256" }, + { + "internalType": "uint256", + "name": "_challengePeriodDuration", + "type": "uint256" + }, + { "internalType": "address", "name": "_controller", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "_recipientId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "enum OptimisticRecipientRegistry.RequestType", + "name": "_type", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "bool", + "name": "_rejected", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_recipientIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "RequestResolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "_recipientId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "enum OptimisticRecipientRegistry.RequestType", + "name": "_type", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "_metadataId", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "RequestSubmitted", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "_recipient", "type": "address" }, + { "internalType": "string", "name": "_metadataId", "type": "string" } + ], + "name": "addRecipient", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "baseDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "challengePeriodDuration", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" }, + { + "internalType": "address payable", + "name": "_beneficiary", + "type": "address" + } + ], + "name": "challengeRequest", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "controller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" } + ], + "name": "executeRequest", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_index", "type": "uint256" }, + { "internalType": "uint256", "name": "_startTime", "type": "uint256" }, + { "internalType": "uint256", "name": "_endTime", "type": "uint256" } + ], + "name": "getRecipientAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRecipients", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" } + ], + "name": "removeRecipient", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_baseDeposit", "type": "uint256" } + ], + "name": "setBaseDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_challengePeriodDuration", + "type": "uint256" + } + ], + "name": "setChallengePeriodDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_maxRecipients", "type": "uint256" } + ], + "name": "setMaxRecipients", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraph/config/arbitrum-rinkeby.json b/subgraph/config/arbitrum-rinkeby.json index c8850d0b0..9e4c9c053 100644 --- a/subgraph/config/arbitrum-rinkeby.json +++ b/subgraph/config/arbitrum-rinkeby.json @@ -2,5 +2,6 @@ "network": "arbitrum-rinkeby", "address": "0xC032e80a413Be959d9a9B6e5CadE53c870074d37", "factoryStartBlock": 4806990, - "recipientRegistryStartBlock": 4806990 + "recipientRegistryStartBlock": 4806990, + "universalRecipientRegistryStartBlock": 4806990 } diff --git a/subgraph/config/arbitrum.json b/subgraph/config/arbitrum.json index 8f72d1d1f..973ecdf73 100644 --- a/subgraph/config/arbitrum.json +++ b/subgraph/config/arbitrum.json @@ -2,5 +2,6 @@ "network": "arbitrum-one", "address": "0x2e89494a8fE02891511a43f7877b726787E0C160", "factoryStartBlock": 3461582, - "recipientRegistryStartBlock": 3461582 + "recipientRegistryStartBlock": 3461582, + "universalRecipientRegistryStartBlock": 3461582 } diff --git a/subgraph/config/hardhat.json b/subgraph/config/hardhat.json index 308788d1d..bff76574a 100644 --- a/subgraph/config/hardhat.json +++ b/subgraph/config/hardhat.json @@ -2,5 +2,6 @@ "network": "hardhat", "address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", "factoryStartBlock": 0, - "recipientRegistryStartBlock": 0 + "recipientRegistryStartBlock": 0, + "universalRecipientRegistryStartBlock": 0 } diff --git a/subgraph/config/rinkeby.json b/subgraph/config/rinkeby.json index 434b744c9..b81deae58 100644 --- a/subgraph/config/rinkeby.json +++ b/subgraph/config/rinkeby.json @@ -2,5 +2,6 @@ "network": "rinkeby", "address": "0x93A990D939Ca592cD8cCa47b7a0c3F590A598F9d", "factoryStartBlock": 9969110, - "recipientRegistryStartBlock": 9969130 + "recipientRegistryStartBlock": 9969130, + "universalRecipientRegistryStartBlock": 10255005 } diff --git a/subgraph/config/xdai.json b/subgraph/config/xdai.json index 5021104c0..71f02009d 100644 --- a/subgraph/config/xdai.json +++ b/subgraph/config/xdai.json @@ -2,5 +2,6 @@ "network": "xdai", "address": "0x549F91A93c94358C5f5380D7ABF23E1340CfF2db", "factoryStartBlock": 15217676, - "recipientRegistryStartBlock": 0 + "recipientRegistryStartBlock": 0, + "universalRecipientRegistryStartBlock": 15217676 } diff --git a/subgraph/generated/UniversalRecipientRegistry/UniversalRecipientRegistry.ts b/subgraph/generated/UniversalRecipientRegistry/UniversalRecipientRegistry.ts new file mode 100644 index 000000000..fd3246a96 --- /dev/null +++ b/subgraph/generated/UniversalRecipientRegistry/UniversalRecipientRegistry.ts @@ -0,0 +1,638 @@ +// 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 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 RequestResolved extends ethereum.Event { + get params(): RequestResolved__Params { + return new RequestResolved__Params(this); + } +} + +export class RequestResolved__Params { + _event: RequestResolved; + + constructor(event: RequestResolved) { + this._event = event; + } + + get _recipientId(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _type(): i32 { + return this._event.parameters[1].value.toI32(); + } + + get _rejected(): boolean { + return this._event.parameters[2].value.toBoolean(); + } + + get _recipientIndex(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get _timestamp(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } +} + +export class RequestSubmitted extends ethereum.Event { + get params(): RequestSubmitted__Params { + return new RequestSubmitted__Params(this); + } +} + +export class RequestSubmitted__Params { + _event: RequestSubmitted; + + constructor(event: RequestSubmitted) { + this._event = event; + } + + get _recipientId(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get _type(): i32 { + return this._event.parameters[1].value.toI32(); + } + + get _recipient(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get _metadataId(): string { + return this._event.parameters[3].value.toString(); + } + + get _timestamp(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } +} + +export class UniversalRecipientRegistry extends ethereum.SmartContract { + static bind(address: Address): UniversalRecipientRegistry { + return new UniversalRecipientRegistry( + "UniversalRecipientRegistry", + address + ); + } + + baseDeposit(): BigInt { + let result = super.call("baseDeposit", "baseDeposit():(uint256)", []); + + return result[0].toBigInt(); + } + + try_baseDeposit(): ethereum.CallResult { + let result = super.tryCall("baseDeposit", "baseDeposit():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + challengePeriodDuration(): BigInt { + let result = super.call( + "challengePeriodDuration", + "challengePeriodDuration():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_challengePeriodDuration(): ethereum.CallResult { + let result = super.tryCall( + "challengePeriodDuration", + "challengePeriodDuration():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + challengeRequest(_recipientId: Bytes, _beneficiary: Address): boolean { + let result = super.call( + "challengeRequest", + "challengeRequest(bytes32,address):(bool)", + [ + ethereum.Value.fromFixedBytes(_recipientId), + ethereum.Value.fromAddress(_beneficiary) + ] + ); + + return result[0].toBoolean(); + } + + try_challengeRequest( + _recipientId: Bytes, + _beneficiary: Address + ): ethereum.CallResult { + let result = super.tryCall( + "challengeRequest", + "challengeRequest(bytes32,address):(bool)", + [ + ethereum.Value.fromFixedBytes(_recipientId), + ethereum.Value.fromAddress(_beneficiary) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + controller(): Address { + let result = super.call("controller", "controller():(address)", []); + + return result[0].toAddress(); + } + + try_controller(): ethereum.CallResult
{ + let result = super.tryCall("controller", "controller():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + executeRequest(_recipientId: Bytes): boolean { + let result = super.call( + "executeRequest", + "executeRequest(bytes32):(bool)", + [ethereum.Value.fromFixedBytes(_recipientId)] + ); + + return result[0].toBoolean(); + } + + try_executeRequest(_recipientId: Bytes): ethereum.CallResult { + let result = super.tryCall( + "executeRequest", + "executeRequest(bytes32):(bool)", + [ethereum.Value.fromFixedBytes(_recipientId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getRecipientAddress( + _index: BigInt, + _startTime: BigInt, + _endTime: BigInt + ): Address { + let result = super.call( + "getRecipientAddress", + "getRecipientAddress(uint256,uint256,uint256):(address)", + [ + ethereum.Value.fromUnsignedBigInt(_index), + ethereum.Value.fromUnsignedBigInt(_startTime), + ethereum.Value.fromUnsignedBigInt(_endTime) + ] + ); + + return result[0].toAddress(); + } + + try_getRecipientAddress( + _index: BigInt, + _startTime: BigInt, + _endTime: BigInt + ): ethereum.CallResult
{ + let result = super.tryCall( + "getRecipientAddress", + "getRecipientAddress(uint256,uint256,uint256):(address)", + [ + ethereum.Value.fromUnsignedBigInt(_index), + ethereum.Value.fromUnsignedBigInt(_startTime), + ethereum.Value.fromUnsignedBigInt(_endTime) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + maxRecipients(): BigInt { + let result = super.call("maxRecipients", "maxRecipients():(uint256)", []); + + return result[0].toBigInt(); + } + + try_maxRecipients(): ethereum.CallResult { + let result = super.tryCall( + "maxRecipients", + "maxRecipients():(uint256)", + [] + ); + 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()); + } + + setMaxRecipients(_maxRecipients: BigInt): boolean { + let result = super.call( + "setMaxRecipients", + "setMaxRecipients(uint256):(bool)", + [ethereum.Value.fromUnsignedBigInt(_maxRecipients)] + ); + + return result[0].toBoolean(); + } + + try_setMaxRecipients(_maxRecipients: BigInt): ethereum.CallResult { + let result = super.tryCall( + "setMaxRecipients", + "setMaxRecipients(uint256):(bool)", + [ethereum.Value.fromUnsignedBigInt(_maxRecipients)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } +} + +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 _baseDeposit(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _challengePeriodDuration(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _controller(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class ConstructorCall__Outputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } +} + +export class AddRecipientCall extends ethereum.Call { + get inputs(): AddRecipientCall__Inputs { + return new AddRecipientCall__Inputs(this); + } + + get outputs(): AddRecipientCall__Outputs { + return new AddRecipientCall__Outputs(this); + } +} + +export class AddRecipientCall__Inputs { + _call: AddRecipientCall; + + constructor(call: AddRecipientCall) { + this._call = call; + } + + get _recipient(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _metadataId(): string { + return this._call.inputValues[1].value.toString(); + } +} + +export class AddRecipientCall__Outputs { + _call: AddRecipientCall; + + constructor(call: AddRecipientCall) { + this._call = call; + } +} + +export class ChallengeRequestCall extends ethereum.Call { + get inputs(): ChallengeRequestCall__Inputs { + return new ChallengeRequestCall__Inputs(this); + } + + get outputs(): ChallengeRequestCall__Outputs { + return new ChallengeRequestCall__Outputs(this); + } +} + +export class ChallengeRequestCall__Inputs { + _call: ChallengeRequestCall; + + constructor(call: ChallengeRequestCall) { + this._call = call; + } + + get _recipientId(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get _beneficiary(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class ChallengeRequestCall__Outputs { + _call: ChallengeRequestCall; + + constructor(call: ChallengeRequestCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class ExecuteRequestCall extends ethereum.Call { + get inputs(): ExecuteRequestCall__Inputs { + return new ExecuteRequestCall__Inputs(this); + } + + get outputs(): ExecuteRequestCall__Outputs { + return new ExecuteRequestCall__Outputs(this); + } +} + +export class ExecuteRequestCall__Inputs { + _call: ExecuteRequestCall; + + constructor(call: ExecuteRequestCall) { + this._call = call; + } + + get _recipientId(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } +} + +export class ExecuteRequestCall__Outputs { + _call: ExecuteRequestCall; + + constructor(call: ExecuteRequestCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class RemoveRecipientCall extends ethereum.Call { + get inputs(): RemoveRecipientCall__Inputs { + return new RemoveRecipientCall__Inputs(this); + } + + get outputs(): RemoveRecipientCall__Outputs { + return new RemoveRecipientCall__Outputs(this); + } +} + +export class RemoveRecipientCall__Inputs { + _call: RemoveRecipientCall; + + constructor(call: RemoveRecipientCall) { + this._call = call; + } + + get _recipientId(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } +} + +export class RemoveRecipientCall__Outputs { + _call: RemoveRecipientCall; + + constructor(call: RemoveRecipientCall) { + this._call = call; + } +} + +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 SetBaseDepositCall extends ethereum.Call { + get inputs(): SetBaseDepositCall__Inputs { + return new SetBaseDepositCall__Inputs(this); + } + + get outputs(): SetBaseDepositCall__Outputs { + return new SetBaseDepositCall__Outputs(this); + } +} + +export class SetBaseDepositCall__Inputs { + _call: SetBaseDepositCall; + + constructor(call: SetBaseDepositCall) { + this._call = call; + } + + get _baseDeposit(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetBaseDepositCall__Outputs { + _call: SetBaseDepositCall; + + constructor(call: SetBaseDepositCall) { + this._call = call; + } +} + +export class SetChallengePeriodDurationCall extends ethereum.Call { + get inputs(): SetChallengePeriodDurationCall__Inputs { + return new SetChallengePeriodDurationCall__Inputs(this); + } + + get outputs(): SetChallengePeriodDurationCall__Outputs { + return new SetChallengePeriodDurationCall__Outputs(this); + } +} + +export class SetChallengePeriodDurationCall__Inputs { + _call: SetChallengePeriodDurationCall; + + constructor(call: SetChallengePeriodDurationCall) { + this._call = call; + } + + get _challengePeriodDuration(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetChallengePeriodDurationCall__Outputs { + _call: SetChallengePeriodDurationCall; + + constructor(call: SetChallengePeriodDurationCall) { + this._call = call; + } +} + +export class SetMaxRecipientsCall extends ethereum.Call { + get inputs(): SetMaxRecipientsCall__Inputs { + return new SetMaxRecipientsCall__Inputs(this); + } + + get outputs(): SetMaxRecipientsCall__Outputs { + return new SetMaxRecipientsCall__Outputs(this); + } +} + +export class SetMaxRecipientsCall__Inputs { + _call: SetMaxRecipientsCall; + + constructor(call: SetMaxRecipientsCall) { + this._call = call; + } + + get _maxRecipients(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetMaxRecipientsCall__Outputs { + _call: SetMaxRecipientsCall; + + constructor(call: SetMaxRecipientsCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +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/generated/schema.ts b/subgraph/generated/schema.ts index a868e9c45..5e17d2f4d 100644 --- a/subgraph/generated/schema.ts +++ b/subgraph/generated/schema.ts @@ -1501,6 +1501,23 @@ export class Recipient extends Entity { } } + get recipientMetadataId(): string | null { + let value = this.get("recipientMetadataId"); + if (value === null || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set recipientMetadataId(value: string | null) { + if (value === null) { + this.unset("recipientMetadataId"); + } else { + this.set("recipientMetadataId", Value.fromString(value as string)); + } + } + get rejected(): boolean { let value = this.get("rejected"); return value.toBoolean(); diff --git a/subgraph/subgraph.template.yaml b/subgraph/subgraph.template.yaml index 4e391d58b..4746c92d1 100644 --- a/subgraph/subgraph.template.yaml +++ b/subgraph/subgraph.template.yaml @@ -71,6 +71,30 @@ dataSources: - event: RequestSubmitted(indexed bytes32,indexed uint8,address,string,uint256) handler: handleRequestSubmitted file: ./src/OptimisticRecipientRegistryMapping.ts + - kind: ethereum/contract + name: UniversalRecipientRegistry + network: {{network}} + source: + abi: UniversalRecipientRegistry + startBlock: {{universalRecipientRegistryStartBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.4 + language: wasm/assemblyscript + entities: + - RecipientRegistry + - Recipient + abis: + - name: UniversalRecipientRegistry + file: ./abis/UniversalRecipientRegistry.json + eventHandlers: + - event: OwnershipTransferred(indexed address,indexed address) + handler: handleOwnershipTransferred + - event: RequestResolved(indexed bytes32,indexed uint8,indexed bool,uint256,uint256) + handler: handleRequestResolved + - event: RequestSubmitted(indexed bytes32,indexed uint8,address,string,uint256) + handler: handleRequestSubmitted + file: ./src/UniversalRecipientRegistryMapping.ts templates: - name: FundingRound kind: ethereum/contract