merge main

This commit is contained in:
saml33 2022-11-11 22:39:14 +11:00
commit 8a6706e142
26 changed files with 322 additions and 163 deletions

79
components/SolanaTps.tsx Normal file
View File

@ -0,0 +1,79 @@
import { useEffect, useState } from 'react'
import sumBy from 'lodash/sumBy'
import { useTranslation } from 'next-i18next'
import { Connection } from '@solana/web3.js'
import mangoStore, { CLUSTER } from '@store/mangoStore'
import useInterval from './shared/useInterval'
const tpsAlertThreshold = 1000
const tpsWarningThreshold = 1300
const getRecentPerformance = async (
connection: Connection,
setTps: (x: number) => void
) => {
try {
const samples = 2
const response = await connection.getRecentPerformanceSamples(samples)
const totalSecs = sumBy(response, 'samplePeriodSecs')
const totalTransactions = sumBy(response, 'numTransactions')
const tps = totalTransactions / totalSecs
setTps(tps)
} catch {
console.log('Unable to fetch TPS')
}
}
const SolanaTps = () => {
const connection = mangoStore((s) => s.connection)
const [tps, setTps] = useState(0)
const { t } = useTranslation('common')
useEffect(() => {
getRecentPerformance(connection, setTps)
}, [])
useInterval(() => {
getRecentPerformance(connection, setTps)
}, 45 * 1000)
if (CLUSTER == 'mainnet-beta') {
return (
<div>
<p className="text-xs">{t('solana-tps')}</p>
<div className="flex items-center">
<div className="relative mr-1 h-3 w-3">
<div
className={`absolute top-0.5 left-0.5 h-2 w-2 rounded-full ${
tps < tpsWarningThreshold
? 'bg-th-orange'
: tps < tpsAlertThreshold
? 'bg-th-red'
: 'bg-th-green'
}`}
/>
<div
className={`absolute h-3 w-3 rounded-full opacity-40 ${
tps < tpsWarningThreshold
? 'bg-th-orange'
: tps < tpsAlertThreshold
? 'bg-th-red'
: 'bg-th-green'
}`}
/>
</div>
<span className="font-mono text-th-fgd-2">
{tps?.toLocaleString(undefined, {
maximumFractionDigits: 0,
})}
</span>
</div>
</div>
)
} else {
return null
}
}
export default SolanaTps

View File

@ -13,6 +13,7 @@ import CreateAccountModal from './modals/CreateAccountModal'
import MangoAccountsListModal from './modals/MangoAccountsListModal'
import { useRouter } from 'next/router'
import UserSetup from './UserSetup'
import SolanaTps from './SolanaTps'
const TopBar = () => {
const { t } = useTranslation('common')
@ -45,6 +46,7 @@ const TopBar = () => {
return (
<>
<div className="flex w-full items-center justify-between space-x-4">
{connected ? <SolanaTps /> : null}
<span className="mb-0 flex items-center">
{query.token ? (
<div

View File

@ -8,12 +8,14 @@ import {
XMarkIcon,
} from '@heroicons/react/20/solid'
import { Wallet } from '@project-serum/anchor'
import { TokenInstructions } from '@project-serum/serum'
import { useWallet } from '@solana/wallet-adapter-react'
import mangoStore from '@store/mangoStore'
import Decimal from 'decimal.js'
import { useTranslation } from 'next-i18next'
import Image from 'next/image'
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react'
import { MIN_SOL_BALANCE } from 'utils/constants'
import { notify } from 'utils/notifications'
import { floorToDecimal } from 'utils/numbers'
import ActionTokenList from './account/ActionTokenList'
@ -45,6 +47,14 @@ const UserSetup = ({ onClose }: { onClose: () => void }) => {
// const [showEditProfilePic, setShowEditProfilePic] = useState(false)
const walletTokens = mangoStore((s) => s.wallet.tokens)
const solBalance = useMemo(() => {
return (
walletTokens.find((t) =>
t.mint.equals(TokenInstructions.WRAPPED_SOL_MINT)
)?.uiAmount || 0
)
}, [walletTokens])
const connectWallet = async () => {
if (wallet) {
try {
@ -366,6 +376,7 @@ const UserSetup = ({ onClose }: { onClose: () => void }) => {
<div className="mt-10">
<Button
className="mb-6 flex w-44 items-center justify-center"
disabled={solBalance < MIN_SOL_BALANCE}
onClick={handleCreateAccount}
size="large"
>
@ -378,6 +389,14 @@ const UserSetup = ({ onClose }: { onClose: () => void }) => {
</div>
)}
</Button>
{solBalance < MIN_SOL_BALANCE ? (
<div className="mb-6">
<InlineNotification
type="error"
desc={t('deposit-more-sol')}
/>
</div>
) : null}
<LinkButton onClick={onClose}>
<span className="default-transition text-th-fgd-4 underline md:hover:text-th-fgd-3 md:hover:no-underline">
Skip for now

View File

@ -17,6 +17,7 @@ import AccountNameModal from '../modals/AccountNameModal'
import mangoStore from '@store/mangoStore'
import { copyToClipboard } from 'utils'
import { notify } from 'utils/notifications'
import { abbreviateAddress } from 'utils/formatting'
const AccountActions = () => {
const { t } = useTranslation(['common', 'close-account'])
@ -29,7 +30,9 @@ const AccountActions = () => {
const handleCopyAddress = (address: string) => {
copyToClipboard(address)
notify({
title: t('copy-address-success'),
title: t('copy-address-success', {
pk: abbreviateAddress(mangoAccount!.publicKey),
}),
type: 'success',
})
}

View File

@ -1,4 +1,4 @@
import { ChangeEvent, useState } from 'react'
import { ChangeEvent, useMemo, useState } from 'react'
import { useTranslation } from 'next-i18next'
import mangoStore from '@store/mangoStore'
import { notify } from '../../utils/notifications'
@ -10,6 +10,8 @@ import { useWallet } from '@solana/wallet-adapter-react'
import InlineNotification from '../shared/InlineNotification'
import { MangoAccount } from '@blockworks-foundation/mango-v4'
import { ArrowLeftIcon } from '@heroicons/react/20/solid'
import { TokenInstructions } from '@project-serum/serum'
import { MIN_SOL_BALANCE } from 'utils/constants'
const getNextAccountNumber = (accounts: MangoAccount[]): number => {
if (accounts.length > 1) {
@ -37,6 +39,15 @@ const CreateAccountForm = ({
const [loading, setLoading] = useState(false)
const [name, setName] = useState('')
const { wallet } = useWallet()
const walletTokens = mangoStore((s) => s.wallet.tokens)
const solBalance = useMemo(() => {
return (
walletTokens.find((t) =>
t.mint.equals(TokenInstructions.WRAPPED_SOL_MINT)
)?.uiAmount || 0
)
}, [walletTokens])
const handleNewAccount = async () => {
const client = mangoStore.getState().client
@ -122,11 +133,19 @@ const CreateAccountForm = ({
}
/>
</div>
<div className="space-y-6">
<div className="space-y-4">
<InlineNotification type="info" desc={t('insufficient-sol')} />
<Button className="w-full" onClick={handleNewAccount} size="large">
<Button
className="w-full"
disabled={solBalance < MIN_SOL_BALANCE}
onClick={handleNewAccount}
size="large"
>
{t('create-account')}
</Button>
{solBalance < MIN_SOL_BALANCE ? (
<InlineNotification type="error" desc={t('deposit-more-sol')} />
) : null}
</div>
</div>
)

View File

@ -45,7 +45,8 @@ const SwapTradeBalances = () => {
return []
}, [group, mangoAccount])
return showTableView ? (
return banks?.length ? (
showTableView ? (
<table className="min-w-full">
<thead>
<tr>
@ -69,7 +70,8 @@ const SwapTradeBalances = () => {
}
const inOrders = spotBalances[bank.mint.toString()]?.inOrders || 0.0
const unsettled = spotBalances[bank.mint.toString()]?.unsettled || 0.0
const unsettled =
spotBalances[bank.mint.toString()]?.unsettled || 0.0
return (
<tr key={key} className="text-sm">
@ -189,6 +191,11 @@ const SwapTradeBalances = () => {
})}
</>
)
) : (
<div className="flex flex-col items-center p-8">
<p>{t('trade:no-balances')}</p>
</div>
)
}
export default SwapTradeBalances

View File

@ -251,7 +251,7 @@ const SwapForm = () => {
</div>
</div>
<div id="swap-step-two" className="mb-2 flex items-end justify-between">
<p className="text-th-fgd-3">{t('trade')}</p>
<p className="text-th-fgd-3">{t('swap:pay')}</p>
<MaxSwapAmount
useMargin={useMargin}
setAmountIn={setAmountInFormValue}
@ -265,7 +265,7 @@ const SwapForm = () => {
type="input"
/>
</div>
<div className="col-span-1">
<div className="col-span-1 flex h-[54px]">
<NumberFormat
inputMode="decimal"
thousandSeparator=","
@ -274,7 +274,7 @@ const SwapForm = () => {
decimalScale={inputTokenInfo?.decimals || 6}
name="amountIn"
id="amountIn"
className="w-full rounded-lg rounded-l-none border border-th-bkg-4 bg-th-bkg-1 p-3 text-right font-mono text-base font-bold text-th-fgd-1 focus:outline-none lg:text-lg xl:text-xl"
className="w-full rounded-r-lg border border-th-bkg-4 bg-th-bkg-1 p-3 text-right font-mono text-base font-bold text-th-fgd-1 focus:outline-none lg:text-lg xl:text-xl"
placeholder="0.00"
value={amountInFormValue}
onValueChange={handleAmountInChange}
@ -304,7 +304,7 @@ const SwapForm = () => {
/>
</button>
</div>
<p className="mb-2 text-th-fgd-3">{t('swap:for')}</p>
<p className="mb-2 text-th-fgd-3">{t('swap:receive')}</p>
<div id="swap-step-three" className="mb-3 grid grid-cols-2">
<div className="col-span-1 rounded-lg rounded-r-none border border-r-0 border-th-bkg-4 bg-th-bkg-1">
<TokenSelect
@ -329,10 +329,10 @@ const SwapForm = () => {
thousandSeparator=","
allowNegative={false}
isNumericString={true}
decimalScale={inputTokenInfo?.decimals || 6}
name="amountIn"
id="amountIn"
className="w-full bg-th-bkg-1 p-3 text-right font-mono text-base font-bold text-th-fgd-1 focus:outline-none lg:text-lg xl:text-xl"
decimalScale={outputTokenInfo?.decimals || 6}
name="amountOut"
id="amountOut"
className="w-full rounded-r-lg bg-th-bkg-3 p-3 text-right font-mono text-base font-bold text-th-fgd-3 focus:outline-none lg:text-lg xl:text-xl"
placeholder="0.00"
disabled
value={

View File

@ -107,14 +107,18 @@ const AdvancedTradeForm = () => {
const handleBaseSizeChange = useCallback(
(e: NumberFormatValues, info: SourceInfo) => {
if (info.source !== 'event') return
set((s) => {
s.tradeForm.baseSize = e.value
if (s.tradeForm.price && !Number.isNaN(Number(e.value))) {
if (
s.tradeForm.price &&
e.value !== '' &&
!Number.isNaN(Number(e.value))
) {
s.tradeForm.quoteSize = (
parseFloat(s.tradeForm.price) * parseFloat(e.value)
).toString()
} else {
s.tradeForm.quoteSize = ''
}
})
},
@ -128,10 +132,16 @@ const AdvancedTradeForm = () => {
set((s) => {
s.tradeForm.quoteSize = e.value
if (Number(s.tradeForm.price)) {
if (
s.tradeForm.price &&
e.value !== '' &&
!Number.isNaN(Number(e.value))
) {
s.tradeForm.baseSize = (
parseFloat(e.value) / parseFloat(s.tradeForm.price)
).toString()
} else {
s.tradeForm.baseSize = ''
}
})
},

View File

@ -79,11 +79,10 @@ const OpenOrders = () => {
const mangoAccount = mangoStore.getState().mangoAccount.current
const selectedMarket = mangoStore.getState().selectedMarket.current
const actions = mangoStore.getState().actions
if (!group || !mangoAccount) return
setCancelId(o.orderId.toString())
try {
if (selectedMarket instanceof Serum3Market) {
if (selectedMarket instanceof PerpMarket) {
const tx = await client.perpCancelOrder(
group,
mangoAccount,

View File

@ -11,7 +11,7 @@ const PerpPositions = () => {
if (!group) return null
return (
return Object.entries(perpPositions).length ? (
<div>
<table>
<thead>
@ -53,6 +53,10 @@ const PerpPositions = () => {
</tbody>
</table>
</div>
) : (
<div className="flex flex-col items-center p-8">
<p>{t('trade:no-positions')}</p>
</div>
)
}

View File

@ -31,7 +31,7 @@
"connect": "Connect",
"connect-helper": "Connect to get started",
"copy-address": "Copy Address",
"copy-address-success": "Copied Mango Account address",
"copy-address-success": "Copied address: {{pk}}",
"create-account": "Create Account",
"creating-account": "Creating Account...",
"cumulative-interest-value": "Cumulative Interest Earned",
@ -40,6 +40,7 @@
"date-from": "Date From",
"date-to": "Date To",
"deposit": "Deposit",
"deposit-more-sol": "Deposit more SOL to your wallet before creating an account.",
"deposit-rate": "Deposit Rate (APR)",
"deposit-value": "Deposit Value",
"disconnect": "Disconnect",
@ -52,7 +53,7 @@
"governance": "Governance",
"health": "Health",
"health-impact": "Health Impact",
"insufficient-sol": "Solana requires 0.00757 SOL rent to create a Mango Account. This will be returned if you close your account.",
"insufficient-sol": "Solana requires 0.0294 SOL rent to create a Mango Account. This will be returned if you close your account.",
"interest-earned": "Interest Earned",
"interest-earned-paid": "Interest Earned",
"learn": "Learn",
@ -79,6 +80,7 @@
"sell": "Sell",
"settings": "Settings",
"show-zero-balances": "Show Zero Balances",
"solana-tps": "Solana TPS",
"spot": "Spot",
"stats": "Stats",
"swap": "Swap",

View File

@ -2,16 +2,15 @@
"confirm-swap": "Confirm Swap",
"est-liq-price": "Est. Liq Price",
"fees-paid-to": "Fees Paid to {{route}}",
"for": "For",
"from": "From",
"health-impact": "Health Impact",
"insufficient-balance": "Insufficient {{symbol}} Balance",
"insufficient-collateral": "Insufficient Collateral",
"minimum-received": "Minimum Received",
"pay": "You Pay",
"rate": "Rate",
"receive": "You Receive",
"review-swap": "Review Swap",
"slippage": "Slippage",
"swap-history": "Swap History",
"to": "To",
"use-margin": "Allow Margin"
}

View File

@ -11,7 +11,9 @@
"in-orders": "In Orders",
"limit-price": "Limit Price",
"margin": "Margin",
"no-balances": "No balances",
"no-orders": "No open orders",
"no-positions": "No positions",
"no-unsettled": "No unsettled funds",
"oracle-price": "Oracle Price",
"orders": "Orders",

View File

@ -31,7 +31,7 @@
"connect": "Connect",
"connect-helper": "Connect to get started",
"copy-address": "Copy Address",
"copy-address-success": "Copied Mango Account address",
"copy-address-success": "Copied address: {{pk}}",
"create-account": "Create Account",
"creating-account": "Creating Account...",
"cumulative-interest-value": "Cumulative Interest Earned",
@ -40,6 +40,7 @@
"date-from": "Date From",
"date-to": "Date To",
"deposit": "Deposit",
"deposit-more-sol": "Deposit more SOL to your wallet before creating an account.",
"deposit-rate": "Deposit Rate (APR)",
"deposit-value": "Deposit Value",
"disconnect": "Disconnect",
@ -52,7 +53,7 @@
"governance": "Governance",
"health": "Health",
"health-impact": "Health Impact",
"insufficient-sol": "Solana requires 0.00757 SOL rent to create a Mango Account. This will be returned if you close your account.",
"insufficient-sol": "Solana requires 0.0294 SOL rent to create a Mango Account. This will be returned if you close your account.",
"interest-earned": "Interest Earned",
"interest-earned-paid": "Interest Earned",
"learn": "Learn",
@ -79,6 +80,7 @@
"sell": "Sell",
"settings": "Settings",
"show-zero-balances": "Show Zero Balances",
"solana-tps": "Solana TPS",
"spot": "Spot",
"stats": "Stats",
"swap": "Swap",

View File

@ -2,16 +2,15 @@
"confirm-swap": "Confirm Swap",
"est-liq-price": "Est. Liq Price",
"fees-paid-to": "Fees Paid to {{route}}",
"for": "For",
"from": "From",
"health-impact": "Health Impact",
"insufficient-balance": "Insufficient {{symbol}} Balance",
"insufficient-collateral": "Insufficient Collateral",
"minimum-received": "Minimum Received",
"pay": "You Pay",
"rate": "Rate",
"receive": "You Receive",
"review-swap": "Review Swap",
"slippage": "Slippage",
"swap-history": "Swap History",
"to": "To",
"use-margin": "Allow Margin"
}

View File

@ -11,7 +11,9 @@
"in-orders": "In Orders",
"limit-price": "Limit Price",
"margin": "Margin",
"no-balances": "No balances",
"no-orders": "No open orders",
"no-positions": "No positions",
"no-unsettled": "No unsettled funds",
"oracle-price": "Oracle Price",
"orders": "Orders",

View File

@ -31,7 +31,7 @@
"connect": "Connect",
"connect-helper": "Connect to get started",
"copy-address": "Copy Address",
"copy-address-success": "Copied Mango Account address",
"copy-address-success": "Copied address: {{pk}}",
"create-account": "Create Account",
"creating-account": "Creating Account...",
"cumulative-interest-value": "Cumulative Interest Value",
@ -40,6 +40,7 @@
"date-from": "Date From",
"date-to": "Date To",
"deposit": "Deposit",
"deposit-more-sol": "Deposit more SOL to your wallet before creating an account.",
"deposit-rate": "Deposit Rate (APR)",
"deposit-value": "Deposit Value",
"disconnect": "Disconnect",
@ -52,7 +53,7 @@
"governance": "Governance",
"health": "Health",
"health-impact": "Health Impact",
"insufficient-sol": "Solana requires 0.00757 SOL rent to create a Mango Account. This will be returned if you close your account.",
"insufficient-sol": "Solana requires 0.0294 SOL rent to create a Mango Account. This will be returned if you close your account.",
"interest-earned": "Interest Earned",
"interest-earned-paid": "Interest Earned",
"learn": "Learn",
@ -80,6 +81,7 @@
"sell": "Sell",
"settings": "Settings",
"show-zero-balances": "Show Zero Balances",
"solana-tps": "Solana TPS",
"spot": "Spot",
"stats": "Stats",
"swap": "Swap",

View File

@ -2,16 +2,15 @@
"confirm-swap": "Confirm Swap",
"est-liq-price": "Est. Liq Price",
"fees-paid-to": "Fees Paid to {{route}}",
"for": "For",
"from": "From",
"health-impact": "Health Impact",
"insufficient-balance": "Insufficient {{symbol}} Balance",
"insufficient-collateral": "Insufficient Collateral",
"minimum-received": "Minimum Received",
"pay": "You Pay",
"rate": "Rate",
"receive": "You Receive",
"review-swap": "Review Swap",
"slippage": "Slippage",
"swap-history": "Swap History",
"to": "To",
"use-margin": "Allow Margin"
}

View File

@ -11,7 +11,9 @@
"in-orders": "In Orders",
"limit-price": "Limit Price",
"margin": "Margin",
"no-balances": "No balances",
"no-orders": "No open orders",
"no-positions": "No positions",
"no-unsettled": "No unsettled funds",
"oracle-price": "Oracle Price",
"orders": "Orders",

View File

@ -31,7 +31,7 @@
"connect": "Connect",
"connect-helper": "Connect to get started",
"copy-address": "Copy Address",
"copy-address-success": "Copied Mango Account address",
"copy-address-success": "Copied address: {{pk}}",
"create-account": "Create Account",
"creating-account": "Creating Account...",
"cumulative-interest-value": "Cumulative Interest Earned",
@ -40,6 +40,7 @@
"date-from": "Date From",
"date-to": "Date To",
"deposit": "Deposit",
"deposit-more-sol": "Deposit more SOL to your wallet before creating an account.",
"deposit-rate": "Deposit Rate (APR)",
"deposit-value": "Deposit Value",
"disconnect": "Disconnect",
@ -52,7 +53,7 @@
"governance": "Governance",
"health": "Health",
"health-impact": "Health Impact",
"insufficient-sol": "Solana requires 0.00757 SOL rent to create a Mango Account. This will be returned if you close your account.",
"insufficient-sol": "Solana requires 0.0294 SOL rent to create a Mango Account. This will be returned if you close your account.",
"interest-earned": "Interest Earned",
"interest-earned-paid": "Interest Earned",
"learn": "Learn",
@ -79,6 +80,7 @@
"sell": "Sell",
"settings": "Settings",
"show-zero-balances": "Show Zero Balances",
"solana-tps": "Solana TPS",
"spot": "Spot",
"stats": "Stats",
"swap": "Swap",

View File

@ -2,16 +2,15 @@
"confirm-swap": "Confirm Swap",
"est-liq-price": "Est. Liq Price",
"fees-paid-to": "Fees Paid to {{route}}",
"for": "For",
"from": "From",
"health-impact": "Health Impact",
"insufficient-balance": "Insufficient {{symbol}} Balance",
"insufficient-collateral": "Insufficient Collateral",
"minimum-received": "Minimum Received",
"pay": "You Pay",
"rate": "Rate",
"receive": "You Receive",
"review-swap": "Review Swap",
"slippage": "Slippage",
"swap-history": "Swap History",
"to": "To",
"use-margin": "Allow Margin"
}

View File

@ -11,7 +11,9 @@
"in-orders": "In Orders",
"limit-price": "Limit Price",
"margin": "Margin",
"no-balances": "No balances",
"no-orders": "No open orders",
"no-positions": "No positions",
"no-unsettled": "No unsettled funds",
"oracle-price": "Oracle Price",
"orders": "Orders",

View File

@ -31,7 +31,7 @@
"connect": "Connect",
"connect-helper": "Connect to get started",
"copy-address": "Copy Address",
"copy-address-success": "Copied Mango Account address",
"copy-address-success": "Copied address: {{pk}}",
"create-account": "Create Account",
"creating-account": "Creating Account...",
"cumulative-interest-value": "Cumulative Interest Earned",
@ -40,6 +40,7 @@
"date-from": "Date From",
"date-to": "Date To",
"deposit": "Deposit",
"deposit-more-sol": "Deposit more SOL to your wallet before creating an account.",
"deposit-rate": "Deposit Rate (APR)",
"deposit-value": "Deposit Value",
"disconnect": "Disconnect",
@ -52,7 +53,7 @@
"governance": "Governance",
"health": "Health",
"health-impact": "Health Impact",
"insufficient-sol": "Solana requires 0.00757 SOL rent to create a Mango Account. This will be returned if you close your account.",
"insufficient-sol": "Solana requires 0.0294 SOL rent to create a Mango Account. This will be returned if you close your account.",
"interest-earned": "Interest Earned",
"interest-earned-paid": "Interest Earned",
"learn": "Learn",
@ -80,6 +81,7 @@
"settings": "Settings",
"show-zero-balances": "Show Zero Balances",
"spot": "Spot",
"solana-tps": "Solana TPS",
"stats": "Stats",
"swap": "Swap",
"time": "Time",

View File

@ -2,16 +2,15 @@
"confirm-swap": "Confirm Swap",
"est-liq-price": "Est. Liq Price",
"fees-paid-to": "Fees Paid to {{route}}",
"for": "For",
"from": "From",
"health-impact": "Health Impact",
"insufficient-balance": "Insufficient {{symbol}} Balance",
"insufficient-collateral": "Insufficient Collateral",
"minimum-received": "Minimum Received",
"pay": "You Pay",
"rate": "Rate",
"receive": "You Receive",
"review-swap": "Review Swap",
"slippage": "Slippage",
"swap-history": "Swap History",
"to": "To",
"use-margin": "Allow Margin"
}

View File

@ -11,7 +11,9 @@
"in-orders": "In Orders",
"limit-price": "Limit Price",
"margin": "Margin",
"no-balances": "No balances",
"no-orders": "No open orders",
"no-positions": "No positions",
"no-unsettled": "No unsettled funds",
"oracle-price": "Oracle Price",
"orders": "Orders",

View File

@ -41,3 +41,5 @@ export const GRID_LAYOUT_KEY = 'savedLayouts-0.1'
export const ORDERBOOK_FLASH_KEY = 'showOrderbookFlash-0.1'
export const NOTIFICATION_POSITION_KEY = 'notificationPosition'
export const MIN_SOL_BALANCE = 0.04