Skip to content

Commit

Permalink
Merge pull request #687 from Sifchain/staging
Browse files Browse the repository at this point in the history
Merging Staging to Release Comdex
  • Loading branch information
gzukel authored Jun 13, 2022
2 parents c7961d1 + 38fa36f commit 954a281
Show file tree
Hide file tree
Showing 50 changed files with 945 additions and 2,188 deletions.
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ node_modules
chains/eth/build/contracts
coverage
e2e/extensions
e2e/playwright
react-example/.next
e2e/playwright
5 changes: 5 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Release 2022.06.08

- Add OSQTH token
- Add COMDEX token

## Release 2022.05.26

- Fix ethereum assetlist configuration for tokens missing 'homeNetwork'
Expand Down
55 changes: 23 additions & 32 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "2.7.5",
"version": "2.7.6",
"private": true,
"scripts": {
"bump": "bump patch --tag --commit 'testnet release '",
Expand All @@ -17,62 +17,56 @@
"bignumber.js": "^9.0.2",
"buffer": "^6.0.3",
"clsx": "^1.1.1",
"color-hash": "^1.1.1",
"copy-to-clipboard": "^3.3.1",
"core-js": "^3.22.1",
"core-js": "^3.22.7",
"dat.gui": "^0.7.9",
"date-fns": "^2.28.0",
"flip-toolkit": "^7.0.13",
"immer": "^9.0.12",
"normalize-scss": "^7.0.1",
"immer": "^9.0.14",
"p-limit": "^4.0.0",
"p-props": "^5.0.0",
"process": "^0.11.10",
"react-dom": "^17.0.2",
"rxjs": "7.5.2",
"rxjs": "7.5.5",
"tippy.js": "^6.3.7",
"vue": "^3.2.33",
"vue-query": "^1.22.3",
"vue-router": "^4.0.14",
"vue": "^3.2.36",
"vue-query": "^1.25.0",
"vue-router": "^4.0.15",
"vue-tippy": "^6.0.0-alpha.57",
"vuex": "4.0.2"
},
"devDependencies": {
"@commitlint/config-conventional": "^16.2.1",
"@jsdevtools/version-bump-prompt": "^6.1.0",
"@tailwindcss/typography": "^0.5.2",
"@types/color-hash": "^1.0.2",
"@types/dat.gui": "^0.7.7",
"@types/jest": "^24.9.1",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@vitejs/plugin-vue": "^2.3.1",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/compiler-sfc": "^3.2.33",
"@vue/compiler-sfc": "^3.2.36",
"@vue/eslint-config-typescript": "^10.0.0",
"@vue/test-utils": "^2.0.0-rc.20",
"@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.4",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^8.6.0",
"happy-dom": "^2.55.0",
"postcss": "^8.4.12",
"autoprefixer": "^10.4.7",
"eslint": "^8.16.0",
"eslint-plugin-vue": "^9.0.1",
"happy-dom": "^4.0.1",
"postcss": "^8.4.14",
"prettier": "^2.6.2",
"prettier-plugin-tailwindcss": "^0.1.9",
"prettier-plugin-tailwindcss": "^0.1.11",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-visualizer": "^5.6.0",
"sass": "^1.50.1",
"style-loader": "^3.3.1",
"svgo": "^2.8.0",
"tailwindcss": "^3.0.24",
"typescript": "^4.6.3",
"vite": "^2.9.5",
"vite-compatible-readable-stream": "^3.6.0",
"vite": "^2.9.9",
"vite-compatible-readable-stream": "^3.6.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-live-reload": "^2.1.0",
"vite-plugin-singlefile": "^0.7.2",
"vite-svg-loader": "^2.2.0",
"vitest": "^0.9.3"
"vite-plugin-singlefile": "^0.9.0",
"vite-svg-loader": "^3.3.0",
"vitest": "^0.12.9"
},
"eslintConfig": {
"root": true,
Expand All @@ -99,10 +93,7 @@
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)",
"**/*.test.{j,t}s?(x)"
],
"env": {
"jest": true
}
]
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions app/src/business/calculators/addLiquidityCalculator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("addLiquidityCalculator", () => {
const shareOfPoolPercent: Ref<string> = ref("");
const state: Ref<PoolState> = ref(PoolState.SELECT_TOKENS);
const liquidityProvider = ref(
LiquidityProvider(ATK, ZERO, akasha.address, ZERO, ZERO),
new LiquidityProvider(ATK, ZERO, akasha.address, ZERO, ZERO),
) as Ref<LiquidityProvider | null>; // ? not sure why we need to cast

beforeEach(() => {
Expand Down Expand Up @@ -398,7 +398,7 @@ describe("addLiquidityCalculator", () => {
];
liquidityProvider.value = !preexistingLiquidity
? null
: LiquidityProvider(
: new LiquidityProvider(
ATK,
Amount(preexistingLiquidity.units),
akasha.address,
Expand Down Expand Up @@ -484,7 +484,7 @@ describe("addLiquidityCalculator", () => {
);

// Liquidity provider already owns 1000 pool units (1000000 from another investor)
liquidityProvider.value = LiquidityProvider(
liquidityProvider.value = new LiquidityProvider(
ATK,
Amount("500000000000000000000000"),
akasha.address,
Expand Down Expand Up @@ -548,7 +548,7 @@ describe("addLiquidityCalculator", () => {
});

test("Can handle division by zero", () => {
liquidityProvider.value = LiquidityProvider(ATK, ZERO, "", ZERO, ZERO);
liquidityProvider.value = new LiquidityProvider(ATK, ZERO, "", ZERO, ZERO);
tokenAAmount.value = "0";
tokenBAmount.value = "0";
tokenASymbol.value = "atk";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("useRemoveLiquidityCalculator", () => {
});

test("displays the correct withdrawal amounts", async () => {
liquidityProvider.value = LiquidityProvider(
liquidityProvider.value = new LiquidityProvider(
CATK,
Amount("100000000000000000000000"),
"sif123456876512341234",
Expand Down
2 changes: 1 addition & 1 deletion app/src/business/services/ClpService/ClpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class ClpService {
const { liquidity_provider_units, liquidity_provider_address } =
liquidity_provider;

return LiquidityProvider(
return new LiquidityProvider(
params.asset,
Amount(liquidity_provider_units),
liquidity_provider_address,
Expand Down
4 changes: 1 addition & 3 deletions app/src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export default defineComponent({
}
};
onMounted(() => {
// document.body.style.setProperty("height", "100vh");
// document.body.style.setProperty("overflow", "hidden");
document.body.addEventListener("keydown", onKeypress);
});
onUnmounted(() => {
Expand All @@ -86,7 +84,7 @@ export default defineComponent({
>
<div
class={[
"relative flex-col items-center justify-start md:w-[538px]",
"relative flex-col items-center justify-start md:w-[578px]",
"rounded-lg bg-black p-4 text-white",
props.class,
]}
Expand Down
12 changes: 4 additions & 8 deletions app/src/components/VotingModal/VotingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ export const VotingModal = defineComponent({
return "symbol";
}
return (a: TokenListItem, b: TokenListItem) => {
return (
parseFloat(
this.poolStatsLookup[b.asset.symbol.toLowerCase()]?.volume || "0",
) -
parseFloat(
this.poolStatsLookup[a.asset.symbol.toLowerCase()]?.volume || "0",
)
);
const aPool = this.poolStatsLookup[a.asset.symbol.toLowerCase()];
const bPool = this.poolStatsLookup[b.asset.symbol.toLowerCase()];

return (bPool?.volume ?? 0) - (aPool?.volume ?? 0);
};
},
proposal() {
Expand Down
36 changes: 0 additions & 36 deletions app/src/components/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { computed, Ref } from "@vue/reactivity";
import ColorHash from "color-hash";
import {
Asset,
IAssetAmount,
Network,
toBaseUnits,
Expand Down Expand Up @@ -47,12 +44,6 @@ export function formatAssetAmount(value: IAssetAmount) {
: format(amount, asset, { mantissa: 6 });
}

// TODO: These could be replaced with a look up table
export function getPeggedSymbol(symbol: string) {
if (symbol.toLowerCase() === "erowan") return "ROWAN";
return "c" + symbol.toUpperCase();
}

export function getUnpeggedSymbol(symbol: string) {
if (symbol.toLowerCase() === "rowan") return "eROWAN";
return symbol.indexOf("c") === 0 ? symbol.slice(1) : symbol;
Expand All @@ -73,33 +64,6 @@ export function getAssetLabel(t: IAsset) {
return t.displaySymbol.toUpperCase();
}

export function useAssetItem(symbol: Ref<string | undefined>) {
const token = computed(() =>
symbol.value ? Asset.get(symbol.value) : undefined,
);

const tokenLabel = computed(() => {
if (!token.value) return "";
return getAssetLabel(token.value);
});

const backgroundStyle = computed(() => {
if (!symbol.value) return "";

const colorHash = new ColorHash();

const color = symbol ? colorHash.hex(symbol.value) : [];

return `background: ${color};`;
});

return {
token: token,
label: tokenLabel,
background: backgroundStyle,
};
}

export function getBlockExplorerUrl(
sifChainId: string,
txHash?: TxHash,
Expand Down
4 changes: 4 additions & 0 deletions app/src/views/PoolPage/children/AddLiquidity/AddLiquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export default defineComponent({

const poolTVL = pool.poolStat.poolTVL;

if (!poolTVL) {
return defaultPrices;
}

const externalTVL = pool.pool.externalAmount
.toDerived()
.multiply(pool.poolStat.priceToken ?? "0")
Expand Down
13 changes: 13 additions & 0 deletions core/src/clients/chains/GravityChain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { urlJoin } from "url-join-ts";

import { Chain } from "../../entities";
import { BaseChain } from "./_BaseChain";

export class GravityChain extends BaseChain implements Chain {
getBlockExplorerUrlForTxHash(hash: string) {
return urlJoin(this.chainConfig.blockExplorerUrl, "txs", hash);
}
getBlockExplorerUrlForAddress(hash: string) {
return urlJoin(this.chainConfig.blockExplorerUrl, "account", hash);
}
}
1 change: 1 addition & 0 deletions core/src/clients/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export * from "./StargazeChain";
export * from "./StarnameChain";
export * from "./SecretChain";
export * from "./TerraChain";
export * from "./GravityChain";
export * from "./_BaseChain";
2 changes: 2 additions & 0 deletions core/src/clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
StargazeChain,
EvmosChain,
SecretChain,
GravityChain,
} from "../clients/chains";

import { Network } from "..";
Expand Down Expand Up @@ -54,6 +55,7 @@ export const networkChainCtorLookup = {
[Network.STARGAZE]: StargazeChain,
[Network.EVMOS]: EvmosChain,
[Network.SECRET]: SecretChain,
[Network.GRAVITY]: GravityChain,
};

export * from "./chains";
Expand Down
58 changes: 58 additions & 0 deletions core/src/config/chains/comdex/comdex-mainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Network, IBCChainConfig } from "../../../entities";

export const COMDEX_MAINNET: IBCChainConfig = {
chainType: "ibc",
network: Network.COMDEX,
displayName: "Comdex",
blockExplorerUrl: "https://www.mintscan.io/comdex",
nativeAssetSymbol: "ucmdx",
chainId: "comdex-1",
rpcUrl: "https://proxies.sifchain.finance/api/comdex-1/rpc",
restUrl: "https://proxies.sifchain.finance/api/comdex-1/rest",
features: {
erc20Transfers: true,
},
keplrChainInfo: {
rpc: "https://proxies.sifchain.finance/api/comdex-1/rpc",
rest: "https://proxies.sifchain.finance/api/comdex-1/rest",
chainId: "comdex-1",
chainName: "Comdex Testnet (Sifchain)",
stakeCurrency: {
coinDenom: "CMDX",
coinMinimalDenom: "ucmdx",
coinDecimals: 6,
coinGeckoId: "pool:ucmdx",
},
walletUrl: "https://wallet.keplr.app/#/cmdx-mainnet/stake",
walletUrlForStaking: "https://wallet.keplr.app/#/cmdx-mainnet/stake",
bip44: {
coinType: 118,
},
bech32Config: {
bech32PrefixAccAddr: "comdex",
bech32PrefixAccPub: "comdexpub",
bech32PrefixValAddr: "comdexvaloper",
bech32PrefixValPub: "comdexvaloperpub",
bech32PrefixConsAddr: "comdexvalcons",
bech32PrefixConsPub: "comdexvalconspub",
},
currencies: [
{
coinDenom: "CMDX",
coinMinimalDenom: "ucmdx",
coinDecimals: 6,
coinGeckoId: "pool:ucmdx",
},
],
feeCurrencies: [
{
coinDenom: "CMDX",
coinMinimalDenom: "ucmdx",
coinDecimals: 6,
coinGeckoId: "pool:ucmdx",
},
],
coinType: 118,
features: ["stargate", "ibc-transfer"],
},
};
3 changes: 2 additions & 1 deletion core/src/config/chains/comdex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { NetworkEnv } from "../../getEnv";
import { NetEnvChainConfigLookup } from "../NetEnvChainConfigLookup";

import { COMDEX_TESTNET } from "./comdex-testnet";
import { COMDEX_MAINNET } from "./comdex-mainnet";

export default <NetEnvChainConfigLookup>{
[NetworkEnv.LOCALNET]: COMDEX_TESTNET,
[NetworkEnv.DEVNET]: COMDEX_TESTNET,
[NetworkEnv.TESTNET]: COMDEX_TESTNET,
[NetworkEnv.MAINNET]: COMDEX_TESTNET,
[NetworkEnv.MAINNET]: COMDEX_MAINNET,
};
Loading

1 comment on commit 954a281

@vercel
Copy link

@vercel vercel bot commented on 954a281 Jun 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.