From 675e84adbcd9c74d3dca783854970dae330f0b8d Mon Sep 17 00:00:00 2001 From: yuetloo Date: Fri, 9 Sep 2022 13:17:53 -0400 Subject: [PATCH 1/5] Remove the timestamp check in BrightId user registry --- .../userRegistry/BrightIdUserRegistry.sol | 39 +---------- contracts/scripts/newRound.ts | 69 ++++++++++--------- 2 files changed, 37 insertions(+), 71 deletions(-) diff --git a/contracts/contracts/userRegistry/BrightIdUserRegistry.sol b/contracts/contracts/userRegistry/BrightIdUserRegistry.sol index 2b2e8ce1f..e47bfd059 100644 --- a/contracts/contracts/userRegistry/BrightIdUserRegistry.sol +++ b/contracts/contracts/userRegistry/BrightIdUserRegistry.sol @@ -12,18 +12,11 @@ contract BrightIdUserRegistry is Ownable, IUserRegistry { string private constant ERROR_INVALID_VERIFIER = 'INVALID VERIFIER'; string private constant ERROR_INVALID_CONTEXT = 'INVALID CONTEXT'; string private constant ERROR_INVALID_SPONSOR = 'INVALID SPONSOR'; - string private constant ERROR_INVALID_REGISTRATION_PERIOD = 'INVALID REGISTRATION PERIOD'; - string private constant ERROR_EXPIRED_VERIFICATION = 'EXPIRED VERIFICATION'; - string private constant ERROR_REGISTRATION_CLOSED = 'REGISTRATION CLOSED'; bytes32 public context; address public verifier; BrightIdSponsor public brightIdSponsor; - // Only register a verified user during this period - uint256 public registrationStartTime; - uint256 public registrationDeadline; - struct Verification { uint256 time; } @@ -32,7 +25,6 @@ contract BrightIdUserRegistry is Ownable, IUserRegistry { event SetBrightIdSettings(bytes32 context, address verifier); event Registered(address indexed addr, uint256 timestamp); - event RegistrationPeriodChanged(uint256 startTime, uint256 deadline); event SponsorChanged(address sponsor); /** @@ -83,19 +75,6 @@ contract BrightIdUserRegistry is Ownable, IUserRegistry { emit SponsorChanged(_sponsor); } - /** - * @notice Set the registration period for verified users - * @param _startTime Registration start time - * @param _deadline Registration deadline - */ - function setRegistrationPeriod(uint256 _startTime, uint256 _deadline) external onlyOwner { - require(_startTime <= _deadline, ERROR_INVALID_REGISTRATION_PERIOD); - - registrationStartTime = _startTime; - registrationDeadline = _deadline; - emit RegistrationPeriodChanged(_startTime, _deadline); - } - /** * @notice Check a user is verified or not * @param _user BrightID context id used for verifying users @@ -107,21 +86,7 @@ contract BrightIdUserRegistry is Ownable, IUserRegistry { returns (bool) { Verification memory verification = verifications[_user]; - return canRegister(verification.time); - } - - /** - * @notice check if the registry is open for registration - * @param _timestamp timestamp - */ - function canRegister(uint256 _timestamp) - public - view - returns (bool) - { - return _timestamp > 0 - && _timestamp >= registrationStartTime - && _timestamp < registrationDeadline; + return verification.time > 0; } /** @@ -145,8 +110,6 @@ contract BrightIdUserRegistry is Ownable, IUserRegistry { ) external { require(context == _context, ERROR_INVALID_CONTEXT); require(verifications[_addr].time < _timestamp, ERROR_NEWER_VERIFICATION); - require(canRegister(block.timestamp), ERROR_REGISTRATION_CLOSED); - require(canRegister(_timestamp), ERROR_EXPIRED_VERIFICATION); bytes32 message = keccak256(abi.encodePacked(_context, _addr, _verificationHash, _timestamp)); address signer = ecrecover(message, _v, _r, _s); diff --git a/contracts/scripts/newRound.ts b/contracts/scripts/newRound.ts index 7ba3466d7..f539b20d7 100644 --- a/contracts/scripts/newRound.ts +++ b/contracts/scripts/newRound.ts @@ -1,4 +1,5 @@ -import { ethers } from 'hardhat' +import { ethers, network } from 'hardhat' +import { Contract, utils } from 'ethers' async function main() { console.log('*******************') @@ -7,14 +8,13 @@ async function main() { const [deployer] = await ethers.getSigners() console.log('deployer.address: ', deployer.address) - const fundingRoundFactoryAddress = process.env.FUNDING_ROUND_FACTORY_ADDRESS + const fundingRoundFactoryAddress = process.env.FACTORY_ADDRESS const userRegistryType = process.env.USER_REGISTRY_TYPE if (!fundingRoundFactoryAddress) { - throw new Error( - 'Environment variable FUNDING_ROUND_FACTORY_ADDRESS is not setup' - ) + throw new Error('Environment variable FACTORY_ADDRESS is not setup') } + if (!userRegistryType) { throw new Error('Environment variable USER_REGISTRY_TYPE is not setup') } @@ -25,41 +25,44 @@ async function main() { ) console.log('funding round factory address ', factory.address) - const tx = await factory.deployNewRound() - console.log('deployNewRound tx hash: ', tx.hash) - await tx.wait() - - const fundingRoundAddress = await factory.getCurrentRound() - console.log('new funding round address: ', fundingRoundAddress) - - // for BrightId user registry, we need to activate the registry - // by setting the registration period to match maci signup period - if (userRegistryType === 'brightid') { - // get maci signup period - const fundingRound = await ethers.getContractAt( - 'FundingRound', - fundingRoundAddress + // check if the current round is finalized before starting a new round to avoid revert + const currentRoundAddress = await factory.getCurrentRound() + const currentRound = await ethers.getContractAt( + 'FundingRound', + currentRoundAddress + ) + const isFinalized = await currentRound.isFinalized() + if (!isFinalized) { + throw new Error( + 'Cannot start a new round as the current round is not finalized' ) - const maciAddress = await fundingRound.maci() - console.log('maci address: ', maciAddress) - const maci = await ethers.getContractAt('MACI', maciAddress) - const startTime = await maci.signUpTimestamp() - const endTime = await maci.calcSignUpDeadline() + } - // set user registration period - const userRegistryAddress = await fundingRound.userRegistry() - const userRegistry = await ethers.getContractAt( + // deploy a new BrightId user registry for each new round + if (userRegistryType === 'brightid') { + const BrightIdUserRegistry = await ethers.getContractFactory( 'BrightIdUserRegistry', - userRegistryAddress + deployer ) - const periodTx = await userRegistry.setRegistrationPeriod( - startTime, - endTime + const userRegistry = await BrightIdUserRegistry.deploy( + utils.formatBytes32String(process.env.BRIGHTID_CONTEXT || 'clr.fund'), + process.env.BRIGHTID_VERIFIER_ADDR, + process.env.BRIGHTID_SPONSOR + ) + console.log('BrightId user registry address: ', userRegistry.address) + await userRegistry.deployTransaction.wait() + + const setUserRegistryTx = await factory.setUserRegistry( + userRegistry.address ) - console.log('User registration period changed at', periodTx.hash) - await periodTx.wait() + await setUserRegistryTx.wait() + console.log('Set user registry in factory', setUserRegistryTx.hash) } + const tx = await factory.deployNewRound() + console.log('deployNewRound tx hash: ', tx.hash) + await tx.wait() + console.log('*******************') console.log('Script complete!') console.log('*******************') From d2bc8d385803015897f8703be9c9b9cbad2bc331 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Fri, 9 Sep 2022 13:59:12 -0400 Subject: [PATCH 2/5] fix brightId test cases --- contracts/tests/userRegistryBrightId.ts | 62 ++++--------------------- 1 file changed, 8 insertions(+), 54 deletions(-) diff --git a/contracts/tests/userRegistryBrightId.ts b/contracts/tests/userRegistryBrightId.ts index 5fc719b58..d92ed49fb 100644 --- a/contracts/tests/userRegistryBrightId.ts +++ b/contracts/tests/userRegistryBrightId.ts @@ -90,24 +90,6 @@ describe('BrightId User Registry', () => { ) }) - describe('registration period not set', () => { - it('rejects registration', async () => { - const timestamp = await getBlockTimestamp(provider) - const verification = generateVerification(user.address, timestamp) - await expect(register(registry, verification)).to.be.revertedWith( - 'REGISTRATION CLOSED' - ) - }) - it('isVerifiedUser returns false', async () => { - expect(await registry.isVerifiedUser(deployer.address)).to.equal(false) - }) - }) - - it('reject invalid registration period', async () => { - await expect(registry.setRegistrationPeriod(3, 2)).to.be.revertedWith( - 'INVALID REGISTRATION PERIOD' - ) - }) it('reject invalid verifier', async () => { await expect( registry.setSettings(context, ZERO_ADDRESS) @@ -131,38 +113,10 @@ describe('BrightId User Registry', () => { .withArgs(sponsor.address) }) - it('allows valid registration period', async () => { - await expect(registry.setRegistrationPeriod(1, 2)) - .to.emit(registry, 'RegistrationPeriodChanged') - .withArgs(1, 2) - }) - describe('registration', () => { let blockTimestamp: number - let invalidTimestamp: number - let deadline: number - beforeEach(async () => { - const blockNumber = await provider.getBlockNumber() - const block = await provider.getBlock(blockNumber) - invalidTimestamp = block.timestamp + 1 - const startTime = block.timestamp + 2 - blockTimestamp = block.timestamp + 5 - deadline = startTime + 500 - const tx = await registry.setRegistrationPeriod(startTime, deadline) - await tx.wait() - }) - - describe('canRegister', () => { - it('returns true for valid timestamp', async () => { - await expect(await registry.canRegister(blockTimestamp)).to.equal(true) - }) - - it('returns false for invalid timestamp', async () => { - await expect(await registry.canRegister(invalidTimestamp)).to.equal( - false - ) - }) + blockTimestamp = await getBlockTimestamp(provider) }) it('allows valid verified user to register', async () => { @@ -175,6 +129,13 @@ describe('BrightId User Registry', () => { expect(await registry.isVerifiedUser(user.address)).to.equal(true) }) + it('rejects verifications with 0 timestamp', async () => { + const verification = generateVerification(user.address, 0) + await expect(register(registry, verification)).to.be.revertedWith( + 'NEWER VERIFICATION REGISTERED BEFORE' + ) + }) + it('rejects older verifications', async () => { expect(await registry.isVerifiedUser(user.address)).to.equal(false) const oldTime = blockTimestamp @@ -201,13 +162,6 @@ describe('BrightId User Registry', () => { ) }) - it('rejects verifications after deadline', async () => { - const verification = generateVerification(user.address, deadline + 1) - await expect(register(registry, verification)).to.be.revertedWith( - 'EXPIRED VERIFICATION' - ) - }) - it('rejects invalid context', async () => { const verification = generateVerification(user.address, blockTimestamp) const tx = await registry.setSettings( From dc9e21609407c2043b764352910f50585abbfdbc Mon Sep 17 00:00:00 2001 From: yuetloo Date: Fri, 9 Sep 2022 16:19:22 -0400 Subject: [PATCH 3/5] add more checks before creating new round --- contracts/scripts/newRound.ts | 39 ++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/contracts/scripts/newRound.ts b/contracts/scripts/newRound.ts index f539b20d7..c35e083d6 100644 --- a/contracts/scripts/newRound.ts +++ b/contracts/scripts/newRound.ts @@ -1,5 +1,5 @@ -import { ethers, network } from 'hardhat' -import { Contract, utils } from 'ethers' +import { ethers } from 'hardhat' +import { utils, constants } from 'ethers' async function main() { console.log('*******************') @@ -10,6 +10,8 @@ async function main() { const fundingRoundFactoryAddress = process.env.FACTORY_ADDRESS const userRegistryType = process.env.USER_REGISTRY_TYPE + const brightIdSponsor = process.env.BRIGHTID_SPONSOR + const brightIdVerifier = process.env.BRIGHTID_VERIFIER_ADDR if (!fundingRoundFactoryAddress) { throw new Error('Environment variable FACTORY_ADDRESS is not setup') @@ -19,6 +21,17 @@ async function main() { throw new Error('Environment variable USER_REGISTRY_TYPE is not setup') } + if (userRegistryType === 'brightid') { + if (!brightIdSponsor) { + throw new Error('Environment variable BRIGHTID_SPONSOR is not setup') + } + if (!brightIdVerifier) { + throw new Error( + 'Environment variable BRIGHTID_VERIFIER_ADDR is not setup' + ) + } + } + const factory = await ethers.getContractAt( 'FundingRoundFactory', fundingRoundFactoryAddress @@ -27,15 +40,17 @@ async function main() { // check if the current round is finalized before starting a new round to avoid revert const currentRoundAddress = await factory.getCurrentRound() - const currentRound = await ethers.getContractAt( - 'FundingRound', - currentRoundAddress - ) - const isFinalized = await currentRound.isFinalized() - if (!isFinalized) { - throw new Error( - 'Cannot start a new round as the current round is not finalized' + if (currentRoundAddress !== constants.AddressZero) { + const currentRound = await ethers.getContractAt( + 'FundingRound', + currentRoundAddress ) + const isFinalized = await currentRound.isFinalized() + if (!isFinalized) { + throw new Error( + 'Cannot start a new round as the current round is not finalized' + ) + } } // deploy a new BrightId user registry for each new round @@ -46,8 +61,8 @@ async function main() { ) const userRegistry = await BrightIdUserRegistry.deploy( utils.formatBytes32String(process.env.BRIGHTID_CONTEXT || 'clr.fund'), - process.env.BRIGHTID_VERIFIER_ADDR, - process.env.BRIGHTID_SPONSOR + brightIdVerifier, + brightIdSponsor ) console.log('BrightId user registry address: ', userRegistry.address) await userRegistry.deployTransaction.wait() From 2be9ce785aa2f0c859e1ac39d8a711ef628c82e6 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Fri, 9 Sep 2022 16:21:42 -0400 Subject: [PATCH 4/5] add brightId sponsor to arbitrum rinkeby --- docs/brightid.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/brightid.md b/docs/brightid.md index 32943b475..03ea92188 100644 --- a/docs/brightid.md +++ b/docs/brightid.md @@ -20,10 +20,10 @@ Available envs: | Network/Env | Context | Sponsor Contract | | ----------- | ------- | ---------------- | -| goerli | clrfund-goerli | 0xF045234A776C87060DEEc5689056455A24a59c08 | -| xdai | clrfund-gnosis-chain |0x669A55Dd17a2f9F4dacC37C7eeB5Ed3e13f474f9| | arbitrum | clrfund-arbitrum |0x669A55Dd17a2f9F4dacC37C7eeB5Ed3e13f474f9| - +| arbitrum rinkeby | clrfund-arbitrum-rinkeby | 0xC7c81634Dac2de4E7f2Ba407B638ff003ce4534C | +| goerli | clrfund-goerli | 0xF045234A776C87060DEEc5689056455A24a59c08 | +| xdai | clrfund-gnosischain |0x669A55Dd17a2f9F4dacC37C7eeB5Ed3e13f474f9| ```.sh # /vue-app/.env From 767856b43dbd7d770354158254d2ac70b22be915 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Tue, 13 Sep 2022 11:30:10 -0400 Subject: [PATCH 5/5] remove setRegistrationPeriod from the BrightIdUserRegistry contract --- contracts/scripts/deployRound.ts | 12 -- contracts/scripts/deployTestRound.ts | 17 --- contracts/scripts/newRound.ts | 1 + subgraph/abis/BrightIdUserRegistry.json | 82 ------------ .../BrightIdUserRegistry.ts | 121 ------------------ .../BrightIdUserRegistry.ts | 121 ------------------ .../FundingRound/BrightIdUserRegistry.ts | 121 ------------------ 7 files changed, 1 insertion(+), 474 deletions(-) diff --git a/contracts/scripts/deployRound.ts b/contracts/scripts/deployRound.ts index ebd71e53d..545dad7eb 100644 --- a/contracts/scripts/deployRound.ts +++ b/contracts/scripts/deployRound.ts @@ -229,18 +229,6 @@ async function main() { const maciAddress = await fundingRound.maci() console.log('maci.address: ', maciAddress) - if (userRegistryType === 'brightid') { - const maci = await ethers.getContractAt('MACI', maciAddress) - const startTime = await maci.signUpTimestamp() - const endTime = await maci.calcSignUpDeadline() - const periodTx = await userRegistry.setRegistrationPeriod( - startTime, - endTime - ) - console.log('Set user registration period', periodTx.hash) - await periodTx.wait() - } - console.log('*******************') console.log('Deploy complete!') console.log('*******************') diff --git a/contracts/scripts/deployTestRound.ts b/contracts/scripts/deployTestRound.ts index e3b05c4e7..9e2f89fec 100644 --- a/contracts/scripts/deployTestRound.ts +++ b/contracts/scripts/deployTestRound.ts @@ -288,23 +288,6 @@ async function main() { const maciAddress = await fundingRound.maci() console.log(`MACI address: ${maciAddress}`) - if (userRegistryType === 'brightid') { - const userRegistryAddress = await fundingRound.userRegistry() - const userRegistry = await ethers.getContractAt( - 'BrightIdUserRegistry', - userRegistryAddress - ) - const maci = await ethers.getContractAt('MACI', maciAddress) - const startTime = await maci.signUpTimestamp() - const endTime = await maci.calcSignUpDeadline() - const periodTx = await userRegistry.setRegistrationPeriod( - startTime, - endTime - ) - console.log('Set user registration period', periodTx.hash) - await periodTx.wait() - } - const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple' const recipientRegistryAddress = await factory.recipientRegistry() if (recipientRegistryType === 'simple') { diff --git a/contracts/scripts/newRound.ts b/contracts/scripts/newRound.ts index c35e083d6..d5c3a666a 100644 --- a/contracts/scripts/newRound.ts +++ b/contracts/scripts/newRound.ts @@ -54,6 +54,7 @@ async function main() { } // deploy a new BrightId user registry for each new round + // to force users to link with BrightId every round if (userRegistryType === 'brightid') { const BrightIdUserRegistry = await ethers.getContractFactory( 'BrightIdUserRegistry', diff --git a/subgraph/abis/BrightIdUserRegistry.json b/subgraph/abis/BrightIdUserRegistry.json index d7a1b1e4c..abd728603 100644 --- a/subgraph/abis/BrightIdUserRegistry.json +++ b/subgraph/abis/BrightIdUserRegistry.json @@ -58,25 +58,6 @@ "name": "Registered", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "RegistrationPeriodChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -122,25 +103,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_timestamp", - "type": "uint256" - } - ], - "name": "canRegister", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "context", @@ -229,32 +191,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "registrationDeadline", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "registrationStartTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "renounceOwnership", @@ -262,24 +198,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_deadline", - "type": "uint256" - } - ], - "name": "setRegistrationPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { diff --git a/subgraph/generated/FundingRoundFactory/BrightIdUserRegistry.ts b/subgraph/generated/FundingRoundFactory/BrightIdUserRegistry.ts index 26a35e7b0..7d1e77f55 100644 --- a/subgraph/generated/FundingRoundFactory/BrightIdUserRegistry.ts +++ b/subgraph/generated/FundingRoundFactory/BrightIdUserRegistry.ts @@ -54,28 +54,6 @@ export class Registered__Params { } } -export class RegistrationPeriodChanged extends ethereum.Event { - get params(): RegistrationPeriodChanged__Params { - return new RegistrationPeriodChanged__Params(this); - } -} - -export class RegistrationPeriodChanged__Params { - _event: RegistrationPeriodChanged; - - constructor(event: RegistrationPeriodChanged) { - this._event = event; - } - - get startTime(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get deadline(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } -} - export class SetBrightIdSettings extends ethereum.Event { get params(): SetBrightIdSettings__Params { return new SetBrightIdSettings__Params(this); @@ -144,25 +122,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - canRegister(_timestamp: BigInt): boolean { - let result = super.call("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - - return result[0].toBoolean(); - } - - try_canRegister(_timestamp: BigInt): ethereum.CallResult { - let result = super.tryCall("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } - context(): Bytes { let result = super.call("context", "context():(bytes32)", []); @@ -216,52 +175,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - registrationDeadline(): BigInt { - let result = super.call( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationDeadline(): ethereum.CallResult { - let result = super.tryCall( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - registrationStartTime(): BigInt { - let result = super.call( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationStartTime(): ethereum.CallResult { - let result = super.tryCall( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - verifications(param0: Address): BigInt { let result = super.call( "verifications", @@ -419,40 +332,6 @@ export class RenounceOwnershipCall__Outputs { } } -export class SetRegistrationPeriodCall extends ethereum.Call { - get inputs(): SetRegistrationPeriodCall__Inputs { - return new SetRegistrationPeriodCall__Inputs(this); - } - - get outputs(): SetRegistrationPeriodCall__Outputs { - return new SetRegistrationPeriodCall__Outputs(this); - } -} - -export class SetRegistrationPeriodCall__Inputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } - - get _startTime(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _deadline(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class SetRegistrationPeriodCall__Outputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } -} - export class SetSettingsCall extends ethereum.Call { get inputs(): SetSettingsCall__Inputs { return new SetSettingsCall__Inputs(this); diff --git a/subgraph/generated/templates/BrightIdUserRegistry/BrightIdUserRegistry.ts b/subgraph/generated/templates/BrightIdUserRegistry/BrightIdUserRegistry.ts index 26a35e7b0..7d1e77f55 100644 --- a/subgraph/generated/templates/BrightIdUserRegistry/BrightIdUserRegistry.ts +++ b/subgraph/generated/templates/BrightIdUserRegistry/BrightIdUserRegistry.ts @@ -54,28 +54,6 @@ export class Registered__Params { } } -export class RegistrationPeriodChanged extends ethereum.Event { - get params(): RegistrationPeriodChanged__Params { - return new RegistrationPeriodChanged__Params(this); - } -} - -export class RegistrationPeriodChanged__Params { - _event: RegistrationPeriodChanged; - - constructor(event: RegistrationPeriodChanged) { - this._event = event; - } - - get startTime(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get deadline(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } -} - export class SetBrightIdSettings extends ethereum.Event { get params(): SetBrightIdSettings__Params { return new SetBrightIdSettings__Params(this); @@ -144,25 +122,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - canRegister(_timestamp: BigInt): boolean { - let result = super.call("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - - return result[0].toBoolean(); - } - - try_canRegister(_timestamp: BigInt): ethereum.CallResult { - let result = super.tryCall("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } - context(): Bytes { let result = super.call("context", "context():(bytes32)", []); @@ -216,52 +175,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - registrationDeadline(): BigInt { - let result = super.call( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationDeadline(): ethereum.CallResult { - let result = super.tryCall( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - registrationStartTime(): BigInt { - let result = super.call( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationStartTime(): ethereum.CallResult { - let result = super.tryCall( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - verifications(param0: Address): BigInt { let result = super.call( "verifications", @@ -419,40 +332,6 @@ export class RenounceOwnershipCall__Outputs { } } -export class SetRegistrationPeriodCall extends ethereum.Call { - get inputs(): SetRegistrationPeriodCall__Inputs { - return new SetRegistrationPeriodCall__Inputs(this); - } - - get outputs(): SetRegistrationPeriodCall__Outputs { - return new SetRegistrationPeriodCall__Outputs(this); - } -} - -export class SetRegistrationPeriodCall__Inputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } - - get _startTime(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _deadline(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class SetRegistrationPeriodCall__Outputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } -} - export class SetSettingsCall extends ethereum.Call { get inputs(): SetSettingsCall__Inputs { return new SetSettingsCall__Inputs(this); diff --git a/subgraph/generated/templates/FundingRound/BrightIdUserRegistry.ts b/subgraph/generated/templates/FundingRound/BrightIdUserRegistry.ts index 26a35e7b0..7d1e77f55 100644 --- a/subgraph/generated/templates/FundingRound/BrightIdUserRegistry.ts +++ b/subgraph/generated/templates/FundingRound/BrightIdUserRegistry.ts @@ -54,28 +54,6 @@ export class Registered__Params { } } -export class RegistrationPeriodChanged extends ethereum.Event { - get params(): RegistrationPeriodChanged__Params { - return new RegistrationPeriodChanged__Params(this); - } -} - -export class RegistrationPeriodChanged__Params { - _event: RegistrationPeriodChanged; - - constructor(event: RegistrationPeriodChanged) { - this._event = event; - } - - get startTime(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get deadline(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } -} - export class SetBrightIdSettings extends ethereum.Event { get params(): SetBrightIdSettings__Params { return new SetBrightIdSettings__Params(this); @@ -144,25 +122,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - canRegister(_timestamp: BigInt): boolean { - let result = super.call("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - - return result[0].toBoolean(); - } - - try_canRegister(_timestamp: BigInt): ethereum.CallResult { - let result = super.tryCall("canRegister", "canRegister(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(_timestamp) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } - context(): Bytes { let result = super.call("context", "context():(bytes32)", []); @@ -216,52 +175,6 @@ export class BrightIdUserRegistry extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } - registrationDeadline(): BigInt { - let result = super.call( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationDeadline(): ethereum.CallResult { - let result = super.tryCall( - "registrationDeadline", - "registrationDeadline():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - registrationStartTime(): BigInt { - let result = super.call( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - - return result[0].toBigInt(); - } - - try_registrationStartTime(): ethereum.CallResult { - let result = super.tryCall( - "registrationStartTime", - "registrationStartTime():(uint256)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - verifications(param0: Address): BigInt { let result = super.call( "verifications", @@ -419,40 +332,6 @@ export class RenounceOwnershipCall__Outputs { } } -export class SetRegistrationPeriodCall extends ethereum.Call { - get inputs(): SetRegistrationPeriodCall__Inputs { - return new SetRegistrationPeriodCall__Inputs(this); - } - - get outputs(): SetRegistrationPeriodCall__Outputs { - return new SetRegistrationPeriodCall__Outputs(this); - } -} - -export class SetRegistrationPeriodCall__Inputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } - - get _startTime(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _deadline(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class SetRegistrationPeriodCall__Outputs { - _call: SetRegistrationPeriodCall; - - constructor(call: SetRegistrationPeriodCall) { - this._call = call; - } -} - export class SetSettingsCall extends ethereum.Call { get inputs(): SetSettingsCall__Inputs { return new SetSettingsCall__Inputs(this);