Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unstoppable domains #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public/compound-components/

# IPFS release file
.release
.release-notes
.release-notes
# Local Netlify folder
.netlify
4 changes: 2 additions & 2 deletions config/env/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"rinkeby": "https://infura.io/rinkeby",
"kovan": "https://infura.io/kovan",
"ropsten": "https://infura.io/ropsten",
"mainnet": "https://infura.io/mainnet"
"mainnet": "https://mainnet.infura.io/v3/dc6607314ecd4fab97514370c623259a"
},
"NETWORK_MAP": {
"mainnet": 1,
Expand All @@ -24,5 +24,5 @@
"development": 999
},
"DEFAULT_NETWORK": "mainnet",
"BLOCKNATIVE_API_KEY": null
"BLOCKNATIVE_API_KEY": "70a5e5a7-09ac-45e5-9dd7-4bfc804038ed"
}
4 changes: 2 additions & 2 deletions config/env/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"rinkeby": "https://infura.io/rinkeby",
"kovan": "https://infura.io/kovan",
"ropsten": "https://infura.io/ropsten",
"mainnet": "https://infura.io/mainnet"
"mainnet": "https://mainnet.infura.io/v3/dc6607314ecd4fab97514370c623259a"
},
"NETWORK_MAP": {
"mainnet": 1,
Expand All @@ -22,5 +22,5 @@
"kovan": 42
},
"DEFAULT_NETWORK": "mainnet",
"BLOCKNATIVE_API_KEY": null
"BLOCKNATIVE_API_KEY": "70a5e5a7-09ac-45e5-9dd7-4bfc804038ed"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@babel/runtime": "^7.9.2",
"@babel/runtime-corejs3": "^7.10.2",
"@material/switch": "^3.0.0",
"@unstoppabledomains/resolution": "^8.2.0",
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^9.7.6",
"babel-loader": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/elm/Admin.elm
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ timelockView configs abiFilesRaw account maybeNetwork timezone maybeCurrentTime

actionButton =
case ( account, maybeNetworkConfig ) of
( Acct adminAddress _, Just config ) ->
( Acct adminAddress _ _ , Just config ) ->
case config.maybeTimelock of
Just timelock ->
case ( model.maybeTarget, model.maybeFunction, model.maybeDataArg ) of
Expand Down Expand Up @@ -638,7 +638,7 @@ timelockView configs abiFilesRaw account maybeNetwork timezone maybeCurrentTime
( Just time, Just eta ) ->
if CompoundComponents.Utils.Time.posixToSeconds time > eta then
case ( account, maybeNetworkConfig ) of
( Acct adminAddress _, Just config ) ->
( Acct adminAddress _ _ , Just config ) ->
case config.maybeTimelock of
Just timelock ->
button
Expand Down
4 changes: 2 additions & 2 deletions src/elm/Balances.elm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ getUnderlyingTotalsInUsd compoundState cTokens oracleState =
getWalletBalanceNonSafeEther : Config -> Account -> CompoundState -> CToken -> Maybe Decimal
getWalletBalanceNonSafeEther config account compoundState cToken =
case ( Eth.Token.isCEtherToken config cToken, account ) of
( True, Acct customerAddress etherBalance ) ->
( True, Acct customerAddress etherBalance _ ) ->
etherBalance

_ ->
Expand All @@ -138,7 +138,7 @@ getWalletBalanceNonSafeEther config account compoundState cToken =
getWalletBalanceSafeEther : Config -> Account -> CompoundState -> CToken -> Maybe Decimal
getWalletBalanceSafeEther config account compoundState cToken =
case ( Eth.Token.isCEtherToken config cToken, account ) of
( True, Acct customerAddress etherBalance ) ->
( True, Acct customerAddress etherBalance _ ) ->
case ( Decimal.fromFloat 0.005, etherBalance ) of
( Just etherMaxAdjustment, Just actualEtherBalance ) ->
Decimal.sub actualEtherBalance etherMaxAdjustment
Expand Down
8 changes: 4 additions & 4 deletions src/elm/DappInterface/BorrowingPane.elm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ borrowedListOrAllMarketsPanel maybeConfig maybeEtherUsdPrice ({ account, userLan
in
if areAllAssetsLoaded model then
case ( maybeConfig, account ) of
( Just config, Acct customerAddress maybeEtherBalance ) ->
( Just config, Acct customerAddress maybeEtherBalance _ ) ->
if List.length borrowedAssets > 0 then
section [ class "asset-list" ]
[ columnLabels
Expand Down Expand Up @@ -186,7 +186,7 @@ allMarketsListPanel maybeConfig maybeEtherUsdPrice ({ account, compoundState, pr
getReadyBorrowedAssets model True
in
case ( maybeConfig, account ) of
( Just config, Acct _ _ ) ->
( Just config, Acct _ _ _ ) ->
if List.length borrowedAndReadyAssets == 0 then
text ""

Expand Down Expand Up @@ -237,7 +237,7 @@ getAllMarketsPanelContent config maybeEtherUsdPrice addPanelClass allBorrowableA
[ class "asset-list" ]
in
case account of
Acct customerAddress maybeEtherBalance ->
Acct customerAddress maybeEtherBalance _ ->
div parentDivAttributes
[ columnLabels
, div [ class "assets" ]
Expand Down Expand Up @@ -293,7 +293,7 @@ borrowedAssetRow isAllMarketsRow config ( maybeCustomerAddress, maybeEtherBalanc
maybeCustomerAddress
|> Maybe.map
(\customerAddress ->
Balances.getWalletBalanceNonSafeEther config (Acct customerAddress maybeEtherBalance) compoundState cToken
Balances.getWalletBalanceNonSafeEther config (Acct customerAddress maybeEtherBalance Nothing ) compoundState cToken
)
|> Functions.demaybeify
|> Maybe.withDefault Decimal.zero
Expand Down
6 changes: 3 additions & 3 deletions src/elm/DappInterface/ClaimCompModal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ updateClaimModalStep newStep oldState =
handleTransactionUpdate : Maybe Config -> Maybe Network -> Account -> TransactionState -> TransactionMsg -> Model -> Model
handleTransactionUpdate maybeConfig maybeNetwork account transactionState transactionMsg model =
case ( maybeConfig, maybeNetwork, account ) of
( Just config, Just actualNetwork, Acct customer _ ) ->
( Just config, Just actualNetwork, Acct customer _ _ ) ->
case transactionMsg of
Eth.Transaction.NewTransaction transaction ->
if
Expand Down Expand Up @@ -150,7 +150,7 @@ update internalMsg maybeConfig account compoundState model =
case internalMsg of
ClaimCompClicked estimateComp ->
case ( maybeConfig, account ) of
( Just config, Acct customer _ ) ->
( Just config, Acct customer _ _ ) ->
let
marketsWithBalances =
Dict.toList compoundState.balances
Expand Down Expand Up @@ -193,7 +193,7 @@ update internalMsg maybeConfig account compoundState model =
view : Translations.Lang -> Maybe Config -> Maybe Network -> Account -> TokenState -> OracleState -> TransactionState -> GovernanceState -> Preferences -> Model -> Html Msg
view userLanguage maybeConfig maybeNetwork account tokenState oracleState transactionState governanceState preferences model =
case ( account, maybeNetwork ) of
( Acct accountAddress _, Just network ) ->
( Acct accountAddress _ _ , Just network ) ->
let
maybeEtherUsdPrice =
maybeConfig
Expand Down
10 changes: 5 additions & 5 deletions src/elm/DappInterface/CollateralPane.elm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ collateralListOrAllMarketsPanel maybeConfig maybeEtherUsdPrice ({ account, userL
in
if areAllAssetsLoaded model then
case ( maybeConfig, account ) of
( Just config, Acct customerAddress maybeEtherBalance ) ->
( Just config, Acct customerAddress maybeEtherBalance _ ) ->
if List.length suppliedAndReadyCollateralAssets > 0 then
section [ class "asset-list" ]
[ columnLabels
Expand Down Expand Up @@ -187,7 +187,7 @@ allMarketsListPanel maybeConfig maybeEtherUsdPrice ({ account, compoundState, pr
getReadyCollateralAssets model True
in
case ( maybeConfig, account ) of
( Just config, Acct _ _ ) ->
( Just config, Acct _ _ _ ) ->
if List.length suppliedAndReadyCollateralAssets == 0 then
text ""

Expand Down Expand Up @@ -238,7 +238,7 @@ getAllMarketsPanelContent config maybeEtherUsdPrice addPanelClass allReadyCollat
[ class "asset-list" ]
in
case account of
Acct customerAddress maybeEthBalance ->
Acct customerAddress maybeEthBalance _ ->
div parentDivAttributes
[ columnLabels
, div [ class "assets" ]
Expand All @@ -261,7 +261,7 @@ getAllMarketsPanelContent config maybeEtherUsdPrice addPanelClass allReadyCollat


collateralAssetRow : Bool -> Config -> ( Maybe CustomerAddress, Maybe Decimal ) -> Maybe Decimal -> Model -> ReadyCollateralAsset -> Html Msg
collateralAssetRow isAllMarketsRow config ( maybeCustomerAddress, maybeEtherBalance ) maybeEtherUsdPrice { compoundState, tokenState, preferences, userLanguage } { cToken, supplyBalance, tokenValueUsd, maybeSupplyInterestEarned, supplyInterestRate } =
collateralAssetRow isAllMarketsRow config ( maybeCustomerAddress, maybeEtherBalance) maybeEtherUsdPrice { compoundState, tokenState, preferences, userLanguage } { cToken, supplyBalance, tokenValueUsd, maybeSupplyInterestEarned, supplyInterestRate } =
let
supplyBalanceUsd =
Decimal.mul supplyBalance tokenValueUsd
Expand All @@ -270,7 +270,7 @@ collateralAssetRow isAllMarketsRow config ( maybeCustomerAddress, maybeEtherBala
maybeCustomerAddress
|> Maybe.map
(\customerAddress ->
Balances.getWalletBalanceNonSafeEther config (Acct customerAddress maybeEtherBalance) compoundState cToken
Balances.getWalletBalanceNonSafeEther config (Acct customerAddress maybeEtherBalance Nothing) compoundState cToken
)
|> Functions.demaybeify
|> Maybe.withDefault Decimal.zero
Expand Down
4 changes: 2 additions & 2 deletions src/elm/DappInterface/CollateralToggleModal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ view mainModel =
|> Maybe.andThen (\config -> Eth.Oracle.getEtherPrice config mainModel.tokenState mainModel.oracleState)
in
case ( ( maybeConfig, mainModel.network ), ( mainModel.account, mainModel.collateralToggleModalState ) ) of
( ( Just config, Just actualNetwork ), ( Acct customerAddress _, Just visibleCollateralModalState ) ) ->
( ( Just config, Just actualNetwork ), ( Acct customerAddress _ _ , Just visibleCollateralModalState ) ) ->
div [ class "collateral-toggle modal" ]
[ div [ class "cover active", onClick (ForParent DismissAndResetCollateralModal) ] []
, div [ class "container-small" ]
Expand Down Expand Up @@ -502,7 +502,7 @@ getMostRecentAssetPendingTransaction config { chosenAsset } { currentTime, netwo
-- Any transaction for the asset will block the whole input view.
pendingAssetTransactions =
case ( network, account ) of
( Just actualNetwork, Acct customerAddress _ ) ->
( Just actualNetwork, Acct customerAddress _ _ ) ->
Eth.Transaction.filteredTransactionsByCToken pendingRecentTransactions config actualNetwork customerAddress tokenState.cTokens chosenAsset

_ ->
Expand Down
23 changes: 14 additions & 9 deletions src/elm/DappInterface/CommonViews.elm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module DappInterface.CommonViews exposing
, pageHeader
, translator
, update

)

import CompoundComponents.DisplayCurrency exposing (DisplayCurrency(..))
Expand Down Expand Up @@ -115,14 +116,18 @@ pageHeader userLanguage page connectedWallet account preferences governanceState
let
accountAddress =
case account of
UnknownAcct ->
""
UnknownAcct ->
""

NoAccount ->
Translations.no_account userLanguage
NoAccount ->
Translations.no_account userLanguage

Acct (Customer customerAddress) _ ->
shortenedAddressString 2 4 customerAddress
Acct (Customer customerAddress) _ unsDomain ->
case unsDomain of
Nothing ->
shortenedAddressString 2 4 customerAddress
Just domain ->
domain

connectedWalletIconClass =
case connectedWallet.selectedProvider of
Expand All @@ -139,10 +144,9 @@ pageHeader userLanguage page connectedWallet account preferences governanceState
""

accountButton =
if connectedWallet.selectedProvider == Nothing || connectedWallet.selectedProvider == Just EthConnectedWallet.None then
if (connectedWallet.selectedProvider == Nothing || connectedWallet.selectedProvider == Just EthConnectedWallet.None) then
a [ id "connect-wallet", class "dapp button hollow", onClick (ForParent AccountAddressClicked) ]
[ text (Translations.connect_wallet userLanguage) ]

else
a [ id "account", onClick (ForParent AccountAddressClicked) ]
[ span [ class connectedWalletIconClass ] []
Expand Down Expand Up @@ -189,6 +193,7 @@ pageHeader userLanguage page connectedWallet account preferences governanceState
, div [ class "col-xs-9 col-sm-3 text-right actions" ]
[ compBalanceView account governanceState
, accountButton
, text ""
]
, div [ class "col-xs-9 mobile-links actions" ] mobileLinks
]
Expand Down Expand Up @@ -251,7 +256,7 @@ compBalanceView account governanceState =
]
in
case account of
Acct customer _ ->
Acct customer _ _ ->
case ( getCompoundGovernanceTokenBalance customer governanceState, getCompAccruedBalance customer governanceState ) of
( Just balance, Just accrued ) ->
let
Expand Down
2 changes: 1 addition & 1 deletion src/elm/DappInterface/Container.elm
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ view mainModel =

else
case account of
Acct (Customer _) maybeBalance ->
Acct (Customer _) maybeBalance _ ->
let
hasZeroEthBalance =
case maybeBalance of
Expand Down
1 change: 1 addition & 0 deletions src/elm/DappInterface/MainModel.elm
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type alias Model =
, maybeGasPrice : Maybe Decimal
, userLanguage : Translations.Lang
, repl : Repl.Model
, unsDomains: Dict String String
}


Expand Down
14 changes: 7 additions & 7 deletions src/elm/DappInterface/PrimaryActionModal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ enableAssetView userLanguage config maybeEtherUsdPrice ({ chosenAsset, primaryAc
" borrow"
in
case ( mainModel.network, mainModel.account ) of
( Just network, Acct customerAddress _ ) ->
( Just network, Acct customerAddress _ _ ) ->
let
enableClickAction =
Eth.Token.FaucetTokenApprove
Expand Down Expand Up @@ -927,7 +927,7 @@ getSubmitButton userLanguage config ({ chosenAsset, inputValue, primaryActionTyp

actionConstructor panelMessage amount =
case ( mainModel.network, mainModel.account ) of
( Just actualNetwork, Acct customerAddress _ ) ->
( Just actualNetwork, Acct customerAddress _ _ ) ->
WrappedCompoundMsg <| Eth.Compound.Web3TransactionMsg <| panelMessage actualNetwork chosenAsset.contractAddress chosenAsset.underlying.decimals customerAddress amount

_ ->
Expand All @@ -936,7 +936,7 @@ getSubmitButton userLanguage config ({ chosenAsset, inputValue, primaryActionTyp

redeemConstructor panelMessage amount =
case ( mainModel.network, mainModel.account, Dict.get (Ethereum.getContractAddressString chosenAsset.contractAddress) mainModel.compoundState.cTokensMetadata ) of
( Just actualNetwork, Acct customerAddress _, Just cTokenMetadata ) ->
( Just actualNetwork, Acct customerAddress _ _, Just cTokenMetadata ) ->
WrappedCompoundMsg <| Eth.Compound.Web3TransactionMsg <| panelMessage actualNetwork chosenAsset.contractAddress cTokenMetadata.exchangeRate chosenAsset.decimals chosenAsset.underlying.decimals customerAddress amount

_ ->
Expand Down Expand Up @@ -1164,15 +1164,15 @@ bottomBalanceView userLanguage config { chosenAsset, primaryActionType } mainMod
faucetAllocateButton : Config -> Model -> CToken -> Html Msg
faucetAllocateButton config { account, network, userLanguage } chosenAsset =
case ( network, account, config.maybeFauceteer ) of
( Just actualNetwork, Acct customerAddress _, Just fauceteerAddress ) ->
( Just actualNetwork, Acct customerAddress _ _, Just fauceteerAddress ) ->
if config.cEtherToken.address /= chosenAsset.contractAddress && actualNetwork /= Network.MainNet then
a [ class "faucet-link", onClick <| WrappedTokenMsg <| Eth.Token.Web3TransactionMsg (Eth.Token.FauceteerDrip actualNetwork fauceteerAddress chosenAsset.contractAddress chosenAsset.underlying.assetAddress customerAddress) ]
[ text (Translations.faucet userLanguage) ]

else
text ""

( Just actualNetwork, Acct customerAddress _, Nothing ) ->
( Just actualNetwork, Acct customerAddress _ _, Nothing ) ->
if
(config.cEtherToken.address /= chosenAsset.contractAddress && actualNetwork /= Network.MainNet)
&& not (actualNetwork == Network.Kovan && (chosenAsset.symbol == "cSAI" || chosenAsset.symbol == "cDAI"))
Expand Down Expand Up @@ -1202,7 +1202,7 @@ getMostRecentAssetPendingTransaction config { chosenAsset } { currentTime, netwo
-- Any transaction for the asset will block the whole input view.
pendingAssetTransactions =
case ( network, account ) of
( Just actualNetwork, Acct customerAddress _ ) ->
( Just actualNetwork, Acct customerAddress _ _ ) ->
Eth.Transaction.filteredTransactionsByCToken pendingRecentTransactions config actualNetwork customerAddress tokenState.cTokens chosenAsset

_ ->
Expand Down Expand Up @@ -1243,7 +1243,7 @@ getAvailableTokensForAction maybeConfig { chosenAsset, primaryActionType } { acc

( supplyBalance, borrowBalance ) =
case account of
Acct _ _ ->
Acct _ _ _ ->
( Maybe.map .underlyingSupplyBalance underlyingBalances
|> Maybe.withDefault Decimal.zero
, Maybe.map .underlyingBorrowBalance underlyingBalances
Expand Down
2 changes: 1 addition & 1 deletion src/elm/DappInterface/Propose.elm
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ governanceView userLanguage isCrowdProposal config ( governorAddress, isBravo )

proposalActionButton =
case account of
Acct adminAddress _ ->
Acct adminAddress _ _ ->
case ( model.maybeProposalTitle, List.length model.actions > 0 ) of
( Just _, True ) ->
case ( isCrowdProposal, maybeCrowdFactoryAddress ) of
Expand Down
Loading