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 |
|---|---|---|---|---|
30 | // If the owner has both a queen and king, return heart | if (
(toERC1155.balanceOf(owner, toWQueenERC1155Id) > 0 || toERC1155.balanceOf(owner, toBQueenERC1155Id) > 0) &&
(toERC1155.balanceOf(owner, toWKingERC1155Id) > 0 || toERC1155.balanceOf(owner, toBKingERC1155Id) > 0)
) {
return string(abi.encodePacked(_baseURI, "heart.json"));
}
| if (
(toERC1155.balanceOf(owner, toWQueenERC1155Id) > 0 || toERC1155.balanceOf(owner, toBQueenERC1155Id) > 0) &&
(toERC1155.balanceOf(owner, toWKingERC1155Id) > 0 || toERC1155.balanceOf(owner, toBKingERC1155Id) > 0)
) {
return string(abi.encodePacked(_baseURI, "heart.json"));
}
| 23,511 |
56 | // unstaking possible Time | uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
| uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
| 8,835 |
301 | // Deposits the `asset` from msg.sender added to `creditor`'s deposit. Used for vault -> vault deposits on the user's behalf creditor is the address that can claim/withdraw deposited amount / | function depositFor(address creditor) external payable nonReentrant {
require(msg.value > 0, "!value");
require(creditor != address(0), "!creditor");
_depositFor(msg.value, creditor, true);
}
| function depositFor(address creditor) external payable nonReentrant {
require(msg.value > 0, "!value");
require(creditor != address(0), "!creditor");
_depositFor(msg.value, creditor, true);
}
| 25,092 |
19 | // reverse-for-loops with unsigned integer/ solium-disable-next-line security/no-modify-for-iter-var / take last decimal digit | bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));
| bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));
| 26,514 |
38 | // Get current tranche based on the amount of time that has passed since vesting start date | uint256 currentTranche = now.sub(cofoundersSupplyVestingStartDate) / 4 weeks;
| uint256 currentTranche = now.sub(cofoundersSupplyVestingStartDate) / 4 weeks;
| 36,642 |
32 | // Only accrue rewards if over a threshold | uint256 newRewards = (subgraphSignalledTokens >= minimumSubgraphSignal) // Accrue new rewards since last snapshot
? getAccRewardsPerSignal()
.sub(subgraph.accRewardsPerSignalSnapshot)
.mul(subgraphSignalledTokens)
.div(FIXED_POINT_SCALING_FACTOR)
... | uint256 newRewards = (subgraphSignalledTokens >= minimumSubgraphSignal) // Accrue new rewards since last snapshot
? getAccRewardsPerSignal()
.sub(subgraph.accRewardsPerSignalSnapshot)
.mul(subgraphSignalledTokens)
.div(FIXED_POINT_SCALING_FACTOR)
... | 20,574 |
488 | // 7 bytes allocated, one byte per market for the rate scalar | uint256 private constant RATE_SCALAR_FIRST_BIT = 15;
| uint256 private constant RATE_SCALAR_FIRST_BIT = 15;
| 6,072 |
25 | // Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist./ | function ownerOf(uint tokenId) external view returns (address owner);
| function ownerOf(uint tokenId) external view returns (address owner);
| 30,866 |
6 | // ============================================================================== init============================================================================== | constructor() public {
rID_ = 0;
rTypeID_ = 0;
}
| constructor() public {
rID_ = 0;
rTypeID_ = 0;
}
| 46,294 |
215 | // See {IPausable-setSaleState}.Requirements:- Caller must be the contract owner./ | function setSaleState( SaleState newState_ ) external onlyOwner {
_setSaleState( newState_ );
}
| function setSaleState( SaleState newState_ ) external onlyOwner {
_setSaleState( newState_ );
}
| 82,412 |
41 | // Removes account from blacklist _account The address to remove from the blacklist/ | function unBlacklist(address _account) public onlyBlacklister {
blacklisted[_account] = false;
emit UnBlacklisted(_account);
}
| function unBlacklist(address _account) public onlyBlacklister {
blacklisted[_account] = false;
emit UnBlacklisted(_account);
}
| 28,274 |
160 | // indices for flags | uint8 internal constant RE_STAKE_DISABLED_INDEX = 0;
uint8 internal constant WIND_DOWN_INDEX = 1;
uint8 internal constant MEASURE_WORK_INDEX = 2;
uint8 internal constant SNAPSHOTS_DISABLED_INDEX = 3;
uint8 internal constant MIGRATED_INDEX = 4;
uint16 public immutable minLockedPeriods;
uint1... | uint8 internal constant RE_STAKE_DISABLED_INDEX = 0;
uint8 internal constant WIND_DOWN_INDEX = 1;
uint8 internal constant MEASURE_WORK_INDEX = 2;
uint8 internal constant SNAPSHOTS_DISABLED_INDEX = 3;
uint8 internal constant MIGRATED_INDEX = 4;
uint16 public immutable minLockedPeriods;
uint1... | 50,013 |
740 | // Allows anyone to withdraw funds for a specified user using the balances stored/in the Merkle tree. The funds will be sent to the owner of the acount.//Can only be used in withdrawal mode (i.e. when the owner has stopped/committing blocks and is not able to commit any more blocks).//This will NOT modify the onchain m... | function withdrawFromMerkleTree(
ExchangeData.MerkleProof calldata merkleProof
)
external
virtual;
| function withdrawFromMerkleTree(
ExchangeData.MerkleProof calldata merkleProof
)
external
virtual;
| 53,294 |
37 | // Returns the key-value pair stored at position `index` in the map. O(1). Note that there are no guarantees on the ordering of entries inside thearray, and it may change when more entries are added or removed. Requirements: | * - `index` must be strictly less than {length}.
*/
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
require(map._entries.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._entries[index];
return (entry._key, ... | * - `index` must be strictly less than {length}.
*/
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
require(map._entries.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._entries[index];
return (entry._key, ... | 50,396 |
36 | // Gets tokens currently available for release Considers the schedule and takes into account already released tokensreturn Amount of tokens ready to be released / | function releasableAmount() public view virtual override returns (uint256) {
// If a release start time is set no tokens are available for release before this date
// If not set it follows the default schedule and tokens are available on
// the first period passed
if (releaseStartTim... | function releasableAmount() public view virtual override returns (uint256) {
// If a release start time is set no tokens are available for release before this date
// If not set it follows the default schedule and tokens are available on
// the first period passed
if (releaseStartTim... | 21,278 |
184 | // mint end block num,about 30 days. | uint256 public constant MINTEND_BLOCKNUM = 200000;
| uint256 public constant MINTEND_BLOCKNUM = 200000;
| 10,385 |
13 | // The total amount of AION bet for this current game | uint public totalBet;
| uint public totalBet;
| 11,920 |
19 | // Lets any account close an auction on behalf of either the (1) auction's creator, or (2) winning bidder. For (1): The auction creator is sent the the winning bid amount. For (2): The winning bidder is sent the auctioned NFTs. _listingId The uid of the listing (the auction to close)._closeFor For whom the auction is b... | function closeAuction(uint256 _listingId, address _closeFor) external;
| function closeAuction(uint256 _listingId, address _closeFor) external;
| 7,730 |
23 | // Safe, because the user must have added their balance before | votes[currentVote] -= user.balance;
extraVotes += user.balance;
| votes[currentVote] -= user.balance;
extraVotes += user.balance;
| 11,923 |
157 | // Reserve Fund (5%) | uint256 private constant RESERVE_FUND = 500_000_000 * 10 ** 6;
| uint256 private constant RESERVE_FUND = 500_000_000 * 10 ** 6;
| 21,963 |
14 | // Many of the settings that change weekly rely on the rate accumulator described at https:docs.makerdao.com/smart-contract-modules/rates-module To check this yourself, use the following rate calculation (example 8%): $ bc -l <<< 'scale=27; e( l(1.08)/(606024365) )' | uint256 constant TWO_TWENTYFIVE_PCT_RATE = 1000000000705562181084137268;
uint256 constant FOUR_TWENTYFIVE_PCT_RATE = 1000000001319814647332759691;
uint256 constant EIGHT_TWENTYFIVE_PCT_RATE = 1000000002513736079215619839;
uint256 constant TWELVE_TWENTYFIVE_PCT_RATE = 1000000003664330950215446102;
... | uint256 constant TWO_TWENTYFIVE_PCT_RATE = 1000000000705562181084137268;
uint256 constant FOUR_TWENTYFIVE_PCT_RATE = 1000000001319814647332759691;
uint256 constant EIGHT_TWENTYFIVE_PCT_RATE = 1000000002513736079215619839;
uint256 constant TWELVE_TWENTYFIVE_PCT_RATE = 1000000003664330950215446102;
... | 51,028 |
23 | // Base contract for all modules / | contract Base is Initializable, Context, Ownable {
address constant ZERO_ADDRESS = address(0);
function initialize() public initializer {
Ownable.initialize(_msgSender());
}
}
| contract Base is Initializable, Context, Ownable {
address constant ZERO_ADDRESS = address(0);
function initialize() public initializer {
Ownable.initialize(_msgSender());
}
}
| 39,317 |
0 | // Extension of {ERC1155} that allows other facets of the diamond to mint based on arbitrary logic./@inheritdoc IERC1155Mintable / | function mintByFacet(
address to,
uint256 id,
uint256 amount,
bytes calldata data
) public virtual {
if (address(this) != msg.sender) {
revert ErrSenderIsNotSelf();
}
| function mintByFacet(
address to,
uint256 id,
uint256 amount,
bytes calldata data
) public virtual {
if (address(this) != msg.sender) {
revert ErrSenderIsNotSelf();
}
| 7,555 |
5 | // SafeMathMath operations with safety checks that throw on error / | contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b != 0); // Solidity automatically throws when di... | contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b != 0); // Solidity automatically throws when di... | 17,906 |
29 | // 1<<30 | } else if (i < 1073741824) {
| } else if (i < 1073741824) {
| 33,446 |
184 | // Mint as Founder (can mint one) | function mintAsFounder() public payable {
//check if paused
require( !_paused, "Minting is paused" );
// founder-related checks
require( blootMF.isFounder(msg.sender), "Sender is not a Founder");
require(!founderMap[msg.sender], "Sender has already minted as... | function mintAsFounder() public payable {
//check if paused
require( !_paused, "Minting is paused" );
// founder-related checks
require( blootMF.isFounder(msg.sender), "Sender is not a Founder");
require(!founderMap[msg.sender], "Sender has already minted as... | 4,958 |
15 | // / | abstract contract BuddleBridge is IBuddleBridge, Ownable {
bytes32 public VERSION;
address constant BASE_TOKEN_ADDRESS = address(0);
BuddleContracts public buddle; // deployed Buddle src and dest contracts on respective layer 2
mapping(address => address) public tokenMap; // l2 token address => l1 to... | abstract contract BuddleBridge is IBuddleBridge, Ownable {
bytes32 public VERSION;
address constant BASE_TOKEN_ADDRESS = address(0);
BuddleContracts public buddle; // deployed Buddle src and dest contracts on respective layer 2
mapping(address => address) public tokenMap; // l2 token address => l1 to... | 3,644 |
235 | // a modifier to store earned points for a designated address untilcurrent block after having staked some MEEDs. if the Points rewarding didn't started yetthe address will not receive points yet. / | modifier updateReward(address account) {
if (account != address(0)) {
if (block.timestamp < startRewardsTime) {
points[account] = 0;
pointsLastUpdateTime[account] = startRewardsTime;
} else {
points[account] = earned(account);
pointsLastUpd... | modifier updateReward(address account) {
if (account != address(0)) {
if (block.timestamp < startRewardsTime) {
points[account] = 0;
pointsLastUpdateTime[account] = startRewardsTime;
} else {
points[account] = earned(account);
pointsLastUpd... | 38,058 |
9 | // Construct crowd proposalauthor_ The crowd proposal authortargets_ The ordered list of target addresses for calls to be madevalues_ The ordered list of values (i.e. msg.value) to be passed to the calls to be madesignatures_ The ordered list of function signatures to be calledcalldatas_ The ordered list of calldata to... | constructor(address payable author_,
address[] memory targets_,
uint[] memory values_,
string[] memory signatures_,
bytes[] memory calldatas_,
string memory description_,
address comp_,
| constructor(address payable author_,
address[] memory targets_,
uint[] memory values_,
string[] memory signatures_,
bytes[] memory calldatas_,
string memory description_,
address comp_,
| 33,715 |
22 | // Create new beat, don't let it be cloned | for (uint i = 0; i < _numClonesRequested; i++) {
Beat memory _newBeat;
_newBeat.priceFinney = _beat.priceFinney;
_newBeat.numEditionsAllowed = 0;
_newBeat.numEditionsInWild = 0;
_newBeat.madeFromId = _tokenId;
| for (uint i = 0; i < _numClonesRequested; i++) {
Beat memory _newBeat;
_newBeat.priceFinney = _beat.priceFinney;
_newBeat.numEditionsAllowed = 0;
_newBeat.numEditionsInWild = 0;
_newBeat.madeFromId = _tokenId;
| 15,919 |
49 | // Calculates loan to value ration numerator Numerator. denominator Denominator. / | function _percent(uint256 numerator, uint256 denominator) internal pure returns(uint256) {
return numerator.mul(10000).div(denominator).add(5).div(10);
}
| function _percent(uint256 numerator, uint256 denominator) internal pure returns(uint256) {
return numerator.mul(10000).div(denominator).add(5).div(10);
}
| 9,709 |
282 | // require(numBobas > 0 && numBobas <= 15, "You can adopt minimum 1, maximum 10 bobas"); | require(totalSupply().add(numBobas) <= MAX_BOBAS, "Exceeds MAX_BOBAS");
for (uint i = 0; i < numBobas; i++) {
uint mintIndex = totalSupply();
_safeMint(msg.sender, mintIndex);
}
| require(totalSupply().add(numBobas) <= MAX_BOBAS, "Exceeds MAX_BOBAS");
for (uint i = 0; i < numBobas; i++) {
uint mintIndex = totalSupply();
_safeMint(msg.sender, mintIndex);
}
| 17,159 |
54 | // Check that the root has been submittedand that the optimistic timeout period has expired,meaning the root can be processed _root the Merkle root, submitted in an update, to checkreturn TRUE iff root has been submitted & timeout has expired / | function acceptableRoot(bytes32 _root) public view returns (bool) {
uint256 _time = confirmAt[_root];
if (_time == 0) {
return false;
}
return block.timestamp >= _time;
}
| function acceptableRoot(bytes32 _root) public view returns (bool) {
uint256 _time = confirmAt[_root];
if (_time == 0) {
return false;
}
return block.timestamp >= _time;
}
| 52,055 |
136 | // List of configs indexed by id | mapping (uint64 => uint256) private configIdByTerm;
event NewConfig(uint64 fromTermId, uint64 courtConfigId);
| mapping (uint64 => uint256) private configIdByTerm;
event NewConfig(uint64 fromTermId, uint64 courtConfigId);
| 10,434 |
106 | // ------------------------------------------------------------------------ Calculate year/month/day from the number of days since 1970/01/01 using the date conversion algorithm from http:aa.usno.navy.mil/faq/docs/JD_Formula.php and adding the offset 2440588 so that 1970/01/01 is day 0 int256 L = days + 68569 + offset ... | function _daysToDate(uint256 _days) internal pure returns (uint256 year, uint256 month, uint256 day) {
int256 __days = int256(_days);
int256 L = __days + 68569 + OFFSET19700101;
int256 N = 4 * L / 146097;
L = L - (146097 * N + 3) / 4;
int256 _year = 4000 * (L + 1) / 1461... | function _daysToDate(uint256 _days) internal pure returns (uint256 year, uint256 month, uint256 day) {
int256 __days = int256(_days);
int256 L = __days + 68569 + OFFSET19700101;
int256 N = 4 * L / 146097;
L = L - (146097 * N + 3) / 4;
int256 _year = 4000 * (L + 1) / 1461... | 1,676 |
38 | // Checks the calculated dart is not higher than urn.art (total debt), otherwise uses its value | dart = uint256(dart) <= art ? -dart : -toInt256(art);
| dart = uint256(dart) <= art ? -dart : -toInt256(art);
| 69,412 |
243 | // Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was notalready present. / | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.len... | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.len... | 445 |
140 | // Claims stucked tokens. Only unsupported tokens can be claimed. When dealing with already supported tokens, fixMediatorBalance can be used instead._token address of claimed token, address(0) for native_to address of tokens receiver/ | function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
// Only unregistered tokens and native coins are allowed to be claimed with the use of this function
require(_token == address(0) || !isTokenRegistered(_token));
claimValues(_token, _to);
}
| function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
// Only unregistered tokens and native coins are allowed to be claimed with the use of this function
require(_token == address(0) || !isTokenRegistered(_token));
claimValues(_token, _to);
}
| 51,514 |
178 | // Gossip tokens created per block. | uint256 public GossipPerBlock;
| uint256 public GossipPerBlock;
| 4,371 |
68 | // Get how many gov tokens a user is entitled to (this may not include eventual undistributed tokens)_usr : user addressreturn : array of amounts for each gov token / | function getGovTokensAmounts(address _usr) external view returns (uint256[] memory _amounts) {
address govToken;
uint256 usrBal = balanceOf(_usr);
_amounts = new uint256[](govTokens.length);
for (uint256 i = 0; i < _amounts.length; i++) {
govToken = govTokens[i];
_amounts[i] = usrBal.mul(g... | function getGovTokensAmounts(address _usr) external view returns (uint256[] memory _amounts) {
address govToken;
uint256 usrBal = balanceOf(_usr);
_amounts = new uint256[](govTokens.length);
for (uint256 i = 0; i < _amounts.length; i++) {
govToken = govTokens[i];
_amounts[i] = usrBal.mul(g... | 33,629 |
457 | // Emits {CallSalt} if salt is nonzero, and one {CallScheduled} event per transaction in the batch. Requirements: - the caller must have the 'proposer' role. / | function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
require(targets.length == values.length, "TimelockControll... | function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
require(targets.length == values.length, "TimelockControll... | 27,991 |
4 | // the amount of eth lp tokens owned by the account | uint256 kkoEthLpTokens;
| uint256 kkoEthLpTokens;
| 44,508 |
37 | // Balances | uint marketing_balance;
uint growth_balance;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
| uint marketing_balance;
uint growth_balance;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
| 25,685 |
82 | // remove user from list if unstaked completely | if (userInfo[user].totalAmountStaked == 0) {
delete userInfo[user];
}
| if (userInfo[user].totalAmountStaked == 0) {
delete userInfo[user];
}
| 8,082 |
1 | // Indicating whether or not the target contract is paused in emergency mode. | bool public emergency;
| bool public emergency;
| 19,968 |
11 | // 4: no partial fills, anyone can execute | ETH_TO_ERC1155_FULL_OPEN,
| ETH_TO_ERC1155_FULL_OPEN,
| 32,992 |
40 | // BurnableStandard ERC20 token / | contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint value);
function burn(uint _value) returns (bool success) {
require(_value > 0 && balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.... | contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint value);
function burn(uint _value) returns (bool success) {
require(_value > 0 && balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.... | 35,068 |
14 | // ------------------------------------------------------------------------------------------------------ Public functions/ Purchase pixel / | function buy(uint[] memory _index, uint8[] memory _color, uint[] memory _price, address _referrar) public payable { //injected LOCKED ETHER
require(now < expiration, "revert8"); // Is the game still going?
require(_index.length == _color.length, "revert9");
require(_index.l... | function buy(uint[] memory _index, uint8[] memory _color, uint[] memory _price, address _referrar) public payable { //injected LOCKED ETHER
require(now < expiration, "revert8"); // Is the game still going?
require(_index.length == _color.length, "revert9");
require(_index.l... | 5,920 |
22 | // solhint-enable no-complex-fallback //Implementation slot is accessed directly./Saves gas compared to using storage slot library./implementation Address of the implementation. | struct ImplementationSlot {
address implementation;
}
| struct ImplementationSlot {
address implementation;
}
| 39,165 |
7 | // Emitted when the active state of a pool is changed Logs the pool's ID and its new active state poolId The ID of the pool isActive The new active state of the pool / | event IsActiveChanged(uint256 indexed poolId, bool isActive);
| event IsActiveChanged(uint256 indexed poolId, bool isActive);
| 25,698 |
117 | // Add recipient to stakeholders if not exist Admin will not get added | _addStakeholder(recipient);
return true;
| _addStakeholder(recipient);
return true;
| 5,614 |
71 | // Stores Stake Details | struct stakeInfo {
address user;
bool[] isActive;
address[] referrer;
address[] tokenAddress;
uint256[] stakeId;
uint256[] stakedAmount;
uint256[] startTime;
}
| struct stakeInfo {
address user;
bool[] isActive;
address[] referrer;
address[] tokenAddress;
uint256[] stakeId;
uint256[] stakedAmount;
uint256[] startTime;
}
| 27,655 |
140 | // Mint a FirstEdition token for a price | /// Emits a {FirstEditionMintExecuted} event.
function payableMint() external payable whenNotPaused {
uint256 price = huxleyComics.getCurrentPrice();
require(price == msg.value, "Huxley: invalid price");
uint256 maxPayableMintBatch = huxleyComics.getCurrentMaxPayableMintBatch();
... | /// Emits a {FirstEditionMintExecuted} event.
function payableMint() external payable whenNotPaused {
uint256 price = huxleyComics.getCurrentPrice();
require(price == msg.value, "Huxley: invalid price");
uint256 maxPayableMintBatch = huxleyComics.getCurrentMaxPayableMintBatch();
... | 40,271 |
204 | // Each batch forged will have a correlated 'l1L2TxDataHash' | mapping(uint32 => bytes32) public l1L2TxsDataHashMap;
| mapping(uint32 => bytes32) public l1L2TxsDataHashMap;
| 79,231 |
6 | // Data passed into the contract when it's first created initializing the characters. We're going to actually pass these values in from run.js |
constructor(
string[] memory characterNames,
string[] memory characterImageURIs,
string[] memory characterWeapons,
uint256[] memory characterHp,
uint256[] memory characterAttackDmg,
string memory bossName,
string memory bossImageURI,
string memory bos... |
constructor(
string[] memory characterNames,
string[] memory characterImageURIs,
string[] memory characterWeapons,
uint256[] memory characterHp,
uint256[] memory characterAttackDmg,
string memory bossName,
string memory bossImageURI,
string memory bos... | 53,520 |
357 | // Update Last Claim | lastClaim[tokenId] = block.timestamp;
CANDY_TOKEN.mint(msg.sender, amount);
emit RewardsClaimed(msg.sender, tokenId, amount, block.timestamp);
| lastClaim[tokenId] = block.timestamp;
CANDY_TOKEN.mint(msg.sender, amount);
emit RewardsClaimed(msg.sender, tokenId, amount, block.timestamp);
| 63,580 |
4 | // Multiplies two unsigned integers, reverts on overflow. / | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
... | 8,222 |
137 | // extract an order from a 256b integer | function _uint2order(uint n) internal pure returns (Order memory) {
Order memory order;
order.nextID = uint32(n & ((1<<22)-1));
n = n >> 22;
order.amount = uint64(n & ((1<<42)-1));
n = n >> 42;
order.price = uint32(n & ((1<<32)-1));
n = n >> 32;
order.... | function _uint2order(uint n) internal pure returns (Order memory) {
Order memory order;
order.nextID = uint32(n & ((1<<22)-1));
n = n >> 22;
order.amount = uint64(n & ((1<<42)-1));
n = n >> 42;
order.price = uint32(n & ((1<<32)-1));
n = n >> 32;
order.... | 28,037 |
128 | // Returns the minimum bond that can answer the question/question_id The ID of the question | function getMinBond(bytes32 question_id)
| function getMinBond(bytes32 question_id)
| 26,632 |
36 | // Where we check for certifiers. | CertifierDbI private certifierDb;
| CertifierDbI private certifierDb;
| 29,304 |
45 | // Returns whether the target address is a contract This function will return false if invoked during the constructor of a contract,as the code is not actually created until after the constructor finishes. account address of the account to checkreturn whether the target address is a contract / | function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details... | function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details... | 49,811 |
79 | // Mapping from token ID to owner | mapping (uint256 => address) public tokenOwner;
| mapping (uint256 => address) public tokenOwner;
| 45,677 |
27 | // make sure there are at least 3 participants | uint256 tokensCount = getCurrentLotteryTokensCount();
require(tokensCount >= 3, "minimum tokens sold required");
require(
lotteryIdExpiry[lotteryIds.current()] < block.timestamp,
"Lottery is still running!"
);
bytes32 requestId = getRandomNumber(userProv... | uint256 tokensCount = getCurrentLotteryTokensCount();
require(tokensCount >= 3, "minimum tokens sold required");
require(
lotteryIdExpiry[lotteryIds.current()] < block.timestamp,
"Lottery is still running!"
);
bytes32 requestId = getRandomNumber(userProv... | 42,691 |
77 | // detach market from rest of list | user[_market][index[_market][_market][i]].prev = _market;
user[_market][index[_market][_market][i]].next = _market;
user[_lastOwner][index[_lastOwner][_market][i]]
.prev = address(this);
user[_lastBid][index[_lastBid... | user[_market][index[_market][_market][i]].prev = _market;
user[_market][index[_market][_market][i]].next = _market;
user[_lastOwner][index[_lastOwner][_market][i]]
.prev = address(this);
user[_lastBid][index[_lastBid... | 35,041 |
30 | // Store the mapping of token id to the edition being purchased. | tokenToEdition[nextTokenId] = editionId;
emit EditionPurchased(
editionId,
nextTokenId,
editions[editionId].numSold,
msg.sender
);
nextTokenId++;
| tokenToEdition[nextTokenId] = editionId;
emit EditionPurchased(
editionId,
nextTokenId,
editions[editionId].numSold,
msg.sender
);
nextTokenId++;
| 30,114 |
16 | // Fetch the owner | address payable _seller = _ticket.owner;
| address payable _seller = _ticket.owner;
| 41,183 |
7 | // The Ownable constructor sets the original `owner` of the contract to the sender account. / | constructor() public {
owner = msg.sender;
}
| constructor() public {
owner = msg.sender;
}
| 4,424 |
237 | // Emits {Unwrapped} and {IERC20-Transfer} events. / | function unwrap(string memory extTo, uint256 amount) public returns (bool) {
require(_isPCIAddress(extTo), "Wrapper: invalid PCI address");
require(amount > 0, "Wrapper: zero amount");
_burn(_msgSender(), amount);
emit Unwrapped(_msgSender(), amount, extTo);
return true;
... | function unwrap(string memory extTo, uint256 amount) public returns (bool) {
require(_isPCIAddress(extTo), "Wrapper: invalid PCI address");
require(amount > 0, "Wrapper: zero amount");
_burn(_msgSender(), amount);
emit Unwrapped(_msgSender(), amount, extTo);
return true;
... | 24,781 |
20 | // List of exchange rates for each token volume / | ExchangeRate[4] public exchangeRates;
| ExchangeRate[4] public exchangeRates;
| 13,079 |
1 | // Exposes the function pointers as `uint16` values packed into a single/ `bytes` in the same order as they would be indexed into by opcodes. For/ example, if opcode `2` should dispatch function at position `0x1234` then/ the start of the returned bytes would be `0xXXXXXXXX1234` where `X` is/ a placeholder for the func... | function functionPointers() external view returns (bytes memory);
| function functionPointers() external view returns (bytes memory);
| 18,114 |
1 | // If the user is already registered | if (userIsRegistered(msg.sender)) {
return false;
}
| if (userIsRegistered(msg.sender)) {
return false;
}
| 20,722 |
21 | // Only active airlines can register/vote | requireIsActiveAirline()
| requireIsActiveAirline()
| 25,988 |
2 | // KYC data can not be present if added is false and hence we can set packed KYC as uint256(1) to set added as true | _dataStore.setUint256(_getKey(WHITELIST, _holder), uint256(1));
| _dataStore.setUint256(_getKey(WHITELIST, _holder), uint256(1));
| 23,914 |
7 | // Documents Denis Jazbec You can use this contract for storing documents Store & retrieve documents / | contract Documents {
struct Document {
address sender;
bytes data;
uint256 sentAt;
uint256 openedAt;
}
mapping(address => Document[]) internal documents;
// Events
event SetDocument(
address sender,
address receiver,
bytes data,
uint2... | contract Documents {
struct Document {
address sender;
bytes data;
uint256 sentAt;
uint256 openedAt;
}
mapping(address => Document[]) internal documents;
// Events
event SetDocument(
address sender,
address receiver,
bytes data,
uint2... | 34,445 |
102 | // getEscapeRequest(): returns _point&39;s current escape requestthe returned escape request is only valid as long as isEscaping()returns true | function getEscapeRequest(uint32 _point)
view
external
returns (uint32 escape)
| function getEscapeRequest(uint32 _point)
view
external
returns (uint32 escape)
| 38,471 |
108 | // New options can be createdRedemption token holders can redeem their options for collateralCollateral token holders can't do anything / | OPEN,
| OPEN,
| 7,086 |
56 | // we can just add to the slot contents because the bytes we want to change are the LSBs | fslot,
add(
mul(
div(
| fslot,
add(
mul(
div(
| 8,555 |
17 | // because we zero-out the existing amount for each coin in the Rebalance Proposal above, we can safely assume that any coin left with an amount > 0 has been removed and calculate fee based on existing amount. | if (uints[6] > 0) {
(uints[7],,) = CerberusOracle(Registrar(portfolioLib.registrar).registry('oracle')).get(portfolioLib.coinsHeld[i]);
| if (uints[6] > 0) {
(uints[7],,) = CerberusOracle(Registrar(portfolioLib.registrar).registry('oracle')).get(portfolioLib.coinsHeld[i]);
| 21,356 |
178 | // estimate pending reward from distributor | uint256 pending = token == tru ? distributor.nextDistribution() : 0;
| uint256 pending = token == tru ? distributor.nextDistribution() : 0;
| 54,105 |
9 | // Element Finance/Yearn Vault Asset Proxy | contract YVaultV4AssetProxy is YVaultAssetProxy {
/// @notice Constructs this contract by calling into the super constructor
/// @param vault_ The yearn v2 vault, must be version 0.4.2
/// @param _token The underlying token.
/// This token should revert in the event of a transfer failure.
... | contract YVaultV4AssetProxy is YVaultAssetProxy {
/// @notice Constructs this contract by calling into the super constructor
/// @param vault_ The yearn v2 vault, must be version 0.4.2
/// @param _token The underlying token.
/// This token should revert in the event of a transfer failure.
... | 16,083 |
33 | // uint feeAmount = returnAmount.mul(fee) / (ONE.sub(fee)); | uint feeLPAmount = returnAmount.mul(lpFee) / ONE;
feePoolWeight = feePoolWeight.add(feeLPAmount);
uint returnAmountPlusFees = returnAmount.add(feeLPAmount);
mergePositionsThroughAllConditions(returnAmountPlusFees);
collateralToken.safeTransfer(beneficiary, returnAmount)... | uint feeLPAmount = returnAmount.mul(lpFee) / ONE;
feePoolWeight = feePoolWeight.add(feeLPAmount);
uint returnAmountPlusFees = returnAmount.add(feeLPAmount);
mergePositionsThroughAllConditions(returnAmountPlusFees);
collateralToken.safeTransfer(beneficiary, returnAmount)... | 15,147 |
69 | // Divides x between y, rounding up to the closest representable number./ Assumes x and y are both fixed point with `decimals` digits. | function divdrup(uint256 x, uint256 y) internal pure returns (uint256)
| function divdrup(uint256 x, uint256 y) internal pure returns (uint256)
| 65,836 |
24 | // ------------------------------------------------------------------------ 100 Tokens per 1 ETH ------------------------------------------------------------------------ | function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 120;
} else {
tokens = msg.value * 100;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
... | function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 120;
} else {
tokens = msg.value * 100;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
... | 60,879 |
72 | // Grants TRANSFER role to `account`. Grants MINTER role to `account`.Grants BURNER role to `account`. Requirements: - the caller must have ``role``'s admin role. / | function setAdmin(address account) external {
grantRole(MINTER_ROLE, account);
grantRole(BURNER_ROLE, account);
}
| function setAdmin(address account) external {
grantRole(MINTER_ROLE, account);
grantRole(BURNER_ROLE, account);
}
| 10,860 |
4 | // Emits when tokens are transferred. | event TokenTransferred(uint256 tokenId,address from,address to);
| event TokenTransferred(uint256 tokenId,address from,address to);
| 35,527 |
29 | // register event | Transfer(msg.sender, _to, _id);
| Transfer(msg.sender, _to, _id);
| 41,892 |
319 | // If we need to repay debt and are outside the tolerance bands, we do it regardless of the call cost | if (currentRatio < collateralizationRatio.sub(rebalanceTolerance)) {
return true;
}
| if (currentRatio < collateralizationRatio.sub(rebalanceTolerance)) {
return true;
}
| 69,456 |
217 | // support borrow function from pool V2 | function borrow(uint256 amount) external {
borrow(amount, 0);
}
| function borrow(uint256 amount) external {
borrow(amount, 0);
}
| 8,838 |
7 | // solhint-disable-next-line no-simple-event-func-name | event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
| 36,285 |
68 | // Initialize the governor to the contract caller. / | function _initialize(address _initGovernor) internal {
governor = _initGovernor;
}
| function _initialize(address _initGovernor) internal {
governor = _initGovernor;
}
| 40,623 |
3 | // Executes a message affirmation for some Foreign side event.Can be called only by a current bridge validator. recipient tokens/coins of receiver address, where the assets should be unlocked/minted. value amount of assets to unlock/mint. transactionHash reference event transaction hash on the Foreign side of the bridg... | function executeAffirmation(address recipient, uint256 value, bytes32 transactionHash) external onlyValidator {
bytes32 hashMsg = keccak256(abi.encodePacked(recipient, value, transactionHash));
if (withinExecutionLimit(value)) {
bytes32 hashSender = keccak256(abi.encodePacked(msg.sender,... | function executeAffirmation(address recipient, uint256 value, bytes32 transactionHash) external onlyValidator {
bytes32 hashMsg = keccak256(abi.encodePacked(recipient, value, transactionHash));
if (withinExecutionLimit(value)) {
bytes32 hashSender = keccak256(abi.encodePacked(msg.sender,... | 18,165 |
6 | // Nothing to remove | if (registry.length == 0) return;
| if (registry.length == 0) return;
| 31,838 |
71 | // mints new pintokens, can only be called by BubbleToken / contract during burns, no users or dev can call this | function mint(address _to, uint256 _amount) public onlyOwner {
require(totalSupply().add(_amount) <= _cap, "Pin: cap exceeded");
_mint(_to, _amount);
}
| function mint(address _to, uint256 _amount) public onlyOwner {
require(totalSupply().add(_amount) <= _cap, "Pin: cap exceeded");
_mint(_to, _amount);
}
| 42,722 |
240 | // ./contracts/token/IIncentive.sol/ pragma solidity ^0.6.2; //incentive contract interface/Fei Protocol/Called by FEI token contract when transferring with an incentivized address/should be appointed as a Minter or Burner as needed | interface IIncentive {
// ----------- Fei only state changing api -----------
/// @notice apply incentives on transfer
/// @param sender the sender address of the FEI
/// @param receiver the receiver address of the FEI
/// @param operator the operator (msg.sender) of the transfer
/// @param amo... | interface IIncentive {
// ----------- Fei only state changing api -----------
/// @notice apply incentives on transfer
/// @param sender the sender address of the FEI
/// @param receiver the receiver address of the FEI
/// @param operator the operator (msg.sender) of the transfer
/// @param amo... | 16,992 |
32 | // Private method to transfer funds to the destination addresses on the basis of transaction type/ | function _transferFunds(
bytes32 scriptHash,
address[]destinations,
uint256[]amounts
)
private
returns (uint256)
| function _transferFunds(
bytes32 scriptHash,
address[]destinations,
uint256[]amounts
)
private
returns (uint256)
| 44,877 |
1 | // Needs to be overcollateralize Needs to provide +2 wei to be safe | return amount.add(2);
| return amount.add(2);
| 46,231 |
0 | // @inheritdoc IKeep3rJobWorkable | function isKeeper(address _keeper) external override returns (bool _isKeeper) {
_initialGas = _getGasLeft();
if (_keepers.contains(_keeper)) {
emit KeeperValidation(_initialGas);
return true;
}
}
| function isKeeper(address _keeper) external override returns (bool _isKeeper) {
_initialGas = _getGasLeft();
if (_keepers.contains(_keeper)) {
emit KeeperValidation(_initialGas);
return true;
}
}
| 368 |
73 | // SMATS per ETH price | uint256 buyPrice;
uint256 minimalGoal;
uint256 hardCap;
Smarts crowdsaleToken;
uint256 tokenUnit = (10 ** 18);
event SellToken(address recepient, uint tokensSold, uint value);
| uint256 buyPrice;
uint256 minimalGoal;
uint256 hardCap;
Smarts crowdsaleToken;
uint256 tokenUnit = (10 ** 18);
event SellToken(address recepient, uint tokensSold, uint value);
| 32,891 |
7 | // User sets EMode for Aave position on Proxy/_market Address provider for specific market/_categoryId eMode category id (0 - 255) | function _setEmode(address _market, uint8 _categoryId)
internal
returns (uint256, bytes memory)
| function _setEmode(address _market, uint8 _categoryId)
internal
returns (uint256, bytes memory)
| 37,179 |
78 | // ◢◣◢◣◢◣◢◣◢◣◢◣◢◣◢◣ add state variables above ◢◣◢◣◢◣◢◣◢◣◢◣◢◣◢◣ | uint256[50] private __gap;
| uint256[50] private __gap;
| 8,600 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.