Skip to content

Commit

Permalink
fix(kovan): Deploys kovan and updates packages with kovan deployments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexangelj committed Mar 13, 2021
1 parent 41d6753 commit 718989a
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 38 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@material-ui/icons": "^4.9.1",
"@material-ui/styles": "^4.10.0",
"@metamask/onboarding": "^1.0.0",
"@primitivefi/sdk": "1.4.1",
"@primitivefi/v1-connectors": "2.2.0",
"@primitivefi/sdk": "1.4.2",
"@primitivefi/v1-connectors": "2.2.1",
"@reduxjs/toolkit": "^1.4.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
Expand Down Expand Up @@ -66,7 +66,7 @@
]
},
"devDependencies": {
"@primitivefi/contracts": "0.4.4",
"@primitivefi/contracts": "0.6.0",
"@sushiswap/sdk": "5.0.0-canary.3",
"@types/jest": "^26.0.7",
"@types/node": "^14.0.26",
Expand Down
14 changes: 9 additions & 5 deletions src/components/Market/BalanceCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useItem } from '@/state/order/hooks'

import useTokenBalance from '@/hooks/useTokenBalance'
import { mintTestTokens, WETH9, Operation, STABLECOINS } from '@primitivefi/sdk'
import { ChainId } from '@sushiswap/sdk'

import { formatEther } from 'ethers/lib/utils'
const fetcher = (library) => (...args) => {
Expand All @@ -31,7 +32,10 @@ const BalanceCard: React.FC = () => {
const { item } = useItem()
const addTransaction = useTransactionAdder()
const { library, account, chainId } = useWeb3React()
const daiBal = useTokenBalance(STABLECOINS[chainId].address)
const daiBal =
chainId === ChainId.KOVAN
? '0'
: useTokenBalance(STABLECOINS[chainId].address)
const wethBal = useTokenBalance(WETH9[chainId].address)

const [ethBal, setEth] = useState('')
Expand Down Expand Up @@ -85,7 +89,7 @@ const BalanceCard: React.FC = () => {
return (
<>
<CustomCard>
{chainId === 4 ? (
{chainId === 4 || chainId === 42 ? (
<>
<Spacer size="sm" />
<Button
Expand All @@ -99,12 +103,12 @@ const BalanceCard: React.FC = () => {

<LineItem label={`DAI Balance`} data={daiBal} />
<Spacer size="sm" />
{balance.token.symbol === 'WETH' ? (
{balance?.token.symbol === 'WETH' ? (
<LineItem label={`ETH Balance`} data={formatEther(ethBal)} />
) : (
<LineItem
label={`${balance.token.symbol} Balance`}
data={formatEther(balance.raw.toString())}
label={`${balance?.token.symbol} Balance`}
data={formatEther(balance ? balance?.raw.toString() : '0')}
/>
)}
</CustomCard>
Expand Down
2 changes: 1 addition & 1 deletion src/components/WethWrapper/WethWraper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { TokenAmount, Token } from '@sushiswap/sdk'
import { ethers } from 'ethers'
import { parseEther, formatEther } from 'ethers/lib/utils'

import WethArtifact from '@primitivefi/contracts/artifacts/WETH9.json'
import WethArtifact from '@primitivefi/contracts/artifacts/contracts/test/tokens/WETH9.sol/WETH9.json'
import { SinglePositionParameters, WETH9 } from '@primitivefi/sdk'

const WethWrapper: React.FC = () => {
Expand Down
8 changes: 4 additions & 4 deletions src/constants/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import UniswapConnector from '@primitivefi/v1-connectors/deployments/live/UniswapConnector03.json'
import OptionFactory from '@primitivefi/contracts/deployments/live_1/OptionFactory.json'
import RedeemFactory from '@primitivefi/contracts/deployments/live_1/RedeemFactory.json'
import Registry from '@primitivefi/contracts/deployments/live_1/Registry.json'
import Trader from '@primitivefi/contracts/deployments/live_1/Trader.json'
import OptionFactory from '@primitivefi/contracts/deployments/live/OptionFactory.json'
import RedeemFactory from '@primitivefi/contracts/deployments/live/RedeemFactory.json'
import Registry from '@primitivefi/contracts/deployments/live/Registry.json'
import Trader from '@primitivefi/contracts/deployments/live/Trader.json'

import PrimitiveRouter from '@primitivefi/v1-connectors/deployments/live/PrimitiveRouter.json'
import PrimitiveCore from '@primitivefi/v1-connectors/deployments/live/PrimitiveCore.json'
Expand Down
9 changes: 5 additions & 4 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { ChainId, JSBI, Percent, Token, WETH } from '@sushiswap/sdk'
import { parseEther } from 'ethers/lib/utils'

import { injected, walletconnect } from '../connectors'
import UniswapConnectorTestnet from '@primitivefi/v1-connectors/deployments/rinkeby/UniswapConnector03.json'
import UniswapConnector from '@primitivefi/v1-connectors/deployments/live/UniswapConnector03.json'
import Trader from '@primitivefi/contracts/deployments/live_1/Trader.json'
import TraderTestnet from '@primitivefi/contracts/deployments/rinkeby/Trader.json'

export interface Wallet {
connector: AbstractConnector
Expand Down Expand Up @@ -47,6 +43,7 @@ export const NAME_FOR_MARKET: { [key: string]: string } = {
aave: 'Aave',
snx: 'Synthetix',
mkr: 'Maker',
rai: 'RAI',
}

export const SORT_FOR_MARKET: { [key: string]: number } = {
Expand All @@ -59,6 +56,7 @@ export const SORT_FOR_MARKET: { [key: string]: number } = {
aave: 6,
snx: 7,
mkr: 8,
rai: 9,
}

export const COINGECKO_ID_FOR_MARKET: { [key: string]: string } = {
Expand All @@ -71,6 +69,7 @@ export const COINGECKO_ID_FOR_MARKET: { [key: string]: string } = {
aave: 'aave',
snx: 'havven',
mkr: 'maker',
rai: 'rai',
}

export const ADDRESS_FOR_MARKET: { [key: string]: string } = {
Expand All @@ -83,6 +82,7 @@ export const ADDRESS_FOR_MARKET: { [key: string]: string } = {
aave: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
snx: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F',
mkr: '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2',
rai: '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919',
}

export const ACTIVE_FOR_MARKET: { [key: string]: boolean } = {
Expand All @@ -95,6 +95,7 @@ export const ACTIVE_FOR_MARKET: { [key: string]: boolean } = {
aave: false,
snx: false,
mkr: false,
rai: true,
}

export const MARKETS: Market[] = Object.keys(SORT_FOR_MARKET).map(
Expand Down
1 change: 0 additions & 1 deletion src/hooks/data/useBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Web3Provider } from '@ethersproject/providers'
import { Contract } from '@ethersproject/contracts'

import { Token, TokenAmount, Pair, JSBI, ChainId } from '@sushiswap/sdk'
import OptionContract from '@primitivefi/contracts/artifacts/Option.json'
import IERC20 from '@uniswap/v2-core/build/IERC20.json'

import { useKeepSWRDataLiveAsBlocksArrive, useContract } from '../utils/index'
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/transactions/useApprove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback } from 'react'
import { useWeb3React } from '@web3-react/core'
import { Operation } from '@/constants/index'
import ethers, { BigNumber } from 'ethers'
import ERC20 from '@primitivefi/contracts/artifacts/ERC20.json'
import ERC20 from '@primitivefi/contracts/artifacts/contracts/option/primitives/ERC20.sol/ERC20.json'
import { parseEther, formatEther, parseUnits } from 'ethers/lib/utils'

import { useTransactionAdder } from '@/state/transactions/hooks'
Expand Down
4 changes: 3 additions & 1 deletion src/state/options/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const useUpdateOptions = (): ((
}, 200)
Protocol.getOptionsUsingMultiCall(
chainId,
chainId == ChainId.RINKEBY ? testAddresses : optionAddresses,
chainId == ChainId.RINKEBY || chainId == ChainId.KOVAN
? testAddresses
: optionAddresses,
provider
)
.then((optionEntitiesObject) => {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/executeTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ethers, { BigNumberish } from 'ethers'
import ERC20 from '@primitivefi/contracts/artifacts/ERC20.json'
import Option from '@primitivefi/contracts/artifacts/Option.json'
import ERC20 from '@primitivefi/contracts/artifacts/contracts/option/primitives/ERC20.sol/ERC20.json'
import { parseEther } from 'ethers/lib/utils'
import { SinglePositionParameters } from '@primitivefi/sdk'
const MIN_ALLOWANCE: ethers.BigNumber = parseEther('10000000')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mintTestTokens.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ethers from 'ethers'
import ERC20 from '@primitivefi/contracts/artifacts/TestERC20.json'
import ERC20 from '@primitivefi/contracts/artifacts/contracts/option/primitives/ERC20.sol/ERC20.json'

/* const mintTestTokens = async (address: string, signer: ethers.Signer) => {
const tokenArray = [
Expand Down
39 changes: 24 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2093,24 +2093,33 @@
resolved "https://registry.yarnpkg.com/@opentelemetry/context-base/-/context-base-0.14.0.tgz#c67fc20a4d891447ca1a855d7d70fa79a3533001"
integrity sha512-sDOAZcYwynHFTbLo6n8kIbLiVF3a3BLkrmehJUyEbT9F+Smbi47kLGS2gG2g0fjBLR/Lr1InPD7kXL7FaTqEkw==

"@openzeppelin/contracts@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.0.1.tgz#2f327f77d16b43f14674086b2b634bda38cb0838"
integrity sha512-uSrD7hZ0ViuHGqHZbeHawZBi/uy7aBiNramXAt2dFFuSuoU4u9insS3V3zdVfOnYSPreUo636xSOuQIFN4//HA==

"@openzeppelin/contracts@^3.2.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.3.0.tgz#ffdb693c5c349fc33bba420248dd3ac0a2d7c408"
integrity sha512-AemZEsQYtUp1WRkcmZm1div5ORfTpLquLaziCIrSagjxyKdmObxuaY1yjQ5SHFMctR8rLwp706NXTbiIRJg7pw==

"@primitivefi/contracts@0.4.4", "@primitivefi/contracts@^0.4.2":
version "0.4.4"
resolved "https://registry.yarnpkg.com/@primitivefi/contracts/-/contracts-0.4.4.tgz#082de30bf71b4895bd767b916cb9d641a430f783"
integrity sha512-J2JzR36lwmnWHCgGakPm5bRCKqAtixJFTjkBbiJ31ZmKGrjxKBCMeOmJzSbGbqXUyTYfT/Mfik6tZ+oZEQL8bA==
"@primitivefi/contracts@0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@primitivefi/contracts/-/contracts-0.6.0.tgz#436759bc67b66d8887ffd38829923f4de7e382cf"
integrity sha512-Kjik84J4Z3xhgSlSeWnjbMc8f9guuNG7DPl94yFDSLPUGsf4FgdqEQmdSy26sPWC0lEpTVssC/0awFo3inXirw==
dependencies:
"@openzeppelin/contracts" "3.0.1"
"@uniswap/v2-core" "^1.0.1"
"@uniswap/v2-periphery" "^1.1.0-beta.0"

"@primitivefi/sdk@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@primitivefi/sdk/-/sdk-1.4.1.tgz#26e119e386a82b4cd548df727673df799644d6c7"
integrity sha512-omgDP8tbNN3Uwm/cqKd+jsthkoIgdSUsfhfo1jrdW56uVKxROLIT5ggy+17lyyWgI75tCT+7oUV4X+rWR9H1wg==
"@primitivefi/sdk@1.4.2":
version "1.4.2"
resolved "https://registry.yarnpkg.com/@primitivefi/sdk/-/sdk-1.4.2.tgz#fbd3a2a681dbf808a3b1db0d228b9e0d25520ad6"
integrity sha512-otbzMU+NY7m/6F1213SMAZcch5r8wZF3X18sS1T7yl6I5UP5X2b/Txd0JXm00ByQ86dzivU7PRP6uec2jTy/6A==
dependencies:
"@ethersproject/providers" "^5.0.5"
"@primitivefi/contracts" "0.4.4"
"@primitivefi/v1-connectors" "2.2.0"
"@primitivefi/contracts" "0.6.0"
"@primitivefi/v1-connectors" "2.2.1"
"@uniswap/v2-core" "^1.0.1"
"@uniswap/v2-periphery" "^1.1.0-beta.0"
bignumber.js "^9.0.0"
Expand All @@ -2121,13 +2130,13 @@
web3 "^1.2.6"
web3modal "^1.5.0"

"@primitivefi/v1-connectors@2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@primitivefi/v1-connectors/-/v1-connectors-2.2.0.tgz#d4d48f7e0d432446ad308e986980a5e16f849777"
integrity sha512-FvFfQPKPqkbCiWJBmjqRbwr5tiRcqgYkIIDv0Q9IaIbUMj2m3jxCBi2W06DgNVypU8ORF5prVqpbFFdjfyShZA==
"@primitivefi/v1-connectors@2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@primitivefi/v1-connectors/-/v1-connectors-2.2.1.tgz#0616a9ca593de048d11b524b047f3e0b26edc92e"
integrity sha512-2wAS3XnFK7K6h8viUvrd/6IdB4Hrd9pa1eV5ETssARNC434PYLbOuTaYdX5XaOkAFM509gEAk5ZGordBoZFlKQ==
dependencies:
"@openzeppelin/contracts" "^3.2.0"
"@primitivefi/contracts" "^0.4.2"
"@primitivefi/contracts" "0.6.0"
"@uniswap/v2-core" "^1.0.1"
"@uniswap/v2-periphery" "^1.1.0-beta.0"

Expand Down

0 comments on commit 718989a

Please sign in to comment.