Skip to content

Commit

Permalink
Merge pull request #142 from balancer/tools-updates
Browse files Browse the repository at this point in the history
Tools updates
  • Loading branch information
mikemcdonald authored Aug 16, 2023
2 parents 4fd3770 + 4daea19 commit eaae1b3
Show file tree
Hide file tree
Showing 35 changed files with 1,390 additions and 297 deletions.
153 changes: 153 additions & 0 deletions docs/.vuepress/abis/ERC20.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
export const ERC20ABI = [
{
inputs: [
{ internalType: 'string', name: 'name_', type: 'string' },
{ internalType: 'string', name: 'symbol_', type: 'string' },
{ internalType: 'uint8', name: 'decimals_', type: 'uint8' },
{ internalType: 'uint256', name: 'initialBalance_', type: 'uint256' },
{
internalType: 'address payable',
name: 'feeReceiver_',
type: 'address',
},
],
stateMutability: 'payable',
type: 'constructor',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'spender',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Approval',
type: 'event',
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: 'address', name: 'from', type: 'address' },
{ indexed: true, internalType: 'address', name: 'to', type: 'address' },
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Transfer',
type: 'event',
},
{
inputs: [
{ internalType: 'address', name: 'owner', type: 'address' },
{ internalType: 'address', name: 'spender', type: 'address' },
],
name: 'allowance',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'approve',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
name: 'balanceOf',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'decimals',
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'subtractedValue', type: 'uint256' },
],
name: 'decreaseAllowance',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'addedValue', type: 'uint256' },
],
name: 'increaseAllowance',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'name',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'symbol',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'totalSupply',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'recipient', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'transfer',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'sender', type: 'address' },
{ internalType: 'address', name: 'recipient', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'transferFrom',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
];
15 changes: 11 additions & 4 deletions docs/.vuepress/components/BatchSwap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const GlobalProvider = createProviderComponent(() => {
<GlobalProvider>
<div class="ToolboxWidget">
<div class="ToolboxWidget__content">
<NetworkSelect />
<div style="display: inline-block">
<NetworkSelect />
</div>
<BatchSwapView />
</div>
</div>
Expand Down Expand Up @@ -63,14 +65,19 @@ const GlobalProvider = createProviderComponent(() => {
</style>
<style scoped>
.ToolboxWidget {
background-color: #fff;
display: flex;
flex-direction: column;
border-radius: 6px;
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.dark .ToolboxWidget {
color: #fff;
}
.ToolboxWidget__content {
flex: 1;
}
.ToolboxWidget__content > * + * {
margin-top: 24px;
}
</style>
50 changes: 48 additions & 2 deletions docs/.vuepress/components/BatchSwap/BatchSwapView.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import Menu from './Menu.vue';
import EditPathForm from './EditPathForm.vue';
import Output from './Output.vue';
import { useNetwork } from '../../providers/network';
const { network } = useNetwork();
const selectedPath = ref(0);
const swapKind = ref(1);
const swapKind = ref(0);
const sender = ref('');
const senderInternalBalance = ref(false);
const recipient = ref('');
Expand Down Expand Up @@ -35,6 +38,39 @@ const paths = ref([
},
]);
watch(network, () => {
selectedPath.value = 0;
swapKind.value = 0;
sender.value = '';
senderInternalBalance.value = false;
recipient.value = '';
recipientInternalBalance.value = false;
deadline.value = '';
paths.value = [
{
amount: '',
tokenIn: null,
hops: [
{
pool: null,
tokenOut: null,
},
],
},
{
amount: '',
tokenIn: null,
hops: [
{
pool: null,
tokenOut: null,
},
],
},
];
});
function addPath() {
paths.value.push({
amount: '',
Expand Down Expand Up @@ -151,10 +187,16 @@ function onTokenOutChange(token, index) {
</template>
<style scoped>
.batch-swap-view {
border: 1px solid #e2e8f0;
border-radius: 12px;
display: flex;
height: 100%;
}
.dark .batch-swap-view {
border-color: #3e4c5a;
}
.batch-swap-view__side-nav {
width: 175px;
flex-shrink: 0;
Expand All @@ -170,6 +212,10 @@ function onTokenOutChange(token, index) {
flex-shrink: 0;
}
.dark .batch-swap-view__edit-path {
border-color: #3e4c5a;
}
.batch-swap-view__edit-path::-webkit-scrollbar {
display: none;
}
Expand Down
19 changes: 17 additions & 2 deletions docs/.vuepress/components/BatchSwap/EditPathForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const props = defineProps({
},
});
const { tokens, getToken } = useTokens();
const { tokens, getToken, searchTokens } = useTokens();
const tokenIn = computed(() => {
if (!props.path.tokenIn) {
Expand Down Expand Up @@ -77,7 +77,12 @@ const tokenIn = computed(() => {
/>
<span v-if="tokenIn">{{ tokenIn.symbol }}</span>
</SelectTrigger>
<SelectOptions v-slot="token" :options="tokens" optionKey="address">
<SelectOptions
v-slot="token"
:options="tokens"
optionKey="address"
:searchFn="searchTokens"
>
<Avatar
:address="token.address"
:imageURL="token.logoURI"
Expand Down Expand Up @@ -135,6 +140,11 @@ const tokenIn = computed(() => {
width: 100%;
}
.dark .add-hop-button {
background-color: #384aff;
color: #fff;
}
.add-hop-button svg {
height: 20px;
width: 20px;
Expand All @@ -144,4 +154,9 @@ const tokenIn = computed(() => {
background-color: #dbeafe;
color: #2563eb;
}
.dark .add-hop-button:hover {
background-color: #2436eb;
color: #fff;
}
</style>
9 changes: 7 additions & 2 deletions docs/.vuepress/components/BatchSwap/HopForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const pool = computed(() => {
return null;
}
return getPoolByID(props.hop.pool);
const _p = getPoolByID(props.hop.pool);
return _p;
});
const tokenOut = computed(() => {
Expand Down Expand Up @@ -144,12 +146,15 @@ const tokenOut = computed(() => {
padding: 12px;
}
.dark .hop-form {
border-color: #3e4c5a;
}
.hop-form > * + * {
margin-top: 16px;
}
.hop-form hr {
border-color: #e2e8f0;
margin-bottom: 0;
}
Expand Down
27 changes: 27 additions & 0 deletions docs/.vuepress/components/BatchSwap/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,17 @@ defineProps({
<style scoped>
.menu {
background-color: #f8fafc;
border-right: 1px solid transparent;
padding: 24px 8px;
height: 100%;
width: 100%;
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
}
.dark .menu {
background-color: #1e293b;
border-color: #3e4c5a;
}
.menu-items > * + * {
Expand All @@ -101,16 +109,35 @@ defineProps({
width: 100%;
}
.dark .menu-item {
color: #e2e8f0;
}
.menu-item--active,
.menu-item__wrapper:hover .menu-item {
background-color: #eaf0f6;
}
.dark .menu-item--active,
.dark .menu-item__wrapper:hover .menu-item {
background-color: #334155;
}
.add-path-button {
background-color: #eff6ff;
color: #2563eb;
}
.dark .add-path-button {
background-color: #384aff;
color: #fff;
}
.dark .add-path-button:hover {
background-color: #2436eb;
color: #fff;
}
.add-path-button:hover {
background-color: #dbeafe;
color: #2563eb;
Expand Down
Loading

1 comment on commit eaae1b3

@vercel
Copy link

@vercel vercel bot commented on eaae1b3 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.