mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-28 05:12:18 +01:00
86b165ea83
Maker has upgraded its Dai token to "Multi-Collateral Dai" (MCD) and requires all users interacting with Dai migrate their tokens to the new version. Dai now exclusively refers to Multi-Collateral Dai and what was previouly called Dai is now Sai (Single Collateral Dai). In this description, Sai refers to what was (prior to the 2019-11-18) known as Dai. Dai is the _new_ token. This changeset: 1. Only affects users who had non-zero Sai at the old contract address 2. Displays a persistent notification for users with Sai 3. Updates the token symbol for users already tracking the Sai token 4. Bumps our direct and indirect eth-contract-metadata dependencies The notification copy: > A message from Maker: The new Multi-Collateral Dai token has been released. Your old tokens are now called Sai. Please upgrade your Sai tokens to the new Dai. The copy is from the Maker team.
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
import Home from './home.component'
|
|
import { compose } from 'recompose'
|
|
import { connect } from 'react-redux'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
|
|
import { getCurrentEthBalance, getDaiV1Token } from '../../selectors/selectors'
|
|
import {
|
|
unsetMigratedPrivacyMode,
|
|
restoreFromThreeBox,
|
|
turnThreeBoxSyncingOn,
|
|
getThreeBoxLastUpdated,
|
|
setShowRestorePromptToFalse,
|
|
} from '../../store/actions'
|
|
import { setThreeBoxLastUpdated } from '../../ducks/app/app'
|
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask, appState } = state
|
|
const {
|
|
suggestedTokens,
|
|
providerRequests,
|
|
migratedPrivacyMode,
|
|
seedPhraseBackedUp,
|
|
tokens,
|
|
threeBoxSynced,
|
|
showRestorePrompt,
|
|
selectedAddress,
|
|
} = metamask
|
|
const accountBalance = getCurrentEthBalance(state)
|
|
const { forgottenPassword, threeBoxLastUpdated } = appState
|
|
|
|
const isPopup = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP
|
|
|
|
return {
|
|
forgottenPassword,
|
|
suggestedTokens,
|
|
unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state),
|
|
providerRequests,
|
|
showPrivacyModeNotification: migratedPrivacyMode,
|
|
shouldShowSeedPhraseReminder: !seedPhraseBackedUp && (parseInt(accountBalance, 16) > 0 || tokens.length > 0),
|
|
isPopup,
|
|
threeBoxSynced,
|
|
showRestorePrompt,
|
|
selectedAddress,
|
|
threeBoxLastUpdated,
|
|
hasDaiV1Token: Boolean(getDaiV1Token(state)),
|
|
}
|
|
}
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
unsetMigratedPrivacyMode: () => dispatch(unsetMigratedPrivacyMode()),
|
|
turnThreeBoxSyncingOn: () => dispatch(turnThreeBoxSyncingOn()),
|
|
setupThreeBox: () => {
|
|
dispatch(getThreeBoxLastUpdated())
|
|
.then(lastUpdated => {
|
|
if (lastUpdated) {
|
|
dispatch(setThreeBoxLastUpdated(lastUpdated))
|
|
} else {
|
|
dispatch(setShowRestorePromptToFalse())
|
|
dispatch(turnThreeBoxSyncingOn())
|
|
}
|
|
})
|
|
},
|
|
restoreFromThreeBox: (address) => dispatch(restoreFromThreeBox(address)),
|
|
setShowRestorePromptToFalse: () => dispatch(setShowRestorePromptToFalse()),
|
|
})
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(Home)
|