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

Static site after finalize #613

Merged
merged 66 commits into from
Jan 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
1863b1b
script to fetch round information
yuetloo Dec 15, 2022
7b91f1e
round static data
yuetloo Dec 15, 2022
325e3f1
fix error when endBlock is not provided
yuetloo Dec 15, 2022
572ba0a
refactor script to pull historical round data
yuetloo Dec 19, 2022
d27dbb9
refactor fetchRound
yuetloo Dec 20, 2022
572f4bc
handle file not found error
yuetloo Dec 20, 2022
a9a5d8c
Merge remote-tracking branch 'origin/develop' into feat/static-leader…
yuetloo Dec 20, 2022
5684fb2
allow previous rounds to be displayed using static JSON data
yuetloo Dec 2, 2022
f897521
remove unused imports
yuetloo Dec 30, 2022
26c18fa
fix error about tally can be null
yuetloo Dec 30, 2022
67e5d42
only show links if available
yuetloo Dec 31, 2022
8e961b1
add getProjects
yuetloo Dec 31, 2022
7ea2f0e
fix build error caused by console.error
yuetloo Dec 31, 2022
b36a723
app loads based on round status
yuetloo Jan 4, 2023
9617610
remove unused import
yuetloo Jan 4, 2023
d289295
get current round from subgraph
yuetloo Jan 4, 2023
2803736
remove unused import
yuetloo Jan 4, 2023
50e4168
assign default matching pool size if missing
yuetloo Jan 4, 2023
a04635e
add menu item for rounds
yuetloo Jan 4, 2023
0d71219
add comment to tell vue-i18n-extract about dynamic key
yuetloo Jan 4, 2023
150051a
throw if missing critical information
yuetloo Jan 6, 2023
6051c91
remove const warning
yuetloo Jan 6, 2023
c689129
add token info to factory and funding round
yuetloo Jan 6, 2023
fec277e
add token ABI
yuetloo Jan 6, 2023
5496cb0
wait for round information to load before rendering
yuetloo Jan 6, 2023
a665c47
add tokenInfo to subgraph
yuetloo Jan 6, 2023
4933bf2
add missing mapping for token address
yuetloo Jan 6, 2023
48c1bcf
use etherscan api from hardhat config and throw on missing critical i…
yuetloo Jan 6, 2023
1359413
add script to generate the subgraph uml file
yuetloo Jan 6, 2023
3c8eca8
add script to generate the subgraph uml file
yuetloo Jan 6, 2023
c1f8c01
added nativeTokenInfo to factory and round
yuetloo Jan 6, 2023
349978d
code refracting to read from subgraph instead of contract and update …
yuetloo Jan 6, 2023
35ff7c4
refactor get maci info
yuetloo Jan 7, 2023
a880692
redirect to project lists if cannot show leaderboard view
yuetloo Jan 7, 2023
843090a
subgraph query keys are lowercase
yuetloo Jan 7, 2023
b28e879
more project details from newer rounds
yuetloo Jan 7, 2023
bf6ba69
fix missing translation keys
yuetloo Jan 7, 2023
a07ad5f
remove unused imports and variables
yuetloo Jan 7, 2023
6926701
revert back to local time to match maci timestamp
yuetloo Jan 9, 2023
72f0c30
styling leaderboard for light mode
yuetloo Jan 9, 2023
ca8ebf0
load tally file if not loaded already
yuetloo Jan 9, 2023
af4c2ee
only show image on desktop
yuetloo Jan 10, 2023
b766be2
contract address can be different case if read from subgraph
yuetloo Jan 10, 2023
25606d0
script to merge allocations for cancelled round
yuetloo Jan 10, 2023
71dfbad
refactor code
yuetloo Jan 10, 2023
9518da0
show leaderboard page for cancelled rounds if allocations were issued
yuetloo Jan 10, 2023
8cddc95
show the claim amount even for cancelled rounds
yuetloo Jan 10, 2023
386f9ea
fix eslint warning
yuetloo Jan 10, 2023
849012d
add blog url to round
yuetloo Jan 11, 2023
f4d2d27
use default link color
yuetloo Jan 11, 2023
eb65e8b
cleanup unused environment vars
yuetloo Jan 11, 2023
bc1e81f
add messages and max messages to static round data to avoid showing n…
yuetloo Jan 11, 2023
625974b
Merge branch 'develop' into feat/static-leaderboard
yuetloo Jan 11, 2023
ed97467
set totalSpent from tally file if not available from the contract
yuetloo Jan 11, 2023
1a1f946
get proof file for debugging
yuetloo Jan 12, 2023
97a5b80
export key before running test
yuetloo Jan 12, 2023
ebacd56
disable known host check
yuetloo Jan 12, 2023
3d79860
use openssl to export key
yuetloo Jan 12, 2023
f0fb469
another export
yuetloo Jan 12, 2023
438a159
cleanup test file
yuetloo Jan 12, 2023
e48fec4
try export key again
yuetloo Jan 12, 2023
5c74bb9
revert changes
yuetloo Jan 12, 2023
b584b2b
remove the push trigger on test-e2e.yml
yuetloo Jan 13, 2023
bdd4f28
update round information review url
yuetloo Jan 13, 2023
82deb31
updated leaderboard heading
yuetloo Jan 13, 2023
98a39cf
updated leaderboard notice
yuetloo Jan 13, 2023
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
Prev Previous commit
Next Next commit
code refracting to read from subgraph instead of contract and update …
…readme with instructions to enable leaderboard view
yuetloo committed Jan 6, 2023

Verified

This commit was signed with the committer’s verified signature.
yuetloo yuetloo
commit 349978d92ad25d7b83ba1418bf15440fd1fbd7a8
21 changes: 21 additions & 0 deletions docs/tally-verify.md
Original file line number Diff line number Diff line change
@@ -233,6 +233,27 @@ From the clrfund contracts folder, run the following command to verify the resul
yarn ts-node scripts/verify.ts tally.json
```

# How to enable the leaderboard view

After finalizing the round, enable the leaderboard view in the vue-app as follow:

1) Set the etherscan API key in the hardhat.config.ts file in the contracts folder
2) Export the round and tally result

```sh
cd contracts

yarn hardhat fetch-round --output-dir <output-directory> --network xdai --round-address <round address>

```

3) Upload the rounds.json and round data file somewhere accessible by the vue-app. For example, clr.fund currently stores them on the github repository: https://github.com/clrfund/rounds

4) Set the VUE_APP_STATIC_ROUNDS_BASE_URL environment variable in the vue-app folder to the location in previous step. For example:
```
VUE_APP_STATIC_ROUNDS_BASE_URL=https://raw.githubusercontent.com/clrfund/rounds/main/
```


## Troubleshooting
If you encountered `core dumped` while running the genProofs script as seen in this [issue](https://github.com/clrfund/monorepo/issues/383), make sure the files are not corrupted due to disk space issue, e.g. check file sizes, checksum, and missing files.
7 changes: 7 additions & 0 deletions subgraph/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[See the subgraph documentation](../docs/subgraph.md) for instructions on how to run the subgraph in your local environment.

Following UML diagram is generated using [graphqlviz](https://github.com/sheerun/graphqlviz)

```sh
cd subgraph
graphqlviz https://api.thegraph.com/subgraphs/name/clrfund/clrfund | dot -Tpng -o subgraphUML.png
```

![Subgraph UML](subgraphUML.png)
22 changes: 14 additions & 8 deletions vue-app/src/api/factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Contract } from 'ethers'
import { ERC20 } from './abi'
import { factory, provider } from './core'
import { BigNumber } from 'ethers'
import { factory } from './core'
import sdk from '@/graphql/sdk'

export interface Factory {
fundingRoundAddress: string
@@ -11,13 +11,19 @@ export interface Factory {
}

export async function getFactoryInfo() {
const nativeTokenAddress = await factory.nativeToken()
const { fundingRoundFactory } = await sdk.GetFactoryInfo({
factoryAddress: factory.address.toLowerCase(),
})

const nativeToken = new Contract(nativeTokenAddress, ERC20, provider)
const nativeTokenSymbol = await nativeToken.symbol()
const nativeTokenDecimals = await nativeToken.decimals()
const nativeTokenAddress = fundingRoundFactory?.nativeTokenInfo?.tokenAddress

const userRegistryAddress = await factory.userRegistry()
const nativeTokenSymbol = fundingRoundFactory?.nativeTokenInfo?.symbol
const decimals = BigNumber.from(
fundingRoundFactory?.nativeTokenInfo?.decimals || 0
)
const nativeTokenDecimals = decimals.toNumber()

const userRegistryAddress = fundingRoundFactory?.contributorRegistryAddress

return {
fundingRoundAddress: factory.address,
14 changes: 0 additions & 14 deletions vue-app/src/api/projects.ts
Original file line number Diff line number Diff line change
@@ -45,20 +45,6 @@ export interface Project {
extra?: any // Registry-specific data
}

//TODO: update anywhere this is called to take factory address as a parameter
//NOTE: why isn't this included in the vuex state schema?
export async function getRecipientRegistryAddress(
roundAddress: string | null
): Promise<string> {
if (roundAddress !== null) {
const fundingRound = new Contract(roundAddress, FundingRound, provider)
return await fundingRound.recipientRegistry()
} else {
//TODO: upgrade factory to take it's address as a parameter
return await factory.recipientRegistry()
}
}

export async function getProjects(
registryAddress: string,
startTime?: number,
32 changes: 27 additions & 5 deletions vue-app/src/api/recipient-registry-optimistic.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ import { Recipient } from '@/graphql/API'
import { hasDateElapsed } from '@/utils/dates'

export interface RegistryInfo {
registryAddress: string
deposit: BigNumber
depositToken: string
challengePeriodDuration: number
@@ -25,15 +26,36 @@ export interface RegistryInfo {
}

export async function getRegistryInfo(
registryAddress: string
): Promise<RegistryInfo> {
factoryAddress: string
): Promise<RegistryInfo | null> {
const { fundingRoundFactory } = await sdk.GetRecipientRegistryInfo({
factoryAddress: factoryAddress.toLowerCase(),
})

if (!fundingRoundFactory) {
return null
}

const recipientRegistry = fundingRoundFactory.currentRound
? fundingRoundFactory.currentRound.recipientRegistry
: fundingRoundFactory.recipientRegistry

if (!recipientRegistry) {
return null
}

const registryAddress = recipientRegistry.id
const owner = recipientRegistry.owner
const deposit = BigNumber.from(recipientRegistry.baseDeposit || 0)
const challengePeriodDuration = BigNumber.from(
recipientRegistry.challengePeriodDuration || 0
)

const registry = new Contract(
registryAddress,
OptimisticRecipientRegistry,
provider
)
const deposit = await registry.baseDeposit()
const challengePeriodDuration = await registry.challengePeriodDuration()
let recipientCount
try {
recipientCount = await registry.getRecipientCount()
@@ -43,8 +65,8 @@ export async function getRegistryInfo(
// used during current round for space calculation
recipientCount = BigNumber.from(0)
}
const owner = await registry.owner()
return {
registryAddress,
deposit,
depositToken: chain.currency,
challengePeriodDuration: challengePeriodDuration.toNumber(),
8 changes: 5 additions & 3 deletions vue-app/src/api/round-base.ts
Original file line number Diff line number Diff line change
@@ -25,10 +25,12 @@ export abstract class BaseRound {
}

abstract getTokenInfo(): Promise<Token>
abstract getRoundInfo(cachedRound?: RoundInfo): Promise<RoundInfo>
abstract getLeaderboardProjects(): Promise<LeaderboardProject[]>
abstract getRoundInfo(cachedRound?: RoundInfo): Promise<RoundInfo | null>
abstract getLeaderboardProjects(): LeaderboardProject[] | null
abstract getProject(projectId: string): Promise<Project | null>
abstract getProjects(): Promise<Project[]>
abstract getAllocatedAmount(projectId: string): Promise<BigNumber | null>
abstract getAllocatedAmountByProjectIndex(
projectIndex: number
): Promise<BigNumber | null>
abstract getTally(): Promise<Tally | null>
}
Loading