-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Debt auctions integrated to UI (#407)
- Loading branch information
1 parent
70a056b
commit d8d895b
Showing
15 changed files
with
658 additions
and
24 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,131 @@ | ||
<template> | ||
<DebtFlow | ||
:auctions="auctions" | ||
:selected-auction-id.sync="selectedAuctionId" | ||
:auctions-error="auctionsError" | ||
:auction-errors="auctionErrors" | ||
:auction-action-state="auctionActionStates" | ||
:are-auctions-fetching="areAuctionsFetching" | ||
:wallet-address="walletAddress" | ||
:wallet-balances="walletBalances" | ||
:allowance-dai="allowanceDai" | ||
:is-connecting-wallet="isConnectingWallet" | ||
:is-refreshing-wallet="isRefreshingWallet" | ||
:is-authorizing="isAuthorizing" | ||
:is-wallet-authorized="isWalletAuthorized" | ||
:is-setting-allowance="isAuthorizationLoading" | ||
:last-updated="lastUpdated" | ||
:is-explanations-shown.sync="isExplanationsShown" | ||
:network="network" | ||
:token-address="tokenAddress" | ||
:is-withdrawing="isWithdrawing" | ||
:dai-vat-balance="daiVatBalance" | ||
@connectWallet="openSelectWalletModal" | ||
@disconnectWallet="disconnectWallet" | ||
@refreshWallet="refreshWallet" | ||
@withdrawAllDaiFromVat="withdrawAllDaiFromVat" | ||
@restart="restartAuction" | ||
@setAllowanceAmount="setAllowanceAmountDai" | ||
@collect="collect" | ||
@bid="bid" | ||
/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import { mapActions, mapGetters } from 'vuex'; | ||
import BigNumber from 'bignumber.js'; | ||
import DebtFlow from '~/components/auction/debt/DebtFlow.vue'; | ||
export default Vue.extend({ | ||
components: { | ||
DebtFlow, | ||
}, | ||
props: { | ||
network: { | ||
type: String, | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
...mapGetters('debt', { | ||
auctions: 'auctions', | ||
areAuctionsFetching: 'areAuctionsFetching', | ||
auctionErrors: 'getAuctionErrors', | ||
auctionActionStates: 'auctionStates', | ||
auctionsError: 'error', | ||
lastUpdated: 'lastUpdated', | ||
tokenAddress: 'getTokenAddress', | ||
isAuthorizationLoading: 'isAuthorizationLoading', | ||
}), | ||
...mapGetters('wallet', { | ||
walletAddress: 'getAddress', | ||
walletBalances: 'walletBalances', | ||
isConnectingWallet: 'isLoading', | ||
isRefreshingWallet: 'isFetchingBalances', | ||
isWithdrawing: 'isDepositingOrWithdrawing', | ||
}), | ||
...mapGetters('authorizations', { | ||
isAuthorizing: 'isWalletAuthorizationLoading', | ||
isWalletAuthorized: 'isWalletAuthorizationDone', | ||
allowanceDai: 'allowanceAmount', | ||
}), | ||
daiVatBalance(): BigNumber | undefined { | ||
return this.walletBalances?.walletVatDAI; | ||
}, | ||
selectedAuctionId: { | ||
get(): string | null { | ||
const auctionGetParameter = this.$route.query.auction; | ||
if (Array.isArray(auctionGetParameter)) { | ||
return auctionGetParameter[0]; | ||
} else { | ||
return auctionGetParameter; | ||
} | ||
}, | ||
set(newAuctionId: string): void { | ||
if (!newAuctionId) { | ||
const network = this.$route.query.network; | ||
this.$router.push({ query: { network } }); | ||
this.updateAllAuctions(); | ||
} | ||
}, | ||
}, | ||
hasAcceptedTerms(): boolean { | ||
return this.$store.getters['cookies/hasAcceptedTerms']; | ||
}, | ||
isExplanationsShown: { | ||
get(): boolean { | ||
return this.$store.getters['preferences/getIsExplanationsShown']; | ||
}, | ||
set(newIsExplanationsShown): void { | ||
this.$store.dispatch('preferences/setExplanationsAction', newIsExplanationsShown); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
...mapActions('debt', { | ||
updateAllAuctions: 'fetchDebtAuctions', | ||
restartAuction: 'restartAuction', | ||
collect: 'collectAuction', | ||
bid: 'bidToDebtAuction', | ||
}), | ||
...mapActions('authorizations', { | ||
setAllowanceAmountDai: 'setAllowanceAmount', | ||
}), | ||
...mapActions('wallet', { | ||
refreshWallet: 'fetchWalletBalances', | ||
disconnectWallet: 'disconnect', | ||
}), | ||
withdrawAllDaiFromVat() { | ||
this.$store.dispatch('wallet/withdrawFromVAT', this.daiVatBalance); | ||
}, | ||
openSelectWalletModal(): void { | ||
if (!this.hasAcceptedTerms) { | ||
this.$store.commit('modals/setTermsModal', true); | ||
return; | ||
} | ||
this.$store.commit('modals/setSelectWalletModal', true); | ||
}, | ||
}, | ||
}); | ||
</script> |
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,20 @@ | ||
<template> | ||
<DebtContainer :network="network" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import DebtContainer from '~/containers/DebtContainer.vue'; | ||
export default Vue.extend({ | ||
components: { | ||
DebtContainer, | ||
}, | ||
layout: process.env.DEMO_MODE ? 'demoMode' : 'default', | ||
computed: { | ||
network() { | ||
return this.$store.getters['network/getPageNetwork']; | ||
}, | ||
}, | ||
}); | ||
</script> |
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
Oops, something went wrong.