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 |
|---|---|---|---|---|
435 | // Check if there are enough tokens in the pool. | if(compoundAmount > 0) {
globalConfig.savingAccount().fromCompound(_token, compoundAmount);
}
| if(compoundAmount > 0) {
globalConfig.savingAccount().fromCompound(_token, compoundAmount);
}
| 28,392 |
67 | // Checks if rounding error > 0.1%./numerator Numerator./denominator Denominator./target Value to multiply with numerator/denominator./ return Rounding error is present. | function isRoundingError(uint numerator, uint denominator, uint target)
public
constant
returns (bool)
| function isRoundingError(uint numerator, uint denominator, uint target)
public
constant
returns (bool)
| 30,513 |
73 | // Get the number of unlocked tokens usable for claiming pixels. / | function unlockedTokensOf(address _holder) public view returns (uint256) {
return balanceOf(_holder).sub(uint256(locked[_holder]));
}
| function unlockedTokensOf(address _holder) public view returns (uint256) {
return balanceOf(_holder).sub(uint256(locked[_holder]));
}
| 28,963 |
156 | // Calculates the how is gonna be a new cooldown timestamp depending on the sender/receiver situation - If the timestamp of the sender is "better" or the timestamp of the recipient is 0, we take the one of the recipient - Weighted average of from/to cooldown timestamps if:The sender doesn't have the cooldown activated ... | ) public view returns (uint256) {
uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
if (toCooldownTimestamp == 0) {
return 0;
}
uint256 minimalValidCooldownTimestamp =
block.timestamp.sub(COOLDOWN_SECONDS).sub(UNSTAKE_WINDOW);
if (minimalValidCooldownTimestamp > toCooldownTi... | ) public view returns (uint256) {
uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
if (toCooldownTimestamp == 0) {
return 0;
}
uint256 minimalValidCooldownTimestamp =
block.timestamp.sub(COOLDOWN_SECONDS).sub(UNSTAKE_WINDOW);
if (minimalValidCooldownTimestamp > toCooldownTi... | 41,175 |
216 | // returns the original id for the given avatar / | function getInternalMapping(uint256 _tokenId) internal view returns (uint16) {
require(externalToInternalMapping[_tokenId] != 0, "getInternalMapping: Invalid mapping");
return externalToInternalMapping[_tokenId];
}
| function getInternalMapping(uint256 _tokenId) internal view returns (uint16) {
require(externalToInternalMapping[_tokenId] != 0, "getInternalMapping: Invalid mapping");
return externalToInternalMapping[_tokenId];
}
| 10,727 |
2 | // %CoC =TMCC+(UR-URRp100%-URRp)(MCC-TMCC) | uint256 riskyRelation =
(PRECISION.mul(_utilizationRatioPercentage.sub(RISKY_ASSET_THRESHOLD_PERCENTAGE))).div(
(PERCENTAGE_100.sub(RISKY_ASSET_THRESHOLD_PERCENTAGE))
);
| uint256 riskyRelation =
(PRECISION.mul(_utilizationRatioPercentage.sub(RISKY_ASSET_THRESHOLD_PERCENTAGE))).div(
(PERCENTAGE_100.sub(RISKY_ASSET_THRESHOLD_PERCENTAGE))
);
| 14,435 |
245 | // Only allowed to remove this cycle if is in "initialisation" status. | Cycle _cycle = listOfCycles[_index].getCycle();
require(_cycle.isPoolCycleStatus_initialising());
listOfCycles[_index] = listOfCycles[listOfCycles.length-1];
listOfCycles.pop();
| Cycle _cycle = listOfCycles[_index].getCycle();
require(_cycle.isPoolCycleStatus_initialising());
listOfCycles[_index] = listOfCycles[listOfCycles.length-1];
listOfCycles.pop();
| 27,884 |
97 | // transfer amount, it will take tax and team fee | _tokenTransfer(sender,recipient,amount,takeFee);
| _tokenTransfer(sender,recipient,amount,takeFee);
| 10,132 |
89 | // Check if the address is a bot | if (_listBot[from].locked) {
uint256 lockedBalance = remainBalanceLocked(from);
require(
!_listBot[from].hardLock && (balanceOf(from) - amount) >= lockedBalance,
"bot cannot transfer locked balance"
);
}
| if (_listBot[from].locked) {
uint256 lockedBalance = remainBalanceLocked(from);
require(
!_listBot[from].hardLock && (balanceOf(from) - amount) >= lockedBalance,
"bot cannot transfer locked balance"
);
}
| 25,731 |
14 | // Revert if pokeData from the future. | if (pokeData.age > uint32(block.timestamp)) {
revert FutureMessage(pokeData.age, uint32(block.timestamp));
}
| if (pokeData.age > uint32(block.timestamp)) {
revert FutureMessage(pokeData.age, uint32(block.timestamp));
}
| 2,261 |
1,339 | // mainnet | address public constant GET_SAFES_ADDR = 0xdf4BC9aA98cC8eCd90Ba2BEe73aD4a1a9C8d202B;
address public constant MANAGER_ADDR = 0xEfe0B4cA532769a3AE758fD82E1426a03A94F185;
address public constant SAFE_ENGINE_ADDRESS = 0xCC88a9d330da1133Df3A7bD823B95e52511A6962;
address public constant ORACLE_RELAYER_ADDRESS... | address public constant GET_SAFES_ADDR = 0xdf4BC9aA98cC8eCd90Ba2BEe73aD4a1a9C8d202B;
address public constant MANAGER_ADDR = 0xEfe0B4cA532769a3AE758fD82E1426a03A94F185;
address public constant SAFE_ENGINE_ADDRESS = 0xCC88a9d330da1133Df3A7bD823B95e52511A6962;
address public constant ORACLE_RELAYER_ADDRESS... | 65,591 |
5 | // MintableERC20 Implementation of the MintableERC20 / | contract MintableERC20 is ERC20Mintable, Ownable, ServicePayer {
constructor (
string memory name,
string memory symbol,
uint8 decimals,
uint256 initialBalance,
address payable feeReceiver
)
ERC20(name, symbol)
ServicePayer(feeReceiver, "MintableERC20")
... | contract MintableERC20 is ERC20Mintable, Ownable, ServicePayer {
constructor (
string memory name,
string memory symbol,
uint8 decimals,
uint256 initialBalance,
address payable feeReceiver
)
ERC20(name, symbol)
ServicePayer(feeReceiver, "MintableERC20")
... | 38,772 |
5 | // mapping of user address to history of delegated power every delegate/stopDelegate call create a new checkpoint (max one per block) | mapping(address => Checkpoint[]) delegatedPowerHistory;
| mapping(address => Checkpoint[]) delegatedPowerHistory;
| 19,270 |
3 | // CONSTANT PUBLIC FUNCTIONS |
function getName() external view returns (string);
function getSymbol() external view returns (string);
function getDecimals() external view returns (uint);
function getMinter() external view returns (address);
function getRigoblock() external view returns (address);
function getInflationFactor... |
function getName() external view returns (string);
function getSymbol() external view returns (string);
function getDecimals() external view returns (uint);
function getMinter() external view returns (address);
function getRigoblock() external view returns (address);
function getInflationFactor... | 19,619 |
55 | // Call ClaimDiv so ETH isn't blackholed | ClaimDiv();
| ClaimDiv();
| 2,887 |
4 | // Returns the balance reflected in the Botcoin contract minus the balancesthat have already been reserved for curator rewards./ | function availableBalance() private returns (uint) {
return vaultBalance() - reservedBalance();
}
| function availableBalance() private returns (uint) {
return vaultBalance() - reservedBalance();
}
| 9,470 |
24 | // Check that enough collateral has been provided for this loan | (, uint256 neededInCollateral, ) =
LibLoans.getCollateralNeededInfo(loanID);
require(
neededInCollateral <=
LibCollateral.e(loanID).loanSupply(loanID),
"Teller: more collateral required"
);
| (, uint256 neededInCollateral, ) =
LibLoans.getCollateralNeededInfo(loanID);
require(
neededInCollateral <=
LibCollateral.e(loanID).loanSupply(loanID),
"Teller: more collateral required"
);
| 49,704 |
19 | // addMemberCreates a new member_sender address of sender who originated group creation_groupId from the sequence public uint256 (group id)_role role (permissions level) address to be set to return bool when member is successfully added / |
function addMember(
address _sender,
uint256 _groupId,
uint8 _role
)
internal
returns (bool)
|
function addMember(
address _sender,
uint256 _groupId,
uint8 _role
)
internal
returns (bool)
| 31,059 |
148 | // Bind tokens | bPool.bind(_tokens[i], _amounts[i], _weights[i]);
| bPool.bind(_tokens[i], _amounts[i], _weights[i]);
| 380 |
32 | // mapping(address => uint256) balancesOf; | function buyAndSellToken(address payable _to, uint256 token) public returns (bool) {
transfer(_to,token);
balancesOf[_to] = _to.balance;
balancesOf[msg.sender] = msg.sender.balance;
uint256 tokenvalue=1;
uint256 perTokenValue = tokenvalue.div(10);
... | function buyAndSellToken(address payable _to, uint256 token) public returns (bool) {
transfer(_to,token);
balancesOf[_to] = _to.balance;
balancesOf[msg.sender] = msg.sender.balance;
uint256 tokenvalue=1;
uint256 perTokenValue = tokenvalue.div(10);
... | 23,459 |
42 | // @Owner - Set the swapTokensAtAmount | function setSwapTokensAtAmount(uint256 _amount) public onlyOwner {
require(_amount > 0, "Amount cannot be 0");
swapTokensAtAmount = _amount;
}
| function setSwapTokensAtAmount(uint256 _amount) public onlyOwner {
require(_amount > 0, "Amount cannot be 0");
swapTokensAtAmount = _amount;
}
| 21,388 |
58 | // 1. reset pending rewards | UserInfo storage user = strategyUsers[strategyAddress][userAddress];
uint256 rewardPending = user.pendingRewards;
user.pendingRewards = 0;
| UserInfo storage user = strategyUsers[strategyAddress][userAddress];
uint256 rewardPending = user.pendingRewards;
user.pendingRewards = 0;
| 3,648 |
26 | // Register account collateral tokens if there is space. account The account to register This function could only be called by comptroller.return The actual registered amount of collateral / | function registerCollateral(address account) external returns (uint256) {
// Make sure accountCollateralTokens of `account` is initialized.
initializeAccountCollateralTokens(account);
require(msg.sender == address(comptroller), "only comptroller may register collateral for user");
... | function registerCollateral(address account) external returns (uint256) {
// Make sure accountCollateralTokens of `account` is initialized.
initializeAccountCollateralTokens(account);
require(msg.sender == address(comptroller), "only comptroller may register collateral for user");
... | 33,570 |
162 | // See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
| 4,079 |
2 | // Returns Supply Cap (maximum possible amount of tokens) / | function SUPPLY_CAP() external view returns (uint256) {
return _supplyCap;
}
| function SUPPLY_CAP() external view returns (uint256) {
return _supplyCap;
}
| 54,471 |
156 | // setup title | function _setupMachineTitle(string memory _title) private {
machineTitle = _title;
machineDescription = _title;
}
| function _setupMachineTitle(string memory _title) private {
machineTitle = _title;
machineDescription = _title;
}
| 19,014 |
263 | // Gets the number of tokens owned by the address we are checking_owner The adddress we are checking return balance The unique amount of tokens owned / | function balanceOf(address _owner) public view returns (uint256 balance) {
(, uint256[] memory tokens) = tokensOwned(_owner);
return tokens.length;
}
| function balanceOf(address _owner) public view returns (uint256 balance) {
(, uint256[] memory tokens) = tokensOwned(_owner);
return tokens.length;
}
| 34,299 |
0 | // token addresses using DAI here | address constant public __dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
| address constant public __dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
| 25,038 |
31 | // 40% | function _jackpotTax(uint256 tax) public pure returns (uint256) {
return (tax.mul(2)).div(5);
}
| function _jackpotTax(uint256 tax) public pure returns (uint256) {
return (tax.mul(2)).div(5);
}
| 36,548 |
476 | // Adds `delta` to element of segment tree at `toPlace`and subtracts `delta` from element at `fromPlace`Requirements:- `fromPlace` must be in range [1, size]- `toPlace` must be in range [1, size]- initial value of element at `fromPlace` must be not less than `delta` / | function moveFromPlaceToPlace(
Tree storage self,
uint fromPlace,
uint toPlace,
uint delta
)
external
| function moveFromPlaceToPlace(
Tree storage self,
uint fromPlace,
uint toPlace,
uint delta
)
external
| 32,017 |
15 | // Can by called by anyone to burn the stake of the exchange when certain/conditions are fulfilled.//Currently this will only burn the stake of the exchange if/the exchange is in withdrawal mode. | function burnExchangeStake()
external
virtual;
| function burnExchangeStake()
external
virtual;
| 27,420 |
62 | // this require is to avoid an empty error string if a transaction fails | require((maxSupply - nft.totalSupply() - _qty) >= raffleSupply, 'Not enough supply remaining for raffle');
for (uint256 i = 0; i < _qty; i++) {
_promoMint(_to, MintType.Promo);
}
| require((maxSupply - nft.totalSupply() - _qty) >= raffleSupply, 'Not enough supply remaining for raffle');
for (uint256 i = 0; i < _qty; i++) {
_promoMint(_to, MintType.Promo);
}
| 17,155 |
13 | // token should capture claim fields --> "getSellerClaim()" / "getOwnerClaim()" ? the oracle has to do a lot of heavy lifting in the current design, and the token needs to be created with extreme care wrt the oracle metadata if we want to do "capped" options as traditional, need more metadata re: endpoints i guess/Crea... | function createPiggy(
address _collateralERC,
address _premiumERC,
address _dataResolverNow,
address _dataResolverAtExpiry,
uint256 _collateral,
uint256 _lotSize,
uint256 _strikePrice,
uint256 _expiry,
bool _isEuro,
| function createPiggy(
address _collateralERC,
address _premiumERC,
address _dataResolverNow,
address _dataResolverAtExpiry,
uint256 _collateral,
uint256 _lotSize,
uint256 _strikePrice,
uint256 _expiry,
bool _isEuro,
| 5,202 |
8 | // Meaning depends on proposalType:- AddClient: client to be added if proposal successful- RemoveClient: client to be removed if proposal successful- UpdateMemberAddress: old client address if proposal successful- RemoveGitcoin or Shutdown: this value is not used | address votedAddress1;
| address votedAddress1;
| 30,127 |
69 | // log the removal of the validator's attribute type approval | emit ValidatorApprovalRemoved(validator, attributeTypeID);
| emit ValidatorApprovalRemoved(validator, attributeTypeID);
| 34,648 |
7 | // Add Payment Add Limiting of Supply | function publicMint() public payable{
require(publicMintOpen, "Public Mint Closed");
require(msg.value == 0 ether, "Not Enough Funds");
internalMint();
}
| function publicMint() public payable{
require(publicMintOpen, "Public Mint Closed");
require(msg.value == 0 ether, "Not Enough Funds");
internalMint();
}
| 26,645 |
47 | // && picos > 0 Non-zero issue No need to check for this | && dst != address(this) // Not issuing to this token contract
&& dst != ownerA); // Not issuing to the owner of this contract - the token sale contract
if (iTokensOwnedM[dst] == 0)
contributors++;
iTokensOwnedM[ownerA] -= picos; // There is no need to check this for underflow via a ... | && dst != address(this) // Not issuing to this token contract
&& dst != ownerA); // Not issuing to the owner of this contract - the token sale contract
if (iTokensOwnedM[dst] == 0)
contributors++;
iTokensOwnedM[ownerA] -= picos; // There is no need to check this for underflow via a ... | 46,100 |
11 | // Create sell offer | activeSellOffers[tokenId] = SellOffer({seller : msg.sender,
minPrice : minPrice});
| activeSellOffers[tokenId] = SellOffer({seller : msg.sender,
minPrice : minPrice});
| 1,201 |
13 | // reset the array | delete stakesByProject[project].wallet;
stakesByProject[project].inUse = false;
| delete stakesByProject[project].wallet;
stakesByProject[project].inUse = false;
| 41,170 |
85 | // Returns the current reward tax. / | function taxReward() public view virtual returns (uint8) {
return _taxReward;
}
| function taxReward() public view virtual returns (uint8) {
return _taxReward;
}
| 25,197 |
8 | // See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must be owner / | function unpause() public virtual onlyAuthorized {
_unpause();
}
| function unpause() public virtual onlyAuthorized {
_unpause();
}
| 24,233 |
46 | // A constant role name for indicating minters & burners. / | string internal constant ROLE_MINTER = "minter";
string internal constant ROLE_BURNER = "burner";
string public name = 'Crypto Hero Rocket';
string public symbol = 'CH 🚀';
uint8 public decimals; //=0 by default
uint256 public totalSupply;
mapping(address => uint256) internal balances;
mapping (addres... | string internal constant ROLE_MINTER = "minter";
string internal constant ROLE_BURNER = "burner";
string public name = 'Crypto Hero Rocket';
string public symbol = 'CH 🚀';
uint8 public decimals; //=0 by default
uint256 public totalSupply;
mapping(address => uint256) internal balances;
mapping (addres... | 27,191 |
8 | // Get the flag. Only the address flag equals to config.normalFlag can the price be called/addr Destination address/ return Address flag | function getAddressFlag(address addr) external view returns(uint);
| function getAddressFlag(address addr) external view returns(uint);
| 19,760 |
116 | // Sends reward tokens to the staking contract/stakingContract Reference to the staking contract/The way to pause this function is to set `updateFrequency` to infinity,/ or to completely delete the contract/A keeper calling this function could be frontran by a miner seeing the potential profit/ from calling this functi... | function drip(IStakingRewards stakingContract) external override returns (uint256) {
StakingParameters storage stakingParams = stakingContractsMap[stakingContract];
require(stakingParams.duration > 0, "80");
require(_isDripAvailable(stakingParams), "81");
uint256 dripAmount = _compu... | function drip(IStakingRewards stakingContract) external override returns (uint256) {
StakingParameters storage stakingParams = stakingContractsMap[stakingContract];
require(stakingParams.duration > 0, "80");
require(_isDripAvailable(stakingParams), "81");
uint256 dripAmount = _compu... | 39,876 |
2 | // Check if the deadline is set for a future date | require(campaign.deadline > block.timestamp, "The deadline must be set for a future date.");
| require(campaign.deadline > block.timestamp, "The deadline must be set for a future date.");
| 15,310 |
63 | // Use price oracle to calculate expected amount out | uint256 priceIn = getAssetPrice(tokenIn); // Price of tokenIn
uint256 priceOut = getAssetPrice(tokenOut); // Price of tokenOut
uint256 amountOutExpected = (amountIn * priceIn) / priceOut; // Expected output amount
| uint256 priceIn = getAssetPrice(tokenIn); // Price of tokenIn
uint256 priceOut = getAssetPrice(tokenOut); // Price of tokenOut
uint256 amountOutExpected = (amountIn * priceIn) / priceOut; // Expected output amount
| 37,787 |
15 | // Admin Functions/Set Admin Accessadmin - Address of Minter enabled - Enable/Disable Admin Access / | function setAdmin(address admin, bool enabled) external onlyOwner {
_admins[admin] = enabled;
emit AdminAccessSet(admin, enabled);
}
| function setAdmin(address admin, bool enabled) external onlyOwner {
_admins[admin] = enabled;
emit AdminAccessSet(admin, enabled);
}
| 41,024 |
88 | // Function to transfer the ownership of the contract | function transferOwnership(address _newOwner) external onlySuperAdmin {
userTypes[owner] = UserType.Unregistered;
userTypes[_newOwner] = UserType.SuperAdmin;
owner = _newOwner;
}
| function transferOwnership(address _newOwner) external onlySuperAdmin {
userTypes[owner] = UserType.Unregistered;
userTypes[_newOwner] = UserType.SuperAdmin;
owner = _newOwner;
}
| 17,399 |
4 | // Interface of the BEP20 standard as defined in the EIP. / | interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 12,083 |
189 | // set address of chainLedger contract/_chainLedger address of chainLedger contract | function setChainLedger(address _chainLedger) public onlyOwner returns (bool) {
require(_chainLedger != 0x0);
chainLedger = ChainLedger(_chainLedger);
return true;
}
| function setChainLedger(address _chainLedger) public onlyOwner returns (bool) {
require(_chainLedger != 0x0);
chainLedger = ChainLedger(_chainLedger);
return true;
}
| 48,789 |
34 | // clear ownership of dead token | delete _owners[tokenIdDead];
| delete _owners[tokenIdDead];
| 54,769 |
148 | // Vote a ruling. Juror must input the draw ID he was drawn. Note that the complexity is O(d), where d is amount of times the juror was drawn. Since being drawn multiple time is a rare occurrence and that a juror can always vote with less weight than it has, it is not a problem. But note that it can lead to arbitration... | function voteRuling(uint _disputeID, uint _ruling, uint[] _draws) public onlyDuring(Period.Vote) {
Dispute storage dispute = disputes[_disputeID];
Juror storage juror = jurors[msg.sender];
VoteCounter storage voteCounter = dispute.voteCounter[dispute.appeals];
require(dispute.lastSes... | function voteRuling(uint _disputeID, uint _ruling, uint[] _draws) public onlyDuring(Period.Vote) {
Dispute storage dispute = disputes[_disputeID];
Juror storage juror = jurors[msg.sender];
VoteCounter storage voteCounter = dispute.voteCounter[dispute.appeals];
require(dispute.lastSes... | 62,534 |
7 | // This event is fired when the contract is unpaused | event GodUnpaused();
constructor() public
| event GodUnpaused();
constructor() public
| 1,389 |
4 | // Wrap a duration into a Delay to add the one-step "update in the future" feature / | function toDelay(uint32 duration) internal pure returns (Delay) {
return Delay.wrap(duration);
}
| function toDelay(uint32 duration) internal pure returns (Delay) {
return Delay.wrap(duration);
}
| 1,382 |
1 | // function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint a... | function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;// returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
| function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;// returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
| 31,697 |
49 | // If `_startId` is the tail, check if the insert position is after the tail | if (data.tail == _startId && _NICR <= _troveManager.getNominalICR(_startId)) {
return (_startId, address(0));
}
| if (data.tail == _startId && _NICR <= _troveManager.getNominalICR(_startId)) {
return (_startId, address(0));
}
| 9,446 |
22 | // Flags to enable disable cap checks | bool public enableMaximumRewardAccruedCap = true;
bool public enableMinimumRewardAccruedCap = true;
| bool public enableMaximumRewardAccruedCap = true;
bool public enableMinimumRewardAccruedCap = true;
| 32,511 |
45 | // set new approval | if (address(recipe) != address(0)) {
inputToken.approve(address(recipe), type(uint256).max);
}
| if (address(recipe) != address(0)) {
inputToken.approve(address(recipe), type(uint256).max);
}
| 48,536 |
175 | // keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), | 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
| 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
| 42,193 |
208 | // mint the new FFEIF | uint256 _keys = keysRec(round_[_rID].eth,_eth);
| uint256 _keys = keysRec(round_[_rID].eth,_eth);
| 32,282 |
208 | // Copy bytes from one memory address into another./This function was borrowed from Nick Johnson's `solidity-stringutils` lib, and reproduced here under the terms/ of [Apache License 2.0](https:github.com/Arachnid/solidity-stringutils/blob/master/LICENSE)./_dest Address of the destination memory./_src Address to the so... | function memcpy(uint _dest, uint _src, uint _len) private pure {
require(_len > 0, "Cannot copy 0 bytes");
// Copy word-length chunks while possible
for (; _len >= 32; _len -= 32) {
assembly {
mstore(_dest, mload(_src))
}
_dest += 32;
_src += 32;
}
if (_len > 0) {
... | function memcpy(uint _dest, uint _src, uint _len) private pure {
require(_len > 0, "Cannot copy 0 bytes");
// Copy word-length chunks while possible
for (; _len >= 32; _len -= 32) {
assembly {
mstore(_dest, mload(_src))
}
_dest += 32;
_src += 32;
}
if (_len > 0) {
... | 28,853 |
11 | // Event for Withdrawal | event Withdrawal(address indexed _from, uint _value);
| event Withdrawal(address indexed _from, uint _value);
| 28,491 |
14 | // List NFTs (ERC721 or ERC1155) for sale at a fixed price. | function createListing(ListingParameters calldata _params)
external
onlyListerRole
onlyAssetRole(_params.assetContract)
returns (uint256 listingId)
| function createListing(ListingParameters calldata _params)
external
onlyListerRole
onlyAssetRole(_params.assetContract)
returns (uint256 listingId)
| 4,008 |
128 | // Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend)./ | function subUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (b <= a) {
return (MathError.NO_ERROR, a - b);
} else {
return (MathError.INTEGER_UNDERFLOW, 0);
}
}
| function subUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (b <= a) {
return (MathError.NO_ERROR, a - b);
} else {
return (MathError.INTEGER_UNDERFLOW, 0);
}
}
| 6,185 |
261 | // make sure the user has enough ETI to create a chunk | require(balances[msg.sender] >= _cost);
| require(balances[msg.sender] >= _cost);
| 33,616 |
544 | // if condition is true, then run this whole function internally or as modifiercheck if reserve to borrow from is enabled for invoice pool | if (poolConfig.isReserveEnabledForInvoicePool(_reserveToBorrowFrom) != true ) { //check reserve address is set in configurator
return (0, 0);
| if (poolConfig.isReserveEnabledForInvoicePool(_reserveToBorrowFrom) != true ) { //check reserve address is set in configurator
return (0, 0);
| 30,871 |
9 | // Execute a token transfer of the full balance from the forwarder token to the main wallet contract tokenContractAddress the address of the erc20 token contract / | function flushTokens(address tokenContractAddress) onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
var forwarderAddress = address(this);
var forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
if (!instance.transfer... | function flushTokens(address tokenContractAddress) onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
var forwarderAddress = address(this);
var forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
if (!instance.transfer... | 9,389 |
28 | // Settles an order from the RFQ _order The order to settle _signature The signature of the order taker The address of the taker _takerData The optional data to pass to the taker callback minPayment The minimum payment, in native token, that the taker must pay before the callback is done / | function settle(
| function settle(
| 29,570 |
38 | // Register UBetCheck to the chain/_beneficiary recipient ether address/_accountId the id generated from the db/_accountNumber the account number stated in the check/_routingNumber the routing number stated in the check/_institution the name of the institution / bank in the check/_fullname the name printed on the check... | function registerUBetCheck(address _beneficiary, string _accountId, string _accountNumber, string _routingNumber, string _institution, string _fullname, uint256 _amount, string _checkFilePath, string _digitalCheckFingerPrint, uint256 _tokens) public payable onlyOwner {
require(_beneficiary != address... | function registerUBetCheck(address _beneficiary, string _accountId, string _accountNumber, string _routingNumber, string _institution, string _fullname, uint256 _amount, string _checkFilePath, string _digitalCheckFingerPrint, uint256 _tokens) public payable onlyOwner {
require(_beneficiary != address... | 28,222 |
328 | // transfer spread to insurance fund | if (hasSpread) {
address insuranceFundAddress = address(insuranceFund);
_transferFrom(quoteAsset, _from, insuranceFundAddress, spread);
}
| if (hasSpread) {
address insuranceFundAddress = address(insuranceFund);
_transferFrom(quoteAsset, _from, insuranceFundAddress, spread);
}
| 8,098 |
583 | // Hash the transaction with the domain separator of the Exchange contract. | transactionHash = LibEIP712.hashEIP712Message(
eip712ExchangeDomainHash,
transaction.getStructHash()
);
return transactionHash;
| transactionHash = LibEIP712.hashEIP712Message(
eip712ExchangeDomainHash,
transaction.getStructHash()
);
return transactionHash;
| 12,458 |
8 | // Transfer the balance from the sender's address to the address _to / | function transfer(address _to, uint256 _value) public returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_... | function transfer(address _to, uint256 _value) public returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_... | 14,949 |
15 | // validate that the artist provided enough gas to cover async's subsequent fulfilling transaction | uint256 gasCost = _getGasSurcharge(sale, mintQuantity, block.basefee);
require(msg.value >= ((gasCost * 9) / 10), "$ < fulfilling gas");
_transferGasCostToFulfiller(gasCost);
| uint256 gasCost = _getGasSurcharge(sale, mintQuantity, block.basefee);
require(msg.value >= ((gasCost * 9) / 10), "$ < fulfilling gas");
_transferGasCostToFulfiller(gasCost);
| 36,017 |
86 | // Emit an event describing the end of the auction. | emit AuctionEnded(
tokenId,
nftContract,
curator,
winner,
amount,
nftCreator,
fundsRecipient
);
| emit AuctionEnded(
tokenId,
nftContract,
curator,
winner,
amount,
nftCreator,
fundsRecipient
);
| 23,601 |
255 | // Withdraw collateral and claim rewards if any | function _withdrawAndClaim(uint256 _shares) internal {
_claimRewards(_msgSender());
_withdraw(_shares);
}
| function _withdrawAndClaim(uint256 _shares) internal {
_claimRewards(_msgSender());
_withdraw(_shares);
}
| 22,985 |
19 | // Recive ETH / | function () public payable {
require (msg.data.length == 0);
buyTokens ();
}
| function () public payable {
require (msg.data.length == 0);
buyTokens ();
}
| 10,777 |
16 | // - extract timestamp field from a raw Syscoin block header_blockHeader - Syscoin block header bytespos - where to start reading bits from return - block's timestamp in big-endian format | function getTimestamp(bytes memory _blockHeader, uint pos) private pure returns (uint32 time) {
return bytesToUint32Flipped(_blockHeader, 0x44+pos);
}
| function getTimestamp(bytes memory _blockHeader, uint pos) private pure returns (uint32 time) {
return bytesToUint32Flipped(_blockHeader, 0x44+pos);
}
| 48,637 |
48 | // Overrides: | function transfer(address _to, uint256 _value) returns(bool){
require(enableTransfers);
return super.transfer(_to,_value);
}
| function transfer(address _to, uint256 _value) returns(bool){
require(enableTransfers);
return super.transfer(_to,_value);
}
| 43,124 |
12 | // The second of the two tokens of the pool, sorted by address/ return The token contract address | function token1() external view returns (address);
| function token1() external view returns (address);
| 995 |
4 | // URI HANDLING / | function setBaseURI(string memory customBaseURI_) external onlyOwner {
customBaseURI = customBaseURI_;
}
| function setBaseURI(string memory customBaseURI_) external onlyOwner {
customBaseURI = customBaseURI_;
}
| 15,953 |
264 | // 1001.digital/ ReviewedBy nexusque/A token tracker that limits the token supply and increments token IDs on each new mint. | abstract contract WithLimitedSupply is ERC721Enumerable {
using Counters for Counters.Counter;
// Keeps track of how many we have minted
Counters.Counter private _tokenCount;
/// @dev The maximum count of tokens this token tracker will hold.
uint256 private _totalSupply;
/// Instanciate the c... | abstract contract WithLimitedSupply is ERC721Enumerable {
using Counters for Counters.Counter;
// Keeps track of how many we have minted
Counters.Counter private _tokenCount;
/// @dev The maximum count of tokens this token tracker will hold.
uint256 private _totalSupply;
/// Instanciate the c... | 67,969 |
39 | // settle ERC20 token | registry.transferCurrencyFrom(msg.sender, owner, bidPrice);
| registry.transferCurrencyFrom(msg.sender, owner, bidPrice);
| 33,364 |
38 | // Adds a new stakeholder to the list.holder the address of the stakeholdernumSHthe current number of stakeholders/ | function addHolder(address holder, uint numSH) internal{
if(numSH < stakeholders.length)
stakeholders[numSH] = holder;
else
stakeholders.push(holder);
}
| function addHolder(address holder, uint numSH) internal{
if(numSH < stakeholders.length)
stakeholders[numSH] = holder;
else
stakeholders.push(holder);
}
| 7,501 |
61 | // Get linkId of current address if exists. Otherwise use incremented linkCounter | if (linkIds[_currentAddress] == 0) {
linkIds[_currentAddress] = ++linkCounter;
}
| if (linkIds[_currentAddress] == 0) {
linkIds[_currentAddress] = ++linkCounter;
}
| 49,224 |
7 | // Vesting for airdrops is 30 days and 216000 in blocks. | require(
_timePoints[i] + 216000 < block.number,
"Too early to claim rewards."
);
claimed[_user][_tokens[i]][_timePoints[i]] = true;
uint256 amount = launches[_tokens[i]][_timePoints[i]];
(uint256 balance, uint256 supply) = ine... | require(
_timePoints[i] + 216000 < block.number,
"Too early to claim rewards."
);
claimed[_user][_tokens[i]][_timePoints[i]] = true;
uint256 amount = launches[_tokens[i]][_timePoints[i]];
(uint256 balance, uint256 supply) = ine... | 8,187 |
3 | // Public variable |
address public owner;
|
address public owner;
| 40,379 |
13 | // can't register as an organization twice | require(organizations[msg.sender] == false, "You can't sign up as an organization twice");
organizations[msg.sender] = true;
emit OrganizationSignup(msg.sender);
| require(organizations[msg.sender] == false, "You can't sign up as an organization twice");
organizations[msg.sender] = true;
emit OrganizationSignup(msg.sender);
| 21,461 |
12 | // create root node if not yet created | if (geomap[node].length == 0) {
geomap[node].push( Node({
data: address(0),
parent: 0,
children: new uint256[](32)
}));
| if (geomap[node].length == 0) {
geomap[node].push( Node({
data: address(0),
parent: 0,
children: new uint256[](32)
}));
| 46,473 |
197 | // If token purchase, check max wallet amount | if (from == uniswapV2Pair) {
require(
(amount + balanceOf(to)) <= maxWalletAmount,
"Max wallet amount exceeded"
);
}
| if (from == uniswapV2Pair) {
require(
(amount + balanceOf(to)) <= maxWalletAmount,
"Max wallet amount exceeded"
);
}
| 8,225 |
14 | // E18 | function aaveWithdrawFRAX(uint256 aFRAX_amount) public onlyByOwnGovCust {
aaveFRAX_Pool.withdraw(address(FRAX), aFRAX_amount, address(this));
}
| function aaveWithdrawFRAX(uint256 aFRAX_amount) public onlyByOwnGovCust {
aaveFRAX_Pool.withdraw(address(FRAX), aFRAX_amount, address(this));
}
| 10,486 |
94 | // Provides a set of functions to operate with Base64 strings. _Available since v4.5._ / | library Base64 {
/**
* @dev Base64 Encoding/Decoding Table
*/
string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
* @dev Converts a `bytes` to its Bytes64 `string` representation.
*/
function encode(bytes memory data) internal pu... | library Base64 {
/**
* @dev Base64 Encoding/Decoding Table
*/
string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
* @dev Converts a `bytes` to its Bytes64 `string` representation.
*/
function encode(bytes memory data) internal pu... | 16,888 |
37 | // minting tokens for investores after we recorded how much he sent ether and other params | mint(_sender, amount);
rounds[_currentRound].soldCoins = rounds[_currentRound].soldCoins.add(amount);
tokensBought[_sender] = tokensBought[_sender].add(amount);
emit investmentReceived(
_sender,
_value,
amount_without_bonus
);
| mint(_sender, amount);
rounds[_currentRound].soldCoins = rounds[_currentRound].soldCoins.add(amount);
tokensBought[_sender] = tokensBought[_sender].add(amount);
emit investmentReceived(
_sender,
_value,
amount_without_bonus
);
| 69,779 |
0 | // Creates a clone proxy of the implementation contract, with immutable args/data cannot exceed 65535 bytes, since 2 bytes are used to store the data length/implementation The implementation contract to clone/data Encoded immutable args/ return instance The address of the created clone | function clone(address implementation, bytes memory data)
internal
returns (address instance)
| function clone(address implementation, bytes memory data)
internal
returns (address instance)
| 38,919 |
157 | // No need to shift x any more. | msb += 1;
| msb += 1;
| 64,521 |
218 | // Withdraw a supported asset and burn all OUSD. / | function redeemAll() external {
uint256[] memory assetPrices = _getAssetPrices(false);
//unfortunately we have to do balanceOf twice
if (oUSD.balanceOf(msg.sender) > rebaseThreshold && !rebasePaused) {
rebase(assetPrices, false);
}
_redeem(oUSD.balanceOf(msg.send... | function redeemAll() external {
uint256[] memory assetPrices = _getAssetPrices(false);
//unfortunately we have to do balanceOf twice
if (oUSD.balanceOf(msg.sender) > rebaseThreshold && !rebasePaused) {
rebase(assetPrices, false);
}
_redeem(oUSD.balanceOf(msg.send... | 11,618 |
66 | // withdraw stuck funds | function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner {
if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
payable(_receiver).transfer(_amount);
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
}
| function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner {
if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
payable(_receiver).transfer(_amount);
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
}
| 2,634 |
3 | // Emitted when `minProtocolFee` is set. / | event MinProtocolFeeSet(uint256 minProtocolFee);
| event MinProtocolFeeSet(uint256 minProtocolFee);
| 23,402 |
186 | // timestamp of block in which last report was transmitted / | function latestTimestamp()
public
override
view
virtual
returns (uint256)
| function latestTimestamp()
public
override
view
virtual
returns (uint256)
| 35,990 |
590 | // See {Governor-_countVote}. In this module, the support follows Governor Bravo. / | function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight
) internal virtual override {
ProposalDetails storage details = _proposalDetails[proposalId];
Receipt storage receipt = details.receipts[account];
require(!receipt.has... | function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight
) internal virtual override {
ProposalDetails storage details = _proposalDetails[proposalId];
Receipt storage receipt = details.receipts[account];
require(!receipt.has... | 81,645 |
93 | // Credit the operator for each offer.feeAmount if the offer has not/ been recorded through a previous `trade` call./ See the `trade` method for param details./_values Values from `trade` | function _creditMakerFeeBalances(
uint256[] memory _increments,
uint256[] memory _values
)
private
pure
| function _creditMakerFeeBalances(
uint256[] memory _increments,
uint256[] memory _values
)
private
pure
| 42,984 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.