-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Remove Liquidity] Show ceres locked liquidity (#922)
* show ceres locked liquidity percent * change translation of locked * refactoring rendering * Update translations Co-authored-by: Stefan Popov <17688105+stefashkaa@users.noreply.github.com> Co-authored-by: Stefan Popov <stefanpopov@list.ru>
- Loading branch information
1 parent
6325528
commit 5338829
Showing
11 changed files
with
127 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineGetters } from 'direct-vuex'; | ||
import { FPNumber } from '@sora-substrate/math'; | ||
|
||
import { poolGetterContext } from './index'; | ||
|
||
import type { PoolState } from './types'; | ||
|
||
const getters = defineGetters<PoolState>()({ | ||
getLockedAmount(...args): (baseAsset: string, poolAsset: string) => FPNumber { | ||
const { state } = poolGetterContext(args); | ||
|
||
return (baseAsset: string, poolAsset: string) => { | ||
return state.accountLockedLiquidity.reduce((value, accountLockedPool) => { | ||
if (accountLockedPool.assetA === baseAsset && accountLockedPool.assetB === poolAsset) { | ||
return value.add(accountLockedPool.poolTokens); | ||
} | ||
return value; | ||
}, FPNumber.ZERO); | ||
}; | ||
}, | ||
}); | ||
|
||
export default getters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
import { defineModule } from 'direct-vuex'; | ||
|
||
import { localActionContext } from '@/store'; | ||
import { localActionContext, localGetterContext } from '@/store'; | ||
import { Module } from '@/store/consts'; | ||
|
||
import mutations from './mutations'; | ||
import state from './state'; | ||
import actions from './actions'; | ||
import getters from './getters'; | ||
|
||
const pool = defineModule({ | ||
namespaced: true, | ||
state, | ||
mutations, | ||
actions, | ||
getters, | ||
}); | ||
|
||
const poolActionContext = (context: any) => localActionContext(context, Module.Pool, pool); | ||
const poolGetterContext = (args: [any, any, any, any]) => localGetterContext(args, Module.Pool, pool); | ||
|
||
export { poolActionContext }; | ||
export { poolActionContext, poolGetterContext }; | ||
export default pool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters