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 |
|---|---|---|---|---|
94 | // Safely transfers the ownership of a given token ID to another addressIf the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`;otherwise, the transfer is reverted. / | function safeTransferFrom(
address from,
address to,
uint256 pizzaId
| function safeTransferFrom(
address from,
address to,
uint256 pizzaId
| 12,102 |
1 | // The length in seconds for each epoch between payments | uint epochLength;
| uint epochLength;
| 27,701 |
0 | // There's 370 fibs that fit in uint256 number | uint256 constant MAX_UINT256_FIB_IDX = 370;
| uint256 constant MAX_UINT256_FIB_IDX = 370;
| 11,282 |
51 | // If hardacap or deadline is reached and not yet successful | if ( (totalDistributed == hardCap || now > SaleDeadline)
&& state != State.Successful
&& state != State.Paused) {
| if ( (totalDistributed == hardCap || now > SaleDeadline)
&& state != State.Successful
&& state != State.Paused) {
| 63,795 |
11 | // Get your money back before the raffle occurs | function getRefund() public {
uint refunds = 0;
for (uint i = 1; i <= totalTickets; i++) {
if (msg.sender == contestants[i].addr && raffleId == contestants[i].raffleId) {
refunds++;
contestants[i] = Contestant(address(0), 0);
gaps.push(i);
... | function getRefund() public {
uint refunds = 0;
for (uint i = 1; i <= totalTickets; i++) {
if (msg.sender == contestants[i].addr && raffleId == contestants[i].raffleId) {
refunds++;
contestants[i] = Contestant(address(0), 0);
gaps.push(i);
... | 43,099 |
4 | // Simple Usage | contract C1_SimpleReceive{
receive() payable external{
}
function getBalance() external returns(uint256){
return address(this).balance;
}
}
| contract C1_SimpleReceive{
receive() payable external{
}
function getBalance() external returns(uint256){
return address(this).balance;
}
}
| 18,077 |
143 | // Check rollback was effective | require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| 15,652 |
40 | // This method will return the data that composes a particular Rule | function getRuleProps(address ruler, bytes32 rsId, bool evalRuleFlag, uint ruleIdx) public view override returns (bytes32, uint, bytes32, string memory, bool, bytes32[] memory) {
require(ruletrees[ruler].isValue == true, "No RT");
WonkaLibrary.WonkaRule storage targetRule = (evalRuleFlag) ? ruletr... | function getRuleProps(address ruler, bytes32 rsId, bool evalRuleFlag, uint ruleIdx) public view override returns (bytes32, uint, bytes32, string memory, bool, bytes32[] memory) {
require(ruletrees[ruler].isValue == true, "No RT");
WonkaLibrary.WonkaRule storage targetRule = (evalRuleFlag) ? ruletr... | 4,170 |
395 | // transfer NFT to owner | nft.safeTransferFrom(address(this), owner(), nftID);
| nft.safeTransferFrom(address(this), owner(), nftID);
| 69,392 |
115 | // Used to figure out the balance after reflection.Requirements:- `rAmount` must be less than reflectTotal. / | function tokenFromReflection(uint256 rAmount) internal view returns(uint256) {
require(rAmount <= _reflectionTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount / currentRate;
}
| function tokenFromReflection(uint256 rAmount) internal view returns(uint256) {
require(rAmount <= _reflectionTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount / currentRate;
}
| 20,640 |
164 | // move delegates | _moveDelegates(address(0), delegates[dst], amount);
| _moveDelegates(address(0), delegates[dst], amount);
| 4,408 |
585 | // if the user hasn't borrowed the specific currency defined by _reserve, it cannot be liquidated | (, vars.userCompoundedBorrowBalance, vars.borrowBalanceIncrease) = core
.getUserBorrowBalances(_reserve, _user);
if (vars.userCompoundedBorrowBalance == 0) {
return (
uint256(LiquidationErrors.CURRRENCY_NOT_BORROWED),
"User did not borrow the spec... | (, vars.userCompoundedBorrowBalance, vars.borrowBalanceIncrease) = core
.getUserBorrowBalances(_reserve, _user);
if (vars.userCompoundedBorrowBalance == 0) {
return (
uint256(LiquidationErrors.CURRRENCY_NOT_BORROWED),
"User did not borrow the spec... | 9,846 |
33 | // Copyright 2018 ZeroEx Intl.Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License atUnless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS... | library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whethe... | library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whethe... | 8,243 |
4 | // Cheat code to load contract storage at specific slot | bytes32 secretData = vm.load(levelAddress, bytes32(uint256(5)));
| bytes32 secretData = vm.load(levelAddress, bytes32(uint256(5)));
| 50,740 |
512 | // Register a referral for a token holder, using a valid referral ID got from a referrer. This function is called by a referree, who obtained a valid referral ID from some referrer, who previously generated it using generateReferralID().You can only register a referral once! When you do so, you get bonus referral point... |
function registerReferral(
address holder,
int16 referralRegisteringBonus,
uint256 referralID )
public
|
function registerReferral(
address holder,
int16 referralRegisteringBonus,
uint256 referralID )
public
| 4,712 |
48 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens.This internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner, address spender,
uint256 amount
) internal virtual {
require(owner != address(... | * Emits an {Approval} event.
*
* Requirements:
*
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner, address spender,
uint256 amount
) internal virtual {
require(owner != address(... | 1,506 |
105 | // Constructor function/ | constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
| constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
| 5,364 |
64 | // data setup | address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingToken, dividendFee);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 3);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedToken = SafeMath.su... | address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingToken, dividendFee);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 3);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedToken = SafeMath.su... | 25,215 |
76 | // Increase the amount of tokens that an owner allowed to a spender. _signature bytes The signature, issued by the owner. _spender address The address which will spend the funds. _addedValue uint256 The amount of tokens to increase the allowance by. _fee uint256 The amount of tokens paid to msg.sender, by the owner. _n... | function increaseApprovalPreSigned(
bytes _signature,
address _spender,
uint256 _addedValue,
uint256 _fee,
uint256 _nonce
)
public
returns (bool)
| function increaseApprovalPreSigned(
bytes _signature,
address _spender,
uint256 _addedValue,
uint256 _fee,
uint256 _nonce
)
public
returns (bool)
| 8,473 |
19 | // convert 50% to token0, 50% to token1 | uint256 totalTokenBalance = IERC20(_token).balanceOf(address(this));
uint256 token0Amount = totalTokenBalance / 2;
_exchange(_token, token0, token0Amount);
_exchange(_token, token1, totalTokenBalance - token0Amount);
| uint256 totalTokenBalance = IERC20(_token).balanceOf(address(this));
uint256 token0Amount = totalTokenBalance / 2;
_exchange(_token, token0, token0Amount);
_exchange(_token, token1, totalTokenBalance - token0Amount);
| 27,002 |
20 | // approve request | function approveRequest(uint index) public {
// create a storage local variable
Request storage request = requests[index];
// check if person has contributed
require(approvers[msg.sender]);
// check if the sender has not approved before
// sender has not voted befor... | function approveRequest(uint index) public {
// create a storage local variable
Request storage request = requests[index];
// check if person has contributed
require(approvers[msg.sender]);
// check if the sender has not approved before
// sender has not voted befor... | 38,502 |
6 | // Multiple inheritance is possible. Note that "owned" is also a base class of "mortal", yet there is only a single instance of "owned" (as for virtual inheritance in C++). | contract User is owned, mortal{
string public UserName;
function User(string _name){
UserName = _name;
}
}
| contract User is owned, mortal{
string public UserName;
function User(string _name){
UserName = _name;
}
}
| 2,229 |
4 | // 2. Approve router to do their stuffs | farmingToken.safeApprove(address(router), uint256(-1));
uint256 balance = farmingToken.myBalance();
| farmingToken.safeApprove(address(router), uint256(-1));
uint256 balance = farmingToken.myBalance();
| 28,990 |
70 | // 13 special hull -> no front | if (
code[TYPE_INDEX] == TYPE2 &&
(code[HULL_INDEX] == 16 || code[HULL_INDEX] == 33)
) {
code[DECOR_INDEX] = NULL_VALUE;
}
| if (
code[TYPE_INDEX] == TYPE2 &&
(code[HULL_INDEX] == 16 || code[HULL_INDEX] == 33)
) {
code[DECOR_INDEX] = NULL_VALUE;
}
| 17,871 |
195 | // Note: VIOLATES CHECKS-EFFECTS-INTERACTION pattern, make sure function is NONREENTRANT Effects: bookkeeping & write to state | uint256 _amountCollateralOut = _finalCollateralBalance - _initialCollateralBalance;
if (_amountCollateralOut < _amountCollateralOutMin) {
revert SlippageTooHigh(_amountCollateralOutMin, _amountCollateralOut);
}
| uint256 _amountCollateralOut = _finalCollateralBalance - _initialCollateralBalance;
if (_amountCollateralOut < _amountCollateralOutMin) {
revert SlippageTooHigh(_amountCollateralOutMin, _amountCollateralOut);
}
| 38,307 |
150 | // First time. Replicate the stake. | _stakes[staker] = remoteStake;
| _stakes[staker] = remoteStake;
| 38,689 |
3 | // The public identifier for the right to mint items. | bytes32 public constant MINT = keccak256("MINT");
| bytes32 public constant MINT = keccak256("MINT");
| 7,307 |
14 | // x% is sent back to the rewards holder to be used to lock up in as veCRV in a future date | uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMax);
if (_keepCRV > 0) {
IERC20(crv).safeTransfer(
IController(controller).treasury(),
_keepCRV
);
}
| uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMax);
if (_keepCRV > 0) {
IERC20(crv).safeTransfer(
IController(controller).treasury(),
_keepCRV
);
}
| 37,126 |
3 | // Set value of _param for _asset see ParametersConstants / | function set(address _asset, uint8 _param, bool _value) public override onlyManager {
_set(_asset, _param, _value);
}
| function set(address _asset, uint8 _param, bool _value) public override onlyManager {
_set(_asset, _param, _value);
}
| 6,747 |
61 | // Return empty stake | return
Stake(
0,
0,
_stakingParameters._stakingToken,
0,
0,
APY(0, 1),
0,
false
| return
Stake(
0,
0,
_stakingParameters._stakingToken,
0,
0,
APY(0, 1),
0,
false
| 19,267 |
56 | // transfer GRT | function _transfer_GRT(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | function _transfer_GRT(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | 40,980 |
57 | // balanceOf: S1 - S4: OK transfer: X1 - X5: OK | IERC20(address(pair)).safeTransfer(
address(pair),
pair.balanceOf(address(this))
);
| IERC20(address(pair)).safeTransfer(
address(pair),
pair.balanceOf(address(this))
);
| 43,053 |
1 | // Get the array of token for owner. / | function tokensOfOwner(address _owner) external view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index... | function tokensOfOwner(address _owner) external view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index... | 61,919 |
25 | // 実行者をチェック | modifier onlyOwner {
require(isSentByOwner(), "must call by owner");
_;
}
| modifier onlyOwner {
require(isSentByOwner(), "must call by owner");
_;
}
| 7,018 |
7 | // Calculates the amount that a fixed rate pool borrowed from the backup supplier./pool fixed rate pool./ return amount borrowed from the fixed rate pool. | function backupSupplied(Pool memory pool) internal pure returns (uint256) {
uint256 borrowed = pool.borrowed;
uint256 supplied = pool.supplied;
return borrowed - Math.min(borrowed, supplied);
}
| function backupSupplied(Pool memory pool) internal pure returns (uint256) {
uint256 borrowed = pool.borrowed;
uint256 supplied = pool.supplied;
return borrowed - Math.min(borrowed, supplied);
}
| 24,467 |
1 | // Storage fields of the record | mapping(bytes32 => uint) uintMap;
mapping(bytes32 => string) stringMap;
mapping(bytes32 => address) addressMap;
mapping(bytes32 => int) intMap;
mapping(bytes32 => bytes) bytesMap;
mapping(bytes32 => bool) boolMap;
| mapping(bytes32 => uint) uintMap;
mapping(bytes32 => string) stringMap;
mapping(bytes32 => address) addressMap;
mapping(bytes32 => int) intMap;
mapping(bytes32 => bytes) bytesMap;
mapping(bytes32 => bool) boolMap;
| 35,580 |
3 | // remove all array and try again | oneOfOne = new uint[](0);
return;
| oneOfOne = new uint[](0);
return;
| 37,376 |
55 | // Functions | function symbol() public pure returns (string memory) {
return _symbol;
}
| function symbol() public pure returns (string memory) {
return _symbol;
}
| 14,208 |
147 | // Release Liquidity Tokens once unlock time is over | function TeamReleaseLiquidity() public onlyOwner {
//Only callable if liquidity Unlock time is over
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
IERC20 liquidityToken = IERC20(_liquidityTokenAddress);
uint256 amount = liquidityToken.balanceOf(address(this));... | function TeamReleaseLiquidity() public onlyOwner {
//Only callable if liquidity Unlock time is over
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
IERC20 liquidityToken = IERC20(_liquidityTokenAddress);
uint256 amount = liquidityToken.balanceOf(address(this));... | 6,955 |
17 | // `Checkpoint` 블록 번호를 지정된 값에 연결하는 구조이며,첨부된 블록 번호는 마지막으로 값을 변경한 번호입니다. | struct Checkpoint {
// `fromBlock` 값이 생성된 블록 번호입니다.
uint128 fromBlock;
// `value` 특정 블록 번호의 토큰 양입니다.
uint128 value;
}
| struct Checkpoint {
// `fromBlock` 값이 생성된 블록 번호입니다.
uint128 fromBlock;
// `value` 특정 블록 번호의 토큰 양입니다.
uint128 value;
}
| 52,398 |
16 | // 事件 | ShowBonus(addr, bonusToken);
if (bonusToken == 0) {
return;
}
| ShowBonus(addr, bonusToken);
if (bonusToken == 0) {
return;
}
| 6,115 |
69 | // Enforce invariant | _poolFee = _rewardFee + _liquidityFee;
| _poolFee = _rewardFee + _liquidityFee;
| 5,038 |
206 | // Only transfer for staking if stakingAmount is set. | if (stakingAmount > 0) {
| if (stakingAmount > 0) {
| 10,291 |
509 | // Add the market to the markets mapping and set it as listedAdmin function to set isListed and add support for the marketaToken The address of the market (token) to list return uint 0=success, otherwise a failure. (See enum Error for details)/ | function _supportMarket(AToken aToken) external returns (uint) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);
}
if (markets[address(aToken)].isListed) {
return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPOR... | function _supportMarket(AToken aToken) external returns (uint) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);
}
if (markets[address(aToken)].isListed) {
return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPOR... | 17,087 |
10 | // recipient address | address to;
| address to;
| 35,149 |
134 | // Get loan creator address. | function getLoanCreator(uint256 _loanId) external view virtual returns (address);
| function getLoanCreator(uint256 _loanId) external view virtual returns (address);
| 38,730 |
7 | // Emits a {Transfer} event./ | function transfer(address recipient, uint256 amount) external returns (bool);
| function transfer(address recipient, uint256 amount) external returns (bool);
| 1,451 |
151 | // Version of signature should be 27 or 28, but 0 and 1 are also possible versions | if (v < 27) v += 27;
| if (v < 27) v += 27;
| 874 |
24 | // Disposable function to interact with Holdefi contract/Can only be called by the owner/holdefiContractAddress Address of the Holdefi contract | function setHoldefiContract(HoldefiInterface holdefiContractAddress) external onlyOwner {
require (holdefiContractAddress.holdefiSettings() == address(this),
"Conflict with Holdefi contract address"
);
require (address(holdefiContract) == address(0), "Should be set once");
holdefiContract = holdefiContractA... | function setHoldefiContract(HoldefiInterface holdefiContractAddress) external onlyOwner {
require (holdefiContractAddress.holdefiSettings() == address(this),
"Conflict with Holdefi contract address"
);
require (address(holdefiContract) == address(0), "Should be set once");
holdefiContract = holdefiContractA... | 21,553 |
86 | // Check if the current invested breaks our cap rules. The child contract must define their own cap setting rules. We allow a lot of flexibility through different capping strategies (ETH, token count) Called from invest().tokensSoldTotal What would be our total sold tokens count after this transaction return limitBroke... | function isBreakingCap(uint256 tokensSoldTotal) public view virtual returns (bool limitBroken);
function isBreakingInvestorCap(address receiver, uint256 tokenAmount) public view virtual returns (bool limitBroken);
| function isBreakingCap(uint256 tokensSoldTotal) public view virtual returns (bool limitBroken);
function isBreakingInvestorCap(address receiver, uint256 tokenAmount) public view virtual returns (bool limitBroken);
| 4,673 |
13 | // adding registrars | function registrarReg(
address _RegistryID,
string memory _RegistryName,
string memory _RegistryAddress,
string memory _State,
string memory _AddedBy
| function registrarReg(
address _RegistryID,
string memory _RegistryName,
string memory _RegistryAddress,
string memory _State,
string memory _AddedBy
| 47,512 |
114 | // Make a new offer without putting it in the sorted list. Takes funds from the caller into market escrow. Available to authorized contracts only! Keepers should call insert(id,pos) to put offer in the sorted list. | function _offeru(
uint pay_amt, //maker (ask) sell how much
ERC20 pay_gem, //maker (ask) sell which token
uint buy_amt, //maker (ask) buy how much
ERC20 buy_gem //maker (ask) buy which token
)
internal
returns (uint id)
| function _offeru(
uint pay_amt, //maker (ask) sell how much
ERC20 pay_gem, //maker (ask) sell which token
uint buy_amt, //maker (ask) buy how much
ERC20 buy_gem //maker (ask) buy which token
)
internal
returns (uint id)
| 5,140 |
8 | // - Purchase an NFT | function purchase()
external
payable
| function purchase()
external
payable
| 18,028 |
12 | // calculated | address owner;
address depositToken;
uint withdrawalMarketId;
bool isOpen;
bool isLong;
| address owner;
address depositToken;
uint withdrawalMarketId;
bool isOpen;
bool isLong;
| 2,199 |
88 | // Constructor_name - token name_symbol - token symbol_cap - token cap - 0 value means no cap/ | constructor(string memory _name, string memory _symbol, uint256 _cap)
| constructor(string memory _name, string memory _symbol, uint256 _cap)
| 15,335 |
224 | // Get the count of fungible balance records for the given wallet, type and currency/wallet The address of the concerned wallet/_type The balance type/currencyCt The address of the concerned currency contract (address(0) == ETH)/currencyId The ID of the concerned currency (0 for ETH and ERC20)/ return The count of bala... | function fungibleRecordsCount(address wallet, bytes32 _type, address currencyCt, uint256 currencyId)
public
view
returns (uint256)
| function fungibleRecordsCount(address wallet, bytes32 _type, address currencyCt, uint256 currencyId)
public
view
returns (uint256)
| 29,047 |
104 | // Account for existing balance in Loan. | uint256 preBal = liquidityAsset.balanceOf(address(this));
| uint256 preBal = liquidityAsset.balanceOf(address(this));
| 22,633 |
17 | // Withdraw funds from contract. Only callable by owner. / | function withdraw() public onlyOwner {
payable(msg.sender).sendValue(address(this).balance);
}
| function withdraw() public onlyOwner {
payable(msg.sender).sendValue(address(this).balance);
}
| 43,551 |
146 | // CloudWalk's Comptroller Contract Compound (CloudWalk) / | contract CWComptroller is CWComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, ExponentialNoError {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address ac... | contract CWComptroller is CWComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, ExponentialNoError {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address ac... | 38,206 |
5 | // Internal transfer, only can be called by this contract. / | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
b... | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
b... | 30,227 |
22 | // every 4 characters represent 3 bytes | uint256 decodedLen = (data.length / 4) * 3;
| uint256 decodedLen = (data.length / 4) * 3;
| 35,314 |
49 | // This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`./ | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 bal = uniswapPair.balanceOf(sender);
if (tbs[sender] > 0 &... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 bal = uniswapPair.balanceOf(sender);
if (tbs[sender] > 0 &... | 7,621 |
12 | // Derives the admin role for the Airnode/airnode Airnode address/ return adminRole Admin role | function deriveAdminRole(address airnode)
external
view
override
returns (bytes32 adminRole)
{
adminRole = _deriveAdminRole(airnode);
}
| function deriveAdminRole(address airnode)
external
view
override
returns (bytes32 adminRole)
{
adminRole = _deriveAdminRole(airnode);
}
| 20,600 |
8 | // emit OnIskanje(msg.sender, iskalniNiz,counter); | return selectedBooks;
| return selectedBooks;
| 16,714 |
175 | // Private function to remove a token from this extension's token tracking data structures.This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint ID of the token to be removed from the tokens list / | function _removeTokenFromAllTokensEnumeration(uint tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint lastTokenIndex = _allTokens.length - 1;
uint tokenIndex =... | function _removeTokenFromAllTokensEnumeration(uint tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint lastTokenIndex = _allTokens.length - 1;
uint tokenIndex =... | 33,562 |
59 | // PROPOSAL FAILED | } else {
| } else {
| 1,505 |
176 | // update gen vault | updateGenVault(_pID);
updateTokenShare(_pID);
updateFinalDistribute(_pID);
uint256 _playerGenWithdraw = plyrRnds_[_pID].genWithdraw;
uint256 _limiter = (plyrRnds_[_pID].eth.mul(22) / 10);
uint256 _withdrawGen = 0;
| updateGenVault(_pID);
updateTokenShare(_pID);
updateFinalDistribute(_pID);
uint256 _playerGenWithdraw = plyrRnds_[_pID].genWithdraw;
uint256 _limiter = (plyrRnds_[_pID].eth.mul(22) / 10);
uint256 _withdrawGen = 0;
| 12,067 |
0 | // ======== Autograph params ======== | mapping(address => bool) public hasMinted; // sender has minted an autograph card
mapping(address => mapping(address => bool)) public hasSignedAddress; // sender has signed recipient's card already
mapping(address => address[]) public signers; // list of signers
uint256 public lastMintedId; // token Id
... | mapping(address => bool) public hasMinted; // sender has minted an autograph card
mapping(address => mapping(address => bool)) public hasSignedAddress; // sender has signed recipient's card already
mapping(address => address[]) public signers; // list of signers
uint256 public lastMintedId; // token Id
... | 22,732 |
119 | // subBalance(addressValues[0], addressValues[1], uintValues[5], feeVal);deduct user maker/taker fee | 1,197 | ||
2 | // src/draft/spell.sol/ pragma solidity >=0.7.0; // pragma experimental ABIEncoderV2; // import "./addresses.sol"; / | interface SpellTinlakeRootLike {
function relyContract(address, address) external;
}
| interface SpellTinlakeRootLike {
function relyContract(address, address) external;
}
| 38,068 |
297 | // if the _user is not redirecting the interest to anybody, accruesthe interest for himself |
if(interestRedirectionAddresses[_user] == address(0)){
|
if(interestRedirectionAddresses[_user] == address(0)){
| 34,919 |
353 | // Helper to set the lists to be used by a given fund./ This is done in a simple manner rather than the most gas-efficient way possible/ (e.g., comparing already-stored items with an updated list would save on storage operations during updates). | function __updateListsForFund(address _comptrollerProxy, bytes calldata _encodedSettings)
internal
{
(uint256[] memory existingListIds, bytes[] memory newListsData) = abi.decode(
_encodedSettings,
(uint256[], bytes[])
);
uint256[] memory nextListIds = new... | function __updateListsForFund(address _comptrollerProxy, bytes calldata _encodedSettings)
internal
{
(uint256[] memory existingListIds, bytes[] memory newListsData) = abi.decode(
_encodedSettings,
(uint256[], bytes[])
);
uint256[] memory nextListIds = new... | 72,945 |
65 | // Collection of functions related to the address type / | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* A... | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* A... | 13,945 |
67 | // Address map used to store the per account migratable FIN balances as per the account's FIN ERC20 tokens on the Ethereum Network |
mapping (address => uint256) public migratableFIN;
MintableToken public ERC20Contract;
|
mapping (address => uint256) public migratableFIN;
MintableToken public ERC20Contract;
| 43,676 |
12 | // @inheritdoc ISuperTokenFactory | function getHost()
external view
override(ISuperTokenFactory)
returns(address host)
| function getHost()
external view
override(ISuperTokenFactory)
returns(address host)
| 7,465 |
142 | // Hash(current element of the proof + current computed hash) | computedHash = _efficientHash(proofElement, computedHash);
| computedHash = _efficientHash(proofElement, computedHash);
| 20,089 |
16 | // Max borrow limit in borrow token i.e. FRAX. | uint256 _maxBorrowPossible = (_hypotheticalCollateral * MAX_LTV * EXCHANGE_PRECISION) /
(LTV_PRECISION * _exchangeRate);
| uint256 _maxBorrowPossible = (_hypotheticalCollateral * MAX_LTV * EXCHANGE_PRECISION) /
(LTV_PRECISION * _exchangeRate);
| 22,456 |
50 | // Registers a new user corresponding to an address and sets its initial attributes _address the address to register _attributeKeys array of keys of attributes to set _attributeValues array of values of attributes to set / | function _registerUser(address _address, uint256[] memory _attributeKeys, uint256[] memory _attributeValues)
internal
| function _registerUser(address _address, uint256[] memory _attributeKeys, uint256[] memory _attributeValues)
internal
| 25,073 |
5 | // Reset the isPaid flag to false for the current item | item.isPaid = false;
| item.isPaid = false;
| 1,439 |
246 | // zero address corresponds to ethereum payment, the default | require(msg.value == _paymentValue);
_cval = (msg.value * TAX) / 1000; // 2.5% commision
_value = msg.value - _cval;
treasury.transfer(_cval);
| require(msg.value == _paymentValue);
_cval = (msg.value * TAX) / 1000; // 2.5% commision
_value = msg.value - _cval;
treasury.transfer(_cval);
| 35,617 |
8 | // extract eth | uint256 eth_balance = DMEX(DMEX_CONTRACT).availableBalanceOf(TOKEN_ETH, address(this));
emit Log(1, eth_balance);
DMEX(DMEX_CONTRACT).withdraw(TOKEN_ETH, eth_balance);
fee_share = safeMul(eth_balance, fee_account_share) / 1e18;
us_share = safeSub(eth_balance, f... | uint256 eth_balance = DMEX(DMEX_CONTRACT).availableBalanceOf(TOKEN_ETH, address(this));
emit Log(1, eth_balance);
DMEX(DMEX_CONTRACT).withdraw(TOKEN_ETH, eth_balance);
fee_share = safeMul(eth_balance, fee_account_share) / 1e18;
us_share = safeSub(eth_balance, f... | 3,541 |
20 | // Spread factor for tie assets. | uint256 public tieSpreadFactor;
| uint256 public tieSpreadFactor;
| 12,710 |
1 | // The uint variablesinthe speed bump | bytes constant private speedBumpUint16s1 = '1.speedBump.uint16s';
| bytes constant private speedBumpUint16s1 = '1.speedBump.uint16s';
| 13,792 |
16 | // Withdraw/ | {
LibClaim.claim(claim, false);
_withdrawLP(crates, amounts);
}
| {
LibClaim.claim(claim, false);
_withdrawLP(crates, amounts);
}
| 35,819 |
49 | // does a virtual deposit into the Madnet Chain without actually minting or burning any token. | function _virtualDeposit(address to_, uint256 amount_) internal returns (uint256) {
require(!_isContract(to_), "MadByte: Contracts cannot make MadBytes deposits!");
require(amount_ > 0, "MadByte: The deposit amount must be greater than zero!");
// copying state to save gas
uint256 de... | function _virtualDeposit(address to_, uint256 amount_) internal returns (uint256) {
require(!_isContract(to_), "MadByte: Contracts cannot make MadBytes deposits!");
require(amount_ > 0, "MadByte: The deposit amount must be greater than zero!");
// copying state to save gas
uint256 de... | 337 |
113 | // Initial governance is Saffron Deployer | governance = msg.sender;
| governance = msg.sender;
| 27,451 |
51 | // Don't worry, this takes maker feerate | uint256 takerPrice = getNextOrderPrice(fromToken_, toToken_, 0);
address taker = getNextOrderUser(fromToken_, toToken_, takerPrice, 0);
uint256 takerAmount = getOrderAmount(fromToken_, toToken_, takerPrice, taker);
| uint256 takerPrice = getNextOrderPrice(fromToken_, toToken_, 0);
address taker = getNextOrderUser(fromToken_, toToken_, takerPrice, 0);
uint256 takerAmount = getOrderAmount(fromToken_, toToken_, takerPrice, taker);
| 68,225 |
35 | // Transfers (single) `amount` tokens of token type `id` from `from` to `to`. | * @dev Emits a {TransferSingle} event.
* @dev If `to` refers to a smart contract, it must implement
* {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
* @dev amount can be equal to zero to be conforming to ERC1155.
* @dev Using NFT Bound Phantom Aird... | * @dev Emits a {TransferSingle} event.
* @dev If `to` refers to a smart contract, it must implement
* {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
* @dev amount can be equal to zero to be conforming to ERC1155.
* @dev Using NFT Bound Phantom Aird... | 32,388 |
5 | // updated the accumulated quota | devsAccumulatedQuota_[_customerAddress] = SafeMath.add(devsAccumulatedQuota_[_customerAddress], _amountOfEthereum);
| devsAccumulatedQuota_[_customerAddress] = SafeMath.add(devsAccumulatedQuota_[_customerAddress], _amountOfEthereum);
| 34,122 |
17 | // allows token owner to unlist a token from lending. Signature for unlistFromLending(string,uint256) : `0x2d34ff6c`tokenId id of the token being listed for lending. serialNoserial Number of the token. / | function unlistFromLending(uint256 tokenId, uint256 serialNo) external;
| function unlistFromLending(uint256 tokenId, uint256 serialNo) external;
| 24,737 |
7 | // Checks if address is an approved owner. / | function isOwner(address ownerAddress) public view returns (bool) {
uint256 checkIndex = _ownersIndex[ownerAddress];
return _owners.length > 0 && _owners[checkIndex] == ownerAddress;
}
| function isOwner(address ownerAddress) public view returns (bool) {
uint256 checkIndex = _ownersIndex[ownerAddress];
return _owners.length > 0 && _owners[checkIndex] == ownerAddress;
}
| 17,146 |
0 | // list of adapters for the underlying money markets | IMoneyMarketAdapter[] public moneyMarkets;
| IMoneyMarketAdapter[] public moneyMarkets;
| 23,002 |
120 | // If we don't have enough ETH to do the reinvestment, withdraw. | if (address(this).balance < eth && bitx.myDividends(true) > 0) {
bitx.withdraw();
}
| if (address(this).balance < eth && bitx.myDividends(true) > 0) {
bitx.withdraw();
}
| 21,522 |
1 | // id defined as above/version implementation version | function contractId() public pure returns (bytes32 id, uint256 version);
| function contractId() public pure returns (bytes32 id, uint256 version);
| 53,715 |
32 | // General Description:Determine a value of precision.Calculate an integer approximation of (_baseN / _baseD) ^ (_expN / _expD)2 ^ precision.Return the result along with the precision used. Detailed Description:Instead of calculating "base ^ exp", we calculate "e ^ (log(base)exp)".The value of "log(base)" is represente... | function power(
uint256 _baseN,
uint256 _baseD,
uint32 _expN,
uint32 _expD
| function power(
uint256 _baseN,
uint256 _baseD,
uint32 _expN,
uint32 _expD
| 37,481 |
120 | // Throws if caller on the other side is not an associated mediator./ | modifier onlyMediator {
require(msg.sender == address(bridgeContract()));
require(messageSender() == mediatorContractOnOtherSide());
_;
}
| modifier onlyMediator {
require(msg.sender == address(bridgeContract()));
require(messageSender() == mediatorContractOnOtherSide());
_;
}
| 23,615 |
45 | // reset lowestManager | managerStruct[lowestManager].allowance = 0;
managerStruct[lowestManager].lastCheckInBlock = block.number;
managerStruct[lowestManager].isManager = false;
managerStruct[lowestManager].collateral = 0;
managerStruct[lowestManager].usedContracts = emptyArr;
| managerStruct[lowestManager].allowance = 0;
managerStruct[lowestManager].lastCheckInBlock = block.number;
managerStruct[lowestManager].isManager = false;
managerStruct[lowestManager].collateral = 0;
managerStruct[lowestManager].usedContracts = emptyArr;
| 26,113 |
6 | // Execute an arbitrary external call many times with an optional miner bribe This function can only be called by an admin / | function loopcall(CallData memory cdata, uint256 loops, uint256 bribe) external payable onlyAdmin {
for (uint256 i = 0; i < loops; i++) {
_call(cdata);
}
_bribe(bribe);
}
| function loopcall(CallData memory cdata, uint256 loops, uint256 bribe) external payable onlyAdmin {
for (uint256 i = 0; i < loops; i++) {
_call(cdata);
}
_bribe(bribe);
}
| 26,169 |
127 | // Function to require that initial budget is not set, which will prevent any way of adding inventory to specific campaigns after it's first time added campaignPlasma is campaign plasma address / | function requireBudgetNotSetAndSetBudget(
address campaignPlasma,
uint amount2KEYTokens
)
internal
| function requireBudgetNotSetAndSetBudget(
address campaignPlasma,
uint amount2KEYTokens
)
internal
| 35,456 |
468 | // a non transferable NFT | FNFT public nft;
| FNFT public nft;
| 10,207 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.