Unnamed: 0
int64 0
7.36k
| comments
stringlengths 3
35.2k
| code_string
stringlengths 1
527k
| code
stringlengths 1
527k
| __index_level_0__
int64 0
88.6k
|
|---|---|---|---|---|
287
|
// Private Function to check that Rooot ID = 0 is not modified as this is root _index The index to check /
|
function _isNonReservedItem(uint _index)
|
function _isNonReservedItem(uint _index)
| 36,998
|
81
|
// PoS Bridge
|
interface IRootChainManager {
function depositEtherFor(address user) external payable;
function depositFor(
address user,
address rootToken,
bytes calldata depositData
) external;
function tokenToType(address) external returns (bytes32);
function typeToPredicate(bytes32) external returns (address);
}
|
interface IRootChainManager {
function depositEtherFor(address user) external payable;
function depositFor(
address user,
address rootToken,
bytes calldata depositData
) external;
function tokenToType(address) external returns (bytes32);
function typeToPredicate(bytes32) external returns (address);
}
| 11,379
|
165
|
// solhint-disable no-empty-blocks/Payable fallback to receive ETH from uniswap.
|
function ()
external
payable
|
function ()
external
payable
| 16,496
|
41
|
// burn amount calculations
|
if (totalSupply() > _minimumSupply) {
burnAmount = amount.mul(2).div(100);
uint256 availableBurn = totalSupply().sub(_minimumSupply);
if (burnAmount > availableBurn) {
burnAmount = availableBurn;
}
|
if (totalSupply() > _minimumSupply) {
burnAmount = amount.mul(2).div(100);
uint256 availableBurn = totalSupply().sub(_minimumSupply);
if (burnAmount > availableBurn) {
burnAmount = availableBurn;
}
| 7,035
|
115
|
// Allows owner to increase/decrease POLY approval of one of the modules_module Module address_change Change in allowance_increase True if budget has to be increased, false if decrease/
|
function changeModuleBudget(address _module, uint256 _change, bool _increase) external;
|
function changeModuleBudget(address _module, uint256 _change, bool _increase) external;
| 47,825
|
175
|
// using nested data sources (query type nested) and partial encrypted queries in the next release of oraclize note that the first call maps the encrypted string to the sending contract address, this string can't be used from any other sender
|
string memory oraclize_url = strConcat(
oraclize_RatingsBaseUrl,
_carrierFlightNumber,
oraclizeRatingsQuery
);
bytes32 queryId = oraclize_query("nested", oraclize_url, oraclizeGas);
|
string memory oraclize_url = strConcat(
oraclize_RatingsBaseUrl,
_carrierFlightNumber,
oraclizeRatingsQuery
);
bytes32 queryId = oraclize_query("nested", oraclize_url, oraclizeGas);
| 46,991
|
144
|
// View function to see pending Rewards on frontend.
|
function pendingRewardToken(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRewardTokenPerShare = pool.accRewardTokenPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(rewardTokenPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accRewardTokenPerShare = accRewardTokenPerShare.add(tokenReward.mul(1e12).div(lpSupply));
}
uint256 pending = user.amount.mul(accRewardTokenPerShare).div(1e12).sub(user.rewardDebt);
return pending.sub(pending.div(10));
}
|
function pendingRewardToken(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRewardTokenPerShare = pool.accRewardTokenPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(rewardTokenPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accRewardTokenPerShare = accRewardTokenPerShare.add(tokenReward.mul(1e12).div(lpSupply));
}
uint256 pending = user.amount.mul(accRewardTokenPerShare).div(1e12).sub(user.rewardDebt);
return pending.sub(pending.div(10));
}
| 39,506
|
16
|
// Gets the sum of all tokens that this address allowed others spend on its expence. Basically a sum of all allowances from this address _owner The address to query the allowances of.return An uint256 representing the sum of all allowances of the passed address./
|
function getTotalAllowed(address _owner) view public returns(uint256)
|
function getTotalAllowed(address _owner) view public returns(uint256)
| 42,021
|
394
|
// round 52
|
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 7157404299437167354719786626667769956233708887934477609633504801472827442743)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
|
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 7157404299437167354719786626667769956233708887934477609633504801472827442743)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 19,825
|
5
|
// Emitted when base URI is set.
|
event BaseURISet(string baseTokenURI);
|
event BaseURISet(string baseTokenURI);
| 12,693
|
190
|
// The various states a transcoder can be in
|
enum TranscoderStatus { NotRegistered, Registered }
// Represents a delegator's current state
struct Delegator {
uint256 bondedAmount; // The amount of bonded tokens
uint256 fees; // The amount of fees collected
address delegateAddress; // The address delegated to
uint256 delegatedAmount; // The amount of tokens delegated to the delegator
uint256 startRound; // The round the delegator transitions to bonded phase and is delegated to someone
uint256 withdrawRoundDEPRECATED; // DEPRECATED - DO NOT USE
uint256 lastClaimRound; // The last round during which the delegator claimed its earnings
uint256 nextUnbondingLockId; // ID for the next unbonding lock created
mapping (uint256 => UnbondingLock) unbondingLocks; // Mapping of unbonding lock ID => unbonding lock
}
|
enum TranscoderStatus { NotRegistered, Registered }
// Represents a delegator's current state
struct Delegator {
uint256 bondedAmount; // The amount of bonded tokens
uint256 fees; // The amount of fees collected
address delegateAddress; // The address delegated to
uint256 delegatedAmount; // The amount of tokens delegated to the delegator
uint256 startRound; // The round the delegator transitions to bonded phase and is delegated to someone
uint256 withdrawRoundDEPRECATED; // DEPRECATED - DO NOT USE
uint256 lastClaimRound; // The last round during which the delegator claimed its earnings
uint256 nextUnbondingLockId; // ID for the next unbonding lock created
mapping (uint256 => UnbondingLock) unbondingLocks; // Mapping of unbonding lock ID => unbonding lock
}
| 1,741
|
830
|
// RariFundController This contract handles deposits to and withdrawals from the liquidity pools that power the Rari Yield Pool as well as currency exchanges via 0x. /
|
contract RariFundController is Ownable {
using SafeMath for uint256;
using SignedSafeMath for int256;
using SafeERC20 for IERC20;
|
contract RariFundController is Ownable {
using SafeMath for uint256;
using SignedSafeMath for int256;
using SafeERC20 for IERC20;
| 29,039
|
26
|
// Transfer tokens from the contract to the owner
|
erc20Token.transfer(owner, amount);
emit Erc20Withdrawal(erc20TokenAddress, amount, block.timestamp);
|
erc20Token.transfer(owner, amount);
emit Erc20Withdrawal(erc20TokenAddress, amount, block.timestamp);
| 28,249
|
24
|
// solhint-disable-next-line avoid-tx-origin
|
address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;
if (gasToken == address(0)) {
|
address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;
if (gasToken == address(0)) {
| 3,246
|
53
|
// c = cD / (Anncoins.length)
|
c = c.mul(D).div(Ann.mul(coins.length));
|
c = c.mul(D).div(Ann.mul(coins.length));
| 46,516
|
234
|
// The first 32 bits of the packed data corresponds to the id. By casting to uint32, we can compare the id without having to unpack the entire thing.
|
uint32 orderId = uint32(orders[i].packedData);
if (orderId == id) {
|
uint32 orderId = uint32(orders[i].packedData);
if (orderId == id) {
| 57,099
|
102
|
// Revoke a third party `_operator`'s rights to manage (send) `msg.sender`'s tokens at remote database. _operator The operator that wants to be Revoked /
|
function revokeOperator(address _operator) external {
require(_operator != msg.sender, "Cannot revoke yourself as an operator");
if (balancesDB.getDefaultOperator(_operator)) {
require(balancesDB.setRevokedDefaultOperator(_operator, msg.sender, true));
} else {
require(balancesDB.setAuthorizedOperator(_operator, msg.sender, false));
}
emit RevokedOperator(_operator, msg.sender);
}
|
function revokeOperator(address _operator) external {
require(_operator != msg.sender, "Cannot revoke yourself as an operator");
if (balancesDB.getDefaultOperator(_operator)) {
require(balancesDB.setRevokedDefaultOperator(_operator, msg.sender, true));
} else {
require(balancesDB.setAuthorizedOperator(_operator, msg.sender, false));
}
emit RevokedOperator(_operator, msg.sender);
}
| 12,739
|
65
|
// Allows the safe transfer of ETH _to account to transfer ETH _value amount of ETH /
|
function safeTransferETH(address _to, uint256 _value) internal {
(bool success, ) = _to.call{value: _value}(new bytes(0));
require(success, "IVaultHandler::safeTransferETH: ETH transfer failed");
}
|
function safeTransferETH(address _to, uint256 _value) internal {
(bool success, ) = _to.call{value: _value}(new bytes(0));
require(success, "IVaultHandler::safeTransferETH: ETH transfer failed");
}
| 9,386
|
128
|
// modify the community Perks wallet address
|
function updateMemberPerksWallet(
address newMemberPerksWallet
|
function updateMemberPerksWallet(
address newMemberPerksWallet
| 7,832
|
276
|
// Validates a transfer with a TransferManager module if it exists TransferManager module has a key of 2 _from sender of transfer _to receiver of transfer _value value of transfer _data data to indicate validationreturn bool /
|
function verifyTransfer(address _from, address _to, uint256 _value, bytes _data) public returns (bool) {
return _verifyTransfer(_from, _to, _value, _data, false);
}
|
function verifyTransfer(address _from, address _to, uint256 _value, bytes _data) public returns (bool) {
return _verifyTransfer(_from, _to, _value, _data, false);
}
| 26,283
|
9
|
// Emitted when Expansion is deployed expansion Address of deployed DynamicBlueprintsExpansion BeaconProxy expansionPlatformID Platform's identification of dynamic blueprint expansion /
|
event ExpansionDeployed(address indexed expansion, string expansionPlatformID);
|
event ExpansionDeployed(address indexed expansion, string expansionPlatformID);
| 35,927
|
11
|
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
|
function name() public pure returns (string) {}
function symbol() public pure returns (string) {}
function decimals() public pure returns (uint8) {}
function totalSupply() public pure returns (uint256) {}
function balanceOf(address _owner) public pure returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public pure returns (uint256) { _owner; _spender; }
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
|
function name() public pure returns (string) {}
function symbol() public pure returns (string) {}
function decimals() public pure returns (uint8) {}
function totalSupply() public pure returns (uint256) {}
function balanceOf(address _owner) public pure returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public pure returns (uint256) { _owner; _spender; }
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
| 11,527
|
55
|
// Returns a memory pointer to the data portion of the provided bytes array. bts Memory byte array /
|
function dataPtr(bytes memory bts) internal pure returns (uint256 addr) {
assembly {
addr := add(bts, /*BYTES_HEADER_SIZE*/ 32)
}
}
|
function dataPtr(bytes memory bts) internal pure returns (uint256 addr) {
assembly {
addr := add(bts, /*BYTES_HEADER_SIZE*/ 32)
}
}
| 49,591
|
147
|
// Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. newPendingAdmin New pending admin.return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
|
function _setPendingAdmin(address newPendingAdmin)
public
returns (uint256)
|
function _setPendingAdmin(address newPendingAdmin)
public
returns (uint256)
| 19,757
|
43
|
// Returns the token symbol. /
|
function symbol() external view returns (string memory) {
return _symbol;
}
|
function symbol() external view returns (string memory) {
return _symbol;
}
| 15,738
|
127
|
// Get opposite TIP-3 token root address _token Address of token root /
|
function _getOppositeToken(address _token)
private
view
returns(address)
|
function _getOppositeToken(address _token)
private
view
returns(address)
| 1,299
|
49
|
// An address used in the withdrawal process/ return adminToo
|
address public adminToo;
|
address public adminToo;
| 47,996
|
31
|
// The Channel should be in Open State
|
require(channels[id].isOpen);
|
require(channels[id].isOpen);
| 45,162
|
143
|
// A struct to record metrics about OpenMarketOperation.
|
struct OpenMarketOperationLog {
int coin_budget;
int exchanged_coins;
int exchanged_eth;
uint eth_balance;
uint latest_price;
uint new_value1;
uint new_value2;
}
|
struct OpenMarketOperationLog {
int coin_budget;
int exchanged_coins;
int exchanged_eth;
uint eth_balance;
uint latest_price;
uint new_value1;
uint new_value2;
}
| 20,844
|
5
|
// Slope of the variable interest curve when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO. Expressed in ray
|
uint256 internal immutable _variableRateSlope1;
|
uint256 internal immutable _variableRateSlope1;
| 6,097
|
69
|
// ´:°•.°+.•´.:˚.°.˚•´.°:°•.°•.•´.:˚.°.˚•´.°:°•.°+.•´.://EIP-2612//.•°:°.´+˚.°.˚:.´•.+°.•°:´.´•.•°.•°:°.´:•˚°.°.˚:.´+°.•//Returns the current nonce for `owner`./ This value is used to compute the signature for EIP-2612 permit.
|
function nonces(address owner) public view virtual returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
// Compute the nonce slot and load its value.
mstore(0x0c, _NONCES_SLOT_SEED)
mstore(0x00, owner)
result := sload(keccak256(0x0c, 0x20))
}
}
|
function nonces(address owner) public view virtual returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
// Compute the nonce slot and load its value.
mstore(0x0c, _NONCES_SLOT_SEED)
mstore(0x00, owner)
result := sload(keccak256(0x0c, 0x20))
}
}
| 15,822
|
506
|
// Sets a new bird oracle for the bControllerAdmin function to set a new bird oracle return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
|
function _setBirdOracle(BirdOracleInterface newBirdOracle) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);
}
// Set bController's birdOracle to newBirdOracle
birdOracle = newBirdOracle;
}
|
function _setBirdOracle(BirdOracleInterface newBirdOracle) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);
}
// Set bController's birdOracle to newBirdOracle
birdOracle = newBirdOracle;
}
| 31,252
|
48
|
// Writes an address into a specific position in a byte array./b Byte array to insert address into./index Index in byte array of address./input Address to put into byte array.
|
function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
|
function writeAddress(
bytes memory b,
uint256 index,
address input
)
internal
pure
| 499
|
74
|
// See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. /
|
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
|
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 532
|
19
|
// Set leader's img_url if it is not an empty string
|
bytes memory tmp_img_url = bytes(img_url);
if (tmp_img_url.length != 0) {
|
bytes memory tmp_img_url = bytes(img_url);
if (tmp_img_url.length != 0) {
| 23,217
|
187
|
// Add intrinsic gas and transfer gas. Need to account for gas stipend as well. usedGas += 21000 + 9700;
|
usedGas += 30000;
|
usedGas += 30000;
| 8,753
|
3
|
// This is the only place where we ever mint tokens for initial supply
|
_mint(_msgSender(), _totalSupply * (10 ** uint256(_decimals)));
|
_mint(_msgSender(), _totalSupply * (10 ** uint256(_decimals)));
| 25,433
|
13
|
// current validator set used by chain only changed at block epoch
|
address[] public currentValidatorSet;
|
address[] public currentValidatorSet;
| 402
|
47
|
// - Flag deposit as claimed
|
DepositRecord[msg.sender][xactionIndex].claimed = true;
|
DepositRecord[msg.sender][xactionIndex].claimed = true;
| 19,552
|
0
|
// Swap directly through a Pair amountIn input amount fromToken address toToken address pair Pair used for swapreturn output amount /
|
function swap(uint amountIn, address fromToken, address toToken, IPair pair) internal returns (uint) {
(address token0,) = sortTokens(fromToken, toToken);
(uint112 reserve0, uint112 reserve1,) = pair.getReserves();
if (token0 != fromToken) (reserve0, reserve1) = (reserve1, reserve0);
uint amountOut1 = 0;
uint amountOut2 = getAmountOut(amountIn, reserve0, reserve1);
if (token0 != fromToken) (amountOut1, amountOut2) = (amountOut2, amountOut1);
safeTransfer(fromToken, address(pair), amountIn);
pair.swap(amountOut1, amountOut2, address(this), zeroBytes);
return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
}
|
function swap(uint amountIn, address fromToken, address toToken, IPair pair) internal returns (uint) {
(address token0,) = sortTokens(fromToken, toToken);
(uint112 reserve0, uint112 reserve1,) = pair.getReserves();
if (token0 != fromToken) (reserve0, reserve1) = (reserve1, reserve0);
uint amountOut1 = 0;
uint amountOut2 = getAmountOut(amountIn, reserve0, reserve1);
if (token0 != fromToken) (amountOut1, amountOut2) = (amountOut2, amountOut1);
safeTransfer(fromToken, address(pair), amountIn);
pair.swap(amountOut1, amountOut2, address(this), zeroBytes);
return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
}
| 37,418
|
79
|
// You can access this method either buying tokens or assigning tokens to someone. In the previous case you won&39;t be sending any ehter to contract so no need to forward any funds to wallet.
|
if (msg.value > 0) {
wallet.transfer(_weiSpent);
}
|
if (msg.value > 0) {
wallet.transfer(_weiSpent);
}
| 46,913
|
177
|
// add board meeting /
|
function addBoardMeeting(
bytes32 _hash,
bytes32[] _sigR,
bytes32[] _sigS,
uint8[] _sigV) public
thresholdRequired(address(this), 0,
abi.encodePacked(_hash),
0, threshold, _sigR, _sigS, _sigV)
|
function addBoardMeeting(
bytes32 _hash,
bytes32[] _sigR,
bytes32[] _sigS,
uint8[] _sigV) public
thresholdRequired(address(this), 0,
abi.encodePacked(_hash),
0, threshold, _sigR, _sigS, _sigV)
| 13,133
|
3
|
// Triggered when an initial offering end date is set _date Initial offering end date /
|
event InititalOfferEndDateSet(uint256 _date);
|
event InititalOfferEndDateSet(uint256 _date);
| 39,483
|
152
|
// Fetches the recipient of government fees/ and current government fee charged in fee units
|
function feeConfiguration() external view returns (address _feeTo, uint24 _governmentFeeUnits);
|
function feeConfiguration() external view returns (address _feeTo, uint24 _governmentFeeUnits);
| 1,576
|
93
|
// special case if the ratio = 100%
|
if (_reserveRatio == MAX_RESERVE_RATIO) {
return _supply.mul(_depositAmount).div(_reserveBalance);
}
|
if (_reserveRatio == MAX_RESERVE_RATIO) {
return _supply.mul(_depositAmount).div(_reserveBalance);
}
| 78,200
|
4,700
|
// 2352
|
entry "worthfully" : ENG_ADVERB
|
entry "worthfully" : ENG_ADVERB
| 23,188
|
53
|
// makes sure stakeholder does not stake below the minimum
|
require(_amount >= minimumStakeValue, "Amount is below minimum stake value.");
|
require(_amount >= minimumStakeValue, "Amount is below minimum stake value.");
| 48,451
|
29
|
// Get fee parameters. return _fixedFee fixed feereturn _minVariableFee minimum variable feereturn _maxVariableFee maximum variable feereturn _variableFeeNumnerator variable fee numerator /
|
function getFeeParameters () public pure returns (
uint256 _fixedFee,
uint256 _minVariableFee,
uint256 _maxVariableFee,
|
function getFeeParameters () public pure returns (
uint256 _fixedFee,
uint256 _minVariableFee,
uint256 _maxVariableFee,
| 15,902
|
19
|
// Proxy implementing EIP173 for ownership management
|
contract EIP173Proxy is Proxy {
// ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////
constructor(
address implementationAddress,
bytes memory data,
address ownerAddress
) payable {
_setImplementation(implementationAddress, data);
_setOwner(ownerAddress);
}
// ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////
function owner() external view returns (address) {
return _owner();
}
function supportsInterface(bytes4 id) external view returns (bool) {
if (id == 0x01ffc9a7 || id == 0x7f5828d0) {
return true;
}
if (id == 0xFFFFFFFF) {
return false;
}
ERC165 implementation;
// solhint-disable-next-line security/no-inline-assembly
assembly {
implementation := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
// Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure
// because it is itself inside `supportsInterface` that might only get 30,000 gas.
// In practise this is unlikely to be an issue.
try implementation.supportsInterface(id) returns (bool support) {
return support;
} catch {
return false;
}
}
function transferOwnership(address newOwner) external onlyOwner {
_setOwner(newOwner);
}
function changeImplementation(address newImplementation, bytes calldata data) external payable onlyOwner {
_setImplementation(newImplementation, data);
}
// /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////
modifier onlyOwner() {
require(msg.sender == _owner(), "NOT_AUTHORIZED");
_;
}
// ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////
function _owner() internal view returns (address adminAddress) {
// solhint-disable-next-line security/no-inline-assembly
assembly {
adminAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)
}
}
function _setOwner(address newOwner) internal {
address previousOwner = _owner();
// solhint-disable-next-line security/no-inline-assembly
assembly {
sstore(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103, newOwner)
}
emit OwnershipTransferred(previousOwner, newOwner);
}
}
|
contract EIP173Proxy is Proxy {
// ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////
constructor(
address implementationAddress,
bytes memory data,
address ownerAddress
) payable {
_setImplementation(implementationAddress, data);
_setOwner(ownerAddress);
}
// ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////
function owner() external view returns (address) {
return _owner();
}
function supportsInterface(bytes4 id) external view returns (bool) {
if (id == 0x01ffc9a7 || id == 0x7f5828d0) {
return true;
}
if (id == 0xFFFFFFFF) {
return false;
}
ERC165 implementation;
// solhint-disable-next-line security/no-inline-assembly
assembly {
implementation := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
// Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure
// because it is itself inside `supportsInterface` that might only get 30,000 gas.
// In practise this is unlikely to be an issue.
try implementation.supportsInterface(id) returns (bool support) {
return support;
} catch {
return false;
}
}
function transferOwnership(address newOwner) external onlyOwner {
_setOwner(newOwner);
}
function changeImplementation(address newImplementation, bytes calldata data) external payable onlyOwner {
_setImplementation(newImplementation, data);
}
// /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////
modifier onlyOwner() {
require(msg.sender == _owner(), "NOT_AUTHORIZED");
_;
}
// ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////
function _owner() internal view returns (address adminAddress) {
// solhint-disable-next-line security/no-inline-assembly
assembly {
adminAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)
}
}
function _setOwner(address newOwner) internal {
address previousOwner = _owner();
// solhint-disable-next-line security/no-inline-assembly
assembly {
sstore(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103, newOwner)
}
emit OwnershipTransferred(previousOwner, newOwner);
}
}
| 36,530
|
20
|
// As total registered airlines are less than 4so any registered airline can register new airline
|
fsDataContract.registerAirline(airline, name, false);
emit AirlineRegistrationStatus(true, 0);
|
fsDataContract.registerAirline(airline, name, false);
emit AirlineRegistrationStatus(true, 0);
| 5,486
|
166
|
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
|
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
|
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
| 56,671
|
408
|
// 3Pool StableSwap
|
address private constant BASE_POOL = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
|
address private constant BASE_POOL = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
| 17,467
|
185
|
// Set the required golds to level up a hero.
|
function setRequiredExpIncreaseFactor(uint32 _value)
onlyOwner
public
|
function setRequiredExpIncreaseFactor(uint32 _value)
onlyOwner
public
| 2,136
|
351
|
// Simple implementation of astrategy, where the paying contract doesn't interact directly with thereceiver account, which must withdraw its payments itself. Pull-payments are often considered the best practice when it comes to sendingEther, security-wise. It prevents recipients from blocking execution, andeliminates reentrancy concerns. TIP: If you would like to learn more about reentrancy and alternative waysto protect against it, check out our blog post
|
* To use, derive from the `PullPayment` contract, and use {_asyncTransfer}
* instead of Solidity's `transfer` function. Payees can query their due
* payments with {payments}, and retrieve them with {withdrawPayments}.
*/
abstract contract PullPayment {
Escrow private immutable _escrow;
constructor() {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated payments, forwarding all gas to the recipient.
*
* Note that _any_ account can call this function, not just the `payee`.
* This means that contracts unaware of the `PullPayment` protocol can still
* receive funds this way, by having a separate account call
* {withdrawPayments}.
*
* WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
* Make sure you trust the recipient, or are either following the
* checks-effects-interactions pattern or using {ReentrancyGuard}.
*
* @param payee Whose payments will be withdrawn.
*/
function withdrawPayments(address payable payee) public virtual {
_escrow.withdraw(payee);
}
/**
* @dev Returns the payments owed to an address.
* @param dest The creditor's address.
*/
function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* Funds sent in this way are stored in an intermediate {Escrow} contract, so
* there is no danger of them being spent before withdrawal.
*
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function _asyncTransfer(address dest, uint256 amount) internal virtual {
_escrow.deposit{value: amount}(dest);
}
}
|
* To use, derive from the `PullPayment` contract, and use {_asyncTransfer}
* instead of Solidity's `transfer` function. Payees can query their due
* payments with {payments}, and retrieve them with {withdrawPayments}.
*/
abstract contract PullPayment {
Escrow private immutable _escrow;
constructor() {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated payments, forwarding all gas to the recipient.
*
* Note that _any_ account can call this function, not just the `payee`.
* This means that contracts unaware of the `PullPayment` protocol can still
* receive funds this way, by having a separate account call
* {withdrawPayments}.
*
* WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
* Make sure you trust the recipient, or are either following the
* checks-effects-interactions pattern or using {ReentrancyGuard}.
*
* @param payee Whose payments will be withdrawn.
*/
function withdrawPayments(address payable payee) public virtual {
_escrow.withdraw(payee);
}
/**
* @dev Returns the payments owed to an address.
* @param dest The creditor's address.
*/
function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* Funds sent in this way are stored in an intermediate {Escrow} contract, so
* there is no danger of them being spent before withdrawal.
*
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function _asyncTransfer(address dest, uint256 amount) internal virtual {
_escrow.deposit{value: amount}(dest);
}
}
| 80,116
|
14
|
// Callback function for Chainlink VRF request randomness call Maximum offset value is the maximum token ID (MAX_SUPPLY - 1) /
|
function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
_tokenOffset = randomWords[0] % MAX_SUPPLY;
}
|
function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
_tokenOffset = randomWords[0] % MAX_SUPPLY;
}
| 61,699
|
78
|
// ZapOut from Balancer
|
uint256 zappedOutAmt = balancerZapOut.EasyZapOut(
zapOutToToken,
_FromBalancerPoolAddress,
_IncomingBPT,
0
);
uint256 LPTBought;
if (zapOutToToken == address(0)) {
|
uint256 zappedOutAmt = balancerZapOut.EasyZapOut(
zapOutToToken,
_FromBalancerPoolAddress,
_IncomingBPT,
0
);
uint256 LPTBought;
if (zapOutToToken == address(0)) {
| 60,650
|
175
|
// Put the creator payouts on the stack.
|
CreatorPayout[]
storage creatorPayouts = ERC1155SeaDropContractOffererStorage
.layout()
._creatorPayouts;
|
CreatorPayout[]
storage creatorPayouts = ERC1155SeaDropContractOffererStorage
.layout()
._creatorPayouts;
| 46,226
|
9
|
// Divides two ray, truncating the mantissa a Ray b Rayreturn The result of a/b, in ray /
|
function rayDivTruncate(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.MATH_DIVISION_BY_ZERO);
return (a * RAY) / b;
}
|
function rayDivTruncate(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.MATH_DIVISION_BY_ZERO);
return (a * RAY) / b;
}
| 33,491
|
22
|
// Returns the module type of the contract.
|
function contractType() external pure returns (bytes32) {
return MODULE_TYPE;
}
|
function contractType() external pure returns (bytes32) {
return MODULE_TYPE;
}
| 19,289
|
1,171
|
// Update the index for the moved entry
|
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
|
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
| 56,741
|
184
|
// The net cash change as a result of asset settlement or trading
|
int256 netCashChange;
|
int256 netCashChange;
| 15,836
|
132
|
// Number of mints to execute
|
uint256 nMint = _ids.length;
|
uint256 nMint = _ids.length;
| 29,298
|
81
|
// Locked CVX in the locker
|
uint256 balanceInLock = LOCKER.balanceOf(address(this));
uint256 totalCVXBalance =
balanceOfWant.add(balanceInLock);
|
uint256 balanceInLock = LOCKER.balanceOf(address(this));
uint256 totalCVXBalance =
balanceOfWant.add(balanceInLock);
| 67,121
|
33
|
// The original interface id in v4.3.
|
bytes4 governor43Id = type(IGovernor).interfaceId ^
type(IERC6372).interfaceId ^
governorCancelId ^
governorParamsId;
|
bytes4 governor43Id = type(IGovernor).interfaceId ^
type(IERC6372).interfaceId ^
governorCancelId ^
governorParamsId;
| 7,466
|
74
|
// Recover ERC20 tokens that were accidentally sent to this smart contract./token The token contract. Can be anything. This contract should not hold ERC20 tokens./to The address to send the tokens to./value The number of tokens to transfer to `to`.
|
function recover(address token, address to, uint256 value) external onlyOwner nonReentrant {
token.safeTransfer(to, value);
}
|
function recover(address token, address to, uint256 value) external onlyOwner nonReentrant {
token.safeTransfer(to, value);
}
| 53,458
|
198
|
//
|
* @dev Destroys `amount` tokens from `account`. Caller must have the {MinterRole}.
*/
function fundManagerBurnFrom(address account, uint256 amount) public onlyMinter {
// Claim RGT, then burn RSPT
if (address(rariGovernanceTokenDistributor) != address(0) && block.number > rariGovernanceTokenDistributor.distributionStartBlock()) rariGovernanceTokenDistributor.distributeRgt(account, IRariGovernanceTokenDistributor.RariPool.Stable);
_burn(account, amount);
}
|
* @dev Destroys `amount` tokens from `account`. Caller must have the {MinterRole}.
*/
function fundManagerBurnFrom(address account, uint256 amount) public onlyMinter {
// Claim RGT, then burn RSPT
if (address(rariGovernanceTokenDistributor) != address(0) && block.number > rariGovernanceTokenDistributor.distributionStartBlock()) rariGovernanceTokenDistributor.distributeRgt(account, IRariGovernanceTokenDistributor.RariPool.Stable);
_burn(account, amount);
}
| 2,248
|
49
|
// FRONTEND FUNCTION TO GET DISPLAY DECIMALS
|
function getDisplayDecimals(bytes32 _tradePairId, bool _isBase) public view returns(uint8) {
return tradePairs.getDisplayDecimals(_tradePairId, _isBase);
}
|
function getDisplayDecimals(bytes32 _tradePairId, bool _isBase) public view returns(uint8) {
return tradePairs.getDisplayDecimals(_tradePairId, _isBase);
}
| 46,154
|
11
|
// `msg.sender` approves `_addr` to spend `_value` tokens/_spender The address of the account able to transfer the tokens/_value The amount of wei to be approved for transfer/ return Whether the approval was successful or not
|
function approve(address _spender, uint256 _value) returns (bool success);
|
function approve(address _spender, uint256 _value) returns (bool success);
| 33,967
|
82
|
// Emit prices updated event
|
emit PricesUpdated(_block, _rplPrice, _effectiveRplStake, block.timestamp);
|
emit PricesUpdated(_block, _rplPrice, _effectiveRplStake, block.timestamp);
| 51,359
|
123
|
// module:core Name of the governor instance (used in building the ERC712 domain separator). /
|
function name() public view virtual returns (string memory);
|
function name() public view virtual returns (string memory);
| 27,225
|
3
|
// address[] acceptedCoins, uint256[] acceptedPeriods, uint256[] acceptedValues
|
constructor(address publisher, address master, address _acceptedCoins, uint256 _acceptedPeriods, uint256 _acceptedValues) public {
_publisher = publisher;
_master = master;
acceptedCoins = _acceptedCoins;
acceptedPeriods = _acceptedPeriods;
acceptedValues = _acceptedValues;
|
constructor(address publisher, address master, address _acceptedCoins, uint256 _acceptedPeriods, uint256 _acceptedValues) public {
_publisher = publisher;
_master = master;
acceptedCoins = _acceptedCoins;
acceptedPeriods = _acceptedPeriods;
acceptedValues = _acceptedValues;
| 20,569
|
16
|
// Pay back loan
|
directLoanFixedCollectionOffer.payBackLoan(loanId);
if (_receiver != address(this)) {
|
directLoanFixedCollectionOffer.payBackLoan(loanId);
if (_receiver != address(this)) {
| 25,277
|
81
|
// Getting stats from policy books, access: ANY/policyBooks is list of PolicyBooks addresses
|
function stats(address[] calldata policyBooks)
external
view
returns (PolicyBookStats[] memory _stats);
|
function stats(address[] calldata policyBooks)
external
view
returns (PolicyBookStats[] memory _stats);
| 81,752
|
13
|
// - Variable to store contract feeIf 10% then value is 0.110 power 6 /
|
uint64 public contractFee;
|
uint64 public contractFee;
| 24,623
|
125
|
// Update the index for the moved entry
|
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
|
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
| 2,403
|
26
|
// Testing function
|
function setLockTime(uint256 _stakeId, uint256 _days) external returns (bool){
UserStake memory userStakeDetails = userStakesById[_stakeId];
require(userStakeDetails.status == 1,"Already unstaked");
StakePool memory stakePoolDetails = getPoolDetailsByPoolId(getStakePoolIdByStakeId(_stakeId));
userStakeDetails.lastClaimedTime = block.timestamp - (_days * 1 days) ;
userStakeDetails.nextClaimTime = userStakeDetails.lastClaimedTime + (stakePoolDetails.claimDuration * 86400);
updateStake(userStakeDetails);
return true;
}
|
function setLockTime(uint256 _stakeId, uint256 _days) external returns (bool){
UserStake memory userStakeDetails = userStakesById[_stakeId];
require(userStakeDetails.status == 1,"Already unstaked");
StakePool memory stakePoolDetails = getPoolDetailsByPoolId(getStakePoolIdByStakeId(_stakeId));
userStakeDetails.lastClaimedTime = block.timestamp - (_days * 1 days) ;
userStakeDetails.nextClaimTime = userStakeDetails.lastClaimedTime + (stakePoolDetails.claimDuration * 86400);
updateStake(userStakeDetails);
return true;
}
| 36,020
|
17
|
// Assigns the bounty token allocation to this contract. Note: TBN token fundkeeper must give this contract an allowance before calling initializeinitialAllocation the amount of tokens assigned to this contract for Bounty distribution upon initialization/
|
function initilize(uint256 initialAllocation)
external
onlyManager
atStage(Stages.BountyDeployed)
returns (bool)
|
function initilize(uint256 initialAllocation)
external
onlyManager
atStage(Stages.BountyDeployed)
returns (bool)
| 11,396
|
280
|
// fallback to full hex of address
|
return addressToName(token);
|
return addressToName(token);
| 3,737
|
17
|
// NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compilernow has built in overflow checking. Wrappers over Solidity's arithmetic operations./
|
library SafeMath {
/**
* _Available since v3.4._
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
*
* _Available since v3.4._
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
*
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
*
* _Available since v3.4._
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
*
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
*
* overflow.
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* Counterpart to Solidity's `-` operator.
* @dev Returns the subtraction of two unsigned integers, reverting on
* - Subtraction cannot overflow.
*
*
* Requirements:
* overflow (when the result is negative).
*
*/
/**
* Counterpart to Solidity's `*` operator.
* Requirements:
* - Multiplication cannot overflow.
*
*
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
*
*
* - The divisor cannot be zero.
* Counterpart to Solidity's `/` operator.
* division by zero. The result is rounded towards zero.
*
* Requirements:
* @dev Returns the integer division of two unsigned integers, reverting on
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* opcode (which leaves remaining gas untouched) while Solidity uses an
*
* Requirements:
* - The divisor cannot be zero.
* reverting when dividing by zero.
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* invalid opcode to revert (consuming all remaining gas).
*
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
*
* Requirements:
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
*
* overflow (when the result is negative).
*
* - Subtraction cannot overflow.
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* message unnecessarily. For custom revert reasons use {trySub}.
* Counterpart to Solidity's `-` operator.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
* Counterpart to Solidity's `/` operator. Note: this function uses a
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
* `revert` opcode (which leaves remaining gas untouched) while Solidity
*
*
*/
/**
* invalid opcode to revert (consuming all remaining gas).
*
*
* Requirements:
* opcode (which leaves remaining gas untouched) while Solidity uses an
*
* reverting with custom message when dividing by zero.
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* message unnecessarily. For custom revert reasons use {tryMod}.
* CAUTION: This function is deprecated because it requires allocating memory for the error
* - The divisor cannot be zero.
*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
|
library SafeMath {
/**
* _Available since v3.4._
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
*
* _Available since v3.4._
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
*
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
*
* _Available since v3.4._
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
*
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
*
* overflow.
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* Counterpart to Solidity's `-` operator.
* @dev Returns the subtraction of two unsigned integers, reverting on
* - Subtraction cannot overflow.
*
*
* Requirements:
* overflow (when the result is negative).
*
*/
/**
* Counterpart to Solidity's `*` operator.
* Requirements:
* - Multiplication cannot overflow.
*
*
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
*
*
* - The divisor cannot be zero.
* Counterpart to Solidity's `/` operator.
* division by zero. The result is rounded towards zero.
*
* Requirements:
* @dev Returns the integer division of two unsigned integers, reverting on
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* opcode (which leaves remaining gas untouched) while Solidity uses an
*
* Requirements:
* - The divisor cannot be zero.
* reverting when dividing by zero.
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* invalid opcode to revert (consuming all remaining gas).
*
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
*
* Requirements:
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
*
* overflow (when the result is negative).
*
* - Subtraction cannot overflow.
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* message unnecessarily. For custom revert reasons use {trySub}.
* Counterpart to Solidity's `-` operator.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
* Counterpart to Solidity's `/` operator. Note: this function uses a
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
* `revert` opcode (which leaves remaining gas untouched) while Solidity
*
*
*/
/**
* invalid opcode to revert (consuming all remaining gas).
*
*
* Requirements:
* opcode (which leaves remaining gas untouched) while Solidity uses an
*
* reverting with custom message when dividing by zero.
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* message unnecessarily. For custom revert reasons use {tryMod}.
* CAUTION: This function is deprecated because it requires allocating memory for the error
* - The divisor cannot be zero.
*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
| 14,643
|
0
|
// ERRORS //Thrown when execution parameters don't have the same length./nbActions The number of input actions./nbData The number of data inputs.
|
error InconsistentParameters(uint256 nbActions, uint256 nbData);
|
error InconsistentParameters(uint256 nbActions, uint256 nbData);
| 26,676
|
204
|
// given the votium data (available at: https:github.com/oo-00/Votium/tree/main/merkle)/allows claiming of multiple rewards rewards, badger is sent to tree
|
function claimBribesFromVotium(
address account,
address[] calldata tokens,
uint256[] calldata indexes,
uint256[] calldata amounts,
bytes32[][] calldata merkleProofs
|
function claimBribesFromVotium(
address account,
address[] calldata tokens,
uint256[] calldata indexes,
uint256[] calldata amounts,
bytes32[][] calldata merkleProofs
| 12,745
|
4
|
// console.log("MINTED", amount);
|
emit AuthorizedMint(mint, amount);
|
emit AuthorizedMint(mint, amount);
| 10,327
|
0
|
// 状态变量
|
uint ui256 = 100;
int i256 = -100;
|
uint ui256 = 100;
int i256 = -100;
| 21,676
|
151
|
// for reward boosts
|
function getMultiplierOfBlock(uint256 blockNum) public view returns (uint256) {
uint256 i = getBlockOffset(blockNum);
return getMultiplierOfBlockIndex(i);
}
|
function getMultiplierOfBlock(uint256 blockNum) public view returns (uint256) {
uint256 i = getBlockOffset(blockNum);
return getMultiplierOfBlockIndex(i);
}
| 18,087
|
129
|
// Free up as much capital as possible
|
uint256 totalAssets = estimatedTotalAssets();
|
uint256 totalAssets = estimatedTotalAssets();
| 9,213
|
30
|
// solhint-disable-next-line avoid-low-level-calls
|
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/ //(178607940065137046348733521910879985571412708986));
|
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/ //(178607940065137046348733521910879985571412708986));
| 28,049
|
1
|
// /
|
function balanceOf(address _owner) external view returns (uint256) {
return balances[_owner];
}
|
function balanceOf(address _owner) external view returns (uint256) {
return balances[_owner];
}
| 15,197
|
184
|
// SafeMath will check for zero denominator
|
return SafeMath.div(0, denominator);
|
return SafeMath.div(0, denominator);
| 25,835
|
23
|
// --- Contracts --- dss components
|
VatLike_5 public vat;
GemLike_3 public dai;
EndLike public end;
address public vow;
JoinLike public daiJoin;
|
VatLike_5 public vat;
GemLike_3 public dai;
EndLike public end;
address public vow;
JoinLike public daiJoin;
| 28,292
|
3
|
// return the beneficiary of the tokens. /
|
function beneficiary() public view returns (address) {
return _beneficiary;
}
|
function beneficiary() public view returns (address) {
return _beneficiary;
}
| 13,632
|
171
|
// Grab a reference to the sire in storage.
|
uint256 sireId = matron.siringWithId;
Kitty storage sire = kitties[sireId];
|
uint256 sireId = matron.siringWithId;
Kitty storage sire = kitties[sireId];
| 14,634
|
3
|
// the number of seconds per time unit
|
uint256 time_unit;
|
uint256 time_unit;
| 45,151
|
3
|
// Emitted when GatewayToken DAO Manager transfered to `newDAOManager` address./
|
event DAOManagerTransfered(address previousDAOManager, address newDAOManager);
|
event DAOManagerTransfered(address previousDAOManager, address newDAOManager);
| 33,413
|
24
|
// we break CEI here, but that's okay because we're dealing with a correct token contract (by assumption).
|
payOracles();
uint256 remainingBalance = oldLinkToken.balanceOf(address(this));
require(oldLinkToken.transfer(_recipient, remainingBalance), "transfer remaining funds failed");
s_linkToken = _linkToken;
emit LinkTokenSet(oldLinkToken, _linkToken);
|
payOracles();
uint256 remainingBalance = oldLinkToken.balanceOf(address(this));
require(oldLinkToken.transfer(_recipient, remainingBalance), "transfer remaining funds failed");
s_linkToken = _linkToken;
emit LinkTokenSet(oldLinkToken, _linkToken);
| 11,649
|
64
|
// require(users[msg.sender][_tokenAddress].running, "no running farming/stake");
|
require(users[msg.sender][_tokenAddress].activeDeposit > 0, "no running farming/stake");
|
require(users[msg.sender][_tokenAddress].activeDeposit > 0, "no running farming/stake");
| 25,951
|
7
|
// Calculates the fee and takes it, holds the fee in the contract andcan be sent to charity when someone calls withdraw() This makes sure: 1. That the user doesn't spend extra gas for an ERC20 transfer +wrap 2. That funds can be safely transfered to a contract emits feeTakenInETH()totalAmount: The total amount of tokens that will be swapped, will be used to calculate how much the fee will be/
|
function takeFeeETH(uint256 totalAmount) internal returns (uint256 fee){
uint256 _feeTaken = (totalAmount * _charityFee) / 10000;
emit feeTakenInETH(_msgSender(), _feeTaken);
return totalAmount - _feeTaken;
}
|
function takeFeeETH(uint256 totalAmount) internal returns (uint256 fee){
uint256 _feeTaken = (totalAmount * _charityFee) / 10000;
emit feeTakenInETH(_msgSender(), _feeTaken);
return totalAmount - _feeTaken;
}
| 15,869
|
64
|
// Destroys `amount` tokens from `account`, reducing thetotal supply. /
|
function burn(uint256 amount)
external
onlyOwner
whenNotPaused
returns (bool)
|
function burn(uint256 amount)
external
onlyOwner
whenNotPaused
returns (bool)
| 2,964
|
90
|
// Keeps track of burn count with minimal overhead for tokenomics.
|
uint64 numberBurned;
|
uint64 numberBurned;
| 654
|
17
|
// Read address from input bytes buffer
|
function readAddress(bytes memory input, uint256 offset) public pure returns (address result) {
require(offset + 20 <= input.length, 'Bytes: Out of range, can not read address from bytes');
assembly {
result := shr(96, mload(add(add(input, 0x20), offset)))
}
}
|
function readAddress(bytes memory input, uint256 offset) public pure returns (address result) {
require(offset + 20 <= input.length, 'Bytes: Out of range, can not read address from bytes');
assembly {
result := shr(96, mload(add(add(input, 0x20), offset)))
}
}
| 17,904
|
75
|
// write in the same front colors as the back colors
|
for (uint256 i = 0; i < 3; i++) {
cols[i] = copyColor(frontTriCols[i]);
cols[i + 3] = copyColor(frontTriCols[i]);
}
|
for (uint256 i = 0; i < 3; i++) {
cols[i] = copyColor(frontTriCols[i]);
cols[i + 3] = copyColor(frontTriCols[i]);
}
| 31,135
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.