Skip to content

Commit

Permalink
Merge pull request #1306 from madfish-solutions/v3.3.4
Browse files Browse the repository at this point in the history
v3.3.4
  • Loading branch information
keshan3262 authored Feb 8, 2023
2 parents f3f2e2a + 0c2fb92 commit 0b5c3b1
Show file tree
Hide file tree
Showing 171 changed files with 2,093 additions and 1,511 deletions.
5 changes: 2 additions & 3 deletions .env.ghostnet.pord
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ REACT_APP_TTDEX_CONTRACT=KT1PnmpVWmA5CBUsA5ZAx1HoDW67mPYurAL5
REACT_APP_FARMING_CONTRACT=KT1HXQcPhPtVWiU64X4WZG9dmRBhBAkAEfT1
REACT_APP_COINFLIP_CONTRACT=KT1LYJif66XPDGgvUZdnmdyorjEYHkT9pTs5
REACT_APP_STABLESWAP_FACTORY_CONTRACT_ADDRESS=KT1GjgXdwaMjjwXcS2JURcMA53WRq9qW1nZF
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1Vf8ELhJQtYJNjbiKxpQUxVWBkknFKRA7Q
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1RxBqWNcvWKcrVZWKS7PtjtPXfpnAkBHpF

#network and mode depends
#temple api
REACT_APP_TEMPLEWALLET_API_URL=https://temple-api-mainnet.prod.templewallet.com
REACT_APP_METADATA_API_URL=https://ghostnet-metadata.templewallet.com/metadata
REACT_APP_POOLS_URL=wss://tezos-dexes-api-ghostnet.stage.madservice.xyz/
#not production CHECK!
REACT_APP_POOLS_URL=wss://dexes-api-ghostnet.prod.templewallet.com/

#api
REACT_APP_FARMING_API_URL=https://quipuswap-staking-api-ithacanet.production.madservice.xyz
Expand Down
2 changes: 1 addition & 1 deletion .env.ghostnet.stage
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ REACT_APP_FARMING_CONTRACT=KT1HXQcPhPtVWiU64X4WZG9dmRBhBAkAEfT1
REACT_APP_COINFLIP_CONTRACT=KT1LYJif66XPDGgvUZdnmdyorjEYHkT9pTs5
REACT_APP_STABLESWAP_FACTORY_CONTRACT_ADDRESS=KT1GjgXdwaMjjwXcS2JURcMA53WRq9qW1nZF
REACT_APP_DEX_TWO_CONTRACT_ADDRESS=KT1GPJDTf8GZspCcanaG2KhMvGu3NJRqurat
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1Vf8ELhJQtYJNjbiKxpQUxVWBkknFKRA7Q
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1RxBqWNcvWKcrVZWKS7PtjtPXfpnAkBHpF

#network and mode depends
#temple api
Expand Down
1 change: 1 addition & 0 deletions .env.mainnet.prod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ REACT_APP_FARMING_CONTRACT=KT1RdoweZPFjttwMUsaTo1E2EWNX3WcR9nxZ
REACT_APP_COINFLIP_CONTRACT=#there no value yet
REACT_APP_STABLESWAP_FACTORY_CONTRACT_ADDRESS=KT1UPiYB4HrLFcHQ5tkjahGnDM55E8iEbNAx
REACT_APP_DEX_TWO_CONTRACT_ADDRESS=KT1J8Hr3BP8bpbfmgGpRPoC9nAMSYtStZG43
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1FHmV5axxEAZgWWT1pviR2VtrFkLDseg5g

#network and mode depends
#temple api
Expand Down
1 change: 1 addition & 0 deletions .env.mainnet.stage
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ REACT_APP_FARMING_CONTRACT=KT1RdoweZPFjttwMUsaTo1E2EWNX3WcR9nxZ
REACT_APP_COINFLIP_CONTRACT=#there no value yet
REACT_APP_STABLESWAP_FACTORY_CONTRACT_ADDRESS=KT1UPiYB4HrLFcHQ5tkjahGnDM55E8iEbNAx
REACT_APP_DEX_TWO_CONTRACT_ADDRESS=KT1J8Hr3BP8bpbfmgGpRPoC9nAMSYtStZG43
REACT_APP_DEX_V3_FACTORY_ADDRESS=KT1FHmV5axxEAZgWWT1pviR2VtrFkLDseg5g

#network and mode depends
#temple api
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quipuswap-webapp-2",
"version": "3.3.3",
"version": "3.3.4",
"private": true,
"scripts": {
"pre-build": "node -v && npm -v && yarn -v && node ./scripts/build.js",
Expand Down Expand Up @@ -58,7 +58,7 @@
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"quipuswap-v3-sdk": "^0.0.3",
"quipuswap-v3-sdk": "^0.0.5",
"react": "^18.1.0",
"react-countdown-hook": "^1.1.1",
"react-dom": "^18.1.0",
Expand All @@ -77,7 +77,7 @@
"reflect-metadata": "^0.1.13",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"swap-router-sdk": "^1.19.2",
"swap-router-sdk": "^1.21.1",
"swr": "^1.3.0",
"throttle-debounce": "^5.0.0",
"url": "^0.11.0",
Expand Down
4 changes: 2 additions & 2 deletions src/blockchain/get-user-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChainIds, TezosToolkit } from '@taquito/taquito';
import BigNumber from 'bignumber.js';
import memoizee from 'memoizee';

import { getReadOnlyTezos } from '@shared/dapp';
import { getContract, getReadOnlyTezos } from '@shared/dapp';
import { Standard, TokenId } from '@shared/types';

const loadChainId = memoizee(async (tezos: TezosToolkit) => tezos.rpc.getChainId(), {
Expand All @@ -21,7 +21,7 @@ export const getUserBalance = async (
if (contractAddress === 'tez') {
return newTezos.tz.getBalance(account);
}
const contract = await newTezos.contract.at(contractAddress);
const contract = await getContract(newTezos, contractAddress);

const chainId = (await loadChainId(newTezos)) as ChainIds;

Expand Down
2 changes: 2 additions & 0 deletions src/blockchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export * from './user-balances-subscription';
export * from './send-batch';
export * from './get-user-lp-balance-in-dex';
export * from './migrate-liquidity';
export * from './with-wtez-burn-on-output.api';
export * from './with-wtez-mint-on-input.api';
29 changes: 29 additions & 0 deletions src/blockchain/with-wtez-burn-on-output.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { TezosToolkit, TransferParams } from '@taquito/taquito';
import BigNumber from 'bignumber.js';

import { WTEZ_TOKEN } from '@config/tokens';
import { getContract } from '@shared/dapp';

import { sendBatch } from './send-batch';

export const getWithWtezBurnOnOutputParams = async (
tezos: TezosToolkit,
mutezAmount: BigNumber,
accountPkh: string,
operationParams: TransferParams[]
) => {
if (mutezAmount.isZero()) {
return operationParams;
}

const wTezContract = await getContract(tezos, WTEZ_TOKEN.contractAddress);

return operationParams.concat(wTezContract.methods.burn(accountPkh, accountPkh, mutezAmount).toTransferParams());
};

export const withWtezBurnOnOutput = async (
tezos: TezosToolkit,
mutezAmount: BigNumber,
accountPkh: string,
operationParams: TransferParams[]
) => await sendBatch(tezos, await getWithWtezBurnOnOutputParams(tezos, mutezAmount, accountPkh, operationParams));
31 changes: 31 additions & 0 deletions src/blockchain/with-wtez-mint-on-input.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { TezosToolkit, TransferParams } from '@taquito/taquito';
import BigNumber from 'bignumber.js';

import { WTEZ_TOKEN } from '@config/tokens';
import { getContract } from '@shared/dapp';

import { sendBatch } from './send-batch';

export const getWithWtezMintOnInputParams = async (
tezos: TezosToolkit,
mutezAmount: BigNumber,
accountPkh: string,
operationParams: TransferParams[]
) => {
if (mutezAmount.isZero()) {
return operationParams;
}

const wTezContract = await getContract(tezos, WTEZ_TOKEN.contractAddress);

return [
wTezContract.methods.mint(accountPkh).toTransferParams({ amount: mutezAmount.toNumber(), mutez: true })
].concat(operationParams);
};

export const withWtezMintOnInput = async (
tezos: TezosToolkit,
mutezAmount: BigNumber,
accountPkh: string,
operationParams: TransferParams[]
) => await sendBatch(tezos, await getWithWtezMintOnInputParams(tezos, mutezAmount, accountPkh, operationParams));
23 changes: 11 additions & 12 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import GhostnetWhitelistTokens from '@quipuswap/tokens-whitelist/tokens/quipuswa
import MainnetWhitelistTokens from '@quipuswap/tokens-whitelist/tokens/quipuswap.whitelist.json';

import { FarmVersion } from '@modules/farming/interfaces';
import { Categories, PoolType } from '@modules/liquidity/interfaces';
import { PoolType } from '@modules/liquidity/interfaces';
import { ConnectType, QSNetwork, QSNetworkType, SupportedNetworks } from '@shared/types';

import { NETWORK_ID, TEMPLEWALLET_API_URL, TZKT_API } from './environment';
Expand Down Expand Up @@ -54,6 +54,16 @@ const TOKENS_MAP = {
export const TOKENS = TOKENS_MAP[NETWORK_ID];
//#endregion TOKENS

export const TEZ_TOKEN_MAINNET_WHITELISTED_POOLS_ADDRESSES = [
'KT1K4EwTpbvYN9agJdjpyJm4ZZdhpUNKB3F6',
'KT1WxgZ1ZSfMgmsSDDcUn8Xn577HwnQ7e1Lb',
'KT1PL1YciLdwMbydt21Ax85iZXXyGSrKT2BE',
'KT1KFszq8UFCcWxnXuhZPUyHT9FK3gjmSKm6',
'KT1Ucg1fTZXBD8P426rTRXyu7YQUgYXV7RVu',
'KT1EtjRRCBC2exyCRXz8UfV7jz7svnkqi7di',
'KT1X3zxdTzPB9DgVzA3ad6dgZe9JEamoaeRy'
];

export const FACTORIES: Record<SupportedNetworks, { fa1_2Factory: string[]; fa2Factory: string[] }> = {
[NetworkType.MAINNET]: {
fa1_2Factory: ['KT1FWHLMk5tHbwuSsp31S4Jum4dTVmkXpfJw', 'KT1Lw8hCoaBrHeTeMXbqHPG4sS4K1xn7yKcD'],
Expand Down Expand Up @@ -118,14 +128,3 @@ export const HOT_POOLS: Array<{ id: string; type: PoolType }> = [
// Coinflip
export const COINFLIP_CONTRACT_DECIMALS = 18;
export const COINFLIP_TOKEN_DECIMALS = 6;

const MAINNET_LIQUIDITY_V3_POOL_TAGS: Record<number, Array<Categories>> = {};
const TESTNET_LIQUIDITY_V3_POOL_TAGS: Record<number, Array<Categories>> = {
0: [Categories.Stable, Categories.V3],
2: [Categories.Stable, Categories.QuipuSwap, Categories.V3]
};

export const LIQUIDITY_V3_POOL_TAGS = {
[NetworkType.MAINNET]: MAINNET_LIQUIDITY_V3_POOL_TAGS,
[NetworkType.GHOSTNET]: TESTNET_LIQUIDITY_V3_POOL_TAGS
};
5 changes: 5 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const SKIP = -1;
export const LIST = 'list';
export const STATS = 'stats';
export const DEX_TWO_ITEM = 'dex-two-item';
export const UNISWAP_ITEM = 'uniswap-item';
// TODO: change api address => change farm => dividends (if needed)
export const DIVIDENDS = 'farm';

Expand All @@ -118,6 +119,7 @@ export const STABLEDIVIDENDS_STATS_API_URL = `${STABLESWAP_API_URL}/${DIVIDENDS}
export const LIQUIDITY_LIST_API_URL = `${LIQUIDITY_API_URL}/${LIST}`;
export const LIQUIDITY_STATS_API_URL = `${LIQUIDITY_API_URL}/${STATS}`;
export const LIQUIDITY_DEX_TWO_ITEM_API_URL = `${LIQUIDITY_API_URL}/${DEX_TWO_ITEM}`;
export const LIQUIDITY_V3_ITEM_API_URL = `${LIQUIDITY_API_URL}/${UNISWAP_ITEM}`;
//#endregion

//TODO: assort mix
Expand Down Expand Up @@ -173,8 +175,11 @@ export const FARMING_FEES_PERCENTAGE_PRECISION = 16;
export const DEFAULT_TICK_SPACING = 1;
export const MIN_TICK_INDEX = -1048575;
export const MAX_TICK_INDEX = 1048575;
export const DEFAULT_EXTRA_SLOTS = 0;

export const NON_INTERACTIVE_ELEMENT_TAB_INDEX = -1;

export const DEFAULT_CATEGORY_ICON_SIZE = 24;
//#endregion

// error constant
Expand Down
25 changes: 25 additions & 0 deletions src/config/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ export const networksQuipuTokens: Record<SupportedNetworks, Token> = {

export const QUIPU_TOKEN = networksQuipuTokens[NETWORK_ID];

export const MAINNET_WTEZ_TOKEN: Token = {
type: Standard.Fa2,
contractAddress: 'KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b',
fa2TokenId: 0,
isWhitelisted: true,
metadata: {
decimals: 6,
symbol: 'wTEZ',
name: 'Wrapped Tezos FA2 token',
thumbnailUri: 'ipfs://QmUWhCYXtC8r8aXgjrwsLrZmopiGMHdLWoQzEueAktJbHB'
}
};

export const GHOSTNET_WTEZ_TOKEN: Token = {
...MAINNET_WTEZ_TOKEN,
contractAddress: 'KT1L8ujeb25JWKa4yPB61ub4QG2NbaKfdJDK'
};

export const networksWtezTokens: Record<SupportedNetworks, Token> = {
[NetworkType.MAINNET]: MAINNET_WTEZ_TOKEN,
[NetworkType.GHOSTNET]: GHOSTNET_WTEZ_TOKEN
};

export const WTEZ_TOKEN = networksWtezTokens[NETWORK_ID];

export const COINFLIP_TOKENS_TO_PLAY = [TEZOS_TOKEN, QUIPU_TOKEN];

export const QUIPU_TOKEN_DECIMALS_PRECISION = 1e6;
99 changes: 0 additions & 99 deletions src/config/whitelisted-pools.ts

This file was deleted.

Binary file added src/images/no-position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { DAppTokensProvider } from '@providers/dapp-tokens';
import { RootStoreProvider } from '@providers/root-store-provider';
import { DAppProvider } from '@providers/use-dapp';
import { ExchangeRatesProvider, NewExchangeRatesProvider } from '@providers/use-new-exchange-rate';
import { DexGraphProvider } from '@shared/hooks';
import { sentryService } from '@shared/services';

import { App } from './app';
Expand All @@ -34,9 +33,7 @@ if (container) {
<DAppBakerProvider>
<DAppTokensProvider>
<BalancesProvider>
<DexGraphProvider>
<App />
</DexGraphProvider>
<App />
</BalancesProvider>
</DAppTokensProvider>
</DAppBakerProvider>
Expand Down
Loading

0 comments on commit 0b5c3b1

Please sign in to comment.