Skip to content

Commit

Permalink
dApp staking v3 (#1023)
Browse files Browse the repository at this point in the history
* Defined v3 project structure

* Stake, unstake skeletons

* Code organization improvements

* Get protocol state

* Protocol change notification message

* Lock and stake

* Read account ledger

* Unstake call

* unstake and unlock, claim staker

* Staker info

* Started with can stake logic

* Updated node types

* Staker reward calculation part 1

* Staker rewards calculation part 2

* dApp rewards calculation and claim

* Calculate and claim bonus rewards

* Calculate claim staker batch size fix

* Rewards fetch fix

* can claim methods

* Can Claim bug fix

* feat: Prevents Errors from Occuring (#1026)

* Prevents UnavailableStakeFunds

* rephrase

* Prevent tooManyStakedContracts, unclaimedRewardsFromPastPeriods

* less logs

* unstake Prevents UnstakeAmountTooLarge ZeroAmount Disabled

* UnclaimedRewardsFromPastPeriods

* feat: added top page (#1033)

* Vote mobile page and logic (#1036)

* Voting page created

* Voting page - part 1

* Vote logic

---------

Co-authored-by: impelcrypto <impelcrypto@gmail.com>

* Vote batch bug fixes

* vote and dictionary changes (#1037)

* vote and dictionary changes

* fix value and more

* vote checks

* Vote on multiple dApps  (#1046)

* FeatureDapp logic

* Search dApps

* Implemented stake on multiple dApps

* dApp tiers

* Switch periods on UI

* Removed separate link for staking v3

* Dapp rewards per period calculation

* feat: link to the project page (#1049)

* feat: link to the project page

* fix: display dapp data

* fix: clean up

* fix: clean up

* fix: clean up

* styles: added 'current tier' and 'total earned' (#1053)

* pulled latest main branch (#1057)

* merge the `release-hotfix` to `main` branch (#1025)

* fix: enables Snap on the production (#1024)

* Add a link to the docs (#1027)

* fix: words (#1028)

* fix: display the staking list for EVM accounts (#1030)

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>

* dApp fetching optimization (#1041)

* dApp fetching optimization

* An additional tiny optimization

* Update assets page layout (#956)

* Update assets page layout

* style update

* clean up

* replace transfer button to icon

* Align icon buttons on the right side

* Add navy-4 colour

* Update text color from default black to navy-1

* align token balance positions

* Adjust breakpoint for account section

* fix pointer events depends on screen size

* use i18n

* update asset search style

* Add faucet icon

* align token balance

* add reward animation

* remove static texts from account section

* Update AstarUI and replace icons

* remove claim button from reward section

* fix rewards section

* fix background image

* set max width

* update styles

* update delete button style

* move reward button next to account info

* Header style update

* update header color

* Add border color variation

* update to simple style

* remove old background image

* fix account icon size

* update sidebar size

* add border color for zKatana

* Update header icon styles

* update

* update style

* add icons

* Ads

* remove dynamic links

* update asset page style

* adjust border thickness 3px

* add background images

* add accout background

* update evm native token section style

* add ads style

* asset page wrapper space

* update header style

* add mobile nav

* Update styles

* add side ad area

* update Erx20Currency

* update account bg

* Add Rewards section

* Add rewards style

* update mobile nav

* update rewards style

* add mobile nav

* hide expand icon for mobile

* remove duplicated transfable

* display none

* revert

* Add assets list icon

* change-dark-bk

* add claim function

* fix mobile nav scroll

* update styles

* Remove transferable and comment out e2e test

* replace rewards section div to button

* add-account-images

* add shiden and testnet background

* Add transfer button for shibuya

* update native asset list style

* fix: updated rewards UI on the assets page (#1042)

* fix: fetch estimated rewards

* fix: updated rewards UI on the assets page

* fix: clean up

* fix: do not allow to select ZK network if the portal connects to native wallet

* fix: display background when the app is claiming rewards (#1045)

* fix: E2E test for new assets page  (#1044)

* fix: E2E test

* fix: E2E test (2)

* fix: remove --debug from 'playwright' command

* fix: include vesting amount in locked tokens (#1043)

* amend-style (#1047)

* fix: clean up

* fix: clean up

* use i18n

* clean up

* replace numers to endpointKey enum

* replace svg icons to astar ui

---------

Co-authored-by: Kahori Razzell <kahorirazzell@Kahoris-MacBook-Pro.local>
Co-authored-by: kahonnohak <kahon.nohak@gmail.com>
Co-authored-by: impelcrypto <92044428+impelcrypto@users.noreply.github.com>
Co-authored-by: impelcrypto <impelcrypto@gmail.com>
Co-authored-by: Kahori <77480847+Kahonnohak@users.noreply.github.com>

* fix-styling (#1054)

* merge 'release-hotfix' to 'main' (#1052)

* fix: enables Snap on the production (#1024)

* Add a link to the docs (#1027)

* fix: words (#1028)

* fix: display the staking list for EVM accounts (#1030)

* Ignore gas station (#1050)

* Ignore gas station

* Turned off Gas station everywhere

* Ignore another one gas station call

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
Co-authored-by: Bobo <bobo.kovacevic@gmail.com>

* fix: resolved new assets page bugs (#1055)

* fix: close the modal after claiming EVM withdrawal

* fix: close the modal after claiming EVM withdrawal (2)

* fix: ModalVesting.vue

* fix: link to subscan for WASM projects

* feat: added Reserved section

* feat: added Reserved section (2)

* fix: words

* fix: refactor

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
Co-authored-by: Bobo <bobo.kovacevic@gmail.com>
Co-authored-by: Kahori Razzell <kahorirazzell@Kahoris-MacBook-Pro.local>
Co-authored-by: kahonnohak <kahon.nohak@gmail.com>
Co-authored-by: Kahori <77480847+Kahonnohak@users.noreply.github.com>

* Staking panels and leaderboard (#1056)

* Get contract stake

* Initial leaderboard version

* voting call refactoring

* Tier rewards updates

* Leaderboard rendering fix

* My staking components

* Staking components logic done

* Re-lock unlocking chunks

* Unbonding modal

* Bonus rewards calculation bug fix

* Minor navigation refactoring

* Display total stake

* PropType fix

* Total stake calculation fix

* feat: added owner section on the assets page (#1059)

* merge the `release-hotfix` to `main` branch (#1025)

* fix: enables Snap on the production (#1024)

* Add a link to the docs (#1027)

* fix: words (#1028)

* fix: display the staking list for EVM accounts (#1030)

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>

* dApp fetching optimization (#1041)

* dApp fetching optimization

* An additional tiny optimization

* Update assets page layout (#956)

* Update assets page layout

* style update

* clean up

* replace transfer button to icon

* Align icon buttons on the right side

* Add navy-4 colour

* Update text color from default black to navy-1

* align token balance positions

* Adjust breakpoint for account section

* fix pointer events depends on screen size

* use i18n

* update asset search style

* Add faucet icon

* align token balance

* add reward animation

* remove static texts from account section

* Update AstarUI and replace icons

* remove claim button from reward section

* fix rewards section

* fix background image

* set max width

* update styles

* update delete button style

* move reward button next to account info

* Header style update

* update header color

* Add border color variation

* update to simple style

* remove old background image

* fix account icon size

* update sidebar size

* add border color for zKatana

* Update header icon styles

* update

* update style

* add icons

* Ads

* remove dynamic links

* update asset page style

* adjust border thickness 3px

* add background images

* add accout background

* update evm native token section style

* add ads style

* asset page wrapper space

* update header style

* add mobile nav

* Update styles

* add side ad area

* update Erx20Currency

* update account bg

* Add Rewards section

* Add rewards style

* update mobile nav

* update rewards style

* add mobile nav

* hide expand icon for mobile

* remove duplicated transfable

* display none

* revert

* Add assets list icon

* change-dark-bk

* add claim function

* fix mobile nav scroll

* update styles

* Remove transferable and comment out e2e test

* replace rewards section div to button

* add-account-images

* add shiden and testnet background

* Add transfer button for shibuya

* update native asset list style

* fix: updated rewards UI on the assets page (#1042)

* fix: fetch estimated rewards

* fix: updated rewards UI on the assets page

* fix: clean up

* fix: do not allow to select ZK network if the portal connects to native wallet

* fix: display background when the app is claiming rewards (#1045)

* fix: E2E test for new assets page  (#1044)

* fix: E2E test

* fix: E2E test (2)

* fix: remove --debug from 'playwright' command

* fix: include vesting amount in locked tokens (#1043)

* amend-style (#1047)

* fix: clean up

* fix: clean up

* use i18n

* clean up

* replace numers to endpointKey enum

* replace svg icons to astar ui

---------

Co-authored-by: Kahori Razzell <kahorirazzell@Kahoris-MacBook-Pro.local>
Co-authored-by: kahonnohak <kahon.nohak@gmail.com>
Co-authored-by: impelcrypto <92044428+impelcrypto@users.noreply.github.com>
Co-authored-by: impelcrypto <impelcrypto@gmail.com>
Co-authored-by: Kahori <77480847+Kahonnohak@users.noreply.github.com>

* fix-styling (#1054)

* merge 'release-hotfix' to 'main' (#1052)

* fix: enables Snap on the production (#1024)

* Add a link to the docs (#1027)

* fix: words (#1028)

* fix: display the staking list for EVM accounts (#1030)

* Ignore gas station (#1050)

* Ignore gas station

* Turned off Gas station everywhere

* Ignore another one gas station call

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
Co-authored-by: Bobo <bobo.kovacevic@gmail.com>

* fix: resolved new assets page bugs (#1055)

* fix: close the modal after claiming EVM withdrawal

* fix: close the modal after claiming EVM withdrawal (2)

* fix: ModalVesting.vue

* fix: link to subscan for WASM projects

* feat: added Reserved section

* feat: added Reserved section (2)

* fix: words

* fix: refactor

* fix: display the amount of estimated rewards for Shibuya (#1058)

* feat: added owner page

* feat: added your-project section

* feat: resolve errors when the app connected to Astar

* feat: resolve errors when the app connected to Astar (2)

* feat: updated owner section

* fix: clean up

* fix: link to the owner page

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
Co-authored-by: Bobo <bobo.kovacevic@gmail.com>
Co-authored-by: Kahori Razzell <kahorirazzell@Kahoris-MacBook-Pro.local>
Co-authored-by: kahonnohak <kahon.nohak@gmail.com>
Co-authored-by: Kahori <77480847+Kahonnohak@users.noreply.github.com>

* Staking v3 data (#1064)

* Data list component and refactoring

* Leader board properly assign tiers ans style improvements

* Day of a period calculation fix

* Prevent multiple dapps data loading

* Update src/App.vue

Co-authored-by: impelcrypto <92044428+impelcrypto@users.noreply.github.com>

---------

Co-authored-by: impelcrypto <92044428+impelcrypto@users.noreply.github.com>

* Compatibility issues fix (#1075)

* Refresh TVL on unstake

* Compatibility issues fix

* feat: maxUnlockingChunks (#1071)

* maxUnlockingChunks

* using getDapp method

* Remove commented

* feat: added owner section (#1079)

* feat: added rewards section

* feat: added edit section

* fix: refactor

* fix: i18

* fix: copy the project page components to the staking-v3 folder (#1085)

* fix: copy project page components to staking-v3 folder

* fix: updated astar.yml

* fix: rollback the endpoint in astar.yml

* Owner page logic and unstake from unregistered (#1088)

* Unstake from unregistered

* usePeriod hook

* era lengths

* Owner page logic

* Owner page fixes

* Fixes on your projects and dapp select modal

* Successful vote message

* Feat/staking v3 improvements4 (#1089)

* Unstake from unregistered

* usePeriod hook

* era lengths

* Owner page logic

* Owner page fixes

* Fixes on your projects and dapp select modal

* Successful vote message

* Leaderboard voting

* Group dApps by category

* Cleanup expired entries

* dApp page logic

* Minor Dapps component styling

* Select up to max number of staked contracts for voting

* Navigate to staking home if a dApp doesn't exists

* Add Shibuya Scope Style (#1078)

* add feature dApp area style

* add dapps list and data list area style

* add ad area style

* add Leaderboard area style

* move staking section to assets page

* update the your projects section style  on the assets page

* move css files

* add staking section style on the assets page

* add vote and stake page style

* adjust tvl text size

* add owner page style

* update astar ui

* remove dark theme style from the vote page

* update vote page style

* remove dark theme from dapp staking pages

* add project page style

* clean up

* add Leaderboard style

* update dapp style

* update lang

* add input search

* update

* update leaderboard style

* add category style

* add tier paging

* Small fix for loading a dApp

* Changed a way how to subscribe and handle protocol state

* clean up

* update dapps search logic

* remove operator from filter function

---------

Co-authored-by: Bobo <bobo.kovacevic@gmail.com>

* Show success messages and tier rewards (#1097)

* add feature dApp area style

* add dapps list and data list area style

* add ad area style

* add Leaderboard area style

* move staking section to assets page

* update the your projects section style  on the assets page

* move css files

* add staking section style on the assets page

* add vote and stake page style

* adjust tvl text size

* add owner page style

* update astar ui

* remove dark theme style from the vote page

* update vote page style

* remove dark theme from dapp staking pages

* add project page style

* clean up

* add Leaderboard style

* update dapp style

* update lang

* add input search

* Added success message to all calls

* update

* update leaderboard style

* add category style

* add tier paging

* Small fix for loading a dApp

* Changed a way how to subscribe and handle protocol state

* clean up

* update dapps search logic

* Show error message from canUnstake function

* Display tier daily rewards

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>

* dApp search bug fix, amount to be locked fix

* Build error fix

* Nomination transfer

* Disable Vote button if no stakes.

* Reward calculation fix, unlock

* v3 vote period style (#1098)

* remove the unnecessary div from assets page

* adjust vote page style

* add hover color to search, selector

* update vote page style

* add animated vote button

* add vote period hero

* update dapps slide style

* update leaderboard text

* update vote page column order

* Show nomination transfer info on Voting page

* feat: added EVM supports (#1102)

* Vote with EVM

* Fetch rewards for evm account

* feat: updated V3 via EVM logic (#1101)

* feat: updated claimUnstakeAndUnlock

* fix: clean up

* feat: added EVM calls

* fix: link to the vote page

* fix: clean up

* fix: conflicts (2)

* fix: claimUnstakeAndUnlock fn

* Build errors fix

* Build error fix 2

* Fix for initial loading of ledger and stakerInfo

* Ledger subscription fix

* Removed gas estimation

* refactor: added batch methods

* Remove senderSs58Account from hook since address mapping logic is moved to the service

* Disable canUnstake

* Linter fix

---------

Co-authored-by: Bobo <bobo.kovacevic@gmail.com>

* EVM unlock fix

* fix: added todo comment

* GetTier bug fix and removed some comments

* fix: removed unused files

* Comments cleanup

* Gas price provider fix

* Message subscriptions, check value before assignment.

* Nomination transfer bug fix, styling and translations

* Nomination transfer amount, total stake

* Leaderboard fix, multiplier removed

* Staker reward calculation optimisation

* Clam banner text update for Shibuya

* Voting period countdown

* Current period day and canConfirm fixes

* feat: update project page styles (#1109)

* add project icon background

* add project icon background to the owner page

* update all vote/stake button background

* fix app height

* move the register button to the assets page

* fix assets page container

* remove the license section from the project page

* made the header scroll

* add small dapp header

* fix v2 style

* remove the register banner from the assets page for now

* fix vote page layout

* fix vote period background

* adjust small header style and heart icon button

* update maintenance mode style

* update

* feat: add migrate support style (#1114)

* add migrate support style

* fix lang file

* Hide migration support for now

* feat: added staker and bonus rewards APR (#1113)

* feat: added useAprV3

* wip: staker rewards

* wip: staker rewards (2)

* wip: staker rewards (3)

* wip: staker rewards (4)

* wip: staker rewards (5)

* wip: staker rewards (6)

* wip: staker rewards (7)

* wip: staker rewards (8)

* feat: added basic rewards in the voting section

* fix: clean up

* fix: refactor

* feat: added bonus APR

* fix: clean up

* fix: set the periodsPerCycle from network name temporarily

* fix: set the periodsPerCycle from network name temporarily (2)

---------

Co-authored-by: impelcrypto <impelcrypto@gmail.com>
Co-authored-by: Gregory Luneau <greg@astar.network>
Co-authored-by: impelcrypto <92044428+impelcrypto@users.noreply.github.com>
Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
Co-authored-by: Kahori Razzell <kahorirazzell@Kahoris-MacBook-Pro.local>
Co-authored-by: kahonnohak <kahon.nohak@gmail.com>
Co-authored-by: Kahori <77480847+Kahonnohak@users.noreply.github.com>
  • Loading branch information
8 people committed Jan 8, 2024
1 parent 2b7b5e4 commit ae4e280
Show file tree
Hide file tree
Showing 147 changed files with 10,384 additions and 147 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -7,5 +7,6 @@
.eslintrc.js
babel.config.js
/src-ssr
/src-pwa
/tests/polkadot_wallet
/tests/metamask_wallet
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -47,5 +47,8 @@ zombienet-macos
polkadot
astar-collator

# Temp folder
*temp

# Chopstick binaries
db.sqlite*
db.sqlite*
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@astar-network/astar-sdk-core": "^0.2.8",
"@astar-network/astar-ui": "^0.0.136",
"@astar-network/astar-ui": "^0.0.137",
"@astar-network/metamask-astar-adapter": "^0.5.4",
"@astar-network/metamask-astar-types": "^0.6.1",
"@ethersproject/bignumber": "^5.5.0",
Expand Down
82 changes: 78 additions & 4 deletions src/App.vue
Expand Up @@ -40,7 +40,7 @@
// https://polkadot.js.org/docs/api/FAQ/#since-upgrading-to-the-7x-series-typescript-augmentation-is-missing
import 'reflect-metadata';
import '@polkadot/api-augment';
import { defineComponent, computed, ref, watch } from 'vue';
import { defineComponent, computed, ref, watch, onMounted } from 'vue';
import DashboardLayout from 'layouts/DashboardLayout.vue';
import { useStore } from 'src/store';
import ModalLoading from 'components/common/ModalLoading.vue';
Expand All @@ -61,6 +61,13 @@ import { container } from 'src/v2/common';
import { Symbols } from 'src/v2/symbols';
import { useAccount, useAppRouter } from 'src/hooks';
import { LOCAL_STORAGE } from 'src/config/localStorage';
import {
AccountLedgerChangedMessage,
IDappStakingService,
ProtocolStateChangedMessage,
} from './staking-v3';
import { useDappStaking, useDapps } from './staking-v3/hooks';
import { IDappStakingRepository as IDappStakingRepositoryV3 } from 'src/staking-v3/logic/repositories';
export default defineComponent({
name: 'App',
Expand All @@ -75,7 +82,18 @@ export default defineComponent({
setup() {
useAppRouter();
const store = useStore();
const { currentAccountName } = useAccount();
const { currentAccountName, currentAccount } = useAccount();
const {
protocolState,
getAllRewards,
getCurrentEraInfo,
getDappTiers,
fetchStakerInfoToStore,
fetchTiersConfigurationToStore,
fetchEraLengthsToStore,
isDappStakingV3,
} = useDappStaking();
const { fetchStakeAmountsToStore, fetchDappsToStore } = useDapps();
const isLoading = computed(() => store.getters['general/isLoading']);
const showAlert = computed(() => store.getters['general/showAlert']);
Expand All @@ -94,7 +112,7 @@ export default defineComponent({
showDisclaimerModal.value = isOpen;
};
// Handle busy and extrisnsic call status messages.
// Handle busy and extrinsic call status messages.
const eventAggregator = container.get<IEventAggregator>(Symbols.EventAggregator);
eventAggregator.subscribe(ExtrinsicStatusMessage.name, (m) => {
const message = m as ExtrinsicStatusMessage;
Expand Down Expand Up @@ -124,9 +142,65 @@ export default defineComponent({
store.commit('dapps/setCurrentEra', message.era, { root: true });
});
// **** dApp staking v3
// dApp staking v3 data changed subscriptions.
onMounted(() => {
if (isDappStakingV3.value) {
container
.get<IDappStakingRepositoryV3>(Symbols.DappStakingRepositoryV3)
.startProtocolStateSubscription();
}
});
eventAggregator.subscribe(ProtocolStateChangedMessage.name, async (m) => {
const message = m as ProtocolStateChangedMessage;
if (message.state) {
console.log('protocol state', message.state);
store.commit('stakingV3/setProtocolState', message.state, { root: true });
await fetchDappsToStore();
await Promise.all([
getAllRewards(),
getCurrentEraInfo(),
getDappTiers(message.state.era - 1),
fetchStakeAmountsToStore(),
fetchStakerInfoToStore(),
fetchEraLengthsToStore(),
]);
}
});
eventAggregator.subscribe(AccountLedgerChangedMessage.name, (m) => {
const message = m as AccountLedgerChangedMessage;
if (message.ledger) {
store.commit('stakingV3/setLedger', message.ledger, { root: true });
console.log('ledger', message.ledger);
}
});
// **** end dApp staking v3
// Handle wallet change so we can inject proper wallet
watch([isEthWallet, currentWallet, isH160, currentAccountName], () => {
let previousAddress: string | undefined = undefined;
watch([isEthWallet, currentWallet, isH160, currentAccountName], async () => {
setCurrentWallet(isEthWallet.value, currentWallet.value);
// Subscribe to an account specific dApp staking v3 data.
if (!isDappStakingV3.value) return;
// Memo: Can't use senderSs58Account here because unified account is not stored to vuex yet
// and senderSs58Account contains evm mapped address which is incorrect for unified account.
if (currentAccount.value && currentAccount.value !== previousAddress) {
const stakingService = container.get<() => IDappStakingService>(
Symbols.DappStakingServiceFactoryV3
)();
await stakingService.startAccountLedgerSubscription(currentAccount.value);
fetchStakerInfoToStore();
getAllRewards();
fetchTiersConfigurationToStore();
getDappTiers((protocolState.value?.era ?? 0) - 1);
previousAddress = currentAccount.value;
}
});
const removeSplashScreen = () => {
Expand Down
29 changes: 24 additions & 5 deletions src/components/assets/Assets.vue
Expand Up @@ -10,14 +10,25 @@
:is-loading-xcm-assets-amount="isLoadingXcmAssetsAmount"
/>

<div v-if="!isLoading" class="container">
<template v-if="isDappStakingV3">
<your-project />
</template>
<template v-if="isDappStakingV3">
<staking />
</template>

<div v-if="!isLoading">
<div v-if="isH160">
<evm-asset-list :tokens="evmAssets.assets" />
<evm-asset-list :tokens="evmAssets.assets" class="container" />
</div>
<div v-else>
<!-- Memo: hide xvm panel because AA might replace it -->
<!-- <xvm-native-asset-list v-if="isSupportXvmTransfer" :xvm-assets="xvmAssets.xvmAssets" /> -->
<xcm-native-asset-list v-if="isEnableXcm" :xcm-assets="xcmAssets.assets" />
<xcm-native-asset-list
v-if="isEnableXcm"
:xcm-assets="xcmAssets.assets"
class="container"
/>
</div>
</div>
</div>
Expand All @@ -30,19 +41,22 @@
</div>
</template>
<script lang="ts">
import { isValidEvmAddress } from '@astar-network/astar-sdk-core';
import Account from 'src/components/assets/Account.vue';
import SideAds from 'src/components/assets/SideAds.vue';
import AstarDomains from 'src/components/header/mobile/AstarDomains.vue';
import EvmAssetList from 'src/components/assets/EvmAssetList.vue';
import XcmNativeAssetList from 'src/components/assets/XcmNativeAssetList.vue';
import YourProject from 'src/components/assets/YourProject.vue';
import { providerEndpoints } from 'src/config/chainEndpoints';
import { LOCAL_STORAGE } from 'src/config/localStorage';
import { isValidEvmAddress } from '@astar-network/astar-sdk-core';
import { useAccount, useBalance, useDispatchGetDapps, useNetworkInfo } from 'src/hooks';
import { useDappStaking } from 'src/staking-v3';
import { useStore } from 'src/store';
import { EvmAssets, XcmAssets, XvmAssets } from 'src/store/assets/state';
import { Asset } from 'src/v2/models';
import { computed, defineComponent, ref, watch, watchEffect, onUnmounted } from 'vue';
import { computed, defineComponent, onUnmounted, ref, watch, watchEffect } from 'vue';
import Staking from 'src/staking-v3/components/my-staking/Staking.vue';
export default defineComponent({
components: {
Expand All @@ -51,14 +65,18 @@ export default defineComponent({
AstarDomains,
EvmAssetList,
XcmNativeAssetList,
YourProject,
Staking,
},
setup() {
const token = ref<Asset | null>(null);
const isModalXcmBridge = ref<boolean>(false);
const isModalXcmTransfer = ref<boolean>(false);
const { isDappStakingV3 } = useDappStaking();
const store = useStore();
const { currentAccount } = useAccount();
const { accountData } = useBalance(currentAccount);
const { isMainnet, currentNetworkIdx, evmNetworkIdx, isZkEvm } = useNetworkInfo();
// Memo: load the dApps data in advance, so that users can access to dApp staging page smoothly
Expand Down Expand Up @@ -184,6 +202,7 @@ export default defineComponent({
isModalXcmBridge,
isLoading,
bg,
isDappStakingV3,
};
},
});
Expand Down
9 changes: 4 additions & 5 deletions src/components/assets/Erc20Currency.vue
Expand Up @@ -136,20 +136,19 @@
</div>
</template>
<script lang="ts">
import TokenBalance from 'src/components/common/TokenBalance.vue';
import { LOCAL_STORAGE } from 'src/config/localStorage';
import { SupportWallet } from 'src/config/wallets';
import { useNetworkInfo, useBreakpoints } from 'src/hooks';
import { useBreakpoints, useNetworkInfo } from 'src/hooks';
import { addToEvmProvider, getEvmProvider } from 'src/hooks/helper/wallet';
import {
deleteImportedErc20Token,
Erc20Token,
deleteImportedErc20Token,
getErc20Explorer,
getStoredERC20Tokens,
} from 'src/modules/token';
import { buildTransferPageLink, buildEthereumBridgePageLink } from 'src/router/routes';
import { buildEthereumBridgePageLink, buildTransferPageLink } from 'src/router/routes';
import { useStore } from 'src/store';
import { computed, defineComponent, PropType, ref } from 'vue';
import { PropType, computed, defineComponent, ref } from 'vue';
import Jazzicon from 'vue3-jazzicon/src/components';
import { truncate } from '@astar-network/astar-sdk-core';
Expand Down
26 changes: 12 additions & 14 deletions src/components/assets/Rewards.vue
@@ -1,21 +1,19 @@
<template>
<div>
<button v-if="!isDappDeveloper" class="wrapper--rewards" @click="handleClaim">
<div class="container--rewards">
<div class="text--title">
{{ $t('assets.yourEstimatedRewards') }}
</div>
<div class="row--data">
<div class="value">
<div>
<span class="text--amount">{{ $n(pendingRewards || 0) }}</span>
<span class="text--symbol">{{ nativeTokenSymbol }}</span>
</div>
<button v-if="!isDappDeveloper" class="wrapper--rewards" @click="handleClaim">
<div class="container--rewards">
<div class="text--title">
{{ $t('assets.yourEstimatedRewards') }}
</div>
<div class="row--data">
<div class="value">
<div>
<span class="text--amount">{{ $n(pendingRewards || 0) }}</span>
<span class="text--symbol">{{ nativeTokenSymbol }}</span>
</div>
</div>
</div>
</button>
</div>
</div>
</button>
</template>

<script lang="ts">
Expand Down
49 changes: 49 additions & 0 deletions src/components/assets/YourProject.vue
@@ -0,0 +1,49 @@
<template>
<div v-if="ownDapps.length > 0" class="container">
<div class="wrapper--your-project">
<div class="row--title">
<astar-icon-project />
<span class="text--title">{{ $t('assets.yourProject') }}</span>
</div>
<div class="separator" />
<div class="box--dapps">
<router-link
v-for="dapp in ownDapps"
:key="dapp.basic.address"
:to="navigateOwnerPage(dapp.basic.address)"
class="card--dapp"
>
<img class="icon--dapp-logo" :src="dapp.basic.iconUrl" :alt="dapp.basic.name" />
<div>
<span>{{ dapp.basic.name }}</span>
</div>
</router-link>
</div>
</div>
</div>
</template>

<script lang="ts">
import { useAccount, useClaimAll } from 'src/hooks';
import { CombinedDappInfo, useDappStakingNavigation, useDapps } from 'src/staking-v3';
import { computed, defineComponent } from 'vue';
export default defineComponent({
setup() {
const { currentAccount } = useAccount();
useClaimAll();
const { allDapps } = useDapps();
const { navigateOwnerPage } = useDappStakingNavigation();
const ownDapps = computed<CombinedDappInfo[]>(() => {
if (!allDapps.value) return [];
return allDapps.value.filter((dapp) => dapp.chain.owner === currentAccount.value);
});
return { ownDapps, navigateOwnerPage };
},
});
</script>

<style lang="scss" scoped>
@use 'src/components/assets/styles/your-project.scss';
</style>
12 changes: 7 additions & 5 deletions src/components/assets/styles/account.scss
Expand Up @@ -4,6 +4,10 @@
display: flex;
flex-direction: column;
gap: 32px;
margin-top: -36px;
@media (min-width: $lg) {
margin-top: 0;
}
}

.row--details-signatory {
Expand Down Expand Up @@ -60,8 +64,6 @@
img {
width: 32px;
height: 32px;
// object-fit: cover;
// border-radius: 9999px;
}
}

Expand Down Expand Up @@ -218,7 +220,7 @@
background-color: white;
padding: 16px;
min-height: 180px;
@media (min-width: $sm) {
@media (min-width: $lg) {
border-radius: 16px;
margin: 0;
}
Expand Down Expand Up @@ -270,7 +272,7 @@
color: white;
background: linear-gradient(270deg, #6c6c6c 25%, #b7b7b7 100%);
}
&:not(.active){
&:not(.active) {
cursor: pointer;
}
}
Expand Down Expand Up @@ -330,7 +332,7 @@
}
}
}
}
}
}

.row--account-rewards {
Expand Down

0 comments on commit ae4e280

Please sign in to comment.