Skip to content

Commit

Permalink
Merge pull request #2310 from keep-network/keep-only-pool-dapp
Browse files Browse the repository at this point in the history
KEEP-only pool dashboard support

Adds support for KEEP-only pool in the KEEP token dashboard.

Main changes:

- the new liquidity pool strategy to handle TokenGeyser contract API,
- deploy KeepTokenGeyser contract to the local/Ropsten network,
- script that initializes the KeepTokenGeyser contract- for development purposes
in KEEP token dashboard.
  • Loading branch information
michalsmiarowski authored Feb 10, 2021
2 parents d69d004 + c19f44b commit 1f7338f
Show file tree
Hide file tree
Showing 31 changed files with 1,125 additions and 187 deletions.
6 changes: 3 additions & 3 deletions solidity/dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion solidity/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"dependencies": {
"@0x/subproviders": "^6.0.8",
"@keep-network/keep-core": "1.4.1",
"@keep-network/keep-core": "1.7.0",
"@keep-network/keep-ecdsa": "1.6.0",
"@keep-network/tbtc": "1.1.0",
"@ledgerhq/hw-app-eth": "^5.13.0",
Expand Down
7 changes: 5 additions & 2 deletions solidity/dashboard/src/actions/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,16 @@ export const withdrawGroupMemberRewards = (

export const withdrawAllLiquidityRewards = (
liquidityPairContractName,
amount,
pool,
meta
) => {
return {
type: WEB3_SEND_TRANSACTION,
type: "liquidity_rewards/withdraw_tokens",
payload: {
contractName: liquidityPairContractName,
methodName: "exit",
amount,
pool,
},
meta,
}
Expand Down
2 changes: 1 addition & 1 deletion solidity/dashboard/src/components/AddETHModal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback } from "react"
import AvailableETHForm from "./AvailableETHForm"
import AvailableETHForm from "./AvailableTokenForm"
import { getErrorsObj } from "../forms/common-validators"
import { withFormik } from "formik"
import web3Utils from "web3-utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { useCustomOnSubmitFormik } from "../hooks/useCustomOnSubmitFormik"
import FormInput from "./FormInput"
import { colors } from "../constants/colors"

const AvailableETHForm = ({
const AvailableTokenForm = ({
onSubmit,
onCancel,
submitBtnText,
formInputProps,
...formikProps
}) => {
const onSubmitBtn = useCustomOnSubmitFormik(onSubmit)
Expand All @@ -19,6 +20,7 @@ const AvailableETHForm = ({
type="text"
label="ETH Amount"
placeholder="0"
{...formInputProps}
/>
<div
className="flex row center mt-2"
Expand Down Expand Up @@ -46,4 +48,4 @@ const AvailableETHForm = ({
)
}

export default React.memo(AvailableETHForm)
export default React.memo(AvailableTokenForm)
22 changes: 7 additions & 15 deletions solidity/dashboard/src/components/DelegateStakeForm.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react"
import BigNumber from "bignumber.js"
import { SubmitButton } from "./Button"
import FormInput from "./FormInput"
import { withFormik, useFormikContext } from "formik"
Expand All @@ -9,7 +8,7 @@ import {
getErrorsObj,
} from "../forms/common-validators"
import { useCustomOnSubmitFormik } from "../hooks/useCustomOnSubmitFormik"
import { displayAmount, fromTokenUnit, toTokenUnit } from "../utils/token.utils"
import { displayAmount, fromTokenUnit } from "../utils/token.utils"
import ProgressBar from "./ProgressBar"
import { colors } from "../constants/colors"
import {
Expand All @@ -18,7 +17,8 @@ import {
} from "../forms/form.utils.js"
import { lte } from "../utils/arithmetics.utils"
import * as Icons from "./Icons"
import Tag from "./Tag"
import MaxAmountAddon from "./MaxAmountAddon"
import useSetMaxAmountToken from "../hooks/useSetMaxAmountToken"

const DelegateStakeForm = ({
onSubmit,
Expand Down Expand Up @@ -111,14 +111,8 @@ const TokensAmountField = ({
minStake,
stakeTokensValue,
}) => {
const { setFieldValue } = useFormikContext()
const onAddonClick = useSetMaxAmountToken("stakeTokens", availableToStake)

const onAddonClick = () => {
setFieldValue(
"stakeTokens",
toTokenUnit(availableToStake).toFixed(0, BigNumber.ROUND_DOWN)
)
}
return (
<div className="token-amount-wrapper">
<div className="token-amount-field">
Expand All @@ -133,7 +127,9 @@ const TokensAmountField = ({
minStake
)} KEEP`}
leftIcon={<Icons.KeepOutline className="keep-outline--mint-100" />}
inputAddon={<MaxStakeAddon onClick={onAddonClick} />}
inputAddon={
<MaxAmountAddon onClick={onAddonClick} text="Max Stake" />
}
/>
<ProgressBar
total={availableToStake}
Expand All @@ -154,10 +150,6 @@ const TokensAmountField = ({
)
}

const MaxStakeAddon = ({ onClick }) => {
return <Tag IconComponent={Icons.Plus} text="Max Stake" onClick={onClick} />
}

const connectedWithFormik = withFormik({
mapPropsToValues: () => ({
beneficiaryAddress: "",
Expand Down
1 change: 1 addition & 0 deletions solidity/dashboard/src/components/Icons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export { ReactComponent as StakeDrop } from "../static/svg/stakedrop.svg"
export { ReactComponent as SwordOperations } from "../static/svg/sword-operations.svg"
export { ReactComponent as MoreInfo } from "../static/svg/more-info.svg"
export { ReactComponent as EthToken } from "../static/svg/eth_token.svg"
export { ReactComponent as KeepOnlyPool } from "../static/svg/keep-only-pool.svg"
export { ReactComponent as BalancerLogo } from "../static/svg/balancer-logo.svg"
export { ReactComponent as UniswapLogo } from "../static/svg/uniswap-logo.svg"

Expand Down
Loading

0 comments on commit 1f7338f

Please sign in to comment.