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
147
// This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: ```soliditybytes32 digest = _hashTypedDataV4(keccak256(abi.encode(keccak256("Mail(address to,string contents)"),mailTo,keccak256(bytes(mailContents)))));address signer = ECDSA.recover(digest, signature);``` /
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); }
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); }
12,266
22
// See {ERC721-_safeTransferFrom}.
function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override(ERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); }
function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override(ERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); }
38,552
584
// Now approve this AMM update
update.validUntil = 0xffffffff; bytes32 txHash = AmmUpdateTransaction.hashTx(ctx.exchangeDomainSeparator, update); ctx.transactionBuffer.approveExchangeTransaction(address(this), txHash); ctx.tokenBalancesL2[i] = update.balance;
update.validUntil = 0xffffffff; bytes32 txHash = AmmUpdateTransaction.hashTx(ctx.exchangeDomainSeparator, update); ctx.transactionBuffer.approveExchangeTransaction(address(this), txHash); ctx.tokenBalancesL2[i] = update.balance;
24,630
84
// Global accounting
uint256 newStakingShareSeconds = now .sub(_lastAccountingTimestampSec) .mul(_totalStakingShares); _totalStakingShareSeconds = _totalStakingShareSeconds.add(newStakingShareSeconds); _lastAccountingTimestampSec = now;
uint256 newStakingShareSeconds = now .sub(_lastAccountingTimestampSec) .mul(_totalStakingShares); _totalStakingShareSeconds = _totalStakingShareSeconds.add(newStakingShareSeconds); _lastAccountingTimestampSec = now;
5,179
0
// cotract to use when issuing a CC (Local Currency)/_name string name for CC token that is created./_symbol string symbol for CC token that is created./_decimals uint8 percison for CC token that is created./_totalSupply uint256 total supply of the CC token that is created./_tokenURI string the URI may point to a JSON ...
function ColuLocalCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public { require(_totalSupply != 0); require(bytes(_name).length != 0); require(bytes(_symbol).length != 0); totalSupply = _totalSupply; name = _name; sy...
function ColuLocalCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public { require(_totalSupply != 0); require(bytes(_name).length != 0); require(bytes(_symbol).length != 0); totalSupply = _totalSupply; name = _name; sy...
25,718
38
// Withdraw any token, including ether from this wallet to an EOA. _token The address of the token to withdraw. _amount The amount to withdraw.return Success of the withdrawal. /
function withdraw(address _token, uint256 _amount) external returns(bool)
function withdraw(address _token, uint256 _amount) external returns(bool)
22,655
1
// Calculate the strike amount equivalent to pay for the underlying requested
uint256 amountStrikeToTransfer = _strikeToTransfer(amount); require(amountStrikeToTransfer > 0, "Amount too low");
uint256 amountStrikeToTransfer = _strikeToTransfer(amount); require(amountStrikeToTransfer > 0, "Amount too low");
2,065
22
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address.- `from` mu...
function transferFrom(address sender, address recipient, uint256 tAmount) public override returns (bool) { __transfer(sender, recipient, tAmount); __approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( tAmount, "ERC...
function transferFrom(address sender, address recipient, uint256 tAmount) public override returns (bool) { __transfer(sender, recipient, tAmount); __approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( tAmount, "ERC...
30,799
2
// Emitted when the hash of the asset generator is set.
event AssetGeneratorHashSet(bytes32 indexed assetGeneratorHash);
event AssetGeneratorHashSet(bytes32 indexed assetGeneratorHash);
14,915
10
// For safety
i+=1; length++;
i+=1; length++;
35,557
176
// Invoke call from manager_module Module to interact with _encodedEncoded byte data /
function invokeManager(address _module, bytes memory _encoded) internal { manager.interactManager(_module, _encoded); }
function invokeManager(address _module, bytes memory _encoded) internal { manager.interactManager(_module, _encoded); }
29,396
29
// We write the string from rightmost digit to leftmost digit. The following is essentially a do-while loop that also handles the zero case.
for {} 1 {} {
for {} 1 {} {
13,055
13
// -------------------------------------------------------------------------- FACTORY --------------------------------------------------------------------------
function setFactoryToal(uint256 _value) public onlyContractsMiniGame
function setFactoryToal(uint256 _value) public onlyContractsMiniGame
39,454
11
// This contructor takes the msg.sender (deployer wallet) as the first master admin/
constructor() internal { level[msg.sender] = 2; //Set initial admin to contract creator emit AdminshipUpdated(msg.sender,2); }
constructor() internal { level[msg.sender] = 2; //Set initial admin to contract creator emit AdminshipUpdated(msg.sender,2); }
27,901
35
// отправить прибыль на контракт собствеников системы
(bool success, ) = theStocksTokenContract.call.value(finaPlatformFee).gas(53000)("");
(bool success, ) = theStocksTokenContract.call.value(finaPlatformFee).gas(53000)("");
12,243
9
// Must match BConst.MIN_BOUND_TOKENS and BConst.MAX_BOUND_TOKENS
uint public constant MIN_ASSET_LIMIT = 2; uint public constant MAX_ASSET_LIMIT = 8; uint public constant MAX_UINT = uint(-1);
uint public constant MIN_ASSET_LIMIT = 2; uint public constant MAX_ASSET_LIMIT = 8; uint public constant MAX_UINT = uint(-1);
47,035
49
// Underlying asset for this CToken /
address public underlying;
address public underlying;
13,070
173
// Claims all accumulated redemption fees in 3CRV /
function claimRedemptionFee() external { threeCrv.safeTransfer(feeRecipient, redemptionFees); redemptionFees = 0; }
function claimRedemptionFee() external { threeCrv.safeTransfer(feeRecipient, redemptionFees); redemptionFees = 0; }
33,166
8
// object storing data about project for investors in community
bool exists; uint256 apr; //interest rate for the project (in per thousand) uint256 repaymentStartDate; //unix timestamp when repayment starts uint256 repaymentEndDate; //unix timestamp when repayment is late uint256 investmentNeeded; //total investment requirement in community c...
bool exists; uint256 apr; //interest rate for the project (in per thousand) uint256 repaymentStartDate; //unix timestamp when repayment starts uint256 repaymentEndDate; //unix timestamp when repayment is late uint256 investmentNeeded; //total investment requirement in community c...
6,360
102
// prevents non-authorized addresses from calling this method /
modifier validateAuthorizedSender()
modifier validateAuthorizedSender()
84,014
224
// Save Bid for this order
bidByOrderId[_nftAddress][_orderId] = Bid({ id: bidId, bidder: msg.sender, price: _priceInWei, expiresAt: _expiresAt });
bidByOrderId[_nftAddress][_orderId] = Bid({ id: bidId, bidder: msg.sender, price: _priceInWei, expiresAt: _expiresAt });
21,872
445
// Returns the average of two numbers. The result is rounded towardszero. /
function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); }
function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); }
2,632
126
// Event emitted when the reserves are reduced /
event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves);
event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves);
12,731
1
// function send(address recipient, uint256 amount, bytes memory data) public { super.send(recipient,amount,data); _addSlot(_msgSender()); }
function getWinnerIndex() public view returns (uint256) { uint256 winnerIndex = 0;
function getWinnerIndex() public view returns (uint256) { uint256 winnerIndex = 0;
17,186
29
// Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to. /
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; }
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; }
6,720
65
// Fallback function for funding smart contract. /
function() external payable
function() external payable
54,467
20
// Get count of pending server key retrieval requests.
function serverKeyRetrievalRequestsCount() view external returns (uint256) { return serverKeyRetrievalRequestsKeys.length; }
function serverKeyRetrievalRequestsCount() view external returns (uint256) { return serverKeyRetrievalRequestsKeys.length; }
42,977
21
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
return computedHash == root;
11,541
137
// if (MSFun.multiSig(msData, required signatures, "functionName") == true)
* { * MSFun.deleteProposal(msData, "functionName"); * * // put function body here * }
* { * MSFun.deleteProposal(msData, "functionName"); * * // put function body here * }
59,110
197
// --- Offboarding: Current Liquidation Ratio ---
uint256 constant CURRENT_AAVE_MAT = 165 * RAY / 100; uint256 constant CURRENT_BAL_MAT = 165 * RAY / 100; uint256 constant CURRENT_COMP_MAT = 165 * RAY / 100;
uint256 constant CURRENT_AAVE_MAT = 165 * RAY / 100; uint256 constant CURRENT_BAL_MAT = 165 * RAY / 100; uint256 constant CURRENT_COMP_MAT = 165 * RAY / 100;
21,502
21
// Base exchange rate is set
uint256 public ratePerOneEther = 135; uint256 public totalUBetCheckAmounts = 0;
uint256 public ratePerOneEther = 135; uint256 public totalUBetCheckAmounts = 0;
6,383
170
// if (weiValue == 0) throw;
investedAmountOf[msg.sender] = 0; weiRefunded = safeAdd(weiRefunded,weiValue); Refund(msg.sender, weiValue); require(msg.sender.send(weiValue));
investedAmountOf[msg.sender] = 0; weiRefunded = safeAdd(weiRefunded,weiValue); Refund(msg.sender, weiValue); require(msg.sender.send(weiValue));
16,849
160
// return total USDC value of all collateral
return totalCollateral.div(1e18);
return totalCollateral.div(1e18);
56,115
730
// Updates the state variables when a position is increased. - Decreases the available amount in the lowest buckets with available token- Increases the principal amount in those buckets principalAddedAmount of principal added to the positionlentAmountAmount of owedToken lent /
function accountForIncrease( uint256 principalAdded, uint256 lentAmount ) private
function accountForIncrease( uint256 principalAdded, uint256 lentAmount ) private
39,135
67
// Decodes an order and returns the offer and substandard version.minimumReceived The minimum items that the caller must receive. context Context of the order according to SIP-12. /
function _decodeOrder( SpentItem[] calldata minimumReceived, bytes calldata context
function _decodeOrder( SpentItem[] calldata minimumReceived, bytes calldata context
15,011
925
// The full set of order components, with the exception of the counter, must be supplied when fulfilling more sophisticated orders or groups of orders. The total number of original consideration items must also be supplied, as the caller may specify additional consideration items. /
struct OrderParameters { address offerer; // 0x00 address zone; // 0x20 OfferItem[] offer; // 0x40 ConsiderationItem[] consideration; // 0x60 OrderType orderType; // 0x80 uint256 startTime; // 0xa0 uint256 endTime; // 0xc0 bytes32 zoneHash; // 0xe0 uint256 salt; // 0x100 bytes32 conduitKey; // 0x120...
struct OrderParameters { address offerer; // 0x00 address zone; // 0x20 OfferItem[] offer; // 0x40 ConsiderationItem[] consideration; // 0x60 OrderType orderType; // 0x80 uint256 startTime; // 0xa0 uint256 endTime; // 0xc0 bytes32 zoneHash; // 0xe0 uint256 salt; // 0x100 bytes32 conduitKey; // 0x120...
23,826
148
// Get the trait type /
function getTraitType(uint16 index) private pure returns (string memory)
function getTraitType(uint16 index) private pure returns (string memory)
63,090
21
// retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
length := extcodesize(_addr)
50,716
209
// lv3
(_affIDNext, _comTmp) = updateAff(_pID, _affs, _affIDNext, affLv3_); if (_comTmp > 0){ _com = (_com.add(_comTmp)); }
(_affIDNext, _comTmp) = updateAff(_pID, _affs, _affIDNext, affLv3_); if (_comTmp > 0){ _com = (_com.add(_comTmp)); }
22,292
27
// OwnerManager - 管理一组所有者和执行操作的阈值。/Stefan George - <stefan@gnosis.pm>
contract OwnerManager is SelfAuthorized { event AddedOwner(address owner); event RemovedOwner(address owner); event ChangedThreshold(uint256 threshold); address internal constant SENTINEL_OWNERS = address(0x1); mapping(address => address) internal owners; uint256 internal ownerCount; uint2...
contract OwnerManager is SelfAuthorized { event AddedOwner(address owner); event RemovedOwner(address owner); event ChangedThreshold(uint256 threshold); address internal constant SENTINEL_OWNERS = address(0x1); mapping(address => address) internal owners; uint256 internal ownerCount; uint2...
20,627
114
// Records which users have contributed throughout the sale
mapping(address => bool) public hasContributed; DisbursementHandler public disbursementHandler; uint256 public weiContributed = 0; uint256 public totalSaleCap; uint256 public minContribution; uint256 public minThreshold;
mapping(address => bool) public hasContributed; DisbursementHandler public disbursementHandler; uint256 public weiContributed = 0; uint256 public totalSaleCap; uint256 public minContribution; uint256 public minThreshold;
20,035
25
// Internal function that burns an amount of the token of a givenaccount. account The account whose tokens will be burnt. value The amount that will be burnt. /
function _burn(address account, uint256 value) internal { require(account != 0); require(value <= _balances[account]); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
function _burn(address account, uint256 value) internal { require(account != 0); require(value <= _balances[account]); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
29,324
23
// get the last index of participant from the current auction Participant[] storage participants = auctionParticipants[_id];
uint256 lastBidAmount = auction.participant[auction.participant.length - 1].bidRecords;
uint256 lastBidAmount = auction.participant[auction.participant.length - 1].bidRecords;
15,151
101
// Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit ofexchange. The royalty amount is denominated and should be paid in that same unit of exchange. /
function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount);
function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount);
8,932
26
// Initializer // Initializer Fee-on-transfer currency tokens are not supported /
function initialize( uint64 auctionDuration_, uint64 timeExtensionWindow_, uint64 timeExtension_, uint64 minimumBidBasisPoints_
function initialize( uint64 auctionDuration_, uint64 timeExtensionWindow_, uint64 timeExtension_, uint64 minimumBidBasisPoints_
13,451
50
// contracts/interfaces/IDebtLockerFactory.sol/ pragma solidity 0.6.11; /
interface IDebtLockerFactory { function owner(address) external view returns (address); function isLocker(address) external view returns (bool); function factoryType() external view returns (uint8); function newLocker(address) external returns (address); }
interface IDebtLockerFactory { function owner(address) external view returns (address); function isLocker(address) external view returns (bool); function factoryType() external view returns (uint8); function newLocker(address) external returns (address); }
20,820
2
// Owners voting mask per operations
mapping(bytes32 => uint256) public votesMaskByOperation; mapping(bytes32 => uint256) public votesCountByOperation;
mapping(bytes32 => uint256) public votesMaskByOperation; mapping(bytes32 => uint256) public votesCountByOperation;
39,415
1,389
// Both minInvestmentAmount and maxInvestmentAmount can be 0 in order to close the fund temporarily
if (minInvestmentAmount == 0) { return _investmentAmount <= maxInvestmentAmount; } else if (maxInvestmentAmount == 0) {
if (minInvestmentAmount == 0) { return _investmentAmount <= maxInvestmentAmount; } else if (maxInvestmentAmount == 0) {
44,646
37
// Safe IERC20 and ETH transfer library that safely handles missing return values./Modified from Uniswap (https:github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/libraries/TransferHelper.sol)/ Taken from Solmate
library SafeERC20 { function safeTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, amount) ); ...
library SafeERC20 { function safeTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, amount) ); ...
46,650
63
// Helper function that checks for ERC777TokensRecipient on the recipient and calls it./May throw according to `_preventLocking`/_operator The address performing the send or mint/_from The address holding the tokens being sent/_to The address of the recipient/_amount The number of tokens to be sent/_userData Data gener...
function callRecipient( address _operator, address _from, address _to, uint256 _amount, bytes _userData, bytes _operatorData, bool _preventLocking ) internal
function callRecipient( address _operator, address _from, address _to, uint256 _amount, bytes _userData, bytes _operatorData, bool _preventLocking ) internal
2,427
93
// Store the updated total supply.
sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter)
sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter)
1,201
721
// Calculate the denominator for the composition polynomial columns: x - z^2.
let denominator := add(shiftedEvalPoint, minusPointPow) mstore(add(productsPtr, 0xf20), partialProduct) mstore(add(valuesPtr, 0xf20), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
let denominator := add(shiftedEvalPoint, minusPointPow) mstore(add(productsPtr, 0xf20), partialProduct) mstore(add(valuesPtr, 0xf20), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
77,869
329
// Get exact amounts for base ticks
(cache.amount0, cache.amount1) = pool.amountsForLiquidity(cache.liquidity, cache.tickLower, cache.tickUpper);
(cache.amount0, cache.amount1) = pool.amountsForLiquidity(cache.liquidity, cache.tickLower, cache.tickUpper);
37,902
186
// Emits a {Withdraw} event.//yieldToken The address of the yield token to withdraw./ownerThe address of the account owner to withdraw from./shares The number of shares to burn./recipientThe recipient of the withdrawn shares. This parameter is only used for logging.// return The amount of yield tokens that the burned s...
function _withdraw( address yieldToken, address owner, uint256 shares, address recipient ) internal returns (uint256) {
function _withdraw( address yieldToken, address owner, uint256 shares, address recipient ) internal returns (uint256) {
44,811
192
// no-op if the passed next value isn't greater than the current next value
if (next <= current) return current;
if (next <= current) return current;
2,492
310
// Check if the farmer's health is greater than zero
if (farmerHealth[tokenId] > 0) { uint256 damage = (uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % (maxDamage - 10)) + 10; if (farmerHealth[tokenId] > damage) { farmerHealth[tokenId] -= damage; } else {
if (farmerHealth[tokenId] > 0) { uint256 damage = (uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % (maxDamage - 10)) + 10; if (farmerHealth[tokenId] > damage) { farmerHealth[tokenId] -= damage; } else {
19,817
21
// BT_SPAE: staking pool already exists
require(!stakingPools.contains(_stakingPool), "BT_SPAE"); stakingPools.add(_stakingPool); emit StakingPoolAdded(_stakingPool);
require(!stakingPools.contains(_stakingPool), "BT_SPAE"); stakingPools.add(_stakingPool); emit StakingPoolAdded(_stakingPool);
20,960
10
// Standard ERC223 function that will handle incoming token transfers._fromToken sender address. _value Amount of tokens. _dataTransaction metadata. /
function tokenFallback(address _from, uint _value, bytes _data) public pure { TKN memory tkn; tkn.sender = _from; tkn.value = _value; tkn.data = _data; if(_data.length > 0) { uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24); tk...
function tokenFallback(address _from, uint _value, bytes _data) public pure { TKN memory tkn; tkn.sender = _from; tkn.value = _value; tkn.data = _data; if(_data.length > 0) { uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24); tk...
24,647
23
// Set new token address/_newTokenAddress - Address of new erc20 token.
function setTokenAddress(address _newTokenAddress) external onlyMarketManger
function setTokenAddress(address _newTokenAddress) external onlyMarketManger
21,408
81
// Extended TPL Jurisdiction Interface. this extends BasicJurisdictionInterface for additional functionality. /
interface ExtendedJurisdictionInterface { // declare events (NOTE: consider which fields should be indexed) event ValidatorSigningKeyModified( address indexed validator, address newSigningKey ); event StakeAllocated( address indexed staker, uint256 indexed attribute, uint256 amount ); ...
interface ExtendedJurisdictionInterface { // declare events (NOTE: consider which fields should be indexed) event ValidatorSigningKeyModified( address indexed validator, address newSigningKey ); event StakeAllocated( address indexed staker, uint256 indexed attribute, uint256 amount ); ...
42,353
206
// Swaps tokens using Uniswap V3 from Token to swap from to Token to swap to amount Amount of tokens to swap slippage Allowed slippage path Steps to complete the swapreturn result Amount of underlying (`to`) tokens recieved /
function _swapV3( IERC20 from, IERC20 to, uint256 amount, uint256 slippage, bytes memory path
function _swapV3( IERC20 from, IERC20 to, uint256 amount, uint256 slippage, bytes memory path
65,151
35
// attempted to update or end staking for an nft without an active season
error NoActiveStakingSeason(address nft);
error NoActiveStakingSeason(address nft);
6,082
45
// If the amount being transfered is more than the balance of theaccount the transfer reverts
var previousBalanceFrom = balanceOf(from); require(previousBalanceFrom >= amount);
var previousBalanceFrom = balanceOf(from); require(previousBalanceFrom >= amount);
14,410
10
// Because the default division is rounded,And we need the exact hour
uint256 h = current / 1 hours; if (h * 1 hours > current) { h = h - 1; }
uint256 h = current / 1 hours; if (h * 1 hours > current) { h = h - 1; }
50,922
12
// Gets the amount of Entities in the collection/
function getEntityCount ( ) external view returns( uint256 entityCount )
function getEntityCount ( ) external view returns( uint256 entityCount )
47,198
12
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; }
1,910
2
// string private constant _NAME = ' PausableAccessControl: ';
bytes32 public constant PAUSER_ROLE = keccak256("ACCESS_CONTROL.PAUSER_ROLE"); constructor( )internal AccessControl() Pausable()
bytes32 public constant PAUSER_ROLE = keccak256("ACCESS_CONTROL.PAUSER_ROLE"); constructor( )internal AccessControl() Pausable()
26,810
4
// Employee must have started payee The destination address of the funds. /
function withdrawalAllowed(address payee) public view returns (bool);
function withdrawalAllowed(address payee) public view returns (bool);
24,624
14
// Add token values as coins to the machine
coins[msg.sender] = coins[msg.sender].add(_tokenAmount);
coins[msg.sender] = coins[msg.sender].add(_tokenAmount);
13,658
28
// halt the crowdsale should any suspicious behavior of a third-party be identified tokens will be locked for trading until they are listed on exchanges
bool public haltICO = false; bool public setTrading = false;
bool public haltICO = false; bool public setTrading = false;
48,556
61
// Performs the power on a specified value, reverts on overflow./
function safePower( uint256 a, uint256 pow ) internal pure returns (uint256)
function safePower( uint256 a, uint256 pow ) internal pure returns (uint256)
23,139
236
// The buyer pays fees.
_payFees(sellOrder, msg.sender, buyAmount, orderInfo.orderAmount, false);
_payFees(sellOrder, msg.sender, buyAmount, orderInfo.orderAmount, false);
2,585
89
// if (ownerPetitionSignerArrayCreated[msg.sender][_petitionId] == 0) {
uint id = petitionsigners.push(PetitionSigner(_petitionId, msg.sender, now)) - 1; emit NewPetitionSigner(id, _petitionId, msg.sender, now); petitionSignerMap[msg.sender][_petitionId] = id; ownerPetitionSignerArrayCreated[msg.sender][_petitionId] = 1; petitio...
uint id = petitionsigners.push(PetitionSigner(_petitionId, msg.sender, now)) - 1; emit NewPetitionSigner(id, _petitionId, msg.sender, now); petitionSignerMap[msg.sender][_petitionId] = id; ownerPetitionSignerArrayCreated[msg.sender][_petitionId] = 1; petitio...
43,223
2
// Event that will be emitted whenever the project starter has received the funds
event CreatorPaid(address recipient);
event CreatorPaid(address recipient);
50,015
33
// Node detail getters
function getNodeAddress() override external view returns (address) { return nodeAddress; }
function getNodeAddress() override external view returns (address) { return nodeAddress; }
57,350
113
// Get the Governance address
function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; }
function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; }
17,924
21
// Gets the ETHUSD pair from the Medianizer contractreturn The pair as an uint256 /
function getEthUsdPair() internal view returns (uint256) { bytes32 pair = _medianizer.read(); return uint256(pair); }
function getEthUsdPair() internal view returns (uint256) { bytes32 pair = _medianizer.read(); return uint256(pair); }
20,538
18
// Get current price and tick from the pool
( uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool.slot0();
( uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool.slot0();
21,312
46
// method to get if a voting portal is approved by the governance votingPortal address of the voting portal to check if approvedreturn flag indicating the approval status of the voting portal /
function isVotingPortalApproved(
function isVotingPortalApproved(
9,311
104
// 1. main contract will transfer TUBE to this contract 2. update the total reward amount for current session/
uint conclude_session = session_id; uint reward_amount = ITubeChief(tube_chief).transferJackpotReward(); session[conclude_session].total_reward = session[conclude_session].total_reward.add(reward_amount); session[conclude_session].can_claim = true; session_id = session_id....
uint conclude_session = session_id; uint reward_amount = ITubeChief(tube_chief).transferJackpotReward(); session[conclude_session].total_reward = session[conclude_session].total_reward.add(reward_amount); session[conclude_session].can_claim = true; session_id = session_id....
45,364
52
// Sets approved amount of tokens for spender. Returns success/spender Address of allowed account/value Number of approved tokens/ return Was approval successful?
function approve(address spender, uint value) public returns (bool)
function approve(address spender, uint value) public returns (bool)
42,603
484
// Rewards stakers on purchase of cover on smart contract. _contractAddress smart contract address. _coverPriceNXM cover price in NXM. /
function pushStakerRewards(address _contractAddress, uint _coverPriceNXM) external onlyInternal { uint rewardValue = _coverPriceNXM.mul(td.stakerCommissionPer()).div(100); pooledStaking.accumulateReward(_contractAddress, rewardValue); }
function pushStakerRewards(address _contractAddress, uint _coverPriceNXM) external onlyInternal { uint rewardValue = _coverPriceNXM.mul(td.stakerCommissionPer()).div(100); pooledStaking.accumulateReward(_contractAddress, rewardValue); }
2,037
67
// Restore the free memory pointer.
mstore(FreeMemoryPointerSlot, freeMemoryPointer)
mstore(FreeMemoryPointerSlot, freeMemoryPointer)
32,830
6
// The publisher is the inital owner /
function Ownership() public { owner = msg.sender; }
function Ownership() public { owner = msg.sender; }
32,859
168
// Adds stake to a relay and sets its `unstakeDelay`. If the relay does not exist, it is created, and the callerof this function becomes its owner. If the relay already exists, only the owner can call this function. A relaycannot be its own owner. All Ether in this function call will be added to the relay's stake.Its u...
* Emits a {Staked} event. */ function stake(address relayaddr, uint256 unstakeDelay) external payable; /** * @dev Emitted when a relay's stake or unstakeDelay are increased */ event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); /** * @dev Registers the ca...
* Emits a {Staked} event. */ function stake(address relayaddr, uint256 unstakeDelay) external payable; /** * @dev Emitted when a relay's stake or unstakeDelay are increased */ event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); /** * @dev Registers the ca...
21,275
26
// Performs a generic transaction. _target The address for the transaction. _data The data of the transaction.Mostly copied from Argent: /
function _invoke(address _target, bytes memory _data) internal returns (bytes memory) { // External contracts can be compiled with different Solidity versions // which can cause "revert without reason" when called through, // for example, a standard IERC20 ABI compiled on the latest version. // This l...
function _invoke(address _target, bytes memory _data) internal returns (bytes memory) { // External contracts can be compiled with different Solidity versions // which can cause "revert without reason" when called through, // for example, a standard IERC20 ABI compiled on the latest version. // This l...
34
110
// affiliate
if(isAffiliate){ address child=msg.sender; for(uint256 i=0; i<affiliateLevel; i++){ uint256 giftToken=affiliateRate[i].mul(tokens).div(100); address parent = referral[child]; if(parent != address(0x00)){//has affiliate referralBalance[child]=referralBalance[child].add(giftToken); }
if(isAffiliate){ address child=msg.sender; for(uint256 i=0; i<affiliateLevel; i++){ uint256 giftToken=affiliateRate[i].mul(tokens).div(100); address parent = referral[child]; if(parent != address(0x00)){//has affiliate referralBalance[child]=referralBalance[child].add(giftToken); }
3,594
83
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. /
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue,
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue,
23,612
9
// Withdraw accumulated balance, called by payee./
function withdrawPayments() public { address payee = msg.sender; uint256 payment = payments[payee]; require(payment != 0); require(address(this).balance >= payment); totalPayments = totalPayments.sub(payment); payments[payee] = 0; payee.transfer(payment); }
function withdrawPayments() public { address payee = msg.sender; uint256 payment = payments[payee]; require(payment != 0); require(address(this).balance >= payment); totalPayments = totalPayments.sub(payment); payments[payee] = 0; payee.transfer(payment); }
17,712
61
// Mints `tokenId` and transfers it to `to`.
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { ...
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { ...
299
10
// computes e ^ (x / FIXED_1)FIXED_1input range: 0 <= x <= OPT_EXP_MAX_VAL - 1auto-generated via 'PrintFunctionOptimalExp.py'Detailed description:- Rewrite the input as a sum of binary exponents and a single residual r, as small as possible- The exponentiation of each binary exponent is given (pre-calculated)- The expo...
function optimalExp(uint256 x) public pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3) z = (z * y) / FIXED_1; res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!) ...
function optimalExp(uint256 x) public pure returns (uint256) { uint256 res = 0; uint256 y; uint256 z; z = y = x % 0x10000000000000000000000000000000; // get the input modulo 2^(-3) z = (z * y) / FIXED_1; res += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!) ...
10,821
95
// return True if the vaults supported by this gate use transferrable ERC20 tokens/ to represent shares, false otherwise.
function vaultSharesIsERC20() public pure virtual returns (bool);
function vaultSharesIsERC20() public pure virtual returns (bool);
4,024
9
// Info of each user that votes.
mapping(address => mapping(address => UserInfo)) public userInfo;
mapping(address => mapping(address => UserInfo)) public userInfo;
27,363
7
// / the _merkleRoot allowing authentication of all users from snapshot and community vetting
bytes32 public _merkleRoot;
bytes32 public _merkleRoot;
41,243
92
// First in liquidation preference is the cash balance. Take as much cash as allowed.
if (balanceState.storedCashBalance > 0) { if (balanceState.storedCashBalance >= collateralAssetRemaining) { balanceState.netCashChange = collateralAssetRemaining.neg(); collateralAssetRemaining = 0; } else {
if (balanceState.storedCashBalance > 0) { if (balanceState.storedCashBalance >= collateralAssetRemaining) { balanceState.netCashChange = collateralAssetRemaining.neg(); collateralAssetRemaining = 0; } else {
10,697
329
// Bird's BErc20Delegate Contract BTokens which wrap an EIP-20 underlying and are delegated to /
contract BErc20USDCDelegate is BErc20, BDelegateInterface { /** * @notice Construct an empty delegate */ constructor() public {} /** * @notice Called by the delegator on a delegate to initialize it for duty * @param data The encoded bytes data for any initialization */ function...
contract BErc20USDCDelegate is BErc20, BDelegateInterface { /** * @notice Construct an empty delegate */ constructor() public {} /** * @notice Called by the delegator on a delegate to initialize it for duty * @param data The encoded bytes data for any initialization */ function...
31,569
244
// SquadOwnable Jack Kasbeer (gh:@jcksber, tw:@satoshigoat, ig:overprivilegd)
contract SquadOwnable is Ownable { //@dev Ownership - list of squad members (owners) mapping (address => bool) internal _squad; constructor() { //add myself and then client _squad[0xB9699469c0b4dD7B1Dda11dA7678Fa4eFD51211b] = true; _squad[0x6b8C6E15818C74895c31A1C91390b3d42B336799] = true;//logik } //@dev...
contract SquadOwnable is Ownable { //@dev Ownership - list of squad members (owners) mapping (address => bool) internal _squad; constructor() { //add myself and then client _squad[0xB9699469c0b4dD7B1Dda11dA7678Fa4eFD51211b] = true; _squad[0x6b8C6E15818C74895c31A1C91390b3d42B336799] = true;//logik } //@dev...
44,920
17
// calculate pair
DELTA_WETH_PAIR_UNISWAP = address(uint(keccak256(abi.encodePacked( hex'ff', 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f, // Mainned uniswap factory keccak256(abi.encodePacked(_deltaToken, WETH)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee3...
DELTA_WETH_PAIR_UNISWAP = address(uint(keccak256(abi.encodePacked( hex'ff', 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f, // Mainned uniswap factory keccak256(abi.encodePacked(_deltaToken, WETH)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee3...
64,539
1
// Returns the maximum amount of tokens the broker can sell for the owner/owner The owner for which the broker can spend funds/broker The broker of the owner/token The token to spend/ return The allowance
function getAllowance( address owner, address broker, address token ) public view returns (uint allowance);
function getAllowance( address owner, address broker, address token ) public view returns (uint allowance);
235
2
// Retrieves the pool context object. /
returns (PoolSpecs.PoolCursor memory cursor) { uint256 POOL_SLOT = 65545; bytes32 poolHash = PoolSpecs.encodeKey(base, quote, poolIdx); bytes32 slot = keccak256(abi.encodePacked(poolHash, POOL_SLOT)); uint256 val = CrocSwapDex(dex_).readSlot(uint256(slot)); cursor.hash_...
returns (PoolSpecs.PoolCursor memory cursor) { uint256 POOL_SLOT = 65545; bytes32 poolHash = PoolSpecs.encodeKey(base, quote, poolIdx); bytes32 slot = keccak256(abi.encodePacked(poolHash, POOL_SLOT)); uint256 val = CrocSwapDex(dex_).readSlot(uint256(slot)); cursor.hash_...
9,612