-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #548 from madfish-solutions/v2.1.0
V2.1.0
- Loading branch information
Showing
288 changed files
with
9,388 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node: ['14.x'] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node ${{ matrix.node }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install deps and build (with cache) | ||
uses: bahmutov/npm-install@v1 | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Test | ||
run: yarn test --ci --coverage --maxWorkers=2 | ||
|
||
- name: Build | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
release: | ||
# This specifies that the build will be triggered when we publish a release | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# "ref" specifies the branch to check out. | ||
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted | ||
ref: ${{ github.event.release.target_commitish }} | ||
# Setup .npmrc file to publish to GitHub Packages | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
- run: yarn install | ||
- run: git config --global user.name "GitHub CD bot" | ||
- run: git config --global user.email "[email protected]" | ||
- run: yarn version --new-version ${{ github.event.release.tag_name }} | ||
- run: yarn build | ||
- run: git push | ||
env: | ||
# The secret is passed automatically. Nothing to configure. | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
# testing | ||
/coverage | ||
/src/coverage | ||
|
||
# next.js | ||
/.next/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
rootDir: './src' | ||
}; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"Farming Details": "Farming Details", | ||
"Value Locked": "Value Locked", | ||
"APR": "APR", | ||
"dailyApr": "Daily", | ||
"Current Delegate": "Current Delegate", | ||
"Next Delegate": "Next Delegate", | ||
"farmingEndsIn": "Ends in", | ||
"Lock Period": "Lock Period", | ||
"Withdrawal Fee": "Withdrawal Fee", | ||
"Interface Fee": "Interface Fee", | ||
"Token Contract": "Token Contract", | ||
"Farming Contract": "Farming Contract", | ||
"Harvest All": "Harvest all", | ||
"Your Claimed": "Your Claimed", | ||
"Your Claimable Rewards": "Your Claimable Rewards", | ||
"Harvest": "Harvest", | ||
"Earn extra income with QuipuSwap": "Earn extra income with QuipuSwap", | ||
"Connect Wallet now!": "Connect Wallet now!", | ||
"valueLockedTooltip": "Total amount of assets locked in the farm.", | ||
"dailyDistributionTooltip": "A portion of the farming rewards that can be claimed/compounded daily.", | ||
"aprTooltip": "Annual Percentage Rate. An estimation of the annual rate of return.", | ||
"dailyAprTooltip": "Daily rate of return as the percentage of your initial stake.", | ||
"currentDelegateTooltip": "The farm votes for this baker on the Dex pool with all deposited tokens.", | ||
"nextDelegateTooltip": "The next candidate to become the baker chosen and voted by the farm.", | ||
"farmingEndsInTooltip": "The amount of time until the current farming ends.", | ||
"lockPeriodTooltip": "The minimum amount of time locked assets can not be withdrawn. If withdrawn earlier, a withdrawal fee will be applied and some portion of deposited tokens along with all earned rewards.", | ||
"withdrawalFeeTooltip": "A fee incurred on withdrawal of assets from a running farm. The fee is charged from the deposit amount and is re-staked in the name of the farm, while accumulated rewards are exchanged to QUIPU and burnt.", | ||
"interfaceFeeTooltip": "Percentage of earned tokens charged for providing an interface.", | ||
"Back to the list": "Back to the list", | ||
"yourShareTooltip": "Current value of your stake in this farm.", | ||
"yourDelegateTooltip": "The baker you prefer to vote for with your tokens on the Dex to increase chances this baker will be chosen as the delegate for the pool.", | ||
"feeEndsInTooltip": "Countdown till the moment when the stake can be withdrawn without paying the withdrawal fee and without burning earned rewards.", | ||
"singleFarmRewardTooltip": "Your unclaimed farming reward from this farm.", | ||
"select": "Select", | ||
"fullCardTooltip": "Add Liquidity to the selected liquidity pool, stake liquidity tokens here, earn rewards.", | ||
"tokenContract": "Token Contract", | ||
"farmingContract": "Farming Contract", | ||
"tvl": "TVL", | ||
"tvlTooltip": "Total amount of assets locked in the farm.", | ||
"apr": "APR", | ||
"apy": "APY", | ||
"apyTooltip": "Annual Percentage Yield. An estimated annual compounded return — expected earnings if you reinvest the reward daily. APY is indicative and should not be used as a performance measure!", | ||
"yourBalance": "Your Balance", | ||
"yourBalanceTooltip": "The amount of corresponding tokens on your currently synced account.", | ||
"yourDeposit": "Your Deposit", | ||
"yourDepositTooltip": "The amount of corresponding tokens currently staked in this pool from your currently synced account.", | ||
"yourEarned": "Your Earned", | ||
"yourEarnedTooltip": "Your total farming earning in this farm.", | ||
"totalValueLocked": "Total Value Locked", | ||
"totalValueLockedTooltip": "Total value of assets locked across all farms.", | ||
"totalDailyReward": "Total Daily Reward", | ||
"totalDailyRewardTooltip": "Total amount of rewards generated in the last 24h.", | ||
"totalPendingReward": "Total Pending Reward", | ||
"totalPendingRewardTooltip": "Total amount of rewards that have not been claimed yet.", | ||
"totalClaimedReward": "Total Claimed Reward", | ||
"totalClaimedRewardTooltip": "Total amount of rewards collected by users so far.", | ||
"harvestAll": "Harvest All", | ||
"rewardsTooltip": "Your rewards that can be claimed now across all farms.", | ||
"stakedOnly": "Staked Only", | ||
"activeOnly": "Active Only", | ||
"balance": "Balance", | ||
"deposit": "Deposit", | ||
"earned": "Earned", | ||
"disabled": "Farming is finished! Please withdraw all your stake and rewards.", | ||
"pending": "Farming is paused!", | ||
"Failed to load farming": "Failed to load farming", | ||
"Daily Distribution": "Daily Distribution", | ||
"Your Share": "Your Share", | ||
"Your delegate": "Your delegate", | ||
"Lock period ends in": "Lock period ends in", | ||
"Stake": "Stake", | ||
"Unstake": "Unstake", | ||
"confirmationFirstStake": "This is the farm with lock period. You will need to wait {{days}} days {{hours}} hours to make the free withdrawal or pay {{persent}}% of your deposit and lose all your rewards if you decide to withdraw earlier.", | ||
"confirmationUpdateStake":"If you make the new stake, your lock countdown will be reset but all rewards will be saved. Your lock countdown ends in {{days}} days {{hours}} hours {{minutes}} minutes.", | ||
"confirmationUnstake": "If you make the withdrawal now, the {{persent}}% withdrawal fee will be charged from your deposit and all your rewards will be lost. You can wait {{days}} days {{hours}} hours to make the free withdrawal." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { FARMING_API_URL } from '@app.config'; | ||
import { FarmingItemResponse } from '@interfaces/farming.interfaces'; | ||
import { Nullable } from '@utils/types'; | ||
|
||
const FARMING_LIST_API_URL = `${FARMING_API_URL}/list`; | ||
|
||
export const getFarmingItemApi = async (farmingId: Nullable<BigNumber>) => { | ||
if (!farmingId) { | ||
throw new Error('Failed to get nullable farmingId'); | ||
} | ||
|
||
const response = await fetch(`${FARMING_LIST_API_URL}/${farmingId.toFixed()}`); | ||
|
||
const data = (await response.json()) as FarmingItemResponse; | ||
|
||
return data.item; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { TezosToolkit } from '@taquito/taquito'; | ||
|
||
import { getUserBalance } from '@api/get-user-balance'; | ||
import { FARMING_CONTRACT_ADDRESS, FARMING_API_URL } from '@app.config'; | ||
import { FarmingContractStorageWrapper } from '@interfaces/farming-contract.interface'; | ||
import { RawFarmingItem, FarmingListResponse } from '@interfaces/farming.interfaces'; | ||
import { bigNumberToString, isNull } from '@utils/helpers'; | ||
import { Nullable } from '@utils/types'; | ||
|
||
import { getUserFarmBalances } from './helpers'; | ||
|
||
const FARMING_LIST_API_URL = `${FARMING_API_URL}/list`; | ||
|
||
const farmingListFetch = async () => { | ||
const response = await fetch(FARMING_LIST_API_URL); | ||
const data = (await response.json()) as FarmingListResponse; | ||
|
||
return data.list; | ||
}; | ||
|
||
export interface UserBalances { | ||
myBalance: string; | ||
depositBalance?: string; | ||
earnBalance?: string; | ||
} | ||
|
||
const injectBalance = async (list: Array<RawFarmingItem>, accountPkh: string, tezos: TezosToolkit) => { | ||
const balances: Map<string, UserBalances> = new Map(); | ||
const wrapStorage = await ( | ||
await tezos.contract.at(FARMING_CONTRACT_ADDRESS) | ||
).storage<FarmingContractStorageWrapper>(); | ||
|
||
const storage = wrapStorage.storage; | ||
|
||
await Promise.all( | ||
list.map(async item => { | ||
const { stakedToken } = item; | ||
const { contractAddress, type, fa2TokenId } = stakedToken; | ||
|
||
const balanceBN = await getUserBalance(tezos, accountPkh, contractAddress, type, fa2TokenId); | ||
|
||
const balance = isNull(balanceBN) ? '0' : bigNumberToString(balanceBN); | ||
|
||
balances.set(item.id, { myBalance: balance }); | ||
}) | ||
); | ||
|
||
const userBalances = await getUserFarmBalances(accountPkh, storage, list); | ||
|
||
userBalances.forEach((userBalance, key) => { | ||
const balance = balances.get(key) as UserBalances; | ||
balances.set(key, { ...balance, ...userBalance }); | ||
}); | ||
|
||
return list.map(item => ({ ...item, ...balances.get(item.id) })); | ||
}; | ||
|
||
export const getFarmingListApi = async (accountPkh: Nullable<string>, tezos: Nullable<TezosToolkit>) => { | ||
const fetchResult = await farmingListFetch(); | ||
|
||
if (isNull(accountPkh) || isNull(tezos)) { | ||
return fetchResult; | ||
} else { | ||
return await injectBalance(fetchResult, accountPkh, tezos); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { FARMING_API_URL } from '@app.config'; | ||
import { FarmingStatsResponse } from '@interfaces/farming.interfaces'; | ||
|
||
const FARMING_STATS_API_URL = `${FARMING_API_URL}/stats`; | ||
|
||
export const getFarmingStatsApi = async () => { | ||
const response = await fetch(FARMING_STATS_API_URL); | ||
const data = (await response.json()) as FarmingStatsResponse; | ||
|
||
return data.stats; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TezosToolkit } from '@taquito/taquito'; | ||
import BigNumber from 'bignumber.js'; | ||
|
||
import { FARMING_CONTRACT_ADDRESS } from '@app.config'; | ||
import { FarmingStorage } from '@interfaces/farming-storage.interfaces'; | ||
import { getStorageInfo } from '@utils/dapp'; | ||
|
||
export const getUserFarmingDelegate = async (tezos: TezosToolkit, accountPkh: string, id: BigNumber) => { | ||
const { | ||
storage: { candidates } | ||
} = await getStorageInfo<FarmingStorage>(tezos, FARMING_CONTRACT_ADDRESS); | ||
|
||
return (await candidates.get<string>([id, accountPkh])) ?? null; | ||
}; |
Oops, something went wrong.
f401e62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
qs-ui-ithaca – ./
qs-ui-ithaca-quipuswap-v2-ui.vercel.app
qs-ui-ithaca.vercel.app
qs-ui-ithaca-git-main-quipuswap-v2-ui.vercel.app
f401e62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
qs-ui-hangzhou – ./
qs-ui-hangzhou-quipuswap-v2-ui.vercel.app
qs-main-hangzhou.vercel.app
qs-ui-hangzhou-git-main-quipuswap-v2-ui.vercel.app
hangzhounet.quipuswap.com