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

Feature/pw 679 #705

Merged
merged 55 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e9307fc
create demeter store
Nikita-Polyakov May 26, 2022
5b24261
add PoolStatusBadge component
Nikita-Polyakov May 27, 2022
f520dea
wip pool card
Nikita-Polyakov May 27, 2022
2f6367b
show/hide badge in title
Nikita-Polyakov May 30, 2022
6e9badd
update translations & info lines
Nikita-Polyakov May 30, 2022
30d20d5
add dialog templates
Nikita-Polyakov May 30, 2022
ef1ab1b
stake dialog content
Nikita-Polyakov May 30, 2022
e9c44f2
fix percent css
Nikita-Polyakov May 30, 2022
ae30165
fix ts error
Nikita-Polyakov May 31, 2022
28e04cc
subscriptions examples
Nikita-Polyakov May 31, 2022
4c775db
update store
Nikita-Polyakov Jun 2, 2022
08e5c1a
claim dialog wip
Nikita-Polyakov Jun 2, 2022
e21d697
add AccountPoolMixin
Nikita-Polyakov Jun 3, 2022
9f8c792
buttons texts
Nikita-Polyakov Jun 3, 2022
c301bdf
add claim rewards action
Nikita-Polyakov Jun 3, 2022
7b6cd5a
merge origin/develop
Nikita-Polyakov Jun 3, 2022
aebfe33
fix claim handler
Nikita-Polyakov Jun 3, 2022
f53a085
add staking route
Nikita-Polyakov Jun 3, 2022
8655504
wip Staking page
Nikita-Polyakov Jun 3, 2022
225f33d
connect wallet on card
Nikita-Polyakov Jun 3, 2022
ef6ae05
add PageMixin
Nikita-Polyakov Jun 3, 2022
5504e7c
refactoring common methods
Nikita-Polyakov Jun 6, 2022
a54584d
add staking actions
Nikita-Polyakov Jun 6, 2022
84dbf7b
add DemeterDataContainer
Nikita-Polyakov Jun 6, 2022
2f32c36
new folder structure
Nikita-Polyakov Jun 6, 2022
f3718c9
remove liqudity calculations
Nikita-Polyakov Jun 6, 2022
5236f9c
add APR for staking
Nikita-Polyakov Jun 6, 2022
e84f2ff
fix apr formula
Nikita-Polyakov Jun 6, 2022
1688ed9
add liquidty apr
Nikita-Polyakov Jun 7, 2022
6c12d3b
update calc
Nikita-Polyakov Jun 7, 2022
4847971
refactoring params
Nikita-Polyakov Jun 7, 2022
2c83d37
hide removed inactive pools
Nikita-Polyakov Jun 7, 2022
a54419b
fix calculations after
Nikita-Polyakov Jun 7, 2022
45514c4
add float input for stake
Nikita-Polyakov Jun 8, 2022
ec3cf21
add fiat amounts to stake dialog
Nikita-Polyakov Jun 8, 2022
22dbf98
refactoring balance
Nikita-Polyakov Jun 8, 2022
dfaa7b0
fix pool share after
Nikita-Polyakov Jun 8, 2022
839d2f0
merge origin/develop
Nikita-Polyakov Jun 8, 2022
87f48fa
update translation keys
Nikita-Polyakov Jun 8, 2022
fac464b
fix some translations, max button visibility
Nikita-Polyakov Jun 8, 2022
b72258e
update removeLiquidity
Nikita-Polyakov Jun 8, 2022
96966f3
update messages
Nikita-Polyakov Jun 8, 2022
63c0b9f
update translations
Nikita-Polyakov Jun 9, 2022
fec2753
revert env.json
Nikita-Polyakov Jun 9, 2022
ea6903e
staking empty card
Nikita-Polyakov Jun 9, 2022
4a9e91e
fix status-badge css
Nikita-Polyakov Jun 9, 2022
141a605
update icon & balance text
Nikita-Polyakov Jun 10, 2022
e491e66
Merge remote-tracking branch 'origin/develop' into feature/pw-679
Nikita-Polyakov Jun 10, 2022
33fabb2
Merge branch 'develop' into feature/pw-679
Nikita-Polyakov Jun 10, 2022
a59fa46
Merge branch 'develop' into feature/pw-679
Nikita-Polyakov Jun 10, 2022
2ffdd72
update badges
Nikita-Polyakov Jun 14, 2022
6107db8
fix click on stopped pool badge
Nikita-Polyakov Jun 15, 2022
7210892
fix bugs
Nikita-Polyakov Jun 16, 2022
a0085bc
merge origin/develop
Nikita-Polyakov Jun 17, 2022
6ad771d
fixes after review
Nikita-Polyakov Jun 20, 2022
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
168 changes: 84 additions & 84 deletions public/env.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
{
"BASE_API_URL": "",
"API_KEYS": {
"moonpay": "pk_test_4ASGxHKGpLPE6sdQq1V3QjtpUFSpWLk",
"nftStorage": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweDBmMzgwOTMyQTNDODM3ZDNiN2JEYzBBNTc0NmNkMDlBRGIyNUZGMzQiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY0MjU4OTQ2ODA4MSwibmFtZSI6Im5mdC1zdG9yYWdlLWRldiJ9.hkvzea9ltcriXXHKoYd3F2Iu1Y8X5H-zunAQboC_3vw",
"etherscan": "YBR7IWEBEXFICT8M7GRV77NBX4AXJ9T53H"
},
"FEATURE_FLAGS": {
"moonpay": true,
"charts": false
},
"FAUCET_URL": "https://faucet.dev.sora2.tachi.soramitsu.co.jp/",
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-dev",
"DEFAULT_NETWORKS": [
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-1.s1.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-2.s2.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-3.s3.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-4.s3.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-5.s4.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-6.s4.dev.sora2.soramitsu.co.jp"
}
],
"NETWORK_TYPE": "Dev",
"CHAIN_GENESIS_HASH": "",
"SUB_NETWORKS": [
{
"name": "ethereum",
"id": 0,
"symbol": "ETH",
"currency": "ETH",
"defaultType": "rinkeby",
"CONTRACTS": {
"XOR": {
"MASTER": "0x12c6a709925783f49fcca0b398d13b0d597e6e1c"
},
"VAL": {
"MASTER": "0x47e229aa491763038f6a505b4f85d8eb463f0962"
},
"OTHER": {
"MASTER": "0x24390c8f6cbd5d152c30226f809f4e3f153b88d4"
}
}
},
{
"name": "energy",
"id": 1,
"symbol": "VT",
"currency": "VT",
"defaultType": "private",
"CONTRACTS": {
"XOR": {
"MASTER": ""
},
"VAL": {
"MASTER": ""
},
"OTHER": {
"MASTER": "0x1891b81AE0C5A81Ec84BC4f69322C6a01A3B3095"
}
}
}
]
"BASE_API_URL": "",
"API_KEYS": {
"moonpay": "pk_test_4ASGxHKGpLPE6sdQq1V3QjtpUFSpWLk",
"nftStorage": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweDBmMzgwOTMyQTNDODM3ZDNiN2JEYzBBNTc0NmNkMDlBRGIyNUZGMzQiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY0MjU4OTQ2ODA4MSwibmFtZSI6Im5mdC1zdG9yYWdlLWRldiJ9.hkvzea9ltcriXXHKoYd3F2Iu1Y8X5H-zunAQboC_3vw",
"etherscan": "YBR7IWEBEXFICT8M7GRV77NBX4AXJ9T53H"
},
"FEATURE_FLAGS": {
"moonpay": true,
"charts": false
},
"FAUCET_URL": "https://faucet.dev.sora2.tachi.soramitsu.co.jp/",
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-dev",
"DEFAULT_NETWORKS": [
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-1.s1.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-2.s2.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-3.s3.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-4.s3.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-5.s4.dev.sora2.soramitsu.co.jp"
},
{
"chain": "SORA-dev Testnet",
"name": "SORA",
"address": "wss://ws.framenode-6.s4.dev.sora2.soramitsu.co.jp"
}
],
"NETWORK_TYPE": "Dev",
"CHAIN_GENESIS_HASH": "",
"SUB_NETWORKS": [
{
"name": "ethereum",
"id": 0,
"symbol": "ETH",
"currency": "ETH",
"defaultType": "rinkeby",
"CONTRACTS": {
"XOR": {
"MASTER": "0x12c6a709925783f49fcca0b398d13b0d597e6e1c"
},
"VAL": {
"MASTER": "0x47e229aa491763038f6a505b4f85d8eb463f0962"
},
"OTHER": {
"MASTER": "0x24390c8f6cbd5d152c30226f809f4e3f153b88d4"
}
}
},
{
"name": "energy",
"id": 1,
"symbol": "VT",
"currency": "VT",
"defaultType": "private",
"CONTRACTS": {
"XOR": {
"MASTER": ""
},
"VAL": {
"MASTER": ""
},
"OTHER": {
"MASTER": "0x1891b81AE0C5A81Ec84BC4f69322C6a01A3B3095"
}
}
}
]
}
4 changes: 4 additions & 0 deletions src/components/App/Menu/AppMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import {
PoolChildPages,
BridgeChildPages,
RewardsChildPages,
StakingChildPages,
SidebarMenuGroups,
FaucetLink,
Components,
Expand Down Expand Up @@ -111,6 +112,9 @@ export default class AppMenu extends Mixins(TranslationMixin) {
if (RewardsChildPages.includes(router.currentRoute.name as PageNames)) {
return PageNames.Rewards;
}
if (StakingChildPages.includes(router.currentRoute.name as any)) {
return PageNames.StakingContainer;
}
return router.currentRoute.name as string;
}

Expand Down
1 change: 1 addition & 0 deletions src/components/PairTokenLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ export default class PairTokenLogo extends Mixins(TranslationMixin) {

@include element-size('pair-logo--mini', 24px);
@include element-size('pair-logo--small', 36px);
@include element-size('pair-logo--medium', 44px);
</style>
48 changes: 48 additions & 0 deletions src/components/Pool/PoolInfo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<div class="pool-info">
<slot name="prepend" />

<div class="pool-info-content">
<slot />
</div>

<div class="pool-info-buttons" v-if="$slots.buttons">
<slot name="buttons" />
</div>

<slot name="append" />
</div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class PoolInfo extends Vue {}
</script>

<style lang="scss">
.pool-info {
& > *:not(:last-child) {
margin-bottom: $inner-spacing-medium;
}

&-buttons {
display: flex;
justify-content: center;

> * {
width: 100%;

&:not(:first-child),
&:not(:last-child) {
width: 50%;
}
}

.el-button + .el-button {
margin-left: $inner-spacing-small;
}
}
}
</style>
63 changes: 63 additions & 0 deletions src/components/mixins/SubscriptionsMixin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Component, Watch, Mixins } from 'vue-property-decorator';
import { mixins } from '@soramitsu/soraneo-wallet-web';

import { getter } from '@/store/decorators';

@Component
export default class SubscriptionsMixin extends Mixins(mixins.LoadingMixin) {
@getter.wallet.account.isLoggedIn isLoggedIn!: boolean;
@getter.settings.nodeIsConnected nodeIsConnected!: boolean;

startSubscriptionsList: AsyncVoidFn[] = [];
resetSubscriptionsList: AsyncVoidFn[] = [];

@Watch('isLoggedIn')
@Watch('nodeIsConnected')
private async restartSubscriptions(value: boolean) {
if (value) {
await this.updateSubscriptions();
} else {
await this.resetSubscriptions();
}
}

get subscriptionsDataLoading(): boolean {
return this.parentLoading || this.loading;
}

async mounted(): Promise<void> {
await this.updateSubscriptions();
}

async beforeDestroy(): Promise<void> {
await this.resetSubscriptions();
}

public setStartSubscriptions(list: AsyncVoidFn[]) {
this.startSubscriptionsList = list;
}

public setResetSubscriptions(list: AsyncVoidFn[]) {
this.resetSubscriptionsList = list;
}

/**
* Update subscriptions
* If this page is loaded first time by url, "watch" & "mounted" call this method
*/
private async updateSubscriptions(): Promise<void> {
// return if updateSubscription is already called by "watch" or "mounted"
if (this.loading) return;

await this.withLoading(async () => {
// wait for node connection & wallet init (App.vue)
await this.withParentLoading(async () => {
await Promise.all(this.startSubscriptionsList.map((fn) => fn?.()));
});
});
}

private async resetSubscriptions(): Promise<void> {
await Promise.all(this.resetSubscriptionsList.map((fn) => fn?.()));
}
}
15 changes: 11 additions & 4 deletions src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import invert from 'lodash/fp/invert';
import { KnownAssets, KnownSymbols, XOR } from '@sora-substrate/util/build/assets/consts';
import { LiquiditySourceTypes } from '@sora-substrate/liquidity-proxy/build/consts';

import { DemeterPageNames } from '@/modules/demeterFarming/consts';

import pkg from '../../package.json';
import { KnownBridgeAsset } from '../utils/ethers-util';

Expand Down Expand Up @@ -129,6 +131,7 @@ export enum PageNames {
BridgeTransactionsHistory = 'BridgeTransactionsHistory',
Tokens = 'Tokens',
MoonpayHistory = 'MoonpayHistory',
StakingContainer = 'StakingContainer',
}

export enum Components {
Expand Down Expand Up @@ -189,6 +192,8 @@ export enum Components {
CreatePairTransactionDetails = 'TransactionDetails/CreatePairTransactionDetails',
BridgeTransferNotification = 'Bridge/TransferNotification',
MobilePopup = 'MobilePopup/MobilePopup',
// Pool
PoolInfo = 'Pool/PoolInfo',
}

export enum RewardsTabsItems {
Expand All @@ -215,14 +220,14 @@ const MainMenu: Array<SidebarMenuItem> = [
icon: 'basic-drop-24',
title: PageNames.Pool,
},
{
icon: 'basic-layers-24',
title: PageNames.StakingContainer,
},
{
icon: 'grid-block-distribute-vertically-24',
title: PageNames.Bridge,
},
// {
// icon: 'various-pocket-24',
// title: PageNames.Auctions,
// },
];

const AccountMenu: Array<SidebarMenuItem> = [
Expand Down Expand Up @@ -303,6 +308,8 @@ export const RewardsChildPages = [
PageNames.ReferralUnbonding,
];

export const StakingChildPages = [DemeterPageNames.Staking];

export enum Topics {
SwapTokens = 'SwapTokens',
PassiveEarning = 'PassiveEarning',
Expand Down
Loading