Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
Last active July 24, 2020 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrkrshnn/c73874b150d4a2c1ec6ebbc345efa9b3 to your computer and use it in GitHub Desktop.
Save hrkrshnn/c73874b150d4a2c1ec6ebbc345efa9b3 to your computer and use it in GitHub Desktop.
Usage of non-trivial exponentation in aragonOS argent-contracts augur-core colonyNetwork openzeppelin-contracts safe-contracts synthetix uniswap-v2-core util-contracts
codefile
uint _newParentSkillNumber = _parentSkillNumber - 2**i;colonyNetwork/contracts/colonyNetwork/ColonyNetwork.sol
uint x = mul(10**sub(36, daysOpen), sub(864000, mul(9,r))) / 864000;colonyNetwork/contracts/colonyNetwork/ColonyNetworkAuction.sol
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));colonyNetwork/contracts/common/DomainRoles.sol
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));colonyNetwork/contracts/common/DomainRoles.sol
bytes32 shifted = bytes32(uint256(uint256(2) ** uint256(role)));colonyNetwork/contracts/common/DomainRoles.sol
uint256 afterInsertionBranchMask = u[U_ADJACENT_REPUTATION_BRANCH_MASK] OR uint256(2**firstDifferenceBit);colonyNetwork/contracts/reputationMiningCycle/ReputationMiningCycleRespond.sol
uint256 afterInsertionBranchMask = branchMask OR uint256(2**firstDifferenceBit);colonyNetwork/contracts/reputationMiningCycle/ReputationMiningCycleRespond.sol
_destAmount = _expectedRate.mul(_srcAmount.sub(_fee)).div(10 ** (36-destDecimals));argent-contracts/contracts-legacy/v1.6.0/contracts/modules/TokenExchanger.sol
_destAmount = _expectedRate.mul(_srcAmount).div(10 ** srcDecimals);argent-contracts/contracts-legacy/v1.6.0/contracts/modules/TokenExchanger.sol
return price.mul(_amount).div(10**decimals);argent-contracts/contracts-legacy/v1.6.0/contracts/infrastructure/TokenPriceProvider.sol
uint mask = 256 ** (32 - len) - 1;argent-contracts/contracts-legacy/v1.6.0/lib/utils/strings.sol
mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);argent-contracts/contracts-legacy/v1.6.0/lib/utils/strings.sol
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));argent-contracts/contracts-legacy/v1.6.0/lib/utils/strings.sol
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));argent-contracts/contracts-legacy/v1.6.0/lib/utils/strings.sol
destAmount = expectedRate.mul(_srcAmount).div(10**tokens[address(_src)].decimals);argent-contracts/contracts-test/KyberNetworkTest.sol
srcAmount = _maxDestAmount.mul(10**tokens[address(_src)].decimals).div(expectedRate);argent-contracts/contracts-test/KyberNetworkTest.sol
_mint(_initialAccounts[i], _supply * 10**uint(_decimals));argent-contracts/contracts-test/TestERC20.sol
uint mask = 256 ** (32 - len) - 1;argent-contracts/lib/utils/strings.sol
mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);argent-contracts/lib/utils/strings.sol
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));argent-contracts/lib/utils/strings.sol
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));argent-contracts/lib/utils/strings.sol
uint public constant UNIT = 10**uint(decimals);synthetix/legacy/contracts/SafeDecimalMath.sol
uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);synthetix/legacy/contracts/SafeDecimalMath.sol
uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);synthetix/legacy/contracts/SafeDecimalMath.sol
uint public constant UNIT = 10**uint(decimals);synthetix/legacy/contracts/SynthetixEscrow.sol
uint public constant UNIT = 10**uint(decimals);synthetix/contracts/SafeDecimalMath.sol
uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);synthetix/contracts/SafeDecimalMath.sol
uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);synthetix/contracts/SafeDecimalMath.sol
@hrkrshnn
Copy link
Author

hrkrshnn commented Jul 24, 2020

Ignore the OR. It's a hack to avoid | messing with tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment