Skip to content

Commit

Permalink
Add exchange selection, load LP from taco
Browse files Browse the repository at this point in the history
  • Loading branch information
Wapaca committed Jul 1, 2023
1 parent 4749583 commit e70f3e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
11 changes: 8 additions & 3 deletions components/LPdistrib.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<img class="LPdistrib-logo" src="/neonspace_logo.png" alt="NeonSpace Logo"/>
<div class="exchanges-container">
<ul class="exchanges">
<li :class="getExchangeClass('defibox')">Defibox</li>
<li @click="changeExchange('alcor')" :class="getExchangeClass('alcor')">Alcor</li>
<li @click="changeExchange('defibox')" :class="getExchangeClass('defibox')">Defibox</li>
<li @click="changeExchange('taco')" :class="getExchangeClass('taco')">Taco</li>
</ul>
</div>
<div class="excludewallet-container">
Expand Down Expand Up @@ -75,7 +77,7 @@ export default {
return (exchange === this.exchange) ? 'active' : ''
},
...mapActions('chain', ['logout']),
...mapActions('LPdistrib', ['sendRewards', 'fetchTopLP', 'switchExcludeWallets', 'remExcludeWallet', 'addExcludeWallet', 'setTotalNeonReward', 'setExcludedWallets'])
...mapActions('LPdistrib', ['sendRewards', 'fetchTopLP', 'switchExcludeWallets', 'remExcludeWallet', 'addExcludeWallet', 'setTotalNeonReward', 'setExcludedWallets', 'changeExchange'])
},
computed: {
...mapState(['user']),
Expand Down Expand Up @@ -274,10 +276,13 @@ ul {
}
.exchanges li {
display: inline-block;
cursor: pointer;
font-weight: bold;
font-size: 28px;
color: #c5c5c5;
padding: 0 10px;
color: #c5c5c5;
}
.exchanges li.active {
color: #fff;
animation: neonPinkFlicker 1.5s infinite alternate;
}
Expand Down
18 changes: 15 additions & 3 deletions store/LPdistrib.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,23 @@ export const actions = {
const amount = 1* event.target.value
commit('setTotalNeonReward', amount)
},
async changeExchange({ commit, dispatch }, exchange) {
commit('setExchange', exchange)

if(['defibox', 'taco'].indexOf(exchange) !== -1)
dispatch('fetchTopLP')
},
async fetchTopLP({commit, state, dispatch}) {
commit('updateIsLPLoading', true)
const ticker = (state.exchange === 'defibox') ? 'BOXX' : 'WAXNEON'
const contract = (state.exchange === 'defibox') ? 'lptoken.box' : 'alcorammswap'
const topLP = await getTopHolders(this.$axios, ticker, contract)
const tickers = {
'defibox': 'BOXX',
'taco': 'NEOWAX',
}
const contracts = {
'defibox': 'lptoken.box',
'taco': 'swap.taco'
}
const topLP = await getTopHolders(this.$axios, tickers[state.exchange], contracts[state.exchange])
commit('setTopLP', topLP)
dispatch('updateDisplayedTopLP')
dispatch('updateTotalLPamount')
Expand Down

0 comments on commit e70f3e4

Please sign in to comment.