Skip to content

Instantly share code, notes, and snippets.

Anthony Akentiev AnthonyAkentiev

Block or report user

Report or block AnthonyAkentiev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BankersRounding.sol
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");
View RoundingExample2.sol
uint orgGets = bankersRoundedDiv(markup_cents.mul(events[msg.sender].feeOrg_ppm),1000000);
View RoundingExample1.sol
// Calculate how much event Organizer gets
X = (((markup_cents * feeOrg_ppm) / 10000) / 100);
// Which can be simplified:
X = (markup_cents * feeOrg_ppm) / 1000000;
View СoW_token2.sol
// 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);
}
View CoW_token1.sol
// 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];
}
View dao_balances4.sol
balancesAtTheStartOfVoting[HolderA] is 100
balancesAtTheStartOfVoting[HolderB] is 20
balances[HolderA] is 70 
balances[HolderB] is 50
View dao_balances3.sol
balancesAtTheStartOfVoting[HolderA] is 100
balancesAtTheStartOfVoting[HolderB] is 20
View dao_balances2.sol
balances[HolderA] is 70 
balances[HolderB] is 50
View dao_balance1.sol
balances[HolderA] is 100 
balances[HolderB] is 20
View dao_balance1.sol
balances[HolderA] is 100 
balances[HolderB] is 20
You can’t perform that action at this time.