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 |
|---|---|---|---|---|
29 | // Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf_spender The address authorized to spend _value the max amount they can spend / | function approve(address _spender, uint256 _value) public
| function approve(address _spender, uint256 _value) public
| 19,762 |
519 | // Get the duration for evaluation of remove delegator operations | function getRemoveDelegatorEvalDuration()
external view returns (uint256)
| function getRemoveDelegatorEvalDuration()
external view returns (uint256)
| 3,343 |
405 | // Initiates Default action function hashes for existing categories To be called after the contract has been upgraded by governance/ | function updateCategoryActionHashes() external onlyOwner {
| function updateCategoryActionHashes() external onlyOwner {
| 28,635 |
5 | // See {ERC721Enumerable-totalSupply}. | uint256 public totalSupply;
| uint256 public totalSupply;
| 11,315 |
26 | // Returns the decimals places of the token./ | function decimals() external view returns (uint8);
| function decimals() external view returns (uint8);
| 9,459 |
1 | // Sepolia LINK token contract | address link_token_contract = 0x779877A7B0D9E8603169DdbD7836e478b4624789;
| address link_token_contract = 0x779877A7B0D9E8603169DdbD7836e478b4624789;
| 15,817 |
101 | // Whether `a` is greater than or equal to `b`. a an int256. b a FixedPoint.Signed.return True if `a >= b`, or False. / | function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {
return fromUnscaledInt(a).rawValue >= b.rawValue;
}
| function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) {
return fromUnscaledInt(a).rawValue >= b.rawValue;
}
| 5,565 |
3 | // Last time rewards were applicable | function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
| function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
| 8,171 |
7 | // price | uint256 public tombPriceOne;
uint256 public tombPriceCeiling;
uint256 public seigniorageSaved;
uint256[] public supplyTiers;
uint256[] public maxExpansionTiers;
uint256 public maxSupplyExpansionPercent;
uint256 public bondDepletionFloorPercent;
| uint256 public tombPriceOne;
uint256 public tombPriceCeiling;
uint256 public seigniorageSaved;
uint256[] public supplyTiers;
uint256[] public maxExpansionTiers;
uint256 public maxSupplyExpansionPercent;
uint256 public bondDepletionFloorPercent;
| 18,884 |
300 | // get the enzyme shares address | function _getSharesAddress() internal view virtual returns (address) {}
| function _getSharesAddress() internal view virtual returns (address) {}
| 37,450 |
11 | // Withdraw tokens from this contract/ tokenAddress '0' is reserved for native Eth/ Requires signatures from a threshold of current Root network validators. | function _withdraw(address _tokenAddress, uint128 _amount, address _recipient) internal nonReentrant {
require(withdrawalsActive, "ERC20Peg: withdrawals paused");
if (_tokenAddress == ETH_RESERVED_TOKEN_ADDRESS) {
(bool sent, ) = _recipient.call{value: _amount}("");
require(... | function _withdraw(address _tokenAddress, uint128 _amount, address _recipient) internal nonReentrant {
require(withdrawalsActive, "ERC20Peg: withdrawals paused");
if (_tokenAddress == ETH_RESERVED_TOKEN_ADDRESS) {
(bool sent, ) = _recipient.call{value: _amount}("");
require(... | 16,682 |
94 | // solhint-disable // InitializableHelper contract to support initializer functions. To use it, replacethe constructor with a function that has the `initializer` modifier.WARNING: Unlike constructors, initializer functions must be manuallyinvoked. This applies both to deploying an Initializable contract, as wellas exte... | contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer fun... | contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer fun... | 27,140 |
258 | // get the size of the current bitcoin address | sizeCurrentBitcoinAddress = uint8(_payerRefundAddress[cursor]);
| sizeCurrentBitcoinAddress = uint8(_payerRefundAddress[cursor]);
| 5,124 |
65 | // Returns the downcasted int16 from int256, reverting onoverflow (when the input is less than smallest int16 orgreater than largest int16). Counterpart to Solidity's `int16` operator. Requirements: - input must fit into 16 bits / | function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
| function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
| 37,610 |
65 | // Can only get via view functions since need to update rewards if required | mapping(address => AuctionLobbyParticipate)
private auctionLobbyParticipates;
mapping(address => CycleStake[]) private cycleStakes;
mapping(address => FlipStake) flipStakes;
address[] auctionLobbyParticipaters;
address[] cycleStakers;
address[] flipStakers;
| mapping(address => AuctionLobbyParticipate)
private auctionLobbyParticipates;
mapping(address => CycleStake[]) private cycleStakes;
mapping(address => FlipStake) flipStakes;
address[] auctionLobbyParticipaters;
address[] cycleStakers;
address[] flipStakers;
| 25,636 |
86 | // Decrease pre-tde supply | PRETDESupplyRemaining = PRETDESupplyRemaining.sub(tokenCount);
| PRETDESupplyRemaining = PRETDESupplyRemaining.sub(tokenCount);
| 7,436 |
8 | // Define an internal function '_removeEndUser' to remove this role, called by 'removeEndUser' | function _removeEndUser(address account) internal {
endusers.remove(account);
emit EndUserRemoved(account);
}
| function _removeEndUser(address account) internal {
endusers.remove(account);
emit EndUserRemoved(account);
}
| 3,828 |
13 | // Удаление верификации/ | function DelVer(address _address) public onlyOwner{
if(RA(_address) == true){
veruser[_address] = veruser[_address].sub(0);
}
}
| function DelVer(address _address) public onlyOwner{
if(RA(_address) == true){
veruser[_address] = veruser[_address].sub(0);
}
}
| 19,791 |
20 | // once this action is completed the base URI cannot be changedand contract cannot be paused. | _saleComplete = true;
emit CloseSale(msg.sender);
| _saleComplete = true;
emit CloseSale(msg.sender);
| 82,134 |
40 | // Pull all the rewards in this contract | IERC20(rewardToken).safeTransferFrom(creator, address(this), vars.totalRewardAmount);
vars.newPledgeID = pledges.length;
| IERC20(rewardToken).safeTransferFrom(creator, address(this), vars.totalRewardAmount);
vars.newPledgeID = pledges.length;
| 10,647 |
8 | // The timelock contract. | ICompTimelock public timelock;
| ICompTimelock public timelock;
| 43,214 |
119 | // deploy template contract | address templateContract = address(new Post());
| address templateContract = address(new Post());
| 31,039 |
6 | // Run over the input, 3 bytes at a time. | for {} 1 {} {
| for {} 1 {} {
| 23,943 |
3 | // / | setContractURI('{"collectionName": "Muallaqat Digital Asset","safelistRequestStatus": "not_requested","imageUrl": "https://ipfs.muallaqat.io/xxx","externalUrl": "https://muallaqat.io","lastIngestedAt": "2023-01-24T00:08:07.000Z"}');
| setContractURI('{"collectionName": "Muallaqat Digital Asset","safelistRequestStatus": "not_requested","imageUrl": "https://ipfs.muallaqat.io/xxx","externalUrl": "https://muallaqat.io","lastIngestedAt": "2023-01-24T00:08:07.000Z"}');
| 24,205 |
112 | // sweep tokens for owner | collectTokens(tokenIn);
collectTokens(tokenOut);
| collectTokens(tokenIn);
collectTokens(tokenOut);
| 71,643 |
44 | // Collection of functions related to the address type / | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* A... | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* A... | 36,989 |
26 | // _validateItemSold(_nftAddress, _tokenId, _owner, _msgSender()); |
emit ItemSold(
_owner,
_msgSender(),
_nftAddress,
_tokenId,
listedItem.quantity,
_payToken,
price / (listedItem.quantity)
);
|
emit ItemSold(
_owner,
_msgSender(),
_nftAddress,
_tokenId,
listedItem.quantity,
_payToken,
price / (listedItem.quantity)
);
| 3,855 |
120 | // update totalMembers of this current Tier at index i | totalTiers[_clubId][i].totalMembers = totalTiers[_clubId][i].totalMembers - totalWipedOffMemberPerTiers;
| totalTiers[_clubId][i].totalMembers = totalTiers[_clubId][i].totalMembers - totalWipedOffMemberPerTiers;
| 14,319 |
8 | // `balances` is the map that tracks the balance of each address, in thiscontract when the balance changes the block number that the changeoccurred is also included in the map | mapping (address => Checkpoint[]) balances;
| mapping (address => Checkpoint[]) balances;
| 16,372 |
187 | // Mint NFT and send those to the list of given addresses/ | function airdrop(uint256 _id, address[] memory _addresses) public onlyMinter {
require(tokenMaxSupply[_id] - tokenSupply[_id] >= _addresses.length, "Cant mint above max supply");
for (uint256 i = 0; i < _addresses.length; i++) {
mint(_addresses[i], _id, 1, "");
}
}
| function airdrop(uint256 _id, address[] memory _addresses) public onlyMinter {
require(tokenMaxSupply[_id] - tokenSupply[_id] >= _addresses.length, "Cant mint above max supply");
for (uint256 i = 0; i < _addresses.length; i++) {
mint(_addresses[i], _id, 1, "");
}
}
| 25,979 |
29 | // Transfer the funds to a customer for chargeback as a dipsute case got approved | token.transfer(
escrows[disputes[_disputeId].escrowId].buyerAdderss,
escrows[disputes[_disputeId].escrowId].amount
);
emit Refunded(
escrows[disputes[_disputeId].escrowId].buyerAdderss,
disputes[_disputeId].escrowId,
... | token.transfer(
escrows[disputes[_disputeId].escrowId].buyerAdderss,
escrows[disputes[_disputeId].escrowId].amount
);
emit Refunded(
escrows[disputes[_disputeId].escrowId].buyerAdderss,
disputes[_disputeId].escrowId,
... | 13,839 |
15 | // A Gelato Task Chain consists of 1 or more Tasks that automatically submitthe next one, after they have been executed, where the total number of tasks canbe an odd number/ | function submitTaskChain(
| function submitTaskChain(
| 51,342 |
27 | // Allows the pendingOwner address to finalize the transfer./ | function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner(), pendingOwner());
addressStorage[keccak256("owner")] = addressStorage[keccak256("pendingOwner")];
addressStorage[keccak256("pendingOwner")] = address(0);
}
| function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner(), pendingOwner());
addressStorage[keccak256("owner")] = addressStorage[keccak256("pendingOwner")];
addressStorage[keccak256("pendingOwner")] = address(0);
}
| 62,503 |
5 | // Throws if called by any account other than the owner./ | modifier onlyOwner() {
require(owner() == msg.sender, "#OO:029");
_;
}
| modifier onlyOwner() {
require(owner() == msg.sender, "#OO:029");
_;
}
| 31,719 |
2 | // withdrawal variables | address[] public wallets;
uint256[] public walletsShares;
uint256 public totalShares;
| address[] public wallets;
uint256[] public walletsShares;
uint256 public totalShares;
| 24,260 |
20 | // Interface for contracts conforming to ERC-721: Non-Fungible Tokens/Dieter Shirley <dete@axiomzen.co> (https:github.com/dete) | contract ERC721 {
// Required methods
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _assetId) public view returns (address owner);
function approve(address _to, uint256 _assetId) public;
function transfer(address _to, uint256 _assetId) public;
function tr... | contract ERC721 {
// Required methods
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _assetId) public view returns (address owner);
function approve(address _to, uint256 _assetId) public;
function transfer(address _to, uint256 _assetId) public;
function tr... | 1,526 |
230 | // ============ External Functions ============ //Calculates total inflation percentage then mints new Sets to the fee recipient. Position units arethen adjusted down (in magnitude) in order to ensure full collateralization. Callable by anyone._setToken Address of SetToken / | function accrueFee(ISetToken _setToken) public nonReentrant onlyValidAndInitializedSet(_setToken) {
uint256 managerFee;
uint256 protocolFee;
if (_streamingFeePercentage(_setToken) > 0) {
uint256 inflationFeePercentage = _calculateStreamingFee(_setToken);
| function accrueFee(ISetToken _setToken) public nonReentrant onlyValidAndInitializedSet(_setToken) {
uint256 managerFee;
uint256 protocolFee;
if (_streamingFeePercentage(_setToken) > 0) {
uint256 inflationFeePercentage = _calculateStreamingFee(_setToken);
| 40,902 |
0 | // Interface of the ERC20 standard as defined in the EIP. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 251 |
32 | // determine if the blueprint is taking a short or long position on the ticker | if (_exitTkrPrice > _entryTkrPrice) {
short = false;
} else {
| if (_exitTkrPrice > _entryTkrPrice) {
short = false;
} else {
| 20,121 |
227 | // Pay or lockup pending cnt. | function payOrLockupPendingcnt(uint256 _pid,address _user) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
if (user.nextHarvestUntil == 0) {
user.nextHarvestUntil = block.timestamp.add(pool.harvestInterval);
}
ui... | function payOrLockupPendingcnt(uint256 _pid,address _user) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
if (user.nextHarvestUntil == 0) {
user.nextHarvestUntil = block.timestamp.add(pool.harvestInterval);
}
ui... | 28,857 |
13 | // Queues transaction in the timelock _target The address of the target contract _value The value that the transaction needs _signature The signature of the function to be executed _data The data required to execute the function _etathe eta on which the transaction will be available / | function queueTransaction(
address _target,
uint256 _value,
string memory _signature,
bytes memory _data,
uint256 _eta
| function queueTransaction(
address _target,
uint256 _value,
string memory _signature,
bytes memory _data,
uint256 _eta
| 36,402 |
4 | // Event logging | event LogEnrolled(address accountAddress);
event LogNewPostAdded(uint256 postId, string title, string fullName, address accountAddress);
event LogUpVote(uint256 postId, string title, uint votes, string fullName, address accountAddress);
event LogDownVote(uint256 postId, string title, uint votes, string fullName... | event LogEnrolled(address accountAddress);
event LogNewPostAdded(uint256 postId, string title, string fullName, address accountAddress);
event LogUpVote(uint256 postId, string title, uint votes, string fullName, address accountAddress);
event LogDownVote(uint256 postId, string title, uint votes, string fullName... | 42,434 |
74 | // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); | bytes32 public constant PERMIT_TYPEHASH =
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
bytes32 public DOMAIN_SEPARATOR;
| bytes32 public constant PERMIT_TYPEHASH =
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
bytes32 public DOMAIN_SEPARATOR;
| 14,680 |
283 | // Initial value of Elo. | uint32 _winnerElo = addressToElo[_winnerAddress];
if (_winnerElo == 0)
_winnerElo = 1500;
uint32 _loserElo = addressToElo[_loserAddress];
if (_loserElo == 0)
_loserElo = 1500;
| uint32 _winnerElo = addressToElo[_winnerAddress];
if (_winnerElo == 0)
_winnerElo = 1500;
uint32 _loserElo = addressToElo[_loserAddress];
if (_loserElo == 0)
_loserElo = 1500;
| 36,351 |
67 | // set the rest of the contract variables | uniswapV2Router = _uniswapV2Router;
deployedAtBlock = block.number;
| uniswapV2Router = _uniswapV2Router;
deployedAtBlock = block.number;
| 37,865 |
11 | // The timestamp when LYD mining starts. | uint256 public startTimestamp;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event SetDevAddress(address indexed... | uint256 public startTimestamp;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event SetDevAddress(address indexed... | 32,019 |
37 | // Receives arbitrator extra data at arbitrable item level. Should be called only by the arbitrable contract. _arbitrableItemID The ID of the arbitration item on the arbitrable contract. _arbitratorExtraData The extra data for the arbitrator. / | function receiveArbitratorExtraData(
address _arbitrable,
uint256 _arbitrableItemID,
bytes calldata _arbitratorExtraData
| function receiveArbitratorExtraData(
address _arbitrable,
uint256 _arbitrableItemID,
bytes calldata _arbitratorExtraData
| 22,677 |
45 | // A library for performing overflow-/underflow-safe addition and subtraction on uint224. | library BoringMath224 {
function add(uint224 a, uint224 b) internal pure returns (uint224 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint224 a, uint224 b) internal pure returns (uint224 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
funct... | library BoringMath224 {
function add(uint224 a, uint224 b) internal pure returns (uint224 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint224 a, uint224 b) internal pure returns (uint224 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
funct... | 4,859 |
138 | // Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
| 5,242 |
10 | // Return the current contract's interests rate per block./ return The amount of interests currently producing per each block. | function interestsPerBlock() external view returns (uint256);
| function interestsPerBlock() external view returns (uint256);
| 4,829 |
267 | // Delete the slot where the moved value was stored |
set._values.pop();
|
set._values.pop();
| 48 |
85 | // Add all permission signatures to regulator/ | function addAllPermissions(Regulator regulator) public {
// Make this contract a temporary validator to add all permissions
regulator.addValidator(this);
regulator.addPermission(regulator.MINT_SIG(), "", "", "" );
regulator.addPermission(regulator.BURN_SIG(), "", "", "" );
r... | function addAllPermissions(Regulator regulator) public {
// Make this contract a temporary validator to add all permissions
regulator.addValidator(this);
regulator.addPermission(regulator.MINT_SIG(), "", "", "" );
regulator.addPermission(regulator.BURN_SIG(), "", "", "" );
r... | 31,746 |
249 | // _bid will throw if the bid or funds transfer fails | _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
| _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
| 26,461 |
52 | // Transfers `amount` tokens of token type `id` from `from` to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.- `from` must have a balance of tokens of type `id` of at l... | function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
| function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
| 4,411 |
4 | // Returns the assigned Mint Cooldown Rate | function mintCooldownRate() external view returns(uint16) {
return _mintCoolRate;
}
| function mintCooldownRate() external view returns(uint16) {
return _mintCoolRate;
}
| 20,347 |
37 | // profit = pnl + fundingPayments | profit = _closePosition(lp, global, tentativeVQuoteAmount);
delete lpPosition[account];
| profit = _closePosition(lp, global, tentativeVQuoteAmount);
delete lpPosition[account];
| 3,123 |
3 | // Events // Modifiers / | modifier onlyValid(string calldata questionId) {
require(questionExist(questionId), "Cryptopati: invalid question");
_;
}
| modifier onlyValid(string calldata questionId) {
require(questionExist(questionId), "Cryptopati: invalid question");
_;
}
| 22,301 |
0 | // @custom:oz-upgrades-unsafe-allow constructorconstructor() initializer {} |
function _initialize(
address _owner,
string memory _name,
string memory _symbol,
string memory _description,
string memory _url
) initializer public {
__ERC1155_init(_url);
__Ownable_init();
|
function _initialize(
address _owner,
string memory _name,
string memory _symbol,
string memory _description,
string memory _url
) initializer public {
__ERC1155_init(_url);
__Ownable_init();
| 1,276 |
94 | // exlcude from fees | mapping (address => bool) private _isExcludedFromFees;
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapEthForTokens(uint256 amountIn, address[] path);
event SwapAndLiquify(uint256 tokensIntoLiqudity, uint256 ethReceived);
event ExcludeFromFees(address indexed account, bool isExcluded);
... | mapping (address => bool) private _isExcludedFromFees;
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapEthForTokens(uint256 amountIn, address[] path);
event SwapAndLiquify(uint256 tokensIntoLiqudity, uint256 ethReceived);
event ExcludeFromFees(address indexed account, bool isExcluded);
... | 41,869 |
90 | // Get someone's address from their team JUST playerbook name | function getAddressFromReferralName(string memory refName) public view returns (address){
return playerBook.getPlayerAddr(playerBook.pIDxName_(stringToBytes32(refName)));
}
| function getAddressFromReferralName(string memory refName) public view returns (address){
return playerBook.getPlayerAddr(playerBook.pIDxName_(stringToBytes32(refName)));
}
| 16,377 |
8 | // bytes32(uint256(keccak256('eip1967.Holograph.utilityToken')) - 1) / | bytes32 constant _utilityTokenSlot = 0xbf76518d46db472b71aa7677a0908b8016f3dee568415ffa24055f9a670f9c37;
| bytes32 constant _utilityTokenSlot = 0xbf76518d46db472b71aa7677a0908b8016f3dee568415ffa24055f9a670f9c37;
| 25,624 |
0 | // To specify a value at a given point in time, we need to store two values: - `time`: unit-time value to denote the first time when a value was registered - `value`: a positive numeric value to registered at a given point in timeNote that `time` does not need to refer necessarily to a timestamp value, any time unit co... | struct Checkpoint {
uint64 time;
uint192 value;
}
| struct Checkpoint {
uint64 time;
uint192 value;
}
| 22,592 |
44 | // setter who set fund collector fundCollector address of fund collector / | event FundCollectorSet(
address indexed setter,
address indexed fundCollector
);
| event FundCollectorSet(
address indexed setter,
address indexed fundCollector
);
| 40,192 |
0 | // https:github.com/dapphub/ds-pause | interface DSPauseAbstract {
function setOwner(address) external;
function setAuthority(address) external;
function setDelay(uint256) external;
function plans(bytes32) external view returns (bool);
function proxy() external view returns (address);
function delay() external view returns (uint256);... | interface DSPauseAbstract {
function setOwner(address) external;
function setAuthority(address) external;
function setDelay(uint256) external;
function plans(bytes32) external view returns (bool);
function proxy() external view returns (address);
function delay() external view returns (uint256);... | 42,962 |
2 | // reorder the candidate key fragments (sort) | bytes memory candidate_key = new bytes(candidate_key_length);
for(uint j=0; j < vote.fragments.length; j++){
candidate_key[vote.fragments[j].candidate_key_fragment_position] = bytes(vote.fragments[j].candidate_key_fragment)[0];
}
| bytes memory candidate_key = new bytes(candidate_key_length);
for(uint j=0; j < vote.fragments.length; j++){
candidate_key[vote.fragments[j].candidate_key_fragment_position] = bytes(vote.fragments[j].candidate_key_fragment)[0];
}
| 2,494 |
57 | // Function returns stored (without accruing) exchange rate of cpTokens for currency tokens/ return Stored exchange rate as 10-digits decimal | function _storedExchangeRate() internal view returns (uint256) {
if (totalSupply() == 0) {
return Decimal.ONE;
} else if (debtClaimed) {
return cash().divDecimal(totalSupply());
} else {
return (_availableToProviders(_info) + _info.borrows).divDecimal(totalSupply());
}
}
| function _storedExchangeRate() internal view returns (uint256) {
if (totalSupply() == 0) {
return Decimal.ONE;
} else if (debtClaimed) {
return cash().divDecimal(totalSupply());
} else {
return (_availableToProviders(_info) + _info.borrows).divDecimal(totalSupply());
}
}
| 1,199 |
64 | // this low-level function should be called from a contract which performs important safety checks | function mint(uint amount0Desired, uint amount1Desired, uint amount0Min, uint amount1Min, address to) external payable returns (uint128 liquidity) {
(liquidity,,) = _addLiquidity(AddLiquidityParams(token0, token1, fee, to, tickLower, tickUpper, amount0Desired, amount1Desired, amount0Min, amount1Min));
... | function mint(uint amount0Desired, uint amount1Desired, uint amount0Min, uint amount1Min, address to) external payable returns (uint128 liquidity) {
(liquidity,,) = _addLiquidity(AddLiquidityParams(token0, token1, fee, to, tickLower, tickUpper, amount0Desired, amount1Desired, amount0Min, amount1Min));
... | 1,858 |
264 | // Constraint expression for public_memory_value_zero: column3_row3. | let val := /*column3_row3*/ mload(0x1c80)
| let val := /*column3_row3*/ mload(0x1c80)
| 32,110 |
34 | // 1-32 teams | modifier validTeam(uint8 _teamId) {
require(_teamId > 0 && _teamId < 33);
_;
}
| modifier validTeam(uint8 _teamId) {
require(_teamId > 0 && _teamId < 33);
_;
}
| 36,508 |
36 | // revert if the strategy mutated since this tx was sent | if (!_equalStrategyOrders(currentOrders, orders)) {
revert OutDated();
}
| if (!_equalStrategyOrders(currentOrders, orders)) {
revert OutDated();
}
| 13,827 |
0 | // @TODO: see if we can just set .length = | function trimToSize(bytes memory b, uint newLen)
internal
pure
| function trimToSize(bytes memory b, uint newLen)
internal
pure
| 34,922 |
34 | // Only allows approved admins to call the specified function / | modifier adminRequired() {
require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
_;
}
| modifier adminRequired() {
require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
_;
}
| 43,630 |
236 | // Mints some amount of tokens to an address _toAddress of the future owner of the token _idToken ID to mint _quantityAmount of tokens to mint _dataData to pass if receiver is contract / | function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
| function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
| 10,277 |
189 | // Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
| function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
| 2,161 |
123 | // The following assert() holds true because: - The system always contains >= 1 trove - When we close or liquidate a trove, we redistribute the pending rewards, so if all troves were closed/liquidated, rewards would’ve been emptied and totalCollateralSnapshot would be zero too./ | assert(totalStakesSnapshot > 0);
stake = _coll.mul(totalStakesSnapshot).div(totalCollateralSnapshot);
| assert(totalStakesSnapshot > 0);
stake = _coll.mul(totalStakesSnapshot).div(totalCollateralSnapshot);
| 4,014 |
68 | // Remove a node from the list _id Node's id / | function remove(Data storage self, address _id) public {
// List must contain the node
require(contains(self, _id), "node not in list");
if (self.size > 1) {
// List contains more than a single node
if (_id == self.head) {
// The removed node is the h... | function remove(Data storage self, address _id) public {
// List must contain the node
require(contains(self, _id), "node not in list");
if (self.size > 1) {
// List contains more than a single node
if (_id == self.head) {
// The removed node is the h... | 42,542 |
60 | // Ex1: trade 50 OMG -> ETH -> EOS Step1: trade 50 OMG -> ETH Step2: trade xx ETH -> EOS "0x5b9a857e0C3F2acc5b94f6693536d3Adf5D6e6Be", "30000000000000000000", "0xd3c64BbA75859Eb808ACE6F2A6048ecdb2d70817", "1", ["0x0000000000000000000000000000000000000000", "0x5b9a857e0C3F2acc5b94f6693536d3Adf5D6e6Be", "0xeeeeeeeeeeeeee... | function tradeRoutes(
ERC20 src,
uint256 srcAmount,
ERC20 dest,
uint256 minDestAmount,
address[] _tradingPaths)
| function tradeRoutes(
ERC20 src,
uint256 srcAmount,
ERC20 dest,
uint256 minDestAmount,
address[] _tradingPaths)
| 27,931 |
31 | // Convert SVG to base64 to include in the metadata | string memory svgBase64 = Base64.encode(bytes(svgImage));
avatar = string(abi.encodePacked("data:image/svg+xml;base64,", svgBase64));
| string memory svgBase64 = Base64.encode(bytes(svgImage));
avatar = string(abi.encodePacked("data:image/svg+xml;base64,", svgBase64));
| 27,704 |
140 | // balance of an ERC20 token within swap contracttoken ERC20 token address | function balanceOfToken(address token) public view returns (uint256) {
return IERC20(token).balanceOf(address(this));
}
| function balanceOfToken(address token) public view returns (uint256) {
return IERC20(token).balanceOf(address(this));
}
| 35,130 |
177 | // _vault The vault where the ETH backing the pledges is stored | function initialize(address _vault) onlyInit public {
require(_vault != 0x0);
initialized();
vault = ILPVault(_vault);
admins.length = 1; // we reserve the 0 admin
pledges.length = 1; // we reserve the 0 pledge
}
| function initialize(address _vault) onlyInit public {
require(_vault != 0x0);
initialized();
vault = ILPVault(_vault);
admins.length = 1; // we reserve the 0 admin
pledges.length = 1; // we reserve the 0 pledge
}
| 2,494 |
116 | // withdraw tokens amount within vesting rules for reserved wallet / | function reservedWithdraw() public {
| function reservedWithdraw() public {
| 49,875 |
27 | // update tail of bucket | Bucket storage b = checkPoints[bucket];
b.tail = expireId;
if(b.head == 0){
| Bucket storage b = checkPoints[bucket];
b.tail = expireId;
if(b.head == 0){
| 5,407 |
10 | // Load the aggregated stats into memory; noop if no pools to finalize. | IStructs.AggregatedStats memory aggregatedStats = aggregatedStatsByEpoch[prevEpoch];
if (aggregatedStats.numPoolsToFinalize == 0) {
return;
}
| IStructs.AggregatedStats memory aggregatedStats = aggregatedStatsByEpoch[prevEpoch];
if (aggregatedStats.numPoolsToFinalize == 0) {
return;
}
| 13,405 |
8 | // Calculates the fair amount of funds to ragequit based on the token, units and loot. It takes into account the historical guild balance when the kick proposal was created.slither-disable-next-line calls-loop | uint256 amountToRagequit = FairShareHelper.calc(
bank.balanceOf(GUILD, token),
unitsAndLootToBurn,
initialTotalTokens
);
| uint256 amountToRagequit = FairShareHelper.calc(
bank.balanceOf(GUILD, token),
unitsAndLootToBurn,
initialTotalTokens
);
| 9,514 |
4 | // No zeros | require(quantity > 0, "Too few");
| require(quantity > 0, "Too few");
| 27,827 |
54 | // Checks whether a storage slot has already been retrieved, and marks it as retrieved if not. _contract Address of the contract to check. _key 32 byte storage slot key.return Whether or not the slot was already loaded. / | function testAndSetContractStorageLoaded(
address _contract,
bytes32 _key
)
override
public
authenticated
returns (
bool
)
| function testAndSetContractStorageLoaded(
address _contract,
bytes32 _key
)
override
public
authenticated
returns (
bool
)
| 67,488 |
6 | // add x% to this strategy We assume that this contract is a minter on underlying | ERC20Mintable(address(underlying)).mint(address(this),
balance.mul(profitRateNumerator + variation).div(profitRateDenominator));
| ERC20Mintable(address(underlying)).mint(address(this),
balance.mul(profitRateNumerator + variation).div(profitRateDenominator));
| 27,871 |
53 | // Called by bZx after a borrower has changed the collateral token/used for an open loan/loanOrderHash A unique hash representing the loan order/borrower The borrower/gasUsed The initial used gas, collected in a modifier in bZx, for optional gas refunds/ return Successful execution of the function | function didChangeCollateral(
bytes32 loanOrderHash,
address borrower,
uint gasUsed)
external
returns (bool);
| function didChangeCollateral(
bytes32 loanOrderHash,
address borrower,
uint gasUsed)
external
returns (bool);
| 4,769 |
11 | // Pauses the contract / | function pause() external onlyOwner whenNotPaused {
_pause();
}
| function pause() external onlyOwner whenNotPaused {
_pause();
}
| 3,063 |
145 | // The manager has control over options like fees and features | function setManager(address _manager) external;
function mint(
uint256[] calldata tokenIds,
uint256[] calldata amounts /* ignored for ERC721 vaults */
) external returns (uint256);
function mintTo(
uint256[] calldata tokenIds,
uint256[] calldata amounts, /* ignored for ... | function setManager(address _manager) external;
function mint(
uint256[] calldata tokenIds,
uint256[] calldata amounts /* ignored for ERC721 vaults */
) external returns (uint256);
function mintTo(
uint256[] calldata tokenIds,
uint256[] calldata amounts, /* ignored for ... | 1,595 |
344 | // 0 is a sentinel and therefore invalid. A valid node is the head or has a previous node. | return id != 0 && (id == stakeNodes[0].next || stakeNodes[id].prev != 0);
| return id != 0 && (id == stakeNodes[0].next || stakeNodes[id].prev != 0);
| 45,646 |
245 | // place a bid for a cat, referenced by its index in the current auction / | function bid(uint64 index) public payable {
(uint256 startId, uint256 endId) = auctionsState();
// bids can only be placed while in an auction
require(startId > endId, "not in auction");
// cats are referenced by their index in the auction
require(index < auctionsCatsPerAuc... | function bid(uint64 index) public payable {
(uint256 startId, uint256 endId) = auctionsState();
// bids can only be placed while in an auction
require(startId > endId, "not in auction");
// cats are referenced by their index in the auction
require(index < auctionsCatsPerAuc... | 8,127 |
3 | // Returns an `uint256[MAX_COLUMN_WORDS]` located at `slot`./ | function getColumn(bytes32 slot) internal pure returns (bytes32[MAX_COLUMN_WORDS] storage r) {
uint256 public constant COLUMN_TYPE_UINT16 = 6;
uint256 public constant COLUMN_TYPE_UINT8 = 7;
uint256 public constant COLUMN_TYPE_NATIVE_STRING = 8;
// solhint-disable-next-line no-inline-assembly
assem... | function getColumn(bytes32 slot) internal pure returns (bytes32[MAX_COLUMN_WORDS] storage r) {
uint256 public constant COLUMN_TYPE_UINT16 = 6;
uint256 public constant COLUMN_TYPE_UINT8 = 7;
uint256 public constant COLUMN_TYPE_NATIVE_STRING = 8;
// solhint-disable-next-line no-inline-assembly
assem... | 26,712 |
12 | // wasnt withdrawn because validator needs to be taken of active validators | if (balance() == prevBalance) {
| if (balance() == prevBalance) {
| 22,773 |
73 | // Multiple token transfers from one address to save gas / | function transferMultiple(address[] _addresses, uint[] _amounts) external {
require( tradeable() );
require( _addresses.length == _amounts.length );
require( _addresses.length <= 100 );
uint i;
// check token amounts
uint tokens_to_transfer = 0;
for (i = 0; i < _addresses.length;... | function transferMultiple(address[] _addresses, uint[] _amounts) external {
require( tradeable() );
require( _addresses.length == _amounts.length );
require( _addresses.length <= 100 );
uint i;
// check token amounts
uint tokens_to_transfer = 0;
for (i = 0; i < _addresses.length;... | 9,112 |
29 | // Function which withdraw LP tokens to messege sender with the given amount _pid: pool ID from which the LP tokens should be withdrawn _amount: the amount of LP tokens that should be withdrawn / | function withdraw(uint256 _pid, uint256 _amount) public poolExists(_pid) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = (user.amount * poo... | function withdraw(uint256 _pid, uint256 _amount) public poolExists(_pid) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = (user.amount * poo... | 6,402 |
5 | // NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the`0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` / | function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
| function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
| 25,238 |
7 | // Sort the timestamps array | uint256[] memory sortedTimestamps = new uint256[](1);
sortedTimestamps[0] = timestamps;
| uint256[] memory sortedTimestamps = new uint256[](1);
sortedTimestamps[0] = timestamps;
| 23,272 |
56 | // calculate stakes | uint256 count = 0;
| uint256 count = 0;
| 17,043 |
28 | // keyRevisionNumber: incremented every time the public keys change | uint32 keyRevisionNumber;
| uint32 keyRevisionNumber;
| 19,488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.