This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd | |
# remove current vim directories | |
rm -rf ~/.vim | |
rm -rf ~/.vimrc | |
rm -rf ~/.gvimrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library RoundedDivMath { | |
/** | |
* @dev Division, round to nearest integer (AKA round-half-up) | |
* @param a What to divide | |
* @param b Divide by this number | |
*/ | |
function roundedDiv(uint256 a, uint256 b) internal pure returns (uint256) { | |
// Solidity automatically throws, but please emit reason | |
require(b > 0, "div by 0"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint orgGets = bankersRoundedDiv(markup_cents.mul(events[msg.sender].feeOrg_ppm),1000000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate how much event Organizer gets | |
X = (((markup_cents * feeOrg_ppm) / 10000) / 100); | |
// Which can be simplified: | |
X = (markup_cents * feeOrg_ppm) / 1000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WRITE | |
function start() public onlyOwner { | |
eventStartTime = now; | |
} | |
function transfer(address _to, uint256 _value) public returns (bool) { | |
updateCopyOnWriteMaps(msg.sender, _to); | |
return super.transfer(_to, _value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WRITE | |
function transfer(address _to, uint256 _value) public returns (bool) { | |
updateCopyOnWriteMap(msg.sender, _to); | |
return super.transfer(_to, _value); | |
} | |
function updateCopyOnWriteMap(address _from, address _to) internal { | |
if(!isDataInMapping(_from)){ | |
balancesAtTheStartOfVoting[_for].balance = balances[_for]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balancesAtTheStartOfVoting[HolderA] is 100 | |
balancesAtTheStartOfVoting[HolderB] is 20 | |
balances[HolderA] is 70 | |
balances[HolderB] is 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balancesAtTheStartOfVoting[HolderA] is 100 | |
balancesAtTheStartOfVoting[HolderB] is 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balances[HolderA] is 70 | |
balances[HolderB] is 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balances[HolderA] is 100 | |
balances[HolderB] is 20 |
NewerOlder