diff --git a/app/components/SetMockedTime.jsx b/app/components/SetMockedTime.jsx new file mode 100644 index 0000000..9e7e94b --- /dev/null +++ b/app/components/SetMockedTime.jsx @@ -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 = () => ( + { + 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 + }) => ( +
+ + + )} +
+) + +export default SetMockedTime diff --git a/app/dapp.js b/app/dapp.js index 1f7c1f4..731fa12 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -14,6 +14,7 @@ import { getProfileEvents, formatFundProfileEvent } from './utils/events'; import { getAllPledges, appendToExistingPledges, transferBetweenPledges } from './utils/pledges'; import { FundingContext } from './context' import { cancelProfile } from './utils/fundProfiles' +import SetMockedTime from './components/SetMockedTime' const { getNetworkType } = web3.eth.net; @@ -34,6 +35,7 @@ class App extends React.Component { const { environment } = EmbarkJS const isInitialized = await vaultPledgingNeedsInit() if (!!isInitialized) { + console.log('mock_time:', await LiquidPledgingMock.mock_time.call()) const lpAllowance = await getLpAllowance() const fundProfiles = await getProfileEvents() const allPledges = await getAllPledges() @@ -92,6 +94,7 @@ class App extends React.Component { + ) diff --git a/config/blockchain.js b/config/blockchain.js index f034b9d..ed22d42 100644 --- a/config/blockchain.js +++ b/config/blockchain.js @@ -25,7 +25,7 @@ module.exports = { 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) 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 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.