Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/metadata #461

Draft
wants to merge 109 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
50d417b
create panel component shared by project list and metadata list
yuetloo Feb 24, 2022
bac2f47
refactoring, move recipient data definition out of optimistic registry
yuetloo Feb 24, 2022
576e574
fix warning on modifying props
yuetloo Feb 24, 2022
619fd08
initial work for metadata registry integration
yuetloo Feb 24, 2022
8cb7838
new configurations for metadata registry
yuetloo Feb 25, 2022
9348e66
add universal recipient registry
yuetloo Mar 1, 2022
b9c4f5a
subgraph mapping for universal recipient registry
yuetloo Mar 1, 2022
a78a430
restore file
yuetloo Mar 1, 2022
320b247
revert changes to contracts/tests/recipientRegistry.ts
yuetloo Mar 1, 2022
b24bda3
add missing routes after rebase
yuetloo Mar 2, 2022
203056e
handle undefined skipExecution
yuetloo Mar 3, 2022
fadca62
saving temporary changes
yuetloo Mar 6, 2022
7491ec7
revert metadataId back to stirng
yuetloo Mar 6, 2022
aeb8307
disable vscode reformat let to const in subgraph mapping
yuetloo Mar 7, 2022
e666231
git ignore generated subgraph files
yuetloo Mar 7, 2022
f32ac7b
reorganized recipient registry files
yuetloo Mar 7, 2022
31272d7
added SimpleRecipientRegistry and KlerosRecipientRegistry mapping
yuetloo Mar 7, 2022
b4710b0
added SimpleRecipientRegistry and KlerosRecipientRegistry mapping
yuetloo Mar 7, 2022
820314c
added SimpleRecipientRegistry and KlerosRecipientRegistry mapping
yuetloo Mar 7, 2022
64d85ed
added SimpleRecipientRegistry and KlerosRecipientRegistry mapping
yuetloo Mar 7, 2022
c1c5bec
fix formatting on spaces
yuetloo Mar 8, 2022
cc41872
disable warning for uninitialized property
yuetloo Mar 8, 2022
031b394
create recipient registry entity and template by registry type
yuetloo Mar 9, 2022
e59f499
UI changes to support different recipient registries
yuetloo Mar 10, 2022
a23b872
fix missing image and metadata for recipients from simple/kleros regi…
yuetloo Mar 10, 2022
e16198f
fix invalid address error due to kleros recipient registry missing owner
yuetloo Mar 11, 2022
a0021f0
missing project image for kleros project
yuetloo Mar 11, 2022
bb4878a
add recipient registry type
yuetloo Mar 14, 2022
5a2af9b
merge with generalized recipient registration branch
yuetloo Mar 16, 2022
2766b48
code refactoring to allow registry specific project information retri…
yuetloo Mar 17, 2022
90c0e8f
fix lint errors
yuetloo Mar 17, 2022
3afa810
no need to populate addresses and hit the blockchain as this informat…
yuetloo Mar 18, 2022
a2f6921
filter out metadata that were already registered as recipient to avoi…
yuetloo Mar 18, 2022
54c03b1
parse and encode receiving addresses in metadata
yuetloo Mar 23, 2022
3ee20a5
refactoring, add metadata result page, update only touched metadata f…
yuetloo Mar 29, 2022
f1f4a1b
add metadata transaction result view
yuetloo Mar 29, 2022
cbfd079
allow wallet to connect to user requested chain
yuetloo Mar 29, 2022
f6658f2
rename subgraphNetwork to chain.name
yuetloo Mar 29, 2022
cae72f4
add comment for chain.name
yuetloo Mar 29, 2022
1f4fb32
fix undefined error with adding and editing metadata
yuetloo Mar 30, 2022
dd8b0c3
ignore .env local files
yuetloo Mar 30, 2022
d301ae8
fix lint error
yuetloo Mar 30, 2022
d757af3
add script to deploy erc20 token
yuetloo Mar 30, 2022
004e87b
do not allow cross chain metadata update or delete
yuetloo Mar 31, 2022
f8f4945
fix stalling in metadata submission and added progress update
yuetloo Apr 1, 2022
9bd3743
fix edit link navigation
yuetloo Apr 1, 2022
46ee091
use metadata-composer v1.0.18
yuetloo Apr 1, 2022
322041f
Merge pull request #482 from clrfund/feature/metadata-filter
yuetloo Apr 1, 2022
1280433
Merge branch 'feature/metadata' into feature/metadata-address
yuetloo Apr 1, 2022
fd70ac1
revert changes
yuetloo Apr 1, 2022
cf9ea4f
Merge pull request #481 from clrfund/feature/metadata-address
yuetloo Apr 1, 2022
256b639
fix image validation
yuetloo Apr 1, 2022
347c910
fix missing recipient address error
yuetloo Apr 1, 2022
fd179b8
remove console log causing build to fail
yuetloo Apr 6, 2022
c853357
fix mobile mode missing finish button when submitting project
yuetloo Apr 7, 2022
380a1df
fix mobile stying issue with metadta viewer
yuetloo Apr 9, 2022
3900838
fix mobile styling in metadata viewer
yuetloo Apr 10, 2022
27affff
fix mobile styling in join form
yuetloo Apr 10, 2022
a4915dd
allow recipient registry admin page to load even when there's bad dat…
yuetloo Apr 13, 2022
849dc4f
remove unused parameter
yuetloo May 4, 2022
9f0331b
do not save email in metadata
yuetloo May 4, 2022
09d3975
check and filter metadata already added as project
yuetloo May 4, 2022
d249836
merged with develop branch
yuetloo Jun 15, 2022
7b54dcf
restoring subgraph.yaml to avoid failing build from the root of the r…
yuetloo Jun 22, 2022
ac29ade
replace @yuetloo/metadata-composer with @clrfund/metadata-composer
yuetloo Jun 22, 2022
13cf10f
do not load test recipients for universal recipient registry as bad m…
yuetloo Jun 22, 2022
0a3936d
merged with the develop branch
yuetloo Jul 14, 2022
5d07d96
Merge remote-tracking branch 'origin/develop' into feature/metadata
yuetloo Jul 14, 2022
7746bbb
refactoring
yuetloo Jul 20, 2022
6e06f87
refactor recipient submission ui
yuetloo Jul 20, 2022
5571c1c
add email field on the join form
yuetloo Jul 20, 2022
e2aae74
update state on navigate next
yuetloo Jul 20, 2022
e9a5ef4
fix chain short name
yuetloo Jul 20, 2022
4452285
format long error message
yuetloo Jul 20, 2022
1ae35ea
refactor to work with new form navigation flow
yuetloo Jul 20, 2022
262b9e8
refactor to work with new submission flow
yuetloo Jul 20, 2022
1dcbb56
remove obsolete code
yuetloo Jul 20, 2022
1113993
remove universal recipient registry
yuetloo Jul 20, 2022
9de0c0e
fix lint warning
yuetloo Jul 20, 2022
ad3d4dd
add validation rules to recipient submission form
yuetloo Jul 21, 2022
85a862a
update steps for form navigation
yuetloo Jul 21, 2022
c58b15c
move button to drop down menu
yuetloo Jul 21, 2022
da5a299
allow update fund receiving address on the current chain only
yuetloo Jul 22, 2022
ba0dd13
add metadata validation and code cleanup
yuetloo Jul 26, 2022
5adbf82
allow owner to add recipient for simple recipient type
yuetloo Jul 27, 2022
5667a5e
fix lint warning
yuetloo Jul 27, 2022
9ab7c5a
fix typo
yuetloo Aug 2, 2022
4673419
fix subgraph build warning
yuetloo Aug 2, 2022
efae44c
allow coordinator to add recipient for simple recipient registry
yuetloo Aug 2, 2022
a8fa9bd
fix lint warning
yuetloo Aug 2, 2022
ed17365
hide deposit information if deposit is not required
yuetloo Aug 2, 2022
85255b6
set challenge period and deposit to 0 for simple registry
yuetloo Aug 2, 2022
39fabbd
simplify code
yuetloo Aug 2, 2022
d35dc05
styling recipient submission widget
yuetloo Aug 2, 2022
82c061c
disable navigation if metadata is not selected
yuetloo Aug 2, 2022
39c4028
fix typo
yuetloo Aug 3, 2022
30f99af
refactor and do not show add project button for previous rounds
yuetloo Aug 3, 2022
cba88c8
css styling
yuetloo Aug 3, 2022
7e99883
make the metadata list in join form responsive
yuetloo Aug 3, 2022
8cb0661
change recipient menu dropdown icon to diamond and rearrange items
yuetloo Aug 4, 2022
d407850
use consistent environment variable prefix
yuetloo Aug 4, 2022
fb702be
add missing bannerImageHash
yuetloo Aug 4, 2022
6f332d0
allow simple recipient registry owner to remove recipient
yuetloo Aug 4, 2022
ee70287
update about recipient for simple recipient registry
yuetloo Aug 4, 2022
f80f857
Merge pull request #538 from clrfund/feature/simple-registry-changes
auryn-macmillan Aug 8, 2022
8915a0e
Merge pull request #539 from clrfund/feature/recipient-email
yuetloo Aug 11, 2022
835ae81
merge with develop branch
yuetloo Aug 17, 2022
7670e7a
merged with develop
yuetloo Aug 30, 2022
6c22435
do not ignore generated folder as they are used in build
yuetloo Aug 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ to run `yarn test` or `yarn test:contracts`.
- [Vue js modal](http://vue-js-modal.yev.io/)
- [Ethers](https://docs.ethers.io/v5/)
- [Gun](https://gun.eco/docs/)
- [GraphQL Code Generator](https://www.graphql-code-generator.com/docs/guides/vue) - used to generate the [/graphql/API.ts](https://github.com/clrfund/monorepo/blob/develop/vue-app/src/graphql/API.ts)

### Visual Studio Code

Expand Down
2 changes: 1 addition & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
overwrite: true
schema: 'http://localhost:8000/subgraphs/name/daodesigner/clrfund'
schema: 'https://api.thegraph.com/subgraphs/name/clrfund/clrfund'
documents: 'vue-app/src/graphql/**/*.graphql'
generates:
vue-app/src/graphql/API.ts:
Expand Down
1 change: 1 addition & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ state.json
proofs.json
tally.json
.env
.env.*
37 changes: 13 additions & 24 deletions contracts/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Contract, utils } from 'ethers'

import { UNIT } from '../utils/constants'
import { deployMaciFactory } from '../utils/deployment'
import { RecipientRegistryFactory } from '../utils/recipient-registry-factory'

async function main() {
const [deployer] = await ethers.getSigners()
Expand Down Expand Up @@ -59,30 +60,18 @@ async function main() {
await setUserRegistryTx.wait()

const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple'
let recipientRegistry: Contract
if (recipientRegistryType === 'simple') {
const SimpleRecipientRegistry = await ethers.getContractFactory(
'SimpleRecipientRegistry',
deployer
)
recipientRegistry = await SimpleRecipientRegistry.deploy(
fundingRoundFactory.address
)
} else if (recipientRegistryType === 'optimistic') {
const OptimisticRecipientRegistry = await ethers.getContractFactory(
'OptimisticRecipientRegistry',
deployer
)
recipientRegistry = await OptimisticRecipientRegistry.deploy(
UNIT.div(1000),
0,
fundingRoundFactory.address
)
} else {
throw new Error('unsupported recipient registry type')
}
await recipientRegistry.deployTransaction.wait()
console.log(`Recipient registry deployed: ${recipientRegistry.address}`)
const recipientRegistry = await RecipientRegistryFactory.deploy(
recipientRegistryType,
{
controller: fundingRoundFactory.address,
baseDeposit: UNIT.div(1000),
challengePeriodDuration: 0,
},
deployer
)
console.log(
`${recipientRegistryType} recipient registry deployed: ${recipientRegistry.address}`
)

const setRecipientRegistryTx = await fundingRoundFactory.setRecipientRegistry(
recipientRegistry.address
Expand Down
72 changes: 72 additions & 0 deletions contracts/scripts/deployRecipientRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { ethers } from 'hardhat'
import { UNIT } from '../utils/constants'
import { RecipientRegistryFactory } from '../utils/recipient-registry-factory'

/*
* Deploy a new recipient registry.
* The following environment variables must be set to run the script
*
* RECIPIENT_REGISTRY_TYPE - default is simple, values can be simple, optimistic
* FUNDING_ROUND_FACTORY_ADDRESS - address of the funding round factory
* WALLET_PRIVATE_KEY - private key of the account that will fund this transaction
* JSONRPC_HTTP_URL - URL to connect to the node
*
* For example, to run the script on rinkeby network:
* From the contracts folder:
* npx hardhat run --network rinkeby scripts/deployRecipientRegistry.ts
*
*/
async function main() {
const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple'
const fundingRoundFactoryAddress = process.env.FUNDING_ROUND_FACTORY_ADDRESS
let challengePeriodDuration = '0'
let baseDeposit = '0'

if (recipientRegistryType === 'optimistic') {
challengePeriodDuration = process.env.CHALLENGE_PERIOD_IN_SECONDS || '300'
baseDeposit = process.env.BASE_DEPOSIT || UNIT.div(10).toString()
}

if (!fundingRoundFactoryAddress) {
console.log('Environment variable FUNDING_ROUND_FACTORY_ADDRESS not set')
return
}
const fundingRoundFactory = await ethers.getContractAt(
'FundingRoundFactory',
fundingRoundFactoryAddress
)
const factoryOwner = await fundingRoundFactory.owner()

console.log('*******************')
console.log(`Deploying a new ${recipientRegistryType} recipient registry!`)
console.log(` challenge period in seconds: ${challengePeriodDuration}`)
console.log(` baseDeposit: ${baseDeposit}`)
console.log(` fundingRoundFactoryAddress: ${fundingRoundFactoryAddress}`)
console.log(` fundingRoundFactoryOwner: ${factoryOwner}`)
const [deployer] = await ethers.getSigners()

const recipientRegistry = await RecipientRegistryFactory.deploy(
recipientRegistryType,
{
controller: fundingRoundFactory.address,
baseDeposit,
challengePeriodDuration,
},
deployer
)
console.log(` recipientRegistry address: ${recipientRegistry.address}`)

const setRecipientRegistryTx = await fundingRoundFactory.setRecipientRegistry(
recipientRegistry.address
)

await setRecipientRegistryTx.wait()
console.log('*******************')
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
182 changes: 48 additions & 134 deletions contracts/scripts/deployRound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { Contract, utils } from 'ethers'
import { Keypair } from 'maci-domainobjs'

import { deployMaciFactory } from '../utils/deployment'
import { getEventArg } from '../utils/contracts'
import { MaciParameters } from '../utils/maci'
import { RecipientRegistryFactory } from '../utils/recipient-registry-factory'
import { RecipientRegistryLoader } from '../utils/recipient-registry-loader'

async function main() {
console.log('*******************')
Expand Down Expand Up @@ -63,30 +64,20 @@ async function main() {
await setUserRegistryTx.wait()

const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple'
let recipientRegistry: Contract
if (recipientRegistryType === 'simple') {
const SimpleRecipientRegistry = await ethers.getContractFactory(
'SimpleRecipientRegistry',
deployer
)
recipientRegistry = await SimpleRecipientRegistry.deploy(
fundingRoundFactory.address
)
} else if (recipientRegistryType === 'optimistic') {
const OptimisticRecipientRegistry = await ethers.getContractFactory(
'OptimisticRecipientRegistry',
deployer
)
recipientRegistry = await OptimisticRecipientRegistry.deploy(
ethers.BigNumber.from(10).pow(ethers.BigNumber.from(18)).div(10),
300,
fundingRoundFactory.address
)
} else {
throw new Error('unsupported recipient registry type')
}
await recipientRegistry.deployTransaction.wait()
console.log('recipientRegistry.address: ', recipientRegistry.address)
const recipientRegistry = await RecipientRegistryFactory.deploy(
recipientRegistryType,
{
controller: fundingRoundFactory.address,
baseDeposit: ethers.BigNumber.from(10)
.pow(ethers.BigNumber.from(18))
.div(10),
challengePeriodDuration: 300,
},
deployer
)
console.log(
`${recipientRegistryType} recipientRegistry address: ${recipientRegistry.address}`
)

const setRecipientRegistryTx = await fundingRoundFactory.setRecipientRegistry(
recipientRegistry.address
Expand Down Expand Up @@ -122,47 +113,6 @@ async function main() {
)
await setMaciParametersTx.wait()

const metadataRecipient1 = {
name: 'Commons Simulator',
description:
'Funding open-source projects & other public goods is the killer app of blockchain tech. Giveth & BlockScience are joining forces to build the Commons Stack: a modular library of well engineered components that can be used to create economic models for projects that are creating value, yet have trouble finding sustainable business models.',
imageHash: 'QmbMP2fMiy6ek5uQZaxG3bzT9gSqMWxpdCUcQg1iSeEFMU',
tagline: 'Modeling Sustainable Funding for Public Good',
category: 'Data',
problemSpace: 'metadata.problemSpace',
plans: 'metadata.plans',
teamName: 'metadata.teamName',
teamDescription: 'metadata.teamDescription',
githubUrl: 'https://github.com/',
radicleUrl: 'https://radicle.xyz/',
websiteUrl: 'https://website.com/',
twitterUrl: 'https://twitter.com/',
discordUrl: 'https://discord.com/',
bannerImageHash: 'QmaDy75RkRVtZcbYeqMDLcCK8dDvahfik68zP7FbpxvD2F',
thumbnailImageHash: 'QmaDy75RkRVtZcbYeqMDLcCK8dDvahfik68zP7FbpxvD2F',
}

const metadataRecipient2 = {
name: 'Synthereum',
description:
'The aim of our synthetic assets is to help creating fiat-based wallet and applications on any local currencies, and help to create stock, commodities portfolio in order to bring more traditional users within the DeFi ecosystem.',
imageHash: 'QmbMP2fMiy6ek5uQZaxG3bzT9gSqMWxpdCUcQg1iSeEFMU',
tagline:
'Synthetic assets with liquidity pools to bridge traditional and digital finance.',
category: 'Content',
problemSpace: 'metadata.problemSpace',
plans: 'metadata.plans',
teamName: 'metadata.teamName',
teamDescription: 'metadata.teamDescription',
githubUrl: 'https://github.com/',
radicleUrl: 'https://radicle.xyz/',
websiteUrl: 'https://website.com/',
twitterUrl: 'https://twitter.com/',
discordUrl: 'https://discord.com/',
bannerImageHash: 'QmaDy75RkRVtZcbYeqMDLcCK8dDvahfik68zP7FbpxvD2F',
thumbnailImageHash: 'QmaDy75RkRVtZcbYeqMDLcCK8dDvahfik68zP7FbpxvD2F',
}

const addFundingSourceTx = await fundingRoundFactory.addFundingSource(
deployer.address
)
Expand All @@ -172,79 +122,43 @@ async function main() {
const deployNewRoundTx = await fundingRoundFactory.deployNewRound()
await deployNewRoundTx.wait()

if (recipientRegistryType === 'simple') {
const recipients = [
{ account: deployer.address, metadata: metadataRecipient1 },
{ account: deployer.address, metadata: metadataRecipient2 },
]
let addRecipientTx
for (const recipient of recipients) {
addRecipientTx = await recipientRegistry.addRecipient(
deployer.address,
JSON.stringify(recipient.metadata)
)
addRecipientTx.wait()
}
} else if (recipientRegistryType === 'optimistic') {
const deposit = await recipientRegistry.baseDeposit()
const recipient1Added = await recipientRegistry.addRecipient(
deployer.address,
JSON.stringify(metadataRecipient1),
{ value: deposit }
)
await recipient1Added.wait()

const recipient1Id = await getEventArg(
recipient1Added,
recipientRegistry,
'RequestSubmitted',
'_recipientId'
)
const executeRequest1 = await recipientRegistry.executeRequest(recipient1Id)
await executeRequest1.wait()

const recipient2Added = await recipientRegistry.addRecipient(
deployer.address,
JSON.stringify(metadataRecipient2),
{ value: deposit }
)
await recipient2Added.wait()
const recipients = RecipientRegistryLoader.buildStubRecipients([
deployer.address,
deployer.address,
])

const recipient2Id = await getEventArg(
recipient2Added,
recipientRegistry,
'RequestSubmitted',
'_recipientId'
)
const executeRequest2 = await recipientRegistry.executeRequest(recipient2Id)
await executeRequest2.wait()
// add recipients to registry
await RecipientRegistryLoader.load(
recipientRegistryType,
recipientRegistry,
recipients
)

const fundingRoundAddress = await fundingRoundFactory.getCurrentRound()
console.log('fundingRound.address: ', fundingRoundAddress)
const fundingRoundAddress = await fundingRoundFactory.getCurrentRound()
console.log('fundingRound.address: ', fundingRoundAddress)

const fundingRound = await ethers.getContractAt(
'FundingRound',
fundingRoundAddress
const fundingRound = await ethers.getContractAt(
'FundingRound',
fundingRoundAddress
)
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
)
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('*******************')
console.log('Set user registration period', periodTx.hash)
await periodTx.wait()
}

console.log('*******************')
console.log('Deploy complete!')
console.log('*******************')
}

main()
Expand Down
Loading