Skip to content

Commit

Permalink
🪄 [QA] Update stage environments (#593)
Browse files Browse the repository at this point in the history
This is a pull request that upon merging will update stage environments
with recent `main` changes.
The environments that will be updated:
* Stage live: https://stage-live--taho-development.netlify.app/
* Stage fork: https://stage-fork--taho-development.netlify.app/

Read more: [Deployment to Production
Flow](https://github.com/tahowallet/dapp/blob/main/docs/testing-env.md)
  • Loading branch information
andreachapman authored Oct 31, 2023
2 parents b506c25 + 251d972 commit d66ed33
Show file tree
Hide file tree
Showing 16 changed files with 233 additions and 70 deletions.
1 change: 1 addition & 0 deletions .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ALLOW_TENDERLY_RESET="false"
ANALYTICS_ENV=DEV
POSTHOG_API_KEY=
# Misc
XP_HOSTING_BASE_URL="" # TBD
SEASON_LENGTH_IN_WEEKS=8
CONTRACT_DEPLOYMENT_BLOCK_NUMBER=553443
SEASON_START_DATE="2023-10-26"
Expand Down
51 changes: 51 additions & 0 deletions docs/xp-distribution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# XP distribution

### On chain allocation

Allocation is done using the script from the [contracts](https://github.com/tahowallet/contracts) repository, please use [documentation](https://github.com/tahowallet/contracts/blob/main/merkle/README.adoc) written for the script there. This documentation assumes you've already generated all the files and the drop already happened. The only thing left to do is to provide the dapp source merkle tree data for given allocation.

### Providing XP data in the dapp

1. In the `src/assets/xp-data.json` find out where is the folder for the realm that you did the XP drop on. Should be `assets/xp/<realm-name>/`

Update leaderboard

2. Copy the `leaderboard.json` file from `contracts` repo that was just created by the allocation script.

3. If we already had leaderbord file (`assets/xp/<realm-name>/leaderboard.json`) then let's replace the leaderboard file with the new one. Leaderboard data will sum xp amounts from previous drops so it should be replaced with updated data.

4. In the `src/assets/xp-data.json` make sure leaderboard file name got updated if needed. If this is the first drop on a given realm then please update it to (`leaderboard` field):
```json
"<realm-id>": {
"rootFolder": "/assets/xp/<realm-name>",
"claimsFolder": "/assets/xp/<realm-name>/claims",
"xpGlossary": [],
"leaderboard": "leaderboard.json"
},
```

Upload XP drop glossary

5. Copy the main file with XP drop data from the contracts. Make sure this is correct file - it should contain `glossary` field and `merkleDistributor`

6. Paste that file into `assets/xp/<realm-name>/` folder

7. Update `src/assets/xp-data.json` with the glossary file name (`xpGlossary` field). If this is first drop then the `xpGlossary` array will be empty, if not then add new file name to the end of the array. Each file is named with the merkle root value.
```json
"<realm-id>": {
"rootFolder": "/assets/xp/<realm-name>",
"claimsFolder": "/assets/xp/<realm-name>/claims",
"xpGlossary": ["0x<merkle-root>.json", "0x<merkle-root>.json"],
"leaderboard": "leaderboard.json"
},
```

Upload XP claim files

8. Copy all files from the `contracts` repo that were created in the `claims` folder for a given XP drop
9. Paste them into the `"src/assets/xp/<realm-name>/claims` folder. Don't remove existing files if this is not the first drop.
10. Look into the glossary file (`/assets/xp/<realm-name>/0x<merkle-root>.json`) and confirm it is referring to the same files you just pasted into the `claims` folder.

Testing

11. Run app locally or build it on Netlify PR preview to make sure you can see correct XP values in the claim banner and XP leaderboard. Confirm you are able to claim XP if possible on a given environment.
52 changes: 31 additions & 21 deletions src/assets/xp-data.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
{
"4": {
"xp": [],
"leaderboard": null
},
"7": {
"xp": [],
"leaderboard": null
},
"9": {
"xp": [],
"leaderboard": null
},
"19": {
"xp": [],
"leaderboard": null
},
"22": {
"xp": [],
"leaderboard": null
}
}
"4": {
"rootFolder": "/assets/xp/gitcoin",
"claimsFolder": "/assets/xp/gitcoin/claims",
"xpGlossary": [],
"leaderboard": null
},
"7": {
"rootFolder": "/assets/xp/cyberconnect",
"claimsFolder": "/assets/xp/cyberconnect/claims",
"xpGlossary": [],
"leaderboard": null
},
"9": {
"rootFolder": "/assets/xp/arbitrum",
"claimsFolder": "/assets/xp/arbitrum/claims",
"xpGlossary": [],
"leaderboard": null
},
"19": {
"rootFolder": "/assets/xp/galxe",
"claimsFolder": "/assets/xp/galxe/claims",
"xpGlossary": [],
"leaderboard": null
},
"22": {
"rootFolder": "/assets/xp/frax",
"claimsFolder": "/assets/xp/frax/claims",
"xpGlossary": [],
"leaderboard": null
}
}
File renamed without changes.
Empty file.
Empty file added src/assets/xp/frax/claims/.keep
Empty file.
Empty file.
Empty file.
17 changes: 13 additions & 4 deletions src/redux-state/thunks/island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ export const ensureAllowance = createDappAsyncThunk(
}
)

// Update on "parent transaction" to make it possible to track them together in the UI
dispatch(
updateTransactionStatus({
id,
status: receipt
? TransactionProgressStatus.Approved
: TransactionProgressStatus.Failed,
})
)
return !!receipt
}

Expand All @@ -209,7 +218,7 @@ export const stakeTaho = createDappAsyncThunk(
}: { id: string; realmContractAddress: string; amount: bigint },
{ dispatch, extra: { transactionService } }
) => {
const allowanceCorrect = await dispatch(
const { payload } = await dispatch(
ensureAllowance({
id,
tokenAddress: TAHO_ADDRESS,
Expand All @@ -218,7 +227,7 @@ export const stakeTaho = createDappAsyncThunk(
})
)

if (!allowanceCorrect) {
if (!payload) {
return false
}

Expand Down Expand Up @@ -252,7 +261,7 @@ export const unstakeTaho = createDappAsyncThunk(
},
{ dispatch, extra: { transactionService } }
) => {
const allowanceCorrect = await dispatch(
const { payload } = await dispatch(
ensureAllowance({
id,
tokenAddress: veTokenContractAddress,
Expand All @@ -261,7 +270,7 @@ export const unstakeTaho = createDappAsyncThunk(
})
)

if (!allowanceCorrect) {
if (!payload) {
return false
}

Expand Down
8 changes: 5 additions & 3 deletions src/shared/components/Transactions/TransactionProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ const statusToElementProps = [
id: "signing",
getLabel: (status: TransactionProgressStatus): string => {
if (status === TransactionProgressStatus.Approving) return "Approving"
if (status === TransactionProgressStatus.Approved) return "Signed"

return status === TransactionProgressStatus.Idle
? "Waiting for signature"
: "Signed"
if (status === TransactionProgressStatus.Signing)
return "Waiting for signature"

return "Signed"
},
getStatus: createGetStatusFunction(TransactionProgressStatus.Signing),
},
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants/external-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {
TWITTER: "https://twitter.com/taho_xyz",
GITHUB: "https://github.com/tahowallet/extension",
RULEBOOK: "https://docs.taho.xyz/app/",
WAITLIST: "https://tahobeta.deform.cc/portalopen",
WAITLIST: "https://tahobeta.deform.cc/november",
DOCS: "https://docs.taho.xyz/app/",
BRAVE_SUPPORT:
"https://support.brave.com/hc/en-us/articles/360023646212-How-do-I-configure-global-and-site-specific-Shields-settings-",
Expand Down
2 changes: 1 addition & 1 deletion src/shared/contracts/xp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const getUnclaimedXpDistributions: ReadTransactionBuilder<
},
UnclaimedXpData[]
> = async (provider, { realmId, account }) => {
const xpData = (await getXpDataForRealmId(realmId)) ?? []
const xpData = await getXpDataForRealmId(realmId, account)

const unclaimedOrNull = await Promise.all(
xpData.map<Promise<UnclaimedXpData | null>>(
Expand Down
1 change: 1 addition & 0 deletions src/shared/types/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ethers } from "ethers"
export enum TransactionProgressStatus {
Idle,
Approving,
Approved,
Signing,
Sending,
Done,
Expand Down
10 changes: 7 additions & 3 deletions src/shared/types/xp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ export type XpMerkleTreeItem = {
amount: string
proof: string[]
}
export type XpMerkleTreeClaims = {
[address: string]: XpMerkleTreeItem
}
export type XpMerkleTree = {
totalAmount: string
merkleRoot: string
merkleDistributor: string
claims: {
[address: string]: XpMerkleTreeItem
}
claims: XpMerkleTreeClaims
}
export type XpMerkleTreeGlossary = Omit<XpMerkleTree, "claims"> & {
glossary: { startAddress: string; file: string }[]
}
export type XpDistributor = {
distributorContractAddress: string
Expand Down
1 change: 1 addition & 0 deletions src/shared/utils/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TransactionProgressStatus } from "shared/types"
// eslint-disable-next-line import/prefer-default-export
export const isTransactionPending = (status: TransactionProgressStatus) =>
status === TransactionProgressStatus.Approving ||
status === TransactionProgressStatus.Approved ||
status === TransactionProgressStatus.Signing ||
status === TransactionProgressStatus.Sending

Expand Down
Loading

0 comments on commit d66ed33

Please sign in to comment.