export deployLP test helper

This commit is contained in:
perissology 2018-06-16 12:04:36 -07:00
parent 5dabfc4b62
commit b8f52dba0f
5 changed files with 57 additions and 47 deletions

View File

@ -1,43 +1,7 @@
const LPFactoryArtifact = require('./build/LPFactory.json');
const LiquidPledgingArtifact = require('./build/LiquidPledging.json');
const LPVaultArtifact = require('./build/LPVault.json');
const KernelArtifact = require('./build/Kernel.json');
const ACLArtifact = require('./build/ACL.json');
const StandardTokenTestAtifact = require('./build/StandardToken.json');
const LiquidPledgingMockArtifact = require('./build/LiquidPledgingMock.json');
const generateClass = require('eth-contract-class').default;
module.exports = {
LiquidPledging: generateClass(
LiquidPledgingArtifact.compilerOutput.abi,
LiquidPledgingArtifact.compilerOutput.evm.bytecode.object,
),
LPFactory: generateClass(
LPFactoryArtifact.compilerOutput.abi,
LPFactoryArtifact.compilerOutput.evm.bytecode.object,
),
LiquidPledgingState: require('./lib/liquidPledgingState.js'),
LPVault: generateClass(
LPVaultArtifact.compilerOutput.abi,
LPVaultArtifact.compilerOutput.evm.bytecode.object,
),
Kernel: generateClass(
KernelArtifact.compilerOutput.abi,
KernelArtifact.compilerOutput.evm.bytecode.object,
),
ACL: generateClass(
ACLArtifact.compilerOutput.abi,
ACLArtifact.compilerOutput.evm.bytecode.object,
),
test: {
StandardTokenTest: generateClass(
StandardTokenTestAtifact.compilerOutput.abi,
StandardTokenTestAtifact.compilerOutput.evm.bytecode.object,
),
assertFail: require('./test/helpers/assertFail'),
LiquidPledgingMock: generateClass(
LiquidPledgingMockArtifact.compilerOutput.abi,
LiquidPledgingMockArtifact.compilerOutput.evm.bytecode.object,
),
},
};
const contracts = require('./js/contracts');
contracts.test.assertFail = require('./test/helpers/assertFail');
contracts.test.deployLP = require('./test/helpers/deployLP');
module.exports = contracts;

48
js/contracts.js Normal file
View File

@ -0,0 +1,48 @@
const generateClass = require('eth-contract-class').default;
const LPFactoryArtifact = require('../build/LPFactory.json');
const LiquidPledgingArtifact = require('../build/LiquidPledging.json');
const LPVaultArtifact = require('../build/LPVault.json');
const KernelArtifact = require('../build/Kernel.json');
const ACLArtifact = require('../build/ACL.json');
const StandardTokenTestAtifact = require('../build/StandardToken.json');
const LiquidPledgingMockArtifact = require('../build/LiquidPledgingMock.json');
const RecoveryVaultArtifact = require('../build/RecoveryVault.json');
module.exports = {
LiquidPledging: generateClass(
LiquidPledgingArtifact.compilerOutput.abi,
LiquidPledgingArtifact.compilerOutput.evm.bytecode.object,
),
LPFactory: generateClass(
LPFactoryArtifact.compilerOutput.abi,
LPFactoryArtifact.compilerOutput.evm.bytecode.object,
),
LiquidPledgingState: require('../lib/liquidPledgingState.js'),
LPVault: generateClass(
LPVaultArtifact.compilerOutput.abi,
LPVaultArtifact.compilerOutput.evm.bytecode.object,
),
Kernel: generateClass(
KernelArtifact.compilerOutput.abi,
KernelArtifact.compilerOutput.evm.bytecode.object,
),
ACL: generateClass(
ACLArtifact.compilerOutput.abi,
ACLArtifact.compilerOutput.evm.bytecode.object,
),
test: {
RecoveryVault: generateClass(
RecoveryVaultArtifact.compilerOutput.abi,
RecoveryVaultArtifact.compilerOutput.evm.bytecode.object,
),
StandardTokenTest: generateClass(
StandardTokenTestAtifact.compilerOutput.abi,
StandardTokenTestAtifact.compilerOutput.evm.bytecode.object,
),
LiquidPledgingMock: generateClass(
LiquidPledgingMockArtifact.compilerOutput.abi,
LiquidPledgingMockArtifact.compilerOutput.evm.bytecode.object,
),
},
};

View File

@ -4,9 +4,8 @@ const TestRPC = require('ganache-cli');
const Web3 = require('web3');
const { assert } = require('chai');
const { LPVault, LPFactory, LiquidPledgingState, Kernel, ACL, test } = require('../index');
const { RecoveryVault } = require('../build/contracts');
const { StandardTokenTest, assertFail, LiquidPledgingMock } = test;
const { StandardTokenTest, assertFail, LiquidPledgingMock, RecoveryVault } = test;
describe('LPVault test', function() {
this.timeout(0);

View File

@ -4,9 +4,8 @@ const Ganache = require('ganache-cli');
const Web3 = require('web3');
const { assert } = require('chai');
const { LPVault, LPFactory, LiquidPledgingState, Kernel, ACL, test } = require('../index');
const { RecoveryVault } = require('../build/contracts');
const { StandardTokenTest, assertFail, LiquidPledgingMock } = test;
const { StandardTokenTest, assertFail, LiquidPledgingMock, RecoveryVault } = test;
const { utils } = Web3;
const printState = async liquidPledgingState => {

View File

@ -1,5 +1,5 @@
const { LPVault, LPFactory, LiquidPledgingState, Kernel, ACL, test } = require('../../index');
const { RecoveryVault } = require('../../build/contracts');
const { LPVault, LPFactory, LiquidPledgingState, Kernel, ACL, test } = require('../../js/contracts');
const { RecoveryVault } = test;
module.exports = async web3 => {
const accounts = await web3.eth.getAccounts();