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 |
|---|---|---|---|---|
113 | // Mapping of shields so we don't reward them for U.F. | mapping (address => bool) public arShields;
| mapping (address => bool) public arShields;
| 10,263 |
36 | // Burning disabled. Returns the total number of tokens burned. / | // function _totalBurned() internal view virtual returns (uint256) {
// return _burnCounter;
// }
| // function _totalBurned() internal view virtual returns (uint256) {
// return _burnCounter;
// }
| 24,521 |
21 | // Governs how many validator validators a single account can vote for. | uint256 public maxNumValidatorsVotedFor;
| uint256 public maxNumValidatorsVotedFor;
| 19,061 |
8 | // allows anybody to execute given they have a signed messaged from an executor | function executeRelayedCall(
address signedFor,
bytes memory _data,
uint256 _nonce,
bytes memory _signature
| function executeRelayedCall(
address signedFor,
bytes memory _data,
uint256 _nonce,
bytes memory _signature
| 27,863 |
4 | // IERC20(_token).transferFrom(msg.sender, address(this), amt); | IERC20(_token).transferFrom(msg.sender,addr, amt_to_send);
| IERC20(_token).transferFrom(msg.sender,addr, amt_to_send);
| 6,277 |
36 | // update state | _weiRaised = _weiRaised.add(weiAmount);
tokensPerAddress[sender] += tokens;
| _weiRaised = _weiRaised.add(weiAmount);
tokensPerAddress[sender] += tokens;
| 2,705 |
134 | // Pie Distribution Admin //Set PIE speed for a single marketpToken The market whose PIE speed to updatepieSpeed New PIE speed for market/ | function _setPieSpeed(address pToken, uint pieSpeed) public {
require(msg.sender == admin, "only admin can set pie speed");
setPieSpeedInternal(pToken, pieSpeed);
}
| function _setPieSpeed(address pToken, uint pieSpeed) public {
require(msg.sender == admin, "only admin can set pie speed");
setPieSpeedInternal(pToken, pieSpeed);
}
| 3,220 |
63 | // Adjust collateral and amountToBorrow to asset tokens | uint adjustedCollateral = numberOfTokensReceived.mul(collateral).div(collateral.add(amountToBorrow));
uint adjustedAmountToBorrow = numberOfTokensReceived.mul(amountToBorrow).div(collateral.add(amountToBorrow));
| uint adjustedCollateral = numberOfTokensReceived.mul(collateral).div(collateral.add(amountToBorrow));
uint adjustedAmountToBorrow = numberOfTokensReceived.mul(amountToBorrow).div(collateral.add(amountToBorrow));
| 24,326 |
204 | // the percentage of sale that an artist gets on secondary sales | uint256 public artistSecondSalePercentage;
| uint256 public artistSecondSalePercentage;
| 15,251 |
25 | // buy | if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
... | if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
... | 2,522 |
2 | // fired at end of buy or reload | event onEndTx
(
uint256 compressedData,
uint256 compressedIDs,
bytes32 playerName,
address playerAddress,
uint256 ethIn,
uint256 keysBought,
address winnerAddr,
bytes32 winnerName,
| event onEndTx
(
uint256 compressedData,
uint256 compressedIDs,
bytes32 playerName,
address playerAddress,
uint256 ethIn,
uint256 keysBought,
address winnerAddr,
bytes32 winnerName,
| 21,050 |
7 | // See {ERC20Pausable} and {Pausable-_pause}. Requirements:the caller must have the `PAUSER_ROLE`. / | function pause() external virtual {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"Token: must have pauser role to pause"
);
_pause();
}
| function pause() external virtual {
require(
hasRole(PAUSER_ROLE, _msgSender()),
"Token: must have pauser role to pause"
);
_pause();
}
| 52,429 |
54 | // Daily allocationdays since mint - claimed | return (ships[shipInstances[tokenId].name].dailyAllocation
| return (ships[shipInstances[tokenId].name].dailyAllocation
| 27,203 |
4 | // A The input array to search a The address to remove / | function removeStorage(address[] storage A, address a) internal {
(uint256 index, bool isIn) = indexOf(A, a);
if (!isIn) {
revert("Address not in array.");
} else {
uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here
if (i... | function removeStorage(address[] storage A, address a) internal {
(uint256 index, bool isIn) = indexOf(A, a);
if (!isIn) {
revert("Address not in array.");
} else {
uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here
if (i... | 6,559 |
5,124 | // 2563 | entry "tweenaged" : ENG_ADJECTIVE
| entry "tweenaged" : ENG_ADJECTIVE
| 19,175 |
24 | // ๅทฒๆฎ้ๆ็ฐ้ขๅบฆ | uint256 public totalCommonWithdrawSupply;
| uint256 public totalCommonWithdrawSupply;
| 38,375 |
204 | // burn the tokens that have not been sold yet | function burnUnmintedTokens() public onlyOwner {
maxTotalTokens = totalSupply();
maxTokensPresale = totalSupply();
}
| function burnUnmintedTokens() public onlyOwner {
maxTotalTokens = totalSupply();
maxTokensPresale = totalSupply();
}
| 41,269 |
27 | // The job creator can choose an applicant for his job Need to flesh out a little... Give applicant the choice to still choose the job before money is staked (do in signing process) For the above, make sure the states are worked out chosenApplicant The applicant who is accepted jobID The ID of a specific job / | {
finalApplicant[jobID] = chosenApplicant;
jobs[jobID].state = State.Signing;
emit ApplicantChosen(chosenApplicant, jobID);
}
| {
finalApplicant[jobID] = chosenApplicant;
jobs[jobID].state = State.Signing;
emit ApplicantChosen(chosenApplicant, jobID);
}
| 10,391 |
45 | // Approves a third-party spender | function approve(address _spender, uint256 _amount)
public
returns (bool)
| function approve(address _spender, uint256 _amount)
public
returns (bool)
| 38,999 |
38 | // Step4. Claim reward | function _claim(uint _tokenType, uint16 _tokenId) internal {
// ์ ์ฒด ๋ฆฌ์๋๋ฅผ ๊ณ์ฐํ์ฌ ๋ฐ์์ต๋๋ค.
uint256 _myReward = _calReward(_tokenType, _tokenId);
// ERC-20 ํ ํฐ ๋ฐํ ํจ์๋ก ๊ต์ฒด
rewardVault.transferToken(msg.sender, _myReward);
// ๋ธ๋กํ์ ์ด๊ธฐํ
if(_tokenType==0){
inStakedtmhc[_... | function _claim(uint _tokenType, uint16 _tokenId) internal {
// ์ ์ฒด ๋ฆฌ์๋๋ฅผ ๊ณ์ฐํ์ฌ ๋ฐ์์ต๋๋ค.
uint256 _myReward = _calReward(_tokenType, _tokenId);
// ERC-20 ํ ํฐ ๋ฐํ ํจ์๋ก ๊ต์ฒด
rewardVault.transferToken(msg.sender, _myReward);
// ๋ธ๋กํ์ ์ด๊ธฐํ
if(_tokenType==0){
inStakedtmhc[_... | 20,603 |
38 | // Remove a rebase hook. _index Index of the transaction to remove. / | function removeTransaction(uint256 _index) external onlyGovernance {
require(_index < transactions.length, "index out of bounds");
if (_index < transactions.length - 1) {
transactions[_index] = transactions[transactions.length - 1];
}
transactions.pop();
}
| function removeTransaction(uint256 _index) external onlyGovernance {
require(_index < transactions.length, "index out of bounds");
if (_index < transactions.length - 1) {
transactions[_index] = transactions[transactions.length - 1];
}
transactions.pop();
}
| 12,032 |
4 | // set the rest of the contract variables | pancakeswapV2Router = _pancakeswapV2Router;
| pancakeswapV2Router = _pancakeswapV2Router;
| 31,347 |
1 | // [ERC1400ERC20 CONSTRUCTOR] Initialize ERC71400ERC20 and CertificateController parameters + registerthe contract implementation in ERC1820Registry. name Name of the token. symbol Symbol of the token. granularity Granularity of the token. controllers Array of initial controllers. certificateSigner Address of the off-c... | constructor(
string memory name,
string memory symbol,
uint256 granularity,
address[] memory controllers,
address certificateSigner,
bytes32[] memory tokenDefaultPartitions
)
| constructor(
string memory name,
string memory symbol,
uint256 granularity,
address[] memory controllers,
address certificateSigner,
bytes32[] memory tokenDefaultPartitions
)
| 33,067 |
5 | // Validate and update nonce | _validateNonce(_nonce);
| _validateNonce(_nonce);
| 9,703 |
63 | // ERC20 token implementation, inherited by CoFiXPair contract, no owner or governance | contract CoFiXERC20 is ICoFiXERC20 {
using SafeMath for uint;
string public constant nameForDomain = 'CoFiX Pool Token';
uint8 public override constant decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uin... | contract CoFiXERC20 is ICoFiXERC20 {
using SafeMath for uint;
string public constant nameForDomain = 'CoFiX Pool Token';
uint8 public override constant decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uin... | 13,177 |
13 | // make sure they&39;re an owner | if (ownerIndex == 0) return;
uint ownerIndexBit = 2**ownerIndex;
PendingState storage pending = m_pending[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
emit Revoke(msg.sender, _oper... | if (ownerIndex == 0) return;
uint ownerIndexBit = 2**ownerIndex;
PendingState storage pending = m_pending[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
emit Revoke(msg.sender, _oper... | 34,164 |
19 | // Function to finish a raffle campaign | function finishRaffleCampaign() public onlyOwner onlyRaffle whenStarted {
require(!finished, "Campaign already finished");
finished = true;
// Request a random number
// randomNumberContract.getRandomNumber(block.timestamp);
emit CampaignFinished();
}
| function finishRaffleCampaign() public onlyOwner onlyRaffle whenStarted {
require(!finished, "Campaign already finished");
finished = true;
// Request a random number
// randomNumberContract.getRandomNumber(block.timestamp);
emit CampaignFinished();
}
| 3,151 |
126 | // Transfer ETH reward to caller of the ripcord function. If the ETH balance on this contract is less than required incentive quantity, then transfer contract balance instead to prevent reverts. return uint256 Amount of ETH transferred to caller / | function _transferEtherRewardToCaller(uint256 _etherReward) internal returns(uint256) {
uint256 etherToTransfer = _etherReward < address(this).balance ? _etherReward : address(this).balance;
msg.sender.transfer(etherToTransfer);
return etherToTransfer;
}
| function _transferEtherRewardToCaller(uint256 _etherReward) internal returns(uint256) {
uint256 etherToTransfer = _etherReward < address(this).balance ? _etherReward : address(this).balance;
msg.sender.transfer(etherToTransfer);
return etherToTransfer;
}
| 34,741 |
45 | // ๅฎ้
ๅบ่ฏฅๅๅป็ๆฐ้ | uint _newPrice = _initPrice.add(_singlePrice.mul(_ratio));
uint _price = uint(1).mul(1e18).div(_newPrice);
return _price;
| uint _newPrice = _initPrice.add(_singlePrice.mul(_ratio));
uint _price = uint(1).mul(1e18).div(_newPrice);
return _price;
| 9,683 |
72 | // function to get stakeholders addresses | function getStakeholdersAddresses()
external
view
returns (address[] memory)
| function getStakeholdersAddresses()
external
view
returns (address[] memory)
| 37,540 |
104 | // Update per investor amount | investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
| investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
| 68,285 |
14 | // Calculates the total amount of {want} held by the strategywhich is the balance of want + the total amount supplied to Excalibur. / | function balanceOf() public view override returns (uint256) {
return balanceOfWant() + balanceOfPool();
}
| function balanceOf() public view override returns (uint256) {
return balanceOfWant() + balanceOfPool();
}
| 36,888 |
10 | // Check whether a voucher has been executed./_inboxInputIndex The index of the input in the input box/_outputIndex The index of output emitted by the input/ return Whether the voucher has been executed before | function wasVoucherExecuted(
uint256 _inboxInputIndex,
uint256 _outputIndex
) external view returns (bool);
| function wasVoucherExecuted(
uint256 _inboxInputIndex,
uint256 _outputIndex
) external view returns (bool);
| 12,334 |
513 | // See {IERC721-safeTransferFrom}. / | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
| function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
| 2,667 |
8 | // A mix-in contract to decode AML payloads.This should be a library, but for the complexity and toolchain fragility risks involving of linking library inside library, we put this as a mix-in. / | contract KYCPayloadDeserializer {
using BytesDeserializer for bytes;
/**
* This function takes the dataframe and unpacks it
* We have the users ETH address for verification that they are using their own signature
* CustomerID so we can track customer purchases
* Min/Max ETH to invest for AML/CTF purpo... | contract KYCPayloadDeserializer {
using BytesDeserializer for bytes;
/**
* This function takes the dataframe and unpacks it
* We have the users ETH address for verification that they are using their own signature
* CustomerID so we can track customer purchases
* Min/Max ETH to invest for AML/CTF purpo... | 42,097 |
3 | // Returns the max amount of Base that can be sold to the pool | function maxBaseIn() external view returns (uint128) ;
| function maxBaseIn() external view returns (uint128) ;
| 28,286 |
13 | // This allows the owner to change the operator. | function setOperator(address newOperator) external onlyOwner {
operator = newOperator;
}
| function setOperator(address newOperator) external onlyOwner {
operator = newOperator;
}
| 30,321 |
94 | // Forward ERC20 methods to upgraded contract if this one is deprecated | function totalSupply() public view returns (uint256) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).totalSupplyByLegacy();
} else {
return totalSupply_;
}
}
| function totalSupply() public view returns (uint256) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).totalSupplyByLegacy();
} else {
return totalSupply_;
}
}
| 12,574 |
43 | // an approved spender can transfer currency from one account to another up to their spending limit | function transferFrom(address from, address to, uint value) public override returns(bool) {
require(allowances[from][msg.sender] > 0, "No Allowance for this address.");
require(allowances[from][msg.sender] >= value, "Allowance too low for transfer.");
require(balances[from] >= value, "Balanc... | function transferFrom(address from, address to, uint value) public override returns(bool) {
require(allowances[from][msg.sender] > 0, "No Allowance for this address.");
require(allowances[from][msg.sender] >= value, "Allowance too low for transfer.");
require(balances[from] >= value, "Balanc... | 3,085 |
2 | // Immutabel state |
ISnapshotableToken private SHARE_TOKEN;
|
ISnapshotableToken private SHARE_TOKEN;
| 1,474 |
444 | // attempt to add borrower to the market | Error err = addToMarketInternal(PToken(msg.sender), borrower);
if (err != Error.NO_ERROR) {
return uint(err);
}
| Error err = addToMarketInternal(PToken(msg.sender), borrower);
if (err != Error.NO_ERROR) {
return uint(err);
}
| 13,759 |
263 | // replaced Address lib with custom MyAddress to avoid delegateCall (its not allowed for Proxied contract) | using AddressUtil for address;
using Strings for uint256;
| using AddressUtil for address;
using Strings for uint256;
| 53,608 |
294 | // we want to use statechanging for safety | (uint256 deposits, uint256 borrows) = getLivePosition();
| (uint256 deposits, uint256 borrows) = getLivePosition();
| 13,176 |
96 | // Returns e.g. https:mirror-api.com/editions/[editionId]/[tokenId] | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| 13,496 |
11 | // Delete the index for the deleted slot | delete set._indexes[value];
return true;
| delete set._indexes[value];
return true;
| 41,390 |
6 | // Check if goal was reached Checks if the goal or time limit has been reached and ends the campaign / | function checkGoalReached() public afterDeadline {
if (amountRaised >= fundingGoal){
fundingGoalReached = true;
emit GoalReached(beneficiary, amountRaised);
}
| function checkGoalReached() public afterDeadline {
if (amountRaised >= fundingGoal){
fundingGoalReached = true;
emit GoalReached(beneficiary, amountRaised);
}
| 22,251 |
70 | // Checks an address for the total amount of base rewards they can claim for owning one or more Gen1 & Gen2 NFTs. Note these NFTs may have already been claimed by a previous owner, as the base claim is tracked by token id. | function checkBaseReward(address recipient) external view returns (uint256) {
uint256 gen1Count = TPTGen1.balanceOf(recipient);
require(gen1Count > 0, "Wallet must own a Genesis NFT");
uint256 gen2Count = TPTGen2.balanceOf(recipient);
require(gen2Count > 0, "Wallet must own a Gen2 N... | function checkBaseReward(address recipient) external view returns (uint256) {
uint256 gen1Count = TPTGen1.balanceOf(recipient);
require(gen1Count > 0, "Wallet must own a Genesis NFT");
uint256 gen2Count = TPTGen2.balanceOf(recipient);
require(gen2Count > 0, "Wallet must own a Gen2 N... | 9,605 |
29 | // In case there is still small error, you, the caller please pay for it. | IERC20(registry.tidalToken()).transferFrom(msg.sender, address(this), payoutInfo[payoutId_].total - payoutInfo[payoutId_].paid);
payoutInfo[payoutId_].paid = payoutInfo[payoutId_].total;
| IERC20(registry.tidalToken()).transferFrom(msg.sender, address(this), payoutInfo[payoutId_].total - payoutInfo[payoutId_].paid);
payoutInfo[payoutId_].paid = payoutInfo[payoutId_].total;
| 35,661 |
245 | // CurveGaugeV2ActionsMixin Contract/Enzyme Council <[email protected]nance>/Mixin contract for interacting with any Curve LiquidityGaugeV2 contract | abstract contract CurveGaugeV2ActionsMixin is AssetHelpers {
uint256 private constant CURVE_GAUGE_V2_MAX_REWARDS = 8;
/// @dev Helper to claim pool-specific rewards
function __curveGaugeV2ClaimRewards(address _gauge, address _target) internal {
ICurveLiquidityGaugeV2(_gauge).claim_rewards(_target);... | abstract contract CurveGaugeV2ActionsMixin is AssetHelpers {
uint256 private constant CURVE_GAUGE_V2_MAX_REWARDS = 8;
/// @dev Helper to claim pool-specific rewards
function __curveGaugeV2ClaimRewards(address _gauge, address _target) internal {
ICurveLiquidityGaugeV2(_gauge).claim_rewards(_target);... | 52,524 |
0 | // USING Registry / Returned by .getRegistry() | interface IRegistry {
function owner() external view returns (address _addr);
function addressOf(bytes32 _name) external view returns (address _addr);
}
| interface IRegistry {
function owner() external view returns (address _addr);
function addressOf(bytes32 _name) external view returns (address _addr);
}
| 1,153 |
22 | // Deposit in wei the creator added when submitting their proposal. It is taken from the msg.value of a newProposal call. | uint proposalDeposit;
| uint proposalDeposit;
| 9,306 |
18 | // Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) external view returns (uint256);
| function balanceOf(address account, uint256 id) external view returns (uint256);
| 9,062 |
54 | // Burn the unsold tokens | IERC20(tokenAddress).transfer(
DEAD,
IERC20(tokenAddress).balanceOf(address(this))
);
emit TokensBurned(IERC20(tokenAddress).balanceOf(address(this)));
| IERC20(tokenAddress).transfer(
DEAD,
IERC20(tokenAddress).balanceOf(address(this))
);
emit TokensBurned(IERC20(tokenAddress).balanceOf(address(this)));
| 25,769 |
55 | // Execute a token flush from one of the forwarder addresses. This transfer needs only a single signature and can be done by any signerforwarderAddress the address of the forwarder address to flush the tokens from tokenContractAddress the address of the erc20 token contract / | function flushForwarderTokens(
address payable forwarderAddress,
address tokenContractAddress
| function flushForwarderTokens(
address payable forwarderAddress,
address tokenContractAddress
| 1,439 |
45 | // ----------------------------------internal-------------------------------------------------------- | function statisticsTeam(address _ref,uint256 amount,bool _team) internal{
address up = _ref;
for (uint256 i = 0; i < FLOOR; i++) {
if (up == address(0)) {
break;
}
if(_team){
umbrellas[up].headcount++;
}else{
... | function statisticsTeam(address _ref,uint256 amount,bool _team) internal{
address up = _ref;
for (uint256 i = 0; i < FLOOR; i++) {
if (up == address(0)) {
break;
}
if(_team){
umbrellas[up].headcount++;
}else{
... | 36,749 |
43 | // ็นๅฎใฎใขใใฌในใซๆๅฎใใใitemใฎ็พๅจใฎๆๆ่
ใงใใใใฉใใใใใงใใฏใใพใใ/_claimant /_tokenId | function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return itemIndexToOwner[_tokenId] == _claimant;
}
| function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return itemIndexToOwner[_tokenId] == _claimant;
}
| 15,667 |
49 | // set control variable adjustment_addition bool_increment uint_target uint_buffer uint / | function setAdjustment (
bool _addition,
uint _increment,
uint _target,
uint _buffer
| function setAdjustment (
bool _addition,
uint _increment,
uint _target,
uint _buffer
| 17,574 |
52 | // The highest ratio of the new price to the anchor price that will still trigger the price to be updated | uint public immutable upperBoundAnchorRatio;
| uint public immutable upperBoundAnchorRatio;
| 4,512 |
185 | // The ETHFUND TOKEN! | ETHFUND public ethfund;
| ETHFUND public ethfund;
| 5,393 |
1 | // return Whether the transfer was successful or not (hint: it is not :) | function transfer(address, uint256) public pure returns (bool) {
return false; // there are no tokens so there can be no transfer
}
| function transfer(address, uint256) public pure returns (bool) {
return false; // there are no tokens so there can be no transfer
}
| 42,118 |
46 | // Safe ants transfer function, just in case if rounding error causes pool to not have enough ANTSs. | function safeAntsTransfer(address _to, uint256 _amount) internal {
uint256 antsBal = ants.balanceOf(address(this));
if (_amount > antsBal) {
ants.transfer(_to, antsBal);
} else {
ants.transfer(_to, _amount);
}
}
| function safeAntsTransfer(address _to, uint256 _amount) internal {
uint256 antsBal = ants.balanceOf(address(this));
if (_amount > antsBal) {
ants.transfer(_to, antsBal);
} else {
ants.transfer(_to, _amount);
}
}
| 42,035 |
6 | // ERC20Interface function's implementation / ------------------------------------------------------------------------ Get the total supply of the `token` ------------------------------------------------------------------------ | function totalSupply() public override view returns (uint256){
return _totalSupply;
}
| function totalSupply() public override view returns (uint256){
return _totalSupply;
}
| 49,934 |
11 | // So here we are creating a mask which consists of only ones from the firstOne bit to the lastOne bit | uint256 a = (1 << bitFrom) - 1;
uint256 b = (1 << bitTo) - 1;
uint256 mask = a ^ b;
uint256 onlyNeededBits = (number & mask);
return onlyNeededBits >> bitFrom;
| uint256 a = (1 << bitFrom) - 1;
uint256 b = (1 << bitTo) - 1;
uint256 mask = a ^ b;
uint256 onlyNeededBits = (number & mask);
return onlyNeededBits >> bitFrom;
| 10,610 |
212 | // A Loot-Derivative Project for the Travel Industry/jacmos3 - TripsCommunity/Text-based NFTs thought for the Travel Industry appannage. Hotels, restaurants, hospitality etc can use them both in the real or metaverse worlds | contract TravelerLoot is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 private constant DISCOUNT_EXPIRATION = 1790553599; //Sun 27 Sep 2026 21:59:59 UTC
string private constant WHITE = "white";
string private constant BLACK = "black";
string private constant GOLD = "gold";
string private con... | contract TravelerLoot is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 private constant DISCOUNT_EXPIRATION = 1790553599; //Sun 27 Sep 2026 21:59:59 UTC
string private constant WHITE = "white";
string private constant BLACK = "black";
string private constant GOLD = "gold";
string private con... | 10,817 |
63 | // Returns whether the SetToken component default position real unit is greater than or equal to units passed in. / | function hasSufficientDefaultUnits(ISetToken _setToken, address _component, uint256 _unit) internal view returns(bool) {
return _setToken.getDefaultPositionRealUnit(_component) >= _unit.toInt256();
}
| function hasSufficientDefaultUnits(ISetToken _setToken, address _component, uint256 _unit) internal view returns(bool) {
return _setToken.getDefaultPositionRealUnit(_component) >= _unit.toInt256();
}
| 14,980 |
82 | // unwrap to get native tokens | wnative.withdraw(amounts[1]);
| wnative.withdraw(amounts[1]);
| 7,254 |
404 | // If this is the first lot, set this as the max multiplier of the account | if (ownedLots[_account].length == 1) {
ownerMaxMultiplier[_account] = lot.multiplier;
}
| if (ownedLots[_account].length == 1) {
ownerMaxMultiplier[_account] = lot.multiplier;
}
| 32,595 |
0 | // count number of bytes required to represent an unsigned integer | function count_bytes(uint256 n) pure internal returns (uint256 c) {
uint i = 0;
uint mask = 1;
while (n >= mask) {
i += 1;
mask *= 256;
}
return i;
}
| function count_bytes(uint256 n) pure internal returns (uint256 c) {
uint i = 0;
uint mask = 1;
while (n >= mask) {
i += 1;
mask *= 256;
}
return i;
}
| 19,277 |
113 | // data required to create a sequence | struct SequenceCreateData {
uint16 sequenceNumber;
string name;
string description;
string image;
}
| struct SequenceCreateData {
uint16 sequenceNumber;
string name;
string description;
string image;
}
| 67,397 |
6 | // Mixin to add support for `ownable()` `Mixins` are a design pattern seen in the 0x contracts.It simplyseparates logically groupings of code to ease readability. / | contract MixinConvenienceOwnable is MixinErrors, MixinLockCore {
// used for `owner()`convenience helper
address private _convenienceOwner;
// events
event OwnershipTransferred(address previousOwner, address newOwner);
function _initializeMixinConvenienceOwnable(address _sender) internal {
_convenience... | contract MixinConvenienceOwnable is MixinErrors, MixinLockCore {
// used for `owner()`convenience helper
address private _convenienceOwner;
// events
event OwnershipTransferred(address previousOwner, address newOwner);
function _initializeMixinConvenienceOwnable(address _sender) internal {
_convenience... | 15,611 |
31 | // ends ICO | function closeIco () onlyOwner inIco{
icoOpen = false;
}
| function closeIco () onlyOwner inIco{
icoOpen = false;
}
| 1,828 |
223 | // extend Aurora stream reward schedule. It can be only called by the default/ contract admin. It can accept extending the schedule if the new schedule is/ not overlapping with the current schedule. Also, it requires to pause the contract before calling it./scheduleTimes timestamp denoting the start of each scheduled i... | function extendAuroraStreamSchedule(
uint256[] memory scheduleTimes,
uint256[] memory scheduleRewards
| function extendAuroraStreamSchedule(
uint256[] memory scheduleTimes,
uint256[] memory scheduleRewards
| 34,177 |
282 | // Check reduceAmount โค reserves[n] (totalReserves) | if (reduceAmount > totalReserves) {
return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);
}
| if (reduceAmount > totalReserves) {
return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);
}
| 17,408 |
6 | // Returns the pricing premium in wei. / | function premium(
string calldata name,
uint256 expires,
uint256 duration
| function premium(
string calldata name,
uint256 expires,
uint256 duration
| 21,158 |
80 | // in case of change sslp / | function approveSslpToTopDog(IERC20 _sslpToken) public onlyManager {
TransferHelper.safeApprove(address(_sslpToken), address(topDog), type(uint256).max);
}
| function approveSslpToTopDog(IERC20 _sslpToken) public onlyManager {
TransferHelper.safeApprove(address(_sslpToken), address(topDog), type(uint256).max);
}
| 29,452 |
15 | // announcement of a new/bidder address of the bidder | event BidMade(address bidder);
| event BidMade(address bidder);
| 31,862 |
4 | // _key The key for the record | function getUint(bytes32 _key) external view returns (uint) {
return uintStorage[_key];
}
| function getUint(bytes32 _key) external view returns (uint) {
return uintStorage[_key];
}
| 1,388 |
162 | // return result Square root of the number / | function sqrt(uint256 x) private pure returns (uint256 result) {
result = x;
uint256 k = x.div(2).add(1);
while (k < result) (result, k) = (k, x.div(k).add(k).div(2));
}
| function sqrt(uint256 x) private pure returns (uint256 result) {
result = x;
uint256 k = x.div(2).add(1);
while (k < result) (result, k) = (k, x.div(k).add(k).div(2));
}
| 9,817 |
23 | // Initialize the rewardInTelosToTransfer | uint256 rewardInTelosToTransfer;
for (uint256 i = 0; i < _ticketIds.length; i++) {
require(_pools[i] < 6, "Pool out of range");
uint256 thisTicketId = _ticketIds[i];
require(
_lotteries[_lotteryId].firstTicketIdNextLottery > thisTicketId,
... | uint256 rewardInTelosToTransfer;
for (uint256 i = 0; i < _ticketIds.length; i++) {
require(_pools[i] < 6, "Pool out of range");
uint256 thisTicketId = _ticketIds[i];
require(
_lotteries[_lotteryId].firstTicketIdNextLottery > thisTicketId,
... | 32,625 |
309 | // Stake `stakingToken()` and lock your position for a period of time to boost your rewards./ When you call this function, you'll receive an an NFT representing your staked position./ You can present your NFT to `getReward` or `unstake` to claim rewards or unstake your tokens/ respectively. Rewards vest over a schedule... | function stakeWithLockup(uint256 amount, LockupPeriod lockupPeriod)
external
nonReentrant
whenNotPaused
updateReward(0)
| function stakeWithLockup(uint256 amount, LockupPeriod lockupPeriod)
external
nonReentrant
whenNotPaused
updateReward(0)
| 72,846 |
2,688 | // 1345 | entry "unsentimentalized" : ENG_ADJECTIVE
| entry "unsentimentalized" : ENG_ADJECTIVE
| 17,957 |
23 | // Change issue contract owner / | function changeIssueManager(address _newIssueManager) public onlyContractOwner {
isNewRound();
if (_newIssueManager != issueManager) {
issueManager = _newIssueManager;
} else {
revert();
}
}
| function changeIssueManager(address _newIssueManager) public onlyContractOwner {
isNewRound();
if (_newIssueManager != issueManager) {
issueManager = _newIssueManager;
} else {
revert();
}
}
| 45,894 |
95 | // Adds a int256 value to the request with a given key name self The initialized request key The name of the key value The int256 value to add / | function addInt(
Request memory self,
string memory key,
int256 value
)
internal
pure
| function addInt(
Request memory self,
string memory key,
int256 value
)
internal
pure
| 66,840 |
43 | // Derive ConsiderationItem type hash using corresponding type string. | considerationItemTypehash = keccak256(considerationItemTypeString);
bytes memory orderTypeString = bytes.concat(
orderComponentsPartialTypeString,
considerationItemTypeString,
offerItemTypeString
);
| considerationItemTypehash = keccak256(considerationItemTypeString);
bytes memory orderTypeString = bytes.concat(
orderComponentsPartialTypeString,
considerationItemTypeString,
offerItemTypeString
);
| 21,294 |
24 | // totalSupply = totalSupply.add(_amount); | balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(msg.sender, _to, _amount);
return true;
| balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(msg.sender, _to, _amount);
return true;
| 8,098 |
48 | // create a snapshot of the current lender state | epochNAV = assessor.calcUpdateNAV();
epochReserve = assessor.totalBalance();
| epochNAV = assessor.calcUpdateNAV();
epochReserve = assessor.totalBalance();
| 32,198 |
9 | // List all supported token / | function supportedTokens() external view returns (address[] memory supportedTokens_) {
uint256 count = _supportedToken.length();
supportedTokens_ = new address[](count);
for (uint256 index = 0; index < count; ++index) supportedTokens_[index] = _supportedToken.at(index);
}
| function supportedTokens() external view returns (address[] memory supportedTokens_) {
uint256 count = _supportedToken.length();
supportedTokens_ = new address[](count);
for (uint256 index = 0; index < count; ++index) supportedTokens_[index] = _supportedToken.at(index);
}
| 11,540 |
106 | // Umbrella Rewards contract/ umb.network/ This contract allows to mint tokens and burn key (renounceOwnership)/Can be use used with MultiSig as owner | abstract contract MintableToken is Owned, ERC20, IBurnableToken {
using SafeMath for uint256;
// ========== STATE VARIABLES ========== //
uint256 public maxAllowedTotalSupply;
// ========== CONSTRUCTOR ========== //
constructor (uint256 _maxAllowedTotalSupply) {
require(_maxAllowedTotalS... | abstract contract MintableToken is Owned, ERC20, IBurnableToken {
using SafeMath for uint256;
// ========== STATE VARIABLES ========== //
uint256 public maxAllowedTotalSupply;
// ========== CONSTRUCTOR ========== //
constructor (uint256 _maxAllowedTotalSupply) {
require(_maxAllowedTotalS... | 5,008 |
0 | // single stake by user | struct Stake {
uint256 shares;
uint256 timestamp;
}
| struct Stake {
uint256 shares;
uint256 timestamp;
}
| 4,651 |
0 | // Interface of the Approvable tokens to be approved from SC. / | interface Approvable {
/**
* Sets `amount` as the allowance of `spender` over the `sender`'s tokens.
*/
function approveFrom(address sender, address spender, uint256 amount) external returns (bool);
}
| interface Approvable {
/**
* Sets `amount` as the allowance of `spender` over the `sender`'s tokens.
*/
function approveFrom(address sender, address spender, uint256 amount) external returns (bool);
}
| 41,066 |
39 | // INTERNAL METHOD // Actual adding the publicKey to list for a Name _id The ID of the Name _key The publicKey to be addedreturn true on success / | function _addKey(address _id, address _key) internal returns (bool) {
require (!this.isKeyExist(_id, _key));
keyToNameId[_key] = _id;
PublicKey storage _publicKey = publicKeys[_id];
_publicKey.keys.push(_key);
uint256 _nonce = _nameFactory.incrementNonce(_id);
require (_nonce > 0);
emit AddKey(_id, _... | function _addKey(address _id, address _key) internal returns (bool) {
require (!this.isKeyExist(_id, _key));
keyToNameId[_key] = _id;
PublicKey storage _publicKey = publicKeys[_id];
_publicKey.keys.push(_key);
uint256 _nonce = _nameFactory.incrementNonce(_id);
require (_nonce > 0);
emit AddKey(_id, _... | 30,049 |
31 | // slither-disable-next-line divide-before-multiply | uint256 feeAmount = (_quantity * bridgeFeePercentageInBase) /
bridgeFeeDivider;
| uint256 feeAmount = (_quantity * bridgeFeePercentageInBase) /
bridgeFeeDivider;
| 14,441 |
172 | // Creates an array of `size` by repeating provided address,to be required for passing to batch balance checking function of ERC1155 tokens. addr Address to be repeated `size` times in resulting array size Size of resulting array / | function makeArrayWithAddress(address addr, uint256 size)
internal
pure
returns (address[] memory)
| function makeArrayWithAddress(address addr, uint256 size)
internal
pure
returns (address[] memory)
| 28,777 |
9 | // https:docs.synthetix.io/contracts/source/contracts/pausable | contract Pausable is Owned {
uint public lastPauseTime;
bool public paused;
constructor() internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
// Paused will be false, and lastPauseTime will be 0 upon in... | contract Pausable is Owned {
uint public lastPauseTime;
bool public paused;
constructor() internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
// Paused will be false, and lastPauseTime will be 0 upon in... | 30,711 |
244 | // read current destination address voting power | uint256 _fromVal = getVotingPower(_to);
| uint256 _fromVal = getVotingPower(_to);
| 50,634 |
61 | // this current state of the asset; | bool isActive;
| bool isActive;
| 79,180 |
47 | // Converts a uint to int and checks if positive/_x Number to be converted | function toPositiveInt(uint _x) internal pure returns (int y) {
y = int(_x);
require(y >= 0, "int-overflow");
}
| function toPositiveInt(uint _x) internal pure returns (int y) {
y = int(_x);
require(y >= 0, "int-overflow");
}
| 2,570 |
276 | // initial + 20% of users funds | uint256 ownerStableAmount = (initialLiquidityStableLocal *
ONE_HUNDRED +
userStableTotalFunds *
STABLE_TOKEN_SHARE) / ONE_HUNDRED;
| uint256 ownerStableAmount = (initialLiquidityStableLocal *
ONE_HUNDRED +
userStableTotalFunds *
STABLE_TOKEN_SHARE) / ONE_HUNDRED;
| 43,903 |
8 | // y = minInterest + xe; | int256 xPowE = fixidity.power_any(x, e); //x**e
y = fixidity.add(minInterest, xPowE);
| int256 xPowE = fixidity.power_any(x, e); //x**e
y = fixidity.add(minInterest, xPowE);
| 34,084 |
23 | // The variable that indicates game status switching. | bool public toogleStatus = false;
| bool public toogleStatus = false;
| 2,494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.