diff --git a/contracts/cli/contribute.ts b/contracts/cli/contribute.ts index be393c700..c06e5fb1d 100644 --- a/contracts/cli/contribute.ts +++ b/contracts/cli/contribute.ts @@ -93,7 +93,6 @@ async function main(args: any) { '_amount' ) - console.log('saving states with amount', amount) state.contributors[contributorAddress] = { privKey: contributorKeypair.privKey.serialize(), pubKey: contributorKeypair.pubKey.serialize(), diff --git a/subgraph/abis/FundingRound.json b/subgraph/abis/FundingRound.json index 7a482f795..e674c6c8f 100644 --- a/subgraph/abis/FundingRound.json +++ b/subgraph/abis/FundingRound.json @@ -25,6 +25,238 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "AlreadyContributed", + "type": "error" + }, + { + "inputs": [], + "name": "ContributionAmountIsZero", + "type": "error" + }, + { + "inputs": [], + "name": "ContributionAmountTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "EmptyTallyHash", + "type": "error" + }, + { + "inputs": [], + "name": "FundsAlreadyClaimed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "IncompleteTallyResults", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectPerVOSpentVoiceCredits", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectSpentVoiceCredits", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTallyResult", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBudget", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCoordinator", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMaci", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMessageProcessor", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidNativeToken", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPoll", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRecipientRegistry", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTally", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidUserRegistry", + "type": "error" + }, + { + "inputs": [], + "name": "MaciAlreadySet", + "type": "error" + }, + { + "inputs": [], + "name": "MaciNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "NoProjectHasMoreThanOneVote", + "type": "error" + }, + { + "inputs": [], + "name": "NoVoiceCredits", + "type": "error" + }, + { + "inputs": [], + "name": "NoVotes", + "type": "error" + }, + { + "inputs": [], + "name": "NotContributor", + "type": "error" + }, + { + "inputs": [], + "name": "NotCoordinator", + "type": "error" + }, + { + "inputs": [], + "name": "NothingToWithdraw", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyMaciCanRegisterVoters", + "type": "error" + }, + { + "inputs": [], + "name": "PollNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "RoundAlreadyFinalized", + "type": "error" + }, + { + "inputs": [], + "name": "RoundCancelled", + "type": "error" + }, + { + "inputs": [], + "name": "RoundNotCancelled", + "type": "error" + }, + { + "inputs": [], + "name": "RoundNotFinalized", + "type": "error" + }, + { + "inputs": [], + "name": "TallyHashNotPublished", + "type": "error" + }, + { + "inputs": [], + "name": "TopupAmountIsZero", + "type": "error" + }, + { + "inputs": [], + "name": "TopupAmountTooLarge", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "expected", + "type": "address" + }, + { + "internalType": "address", + "name": "actual", + "type": "address" + } + ], + "name": "UnexpectedPollAddress", + "type": "error" + }, + { + "inputs": [], + "name": "UserAlreadyRegistered", + "type": "error" + }, + { + "inputs": [], + "name": "UserHasNotContributed", + "type": "error" + }, + { + "inputs": [], + "name": "UserNotVerified", + "type": "error" + }, + { + "inputs": [], + "name": "VoteResultsAlreadyVerified", + "type": "error" + }, + { + "inputs": [], + "name": "VotesNotTallied", + "type": "error" + }, + { + "inputs": [], + "name": "VotingPeriodNotPassed", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -101,6 +333,19 @@ "name": "OwnershipTransferred", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_poll", + "type": "address" + } + ], + "name": "PollSet", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -114,6 +359,57 @@ "name": "TallyPublished", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_voteOptionIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_tally", + "type": "uint256" + } + ], + "name": "TallyResultsAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_tally", + "type": "address" + } + ], + "name": "TallySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Topup", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -127,6 +423,61 @@ "name": "Voted", "type": "event" }, + { + "inputs": [], + "name": "MESSAGE_DATA_LENGTH", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "alpha", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_budget", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_totalVotesSquares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_totalSpent", + "type": "uint256" + } + ], + "name": "calcAlpha", + "outputs": [ + { + "internalType": "uint256", + "name": "_alpha", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "cancel", @@ -134,6 +485,44 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_voteOptionIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_spent", + "type": "uint256" + }, + { + "internalType": "uint256[][]", + "name": "_spentProof", + "type": "uint256[][]" + }, + { + "internalType": "uint256", + "name": "_spentSalt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_resultsCommitment", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_spentVoiceCreditsCommitment", + "type": "uint256" + } + ], + "name": "claimFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -149,7 +538,7 @@ "type": "uint256" } ], - "internalType": "struct MACISharedObjs.PubKey", + "internalType": "struct DomainObjs.PubKey", "name": "pubKey", "type": "tuple" }, @@ -177,6 +566,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "contributors", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRegistered", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "coordinator", @@ -201,6 +614,16 @@ "internalType": "uint256", "name": "_totalSpentSalt", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_newResultCommitment", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_perVOSpentVoiceCreditsHash", + "type": "uint256" } ], "name": "finalize", @@ -256,6 +679,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "addressValue", + "type": "address" + } + ], + "name": "isAddressZero", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [], "name": "isCancelled", @@ -334,6 +776,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "poll", + "outputs": [ + { + "internalType": "contract Poll", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pollId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -360,6 +828,35 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "recipients", + "outputs": [ + { + "internalType": "bool", + "name": "fundsClaimed", + "type": "bool" + }, + { + "internalType": "bool", + "name": "tallyVerified", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "tallyResult", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -385,12 +882,46 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "resetTally", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { "internalType": "contract MACI", "name": "_maci", "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "poll", + "type": "address" + }, + { + "internalType": "address", + "name": "messageProcessor", + "type": "address" + }, + { + "internalType": "address", + "name": "tally", + "type": "address" + }, + { + "internalType": "address", + "name": "subsidy", + "type": "address" + } + ], + "internalType": "struct MACI.PollContracts", + "name": "_pollContracts", + "type": "tuple" } ], "name": "setMaci", @@ -398,13 +929,26 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "contract MACI", + "name": "_maci", + "type": "address" + } + ], + "name": "setMaciInstance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { "components": [ { "internalType": "uint256", - "name": "iv", + "name": "msgType", "type": "uint256" }, { @@ -413,7 +957,7 @@ "type": "uint256[10]" } ], - "internalType": "struct MACISharedObjs.Message[]", + "internalType": "struct DomainObjs.Message[]", "name": "_messages", "type": "tuple[]" }, @@ -430,7 +974,7 @@ "type": "uint256" } ], - "internalType": "struct MACISharedObjs.PubKey[]", + "internalType": "struct DomainObjs.PubKey[]", "name": "_encPubKeys", "type": "tuple[]" } @@ -440,6 +984,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "tally", + "outputs": [ + { + "internalType": "contract Tally", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "tallyHash", @@ -453,12 +1010,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stateIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "topup", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], - "name": "poll", + "name": "topupToken", "outputs": [ { - "internalType": "contract Poll", + "internalType": "contract TopupToken", "name": "", "type": "address" } @@ -468,7 +1043,7 @@ }, { "inputs": [], - "name": "pollId", + "name": "totalSpent", "outputs": [ { "internalType": "uint256", @@ -481,7 +1056,7 @@ }, { "inputs": [], - "name": "totalSpent", + "name": "totalTallyResults", "outputs": [ { "internalType": "uint256", @@ -505,6 +1080,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "totalVotesSquares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -544,6 +1132,13 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "withdrawContribution", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -552,8 +1147,14 @@ "type": "address[]" } ], - "name": "withdrawContribution", - "outputs": [], + "name": "withdrawContributions", + "outputs": [ + { + "internalType": "bool[]", + "name": "result", + "type": "bool[]" + } + ], "stateMutability": "nonpayable", "type": "function" } diff --git a/subgraph/config/arbitrum-sepolia.json b/subgraph/config/arbitrum-sepolia.json index aee545b9a..55ba6d285 100644 --- a/subgraph/config/arbitrum-sepolia.json +++ b/subgraph/config/arbitrum-sepolia.json @@ -1,6 +1,6 @@ { "network": "arbitrum-sepolia", - "address": "0x22Ff798925A76B21f8122C04D10f177ea52D6411", - "clrFundStartBlock": 9007610, - "recipientRegistryStartBlock": 9007610 + "address": "0x504ED10334aa88E313cC2cfFF4D176796Bd8B00C", + "clrFundStartBlock": 10048750, + "recipientRegistryStartBlock": 10048750 } diff --git a/subgraph/generated/ClrFund/FundingRound.ts b/subgraph/generated/ClrFund/FundingRound.ts index e86a75ef4..194e40e1d 100644 --- a/subgraph/generated/ClrFund/FundingRound.ts +++ b/subgraph/generated/ClrFund/FundingRound.ts @@ -98,6 +98,24 @@ export class OwnershipTransferred__Params { } } +export class PollSet extends ethereum.Event { + get params(): PollSet__Params { + return new PollSet__Params(this); + } +} + +export class PollSet__Params { + _event: PollSet; + + constructor(event: PollSet) { + this._event = event; + } + + get _poll(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + export class TallyPublished extends ethereum.Event { get params(): TallyPublished__Params { return new TallyPublished__Params(this); @@ -116,6 +134,68 @@ export class TallyPublished__Params { } } +export class TallyResultsAdded extends ethereum.Event { + get params(): TallyResultsAdded__Params { + return new TallyResultsAdded__Params(this); + } +} + +export class TallyResultsAdded__Params { + _event: TallyResultsAdded; + + constructor(event: TallyResultsAdded) { + this._event = event; + } + + get _voteOptionIndex(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _tally(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class TallySet extends ethereum.Event { + get params(): TallySet__Params { + return new TallySet__Params(this); + } +} + +export class TallySet__Params { + _event: TallySet; + + constructor(event: TallySet) { + this._event = event; + } + + get _tally(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Topup extends ethereum.Event { + get params(): Topup__Params { + return new Topup__Params(this); + } +} + +export class Topup__Params { + _event: Topup; + + constructor(event: Topup) { + this._event = event; + } + + get _sender(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + export class Voted extends ethereum.Event { get params(): Voted__Params { return new Voted__Params(this); @@ -134,11 +214,145 @@ export class Voted__Params { } } +export class FundingRound__contributorsResult { + value0: BigInt; + value1: boolean; + + constructor(value0: BigInt, value1: boolean) { + 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.fromBoolean(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getIsRegistered(): boolean { + return this.value1; + } +} + +export class FundingRound__recipientsResult { + value0: boolean; + value1: boolean; + value2: BigInt; + + constructor(value0: boolean, value1: boolean, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromBoolean(this.value0)); + map.set("value1", ethereum.Value.fromBoolean(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getFundsClaimed(): boolean { + return this.value0; + } + + getTallyVerified(): boolean { + return this.value1; + } + + getTallyResult(): BigInt { + return this.value2; + } +} + export class FundingRound extends ethereum.SmartContract { static bind(address: Address): FundingRound { return new FundingRound("FundingRound", address); } + MESSAGE_DATA_LENGTH(): i32 { + let result = super.call( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + + return result[0].toI32(); + } + + try_MESSAGE_DATA_LENGTH(): ethereum.CallResult { + let result = super.tryCall( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + alpha(): BigInt { + let result = super.call("alpha", "alpha():(uint256)", []); + + return result[0].toBigInt(); + } + + try_alpha(): ethereum.CallResult { + let result = super.tryCall("alpha", "alpha():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): BigInt { + let result = super.call( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + + return result[0].toBigInt(); + } + + try_calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + contributorCount(): BigInt { let result = super.call( "contributorCount", @@ -162,6 +376,39 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + contributors(param0: Address): FundingRound__contributorsResult { + let result = super.call( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + + return new FundingRound__contributorsResult( + result[0].toBigInt(), + result[1].toBoolean() + ); + } + + try_contributors( + param0: Address + ): ethereum.CallResult { + let result = super.tryCall( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__contributorsResult( + value[0].toBigInt(), + value[1].toBoolean() + ) + ); + } + coordinator(): Address { let result = super.call("coordinator", "coordinator():(address)", []); @@ -235,6 +482,27 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + isAddressZero(addressValue: Address): boolean { + let result = super.call("isAddressZero", "isAddressZero(address):(bool)", [ + ethereum.Value.fromAddress(addressValue) + ]); + + return result[0].toBoolean(); + } + + try_isAddressZero(addressValue: Address): ethereum.CallResult { + let result = super.tryCall( + "isAddressZero", + "isAddressZero(address):(bool)", + [ethereum.Value.fromAddress(addressValue)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + isCancelled(): boolean { let result = super.call("isCancelled", "isCancelled():(bool)", []); @@ -333,6 +601,36 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + poll(): Address { + let result = super.call("poll", "poll():(address)", []); + + return result[0].toAddress(); + } + + try_poll(): ethereum.CallResult
{ + let result = super.tryCall("poll", "poll():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + pollId(): BigInt { + let result = super.call("pollId", "pollId():(uint256)", []); + + return result[0].toBigInt(); + } + + try_pollId(): ethereum.CallResult { + let result = super.tryCall("pollId", "pollId():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + recipientRegistry(): Address { let result = super.call( "recipientRegistry", @@ -356,6 +654,56 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + recipients(param0: BigInt): FundingRound__recipientsResult { + let result = super.call( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new FundingRound__recipientsResult( + result[0].toBoolean(), + result[1].toBoolean(), + result[2].toBigInt() + ); + } + + try_recipients( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__recipientsResult( + value[0].toBoolean(), + value[1].toBoolean(), + value[2].toBigInt() + ) + ); + } + + tally(): Address { + let result = super.call("tally", "tally():(address)", []); + + return result[0].toAddress(); + } + + try_tally(): ethereum.CallResult
{ + let result = super.tryCall("tally", "tally():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + tallyHash(): string { let result = super.call("tallyHash", "tallyHash():(string)", []); @@ -371,14 +719,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toString()); } - poll(): Address { - let result = super.call("poll", "poll():(address)", []); + topupToken(): Address { + let result = super.call("topupToken", "topupToken():(address)", []); return result[0].toAddress(); } - try_poll(): ethereum.CallResult
{ - let result = super.tryCall("poll", "poll():(address)", []); + try_topupToken(): ethereum.CallResult
{ + let result = super.tryCall("topupToken", "topupToken():(address)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -386,14 +734,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - pollId(): BigInt { - let result = super.call("pollId", "pollId():(uint256)", []); + totalSpent(): BigInt { + let result = super.call("totalSpent", "totalSpent():(uint256)", []); return result[0].toBigInt(); } - try_pollId(): ethereum.CallResult { - let result = super.tryCall("pollId", "pollId():(uint256)", []); + try_totalSpent(): ethereum.CallResult { + let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -401,14 +749,22 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } - totalSpent(): BigInt { - let result = super.call("totalSpent", "totalSpent():(uint256)", []); + totalTallyResults(): BigInt { + let result = super.call( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); return result[0].toBigInt(); } - try_totalSpent(): ethereum.CallResult { - let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); + try_totalTallyResults(): ethereum.CallResult { + let result = super.tryCall( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); if (result.reverted) { return new ethereum.CallResult(); } @@ -431,6 +787,29 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + totalVotesSquares(): BigInt { + let result = super.call( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_totalVotesSquares(): ethereum.CallResult { + let result = super.tryCall( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + userRegistry(): Address { let result = super.call("userRegistry", "userRegistry():(address)", []); @@ -468,6 +847,31 @@ export class FundingRound extends ethereum.SmartContract { let value = result.value; return ethereum.CallResult.fromValue(value[0].toBigInt()); } + + withdrawContributions(_contributors: Array
): Array { + let result = super.call( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + + return result[0].toBooleanArray(); + } + + try_withdrawContributions( + _contributors: Array
+ ): ethereum.CallResult> { + let result = super.tryCall( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBooleanArray()); + } } export class ConstructorCall extends ethereum.Call { @@ -538,6 +942,56 @@ export class CancelCall__Outputs { } } +export class ClaimFundsCall extends ethereum.Call { + get inputs(): ClaimFundsCall__Inputs { + return new ClaimFundsCall__Inputs(this); + } + + get outputs(): ClaimFundsCall__Outputs { + return new ClaimFundsCall__Outputs(this); + } +} + +export class ClaimFundsCall__Inputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } + + get _voteOptionIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _spent(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _spentProof(): Array> { + return this._call.inputValues[2].value.toBigIntMatrix(); + } + + get _spentSalt(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _resultsCommitment(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _spentVoiceCreditsCommitment(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } +} + +export class ClaimFundsCall__Outputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } +} + export class ContributeCall extends ethereum.Call { get inputs(): ContributeCall__Inputs { return new ContributeCall__Inputs(this); @@ -608,6 +1062,14 @@ export class FinalizeCall__Inputs { get _totalSpentSalt(): BigInt { return this._call.inputValues[1].value.toBigInt(); } + + get _newResultCommitment(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _perVOSpentVoiceCreditsHash(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } } export class FinalizeCall__Outputs { @@ -708,6 +1170,32 @@ export class RenounceOwnershipCall__Outputs { } } +export class ResetTallyCall extends ethereum.Call { + get inputs(): ResetTallyCall__Inputs { + return new ResetTallyCall__Inputs(this); + } + + get outputs(): ResetTallyCall__Outputs { + return new ResetTallyCall__Outputs(this); + } +} + +export class ResetTallyCall__Inputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + +export class ResetTallyCall__Outputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + export class SetMaciCall extends ethereum.Call { get inputs(): SetMaciCall__Inputs { return new SetMaciCall__Inputs(this); @@ -728,6 +1216,12 @@ export class SetMaciCall__Inputs { get _maci(): Address { return this._call.inputValues[0].value.toAddress(); } + + get _pollContracts(): SetMaciCall_pollContractsStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } } export class SetMaciCall__Outputs { @@ -738,6 +1232,54 @@ export class SetMaciCall__Outputs { } } +export class SetMaciCall_pollContractsStruct extends ethereum.Tuple { + get poll(): Address { + return this[0].toAddress(); + } + + get messageProcessor(): Address { + return this[1].toAddress(); + } + + get tally(): Address { + return this[2].toAddress(); + } + + get subsidy(): Address { + return this[3].toAddress(); + } +} + +export class SetMaciInstanceCall extends ethereum.Call { + get inputs(): SetMaciInstanceCall__Inputs { + return new SetMaciInstanceCall__Inputs(this); + } + + get outputs(): SetMaciInstanceCall__Outputs { + return new SetMaciInstanceCall__Outputs(this); + } +} + +export class SetMaciInstanceCall__Inputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } + + get _maci(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetMaciInstanceCall__Outputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } +} + export class SubmitMessageBatchCall extends ethereum.Call { get inputs(): SubmitMessageBatchCall__Inputs { return new SubmitMessageBatchCall__Inputs(this); @@ -777,7 +1319,7 @@ export class SubmitMessageBatchCall__Outputs { } export class SubmitMessageBatchCall_messagesStruct extends ethereum.Tuple { - get iv(): BigInt { + get msgType(): BigInt { return this[0].toBigInt(); } @@ -796,6 +1338,40 @@ export class SubmitMessageBatchCall_encPubKeysStruct extends ethereum.Tuple { } } +export class TopupCall extends ethereum.Call { + get inputs(): TopupCall__Inputs { + return new TopupCall__Inputs(this); + } + + get outputs(): TopupCall__Outputs { + return new TopupCall__Outputs(this); + } +} + +export class TopupCall__Inputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } + + get stateIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TopupCall__Outputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } +} + export class TransferOwnershipCall extends ethereum.Call { get inputs(): TransferOwnershipCall__Inputs { return new TransferOwnershipCall__Inputs(this); @@ -842,16 +1418,46 @@ export class WithdrawContributionCall__Inputs { constructor(call: WithdrawContributionCall) { this._call = call; } +} + +export class WithdrawContributionCall__Outputs { + _call: WithdrawContributionCall; + + constructor(call: WithdrawContributionCall) { + this._call = call; + } +} + +export class WithdrawContributionsCall extends ethereum.Call { + get inputs(): WithdrawContributionsCall__Inputs { + return new WithdrawContributionsCall__Inputs(this); + } + + get outputs(): WithdrawContributionsCall__Outputs { + return new WithdrawContributionsCall__Outputs(this); + } +} + +export class WithdrawContributionsCall__Inputs { + _call: WithdrawContributionsCall; + + constructor(call: WithdrawContributionsCall) { + this._call = call; + } get _contributors(): Array
{ return this._call.inputValues[0].value.toAddressArray(); } } -export class WithdrawContributionCall__Outputs { - _call: WithdrawContributionCall; +export class WithdrawContributionsCall__Outputs { + _call: WithdrawContributionsCall; - constructor(call: WithdrawContributionCall) { + constructor(call: WithdrawContributionsCall) { this._call = call; } + + get result(): Array { + return this._call.outputValues[0].value.toBooleanArray(); + } } diff --git a/subgraph/generated/schema.ts b/subgraph/generated/schema.ts index f611654e8..19867639a 100644 --- a/subgraph/generated/schema.ts +++ b/subgraph/generated/schema.ts @@ -2123,6 +2123,23 @@ export class Contribution extends Entity { this.set("createdAt", Value.fromString(value)); } } + + get lastUpdatedAt(): string | null { + let value = this.get("lastUpdatedAt"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set lastUpdatedAt(value: string | null) { + if (!value) { + this.unset("lastUpdatedAt"); + } else { + this.set("lastUpdatedAt", Value.fromString(value)); + } + } } export class Vote extends Entity { diff --git a/subgraph/generated/templates/FundingRound/FundingRound.ts b/subgraph/generated/templates/FundingRound/FundingRound.ts index e86a75ef4..194e40e1d 100644 --- a/subgraph/generated/templates/FundingRound/FundingRound.ts +++ b/subgraph/generated/templates/FundingRound/FundingRound.ts @@ -98,6 +98,24 @@ export class OwnershipTransferred__Params { } } +export class PollSet extends ethereum.Event { + get params(): PollSet__Params { + return new PollSet__Params(this); + } +} + +export class PollSet__Params { + _event: PollSet; + + constructor(event: PollSet) { + this._event = event; + } + + get _poll(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + export class TallyPublished extends ethereum.Event { get params(): TallyPublished__Params { return new TallyPublished__Params(this); @@ -116,6 +134,68 @@ export class TallyPublished__Params { } } +export class TallyResultsAdded extends ethereum.Event { + get params(): TallyResultsAdded__Params { + return new TallyResultsAdded__Params(this); + } +} + +export class TallyResultsAdded__Params { + _event: TallyResultsAdded; + + constructor(event: TallyResultsAdded) { + this._event = event; + } + + get _voteOptionIndex(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _tally(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class TallySet extends ethereum.Event { + get params(): TallySet__Params { + return new TallySet__Params(this); + } +} + +export class TallySet__Params { + _event: TallySet; + + constructor(event: TallySet) { + this._event = event; + } + + get _tally(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Topup extends ethereum.Event { + get params(): Topup__Params { + return new Topup__Params(this); + } +} + +export class Topup__Params { + _event: Topup; + + constructor(event: Topup) { + this._event = event; + } + + get _sender(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + export class Voted extends ethereum.Event { get params(): Voted__Params { return new Voted__Params(this); @@ -134,11 +214,145 @@ export class Voted__Params { } } +export class FundingRound__contributorsResult { + value0: BigInt; + value1: boolean; + + constructor(value0: BigInt, value1: boolean) { + 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.fromBoolean(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getIsRegistered(): boolean { + return this.value1; + } +} + +export class FundingRound__recipientsResult { + value0: boolean; + value1: boolean; + value2: BigInt; + + constructor(value0: boolean, value1: boolean, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromBoolean(this.value0)); + map.set("value1", ethereum.Value.fromBoolean(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getFundsClaimed(): boolean { + return this.value0; + } + + getTallyVerified(): boolean { + return this.value1; + } + + getTallyResult(): BigInt { + return this.value2; + } +} + export class FundingRound extends ethereum.SmartContract { static bind(address: Address): FundingRound { return new FundingRound("FundingRound", address); } + MESSAGE_DATA_LENGTH(): i32 { + let result = super.call( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + + return result[0].toI32(); + } + + try_MESSAGE_DATA_LENGTH(): ethereum.CallResult { + let result = super.tryCall( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + alpha(): BigInt { + let result = super.call("alpha", "alpha():(uint256)", []); + + return result[0].toBigInt(); + } + + try_alpha(): ethereum.CallResult { + let result = super.tryCall("alpha", "alpha():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): BigInt { + let result = super.call( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + + return result[0].toBigInt(); + } + + try_calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + contributorCount(): BigInt { let result = super.call( "contributorCount", @@ -162,6 +376,39 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + contributors(param0: Address): FundingRound__contributorsResult { + let result = super.call( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + + return new FundingRound__contributorsResult( + result[0].toBigInt(), + result[1].toBoolean() + ); + } + + try_contributors( + param0: Address + ): ethereum.CallResult { + let result = super.tryCall( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__contributorsResult( + value[0].toBigInt(), + value[1].toBoolean() + ) + ); + } + coordinator(): Address { let result = super.call("coordinator", "coordinator():(address)", []); @@ -235,6 +482,27 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + isAddressZero(addressValue: Address): boolean { + let result = super.call("isAddressZero", "isAddressZero(address):(bool)", [ + ethereum.Value.fromAddress(addressValue) + ]); + + return result[0].toBoolean(); + } + + try_isAddressZero(addressValue: Address): ethereum.CallResult { + let result = super.tryCall( + "isAddressZero", + "isAddressZero(address):(bool)", + [ethereum.Value.fromAddress(addressValue)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + isCancelled(): boolean { let result = super.call("isCancelled", "isCancelled():(bool)", []); @@ -333,6 +601,36 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + poll(): Address { + let result = super.call("poll", "poll():(address)", []); + + return result[0].toAddress(); + } + + try_poll(): ethereum.CallResult
{ + let result = super.tryCall("poll", "poll():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + pollId(): BigInt { + let result = super.call("pollId", "pollId():(uint256)", []); + + return result[0].toBigInt(); + } + + try_pollId(): ethereum.CallResult { + let result = super.tryCall("pollId", "pollId():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + recipientRegistry(): Address { let result = super.call( "recipientRegistry", @@ -356,6 +654,56 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + recipients(param0: BigInt): FundingRound__recipientsResult { + let result = super.call( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new FundingRound__recipientsResult( + result[0].toBoolean(), + result[1].toBoolean(), + result[2].toBigInt() + ); + } + + try_recipients( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__recipientsResult( + value[0].toBoolean(), + value[1].toBoolean(), + value[2].toBigInt() + ) + ); + } + + tally(): Address { + let result = super.call("tally", "tally():(address)", []); + + return result[0].toAddress(); + } + + try_tally(): ethereum.CallResult
{ + let result = super.tryCall("tally", "tally():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + tallyHash(): string { let result = super.call("tallyHash", "tallyHash():(string)", []); @@ -371,14 +719,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toString()); } - poll(): Address { - let result = super.call("poll", "poll():(address)", []); + topupToken(): Address { + let result = super.call("topupToken", "topupToken():(address)", []); return result[0].toAddress(); } - try_poll(): ethereum.CallResult
{ - let result = super.tryCall("poll", "poll():(address)", []); + try_topupToken(): ethereum.CallResult
{ + let result = super.tryCall("topupToken", "topupToken():(address)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -386,14 +734,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - pollId(): BigInt { - let result = super.call("pollId", "pollId():(uint256)", []); + totalSpent(): BigInt { + let result = super.call("totalSpent", "totalSpent():(uint256)", []); return result[0].toBigInt(); } - try_pollId(): ethereum.CallResult { - let result = super.tryCall("pollId", "pollId():(uint256)", []); + try_totalSpent(): ethereum.CallResult { + let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -401,14 +749,22 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } - totalSpent(): BigInt { - let result = super.call("totalSpent", "totalSpent():(uint256)", []); + totalTallyResults(): BigInt { + let result = super.call( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); return result[0].toBigInt(); } - try_totalSpent(): ethereum.CallResult { - let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); + try_totalTallyResults(): ethereum.CallResult { + let result = super.tryCall( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); if (result.reverted) { return new ethereum.CallResult(); } @@ -431,6 +787,29 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + totalVotesSquares(): BigInt { + let result = super.call( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_totalVotesSquares(): ethereum.CallResult { + let result = super.tryCall( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + userRegistry(): Address { let result = super.call("userRegistry", "userRegistry():(address)", []); @@ -468,6 +847,31 @@ export class FundingRound extends ethereum.SmartContract { let value = result.value; return ethereum.CallResult.fromValue(value[0].toBigInt()); } + + withdrawContributions(_contributors: Array
): Array { + let result = super.call( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + + return result[0].toBooleanArray(); + } + + try_withdrawContributions( + _contributors: Array
+ ): ethereum.CallResult> { + let result = super.tryCall( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBooleanArray()); + } } export class ConstructorCall extends ethereum.Call { @@ -538,6 +942,56 @@ export class CancelCall__Outputs { } } +export class ClaimFundsCall extends ethereum.Call { + get inputs(): ClaimFundsCall__Inputs { + return new ClaimFundsCall__Inputs(this); + } + + get outputs(): ClaimFundsCall__Outputs { + return new ClaimFundsCall__Outputs(this); + } +} + +export class ClaimFundsCall__Inputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } + + get _voteOptionIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _spent(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _spentProof(): Array> { + return this._call.inputValues[2].value.toBigIntMatrix(); + } + + get _spentSalt(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _resultsCommitment(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _spentVoiceCreditsCommitment(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } +} + +export class ClaimFundsCall__Outputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } +} + export class ContributeCall extends ethereum.Call { get inputs(): ContributeCall__Inputs { return new ContributeCall__Inputs(this); @@ -608,6 +1062,14 @@ export class FinalizeCall__Inputs { get _totalSpentSalt(): BigInt { return this._call.inputValues[1].value.toBigInt(); } + + get _newResultCommitment(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _perVOSpentVoiceCreditsHash(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } } export class FinalizeCall__Outputs { @@ -708,6 +1170,32 @@ export class RenounceOwnershipCall__Outputs { } } +export class ResetTallyCall extends ethereum.Call { + get inputs(): ResetTallyCall__Inputs { + return new ResetTallyCall__Inputs(this); + } + + get outputs(): ResetTallyCall__Outputs { + return new ResetTallyCall__Outputs(this); + } +} + +export class ResetTallyCall__Inputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + +export class ResetTallyCall__Outputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + export class SetMaciCall extends ethereum.Call { get inputs(): SetMaciCall__Inputs { return new SetMaciCall__Inputs(this); @@ -728,6 +1216,12 @@ export class SetMaciCall__Inputs { get _maci(): Address { return this._call.inputValues[0].value.toAddress(); } + + get _pollContracts(): SetMaciCall_pollContractsStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } } export class SetMaciCall__Outputs { @@ -738,6 +1232,54 @@ export class SetMaciCall__Outputs { } } +export class SetMaciCall_pollContractsStruct extends ethereum.Tuple { + get poll(): Address { + return this[0].toAddress(); + } + + get messageProcessor(): Address { + return this[1].toAddress(); + } + + get tally(): Address { + return this[2].toAddress(); + } + + get subsidy(): Address { + return this[3].toAddress(); + } +} + +export class SetMaciInstanceCall extends ethereum.Call { + get inputs(): SetMaciInstanceCall__Inputs { + return new SetMaciInstanceCall__Inputs(this); + } + + get outputs(): SetMaciInstanceCall__Outputs { + return new SetMaciInstanceCall__Outputs(this); + } +} + +export class SetMaciInstanceCall__Inputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } + + get _maci(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetMaciInstanceCall__Outputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } +} + export class SubmitMessageBatchCall extends ethereum.Call { get inputs(): SubmitMessageBatchCall__Inputs { return new SubmitMessageBatchCall__Inputs(this); @@ -777,7 +1319,7 @@ export class SubmitMessageBatchCall__Outputs { } export class SubmitMessageBatchCall_messagesStruct extends ethereum.Tuple { - get iv(): BigInt { + get msgType(): BigInt { return this[0].toBigInt(); } @@ -796,6 +1338,40 @@ export class SubmitMessageBatchCall_encPubKeysStruct extends ethereum.Tuple { } } +export class TopupCall extends ethereum.Call { + get inputs(): TopupCall__Inputs { + return new TopupCall__Inputs(this); + } + + get outputs(): TopupCall__Outputs { + return new TopupCall__Outputs(this); + } +} + +export class TopupCall__Inputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } + + get stateIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TopupCall__Outputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } +} + export class TransferOwnershipCall extends ethereum.Call { get inputs(): TransferOwnershipCall__Inputs { return new TransferOwnershipCall__Inputs(this); @@ -842,16 +1418,46 @@ export class WithdrawContributionCall__Inputs { constructor(call: WithdrawContributionCall) { this._call = call; } +} + +export class WithdrawContributionCall__Outputs { + _call: WithdrawContributionCall; + + constructor(call: WithdrawContributionCall) { + this._call = call; + } +} + +export class WithdrawContributionsCall extends ethereum.Call { + get inputs(): WithdrawContributionsCall__Inputs { + return new WithdrawContributionsCall__Inputs(this); + } + + get outputs(): WithdrawContributionsCall__Outputs { + return new WithdrawContributionsCall__Outputs(this); + } +} + +export class WithdrawContributionsCall__Inputs { + _call: WithdrawContributionsCall; + + constructor(call: WithdrawContributionsCall) { + this._call = call; + } get _contributors(): Array
{ return this._call.inputValues[0].value.toAddressArray(); } } -export class WithdrawContributionCall__Outputs { - _call: WithdrawContributionCall; +export class WithdrawContributionsCall__Outputs { + _call: WithdrawContributionsCall; - constructor(call: WithdrawContributionCall) { + constructor(call: WithdrawContributionsCall) { this._call = call; } + + get result(): Array { + return this._call.outputValues[0].value.toBooleanArray(); + } } diff --git a/subgraph/generated/templates/MACI/FundingRound.ts b/subgraph/generated/templates/MACI/FundingRound.ts index e86a75ef4..194e40e1d 100644 --- a/subgraph/generated/templates/MACI/FundingRound.ts +++ b/subgraph/generated/templates/MACI/FundingRound.ts @@ -98,6 +98,24 @@ export class OwnershipTransferred__Params { } } +export class PollSet extends ethereum.Event { + get params(): PollSet__Params { + return new PollSet__Params(this); + } +} + +export class PollSet__Params { + _event: PollSet; + + constructor(event: PollSet) { + this._event = event; + } + + get _poll(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + export class TallyPublished extends ethereum.Event { get params(): TallyPublished__Params { return new TallyPublished__Params(this); @@ -116,6 +134,68 @@ export class TallyPublished__Params { } } +export class TallyResultsAdded extends ethereum.Event { + get params(): TallyResultsAdded__Params { + return new TallyResultsAdded__Params(this); + } +} + +export class TallyResultsAdded__Params { + _event: TallyResultsAdded; + + constructor(event: TallyResultsAdded) { + this._event = event; + } + + get _voteOptionIndex(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _tally(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class TallySet extends ethereum.Event { + get params(): TallySet__Params { + return new TallySet__Params(this); + } +} + +export class TallySet__Params { + _event: TallySet; + + constructor(event: TallySet) { + this._event = event; + } + + get _tally(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Topup extends ethereum.Event { + get params(): Topup__Params { + return new Topup__Params(this); + } +} + +export class Topup__Params { + _event: Topup; + + constructor(event: Topup) { + this._event = event; + } + + get _sender(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + export class Voted extends ethereum.Event { get params(): Voted__Params { return new Voted__Params(this); @@ -134,11 +214,145 @@ export class Voted__Params { } } +export class FundingRound__contributorsResult { + value0: BigInt; + value1: boolean; + + constructor(value0: BigInt, value1: boolean) { + 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.fromBoolean(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getIsRegistered(): boolean { + return this.value1; + } +} + +export class FundingRound__recipientsResult { + value0: boolean; + value1: boolean; + value2: BigInt; + + constructor(value0: boolean, value1: boolean, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromBoolean(this.value0)); + map.set("value1", ethereum.Value.fromBoolean(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getFundsClaimed(): boolean { + return this.value0; + } + + getTallyVerified(): boolean { + return this.value1; + } + + getTallyResult(): BigInt { + return this.value2; + } +} + export class FundingRound extends ethereum.SmartContract { static bind(address: Address): FundingRound { return new FundingRound("FundingRound", address); } + MESSAGE_DATA_LENGTH(): i32 { + let result = super.call( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + + return result[0].toI32(); + } + + try_MESSAGE_DATA_LENGTH(): ethereum.CallResult { + let result = super.tryCall( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + alpha(): BigInt { + let result = super.call("alpha", "alpha():(uint256)", []); + + return result[0].toBigInt(); + } + + try_alpha(): ethereum.CallResult { + let result = super.tryCall("alpha", "alpha():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): BigInt { + let result = super.call( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + + return result[0].toBigInt(); + } + + try_calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + contributorCount(): BigInt { let result = super.call( "contributorCount", @@ -162,6 +376,39 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + contributors(param0: Address): FundingRound__contributorsResult { + let result = super.call( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + + return new FundingRound__contributorsResult( + result[0].toBigInt(), + result[1].toBoolean() + ); + } + + try_contributors( + param0: Address + ): ethereum.CallResult { + let result = super.tryCall( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__contributorsResult( + value[0].toBigInt(), + value[1].toBoolean() + ) + ); + } + coordinator(): Address { let result = super.call("coordinator", "coordinator():(address)", []); @@ -235,6 +482,27 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + isAddressZero(addressValue: Address): boolean { + let result = super.call("isAddressZero", "isAddressZero(address):(bool)", [ + ethereum.Value.fromAddress(addressValue) + ]); + + return result[0].toBoolean(); + } + + try_isAddressZero(addressValue: Address): ethereum.CallResult { + let result = super.tryCall( + "isAddressZero", + "isAddressZero(address):(bool)", + [ethereum.Value.fromAddress(addressValue)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + isCancelled(): boolean { let result = super.call("isCancelled", "isCancelled():(bool)", []); @@ -333,6 +601,36 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + poll(): Address { + let result = super.call("poll", "poll():(address)", []); + + return result[0].toAddress(); + } + + try_poll(): ethereum.CallResult
{ + let result = super.tryCall("poll", "poll():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + pollId(): BigInt { + let result = super.call("pollId", "pollId():(uint256)", []); + + return result[0].toBigInt(); + } + + try_pollId(): ethereum.CallResult { + let result = super.tryCall("pollId", "pollId():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + recipientRegistry(): Address { let result = super.call( "recipientRegistry", @@ -356,6 +654,56 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + recipients(param0: BigInt): FundingRound__recipientsResult { + let result = super.call( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new FundingRound__recipientsResult( + result[0].toBoolean(), + result[1].toBoolean(), + result[2].toBigInt() + ); + } + + try_recipients( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__recipientsResult( + value[0].toBoolean(), + value[1].toBoolean(), + value[2].toBigInt() + ) + ); + } + + tally(): Address { + let result = super.call("tally", "tally():(address)", []); + + return result[0].toAddress(); + } + + try_tally(): ethereum.CallResult
{ + let result = super.tryCall("tally", "tally():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + tallyHash(): string { let result = super.call("tallyHash", "tallyHash():(string)", []); @@ -371,14 +719,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toString()); } - poll(): Address { - let result = super.call("poll", "poll():(address)", []); + topupToken(): Address { + let result = super.call("topupToken", "topupToken():(address)", []); return result[0].toAddress(); } - try_poll(): ethereum.CallResult
{ - let result = super.tryCall("poll", "poll():(address)", []); + try_topupToken(): ethereum.CallResult
{ + let result = super.tryCall("topupToken", "topupToken():(address)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -386,14 +734,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - pollId(): BigInt { - let result = super.call("pollId", "pollId():(uint256)", []); + totalSpent(): BigInt { + let result = super.call("totalSpent", "totalSpent():(uint256)", []); return result[0].toBigInt(); } - try_pollId(): ethereum.CallResult { - let result = super.tryCall("pollId", "pollId():(uint256)", []); + try_totalSpent(): ethereum.CallResult { + let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -401,14 +749,22 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } - totalSpent(): BigInt { - let result = super.call("totalSpent", "totalSpent():(uint256)", []); + totalTallyResults(): BigInt { + let result = super.call( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); return result[0].toBigInt(); } - try_totalSpent(): ethereum.CallResult { - let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); + try_totalTallyResults(): ethereum.CallResult { + let result = super.tryCall( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); if (result.reverted) { return new ethereum.CallResult(); } @@ -431,6 +787,29 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + totalVotesSquares(): BigInt { + let result = super.call( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_totalVotesSquares(): ethereum.CallResult { + let result = super.tryCall( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + userRegistry(): Address { let result = super.call("userRegistry", "userRegistry():(address)", []); @@ -468,6 +847,31 @@ export class FundingRound extends ethereum.SmartContract { let value = result.value; return ethereum.CallResult.fromValue(value[0].toBigInt()); } + + withdrawContributions(_contributors: Array
): Array { + let result = super.call( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + + return result[0].toBooleanArray(); + } + + try_withdrawContributions( + _contributors: Array
+ ): ethereum.CallResult> { + let result = super.tryCall( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBooleanArray()); + } } export class ConstructorCall extends ethereum.Call { @@ -538,6 +942,56 @@ export class CancelCall__Outputs { } } +export class ClaimFundsCall extends ethereum.Call { + get inputs(): ClaimFundsCall__Inputs { + return new ClaimFundsCall__Inputs(this); + } + + get outputs(): ClaimFundsCall__Outputs { + return new ClaimFundsCall__Outputs(this); + } +} + +export class ClaimFundsCall__Inputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } + + get _voteOptionIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _spent(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _spentProof(): Array> { + return this._call.inputValues[2].value.toBigIntMatrix(); + } + + get _spentSalt(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _resultsCommitment(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _spentVoiceCreditsCommitment(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } +} + +export class ClaimFundsCall__Outputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } +} + export class ContributeCall extends ethereum.Call { get inputs(): ContributeCall__Inputs { return new ContributeCall__Inputs(this); @@ -608,6 +1062,14 @@ export class FinalizeCall__Inputs { get _totalSpentSalt(): BigInt { return this._call.inputValues[1].value.toBigInt(); } + + get _newResultCommitment(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _perVOSpentVoiceCreditsHash(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } } export class FinalizeCall__Outputs { @@ -708,6 +1170,32 @@ export class RenounceOwnershipCall__Outputs { } } +export class ResetTallyCall extends ethereum.Call { + get inputs(): ResetTallyCall__Inputs { + return new ResetTallyCall__Inputs(this); + } + + get outputs(): ResetTallyCall__Outputs { + return new ResetTallyCall__Outputs(this); + } +} + +export class ResetTallyCall__Inputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + +export class ResetTallyCall__Outputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + export class SetMaciCall extends ethereum.Call { get inputs(): SetMaciCall__Inputs { return new SetMaciCall__Inputs(this); @@ -728,6 +1216,12 @@ export class SetMaciCall__Inputs { get _maci(): Address { return this._call.inputValues[0].value.toAddress(); } + + get _pollContracts(): SetMaciCall_pollContractsStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } } export class SetMaciCall__Outputs { @@ -738,6 +1232,54 @@ export class SetMaciCall__Outputs { } } +export class SetMaciCall_pollContractsStruct extends ethereum.Tuple { + get poll(): Address { + return this[0].toAddress(); + } + + get messageProcessor(): Address { + return this[1].toAddress(); + } + + get tally(): Address { + return this[2].toAddress(); + } + + get subsidy(): Address { + return this[3].toAddress(); + } +} + +export class SetMaciInstanceCall extends ethereum.Call { + get inputs(): SetMaciInstanceCall__Inputs { + return new SetMaciInstanceCall__Inputs(this); + } + + get outputs(): SetMaciInstanceCall__Outputs { + return new SetMaciInstanceCall__Outputs(this); + } +} + +export class SetMaciInstanceCall__Inputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } + + get _maci(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetMaciInstanceCall__Outputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } +} + export class SubmitMessageBatchCall extends ethereum.Call { get inputs(): SubmitMessageBatchCall__Inputs { return new SubmitMessageBatchCall__Inputs(this); @@ -777,7 +1319,7 @@ export class SubmitMessageBatchCall__Outputs { } export class SubmitMessageBatchCall_messagesStruct extends ethereum.Tuple { - get iv(): BigInt { + get msgType(): BigInt { return this[0].toBigInt(); } @@ -796,6 +1338,40 @@ export class SubmitMessageBatchCall_encPubKeysStruct extends ethereum.Tuple { } } +export class TopupCall extends ethereum.Call { + get inputs(): TopupCall__Inputs { + return new TopupCall__Inputs(this); + } + + get outputs(): TopupCall__Outputs { + return new TopupCall__Outputs(this); + } +} + +export class TopupCall__Inputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } + + get stateIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TopupCall__Outputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } +} + export class TransferOwnershipCall extends ethereum.Call { get inputs(): TransferOwnershipCall__Inputs { return new TransferOwnershipCall__Inputs(this); @@ -842,16 +1418,46 @@ export class WithdrawContributionCall__Inputs { constructor(call: WithdrawContributionCall) { this._call = call; } +} + +export class WithdrawContributionCall__Outputs { + _call: WithdrawContributionCall; + + constructor(call: WithdrawContributionCall) { + this._call = call; + } +} + +export class WithdrawContributionsCall extends ethereum.Call { + get inputs(): WithdrawContributionsCall__Inputs { + return new WithdrawContributionsCall__Inputs(this); + } + + get outputs(): WithdrawContributionsCall__Outputs { + return new WithdrawContributionsCall__Outputs(this); + } +} + +export class WithdrawContributionsCall__Inputs { + _call: WithdrawContributionsCall; + + constructor(call: WithdrawContributionsCall) { + this._call = call; + } get _contributors(): Array
{ return this._call.inputValues[0].value.toAddressArray(); } } -export class WithdrawContributionCall__Outputs { - _call: WithdrawContributionCall; +export class WithdrawContributionsCall__Outputs { + _call: WithdrawContributionsCall; - constructor(call: WithdrawContributionCall) { + constructor(call: WithdrawContributionsCall) { this._call = call; } + + get result(): Array { + return this._call.outputValues[0].value.toBooleanArray(); + } } diff --git a/subgraph/generated/templates/Poll/FundingRound.ts b/subgraph/generated/templates/Poll/FundingRound.ts index e86a75ef4..194e40e1d 100644 --- a/subgraph/generated/templates/Poll/FundingRound.ts +++ b/subgraph/generated/templates/Poll/FundingRound.ts @@ -98,6 +98,24 @@ export class OwnershipTransferred__Params { } } +export class PollSet extends ethereum.Event { + get params(): PollSet__Params { + return new PollSet__Params(this); + } +} + +export class PollSet__Params { + _event: PollSet; + + constructor(event: PollSet) { + this._event = event; + } + + get _poll(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + export class TallyPublished extends ethereum.Event { get params(): TallyPublished__Params { return new TallyPublished__Params(this); @@ -116,6 +134,68 @@ export class TallyPublished__Params { } } +export class TallyResultsAdded extends ethereum.Event { + get params(): TallyResultsAdded__Params { + return new TallyResultsAdded__Params(this); + } +} + +export class TallyResultsAdded__Params { + _event: TallyResultsAdded; + + constructor(event: TallyResultsAdded) { + this._event = event; + } + + get _voteOptionIndex(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _tally(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class TallySet extends ethereum.Event { + get params(): TallySet__Params { + return new TallySet__Params(this); + } +} + +export class TallySet__Params { + _event: TallySet; + + constructor(event: TallySet) { + this._event = event; + } + + get _tally(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Topup extends ethereum.Event { + get params(): Topup__Params { + return new Topup__Params(this); + } +} + +export class Topup__Params { + _event: Topup; + + constructor(event: Topup) { + this._event = event; + } + + get _sender(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + export class Voted extends ethereum.Event { get params(): Voted__Params { return new Voted__Params(this); @@ -134,11 +214,145 @@ export class Voted__Params { } } +export class FundingRound__contributorsResult { + value0: BigInt; + value1: boolean; + + constructor(value0: BigInt, value1: boolean) { + 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.fromBoolean(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getIsRegistered(): boolean { + return this.value1; + } +} + +export class FundingRound__recipientsResult { + value0: boolean; + value1: boolean; + value2: BigInt; + + constructor(value0: boolean, value1: boolean, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromBoolean(this.value0)); + map.set("value1", ethereum.Value.fromBoolean(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getFundsClaimed(): boolean { + return this.value0; + } + + getTallyVerified(): boolean { + return this.value1; + } + + getTallyResult(): BigInt { + return this.value2; + } +} + export class FundingRound extends ethereum.SmartContract { static bind(address: Address): FundingRound { return new FundingRound("FundingRound", address); } + MESSAGE_DATA_LENGTH(): i32 { + let result = super.call( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + + return result[0].toI32(); + } + + try_MESSAGE_DATA_LENGTH(): ethereum.CallResult { + let result = super.tryCall( + "MESSAGE_DATA_LENGTH", + "MESSAGE_DATA_LENGTH():(uint8)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + alpha(): BigInt { + let result = super.call("alpha", "alpha():(uint256)", []); + + return result[0].toBigInt(); + } + + try_alpha(): ethereum.CallResult { + let result = super.tryCall("alpha", "alpha():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): BigInt { + let result = super.call( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + + return result[0].toBigInt(); + } + + try_calcAlpha( + _budget: BigInt, + _totalVotesSquares: BigInt, + _totalSpent: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "calcAlpha", + "calcAlpha(uint256,uint256,uint256):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_budget), + ethereum.Value.fromUnsignedBigInt(_totalVotesSquares), + ethereum.Value.fromUnsignedBigInt(_totalSpent) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + contributorCount(): BigInt { let result = super.call( "contributorCount", @@ -162,6 +376,39 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + contributors(param0: Address): FundingRound__contributorsResult { + let result = super.call( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + + return new FundingRound__contributorsResult( + result[0].toBigInt(), + result[1].toBoolean() + ); + } + + try_contributors( + param0: Address + ): ethereum.CallResult { + let result = super.tryCall( + "contributors", + "contributors(address):(uint256,bool)", + [ethereum.Value.fromAddress(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__contributorsResult( + value[0].toBigInt(), + value[1].toBoolean() + ) + ); + } + coordinator(): Address { let result = super.call("coordinator", "coordinator():(address)", []); @@ -235,6 +482,27 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + isAddressZero(addressValue: Address): boolean { + let result = super.call("isAddressZero", "isAddressZero(address):(bool)", [ + ethereum.Value.fromAddress(addressValue) + ]); + + return result[0].toBoolean(); + } + + try_isAddressZero(addressValue: Address): ethereum.CallResult { + let result = super.tryCall( + "isAddressZero", + "isAddressZero(address):(bool)", + [ethereum.Value.fromAddress(addressValue)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + isCancelled(): boolean { let result = super.call("isCancelled", "isCancelled():(bool)", []); @@ -333,6 +601,36 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + poll(): Address { + let result = super.call("poll", "poll():(address)", []); + + return result[0].toAddress(); + } + + try_poll(): ethereum.CallResult
{ + let result = super.tryCall("poll", "poll():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + pollId(): BigInt { + let result = super.call("pollId", "pollId():(uint256)", []); + + return result[0].toBigInt(); + } + + try_pollId(): ethereum.CallResult { + let result = super.tryCall("pollId", "pollId():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + recipientRegistry(): Address { let result = super.call( "recipientRegistry", @@ -356,6 +654,56 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + recipients(param0: BigInt): FundingRound__recipientsResult { + let result = super.call( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new FundingRound__recipientsResult( + result[0].toBoolean(), + result[1].toBoolean(), + result[2].toBigInt() + ); + } + + try_recipients( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "recipients", + "recipients(uint256):(bool,bool,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new FundingRound__recipientsResult( + value[0].toBoolean(), + value[1].toBoolean(), + value[2].toBigInt() + ) + ); + } + + tally(): Address { + let result = super.call("tally", "tally():(address)", []); + + return result[0].toAddress(); + } + + try_tally(): ethereum.CallResult
{ + let result = super.tryCall("tally", "tally():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + tallyHash(): string { let result = super.call("tallyHash", "tallyHash():(string)", []); @@ -371,14 +719,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toString()); } - poll(): Address { - let result = super.call("poll", "poll():(address)", []); + topupToken(): Address { + let result = super.call("topupToken", "topupToken():(address)", []); return result[0].toAddress(); } - try_poll(): ethereum.CallResult
{ - let result = super.tryCall("poll", "poll():(address)", []); + try_topupToken(): ethereum.CallResult
{ + let result = super.tryCall("topupToken", "topupToken():(address)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -386,14 +734,14 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - pollId(): BigInt { - let result = super.call("pollId", "pollId():(uint256)", []); + totalSpent(): BigInt { + let result = super.call("totalSpent", "totalSpent():(uint256)", []); return result[0].toBigInt(); } - try_pollId(): ethereum.CallResult { - let result = super.tryCall("pollId", "pollId():(uint256)", []); + try_totalSpent(): ethereum.CallResult { + let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); if (result.reverted) { return new ethereum.CallResult(); } @@ -401,14 +749,22 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } - totalSpent(): BigInt { - let result = super.call("totalSpent", "totalSpent():(uint256)", []); + totalTallyResults(): BigInt { + let result = super.call( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); return result[0].toBigInt(); } - try_totalSpent(): ethereum.CallResult { - let result = super.tryCall("totalSpent", "totalSpent():(uint256)", []); + try_totalTallyResults(): ethereum.CallResult { + let result = super.tryCall( + "totalTallyResults", + "totalTallyResults():(uint256)", + [] + ); if (result.reverted) { return new ethereum.CallResult(); } @@ -431,6 +787,29 @@ export class FundingRound extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + totalVotesSquares(): BigInt { + let result = super.call( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_totalVotesSquares(): ethereum.CallResult { + let result = super.tryCall( + "totalVotesSquares", + "totalVotesSquares():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + userRegistry(): Address { let result = super.call("userRegistry", "userRegistry():(address)", []); @@ -468,6 +847,31 @@ export class FundingRound extends ethereum.SmartContract { let value = result.value; return ethereum.CallResult.fromValue(value[0].toBigInt()); } + + withdrawContributions(_contributors: Array
): Array { + let result = super.call( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + + return result[0].toBooleanArray(); + } + + try_withdrawContributions( + _contributors: Array
+ ): ethereum.CallResult> { + let result = super.tryCall( + "withdrawContributions", + "withdrawContributions(address[]):(bool[])", + [ethereum.Value.fromAddressArray(_contributors)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBooleanArray()); + } } export class ConstructorCall extends ethereum.Call { @@ -538,6 +942,56 @@ export class CancelCall__Outputs { } } +export class ClaimFundsCall extends ethereum.Call { + get inputs(): ClaimFundsCall__Inputs { + return new ClaimFundsCall__Inputs(this); + } + + get outputs(): ClaimFundsCall__Outputs { + return new ClaimFundsCall__Outputs(this); + } +} + +export class ClaimFundsCall__Inputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } + + get _voteOptionIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _spent(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _spentProof(): Array> { + return this._call.inputValues[2].value.toBigIntMatrix(); + } + + get _spentSalt(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _resultsCommitment(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _spentVoiceCreditsCommitment(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } +} + +export class ClaimFundsCall__Outputs { + _call: ClaimFundsCall; + + constructor(call: ClaimFundsCall) { + this._call = call; + } +} + export class ContributeCall extends ethereum.Call { get inputs(): ContributeCall__Inputs { return new ContributeCall__Inputs(this); @@ -608,6 +1062,14 @@ export class FinalizeCall__Inputs { get _totalSpentSalt(): BigInt { return this._call.inputValues[1].value.toBigInt(); } + + get _newResultCommitment(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _perVOSpentVoiceCreditsHash(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } } export class FinalizeCall__Outputs { @@ -708,6 +1170,32 @@ export class RenounceOwnershipCall__Outputs { } } +export class ResetTallyCall extends ethereum.Call { + get inputs(): ResetTallyCall__Inputs { + return new ResetTallyCall__Inputs(this); + } + + get outputs(): ResetTallyCall__Outputs { + return new ResetTallyCall__Outputs(this); + } +} + +export class ResetTallyCall__Inputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + +export class ResetTallyCall__Outputs { + _call: ResetTallyCall; + + constructor(call: ResetTallyCall) { + this._call = call; + } +} + export class SetMaciCall extends ethereum.Call { get inputs(): SetMaciCall__Inputs { return new SetMaciCall__Inputs(this); @@ -728,6 +1216,12 @@ export class SetMaciCall__Inputs { get _maci(): Address { return this._call.inputValues[0].value.toAddress(); } + + get _pollContracts(): SetMaciCall_pollContractsStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } } export class SetMaciCall__Outputs { @@ -738,6 +1232,54 @@ export class SetMaciCall__Outputs { } } +export class SetMaciCall_pollContractsStruct extends ethereum.Tuple { + get poll(): Address { + return this[0].toAddress(); + } + + get messageProcessor(): Address { + return this[1].toAddress(); + } + + get tally(): Address { + return this[2].toAddress(); + } + + get subsidy(): Address { + return this[3].toAddress(); + } +} + +export class SetMaciInstanceCall extends ethereum.Call { + get inputs(): SetMaciInstanceCall__Inputs { + return new SetMaciInstanceCall__Inputs(this); + } + + get outputs(): SetMaciInstanceCall__Outputs { + return new SetMaciInstanceCall__Outputs(this); + } +} + +export class SetMaciInstanceCall__Inputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } + + get _maci(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetMaciInstanceCall__Outputs { + _call: SetMaciInstanceCall; + + constructor(call: SetMaciInstanceCall) { + this._call = call; + } +} + export class SubmitMessageBatchCall extends ethereum.Call { get inputs(): SubmitMessageBatchCall__Inputs { return new SubmitMessageBatchCall__Inputs(this); @@ -777,7 +1319,7 @@ export class SubmitMessageBatchCall__Outputs { } export class SubmitMessageBatchCall_messagesStruct extends ethereum.Tuple { - get iv(): BigInt { + get msgType(): BigInt { return this[0].toBigInt(); } @@ -796,6 +1338,40 @@ export class SubmitMessageBatchCall_encPubKeysStruct extends ethereum.Tuple { } } +export class TopupCall extends ethereum.Call { + get inputs(): TopupCall__Inputs { + return new TopupCall__Inputs(this); + } + + get outputs(): TopupCall__Outputs { + return new TopupCall__Outputs(this); + } +} + +export class TopupCall__Inputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } + + get stateIndex(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TopupCall__Outputs { + _call: TopupCall; + + constructor(call: TopupCall) { + this._call = call; + } +} + export class TransferOwnershipCall extends ethereum.Call { get inputs(): TransferOwnershipCall__Inputs { return new TransferOwnershipCall__Inputs(this); @@ -842,16 +1418,46 @@ export class WithdrawContributionCall__Inputs { constructor(call: WithdrawContributionCall) { this._call = call; } +} + +export class WithdrawContributionCall__Outputs { + _call: WithdrawContributionCall; + + constructor(call: WithdrawContributionCall) { + this._call = call; + } +} + +export class WithdrawContributionsCall extends ethereum.Call { + get inputs(): WithdrawContributionsCall__Inputs { + return new WithdrawContributionsCall__Inputs(this); + } + + get outputs(): WithdrawContributionsCall__Outputs { + return new WithdrawContributionsCall__Outputs(this); + } +} + +export class WithdrawContributionsCall__Inputs { + _call: WithdrawContributionsCall; + + constructor(call: WithdrawContributionsCall) { + this._call = call; + } get _contributors(): Array
{ return this._call.inputValues[0].value.toAddressArray(); } } -export class WithdrawContributionCall__Outputs { - _call: WithdrawContributionCall; +export class WithdrawContributionsCall__Outputs { + _call: WithdrawContributionsCall; - constructor(call: WithdrawContributionCall) { + constructor(call: WithdrawContributionsCall) { this._call = call; } + + get result(): Array { + return this._call.outputValues[0].value.toBooleanArray(); + } } diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index 3465701bb..557be3f86 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -172,6 +172,7 @@ type Contribution @entity { voiceCredits: BigInt createdAt: String + lastUpdatedAt: String } type Vote @entity { diff --git a/subgraph/src/FundingRoundMapping.ts b/subgraph/src/FundingRoundMapping.ts index 6cd951ed2..765cbd59b 100644 --- a/subgraph/src/FundingRoundMapping.ts +++ b/subgraph/src/FundingRoundMapping.ts @@ -1,4 +1,4 @@ -import { BigInt, log, store } from '@graphprotocol/graph-ts' +import { BigInt, log, store, ethereum } from '@graphprotocol/graph-ts' import { Contribution, ContributionWithdrawn, @@ -7,6 +7,7 @@ import { TallyPublished, RegisterCall, Voted, + Topup, FundingRound as FundingRoundContract, } from '../generated/templates/FundingRound/FundingRound' import { OptimisticRecipientRegistry as RecipientRegistryContract } from '../generated/templates/FundingRound/OptimisticRecipientRegistry' @@ -135,6 +136,7 @@ export function handleContributionWithdrawn( BigInt.fromI32(1) ) fundingRound.lastUpdatedAt = timestamp + fundingRound.save() } export function handleFundsClaimed(event: FundsClaimed): void { @@ -223,3 +225,25 @@ export function handleVoted(event: Voted): void { } vote.save() } + +export function handleTopup(event: Topup): void { + log.info('handleTopup', []) + let timestamp = event.block.timestamp.toString() + let fundingRoundId = event.address.toHexString() + let fundingRoundContract = FundingRoundContract.bind(event.address) + let contributorAddress = event.params._sender + let contributorId = contributorAddress.toHexString() + let contributionId = fundingRoundId + .concat('-contribution-') + .concat(contributorId) + let contribution = new FundingRoundContribution(contributionId) + let contributor = fundingRoundContract.contributors(event.params._sender) + contribution.amount = contributor.getAmount() + let data = ethereum.encode(ethereum.Value.fromAddress(event.params._sender))! + contribution.voiceCredits = fundingRoundContract.getVoiceCredits( + event.params._sender, + data + ) + contribution.lastUpdatedAt = timestamp + contribution.save() +} diff --git a/subgraph/subgraph.template.yaml b/subgraph/subgraph.template.yaml index 1b8bf245b..c0b98a9d0 100644 --- a/subgraph/subgraph.template.yaml +++ b/subgraph/subgraph.template.yaml @@ -118,6 +118,8 @@ templates: handler: handleTallyPublished - event: Voted(indexed address) handler: handleVoted + - event: Topup(indexed address,uint256) + handler: handleTopup file: ./src/FundingRoundMapping.ts - name: OptimisticRecipientRegistry kind: ethereum/contract diff --git a/subgraph/subgraph.yaml b/subgraph/subgraph.yaml index 0a5b17677..5eaf6e54e 100644 --- a/subgraph/subgraph.yaml +++ b/subgraph/subgraph.yaml @@ -118,6 +118,8 @@ templates: handler: handleTallyPublished - event: Voted(indexed address) handler: handleVoted + - event: Topup(indexed address,uint256) + handler: handleTopup file: ./src/FundingRoundMapping.ts - name: OptimisticRecipientRegistry kind: ethereum/contract diff --git a/vue-app/src/components/Cart.vue b/vue-app/src/components/Cart.vue index 08f77b294..9b4254818 100644 --- a/vue-app/src/components/Cart.vue +++ b/vue-app/src/components/Cart.vue @@ -21,7 +21,6 @@
{{ $t('cart.div1') }} - {{ $t('cart.link1') }}
{{ $t('cart.div2') }} @@ -99,10 +98,10 @@ {{ $t('cart.span1') }} {{ formatAmount(contribution) }} {{ tokenSymbol }}
-
+
{{ $t('cart.span2') }}
- ⚠️{{ formatAmount(getCartTotal(cart)) }} + {{ formatAmount(getCartTotal(cart)) }} {{ tokenSymbol }}
@@ -116,11 +115,7 @@ + {{ formatAmount(contribution - getTotal()) }} {{ tokenSymbol }}
-