Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/genesis/GenesisGroup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract GenesisGroup is IGenesisGroup, CoreRef, ERC20, ERC20Burnable, Timed {
function commit(address from, address to, uint amount) external override onlyGenesisPeriod {
burnFrom(from, amount);

committedFGEN[to] = amount;
committedFGEN[to] += amount;
totalCommittedFGEN += amount;

emit Commit(from, to, amount);
Expand Down
18 changes: 15 additions & 3 deletions test/genesis/GenesisGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,29 @@ describe('GenesisGroup', function () {
await this.genesisGroup.purchase(userAddress, 750, {from: userAddress, value: 750});
await this.genesisGroup.purchase(secondUserAddress, 250, {from: secondUserAddress, value: 250});
});
describe('Single Commit', async function() {
describe('Self commit', async function() {
describe('Single Commit', function() {
describe('Self commit', function() {
beforeEach(async function() {
await this.genesisGroup.commit(userAddress, userAddress, '500', {from: userAddress});
await time.increase('2000');
});

it('succeeds', async function() {
expect(await this.genesisGroup.balanceOf(userAddress)).to.be.bignumber.equal('250');
expect(await this.genesisGroup.committedFGEN(userAddress)).to.be.bignumber.equal('500');
expect(await this.genesisGroup.totalCommittedFGEN()).to.be.bignumber.equal('500');
});

describe('Second commit', function() {
beforeEach(async function() {
await this.genesisGroup.commit(userAddress, userAddress, '250', {from: userAddress});
});

it('updates', async function() {
expect(await this.genesisGroup.balanceOf(userAddress)).to.be.bignumber.equal('0');
expect(await this.genesisGroup.committedFGEN(userAddress)).to.be.bignumber.equal('750');
expect(await this.genesisGroup.totalCommittedFGEN()).to.be.bignumber.equal('750');
});
});
});

describe('Commit other', async function() {
Expand Down