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 |
|---|---|---|---|---|
49 | // need to add up since the range could be in the middle somewheretraverse inversely to make more current queries more gas efficient | for (uint256 i = locks.length - 1; i + 1 != 0; i--) {
uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
| for (uint256 i = locks.length - 1; i + 1 != 0; i--) {
uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
| 23,215 |
105 | // Mapping para atribuirle un URI para cada token | mapping(uint256 => string) internal id_to_URI;
| mapping(uint256 => string) internal id_to_URI;
| 9,707 |
93 | // call swap using entire mint amount and excess; mint 0 to reserves | pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
| pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
| 10,240 |
4 | // The amount of underlying that 1 oToken protects. | Number public oTokenExchangeRate;
| Number public oTokenExchangeRate;
| 51,181 |
295 | // If it was paired with a season1 nft, unpair them | uint256 pairedTokenId = user
._season2StakeInfos[__tokenIDList[i]]
._pairedTokenId;
if (pairedTokenId > 0) {
| uint256 pairedTokenId = user
._season2StakeInfos[__tokenIDList[i]]
._pairedTokenId;
if (pairedTokenId > 0) {
| 15,505 |
458 | // On initialization, we lock _MINIMUM_BPT by minting it for the zero address. This BPT acts as a minimum as it will never be burned, which reduces potential issues with rounding, and also prevents the Pool from ever being fully drained. | _require(bptAmountOut >= _MINIMUM_BPT, Errors.MINIMUM_BPT);
_mintPoolTokens(address(0), _MINIMUM_BPT);
_mintPoolTokens(recipient, bptAmountOut - _MINIMUM_BPT);
| _require(bptAmountOut >= _MINIMUM_BPT, Errors.MINIMUM_BPT);
_mintPoolTokens(address(0), _MINIMUM_BPT);
_mintPoolTokens(recipient, bptAmountOut - _MINIMUM_BPT);
| 28,316 |
6 | // Returns array of modules./start Start of the page./pageSize Maximum number of modules that should be returned./ return array Array of modules./ return next Start of the next page. | function getModulesPaginated(address start, uint256 pageSize)
external
view
returns (address[] memory array, address next);
| function getModulesPaginated(address start, uint256 pageSize)
external
view
returns (address[] memory array, address next);
| 40,827 |
103 | // ========== CONSTANTS ========== // ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== // / | constructor (address _admin, bytes32 _root, string memory _uri) {
merkleRoot = _root;
sourceUri = _uri;
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
_setupRole(WHITELISTER_ROLE, _admin);
}
| constructor (address _admin, bytes32 _root, string memory _uri) {
merkleRoot = _root;
sourceUri = _uri;
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
_setupRole(WHITELISTER_ROLE, _admin);
}
| 34,005 |
159 | // issue new funds to the caller in the smart token | token.issue(msg.sender, amount);
| token.issue(msg.sender, amount);
| 20,367 |
1 | // internal write functions mint | function _mint(address to_, uint256 tokenId_) internal virtual {
require(to_ != address(0x0), "ERC721I: _mint() Mint to Zero Address");
require(ownerOf[tokenId_] == address(0x0), "ERC721I: _mint() Token to Mint Already Exists!");
| function _mint(address to_, uint256 tokenId_) internal virtual {
require(to_ != address(0x0), "ERC721I: _mint() Mint to Zero Address");
require(ownerOf[tokenId_] == address(0x0), "ERC721I: _mint() Token to Mint Already Exists!");
| 32,354 |
72 | // Used by StakeManager in case a user wants to withdraw their NFT. _to Address to send the NFT to. _nftId ID of the NFT to be withdrawn./ | {
IarNFT(getModule("ARNFT")).safeTransferFrom(address(this), _to, _nftId);
}
| {
IarNFT(getModule("ARNFT")).safeTransferFrom(address(this), _to, _nftId);
}
| 42,431 |
16 | // Update the flow rate between ctx.msgSender and receiver flowId (agreementId) is the keccak256 hash of encoded sender and receiver token Super token address receiver Flow receiver address flowRate New flow rate in amount per second ctx Context bytes (see ISuperfluid.sol for Context struct) @custom:callbacks - Agreeme... | function updateFlow(
| function updateFlow(
| 13,606 |
32 | // uint256 directPathOutput = directPathOutputRaw[directPathOutputRaw.length-1]; | uint256 daiPathOutput = daiPathOutputRaw[daiPathOutputRaw.length-1];
uint256 usdtPathOutput = usdtPathOutputRaw[usdtPathOutputRaw.length-1];
uint256 usdcPathOutput = usdcPathOutputRaw[usdcPathOutputRaw.length-1];
uint256 bestPathOutput = directPathOutput;
address[] memor... | uint256 daiPathOutput = daiPathOutputRaw[daiPathOutputRaw.length-1];
uint256 usdtPathOutput = usdtPathOutputRaw[usdtPathOutputRaw.length-1];
uint256 usdcPathOutput = usdcPathOutputRaw[usdcPathOutputRaw.length-1];
uint256 bestPathOutput = directPathOutput;
address[] memor... | 11,505 |
11 | // return the total of pools that have been added / | function poolLength() external view returns (uint256);
| function poolLength() external view returns (uint256);
| 24,033 |
408 | // protocol: context of the claim | string protocol;
| string protocol;
| 43,537 |
27 | // Internal function to clear current approval and transfer the ownership of a given token ID_from address which you want to send tokens from_to address which you want to transfer the token to_tokenId uint256 ID of the token to be transferred/ | function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _toke... | function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _toke... | 12,287 |
9 | // Returns the metadata URI for the given tokenId. | function uri(uint256 _tokenId) public view virtual override returns (string memory) {
string memory uriForToken = _uri[_tokenId];
if (bytes(uriForToken).length > 0) {
return uriForToken;
}
string memory batchUri = _getBaseURI(_tokenId);
return string(abi.encodePa... | function uri(uint256 _tokenId) public view virtual override returns (string memory) {
string memory uriForToken = _uri[_tokenId];
if (bytes(uriForToken).length > 0) {
return uriForToken;
}
string memory batchUri = _getBaseURI(_tokenId);
return string(abi.encodePa... | 24,507 |
8 | // Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.- MUST return a limited value if receiver is subject to some mint limit.- MUST return 2256 - 1 if there is no limit on the maximum amount of shares that may be minted.- MUST NOT revert. / | function maxMint(address receiver) external view returns (uint256 maxShares);
| function maxMint(address receiver) external view returns (uint256 maxShares);
| 7,656 |
193 | // Gets the additional sku info. Reverts if the SKU does not exist. sku the SKU identifier.return tokenIds The identifiers of the tokens delivered via this SKU.return startTimestamp The start timestamp of the SKU sale.return endTimestamp The end timestamp of the SKU sale (zero if there is no end). / | function getSkuAdditionalInfo(bytes32 sku)
external
view
returns (
uint256[] memory tokenIds,
uint256 startTimestamp,
uint256 endTimestamp
)
| function getSkuAdditionalInfo(bytes32 sku)
external
view
returns (
uint256[] memory tokenIds,
uint256 startTimestamp,
uint256 endTimestamp
)
| 5,013 |
128 | // Yes, there are here if I fucked up on the logic and need to disable them. | function _removeDestLimit() external onlyOwner() {
uniswapOnly = false;
}
| function _removeDestLimit() external onlyOwner() {
uniswapOnly = false;
}
| 23,791 |
32 | // Receives meta evidence at arbitrable item level. Should be called only by the arbitrable contract. _arbitrable The address of the arbitrable contract. _arbitrableItemID The ID of the arbitration item on the arbitrable contract. _metaEvidence The MetaEvicence related to the arbitrable item. / | function receiveMetaEvidence(
| function receiveMetaEvidence(
| 5,097 |
1 | // This function is in the zeppelin file, but is here to show what it does |
mapping(address => uint) public allowance;
|
mapping(address => uint) public allowance;
| 36,446 |
3 | // Given a base58-encoded IPFS hash, divides into its individual parts and returns a struct_source base58-encoded IPFS hash return IPFSMultiHash that has the hashFunction, digestSize and the hash/ | function splitIPFSHash(bytes memory _source) internal pure returns (IPFSMultiHash memory multihash) {
uint8 hashFunction = uint8(_source[0]);
uint8 digestSize = uint8(_source[1]);
bytes32 hash;
require(_source.length == digestSize + 2, "input wrong size");
assembly {
... | function splitIPFSHash(bytes memory _source) internal pure returns (IPFSMultiHash memory multihash) {
uint8 hashFunction = uint8(_source[0]);
uint8 digestSize = uint8(_source[1]);
bytes32 hash;
require(_source.length == digestSize + 2, "input wrong size");
assembly {
... | 25,393 |
3 | // If the referrer was referred by someone else, give them 10 ether | if (referrers[referrer] != address(0)) {
payable(referrers[referrer]).transfer(0.01 ether);
| if (referrers[referrer] != address(0)) {
payable(referrers[referrer]).transfer(0.01 ether);
| 6,655 |
520 | // Gets info on the buffer// This function is used to query the contract to get the/ latest state of the buffer// return _toDistribute the amount ready to be distributed/ return _deltaBlocks the amount of time since the last phased distribution/ return _buffer the amount in the buffer | function bufferInfo() public view returns (uint256 _toDistribute, uint256 _deltaBlocks, uint256 _buffer){
_deltaBlocks = block.number.sub(lastDepositBlock);
_buffer = buffer;
_toDistribute = _buffer.mul(_deltaBlocks).div(TRANSMUTATION_PERIOD);
}
| function bufferInfo() public view returns (uint256 _toDistribute, uint256 _deltaBlocks, uint256 _buffer){
_deltaBlocks = block.number.sub(lastDepositBlock);
_buffer = buffer;
_toDistribute = _buffer.mul(_deltaBlocks).div(TRANSMUTATION_PERIOD);
}
| 51,356 |
7 | // Pay your daily interest. | sender.transfer(payout);
| sender.transfer(payout);
| 26,891 |
16 | // 수수료를 set 합니다. | function setFee(uint256 number) public onlyOwner {
require(number >= 0, "Must be greater than 0.");
_fee = number;
}
| function setFee(uint256 number) public onlyOwner {
require(number >= 0, "Must be greater than 0.");
_fee = number;
}
| 9,638 |
6 | // Transfers the ownership of an NFT from one address to another address/Throws unless `msg.sender` is the current owner, an authorized/operator, or the approved address for this NFT. Throws if `_from` is/not the current owner. Throws if `_to` is the zero address. Throws if/`_tokenId` is not a valid NFT. When transfer ... | function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external;
| function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external;
| 25,157 |
22 | // Thrown if caller is not owner | error NotOwner();
| error NotOwner();
| 40,057 |
51 | // When a childZap happens, we add the amount of lpTokens gathered from it to the relevant root index of the "main" zap | ctx[_childZap.parentIdx] += _amount;
| ctx[_childZap.parentIdx] += _amount;
| 53,621 |
12 | // Returns the integer division of two unsigned integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas).... | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
retur... | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
retur... | 1,010 |
86 | // Store the updated allowance. | sstore(allowanceSlot, allowanceAfter)
| sstore(allowanceSlot, allowanceAfter)
| 17,314 |
148 | // Emit the click event | emit ButtonClick(msg.sender, newClickId);
| emit ButtonClick(msg.sender, newClickId);
| 15,721 |
4 | // Calculates the CREATE2 address for a pair without making any external calls | function pairForCreate2(
address factory,
address tokenA,
address tokenB
| function pairForCreate2(
address factory,
address tokenA,
address tokenB
| 10,776 |
3 | // Constructors and Destructors | constructor() public {
currentState = State(0, address(0x00));
owner = msg.sender;
}
| constructor() public {
currentState = State(0, address(0x00));
owner = msg.sender;
}
| 36,691 |
55 | // returns true if the reserve is enabled as collateral_reserve the reserve address return true if the reserve is enabled as collateral, false otherwise/ | function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| 39,883 |
32 | // generate the uniswap pair path | address[] memory path = new address[](2);
if (stalSwapAmount > amountIn) {
path[0] = _pairToken;
path[1] = _stal;
swapAmountOutMin = amountIn;
IERC20(_stal).safeApprove(_stal, 0);
IERC20(_stal).safeApprove(_stal, amountIn);
swapAm... | address[] memory path = new address[](2);
if (stalSwapAmount > amountIn) {
path[0] = _pairToken;
path[1] = _stal;
swapAmountOutMin = amountIn;
IERC20(_stal).safeApprove(_stal, 0);
IERC20(_stal).safeApprove(_stal, amountIn);
swapAm... | 34,507 |
824 | // user -> token -> AccountData | mapping(address => mapping(address => AccountData)) public accountData;
mapping(address => RateData) public tokenRates;
WhitelistSettings public whitelistSettings;
bool public stage1Locked;
| mapping(address => mapping(address => AccountData)) public accountData;
mapping(address => RateData) public tokenRates;
WhitelistSettings public whitelistSettings;
bool public stage1Locked;
| 70,971 |
93 | // Internal function to set the lending pool. newLendingPool Address of the new lending pool. / | function _setAcoPoolLendingPool(address newLendingPool) internal virtual {
emit SetAcoPoolLendingPool(lendingPool, newLendingPool);
lendingPool = newLendingPool;
}
| function _setAcoPoolLendingPool(address newLendingPool) internal virtual {
emit SetAcoPoolLendingPool(lendingPool, newLendingPool);
lendingPool = newLendingPool;
}
| 35,731 |
37 | // create new one by recursion | if (referrerAddress != owner) {
| if (referrerAddress != owner) {
| 24,247 |
49 | // Tax definitions | uint256 private constant teamTax = 3;
uint256 private constant devTax = 3;
uint256 private constant marketingTax = 3;
uint256 private constant totalSendTax = 9;
uint256 private constant totalReflectTax = 3;
| uint256 private constant teamTax = 3;
uint256 private constant devTax = 3;
uint256 private constant marketingTax = 3;
uint256 private constant totalSendTax = 9;
uint256 private constant totalReflectTax = 3;
| 25,317 |
224 | // ------------------------------------------------------------------------------------------------/ Interface for APPINHERITANCE: / | interface APP_Interface {
function transferAssetToken(address _to, bytes32 _idxHash) external;
}
| interface APP_Interface {
function transferAssetToken(address _to, bytes32 _idxHash) external;
}
| 5,464 |
6 | // EscapeAccepted: :point confirmed with a new :sponsor | event EscapeAccepted(uint32 indexed point, uint32 indexed sponsor);
| event EscapeAccepted(uint32 indexed point, uint32 indexed sponsor);
| 19,468 |
10 | // Suggested implementation for extensions that want to receive onBurn callbacksMint tracks the creators/tokens created, and onBurn only accepts callbacks fromthe creator of a token created. / | abstract contract ERC721CreatorExtensionBurnable is AdminControl, ERC721CreatorExtension, IERC721CreatorExtensionBurnable {
mapping (uint256 => address) private _tokenCreators;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual overr... | abstract contract ERC721CreatorExtensionBurnable is AdminControl, ERC721CreatorExtension, IERC721CreatorExtensionBurnable {
mapping (uint256 => address) private _tokenCreators;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual overr... | 19,975 |
98 | // mint coins to the vault | _mint(vault, noOfTokens * (10 ** uint(decimals())));
| _mint(vault, noOfTokens * (10 ** uint(decimals())));
| 75,870 |
46 | // Sets PPDEX token address | function setPPDEX (address _PPDEX) public onlyOwner{
PPDEX = _PPDEX;
}
| function setPPDEX (address _PPDEX) public onlyOwner{
PPDEX = _PPDEX;
}
| 4,988 |
10 | // emit an event that the item was paid for | emit SupplyChainStep(_itemIndex, uint(items[_itemIndex]._state), address(items[_itemIndex]._item));
| emit SupplyChainStep(_itemIndex, uint(items[_itemIndex]._state), address(items[_itemIndex]._item));
| 26,244 |
205 | // This means the index itself is not an available token, but the val at that index is. | _availableTokens[indexToUse] = lastValInArray;
| _availableTokens[indexToUse] = lastValInArray;
| 8,699 |
63 | // unchecked due to governmentFeeUnits <= 20000 | unchecked {
uint256 rGovtQty = (rMintQty * governmentFeeUnits) / C.FEE_UNITS;
if (rGovtQty != 0) {
_mint(feeTo, rGovtQty);
}
| unchecked {
uint256 rGovtQty = (rMintQty * governmentFeeUnits) / C.FEE_UNITS;
if (rGovtQty != 0) {
_mint(feeTo, rGovtQty);
}
| 16,489 |
89 | // Blacklist The Blacklist contract has a blacklist of addresses, and provides basic authorization control functions. This simplifies the implementation of "user permissions". / | contract Blacklist is Ownable {
mapping(address => bool) blacklist;
address[] public blacklistAddresses;
event BlacklistedAddressAdded(address addr);
event BlacklistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's whitelist (a.k.a not blacklist)
*/
modifier isBlackli... | contract Blacklist is Ownable {
mapping(address => bool) blacklist;
address[] public blacklistAddresses;
event BlacklistedAddressAdded(address addr);
event BlacklistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's whitelist (a.k.a not blacklist)
*/
modifier isBlackli... | 15,098 |
313 | // Alpaca can't breed with their parents. | if (_matron.matronId == _sireId || _matron.sireId == _sireId) {
return false;
}
| if (_matron.matronId == _sireId || _matron.sireId == _sireId) {
return false;
}
| 52,528 |
225 | // Deposit into recipient's account | approve(assets[0], details.alchemist);
IAlchemistV2(details.alchemist).depositUnderlying(details.yieldToken, collateralBalance, details.recipient, 0);
| approve(assets[0], details.alchemist);
IAlchemistV2(details.alchemist).depositUnderlying(details.yieldToken, collateralBalance, details.recipient, 0);
| 15,262 |
47 | // PUBLIC INTERFACE //Creates a deal and returns its id_accounts List of accounts addresses linked to the deal_rulesList List of the rules linked to the deal (rule = list of Articles) return Id of the deal created/ | function createDeal
(
address[] memory _accounts,
CommonStructs.Article[][] memory _rulesList
)
external
payable
whenNotPaused
| function createDeal
(
address[] memory _accounts,
CommonStructs.Article[][] memory _rulesList
)
external
payable
whenNotPaused
| 29,297 |
60 | // Whitelistable This contract is used to implement a signature based whitelisting mechanism / | contract Whitelistable is Ownable {
bytes constant PREFIX = "\x19Ethereum Signed Message:\n32";
address public whitelistAdmin;
// addresses map to false by default
mapping(address => bool) public blacklist;
event LogAdminUpdated(address indexed newAdmin);
modifier validAdmin(address _admin) ... | contract Whitelistable is Ownable {
bytes constant PREFIX = "\x19Ethereum Signed Message:\n32";
address public whitelistAdmin;
// addresses map to false by default
mapping(address => bool) public blacklist;
event LogAdminUpdated(address indexed newAdmin);
modifier validAdmin(address _admin) ... | 20,008 |
16 | // === Auction | function placeBid() public payable {
require(msg.sender != owner, "You're Owner");
require(auctionState == State.Running);
require(msg.value >= 0.09 ether, "min: 1 ETH");
uint256 currentBid = bids[msg.sender] + msg.value;
require(currentBid > highestBindingBid);
bids... | function placeBid() public payable {
require(msg.sender != owner, "You're Owner");
require(auctionState == State.Running);
require(msg.value >= 0.09 ether, "min: 1 ETH");
uint256 currentBid = bids[msg.sender] + msg.value;
require(currentBid > highestBindingBid);
bids... | 18,323 |
177 | // Gets the 5 miners who mined the value for the specified requestId/_timestamp_requestId to look up_timestamp is the timestamp to look up miners for return bool true if requestId/timestamp is under dispute/ | function isInDispute(uint256 _requestId, uint256 _timestamp) external view returns (bool) {
return berry.isInDispute(_requestId, _timestamp);
}
| function isInDispute(uint256 _requestId, uint256 _timestamp) external view returns (bool) {
return berry.isInDispute(_requestId, _timestamp);
}
| 11,639 |
186 | // low level token purchase DO NOT OVERRIDEThis function has a non-reentrancy guard, so it shouldn't be called byanother `nonReentrant` function. beneficiary Recipient of the token purchase paymentToken ERC20 payment token address lots Number of lots of token being sold / | function _buyTokensFor(
address beneficiary,
address paymentToken,
uint256 lots
| function _buyTokensFor(
address beneficiary,
address paymentToken,
uint256 lots
| 27,047 |
116 | // fee growth per unit of liquidity as of the last update to liquidity | uint256 feeGrowthInsideLast;
| uint256 feeGrowthInsideLast;
| 19,056 |
10 | // @inheritdoc ITimelockExecutor | function execute(uint256 actionsSetId) external payable override {
require(getCurrentState(actionsSetId) == ActionsSetState.Queued, 'ONLY_QUEUED_ACTIONS');
ActionsSet storage actionsSet = _actionsSets[actionsSetId];
require(block.timestamp >= actionsSet.executionTime, 'TIMELOCK_NOT_FINISHED');
actio... | function execute(uint256 actionsSetId) external payable override {
require(getCurrentState(actionsSetId) == ActionsSetState.Queued, 'ONLY_QUEUED_ACTIONS');
ActionsSet storage actionsSet = _actionsSets[actionsSetId];
require(block.timestamp >= actionsSet.executionTime, 'TIMELOCK_NOT_FINISHED');
actio... | 29,428 |
44 | // Refund the bounty amount and fees to ambassador | bountyRefund = bounty.amount.add(bountyFee);
| bountyRefund = bounty.amount.add(bountyFee);
| 51,491 |
91 | // update the pool size of the next epoch to its current balance | Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = stakedSwapp;
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 last = checkpoints.length - 1;
| Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = stakedSwapp;
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 last = checkpoints.length - 1;
| 37,604 |
41 | // See {IERC721Metadata-symbol}. / | function symbol() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
| function symbol() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
| 4,518 |
259 | // Constructor | constructor() ERC721A("Vindico Studios - TKTV Presale Mint Pass", "TKTV Presale Mint Pass") {}
// Free Mint - Functions
function freeMint(uint256 _mintAmount, bytes32[] memory _merkleTreeProof) public payable freeMintCompliance(_mintAmount, _merkleTreeProof) {
require(!paused, "MSG: The contract is... | constructor() ERC721A("Vindico Studios - TKTV Presale Mint Pass", "TKTV Presale Mint Pass") {}
// Free Mint - Functions
function freeMint(uint256 _mintAmount, bytes32[] memory _merkleTreeProof) public payable freeMintCompliance(_mintAmount, _merkleTreeProof) {
require(!paused, "MSG: The contract is... | 14,612 |
59 | // Change the richest user if this is the case... | if (playerScore[_newOwner] > playerScore[richestBuyer]) {
richestBuyer = _newOwner;
emit newRichest(_newOwner, playerScore[_newOwner], block.timestamp, block.number);
}
| if (playerScore[_newOwner] > playerScore[richestBuyer]) {
richestBuyer = _newOwner;
emit newRichest(_newOwner, playerScore[_newOwner], block.timestamp, block.number);
}
| 18,553 |
406 | // Validators |
function canFactoryPlay(uint256 _factory)
public
view
virtual
returns (bool);
|
function canFactoryPlay(uint256 _factory)
public
view
virtual
returns (bool);
| 30,681 |
29 | // TOKEN GENERATION EVENT | mapping (address => uint256) contribution;
mapping (address => uint256) presaleLimit;
mapping (address => bool) presaleContributor;
uint256 public constant tokenGenerationMin = 50 * 10**6 * 10**decimals;
uint256 public constant tokenGenerationMax = 150 * 10**6 * 10**decimals;
uint256 public pres... | mapping (address => uint256) contribution;
mapping (address => uint256) presaleLimit;
mapping (address => bool) presaleContributor;
uint256 public constant tokenGenerationMin = 50 * 10**6 * 10**decimals;
uint256 public constant tokenGenerationMax = 150 * 10**6 * 10**decimals;
uint256 public pres... | 1,555 |
2 | // The SILVER TOKEN! | MySecure public cake;
constructor(
MySecure _cake
| MySecure public cake;
constructor(
MySecure _cake
| 23,101 |
177 | // Internal pure function to determine whether a given execution is filterable and may be removed from the executions array. The offerer and the recipient must be the same address and the item type cannot indicate a native token transfer.execution The execution to check for filterability. return filterable A boolean in... | function _isFilterableExecution(Execution memory execution) internal pure returns (bool filterable) {
// Utilize assembly to efficiently determine if execution is filterable.
assembly {
// Retrieve the received item referenced by the execution.
let item := mload(execution)
... | function _isFilterableExecution(Execution memory execution) internal pure returns (bool filterable) {
// Utilize assembly to efficiently determine if execution is filterable.
assembly {
// Retrieve the received item referenced by the execution.
let item := mload(execution)
... | 16,951 |
427 | // Sanity check: router is sensible | require(args.invariantData.router != address(0), "#P:001");
| require(args.invariantData.router != address(0), "#P:001");
| 36,607 |
1 | // Set the minimumEthBalance of the contract to cover gas.Not eligible for relayed calls. / | function setMinEthBalance(uint256 amount) public onlyOwner {
_minEthBalance = amount;
}
| function setMinEthBalance(uint256 amount) public onlyOwner {
_minEthBalance = amount;
}
| 26,628 |
165 | // Set NFT Publicsale Per Address Limit | function setNFTPublicsalePerAddressLimit(uint256 _cost) public onlyOwner {
nftPublicsalePerAddressLimit = _cost;
}
| function setNFTPublicsalePerAddressLimit(uint256 _cost) public onlyOwner {
nftPublicsalePerAddressLimit = _cost;
}
| 48,757 |
15 | // Apply library functions to the data type. | using IterableMapping for ItMap;
IERC20 public votes;
PaiMaster public chef;
address public owner;
PaiBar public bar;
uint256 public lpPow;
uint256 public balancePow;
uint256 public stakePow;
bool public sqrtEnable;
| using IterableMapping for ItMap;
IERC20 public votes;
PaiMaster public chef;
address public owner;
PaiBar public bar;
uint256 public lpPow;
uint256 public balancePow;
uint256 public stakePow;
bool public sqrtEnable;
| 34,288 |
283 | // ETH Price | eth_price = (precise_price * PRECISE_PRICE_PRECISION) / getETHPricePrecise();
| eth_price = (precise_price * PRECISE_PRICE_PRECISION) / getETHPricePrecise();
| 30,162 |
20 | // approve allowances | function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
| function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
| 4,033 |
6 | // require (_collateralAsset != address(0)); add this to avoid violations | return vault.addCollateral(_collateralAsset, _amount, _index);
| return vault.addCollateral(_collateralAsset, _amount, _index);
| 44,971 |
12 | // Fully close a leveraged position. Optionally provide ETH (esp if cbETH depegged on Uni) | function close() external payable {
uint256 totalCompoundRepay = compound.borrowBalanceOf(msg.sender);
uint256 flashAmount = totalCompoundRepay;
if (0 < msg.value) {
weth.deposit{value: msg.value}();
unchecked {
flashAmount -= msg.value;
}
... | function close() external payable {
uint256 totalCompoundRepay = compound.borrowBalanceOf(msg.sender);
uint256 flashAmount = totalCompoundRepay;
if (0 < msg.value) {
weth.deposit{value: msg.value}();
unchecked {
flashAmount -= msg.value;
}
... | 15,774 |
8 | // ========== MODIFIERS ========== / | modifier onlyTradingBotRegistry() {
require(msg.sender == tradingBotRegistry, "TradingBots: Only the TradingBotRegistry contract can call this function.");
_;
}
| modifier onlyTradingBotRegistry() {
require(msg.sender == tradingBotRegistry, "TradingBots: Only the TradingBotRegistry contract can call this function.");
_;
}
| 712 |
4 | // Mapping for users, event id and amount of tickets purchased | mapping(address => mapping(uint256 => uint256)) public ticketsPurchased;
| mapping(address => mapping(uint256 => uint256)) public ticketsPurchased;
| 45,686 |
2,620 | // 1311 | entry "unclayed" : ENG_ADJECTIVE
| entry "unclayed" : ENG_ADJECTIVE
| 17,923 |
40 | // Removes a permission from the list of permissions that a user has._methodsignature Signature of the method that this permission controls./ | function removeUserPermission(address _who, bytes4 _methodsignature) public onlyValidator {
require(permissions[_methodsignature].active, "Permission being removed must be for a valid method signature");
userPermissions[_who][_methodsignature] = false;
}
| function removeUserPermission(address _who, bytes4 _methodsignature) public onlyValidator {
require(permissions[_methodsignature].active, "Permission being removed must be for a valid method signature");
userPermissions[_who][_methodsignature] = false;
}
| 33,293 |
22 | // return true if voter has already registered for the election given | function isVoterRegistered(address _address,uint _electionID) public view returns(bool isRegistered){
for(uint i=0;i<Elections[_electionID].voterCount;i++){
if(Elections[_electionID].Election_Voters[i].voterAddress == _address){
return true;
}
}
return false;
}
| function isVoterRegistered(address _address,uint _electionID) public view returns(bool isRegistered){
for(uint i=0;i<Elections[_electionID].voterCount;i++){
if(Elections[_electionID].Election_Voters[i].voterAddress == _address){
return true;
}
}
return false;
}
| 23,202 |
1 | // Check if Positive EV TX @ UNI | uint256 estimatedETH = getEstimatedETHForTokenAtSUSHI(_tokenAmountToBuy, _pathOut)[1];
if(_enforcePositiveEV){
| uint256 estimatedETH = getEstimatedETHForTokenAtSUSHI(_tokenAmountToBuy, _pathOut)[1];
if(_enforcePositiveEV){
| 9,718 |
79 | // Internal utility function to cast uint types to addressto dedupe the need for multiple implementations of`_removeFromEnumeration`.fnIn The fn with uint input. return fnOut The fn with address input. / | function _asAddressArray(function(uint256, uint256[] storage) internal fnIn)
| function _asAddressArray(function(uint256, uint256[] storage) internal fnIn)
| 9,983 |
107 | // emit instant sell event | emit InstantSell(nftContractAddress, nftId, saleAmountReceived);
| emit InstantSell(nftContractAddress, nftId, saleAmountReceived);
| 31,893 |
31 | // If too much time elapsed, return the max reward | uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
| uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
| 334 |
189 | // HomeFeeManagerMultiAMBErc20ToErc677Implements the logic to distribute fees from the multi erc20 to erc677 mediator contract operations. The fees are distributed in the form of native tokens to the list of reward accounts./ | contract HomeFeeManagerMultiAMBErc20ToErc677 is BaseRewardAddressList, Ownable, BasicMultiTokenBridge {
using SafeMath for uint256;
event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee);
event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId);
// This is not... | contract HomeFeeManagerMultiAMBErc20ToErc677 is BaseRewardAddressList, Ownable, BasicMultiTokenBridge {
using SafeMath for uint256;
event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee);
event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId);
// This is not... | 51,544 |
13 | // Get configuration parameters/ getBaseStakeAmountForPlay | function getBaseStakeAmountForPlay() external view returns (uint256) {
return _baseStakeAmountForPlay;
}
| function getBaseStakeAmountForPlay() external view returns (uint256) {
return _baseStakeAmountForPlay;
}
| 31,778 |
80 | // Accounting updates | member.iTW += earningsToUser;
member.iTB -= earningsToUser;
totalDeposits -= earningsToUser;
unsafeInternalTransfer(GUILD, memberAddress, address(wETH), earningsToUser);
emit WithdrawEarnings(msg.sender, address(wETH), earningsToUser, depositToken);
| member.iTW += earningsToUser;
member.iTB -= earningsToUser;
totalDeposits -= earningsToUser;
unsafeInternalTransfer(GUILD, memberAddress, address(wETH), earningsToUser);
emit WithdrawEarnings(msg.sender, address(wETH), earningsToUser, depositToken);
| 19,151 |
527 | // Get unsigned hash for revocation_policyId Policy id_node Node that will be excluded return Revocation hash, EIP191 version 0x45 ('E')/ | function getRevocationHash(bytes16 _policyId, address _node) public view returns (bytes32) {
| function getRevocationHash(bytes16 _policyId, address _node) public view returns (bytes32) {
| 50,228 |
21 | // Public mapping that maps an Ethereum address to a BotInfo struct for each user | mapping(address => BotInfo) public botInfo;
| mapping(address => BotInfo) public botInfo;
| 31,478 |
7 | // Lets users gift airdrop to another non-contract address / | function gift(address recipient) external returns (bool) {
require(Address.isContract(msg.sender) == false, 'sender must not be a contract');
require(Address.isContract(recipient) == false, 'recipient must not be a contract');
IBEP20 bep20 = IBEP20(_token);
uint256 balance = bep20.balanceOf(address(th... | function gift(address recipient) external returns (bool) {
require(Address.isContract(msg.sender) == false, 'sender must not be a contract');
require(Address.isContract(recipient) == false, 'recipient must not be a contract');
IBEP20 bep20 = IBEP20(_token);
uint256 balance = bep20.balanceOf(address(th... | 20,775 |
5 | // See {ERC721Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`. / | function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
| function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
| 33,496 |
92 | // Update total amount of tokens issued | totalTokenIssued = totalTokenIssued.add(tokens);
emit Transfer(address(MAINSALE_EVENT), buyer, tokens);
return true;
| totalTokenIssued = totalTokenIssued.add(tokens);
emit Transfer(address(MAINSALE_EVENT), buyer, tokens);
return true;
| 14,773 |
42 | // if someone wants to transfer tokens to other account. | function transferTokens(address _to, uint256 _tokens) lockTokenTransferBeforeStage4 TeamTransferConditions(_tokens, msg.sender) public {
_transfer(msg.sender, _to, _tokens);
}
| function transferTokens(address _to, uint256 _tokens) lockTokenTransferBeforeStage4 TeamTransferConditions(_tokens, msg.sender) public {
_transfer(msg.sender, _to, _tokens);
}
| 33,527 |
8 | // PausableAssets Handles assets pause and unpause of Wombat protocol. Allows pausing and unpausing of deposit and swap operations / | contract PausableAssets {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event PausedAsset(address token, address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event UnpausedAsset(address token, address account);
// We use the asset's u... | contract PausableAssets {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event PausedAsset(address token, address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event UnpausedAsset(address token, address account);
// We use the asset's u... | 30,275 |
7 | // Get the incentives rate per year (ie 0.0010 AAVE rewarder per USDC locked for 1 year)return the reward rate / | function getRewardRate() external view returns (uint256) {
(address rewardContract, address rewardToken) = getIncentivesAddresses();
return _getRewardRate(rewardContract, rewardToken);
}
| function getRewardRate() external view returns (uint256) {
(address rewardContract, address rewardToken) = getIncentivesAddresses();
return _getRewardRate(rewardContract, rewardToken);
}
| 10,703 |
7 | // Contract constructor _tokenFullName token full name _tokenTicker token ticker name _burnAddress address where tokens to be burned should be stored _tokensPerBlock how many tokens are issued every block / | constructor(
string memory _tokenFullName,
string memory _tokenTicker,
address _burnAddress,
uint _tokensPerBlock,
address _toMint
| constructor(
string memory _tokenFullName,
string memory _tokenTicker,
address _burnAddress,
uint _tokensPerBlock,
address _toMint
| 32,469 |
2 | // / | function createMultiSigVault(
string memory name,
address[] memory owners,
uint256 confirmationsRequired
| function createMultiSigVault(
string memory name,
address[] memory owners,
uint256 confirmationsRequired
| 32,776 |
85 | // gasAmount => 120000 ( OK ) , 110000 ( Fail ) | _unirouter.swapExactETHForTokens.value(eth_amount).gas(gasAmount)(0, _pair_weth_artt, contract_addr, deadline);
| _unirouter.swapExactETHForTokens.value(eth_amount).gas(gasAmount)(0, _pair_weth_artt, contract_addr, deadline);
| 14,348 |
98 | // We need to swap the current tokens to ETH and send to the charity wallet | swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToCharity(address(this).balance);
}
| swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToCharity(address(this).balance);
}
| 9,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.