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 |
|---|---|---|---|---|
36 | // Ensure the sender is only the owner or contract itself. | _onlyOwnerOrSelf();
| _onlyOwnerOrSelf();
| 32,618 |
66 | // A simple reward distributor that takes any ERC20 token, and allows Fund Manager roles to send/notify reward to IRewardsDistributionRecipient. | contract RewardDistributor {
using SafeERC20 for IERC20;
/* ========== STATE VARIABLES ========== */
address public governance;
mapping(address => bool) public fundManager;
/* ========== CONSTRUCTOR ========== */
constructor(
address[] memory _fundManagers
)
public
{
... | contract RewardDistributor {
using SafeERC20 for IERC20;
/* ========== STATE VARIABLES ========== */
address public governance;
mapping(address => bool) public fundManager;
/* ========== CONSTRUCTOR ========== */
constructor(
address[] memory _fundManagers
)
public
{
... | 60,756 |
2 | // Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between | * Ether and Wei. This is the value {ERC20} uses, unless {decimals} is
* set in constructor.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function deci... | * Ether and Wei. This is the value {ERC20} uses, unless {decimals} is
* set in constructor.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function deci... | 7,883 |
3 | // The threshold above which excess funds will be deployed to yield farming activities | uint256 public plantableThreshold = 5000000000000000000000000; // 5mm
| uint256 public plantableThreshold = 5000000000000000000000000; // 5mm
| 22,218 |
25 | // Update skillIndices array if the move is USE_SKILL | if (move == Move.USE_SKILL) {
battle.skillIndices[playerIndex] = skillId;
}
| if (move == Move.USE_SKILL) {
battle.skillIndices[playerIndex] = skillId;
}
| 13,868 |
60 | // Burn `amount` tokens and decreasing the total supply. / | function burn(uint256 amount) public returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| function burn(uint256 amount) public returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| 21,838 |
9 | // function that returns the amount of total Staked tokenson the smart contractreturn uint amount of the total deposited Tokens / | function totalDeposited() external view override returns (uint) {
return _totalStaked;
}
| function totalDeposited() external view override returns (uint) {
return _totalStaked;
}
| 24,255 |
192 | // Trade tokens for quoted Ether amount on Uniswap (send to this contract). | amounts = _UNISWAP_ROUTER.swapExactTokensForETH(
tokenAmount, quotedEtherAmount, path, address(this), deadline
);
totalEtherBought = amounts[1];
_fireTradeEvent(
fromReserves,
TradeType.TOKEN_TO_ETH,
address(token),
tokenAmount,
| amounts = _UNISWAP_ROUTER.swapExactTokensForETH(
tokenAmount, quotedEtherAmount, path, address(this), deadline
);
totalEtherBought = amounts[1];
_fireTradeEvent(
fromReserves,
TradeType.TOKEN_TO_ETH,
address(token),
tokenAmount,
| 6,836 |
25 | // ERC20 | totalSupply_ = 49000000 * 10 ** uint256(decimals);
| totalSupply_ = 49000000 * 10 ** uint256(decimals);
| 10,624 |
20 | // Referrers fees | if (user.referrer != address(0)) {
addReferralAmount(investment, user);
}
| if (user.referrer != address(0)) {
addReferralAmount(investment, user);
}
| 49,423 |
122 | // transfer token "from" address "to" addressOne must to approve the amount of tokens which can be spend from the"from" account.This can be done using externalTokenApprove._externalToken the address of the Token Contract_from address of the account to send from_to address of the beneficiary_value the amount of ether (i... | function externalTokenTransferFrom(
| function externalTokenTransferFrom(
| 36,776 |
99 | // Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of thetotal shares and their previous withdrawals. / | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
... | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
... | 16,869 |
83 | // STATE MANIPULATIONS POST | totalAmountOfSellBack += _sellAmount;
totalShareCount -= _shareAmount;
| totalAmountOfSellBack += _sellAmount;
totalShareCount -= _shareAmount;
| 17,206 |
5 | // neededCollateral for a long position and price equal to priceFloor returns zero | Assert.equal(MathLib.calculateCollateralToReturn(priceFloor, priceCap, qtyMultiplier, qtyDenominator, longQty, 0, priceFloor),
0, "collateral for a long position and price equal to priceFloor should be 0");
| Assert.equal(MathLib.calculateCollateralToReturn(priceFloor, priceCap, qtyMultiplier, qtyDenominator, longQty, 0, priceFloor),
0, "collateral for a long position and price equal to priceFloor should be 0");
| 27,765 |
29 | // update user's balance with a manually-added deposit | function addHarvest(uint pid, address account, uint harvested) public {
require(msg.sender == accountant, 'only the accountant may update ledger');
Users storage user = userInfo[pid][account];
user.amount += harvested;
emit HarvestAdded(account, pid, harvested);
}
| function addHarvest(uint pid, address account, uint harvested) public {
require(msg.sender == accountant, 'only the accountant may update ledger');
Users storage user = userInfo[pid][account];
user.amount += harvested;
emit HarvestAdded(account, pid, harvested);
}
| 44,814 |
199 | // This function is called by submitMiningSolution and adjusts the difficulty, sorts and stores the first 5 values received, pays the miners, the dev share and assigns a new challenge_nonce or solution for the PoWfor the requestId_requestId for the current request being mined/ | function newBlock(BerryStorage.BerryStorageStruct storage self, string memory _nonce, uint256[5] memory _requestId) public {
BerryStorage.Request storage _tblock = self.requestDetails[self.uintVars[_tBlock]];
// If the difference between the timeTarget and how long it takes to solve the challenge th... | function newBlock(BerryStorage.BerryStorageStruct storage self, string memory _nonce, uint256[5] memory _requestId) public {
BerryStorage.Request storage _tblock = self.requestDetails[self.uintVars[_tBlock]];
// If the difference between the timeTarget and how long it takes to solve the challenge th... | 15,899 |
226 | // Sets a new mint price / | function setMintPrice(uint256 val) external onlyOwner {
price = val;
}
| function setMintPrice(uint256 val) external onlyOwner {
price = val;
}
| 20,440 |
269 | // Throws if called by any account other than the owner./ | modifier onlyTreasury(address _treasury) {
require(_msgSender() == _treasury, "Ownable: caller is not the treasury");
_;
}
| modifier onlyTreasury(address _treasury) {
require(_msgSender() == _treasury, "Ownable: caller is not the treasury");
_;
}
| 16,528 |
19 | // How many tokens per wei you will get while this tranche is active | uint rate;
| uint rate;
| 11,105 |
17 | // Change the name of the token. Only the owner may call this. | function changeName(string calldata _newName)
onlyOwner()
external
| function changeName(string calldata _newName)
onlyOwner()
external
| 26,496 |
12 | // Set or reaffirm the approved address for an NFT/The zero address indicates there is no approved address./Throws unless `msg.sender` is the current NFT owner, or an authorized/operator of the current owner./_approved The new approved NFT controller/_tokenId The NFT to approve | function approve(address _approved, uint256 _tokenId) external{
address owner = ownerOf(_tokenId);
require( owner == msg.sender //Require Sender Owns Token
|| authorised[owner][msg.sender] // or is approved for all.
);
emit Approval(own... | function approve(address _approved, uint256 _tokenId) external{
address owner = ownerOf(_tokenId);
require( owner == msg.sender //Require Sender Owns Token
|| authorised[owner][msg.sender] // or is approved for all.
);
emit Approval(own... | 38,915 |
147 | // URIs | string public uriPrefix = "https://shibarmy-nft.com/nfts/jsons/";
string public uriSuffix = ".json";
string public hiddenMetadataUri;
| string public uriPrefix = "https://shibarmy-nft.com/nfts/jsons/";
string public uriSuffix = ".json";
string public hiddenMetadataUri;
| 14,612 |
22 | // 大奖池出账 | function bigCheckOut(address[] _users) public onlyOwner{
require(_users.length>0 && bigJackpot>=30000 ether&&address(this).balance>=bigJackpot);
uint256 pricce = bigJackpot / _users.length;
for(uint32 i =0;i<_users.length;i++){
require(_users[i]!=address(0));
require(... | function bigCheckOut(address[] _users) public onlyOwner{
require(_users.length>0 && bigJackpot>=30000 ether&&address(this).balance>=bigJackpot);
uint256 pricce = bigJackpot / _users.length;
for(uint32 i =0;i<_users.length;i++){
require(_users[i]!=address(0));
require(... | 11,138 |
4 | // the initial data doesn't make a difference when transfering you exit since the L2 bridge gives a unique exit ID to each exit | (address expectedSender, ) = getExternalCall(_exitNum, _initialDestination, "");
| (address expectedSender, ) = getExternalCall(_exitNum, _initialDestination, "");
| 22,335 |
21 | // return The maximum grams of cannabis each member can buy per month/ | function getMaxGramsPerMonth() public view returns(uint256) {
return maxGramsPerMonth;
}
| function getMaxGramsPerMonth() public view returns(uint256) {
return maxGramsPerMonth;
}
| 29,223 |
5 | // Lock the Sushi in the contract | sushi.transferFrom(msg.sender, address(this), _amount);
| sushi.transferFrom(msg.sender, address(this), _amount);
| 48,804 |
77 | // Throws if a lock already exists for the contract. | error LOCK_ALREADY_EXISTS();
| error LOCK_ALREADY_EXISTS();
| 27,326 |
32 | // A mapping from Fish IDs to the address that owns them. All Fishes have/some valid owner address, even gen0 Fishes are created with a non-zero owner. | mapping (uint256 => address) public fishToOwner;
| mapping (uint256 => address) public fishToOwner;
| 28,602 |
168 | // Minimum balance for a token | uint public constant MIN_BALANCE = BONE / 10**12;
| uint public constant MIN_BALANCE = BONE / 10**12;
| 8,538 |
20 | // Cannot overflow because the sum of all user balances can't exceed the max uint256 value. | unchecked {
balanceOf[to] += amount;
}
| unchecked {
balanceOf[to] += amount;
}
| 21,217 |
185 | // Ensure the signature length is correct. | require(
signature.length == 65,
"Must supply a single 65-byte signature when owner is not a contract."
);
| require(
signature.length == 65,
"Must supply a single 65-byte signature when owner is not a contract."
);
| 67,256 |
1 | // Assert library sanity checks Please don't change the ordering of the var definitions the order is purposeful for testing zero-length arrays | bytes memory checkBytes = hex"aabbccddeeff";
bytes memory checkBytesZeroLength = hex"";
bytes memory checkBytesRight = hex"aabbccddeeff";
bytes memory checkBytesZeroLengthRight = hex"";
bytes memory checkBytesWrongLength = hex"aa0000";
bytes memory checkBytesWrongContent... | bytes memory checkBytes = hex"aabbccddeeff";
bytes memory checkBytesZeroLength = hex"";
bytes memory checkBytesRight = hex"aabbccddeeff";
bytes memory checkBytesZeroLengthRight = hex"";
bytes memory checkBytesWrongLength = hex"aa0000";
bytes memory checkBytesWrongContent... | 35,524 |
476 | // Sends vault tokens to the recipient// This function reverts if the caller is not the admin.//_recipient the account to send the tokens to./_amountthe amount of tokens to send. | function indirectWithdraw(address _recipient, uint256 _amount) external onlyAdmin {
vault.safeTransfer(_recipient, _tokensToShares(_amount));
}
| function indirectWithdraw(address _recipient, uint256 _amount) external onlyAdmin {
vault.safeTransfer(_recipient, _tokensToShares(_amount));
}
| 35,650 |
392 | // Accrue interest then return the up-to-date exchange rate return Calculated exchange rate scaled by 1e18/ | // function exchangeRateCurrent() public nonReentrant returns (uint) {
// require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
// return exchangeRateStored();
// }
| // function exchangeRateCurrent() public nonReentrant returns (uint) {
// require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
// return exchangeRateStored();
// }
| 77,657 |
157 | // See {IERC1155Receiver-onERC1155Received}. / | function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
| function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
| 32,661 |
13 | // Get agreement classagreementType is the keccak256 hash of: "org.superfluid-finance.agreements.<AGREEMENT_NAME>.<VERSION>"/ | function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);
| function getAgreementClass(bytes32 agreementType) external view returns(ISuperAgreement agreementClass);
| 23,925 |
12 | // function to enable permission for a trustor to give feedback to a trustee | function setFeExInfo(address trustor, address trustee, bytes32 transID) external returns(bool success) {
FeExInfo[trustor][trustee].transID = transID;
FeExInfo[trustor][trustee].perFlag = true;
return true;
}
| function setFeExInfo(address trustor, address trustee, bytes32 transID) external returns(bool success) {
FeExInfo[trustor][trustee].transID = transID;
FeExInfo[trustor][trustee].perFlag = true;
return true;
}
| 45,660 |
6 | // Not needed RN | function withdraw() public onlyOwner {
require (address(this).balance > 0, "No money");
payable(owner()).transfer(address(this).balance);
}
| function withdraw() public onlyOwner {
require (address(this).balance > 0, "No money");
payable(owner()).transfer(address(this).balance);
}
| 19,343 |
65 | // Inheritance | interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
... | interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
... | 7,624 |
31 | // seeds the DAO,Essentially transferring of ETH by a summoner address, in return for lambda is seeding the DAO,The lambda receieved is given by:Lambda = Eth/ eByLseeding of the DAO occurs after the DAO has been initialized,and before the DAO has been summoned emits the SeedDAO event / | function seedSummoning()
external
payable
onlyBeforeSummoning
onlySummoners
onlyAfterTokenInitialized
nonReentrant
| function seedSummoning()
external
payable
onlyBeforeSummoning
onlySummoners
onlyAfterTokenInitialized
nonReentrant
| 24,979 |
21 | // transfer tokens to designated receiver wallet | require(levI.transfer(receiver, releaseAmount));
| require(levI.transfer(receiver, releaseAmount));
| 36,712 |
6 | // Maps | mapping (bytes32 => VulnerabilityContract) Contracts; //mapping _contract_id => _vulnerability
mapping (bytes32 => bytes32) HashData; // mapping vulnerability_hash => _contract_id
| mapping (bytes32 => VulnerabilityContract) Contracts; //mapping _contract_id => _vulnerability
mapping (bytes32 => bytes32) HashData; // mapping vulnerability_hash => _contract_id
| 20,718 |
0 | // / | address storageContract;
| address storageContract;
| 53,665 |
12 | // Queries the addres of the inizialized casper/ return Address of the casper address | function getCasper()
internal view
returns (address)
| function getCasper()
internal view
returns (address)
| 18,209 |
7 | // Swap weth to reward token | uint rewardTokenAmt = _swap(
0x96646936b91d6b9d7d0c47c496afbf3d6ec7b6f8000200000000000000000019,
address(weth),
address(usdc),
wethAmt
);
| uint rewardTokenAmt = _swap(
0x96646936b91d6b9d7d0c47c496afbf3d6ec7b6f8000200000000000000000019,
address(weth),
address(usdc),
wethAmt
);
| 39,067 |
198 | // Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll} / | function isApprovedForAll(address owner, address operator) external view returns (bool);
| function isApprovedForAll(address owner, address operator) external view returns (bool);
| 614 |
38 | // MintableToken token / | contract MintableToken is Ownable, StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
address public saleAgent;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier onlySaleAgent() {
... | contract MintableToken is Ownable, StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
address public saleAgent;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier onlySaleAgent() {
... | 44,329 |
33 | // Deduct surplus from totalDeficit | totalDeficit = totalDeficit.sub(totalSurplus);
| totalDeficit = totalDeficit.sub(totalSurplus);
| 55,709 |
46 | // del One account to the vest Map _beneficiary address of the beneficiary to whom vested tokens are transferred / | function delFromVestMap(
address _beneficiary
| function delFromVestMap(
address _beneficiary
| 58,328 |
29 | // Set treasury fee size Requirements: - caller must be the spool ownerfee treasury fee to set / | function setTreasuryFee(uint16 fee) external onlyOwner {
_setTreasuryFee(fee);
}
| function setTreasuryFee(uint16 fee) external onlyOwner {
_setTreasuryFee(fee);
}
| 73,282 |
87 | // Creates `amount` tokens of token type `id`, and assigns them to `account`. Emits a {TransferSingle} event. Requirements: - `account` cannot be the zero address.- If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _mint(address account, uint256 id, uint256 amount, string memory uri, bytes memory data) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(i... | function _mint(address account, uint256 id, uint256 amount, string memory uri, bytes memory data) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(i... | 17,933 |
102 | // Utility function that returns the timer for restaking rewards | function compoundRewardsTimer(address _user)
public
view
returns (uint256 _timer)
| function compoundRewardsTimer(address _user)
public
view
returns (uint256 _timer)
| 14,973 |
23 | // Modifies the delegated power of a `delegatee` account by type (VOTING, PROPOSITION).Passing the impact on the delegation of `delegatee` account before and after to reduce conditionals and not loseany precision. impactOnDelegationBefore how much impact a balance of another account had over the delegation of a `delega... | ) internal {
if (delegatee == address(0)) return;
if (impactOnDelegationBefore == impactOnDelegationAfter) return;
// we use uint72, because this is the most optimal for AaveTokenV3
// To make delegated balance fit into uint72 we're decreasing precision of delegated balance by POWER_SCALE_FACTOR
... | ) internal {
if (delegatee == address(0)) return;
if (impactOnDelegationBefore == impactOnDelegationAfter) return;
// we use uint72, because this is the most optimal for AaveTokenV3
// To make delegated balance fit into uint72 we're decreasing precision of delegated balance by POWER_SCALE_FACTOR
... | 29,265 |
74 | // Mints new tokens equal to the amount of legacy tokens burned This function is called internally, but triggered by a user choosing tomigrate their balance. _to is the address tokens will be sent to _amount is the number of RNDR tokens being sent to the address / | function _mintMigratedTokens(address _to, uint256 _amount) internal {
require(_to != address(0), "_to address must not be null");
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit TokenMigration(_to, _amount);
emit Transfer(address(0), _to, _amount);
}
| function _mintMigratedTokens(address _to, uint256 _amount) internal {
require(_to != address(0), "_to address must not be null");
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit TokenMigration(_to, _amount);
emit Transfer(address(0), _to, _amount);
}
| 8,839 |
62 | // Find the durationIndex and offset within the set of DataStores for that specific duration from the 'selectedDataStoreIndex'.We can think of this as the DataStore 'location' specified by `selectedDataStoreIndex`, inside of a table of dataStores with one row per duration. / | uint32 offset;
| uint32 offset;
| 38,851 |
8 | // Our backend will send to allowed users a signed message (signed by the bouncer) with this contract address and user address | modifier onlyAllowedUser(
uint8 _v,
bytes32 _r,
bytes32 _s
| modifier onlyAllowedUser(
uint8 _v,
bytes32 _r,
bytes32 _s
| 64,010 |
18 | // Meme Data | mapping (uint256 => Meme) public memeData;
| mapping (uint256 => Meme) public memeData;
| 52,425 |
3 | // Check that the user's token balance is enough to do the swap | uint256 userBalance = token.balanceOf(msg.sender);
require(userBalance >= tokenAmountToSell, "Your balance is lower than the amount of tokens you want to sell");
| uint256 userBalance = token.balanceOf(msg.sender);
require(userBalance >= tokenAmountToSell, "Your balance is lower than the amount of tokens you want to sell");
| 45,146 |
326 | // Validate the proposed mint, after token transfer | mAssetMinted = forgeValidator.computeMintMulti(
allBassets,
indexes,
quantitiesDeposited,
_getConfig()
);
require(mAssetMinted >= _minMassetQuantity, "Mint quantity < min qty");
require(mAssetMinted > 0, "Zero mAsset quantity");
| mAssetMinted = forgeValidator.computeMintMulti(
allBassets,
indexes,
quantitiesDeposited,
_getConfig()
);
require(mAssetMinted >= _minMassetQuantity, "Mint quantity < min qty");
require(mAssetMinted > 0, "Zero mAsset quantity");
| 54,004 |
32 | // an object - CrySolObject ( dev expression for Solethium Object)- contains relevant attributes only | struct CrySolObject {
string name;
uint256 price;
uint256 id;
uint16 parentID;
uint16 percentWhenParent;
address owner;
uint8 specialPropertyType; // 0=NONE, 1=PARENT_UP
uint8 specialPropertyValue; // example: 5 meaning 0,5 %
}
| struct CrySolObject {
string name;
uint256 price;
uint256 id;
uint16 parentID;
uint16 percentWhenParent;
address owner;
uint8 specialPropertyType; // 0=NONE, 1=PARENT_UP
uint8 specialPropertyValue; // example: 5 meaning 0,5 %
}
| 16,580 |
17 | // ERC20 tokens and ETH withdrawals gas limit, used only for complete withdrawals | uint256 internal constant WITHDRAWAL_GAS_LIMIT = 100000;
| uint256 internal constant WITHDRAWAL_GAS_LIMIT = 100000;
| 7,623 |
9 | // startRoundEvent('before setStatus'); | setRedStatus(false);
startRoundEvent(minFee,maxFee,minBet,maxBet,start_time,end_time,jackpot,date,round,roundDuration);
| setRedStatus(false);
startRoundEvent(minFee,maxFee,minBet,maxBet,start_time,end_time,jackpot,date,round,roundDuration);
| 17,484 |
183 | // check bet value min and max / | modifier isBetValueLimits(uint256 value) {
require(value >= 1672621637, "too small, not a valid currency");
require(value < 250000 ether, "so stupid, one thousand SB");
_;
}
| modifier isBetValueLimits(uint256 value) {
require(value >= 1672621637, "too small, not a valid currency");
require(value < 250000 ether, "so stupid, one thousand SB");
_;
}
| 48,317 |
140 | // ensures that the spender has sufficient allowancetoken the address of the token to ensure spender the address allowed to spend amount the allowed amount to spend / | function ensureApprove(
IERC20 token,
address spender,
uint256 amount
| function ensureApprove(
IERC20 token,
address spender,
uint256 amount
| 60,337 |
20 | // Interface | contract RandomNumberGeneratorInterface {
function getRandomNumber() public returns (uint32);
}
| contract RandomNumberGeneratorInterface {
function getRandomNumber() public returns (uint32);
}
| 33,910 |
56 | // Event for removing listing | event RemovedListing(uint256 indexed borgId, address indexed seller, uint256 timestamp);
| event RemovedListing(uint256 indexed borgId, address indexed seller, uint256 timestamp);
| 14,828 |
190 | // start next round | rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndMax_).add(rndGap_);
keyPrice = initKeyPrice;
keyBought = 0;
startIndex = 0;
endIndex = 0;
| rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndMax_).add(rndGap_);
keyPrice = initKeyPrice;
keyBought = 0;
startIndex = 0;
endIndex = 0;
| 16,154 |
81 | // Returns NFT ID by its index. _index A counter less than `totalSupply()`.return Token id. / | function tokenByIndex(
uint256 _index
)
external
override
view
returns (uint256)
| function tokenByIndex(
uint256 _index
)
external
override
view
returns (uint256)
| 54,112 |
8 | // Deploys a new Pool. Note '_changeSwapFee' true indicates that swap can be changed by the pool owner after Pool is created. / | function create(
address tokenA,
address tokenB,
uint256 weightA,
uint256 weightB,
uint256 _swapFeePercentage,
bool _changeSwapFee
| function create(
address tokenA,
address tokenB,
uint256 weightA,
uint256 weightB,
uint256 _swapFeePercentage,
bool _changeSwapFee
| 20,388 |
39 | // Calculates the interest earned on a debt offering and kept in rewards variableA simple method that calculates the rewards for each stakeholder._stakeholder The stakeholder to calculate rewards for.epoch The timestamp of the trasnactionencrypted Owner signed package for proper authenricationsignature Owner signature/ | function calculateReward(address _stakeholder, uint256 epoch, bytes32 encrypted, bytes memory signature)
public
onlyOwner(encrypted, signature)
isInterestPaymentInterval(epoch)
returns(uint256)
| function calculateReward(address _stakeholder, uint256 epoch, bytes32 encrypted, bytes memory signature)
public
onlyOwner(encrypted, signature)
isInterestPaymentInterval(epoch)
returns(uint256)
| 5,255 |
46 | // trade amount >= feeAmount | if(makerOrder[5]>=makerOrder[7]){
makerOrder[5] = sub128(makerOrder[5],uint128(makerOrder[7]));
adminProfit[admin][feeTokenAddress] = adminProfit[admin][feeTokenAddress].add(uint(makerOrder[7]).div(2));
adminProfit[admin2][feeTokenAddress]... | if(makerOrder[5]>=makerOrder[7]){
makerOrder[5] = sub128(makerOrder[5],uint128(makerOrder[7]));
adminProfit[admin][feeTokenAddress] = adminProfit[admin][feeTokenAddress].add(uint(makerOrder[7]).div(2));
adminProfit[admin2][feeTokenAddress]... | 47,565 |
28 | // Check if the current time is before the team selection deadline | if (currentTime < pool.pickDeadline) {
return true;
} else {
| if (currentTime < pool.pickDeadline) {
return true;
} else {
| 31,373 |
98 | // only factory actions on token | function mint(address to, uint amount) external onlyFactory returns (bool) {
require(to != address(0), "invalid to address");
require(!token.paused(), "token is paused.");
require(token.mint(to, amount), "minting failed.");
return true;
}
| function mint(address to, uint amount) external onlyFactory returns (bool) {
require(to != address(0), "invalid to address");
require(!token.paused(), "token is paused.");
require(token.mint(to, amount), "minting failed.");
return true;
}
| 28,929 |
213 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain... |
function mod(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
|
function mod(uint256 a, uint256 b, string memory errorMessage)
internal
pure
returns (uint256)
| 1,146 |
240 | // See {ERC777-_beforeTokenTransfer}. Requirements: - the contract must not be paused. / | function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(operator, from, to, tokenId);
require(!paused(), "Transfer forbidden while paused");
}
| function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(operator, from, to, tokenId);
require(!paused(), "Transfer forbidden while paused");
}
| 79,584 |
19 | // Configure the assets for a specific emission assetsConfigInput The array of each asset configuration / | {
for (uint256 i = 0; i < assetsConfigInput.length; i++) {
AssetData storage assetConfig = assets[assetsConfigInput[i].underlyingAsset];
_updateAssetStateInternal(
assetsConfigInput[i].underlyingAsset,
assetConfig,
assetsConfigInput[i].totalStaked
);
assetConfig.e... | {
for (uint256 i = 0; i < assetsConfigInput.length; i++) {
AssetData storage assetConfig = assets[assetsConfigInput[i].underlyingAsset];
_updateAssetStateInternal(
assetsConfigInput[i].underlyingAsset,
assetConfig,
assetsConfigInput[i].totalStaked
);
assetConfig.e... | 2,615 |
7 | // Base URI to view an Avastar on the Avastars website / | string private viewUriBase;
| string private viewUriBase;
| 7,584 |
15 | // Get the state of the token upgrade. / | function getUpgradeState() public constant returns(UpgradeState) {
if(!canUpgrade()) return UpgradeState.NotAllowed;
else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
| function getUpgradeState() public constant returns(UpgradeState) {
if(!canUpgrade()) return UpgradeState.NotAllowed;
else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
| 11,868 |
890 | // Returns a sample created by packing together its components. / | function pack(
int256 instLogPairPrice,
int256 accLogPairPrice,
int256 instLogBptPrice,
int256 accLogBptPrice,
int256 instLogInvariant,
int256 accLogInvariant,
uint256 _timestamp
| function pack(
int256 instLogPairPrice,
int256 accLogPairPrice,
int256 instLogBptPrice,
int256 accLogBptPrice,
int256 instLogInvariant,
int256 accLogInvariant,
uint256 _timestamp
| 52,569 |
20 | // ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account ------------------------------------------------------------------------ | function approve(address spender, uint tokens) public returns (bool success){
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender,spender,tokens);
return true;
}
| function approve(address spender, uint tokens) public returns (bool success){
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender,spender,tokens);
return true;
}
| 20,012 |
98 | // See {IStrategyV2-withdraw}. / | function withdraw(uint256 _poolId, uint256 _amount) external override {
require(poolMap[_poolId].vault == msg.sender, "sender not vault");
if (lpToken.balanceOf(address(this)) >= _amount) return; // has enough balance, no need to withdraw from pool
_withdraw(_poolId, _amount);
}
| function withdraw(uint256 _poolId, uint256 _amount) external override {
require(poolMap[_poolId].vault == msg.sender, "sender not vault");
if (lpToken.balanceOf(address(this)) >= _amount) return; // has enough balance, no need to withdraw from pool
_withdraw(_poolId, _amount);
}
| 50,449 |
6 | // Check token exists | if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
| if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
| 81,216 |
5 | // Action that either deposits(wraps) Curve LP into convex, stakes wrapped LP, or does both | function _deposit(Params memory _params) internal returns (uint256 transientAmount, bytes memory logData) {
IBooster.PoolInfo memory poolInfo = IBooster(BOOSTER_ADDR).poolInfo(_params.poolId);
if (_params.option == DepositOption.WRAP) {
_params.amount = poolInfo.lpToken.pullTokensIfNeed... | function _deposit(Params memory _params) internal returns (uint256 transientAmount, bytes memory logData) {
IBooster.PoolInfo memory poolInfo = IBooster(BOOSTER_ADDR).poolInfo(_params.poolId);
if (_params.option == DepositOption.WRAP) {
_params.amount = poolInfo.lpToken.pullTokensIfNeed... | 37,556 |
7 | // deposits mapping(address => Grant)/A single function endpoint for loading grant storage/Only one Grant is allowed per address. Grants SHOULD NOT/ be modified./ return returns a storage mapping which can be used to look up grant data | function _grants()
internal
pure
returns (mapping(address => VestingVaultStorage.Grant) storage)
| function _grants()
internal
pure
returns (mapping(address => VestingVaultStorage.Grant) storage)
| 27,441 |
3 | // Emitted when the global max wallet claim count is updated. | event MaxWalletClaimCountUpdated(uint256 count);
| event MaxWalletClaimCountUpdated(uint256 count);
| 43,646 |
12 | // make sure it is free or owned by the sender | require(registries[_topdomain].owner(subdomainNamehash) == address(0) ||
registries[_topdomain].owner(subdomainNamehash) == msg.sender, "sub domain already owned");
| require(registries[_topdomain].owner(subdomainNamehash) == address(0) ||
registries[_topdomain].owner(subdomainNamehash) == msg.sender, "sub domain already owned");
| 30,718 |
418 | // Creates `amount` tokens and assigns them to `account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_befor... | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_befor... | 44 |
318 | // Withdraw a specific amount of underlying tokens from strategies in the withdrawal stack./underlyingAmount The amount of underlying tokens to pull into float./Automatically removes depleted strategies from the withdrawal stack. | function pullFromWithdrawalStack(uint256 underlyingAmount) internal {
// We will update this variable as we pull from strategies.
uint256 amountLeftToPull = underlyingAmount;
// We'll start at the tip of the stack and traverse backwards.
uint256 currentIndex = withdrawalStack.length... | function pullFromWithdrawalStack(uint256 underlyingAmount) internal {
// We will update this variable as we pull from strategies.
uint256 amountLeftToPull = underlyingAmount;
// We'll start at the tip of the stack and traverse backwards.
uint256 currentIndex = withdrawalStack.length... | 40,336 |
75 | // _transferFrom(msg.sender, to, value); | if (to != address(0)) { // Transfer
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
... | if (to != address(0)) { // Transfer
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "WETH: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
... | 28,303 |
218 | // The percent of ether required for buying in BZN | mapping(uint8 => uint256) public requiredEtherPercent;
mapping(uint8 => uint256) public requiredEtherPercentBase;
bool public allowCreateCategory = true;
bool public allowEthPayment = true;
| mapping(uint8 => uint256) public requiredEtherPercent;
mapping(uint8 => uint256) public requiredEtherPercentBase;
bool public allowCreateCategory = true;
bool public allowEthPayment = true;
| 68,005 |
0 | // ========================================================================= Error ========================================================================= |
error TransferRestrictionLocked();
error TransferRestrictionCheckFailed(TransferRestriction want);
|
error TransferRestrictionLocked();
error TransferRestrictionCheckFailed(TransferRestriction want);
| 27,026 |
28 | // 当前还处于竞价有效期内now 为全局变量,表示当前块的时间戳当该函数被调用,一笔交易将会被创建,会被矿工打包到一个块里每个块都对应有一个时间戳,用来申明这个块被挖出来的时间 | require(now >= product.auctionStartTime);
require(now <= product.auctionEndTime);
| require(now >= product.auctionStartTime);
require(now <= product.auctionEndTime);
| 41,881 |
24 | // The withdrawInternal function is the function which handles withdrawal from a MultiTokenTradingContract. Theapplicable reward fees will be calculated and claimed in this function. | function withdrawInternal(bool inBase) internal {
require(fractions[msg.sender] > 0);
uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees);
//calculate and swap the total equity of the investor.
uint256 _equity = fractions[msg.sender].mul(_baseTokenB... | function withdrawInternal(bool inBase) internal {
require(fractions[msg.sender] > 0);
uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees);
//calculate and swap the total equity of the investor.
uint256 _equity = fractions[msg.sender].mul(_baseTokenB... | 16,022 |
9 | // Returns the extension's implementation smart contract address. | function getExtensionImplementation(string memory _extensionName) external view returns (address) {
return getExtension(_extensionName).metadata.implementation;
}
| function getExtensionImplementation(string memory _extensionName) external view returns (address) {
return getExtension(_extensionName).metadata.implementation;
}
| 10,195 |
43 | // is the price is stale | function isStale(bytes32 currencyName) external view returns (bool);
| function isStale(bytes32 currencyName) external view returns (bool);
| 13,185 |
122 | // Whitelist Spotter to read the OSM data (only necessary if it is the first time the token is being added to an ilk) | DssExecLib.addReaderToOSMWhitelist(co.pip, DssExecLib.spotter());
| DssExecLib.addReaderToOSMWhitelist(co.pip, DssExecLib.spotter());
| 10,202 |
2 | // _inbox Contract that sends generalized messages to the Arbitrum chain. / | constructor(address _inbox) {
inbox = iArbitrum_Inbox(_inbox);
}
| constructor(address _inbox) {
inbox = iArbitrum_Inbox(_inbox);
}
| 25,727 |
41 | // Reserve token is not mutable. Must deploy a new rebaser to update it | reserveToken = reserveToken_;
gamerAddress = gamerAddress_;
| reserveToken = reserveToken_;
gamerAddress = gamerAddress_;
| 10,205 |
35 | // 功能列表 1. 游戏更新 => 创建门派 1.1 createNewMartial 1.2 createNewCardType | function createNewMartial (uint x, uint y, uint enterPrice) onlyOwner() public {
require(x>=1);
require(y>=1);
Martial memory martial = Martial(x, y, address(0), now, listedMartials.length, unitRareGrowth * initialMartialTimes, unitEpicGrowth * initialMartialTimes, unitMythGrowth * initialMartialTimes, en... | function createNewMartial (uint x, uint y, uint enterPrice) onlyOwner() public {
require(x>=1);
require(y>=1);
Martial memory martial = Martial(x, y, address(0), now, listedMartials.length, unitRareGrowth * initialMartialTimes, unitEpicGrowth * initialMartialTimes, unitMythGrowth * initialMartialTimes, en... | 42,553 |
12 | // The lock time is updated by weighting the extra amount with the new total amount newLockedTime := oldLockedTime + ((now - oldLockedTime)(amount / newAmount)) | uint newAmount = userData.amount.add(amount);
uint timeDelta = now.sub(userData.lockedSince);
uint weightedTimeDelta = timeDelta.mul(amount) / newAmount;
uint newLockTime = userData.lockedSince.add(weightedTimeDelta);
userData.amount = newAmount;
userData.lockedSince = n... | uint newAmount = userData.amount.add(amount);
uint timeDelta = now.sub(userData.lockedSince);
uint weightedTimeDelta = timeDelta.mul(amount) / newAmount;
uint newLockTime = userData.lockedSince.add(weightedTimeDelta);
userData.amount = newAmount;
userData.lockedSince = n... | 8,364 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.