Skip to content

Commit

Permalink
Merge pull request #537 from OasisDEX/dev
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
peculiarity authored Oct 25, 2021
2 parents 8913c1b + a096526 commit b163e84
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ INFURA_PROJECT_ID_BACKEND="de82b2d602264e4fbc0929dec0c45baa"
ETHERSCAN_API_KEY="34JVYM6RPM3J1SK8QXQFRNSHD9XG4UHXVU"
USE_TERMS_OF_SERVICE=1

MULTIPLY_PROXY_ACTIONS=0x33b4BE1B67c49125C1524777515e4034E04dFF58
MULTIPLY_PROXY_ACTIONS=0x2a49eae5cca3f050ebec729cf90cc910fadaf7a2
EXCHANGE=0xb5eB8cB6cED6b6f8E13bcD502fb489Db4a726C7B
DUMMY_EXCHANGE=0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650
USE_DUMMY=0
BLOCK_NUMBER=13403629
BLOCK_NUMBER=13461200
2 changes: 1 addition & 1 deletion .github/workflows/aws-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
--build-arg MIXPANEL_KEY=${{ secrets.MIXPANEL_STAGING_KEY }} \
--build-arg INFURA_PROJECT_ID=${{ secrets.INFURA_PROJECT_ID }} \
--build-arg ETHERSCAN_API_KEY=${{ secrets.ETHERSCAN_API_KEY }} \
--build-arg BLOCKNATIVE_API_KEY=${{ secrets.BLOCKNATIVE_API_KEY }} \
--build-arg BLOCKNATIVE_API_KEY=${{ secrets.BLOCKNATIVE_STAGING_API_KEY }} \
--build-arg SHOW_BUILD_INFO=1 \
--cache-from=$ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \
-t $ECR_REGISTRY/$ECR_REPO_NAME:$SHA_TAG \
Expand Down
111 changes: 49 additions & 62 deletions blockchain/abi/multiply-proxy-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ETH_ADDR",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "WETH",
Expand Down Expand Up @@ -247,7 +234,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -396,7 +383,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -545,7 +532,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -694,7 +681,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -843,7 +830,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand All @@ -862,45 +849,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "assets",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "premiums",
"type": "uint256[]"
},
{
"internalType": "address",
"name": "initiator",
"type": "address"
},
{
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "executeOperation",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1031,7 +979,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -1180,7 +1128,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand Down Expand Up @@ -1329,7 +1277,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand All @@ -1348,6 +1296,45 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "initiator",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fee",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "onFlashLoan",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1478,7 +1465,7 @@
},
{
"internalType": "address",
"name": "aaveLendingPoolProvider",
"name": "lender",
"type": "address"
},
{
Expand All @@ -1497,4 +1484,4 @@
"stateMutability": "payable",
"type": "function"
}
]
]
14 changes: 7 additions & 7 deletions blockchain/calls/proxyActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function getOpenMultiplyCallData(data: OpenMultiplyData, context: ContextConnect
dssMultiplyProxyActions,
tokens,
exchange,
aaveLendingPool,
fmm,
} = context

return contract<MultiplyProxyActions>(dssMultiplyProxyActions).methods.openMultiplyVault(
Expand Down Expand Up @@ -336,7 +336,7 @@ function getOpenMultiplyCallData(data: OpenMultiplyData, context: ContextConnect
jug: mcdJug.address,
manager: dssCdpManager.address,
multiplyProxyActions: dssMultiplyProxyActions.address,
aaveLendingPoolProvider: aaveLendingPool,
lender: fmm,
exchange: exchange.address,
} as any,
)
Expand Down Expand Up @@ -412,7 +412,7 @@ function getMultiplyAdjustCallData(data: MultiplyAdjustData, context: ContextCon
dssMultiplyProxyActions,
tokens,
exchange,
aaveLendingPool,
fmm,
} = context

if (data.action === 'BUY_COLLATERAL') {
Expand Down Expand Up @@ -446,7 +446,7 @@ function getMultiplyAdjustCallData(data: MultiplyAdjustData, context: ContextCon
jug: mcdJug.address,
manager: dssCdpManager.address,
multiplyProxyActions: dssMultiplyProxyActions.address,
aaveLendingPoolProvider: aaveLendingPool,
lender: fmm,
exchange: exchange.address,
} as any,
)
Expand Down Expand Up @@ -488,7 +488,7 @@ function getMultiplyAdjustCallData(data: MultiplyAdjustData, context: ContextCon
jug: mcdJug.address,
manager: dssCdpManager.address,
multiplyProxyActions: dssMultiplyProxyActions.address,
aaveLendingPoolProvider: aaveLendingPool,
lender: fmm,
exchange: exchange.address,
} as any,
)
Expand Down Expand Up @@ -533,7 +533,7 @@ function getCloseVaultCallData(data: CloseVaultData, context: ContextConnected)
dssMultiplyProxyActions,
tokens,
exchange,
aaveLendingPool,
fmm,
} = context

const {
Expand Down Expand Up @@ -583,7 +583,7 @@ function getCloseVaultCallData(data: CloseVaultData, context: ContextConnected)
jug: mcdJug.address,
manager: dssCdpManager.address,
multiplyProxyActions: dssMultiplyProxyActions.address,
aaveLendingPoolProvider: aaveLendingPool,
lender: fmm,
exchange: exchange.address,
}

Expand Down
10 changes: 5 additions & 5 deletions blockchain/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ const protoMain = {
dssProxyActions: contractDesc(dssProxyActions, mainnetAddresses.PROXY_ACTIONS),
dssMultiplyProxyActions: contractDesc(
dssMultiplyProxyActions,
'0x33b4BE1B67c49125C1524777515e4034E04dFF58',
'0x2a49eae5cca3f050ebec729cf90cc910fadaf7a2',
),
exchange: contractDesc(exchange, '0xb5eB8cB6cED6b6f8E13bcD502fb489Db4a726C7B'),
aaveLendingPool: '0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5',
fmm: '0x1EB4CF3A948E7D72A198fe073cCb8C7a948cD853',
etherscan: {
url: 'https://etherscan.io',
apiUrl: 'https://api.etherscan.io/api',
Expand Down Expand Up @@ -134,7 +134,7 @@ const kovan: NetworkConfig = {
getConfig()?.publicRuntimeConfig?.multiplyProxyActions || '',
),
exchange: contractDesc(exchange, getConfig()?.publicRuntimeConfig?.exchangeAddress || ''), // TODO: UPDATE ADDRESS AFTER DEPLOYMENT
aaveLendingPool: '0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5',
fmm: '0x1EB4CF3A948E7D72A198fe073cCb8C7a948cD853',
etherscan: {
url: 'https://kovan.etherscan.io',
apiUrl: 'https://api-kovan.etherscan.io/api',
Expand Down Expand Up @@ -187,7 +187,7 @@ const goerli: NetworkConfig = {
// Currently this is not supported on Goerli - no deployed contract
exchange: contractDesc(exchange, getConfig()?.publicRuntimeConfig?.exchangeAddress || ''),
// Currently this is not supported on Goerli - no deployed contract
aaveLendingPool: '0x0000000000000000000000000000000000000000',
fmm: '0x1EB4CF3A948E7D72A198fe073cCb8C7a948cD853',
etherscan: {
url: 'https://goerli.etherscan.io',
apiUrl: 'https://api-goerli.etherscan.io/api',
Expand All @@ -212,7 +212,7 @@ const hardhat: NetworkConfig = {
dssMultiplyProxyActions: contractDesc(
dssMultiplyProxyActions,
getConfig()?.publicRuntimeConfig?.multiplyProxyActions ||
'0x33b4BE1B67c49125C1524777515e4034E04dFF58',
'0x2a49eae5cca3f050ebec729cf90cc910fadaf7a2',
),
exchange: contractDesc(
exchange,
Expand Down
5 changes: 4 additions & 1 deletion blockchain/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ export function createGasPrice$(
maxPriorityFeePerGas: minersTip,
} as GasPriceParams
if (blockNative.maxFeePerGas.gt(0)) {
console.log('from blockNative')
gasFees.maxFeePerGas = new BigNumber(1000000000).multipliedBy(blockNative.maxFeePerGas)
gasFees.maxPriorityFeePerGas = new BigNumber(1000000000).multipliedBy(
blockNative.maxPriorityFeePerGas,
)
} else {
console.log('defaults', gasFees)
}
return gasFees
},
Expand Down Expand Up @@ -103,7 +106,7 @@ export const tokenPricesInUSD$: Observable<Ticker> = every10Seconds$.pipe(
}
}),
catchError((error) => {
console.debug(`Error fetching price data: ${error}`)
console.log(error)
return of({})
}),
),
Expand Down
2 changes: 2 additions & 0 deletions components/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ export const RAD = new BigNumber('1e45')
export const HOUR = 60 * 60
export const DAY = 24 * HOUR
export const SECONDS_PER_YEAR = 365 * DAY

export const FLASH_MINT_LIMIT_PER_TX = new BigNumber('500000000')
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ export function ManageMultiplyVaultChangesInformation(props: ManageMultiplyVault
/>
{showFees && (
<Grid pl={3} gap={2}>
<VaultChangesInformationItem
label={'3rd party protocol fees'}
value={`$${formatAmount(loanFee, 'USD')}`}
/>
{loanFee.gt(zero) && (
<VaultChangesInformationItem
label={'3rd party protocol fees'}
value={`$${formatAmount(loanFee, 'USD')}`}
/>
)}
<VaultChangesInformationItem
label={'Oasis fee'}
value={`$${formatAmount(oazoFee, 'USD')}`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { FLASH_MINT_LIMIT_PER_TX } from 'components/constants'
import { AppLink } from 'components/Links'
import { MessageCard } from 'components/MessageCard'
import { formatCryptoBalance } from 'helpers/formatters/format'
Expand Down Expand Up @@ -43,6 +44,10 @@ export function ManageMultiplyVaultErrors({
maxGenerateAmount: formatCryptoBalance(maxGenerateAmount),
token,
})
case 'generateAmountMoreThanMaxFlashAmount':
return translate('generate-amount-more-than-max-flash-amount', {
maxFlashAmount: FLASH_MINT_LIMIT_PER_TX.toFormat(0),
})
case 'generateAmountLessThanDebtFloor':
return (
<Trans
Expand Down
Loading

0 comments on commit b163e84

Please sign in to comment.