mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
Resolved merge conflict
This commit is contained in:
commit
946fe27248
51
README.md
51
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# assembly-nuxt
|
||||
# Assembly
|
||||
|
||||
## Build Setup
|
||||
|
||||
|
|
@ -18,52 +18,3 @@ $ yarn generate
|
|||
```
|
||||
|
||||
For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
|
||||
|
||||
## Special Directories
|
||||
|
||||
You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality.
|
||||
|
||||
### `assets`
|
||||
|
||||
The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets).
|
||||
|
||||
### `components`
|
||||
|
||||
The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components).
|
||||
|
||||
### `layouts`
|
||||
|
||||
Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts).
|
||||
|
||||
|
||||
### `pages`
|
||||
|
||||
This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing).
|
||||
|
||||
### `plugins`
|
||||
|
||||
The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins).
|
||||
|
||||
### `static`
|
||||
|
||||
This directory contains your static files. Each file inside this directory is mapped to `/`.
|
||||
|
||||
Example: `/static/robots.txt` is mapped as `/robots.txt`.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static).
|
||||
|
||||
### `store`
|
||||
|
||||
This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store).
|
||||
|
|
|
|||
|
|
@ -68,7 +68,16 @@
|
|||
>
|
||||
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
|
||||
<span class="flex items-center text-white">
|
||||
<div class="mr-2">
|
||||
<span
|
||||
class="text-white flex-grow-0 flex-shrink-0 bg-primary-blue-border shadow-sm rounded text-[10px] p-1"
|
||||
>
|
||||
v{{ account.version }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
#{{ account.id }}
|
||||
|
||||
</span>
|
||||
|
||||
<span
|
||||
|
|
@ -105,7 +114,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<button class="bg-primary-blue-darker hover:bg-primary-blue-hover border border-primary-blue-border text-white text-sm p-2 rounded flex items-center justify-center w-40" @click="createAccount" v-else>
|
||||
<button
|
||||
class="bg-primary-blue-darker hover:bg-primary-blue-hover border border-primary-blue-border text-white text-sm p-2 rounded flex items-center justify-center w-40"
|
||||
@click="createAccount"
|
||||
v-else
|
||||
>
|
||||
Create Account
|
||||
</button>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -27,17 +27,6 @@
|
|||
placeholder="Amount to borrow"
|
||||
:error="errors.amount.message"
|
||||
>
|
||||
<template v-if="!isMaxAmount" #suffix>
|
||||
<div class="absolute mt-2 top-0 right-0 mr-4">
|
||||
<button
|
||||
type="button"
|
||||
class="text-primary-blue-dark font-semibold text-sm hover:text-primary-blue-hover"
|
||||
@click="toggle"
|
||||
>
|
||||
Max
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</input-numeric>
|
||||
|
||||
<SidebarContextHeading class="mt-5">
|
||||
|
|
@ -150,12 +139,6 @@ export default defineComponent({
|
|||
|
||||
const address = computed(() => token.value?.address)
|
||||
|
||||
const factor = computed(
|
||||
() => displayPositions.value?.find((position) => rootTokenKey.value === position.key)?.factor
|
||||
)
|
||||
|
||||
const { toggle, isMaxAmount } = useMaxAmountActive(amount, balance)
|
||||
|
||||
const { validateAmount, validateLiquidation, validateLiquidity, validateIsLoggedIn } = useValidators()
|
||||
const errors = computed(() => {
|
||||
const hasAmountValue = !isZero(amount.value)
|
||||
|
|
@ -218,8 +201,6 @@ export default defineComponent({
|
|||
formatNumber,
|
||||
formatUsdMax,
|
||||
formatUsd,
|
||||
toggle,
|
||||
isMaxAmount,
|
||||
maxLiquidation,
|
||||
liquidationPrice,
|
||||
liquidationMaxPrice,
|
||||
|
|
|
|||
|
|
@ -19,17 +19,6 @@
|
|||
placeholder="Amount to borrow"
|
||||
:error="errors.amount.message"
|
||||
>
|
||||
<template v-if="!isMaxAmount" #suffix>
|
||||
<div class="absolute mt-2 top-0 right-0 mr-4">
|
||||
<button
|
||||
type="button"
|
||||
class="text-primary-blue-dark font-semibold text-sm hover:text-primary-blue-hover"
|
||||
@click="toggle"
|
||||
>
|
||||
Max
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</input-numeric>
|
||||
|
||||
<SidebarContextHeading class="mt-5">
|
||||
|
|
@ -70,14 +59,12 @@
|
|||
<script>
|
||||
import { computed, defineComponent, ref } from '@nuxtjs/composition-api'
|
||||
import InputNumeric from '~/components/common/input/InputNumeric.vue'
|
||||
import { useBalances } from '~/composables/useBalances'
|
||||
import { useBigNumber } from '~/composables/useBigNumber'
|
||||
import { useFormatting } from '~/composables/useFormatting'
|
||||
import { useValidators } from '~/composables/useValidators'
|
||||
import { useValidation } from '~/composables/useValidation'
|
||||
import { useToken } from '~/composables/useToken'
|
||||
import { useParsing } from '~/composables/useParsing'
|
||||
import { useMaxAmountActive } from '~/composables/useMaxAmountActive'
|
||||
import { useWeb3 } from '~/composables/useWeb3'
|
||||
import ToggleButton from '~/components/common/input/ToggleButton.vue'
|
||||
import { useDSA } from '~/composables/useDSA'
|
||||
|
|
@ -140,10 +127,6 @@ export default defineComponent({
|
|||
return currentPosition.value?.borrow || '0'
|
||||
})
|
||||
|
||||
const address = computed(() => token.value?.address)
|
||||
|
||||
const { toggle, isMaxAmount } = useMaxAmountActive(amount, balance)
|
||||
|
||||
const { validateAmount, validateLiquidation, validateLiquidity, validateIsLoggedIn } = useValidators()
|
||||
const errors = computed(() => {
|
||||
const hasAmountValue = !isZero(amount.value)
|
||||
|
|
@ -202,8 +185,6 @@ export default defineComponent({
|
|||
formatNumber,
|
||||
formatUsdMax,
|
||||
formatUsd,
|
||||
toggle,
|
||||
isMaxAmount,
|
||||
liquidationPrice,
|
||||
liquidationMaxPrice,
|
||||
errorMessages,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { Network } from "./useNetwork";
|
|||
import { useBigNumber } from "./useBigNumber";
|
||||
import { usePosition } from "./usePosition";
|
||||
import { useToken } from "./useToken";
|
||||
import { useSorting } from "./useSorting";
|
||||
|
||||
const {
|
||||
times,
|
||||
|
|
@ -67,6 +68,7 @@ export function useAaveV2Position(
|
|||
const { web3, chainId, networkName } = useWeb3();
|
||||
const { activeAccount } = useDSA();
|
||||
const { getTokenByKey, allATokensV2 } = useToken();
|
||||
const { byMaxSupplyOrBorrowDesc } = useSorting()
|
||||
|
||||
const resolver = computed(() =>
|
||||
chainId.value === 1
|
||||
|
|
@ -204,7 +206,8 @@ export function useAaveV2Position(
|
|||
max(a.supplyUsd, a.borrowUsd)
|
||||
).toNumber()
|
||||
)
|
||||
.map(overridePosition);
|
||||
.map(overridePosition)
|
||||
.sort(byMaxSupplyOrBorrowDesc);
|
||||
});
|
||||
|
||||
function getPositionOrDefaultPosition(token, position) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { useToken } from "./useToken";
|
|||
import addresses from "~/constant/addresses";
|
||||
import ctokens from "~/constant/ctokens";
|
||||
import tokenIdMapping from "~/constant/tokenIdMapping";
|
||||
import { useSorting } from "./useSorting";
|
||||
|
||||
const {
|
||||
times,
|
||||
|
|
@ -64,7 +65,7 @@ export function useCompoundPosition(
|
|||
const { web3, networkName } = useWeb3();
|
||||
const { activeAccount } = useDSA();
|
||||
const { getTokenByKey } = useToken();
|
||||
|
||||
const { byMaxSupplyOrBorrowDesc } = useSorting()
|
||||
const resolver = computed(() => addresses.mainnet.resolver.compound);
|
||||
|
||||
const fetchPosition = async () => {
|
||||
|
|
@ -195,7 +196,8 @@ export function useCompoundPosition(
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
})
|
||||
.sort(byMaxSupplyOrBorrowDesc);
|
||||
});
|
||||
|
||||
function getPositionOrDefaultPosition(token, pos) {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ export function useDSA() {
|
|||
if (web3.value) {
|
||||
dsa.value = new DSA(web3.value, chainId.value);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
@ -39,8 +38,7 @@ export function useDSA() {
|
|||
activeAccount.value = accounts.value[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export function useWeb3() {
|
|||
|
||||
// Subscribe to chainId change
|
||||
provider.on("chainChanged", refreshWeb3);
|
||||
provider.on("accountsChanged", refreshWeb3);
|
||||
};
|
||||
|
||||
const refreshWeb3 = async () => {
|
||||
|
|
@ -119,7 +120,6 @@ export function useWeb3() {
|
|||
let newWeb3 = new Web3(web3Provider);
|
||||
chainId.value = await newWeb3.eth.getChainId();
|
||||
web3.value = newWeb3;
|
||||
window.web3 = web3.value;
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="text-center py-8">
|
||||
<a
|
||||
class="font-medium text-primary-blue-dark hover:text-primary-blue-hover hover:underline"
|
||||
href="https://github.com/Instadapp/assembly-nuxt"
|
||||
href="https://github.com/Instadapp/assembly"
|
||||
target="_blank"
|
||||
>
|
||||
Contribute on GitHub
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "assembly-nuxt",
|
||||
"name": "assembly",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user