|
| 1 | +const helpers = require('./helpers'); |
| 2 | + |
| 3 | +const ERC20Mock = artifacts.require('./test/ERC20Mock.sol'); |
| 4 | +const ContinuousLocking4Reputation = artifacts.require('./ContinuousLocking4Reputation.sol'); |
| 5 | +const ContinuousLocking4ReputationFactory = artifacts.require('./ContinuousLocking4ReputationFactory.sol'); |
| 6 | + |
| 7 | +const setup = async function () { |
| 8 | + var testSetup = new helpers.TestSetup(); |
| 9 | + testSetup.continuousLocking4ReputationFactory = await ContinuousLocking4ReputationFactory.new(); |
| 10 | + return testSetup; |
| 11 | +}; |
| 12 | + |
| 13 | +contract('competitionFactory', function(accounts) { |
| 14 | + it('initialize', async () => { |
| 15 | + let testSetup = await setup(); |
| 16 | + testSetup.lockingToken = await ERC20Mock.new(accounts[0], web3.utils.toWei('100', "ether")); |
| 17 | + testSetup.startTime = (await web3.eth.getBlock("latest")).timestamp; |
| 18 | + testSetup.redeemEnableTime = (await web3.eth.getBlock("latest")).timestamp + (30*60*60); |
| 19 | + testSetup.continuousLocking4Reputation = await ContinuousLocking4Reputation.new(); |
| 20 | + testSetup.periodsUnit = (30*60*60); |
| 21 | + testSetup.agreementHash = helpers.SOME_HASH; |
| 22 | + testSetup.maxLockingPeriod = 12; |
| 23 | + |
| 24 | + testSetup.repRewardConstA = 85000; |
| 25 | + testSetup.repRewardConstB = 900; |
| 26 | + testSetup.reputationReward = 850000; |
| 27 | + testSetup.periodsCap = 100; |
| 28 | + let cl4rAddress = await testSetup.continuousLocking4ReputationFactory.createCL4R.call( |
| 29 | + helpers.SOME_ADDRESS, |
| 30 | + testSetup.reputationReward, |
| 31 | + testSetup.startTime, |
| 32 | + testSetup.periodsUnit, |
| 33 | + testSetup.redeemEnableTime, |
| 34 | + testSetup.maxLockingPeriod, |
| 35 | + testSetup.repRewardConstA, |
| 36 | + testSetup.repRewardConstB, |
| 37 | + testSetup.periodsCap, |
| 38 | + testSetup.lockingToken.address, |
| 39 | + testSetup.agreementHash |
| 40 | + ); |
| 41 | + await testSetup.continuousLocking4ReputationFactory.createCL4R( |
| 42 | + helpers.SOME_ADDRESS, |
| 43 | + testSetup.reputationReward, |
| 44 | + testSetup.startTime, |
| 45 | + testSetup.periodsUnit, |
| 46 | + testSetup.redeemEnableTime, |
| 47 | + testSetup.maxLockingPeriod, |
| 48 | + testSetup.repRewardConstA, |
| 49 | + testSetup.repRewardConstB, |
| 50 | + testSetup.periodsCap, |
| 51 | + testSetup.lockingToken.address, |
| 52 | + testSetup.agreementHash |
| 53 | + ); |
| 54 | + let continuousLocking4Reputation = await ContinuousLocking4Reputation.at(cl4rAddress); |
| 55 | + assert.equal(await continuousLocking4Reputation.reputationRewardLeft(),testSetup.reputationReward); |
| 56 | + assert.equal(await continuousLocking4Reputation.startTime(),testSetup.startTime); |
| 57 | + assert.equal(await continuousLocking4Reputation.redeemEnableTime(),testSetup.redeemEnableTime); |
| 58 | + assert.equal(await continuousLocking4Reputation.token(),testSetup.lockingToken.address); |
| 59 | + assert.equal(await continuousLocking4Reputation.batchTime(),testSetup.periodsUnit); |
| 60 | + assert.equal(await continuousLocking4Reputation.getAgreementHash(),testSetup.agreementHash); |
| 61 | + assert.equal(await continuousLocking4Reputation.batchesIndexCap(),testSetup.periodsCap); |
| 62 | + }); |
| 63 | + |
| 64 | +}); |
0 commit comments