Skip to content

Commit

Permalink
Merge pull request #14 from CryptoManiacsZone/feature/migrator
Browse files Browse the repository at this point in the history
migration
  • Loading branch information
krboktv authored Aug 25, 2020
2 parents cd090d3 + ba2bbf5 commit 2f6aced
Show file tree
Hide file tree
Showing 18 changed files with 1,322 additions and 393 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"use-media": "^1.4.0"
},
"scripts": {
"start": "PORT=4200 react-scripts start",
"start": "PORT=4202 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
Expand Down
36 changes: 17 additions & 19 deletions src/components/PositionCard/V1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ import { ButtonSecondary } from '../Button'
import { RowBetween, RowFixed } from '../Row'
import { FixedHeightRow, HoverCard } from './index'
import DoubleCurrencyLogo from '../DoubleLogo'
import { useActiveWeb3React } from '../../hooks'
import { ThemeContext } from 'styled-components'

interface PositionCardProps extends RouteComponentProps<{}> {
token: Token
token0: Token
token1: Token
V1LiquidityBalance: TokenAmount
}

function V1PositionCard({ token, V1LiquidityBalance }: PositionCardProps) {
function UniV2PositionCard({ token0, token1, V1LiquidityBalance }: PositionCardProps) {
const theme = useContext(ThemeContext)

const { chainId } = useActiveWeb3React()

return (
<HoverCard>
<AutoColumn gap="12px">
<FixedHeightRow>
<RowFixed>
<DoubleCurrencyLogo currency0={token} margin={true} size={20} />
<RowFixed margin="auto">
<DoubleCurrencyLogo currency0={token0} currency1={token1} margin={true} size={20} />
<Text fontWeight={500} fontSize={20} style={{ marginLeft: '' }}>
{`${token.symbol}/ETH`}
{`${token0.symbol}/${token1.symbol}`}
</Text>
<Text
fontSize={12}
Expand All @@ -40,30 +38,30 @@ function V1PositionCard({ token, V1LiquidityBalance }: PositionCardProps) {
backgroundColor={theme.yellow1}
color={'black'}
>
V1
UniV2
</Text>
</RowFixed>
</FixedHeightRow>

<AutoColumn gap="8px">
<RowBetween marginTop="10px">
<ButtonSecondary width="68%" as={Link} to={`/migrate/v1/${V1LiquidityBalance.token.address}`}>
<ButtonSecondary width="100%" as={Link} to={`/migrate/${V1LiquidityBalance.token.address}`}>
Migrate
</ButtonSecondary>

<ButtonSecondary
style={{ backgroundColor: 'transparent' }}
width="28%"
as={Link}
to={`/remove/v1/${V1LiquidityBalance.token.address}`}
>
Remove
</ButtonSecondary>
{/*<ButtonSecondary*/}
{/* style={{ backgroundColor: 'transparent' }}*/}
{/* width="28%"*/}
{/* as={Link}*/}
{/* to={`/remove/${V1LiquidityBalance.token.address}`}*/}
{/*>*/}
{/* Remove*/}
{/*</ButtonSecondary>*/}
</RowBetween>
</AutoColumn>
</AutoColumn>
</HoverCard>
)
}

export default withRouter(V1PositionCard)
export default withRouter(UniV2PositionCard)
271 changes: 255 additions & 16 deletions src/constants/abis/migrator.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,293 @@
{
"inputs": [
{
"internalType": "address",
"name": "_factoryV1",
"internalType": "contract IOneSplitView",
"name": "_oneSplitView",
"type": "address"
},
{
"internalType": "address",
"name": "_router",
"internalType": "contract IOneSplit",
"name": "_oneSplit",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "token",
"internalType": "contract IERC20",
"name": "fromToken",
"type": "address"
},
{
"internalType": "contract IERC20",
"name": "destToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountTokenMin",
"name": "parts",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountETHMin",
"name": "flags",
"type": "uint256"
}
],
"name": "getExpectedReturn",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "distribution",
"type": "uint256[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "contract IERC20",
"name": "fromToken",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"internalType": "contract IERC20",
"name": "destToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "deadline",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "parts",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "flags",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "destTokenEthPriceTimesGasPrice",
"type": "uint256"
}
],
"name": "migrate",
"outputs": [],
"stateMutability": "nonpayable",
"name": "getExpectedReturnWithGas",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "estimateGasAmount",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "distribution",
"type": "uint256[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "contract IERC20[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "parts",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "flags",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "destTokenEthPriceTimesGasPrices",
"type": "uint256[]"
}
],
"name": "getExpectedReturnWithGasMulti",
"outputs": [
{
"internalType": "uint256[]",
"name": "returnAmounts",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "estimateGasAmount",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "distribution",
"type": "uint256[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "oneSplit",
"outputs": [
{
"internalType": "contract IOneSplit",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "oneSplitView",
"outputs": [
{
"internalType": "contract IOneSplitView",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "contract IERC20",
"name": "fromToken",
"type": "address"
},
{
"internalType": "contract IERC20",
"name": "destToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturn",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "distribution",
"type": "uint256[]"
},
{
"internalType": "uint256",
"name": "flags",
"type": "uint256"
}
],
"name": "swap",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"payable": true,
"stateMutability": "payable",
"type": "receive"
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "contract IERC20[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturn",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "distribution",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "flags",
"type": "uint256[]"
}
],
"name": "swapMulti",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"payable": true,
"stateMutability": "payable",
"type": "function"
}
]
]
Loading

0 comments on commit 2f6aced

Please sign in to comment.