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
15
// Ensure that the buyer has not already been a buyer of the product
require(buyerStatus[product_id][address(msg.sender)] == PurchaseState.Default);
require(buyerStatus[product_id][address(msg.sender)] == PurchaseState.Default);
1,195
201
// Grant the contract deployer the default admin role: it will be able to grant and revoke any roles
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
16,019
105
// Update the given pool's BDO allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint) public onlyOwner { massUpdatePools(); totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; }
function set(uint256 _pid, uint256 _allocPoint) public onlyOwner { massUpdatePools(); totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; }
17,781
34
// Ensure that the encoded principal token address is valid
require(principalTokenAddress != address(0));
require(principalTokenAddress != address(0));
31,432
227
// Gets the integration for the module with the passed in name. Validates that the address is not empty /
function getAndValidateAdapter(string memory _integrationName) internal view returns(address) { bytes32 integrationHash = getNameHash(_integrationName); return getAndValidateAdapterWithHash(integrationHash); }
function getAndValidateAdapter(string memory _integrationName) internal view returns(address) { bytes32 integrationHash = getNameHash(_integrationName); return getAndValidateAdapterWithHash(integrationHash); }
4,406
258
// returns the block number when the order being last modified.
function orderBlockNumber(bytes32 _orderID) external view returns (uint256) { return orders[_orderID].blockNumber; }
function orderBlockNumber(bytes32 _orderID) external view returns (uint256) { return orders[_orderID].blockNumber; }
78,821
219
// Allows the owner to change the spending fee percentage/feePercentage The new fee percentage
function setFeePercentage(uint256 feePercentage) external onlyOwner { awooFeePercentage = feePercentage; // We're intentionally allowing the fee percentage to be set to 0%, incase no fees need to be collected }
function setFeePercentage(uint256 feePercentage) external onlyOwner { awooFeePercentage = feePercentage; // We're intentionally allowing the fee percentage to be set to 0%, incase no fees need to be collected }
39,668
244
// supply of all properly locked BOOSTED balances at the given epoch
function totalSupplyAtEpoch(uint256 _epoch) external view returns (uint256 supply)
function totalSupplyAtEpoch(uint256 _epoch) external view returns (uint256 supply)
41,702
25
// generate the uniswap pair path of token -> WHT
address[] memory path = new address[](2); path[0] = address(this); path[1] = getBasePairAddr(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, ...
address[] memory path = new address[](2); path[0] = address(this); path[1] = getBasePairAddr(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, ...
26,328
217
// Returns the `TokenOwnership` struct at `tokenId` without reverting. If the `tokenId` is out of bounds:- `addr` = `address(0)`- `startTimestamp` = `0`- `burned` = `false`- `extraData` = `0` If the `tokenId` is burned:- `addr` = `<Address of owner before token was burned>`- `startTimestamp` = `<Timestamp when token wa...
function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership...
function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership...
29,080
7
// Evaluate current balance_address Address of investor return Payout amount/
function getUserBalance(address _address) view public returns (uint256) { Investor storage investor = investors[_address]; uint percent = getPhasePercent(); uint256 differentTime = now.sub(investor.paymentTime).div(step); uint256 differentPercent = investor.deposit.mul(percent).div(1...
function getUserBalance(address _address) view public returns (uint256) { Investor storage investor = investors[_address]; uint percent = getPhasePercent(); uint256 differentTime = now.sub(investor.paymentTime).div(step); uint256 differentPercent = investor.deposit.mul(percent).div(1...
14,856
69
// probably will never have more than 256 functions from one facet contract
require(numFacetSelectors[facetIndex] < 255); numFacetSelectors[facetIndex]++; continueLoop = true; break;
require(numFacetSelectors[facetIndex] < 255); numFacetSelectors[facetIndex]++; continueLoop = true; break;
34,016
5
// User struct for storing user related data. /
struct User { string pollId; address voter; }
struct User { string pollId; address voter; }
21,260
15
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping (address => uint256)) allowed; event Debug(string message, address addr, uint256 number);
mapping (address => mapping (address => uint256)) allowed; event Debug(string message, address addr, uint256 number);
3,243
3
// value of _baseLiability
function baseLiability() external view returns (uint256);
function baseLiability() external view returns (uint256);
11,398
54
// check whether the managerID is exist or not
function managerIDExist (uint _ManagerID) public view returns (bool) { for (uint c = 0; c < ManagerList.length; c++) { if(ManagerList[c] == _ManagerID) return true; } return false; }
function managerIDExist (uint _ManagerID) public view returns (bool) { for (uint c = 0; c < ManagerList.length; c++) { if(ManagerList[c] == _ManagerID) return true; } return false; }
51,863
10
// The actual amount of collateral provided to the protocol. This amount will be multiplied by the precision scalar if the token has less than 18 d.p /
uint256 internal totalSupplied;
uint256 internal totalSupplied;
48,518
30
// SafeBlocks @date 30/04/2018/
contract SafeBlocksFirewall { event EnquireResult(address sourceAddress, bool approved, address token, uint amount, address destination, uint blockNumber, string msg); event PolicyChanged(address contractAddress, address destination, address tokenAdress, uint limit); event ConfigurationChanged(address send...
contract SafeBlocksFirewall { event EnquireResult(address sourceAddress, bool approved, address token, uint amount, address destination, uint blockNumber, string msg); event PolicyChanged(address contractAddress, address destination, address tokenAdress, uint limit); event ConfigurationChanged(address send...
37,076
190
// Notifies the contract that reward has been added to be given. _reward uint Only ownercan call it Increases duration of rewards /
function notifyRewardAmount(uint256 _reward) external onlyOwner updateReward(address(0))
function notifyRewardAmount(uint256 _reward) external onlyOwner updateReward(address(0))
26,816
37
// Is there a contract with meta _meta. _hashData the hash of the vulnerability data /
function haveHashData(bytes32 _hashData) internal view returns (bool exists)
function haveHashData(bytes32 _hashData) internal view returns (bool exists)
43,944
83
// adding to whitelist has been disabled forever:
canWhitelist = false;
canWhitelist = false;
3,189
46
// contracts/interfaces/IStakeLocker.sol/ pragma solidity 0.6.11; // import "../token/interfaces/IStakeLockerFDT.sol"; /
interface IStakeLocker is IStakeLockerFDT { function stakeDate(address) external returns (uint256); function stake(uint256) external; function unstake(uint256) external; function pull(address, uint256) external; function setAllowlist(address, bool) external; function openStakeLockerToPubli...
interface IStakeLocker is IStakeLockerFDT { function stakeDate(address) external returns (uint256); function stake(uint256) external; function unstake(uint256) external; function pull(address, uint256) external; function setAllowlist(address, bool) external; function openStakeLockerToPubli...
55,886
5
// Withdraw ERC-20 tokens from user account to the current wallet address amount the amount of tokens being withdrawn /
function withdraw(uint256 amount) external { require(accounts[msg.sender].balance >= amount, "Insufficient funds"); require(plushApps.getAppExists(msg.sender) == false, "The wallet is a controller"); accounts[msg.sender].balance -= amount; require(plush.transfer(msg.sender, amount)...
function withdraw(uint256 amount) external { require(accounts[msg.sender].balance >= amount, "Insufficient funds"); require(plushApps.getAppExists(msg.sender) == false, "The wallet is a controller"); accounts[msg.sender].balance -= amount; require(plush.transfer(msg.sender, amount)...
8,938
78
// The share left for the contract. This is an approximate value. The real value will be whatever is leftover after each winner is paid their share.
uint256 approxRevenueShare = g.bets[_loser] * revenueBps / 10_000; bool isSent; { uint256 totalWinnings = g.bets[_loser] - burnShare - approxRevenueShare; for (uint16 i = 0; i < winners.length; i++) { uint256 winnings = totalWinnings * g.bets[winnersPlay...
uint256 approxRevenueShare = g.bets[_loser] * revenueBps / 10_000; bool isSent; { uint256 totalWinnings = g.bets[_loser] - burnShare - approxRevenueShare; for (uint16 i = 0; i < winners.length; i++) { uint256 winnings = totalWinnings * g.bets[winnersPlay...
43,015
19
// emits an event when a call action is executed
event CallExecuted(address indexed from, address indexed to, bytes data);
event CallExecuted(address indexed from, address indexed to, bytes data);
33,797
79
// Update order status and fill amount, packing struct values. [denominator: 15 bytes] [numerator: 15 bytes] [isCancelled: 1 byte] [isValidated: 1 byte]
sstore( orderStatusSlot, or( OrderStatus_ValidatedAndNotCancelled, or( shl(OrderStatus_filledNumerator_offset, filledNumerator), shl(OrderStatus_filledDenominator_offset, denominator) ...
sstore( orderStatusSlot, or( OrderStatus_ValidatedAndNotCancelled, or( shl(OrderStatus_filledNumerator_offset, filledNumerator), shl(OrderStatus_filledDenominator_offset, denominator) ...
17,136
38
// ______ __ ____ ______ __ ____ ______ __ __ /\== \ /\ \ /\_\_\_\ /\___\ /\ \ /\ "-./\ /\__ \ /\ "-.\ \\ \_-/ \ \ \\/_/\_\/_\ \__\ \ \ \____\ \ \-./\ \\ \ \/\ \\ \ \-.\\ \_\\ \_\ /\_\/\_\\ \_____\\ \_____\\ \_\ \ \_\\ \_____\\ \_\\"\_\\/_/ \/_/ \/_/\/_/ \/_____/ \/_____/ \/_/\/_/ \/_____/ \/_/ \/_/ /Generation 1 Pixel...
contract Pixelmon is ERC721, Ownable { using Strings for uint256; /*/////////////////////////////////////////////////////////////// CONSTANTS //////////////////////////////////////////////////////////////*/ /// @dev Determines the order of the species for each tokenId, m...
contract Pixelmon is ERC721, Ownable { using Strings for uint256; /*/////////////////////////////////////////////////////////////// CONSTANTS //////////////////////////////////////////////////////////////*/ /// @dev Determines the order of the species for each tokenId, m...
47,932
28
// AirSwap Converter: Convert Fee Tokens /
contract Converter is Ownable, ReentrancyGuard, TokenPaymentSplitter { using SafeMath for uint256; using SafeERC20 for IERC20; address public wETH; address public swapToToken; address public immutable uniRouter; uint256 public triggerFee; mapping(address => address[]) private tokenPathMapping; eve...
contract Converter is Ownable, ReentrancyGuard, TokenPaymentSplitter { using SafeMath for uint256; using SafeERC20 for IERC20; address public wETH; address public swapToToken; address public immutable uniRouter; uint256 public triggerFee; mapping(address => address[]) private tokenPathMapping; eve...
13,918
17
// getter function to determine current auction id.return current batchId /
function getCurrentBatchId() public view returns (uint32) { // solhint-disable-next-line not-rely-on-time return uint32(now / BATCH_TIME); }
function getCurrentBatchId() public view returns (uint32) { // solhint-disable-next-line not-rely-on-time return uint32(now / BATCH_TIME); }
33,951
24
// Function is called after token transfer/transferFrom _from Sender address _to Receiver address _value Amount of tokens /
function onTokenTransfer(address _from, address _to, uint256 _value) external;
function onTokenTransfer(address _from, address _to, uint256 _value) external;
2,726
23
// Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to. /
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
31,449
56
// Retrieve the value of the attribute of the type with ID`attributeTypeID` on the account at `account`, assuming it is valid. account address The account to check for the given attribute value. attributeTypeID uint256 The ID of the attribute type to check for.return The attribute value if the attribute is valid, rever...
function getAttributeValue( address account, uint256 attributeTypeID ) external view returns (uint256);
function getAttributeValue( address account, uint256 attributeTypeID ) external view returns (uint256);
42,332
30
// Used to restrict usage for non-owner callers
modifier Owner() {if (msg.sender != owner) throw; _;}
modifier Owner() {if (msg.sender != owner) throw; _;}
10,779
27
// Owner can transfer ETH from contract to address to address amount 18 decimals (wei) /
function transferEthTo(address to, uint256 amount) public onlyOwner { require(address(this).balance > amount); /* Required code start */ // Get commission amount from marketplace uint256 commission = mp.calculatePlatformCommission(amount); require(address(this).balance > am...
function transferEthTo(address to, uint256 amount) public onlyOwner { require(address(this).balance > amount); /* Required code start */ // Get commission amount from marketplace uint256 commission = mp.calculatePlatformCommission(amount); require(address(this).balance > am...
37,493
166
// If a base URI is set (via {_setBaseURI}), it is added as a prefix to thetoken's own URI (via {_setTokenURI}). If there is a base URI but no token URI, the token's ID will be used asits URI when appending it to the base URI. This pattern for autogeneratedtoken URIs can lead to large gas savings. .Examples|===|`_setBa...
function tokenURI(uint256 tokenId) public view override virtual returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId];
function tokenURI(uint256 tokenId) public view override virtual returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId];
17,275
82
// Clear the lock.
function clearLock(address _holder) public onlyOwner returns (bool)
function clearLock(address _holder) public onlyOwner returns (bool)
14,099
122
// Overflows are incredibly unrealistic. balance overflow if current value + quantity > 1.56e77 (2256) - 1 updatedIndex overflows if _nextTokenId + quantity > 1.56e77 (2256) - 1
unchecked { _balances[to] += quantity; _owners[startTokenId] = to; uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe) {
unchecked { _balances[to] += quantity; _owners[startTokenId] = to; uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe) {
46,557
8
// The canonical signatures for block N are stored in the parent seal bitmap for block N+1.
bitmap |= getParentSealBitmap(blockNumber.add(1));
bitmap |= getParentSealBitmap(blockNumber.add(1));
12,568
60
// Divides two exponentials, returning a new exponential. (a/scale) / (b/scale) = (a/scale)(scale/b) = a/b,which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)/
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
25,614
287
// Payment splitter contract
address payable public splitter; address payable public owner;
address payable public splitter; address payable public owner;
3,138
38
// Mapping from unicorn ID to approval for GeneLab
mapping(uint256 => bool) private unicornApprovalsForGeneLab;
mapping(uint256 => bool) private unicornApprovalsForGeneLab;
28,111
387
// remove router
function removeRouter(address _router) external onlyOwner() { routers[_router] = false; emit untrackRouter(_router); }
function removeRouter(address _router) external onlyOwner() { routers[_router] = false; emit untrackRouter(_router); }
22,281
459
// add x^33(33! / 33!)
return res / 0x688589cc0e9505e2f2fee5580000000 + _x + (ONE << _precision);
return res / 0x688589cc0e9505e2f2fee5580000000 + _x + (ONE << _precision);
13,232
12
// When the promoter previously bought a license, give them the commission
promoterShare += license.promoterCommission;
promoterShare += license.promoterCommission;
16,709
63
// Atomically decreases the allowance granted to `spender` by the caller.
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {BEP20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of...
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {BEP20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of...
1,375
21
// Archanova accountStanisław Głogowski <[email protected]> /
abstract contract ArchanovaAccount { struct Device { bool isOwner; bool exists; bool existed; } mapping(address => Device) public devices; // events event DeviceAdded( address device, bool isOwner ); event DeviceRemoved( address device ); event TransactionExecuted( add...
abstract contract ArchanovaAccount { struct Device { bool isOwner; bool exists; bool existed; } mapping(address => Device) public devices; // events event DeviceAdded( address device, bool isOwner ); event DeviceRemoved( address device ); event TransactionExecuted( add...
39,983
140
// uint256 _value = msg.value;
uint256 _deposit = getClaimDeposit(); if (_deposit != 0){ if(msg.value < _deposit){ emit LogError(RScorr.Insolvent); return false; }
uint256 _deposit = getClaimDeposit(); if (_deposit != 0){ if(msg.value < _deposit){ emit LogError(RScorr.Insolvent); return false; }
38,953
161
// Bots call this method to repay for user when conditions are met/If the contract ownes gas token it will try and use it for gas price reduction/_data Amount and exchange data [amount, minPrice, exchangeType, gasCost, 0xPrice]/_addrData cTokens addreses and exchange [cCollAddress, cBorrowAddress, exchangeAddress]/_cal...
function repayFor( uint[5] memory _data, // amount, minPrice, exchangeType, gasCost, 0xPrice address[3] memory _addrData, // cCollAddress, cBorrowAddress, exchangeAddress bytes memory _callData, address _user
function repayFor( uint[5] memory _data, // amount, minPrice, exchangeType, gasCost, 0xPrice address[3] memory _addrData, // cCollAddress, cBorrowAddress, exchangeAddress bytes memory _callData, address _user
24,977
129
// Withdraw collateral based on given shares and the current share price.Transfer earned rewards to caller. Withdraw fee, if any, will be deduced fromgiven shares and transferred to feeCollector. Burn remaining shares and return collateral. shares Pool shares. It will be in 18 decimals. /
function withdraw(uint256 shares) external virtual nonReentrant whenNotShutdown { _withdraw(shares); }
function withdraw(uint256 shares) external virtual nonReentrant whenNotShutdown { _withdraw(shares); }
37,168
18
// Lock principal into escrow debtID id of the debt amount in HYDRO to lock /
function lockPrincipal(uint debtID, uint amount) public { SnowflakeInterface snowflake = SnowflakeInterface(snowflakeAddress); IdentityRegistryInterface identityRegistry = IdentityRegistryInterface(snowflake.identityRegistryAddress()); uint256 ein = identityRegistry.getEIN(msg.sender); ...
function lockPrincipal(uint debtID, uint amount) public { SnowflakeInterface snowflake = SnowflakeInterface(snowflakeAddress); IdentityRegistryInterface identityRegistry = IdentityRegistryInterface(snowflake.identityRegistryAddress()); uint256 ein = identityRegistry.getEIN(msg.sender); ...
44,842
138
// STORAGE //An array containing the Kitty struct for all Kitties in existence. The ID/of each cat is actually an index into this array. Note that ID 0 is a negacat,/the unKitty, the mythical beast that is the parent of all gen0 cats. A bizarre/creature that is both matron and sire... to itself! Has an invalid genetic ...
Kitty[] kitties;
Kitty[] kitties;
73,215
29
// 如果执行失败,则会回滚整个交易
require(balances[msg.sender] >= totalAmount); balances[msg.sender] = balances[msg.sender].sub(totalAmount); return true;
require(balances[msg.sender] >= totalAmount); balances[msg.sender] = balances[msg.sender].sub(totalAmount); return true;
62,482
5
// -- Curation --
function mintNSignal( address _graphAccount, uint256 _subgraphNumber, uint256 _tokensIn, uint256 _nSignalOutMin ) external; function burnNSignal( address _graphAccount,
function mintNSignal( address _graphAccount, uint256 _subgraphNumber, uint256 _tokensIn, uint256 _nSignalOutMin ) external; function burnNSignal( address _graphAccount,
22,351
1
// Beacon getter for the token contracts
function implementation() public view returns (address) { return tokenImplementation(); }
function implementation() public view returns (address) { return tokenImplementation(); }
6,578
4
// Pattern for deleting stuff from address arrays by address ✅
function deleteItemInAddressArray( address _ItemAddress, address[] storage _array
function deleteItemInAddressArray( address _ItemAddress, address[] storage _array
16,085
15
// reset allowance for AssetActor
uint256 allowance = IERC20(collateralToken).allowance(address(this), cecActor); require( IERC20(collateralToken).approve(cecActor, allowance.sub(notExecutedAmount)), "Custodian.returnCollateral: DECREASING_ALLOWANCE_FAILD" );
uint256 allowance = IERC20(collateralToken).allowance(address(this), cecActor); require( IERC20(collateralToken).approve(cecActor, allowance.sub(notExecutedAmount)), "Custodian.returnCollateral: DECREASING_ALLOWANCE_FAILD" );
46,880
44
// Allows investors to return their investments/
function returnEther() public { uint256 eth = 0; uint256 tokens = 0; require(canIWithdraw); if (!isItIco) { require(!returnStatusPre[msg.sender]); require(preInvestments[msg.sender] > 0); eth = preInvestments[msg.sender]; tokens = token...
function returnEther() public { uint256 eth = 0; uint256 tokens = 0; require(canIWithdraw); if (!isItIco) { require(!returnStatusPre[msg.sender]); require(preInvestments[msg.sender] > 0); eth = preInvestments[msg.sender]; tokens = token...
24,622
9
// 將ether退款給每位投資者
while(i <= numInvestors){ if(!investors[i].addr.send(investors[i].amount)){ throw; }
while(i <= numInvestors){ if(!investors[i].addr.send(investors[i].amount)){ throw; }
8,988
265
// Maximum allowed tokenSupply boundary. Can be extended by adding new stages.
uint256 internal _maxTotalSupply;
uint256 internal _maxTotalSupply;
10,257
25
// Update the name of the token newName The new name for the token /
function _setName(string memory newName) internal { _name = newName; }
function _setName(string memory newName) internal { _name = newName; }
25,436
5
// Token transfer not possible during mint. /
error MintTimeError();
error MintTimeError();
9,928
17
// calling this function requires ownership of ALL contracts of the T-REX suite
if( Ownable(_token).owner() != msg.sender || Ownable(_ir).owner() != msg.sender || Ownable(_mc).owner() != msg.sender || Ownable(_irs).owner() != msg.sender || Ownable(_ctr).owner() != msg.sender || Ownable(_tir).owner() != msg.sender) { ...
if( Ownable(_token).owner() != msg.sender || Ownable(_ir).owner() != msg.sender || Ownable(_mc).owner() != msg.sender || Ownable(_irs).owner() != msg.sender || Ownable(_ctr).owner() != msg.sender || Ownable(_tir).owner() != msg.sender) { ...
5,770
387
// Bid on the auction with the value sent/ together with this transaction./ The value will only be refunded if the/ auction is not won.
function bid(uint256 tokenId, uint256 bid_value) public nonReentrant { // Contracts cannot bid, because they can block the auction with a reentrant attack require(!msg.sender.isContract(), "No script kiddies"); // auction has to be opened require(auctions[tokenId].open, "No opened ...
function bid(uint256 tokenId, uint256 bid_value) public nonReentrant { // Contracts cannot bid, because they can block the auction with a reentrant attack require(!msg.sender.isContract(), "No script kiddies"); // auction has to be opened require(auctions[tokenId].open, "No opened ...
17,529
1,438
// Try to get the price from the optimistic oracle. This call will revert if the request has not resolved yet. If the request has not resolved yet, then we need to do additional checks to see if we should "forget" the pending proposal and allow new proposals to update the funding rate.
try optimisticOracle.settleAndGetPrice(identifier, proposalTime, ancillaryData) returns (int256 price) {
try optimisticOracle.settleAndGetPrice(identifier, proposalTime, ancillaryData) returns (int256 price) {
52,108
1
// Mints autoBTC with BTCB. _amount Amount of BTCB used to mint autoBTC. /
function mint(uint _amount) external;
function mint(uint _amount) external;
29,131
22
// When generalAvailabilityStartTime is not specified, default to now.
if (generalAvailabilityStartTime == 0) { generalAvailabilityStartTime = block.timestamp; } else if (generalAvailabilityStartTime.hasExpired()) {
if (generalAvailabilityStartTime == 0) { generalAvailabilityStartTime = block.timestamp; } else if (generalAvailabilityStartTime.hasExpired()) {
9,941
12
// Given two tokens, it'll return the tokens in the right order for the tokens pair TokenA must be different from TokenB, and both shouldn't be address(0), no validations tokenA address tokenB addressreturn sorted tokens /
function sortTokens(address tokenA, address tokenB) internal pure returns (address, address)
function sortTokens(address tokenA, address tokenB) internal pure returns (address, address)
31,184
0
// Struct to hold a specfic event
struct RunStat { string eventName; string timestamp; string place; string distance; string time; string description; }
struct RunStat { string eventName; string timestamp; string place; string distance; string time; string description; }
25,660
50
// Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
20,366
8
// Data describing the payout, ABI-encoded
bytes data; uint256 claimId; PayoutState state; uint256 createdAt; uint256 updatedAt;
bytes data; uint256 claimId; PayoutState state; uint256 createdAt; uint256 updatedAt;
4,602
98
// Calculates x^n where x and y are represented in RAY (27 decimals)/x base, represented in 27 decimals/n exponent, represented in 27 decimals/ return z x^n represented in 27 decimals
function rayPow(uint256 x, uint256 n) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := RAY } default { z := 0 } }...
function rayPow(uint256 x, uint256 n) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := RAY } default { z := 0 } }...
41,971
2
// Signature Function
function isValidSignature( bytes32 hash, address signerAddress, Types.Signature calldata signature ) external pure returns (bool isValid)
function isValidSignature( bytes32 hash, address signerAddress, Types.Signature calldata signature ) external pure returns (bool isValid)
31,396
128
// Method for call mint() in EXT ERC20 contract. mint() will be called for each record if amount of tokens > 0
function createTokens(tokens[8] memory _tokensArray) internal { for (uint i = 0; i < _tokensArray.length; i++) { if (_tokensArray[i].extAmount > 0) { token.mint( _tokensArray[i].beneficiary, _tokensArray[i].extAmount, _t...
function createTokens(tokens[8] memory _tokensArray) internal { for (uint i = 0; i < _tokensArray.length; i++) { if (_tokensArray[i].extAmount > 0) { token.mint( _tokensArray[i].beneficiary, _tokensArray[i].extAmount, _t...
14,121
18
// Insert to Database
_userSafes[msg.sender].push(_currentIndex); _safes[_currentIndex] = Safe( _currentIndex, amount, now + hodlingTime, msg.sender, tokenAddress, token.symbol(), data_amountbalance, data_cashbackbalance, now, percent, 0, 0, 0, 0, data_referrer);
_userSafes[msg.sender].push(_currentIndex); _safes[_currentIndex] = Safe( _currentIndex, amount, now + hodlingTime, msg.sender, tokenAddress, token.symbol(), data_amountbalance, data_cashbackbalance, now, percent, 0, 0, 0, 0, data_referrer);
48,955
43
// TokenMintERC20TokenStandard ERC20 token with burning and optional functions implemented.For full specification of ERC-20 standard see: /
contract TokenMintERC20Token is ERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Constructor. * @param name name of the token * @param symbol symbol of the token, 3-4 chars is recommended * @param decimals number of decimal places of one tok...
contract TokenMintERC20Token is ERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Constructor. * @param name name of the token * @param symbol symbol of the token, 3-4 chars is recommended * @param decimals number of decimal places of one tok...
4,065
3
// whitelist related
uint256 public wlPrice; // whitelist price per nft mapping(address => uint256) private _whitelist; function initialize( string memory _name, string memory _symbol, string memory _baseTokenURI, uint256 _generation, uint256 _kind
uint256 public wlPrice; // whitelist price per nft mapping(address => uint256) private _whitelist; function initialize( string memory _name, string memory _symbol, string memory _baseTokenURI, uint256 _generation, uint256 _kind
21,283
21
// Copy returndata into memory at 0x0....returndatasize. Note that this will overwrite the calldata that we just copied into memory but that doesn't really matter because we'll be returning in a second anyway.
returndatacopy(0x0, 0x0, returndatasize())
returndatacopy(0x0, 0x0, returndatasize())
559
176
// Reverts if the 'tokenId' has not been minted yet. /
function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); }
function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); }
26,000
20
// Make sure the user has at least one token staked before withdrawing
require( stakers[msg.sender].amountStaked > 0, "You have no tokens staked" );
require( stakers[msg.sender].amountStaked > 0, "You have no tokens staked" );
3,873
24
// We can now compute how much extra balance is being deposited and used in virtual swaps, and charge swap fees accordingly.
uint256 taxablePercentage = normalizedWeight.complement(); uint256 taxableAmount = amountInWithoutFee.mulUp(taxablePercentage); uint256 nonTaxableAmount = amountInWithoutFee.sub(taxableAmount); return nonTaxableAmount.add(taxableAmount.divUp(swapFee.complement()));
uint256 taxablePercentage = normalizedWeight.complement(); uint256 taxableAmount = amountInWithoutFee.mulUp(taxablePercentage); uint256 nonTaxableAmount = amountInWithoutFee.sub(taxableAmount); return nonTaxableAmount.add(taxableAmount.divUp(swapFee.complement()));
8,632
29
// 234166666+4166682 = 100000000
uint256 decimalValue = 10 ** uint256(decimals); uint256 oneMonthBalance = SafeMath.mul(4166666, decimalValue); uint256 unfrozenBalance = SafeMath.mul(nmonth, oneMonthBalance); frozenAccount[msg.sender] = totalFrozen - unfrozenBalance; uint256 toTransfer = frozenBalance - frozenAc...
uint256 decimalValue = 10 ** uint256(decimals); uint256 oneMonthBalance = SafeMath.mul(4166666, decimalValue); uint256 unfrozenBalance = SafeMath.mul(nmonth, oneMonthBalance); frozenAccount[msg.sender] = totalFrozen - unfrozenBalance; uint256 toTransfer = frozenBalance - frozenAc...
51,536
18
// who The address to query.return The balance of the specified address. /
function balanceOf(address who) public view override returns (uint256) { return _fragmentsToCaviar( _fragmentsBalances[who], who == address(lpPool) ? lpPoolScalingFactor : _debaseCaviarScalingFactor() ); }
function balanceOf(address who) public view override returns (uint256) { return _fragmentsToCaviar( _fragmentsBalances[who], who == address(lpPool) ? lpPoolScalingFactor : _debaseCaviarScalingFactor() ); }
27,163
66
// token utils
function exists(uint256 _tokenId) external view returns (bool); function getEditionIdOfToken(uint256 _tokenId) external pure returns (uint256 _editionId); function getEditionDetails(uint256 _tokenId) external view returns (address _originalCreator, address _owner, uint16 _size, uint256 _editionId, string...
function exists(uint256 _tokenId) external view returns (bool); function getEditionIdOfToken(uint256 _tokenId) external pure returns (uint256 _editionId); function getEditionDetails(uint256 _tokenId) external view returns (address _originalCreator, address _owner, uint16 _size, uint256 _editionId, string...
44,523
285
// Any data passed through by the caller via the IUniswapV3PoolActionsswap call
struct SwapCallbackData { bool zeroForOne; }
struct SwapCallbackData { bool zeroForOne; }
18,717
42
// fallback
_taxFee = 5; _teamFee = 5;
_taxFee = 5; _teamFee = 5;
18,608
1
// Send a generic L2 message to the chain This method is an optimization to avoid having to emit the entirety of the messageData in a log. Instead validators are expected to be able to parse the data from the transaction's input messageData Data of the message being sent /
function sendL2MessageFromOrigin(bytes calldata messageData) external onlyWhitelisted returns (uint256)
function sendL2MessageFromOrigin(bytes calldata messageData) external onlyWhitelisted returns (uint256)
36,612
19
// Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._ /
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
97
57
// Should there be a balanceOf check for all token IDs to confirm the ownership? /
function createOffer1(address token, uint[] calldata tokenIds, uint[] calldata tokenAmounts, uint price) external returns (uint offerId)
function createOffer1(address token, uint[] calldata tokenIds, uint[] calldata tokenAmounts, uint price) external returns (uint offerId)
10,405
6
// The address of the zora protocol to use via this contract
address public zora;
address public zora;
14,736
200
// Get the balance of want held idle in the Strategy
function balanceOfWant() public view returns (uint256) { return IERC20Upgradeable(want).balanceOf(address(this)); }
function balanceOfWant() public view returns (uint256) { return IERC20Upgradeable(want).balanceOf(address(this)); }
10,621
44
// This is a slight change to the ERC20 base standard.// total amount of tokens
uint256 public totalSupply;
uint256 public totalSupply;
613
4
// add this newly found pool
foundPools[found++] = pool;
foundPools[found++] = pool;
23,724
32
// relayManager /
function escheatAbandonedRelayBalance(address relayManager) external;
function escheatAbandonedRelayBalance(address relayManager) external;
23,748
4
// _totalPositionsCount = _totalPositionsCount.add(1);
_activePositionsCount = _activePositionsCount.add(1); bytes32 id = keccak256(abi.encode(_incrementTotalPositionsCount())); _token.transferFrom(msg.sender, address(this), amount); _accountsActiveDeposit[msg.sender] = _accountsActiveDeposit[msg.sender].add( amount ); _stakedAmount = _stake...
_activePositionsCount = _activePositionsCount.add(1); bytes32 id = keccak256(abi.encode(_incrementTotalPositionsCount())); _token.transferFrom(msg.sender, address(this), amount); _accountsActiveDeposit[msg.sender] = _accountsActiveDeposit[msg.sender].add( amount ); _stakedAmount = _stake...
19,392
147
// Perform deposit promotion reserve operation
function depositPromotionReserveInternal (address market, uint256 amount) internal marketIsActive(market)
function depositPromotionReserveInternal (address market, uint256 amount) internal marketIsActive(market)
27,869
18
// Save the rule count
rulesCount[dealId] = _rulesList.length;
rulesCount[dealId] = _rulesList.length;
52,085
13
// The `extraData` cannot be set on an unintialized ownership slot. /
error OwnershipNotInitializedForExtraData();
error OwnershipNotInitializedForExtraData();
316
32
// Sell it off for weth
swapTokenfortoken(token,WETH);
swapTokenfortoken(token,WETH);
3,110
17
// Equivalent to contains(set, value) To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, and then remove the last element (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex];
uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex];
14,105
69
// takes a matures stake and allows restake instead of having to withdraw the axn and stake it back into another stakerestake will take the principal + interest earned + allow a topup
// @param sessionID {uint256} - id of the stake // @param stakingDays {uint256} - number of days to be staked // @param topup {uint256} - amount of AXN to be added as topup to the stake function restake( uint256 sessionId, uint256 stakingDays, uint256 topup ) external pausabl...
// @param sessionID {uint256} - id of the stake // @param stakingDays {uint256} - number of days to be staked // @param topup {uint256} - amount of AXN to be added as topup to the stake function restake( uint256 sessionId, uint256 stakingDays, uint256 topup ) external pausabl...
24,273