Skip to content

Commit

Permalink
change Moloch.sol ragequit variable names and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ameensol committed Jan 16, 2020
1 parent 18a692c commit 5b01708
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions contracts/Moloch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,11 @@ contract Moloch is ReentrancyGuard {
totalLoot = totalLoot.sub(lootToBurn);

for (uint256 i = 0; i < tokens.length; i++) {
uint256 userBalance = fairShare(userTokenBalances[GUILD][tokens[i]], sharesAndLootToBurn, initialTotalSharesAndLoot);
uint256 amountToRagequit = fairShare(userTokenBalances[GUILD][tokens[i]], sharesAndLootToBurn, initialTotalSharesAndLoot);
// deliberately not using safemath here to keep overflows from preventing the function execution (which would break ragekicks)
// if a token overflows, it is because the supply was artificially inflated to oblivion, so we probably don't care about it anyways
userTokenBalances[GUILD][tokens[i]] = userTokenBalances[GUILD][tokens[i]] - userBalance;
userTokenBalances[memberAddress][tokens[i]] = userTokenBalances[memberAddress][tokens[i]] + userBalance;
userTokenBalances[GUILD][tokens[i]] -= amountToRagequit;
userTokenBalances[memberAddress][tokens[i]] += amountToRagequit;
}

emit Ragequit(msg.sender, sharesToBurn, lootToBurn);
Expand Down
7 changes: 6 additions & 1 deletion test/molochV2-multitoken.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ contract('Moloch', ([creator, summoner, applicant1, applicant2, processor, deleg
await restore(snapshotId)
})

describe('rageQuit - multi-token', async () => {
describe('multi-token ragequit + withdraw', async () => {
beforeEach(async () => {
// 1st proposal for with token alpha tribute
await fundAndApproveToMoloch({
Expand Down Expand Up @@ -380,6 +380,11 @@ contract('Moloch', ([creator, summoner, applicant1, applicant2, processor, deleg
}
})
})

// TODO
it('withdraw tokens works', async () => {

})
})
})
})

0 comments on commit 5b01708

Please sign in to comment.