Skip to content

Commit 209c01c

Browse files
committed
Add test for MVM claimEth
Verifies that it works for foundationWallet but it throws with other account
1 parent 92fc1d2 commit 209c01c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/MarketValidationMechanism.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,36 @@ contract('Market validation Mechanism', function(accounts) {
215215
'total supply has decrease to 50 because of burned tokens');
216216
});
217217

218+
it('validates that only the foundation can claim wei', async function() {
219+
const token = await LifToken.new({from: accounts[0]}),
220+
start = latestTime() + 5,
221+
foundationWallet = accounts[1],
222+
otherAccount = accounts[4],
223+
mvm = await LifMarketValidationMechanism.new(token.address, start,
224+
100, 24, foundationWallet, {from: accounts[0]});
225+
226+
// mint some tokens, fund fails otherwise b/c it divides weiSent with tokenSupply
227+
await token.mint(accounts[5], 100, {from: accounts[0]});
228+
await mvm.fund({value: 100, from: accounts[0]});
229+
await mvm.calculateDistributionPeriods();
230+
231+
await increaseTimeTestRPCTo(start + 2000);
232+
233+
// works
234+
await mvm.claimWei(1, {from: foundationWallet});
235+
236+
try {
237+
// fails
238+
await mvm.claimWei(1, {from: otherAccount});
239+
assert(false, 'should have thrown');
240+
} catch(e) {
241+
assert(help.isInvalidOpcodeEx(e));
242+
}
243+
244+
// works
245+
await mvm.claimWei(1, {from: foundationWallet});
246+
});
247+
218248
it('Create 24 months MM', async function() {
219249
const mmInitialBalance = 20000000;
220250
const totalTokenSupply = 100;

0 commit comments

Comments
 (0)