Skip to content

Commit

Permalink
Merge pull request #81 from anyone-protocol/leggo/phase-1/dev
Browse files Browse the repository at this point in the history
fix negative value on available allocated tokens. update anon mentions
  • Loading branch information
MarcoMandar authored Sep 25, 2024
2 parents d865aa1 + 40f44f6 commit 91a55b8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cSpell.words": [
"Arweave",
"anon"
"anyone"
],
"files.associations": {
"*.css": "tailwindcss"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AnyOne Relay Dashboard

This repo houses the code to display the user specific information pertaining to ANON Relays.
This repo houses the code to display the user specific information pertaining to ANYONE Relays.

## Tech used

Expand Down Expand Up @@ -59,4 +59,5 @@ Data is stored on chain using Arweave - this means it's permanent.
Locally or in the app, the data is stored using Pinia.

## Resources

- https://cookbook.g8way.io/concepts/index.html
2 changes: 1 addition & 1 deletion composables/warp-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class WarpSigner extends InjectedEthereumSigner {

override async setPublicKey() {
let message =
'Please sign this message to authenticate with the ANON dashboard. ' +
'Please sign this message to authenticate with the AnyOne dashboard. ' +
'You will only need to do this once per session when interacting with ' +
'the Relay Registry.';

Expand Down
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineNuxtConfig({
{
hid: 'description',
name: 'Description',
content: 'ANON Dashboard',
content: 'ANYONE Dashboard',
},
{ property: 'og:site_name', content: 'AnyOne Dashboard' },
{ name: 'twitter:site', content: '@AnyoneFDN' },
Expand Down Expand Up @@ -72,7 +72,7 @@ export default defineNuxtConfig({
supportWalletPublicKeyBase64:
'K3jnSGVyHj4kSzgce3+k8gJsfHvUoQeJMNPO8CcsO2s=',
commitHash: process.env.NUXT_PUBLIC_COMMIT_HASH || 'dev',
version: '1.2.2',
version: '1.2.3',
},
},
plugins: [{ src: '~/plugins/vue-query.client.ts', mode: 'client' }],
Expand Down
2 changes: 1 addition & 1 deletion pages/_index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const handleClaimAllRewards = async () => {
<span v-if="isConnected" class="text-4xl font-bold">
{{
formatEther(
facilitatorStore.avaliableAllocatedTokens || '0'
facilitatorStore.availableAllocatedTokens || '0'
)
}}
</span>
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<span v-if="isConnected" class="text-4xl font-bold">
{{
formatEtherNoRound(
facilitatorStore.avaliableAllocatedTokens || '0'
facilitatorStore.availableAllocatedTokens || '0'
)
}}
</span>
Expand Down
13 changes: 9 additions & 4 deletions stores/useFacilitatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ export const useFacilitatorStore = defineStore('facilitator', {
setInitialized: (state) => (initialized: boolean) => {
state.initialized = initialized;
},
avaliableAllocatedTokens: (state) => {
availableAllocatedTokens: (state) => {
if (state.claimableAtomicTokens) {
if (state.totalClaimedTokens) {
return BigNumber(state.claimableAtomicTokens)
.minus(state.totalClaimedTokens)
.toString(10);
const allocatedTokens = BigNumber(state.claimableAtomicTokens).minus(
state.totalClaimedTokens
);

// Ensure that the value is never negative
return allocatedTokens.isNegative()
? '0'
: allocatedTokens.toString(10);
}
return state.claimableAtomicTokens;
}
Expand Down
4 changes: 2 additions & 2 deletions stores/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useUserStore = defineStore('user', {
familyVerifiedCache: {} as Record<string, boolean>,
}),
actions: {
// Get ANON balance
// Get ANYONE balance
async getTokenBalance(forceRefresh = false) {
if (!this.userData.address) {
return;
Expand All @@ -71,7 +71,7 @@ export const useUserStore = defineStore('user', {

this.cacheTimings.tokenBalance = new Date().getTime();
},
// Get ANON balance in USD using price store
// Get ANYONE balance in USD using price store
async getUsdTokenBalance(forceRefresh = false) {
if (!this.userData.address) {
return;
Expand Down

0 comments on commit 91a55b8

Please sign in to comment.