WA-238 Init contracts for test mode only used in travis
This commit is contained in:
parent
060a7089b6
commit
52203bcfe2
|
@ -5,15 +5,16 @@ os:
|
||||||
- linux
|
- linux
|
||||||
before_script:
|
before_script:
|
||||||
- yarn global add surge
|
- yarn global add surge
|
||||||
|
- export NODE_ENV=testing
|
||||||
after_success:
|
after_success:
|
||||||
- yarn build-storybook
|
|
||||||
- yarn build
|
|
||||||
- |
|
- |
|
||||||
if [ ${TRAVIS_BRANCH} = "master" ]; then
|
if [ ${TRAVIS_BRANCH} = "master" ]; then
|
||||||
export NODE_ENV=production;
|
export NODE_ENV=production;
|
||||||
else
|
else
|
||||||
export NODE_ENV=development;
|
export NODE_ENV=development;
|
||||||
fi
|
fi
|
||||||
|
- yarn build-storybook
|
||||||
|
- yarn build
|
||||||
- cd build_webpack/ && cp index.html 200.html && cd ..
|
- cd build_webpack/ && cp index.html 200.html && cd ..
|
||||||
- chmod ugo+x ./config/deploy/deploy.sh
|
- chmod ugo+x ./config/deploy/deploy.sh
|
||||||
- ./config/deploy/deploy.sh
|
- ./config/deploy/deploy.sh
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"start": "node scripts/start.js",
|
"start": "node scripts/start.js",
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
"test": "run-with-testrpc -l 40000000 'node scripts/test.js --env=jsdom'",
|
"test": "run-with-testrpc -l 40000000 'node scripts/test.js --env=jsdom'",
|
||||||
"test-local": "node scripts/test.js --env=jsdom",
|
"test-local": "NODE_ENV=test && node scripts/test.js --env=jsdom",
|
||||||
"precommit": "./precommit.sh",
|
"precommit": "./precommit.sh",
|
||||||
"flow": "flow",
|
"flow": "flow",
|
||||||
"storybook": "start-storybook -p 6006",
|
"storybook": "start-storybook -p 6006",
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import contract from 'truffle-contract'
|
import contract from 'truffle-contract'
|
||||||
import { ensureOnce } from '~/utils/singleton'
|
import { ensureOnce } from '~/utils/singleton'
|
||||||
import { getWeb3 } from '~/wallets/getWeb3'
|
import { getWeb3 } from '~/wallets/getWeb3'
|
||||||
|
import { promisify } from '~/utils/promisify'
|
||||||
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
|
import GnosisSafeSol from '#/GnosisSafeTeamEdition.json'
|
||||||
import ProxyFactorySol from '#/ProxyFactory.json'
|
import ProxyFactorySol from '#/ProxyFactory.json'
|
||||||
import CreateAndAddModules from '#/CreateAndAddModules.json'
|
import CreateAndAddModules from '#/CreateAndAddModules.json'
|
||||||
|
@ -62,7 +63,7 @@ const getCreateProxyFactoryContract = ensureOnce(createProxyFactoryContract)
|
||||||
const getCreateAddExtensionContract = ensureOnce(createAddExtensionContract)
|
const getCreateAddExtensionContract = ensureOnce(createAddExtensionContract)
|
||||||
export const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitExtensionContract)
|
export const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitExtensionContract)
|
||||||
|
|
||||||
const createMasterCopies = async () => {
|
const instanciateMasterCopies = async () => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
|
|
||||||
// Create ProxyFactory Master Copy
|
// Create ProxyFactory Master Copy
|
||||||
|
@ -82,7 +83,26 @@ const createMasterCopies = async () => {
|
||||||
dailyLimitMaster = await DailyLimitExtension.deployed()
|
dailyLimitMaster = await DailyLimitExtension.deployed()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initContracts = ensureOnce(createMasterCopies)
|
// ONLY USED IN TEST ENVIRONMENT
|
||||||
|
const createMasterCopies = async () => {
|
||||||
|
const web3 = getWeb3()
|
||||||
|
const accounts = await promisify(cb => web3.eth.getAccounts(cb))
|
||||||
|
const userAccount = accounts[0]
|
||||||
|
|
||||||
|
const ProxyFactory = getCreateProxyFactoryContract(web3)
|
||||||
|
proxyFactoryMaster = await ProxyFactory.new({ from: userAccount, gas: '5000000' })
|
||||||
|
|
||||||
|
const CreateAndAddExtension = getCreateAddExtensionContract(web3)
|
||||||
|
createAndAddModuleMaster = await CreateAndAddExtension.new({ from: userAccount, gas: '5000000' })
|
||||||
|
|
||||||
|
const GnosisSafe = getGnosisSafeContract(web3)
|
||||||
|
safeMaster = await GnosisSafe.new([userAccount], 1, 0, 0, { from: userAccount, gas: '5000000' })
|
||||||
|
|
||||||
|
const DailyLimitExtension = getCreateDailyLimitExtensionContract(web3)
|
||||||
|
dailyLimitMaster = await DailyLimitExtension.new([], [], { from: userAccount, gas: '5000000' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export const initContracts = ensureOnce(process.env.NODE_ENV === 'test' ? createMasterCopies : instanciateMasterCopies)
|
||||||
|
|
||||||
const getSafeDataBasedOn = async (accounts, numConfirmations, dailyLimitInEth) => {
|
const getSafeDataBasedOn = async (accounts, numConfirmations, dailyLimitInEth) => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
|
|
Loading…
Reference in New Issue