add SetMockedTime
This commit is contained in:
parent
6ec1e09033
commit
5ce9132830
|
@ -0,0 +1,49 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Formik } from 'formik'
|
||||||
|
import LiquidPledgingMock from 'Embark/contracts/LiquidPledgingMock'
|
||||||
|
import TextField from '@material-ui/core/TextField'
|
||||||
|
|
||||||
|
const { setMockedTime } = LiquidPledgingMock.methods
|
||||||
|
|
||||||
|
const SetMockedTime = () => (
|
||||||
|
<Formik
|
||||||
|
initialValues={{}}
|
||||||
|
onSubmit={async (values, { setSubmitting, resetForm, setStatus }) => {
|
||||||
|
const { time } = values
|
||||||
|
const n = Math.floor(new Date().getTime() / 1000) + Number(time)
|
||||||
|
setMockedTime(n)
|
||||||
|
.send()
|
||||||
|
.then(res => {console.log({res})})
|
||||||
|
.catch(err => {console.log({err})})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{({
|
||||||
|
values,
|
||||||
|
errors,
|
||||||
|
touched,
|
||||||
|
handleChange,
|
||||||
|
handleBlur,
|
||||||
|
handleSubmit,
|
||||||
|
setFieldValue,
|
||||||
|
setStatus,
|
||||||
|
status
|
||||||
|
}) => (
|
||||||
|
<form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
|
<TextField
|
||||||
|
autoComplete="off"
|
||||||
|
id="time"
|
||||||
|
name="time"
|
||||||
|
label="Set Mocked Time in seconds"
|
||||||
|
placeholder="Set Mocked Time in seconds"
|
||||||
|
margin="normal"
|
||||||
|
variant="outlined"
|
||||||
|
onChange={handleChange}
|
||||||
|
onBlur={handleBlur}
|
||||||
|
value={values.time || ''}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
</Formik>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default SetMockedTime
|
|
@ -14,6 +14,7 @@ import { getProfileEvents, formatFundProfileEvent } from './utils/events';
|
||||||
import { getAllPledges, appendToExistingPledges, transferBetweenPledges } from './utils/pledges';
|
import { getAllPledges, appendToExistingPledges, transferBetweenPledges } from './utils/pledges';
|
||||||
import { FundingContext } from './context'
|
import { FundingContext } from './context'
|
||||||
import { cancelProfile } from './utils/fundProfiles'
|
import { cancelProfile } from './utils/fundProfiles'
|
||||||
|
import SetMockedTime from './components/SetMockedTime'
|
||||||
|
|
||||||
const { getNetworkType } = web3.eth.net;
|
const { getNetworkType } = web3.eth.net;
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ class App extends React.Component {
|
||||||
const { environment } = EmbarkJS
|
const { environment } = EmbarkJS
|
||||||
const isInitialized = await vaultPledgingNeedsInit()
|
const isInitialized = await vaultPledgingNeedsInit()
|
||||||
if (!!isInitialized) {
|
if (!!isInitialized) {
|
||||||
|
console.log('mock_time:', await LiquidPledgingMock.mock_time.call())
|
||||||
const lpAllowance = await getLpAllowance()
|
const lpAllowance = await getLpAllowance()
|
||||||
const fundProfiles = await getProfileEvents()
|
const fundProfiles = await getProfileEvents()
|
||||||
const allPledges = await getAllPledges()
|
const allPledges = await getAllPledges()
|
||||||
|
@ -92,6 +94,7 @@ class App extends React.Component {
|
||||||
<Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
<Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
||||||
GIVE VAULT TOKEN APPROVAL
|
GIVE VAULT TOKEN APPROVAL
|
||||||
</Button>
|
</Button>
|
||||||
|
<SetMockedTime />
|
||||||
</div>
|
</div>
|
||||||
</FundingContext.Provider>
|
</FundingContext.Provider>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ module.exports = {
|
||||||
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
|
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
|
||||||
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
|
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
|
||||||
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
|
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
|
||||||
proxy: false, // Proxy is used to present meaningful information about transactions
|
proxy: true, // Proxy is used to present meaningful information about transactions
|
||||||
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
|
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
|
||||||
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet
|
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet
|
||||||
simulatorBlocktime: 0, // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
|
simulatorBlocktime: 0, // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
|
||||||
|
|
Loading…
Reference in New Issue