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 |
|---|---|---|---|---|
63 | // Implements the ICOEngineInterface.return False if the ico is not started, true if the ico is started and running, true if the ico is completed. / | function started() public view returns(bool) {
if (block.timestamp >= start) {
return true;
} else {
return false;
}
}
| function started() public view returns(bool) {
if (block.timestamp >= start) {
return true;
} else {
return false;
}
}
| 5,071 |
154 | // What gets called in a permit | function _approve( address owner, address spender, uint256 value ) internal override virtual {
_allowedValue[owner][spender] = value;
emit Approval( owner, spender, value );
}
| function _approve( address owner, address spender, uint256 value ) internal override virtual {
_allowedValue[owner][spender] = value;
emit Approval( owner, spender, value );
}
| 35,226 |
11 | // Get a withdraw-recommendation. _balance The balance of the token-contract.return The address of the wallet permitted to withdraw ETH into the token-contract.return The amount that should be withdrawn in order for the balance to reach `mid` ETH. / | function getWithdrawParams(uint256 _balance) external view returns (address, uint256);
| function getWithdrawParams(uint256 _balance) external view returns (address, uint256);
| 11,243 |
154 | // unstake requests/ | function setProcessedUnstakeRequest(uint256 _pool, uint256 _req) internal {
unstakeRequests[_pool][_req].processed = true;
}
| function setProcessedUnstakeRequest(uint256 _pool, uint256 _req) internal {
unstakeRequests[_pool][_req].processed = true;
}
| 37,611 |
33 | // If Tellor is broken, both oracles are untrusted, and return last good price | if (_tellorIsBroken(tellorResponse)) {
_changeStatus(Status.bothOraclesUntrusted);
return lastGoodPrice;
}
| if (_tellorIsBroken(tellorResponse)) {
_changeStatus(Status.bothOraclesUntrusted);
return lastGoodPrice;
}
| 9,389 |
103 | // Returns the TRB value of the token with 5 decimals of percision | function getTokenValue() external view returns (uint256) {
if (stakedAt != 0) {
return (stakeAmount + feesCollected).mul(100000).div(totalSupply());
} else {
return 100000;
}
}
| function getTokenValue() external view returns (uint256) {
if (stakedAt != 0) {
return (stakeAmount + feesCollected).mul(100000).div(totalSupply());
} else {
return 100000;
}
}
| 57,626 |
188 | // TERRA INFINITE MECHANICS/ | function mintAndroids(uint numberOfTokens) external payable {
require(
allowMintAndroids ||
(allowMintForWhiteListed && isWhiteListed(msg.sender)), "The Terra Infinite sale is not active at that time");
require(numberOfTokens <= MAX_TOKEN_PURCHASE, "Exceeded max token purcha... | function mintAndroids(uint numberOfTokens) external payable {
require(
allowMintAndroids ||
(allowMintForWhiteListed && isWhiteListed(msg.sender)), "The Terra Infinite sale is not active at that time");
require(numberOfTokens <= MAX_TOKEN_PURCHASE, "Exceeded max token purcha... | 21,397 |
2 | // limits on rebalancing from the farmer, trying to negate errant rebalances | uint256 public rebalanceUpLimit = 100; // maximum of a 1.0% gain per rebalance
uint256 public rebalanceUpWaitTime = 23 hours;
uint256 public lastRebalanceUpTime;
| uint256 public rebalanceUpLimit = 100; // maximum of a 1.0% gain per rebalance
uint256 public rebalanceUpWaitTime = 23 hours;
uint256 public lastRebalanceUpTime;
| 24,150 |
0 | // Stores data for individual token locks used by transferAndLock. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License) / | struct Lock {
uint256 value;
uint64 expiration;
uint32 periodLength;
uint16 periods;
bool staking;
}
| struct Lock {
uint256 value;
uint64 expiration;
uint32 periodLength;
uint16 periods;
bool staking;
}
| 11,226 |
70 | // Unstake the juror if he lost due to inactivity. | if (!disputeKit.isVoteActive(_disputeID, _round, i)) {
uint96[] memory courtIDs = getJurorCourtIDs(account);
for (uint256 j = 0; j < courtIDs.length; j++) {
setStakeForAccount(account, courtIDs[j], 0, 0);
}
| if (!disputeKit.isVoteActive(_disputeID, _round, i)) {
uint96[] memory courtIDs = getJurorCourtIDs(account);
for (uint256 j = 0; j < courtIDs.length; j++) {
setStakeForAccount(account, courtIDs[j], 0, 0);
}
| 20,574 |
22 | // The official record of all proposals ever proposed | mapping (uint256 => Proposal) public proposals;
| mapping (uint256 => Proposal) public proposals;
| 29,867 |
8 | // Sets the TTL for the specified node. node The node to update. ttl The TTL in seconds. / | function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {
emit NewTTL(node, ttl);
records[node].ttl = ttl;
}
| function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {
emit NewTTL(node, ttl);
records[node].ttl = ttl;
}
| 33,905 |
6 | // claim offer using EIP712 and EIP1271 signature verification scheme/buyer address paying for the offer/seller address of the seller/token token used for payment/purchase buyAmount, maxTokenAmount/auctionData offerId, startingPrice, endingPrice, startedAt, duration, packs/ids ids of the Assets being sold/amounts amoun... | function claimSellerOfferViaEIP1271(
address buyer,
address payable seller,
address token,
uint256[] calldata purchase, // buyAmount, maxTokenAmount
uint256[] calldata auctionData,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata sign... | function claimSellerOfferViaEIP1271(
address buyer,
address payable seller,
address token,
uint256[] calldata purchase, // buyAmount, maxTokenAmount
uint256[] calldata auctionData,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata sign... | 21,318 |
5 | // copy contents of old array | for(uint i; i < arrayLength; i++) {
biggerArray[i] = facets_[facetIndex].functionSelectors[i];
}
| for(uint i; i < arrayLength; i++) {
biggerArray[i] = facets_[facetIndex].functionSelectors[i];
}
| 24,324 |
175 | // Update the given pool's DexyToken allocation point and deposit fee. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 1000, "set: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid]... | function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 1000, "set: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid]... | 9,580 |
34 | // Update number colaterals | numberCollaterals.increment();
emit CollateralEvent(collateralId, collaterals[collateralId],_UID);
| numberCollaterals.increment();
emit CollateralEvent(collateralId, collaterals[collateralId],_UID);
| 40,419 |
69 | // This will make the mint transaction apper in EtherScan.io We can remove this after there is a standardized minting event | Transfer(0, receiver, amount);
| Transfer(0, receiver, amount);
| 2,538 |
54 | // emit DebugUint("rollUnder", rollUnder); | (possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
| (possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
| 21,133 |
42 | // Approval implementation owner The address of the account which owns tokens spender The address of the account which may transfer tokens amount The number of tokens that are approved (2^256-1 means infinite) / | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "Yak::_approve: approve from the zero address");
require(spender != address(0), "Yak::_approve: approve to the zero address");
allowances[owner][spender] = amount;
emit Approval(... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "Yak::_approve: approve from the zero address");
require(spender != address(0), "Yak::_approve: approve to the zero address");
allowances[owner][spender] = amount;
emit Approval(... | 2,275 |
86 | // Allows the owner to revoke the vesting. Tokens already vestedremain in the contract, the rest are returned to the owner. token ERC20 token which is being vested / | function revoke(IERC20 token) public onlyOwner {
require(_revocable);
require(!_revoked[address(token)]);
uint256 balance = token.balanceOf(address(this));
uint256 unreleased = _releasableAmount(token);
uint256 refund = balance.sub(unreleased);
_revoked[address(tok... | function revoke(IERC20 token) public onlyOwner {
require(_revocable);
require(!_revoked[address(token)]);
uint256 balance = token.balanceOf(address(this));
uint256 unreleased = _releasableAmount(token);
uint256 refund = balance.sub(unreleased);
_revoked[address(tok... | 17,022 |
154 | // Change the percent going to stakers for WETH -------------------- | function startChangeStakersPercent(uint256 _percent) external onlyGovernance {
require(_percent <= 100000,"Percent cannot be greater than 100%");
_timelockStart = now;
_timelockType = 6;
_timelock_data_1 = _percent;
}
| function startChangeStakersPercent(uint256 _percent) external onlyGovernance {
require(_percent <= 100000,"Percent cannot be greater than 100%");
_timelockStart = now;
_timelockType = 6;
_timelock_data_1 = _percent;
}
| 3,056 |
12 | // deposit/stake | function stake(address asset, uint256 amount, uint256 poolId) public {
PoolInfo storage pool = poolInfo[poolId];
pool.balance = pool.balance.add(amount);
emit Stake(msg.sender, amount, block.timestamp);
}
| function stake(address asset, uint256 amount, uint256 poolId) public {
PoolInfo storage pool = poolInfo[poolId];
pool.balance = pool.balance.add(amount);
emit Stake(msg.sender, amount, block.timestamp);
}
| 7,107 |
51 | // Calculates the utilization rate for the given asset _supply The total supply for the given asset _demand The total demand for the given asset / | function utilizationRate(uint256 _supply, uint256 _demand)
public
pure
returns (uint256)
| function utilizationRate(uint256 _supply, uint256 _demand)
public
pure
returns (uint256)
| 30,027 |
57 | // Income should go here. / | function deposit() payable {
onDeposit(msg.sender, msg.value);
lifetimeDeposits += msg.value;
deposits[msg.sender].push(Deposit({ amount: msg.value, block: now }));
}
| function deposit() payable {
onDeposit(msg.sender, msg.value);
lifetimeDeposits += msg.value;
deposits[msg.sender].push(Deposit({ amount: msg.value, block: now }));
}
| 34,673 |
8 | // EVENTS/ | event setBaseURIEvent(string indexed baseURI);
event setOwnersExplicitEvent(uint256 indexed quantity);
event WithdrawAllEvent(address indexed to, uint256 amount);
event ReceivedEther(address indexed sender, uint256 indexed amount);
constructor(
address _openseaProxyRegistryAddress
| event setBaseURIEvent(string indexed baseURI);
event setOwnersExplicitEvent(uint256 indexed quantity);
event WithdrawAllEvent(address indexed to, uint256 amount);
event ReceivedEther(address indexed sender, uint256 indexed amount);
constructor(
address _openseaProxyRegistryAddress
| 41,878 |
52 | // Convert any assets if needed | _conversionHelper(converstionDetails);
| _conversionHelper(converstionDetails);
| 31,454 |
112 | // _fromToken will be either fromToken or toToken of the previous path | address _fromToken = i > 0 ? path[i - 1].to : fromToken;
address _toToken = path[i].to;
uint256 _fromAmount = i > 0 ? Utils.tokenBalance(_fromToken, address(this)) : fromAmount;
if (i > 0 && _fromToken == Utils.ethAddress()) {
_fromAmount = _fromAmount.su... | address _fromToken = i > 0 ? path[i - 1].to : fromToken;
address _toToken = path[i].to;
uint256 _fromAmount = i > 0 ? Utils.tokenBalance(_fromToken, address(this)) : fromAmount;
if (i > 0 && _fromToken == Utils.ethAddress()) {
_fromAmount = _fromAmount.su... | 12,080 |
53 | // Used in memory in `nextTradePair` to duck the stack limit | struct MaxSurplusDeficit {
CollateralStatus surplusStatus; // starts SOUND
uint192 surplus; // {UoA}
uint192 deficit; // {UoA}
}
| struct MaxSurplusDeficit {
CollateralStatus surplusStatus; // starts SOUND
uint192 surplus; // {UoA}
uint192 deficit; // {UoA}
}
| 40,242 |
22 | // internal | function payFee(
address to,
uint256 amount
| function payFee(
address to,
uint256 amount
| 17,563 |
37 | // The block at which voting ends: votes must be cast prior to this block | uint256 endBlock;
| uint256 endBlock;
| 24,404 |
117 | // Perform an ERC20 token transferFrom. Designed to be called by transferFrom functionspossessing the optionalProxy or optionalProxy modifiers. / | function _transferFrom_byProxy(address sender, address from, address to, uint value, bytes data)
internal
returns (bool)
| function _transferFrom_byProxy(address sender, address from, address to, uint value, bytes data)
internal
returns (bool)
| 22,663 |
73 | // validate signature elements | bytes32 digest =
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
VOTE_HASH,
signer,
... | bytes32 digest =
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
VOTE_HASH,
signer,
... | 19,384 |
39 | // Burns away the oTokens to redeem the asset collateral/Operation to burn away the oTOkens in redemption of the asset collateral/_amount Amount of calls to burn | function burnOptions(uint256 _amount) external onlyManager nonReentrant() whenNotPaused() {
if(!_withdrawalWindowCheck(false))
revert WithdrawalWindowActive();
if(_amount > IERC20(oToken).balanceOf(address(this)))
revert Invalid();
Actions.ActionArgs[] memory actions... | function burnOptions(uint256 _amount) external onlyManager nonReentrant() whenNotPaused() {
if(!_withdrawalWindowCheck(false))
revert WithdrawalWindowActive();
if(_amount > IERC20(oToken).balanceOf(address(this)))
revert Invalid();
Actions.ActionArgs[] memory actions... | 7,477 |
9 | // return x / y + ((x % y == 0) ? 0 : 1); | require(y > 0);
assembly {
z := add(div(x, y), gt(mod(x, y), 0))
}
| require(y > 0);
assembly {
z := add(div(x, y), gt(mod(x, y), 0))
}
| 22,473 |
115 | // -----------------------------------------------------------------------/ State updates/ ----------------------------------------------------------------------- |
emergencyExitStatusOfVault[vault] = EmergencyExitStatus({
activated: true,
pytPriceInUnderlying: pytPriceInUnderlying
});
|
emergencyExitStatusOfVault[vault] = EmergencyExitStatus({
activated: true,
pytPriceInUnderlying: pytPriceInUnderlying
});
| 4,037 |
0 | // Storage for slot to check user mints/target contract -> tokenId -> minter user -> numberMinted/No gap or stroage interface since this is used within non-upgradeable contracts | mapping(address => mapping(uint256 => mapping(address => uint256))) internal mintedPerAddress;
function getMintedPerWallet(address tokenContract, uint256 tokenId, address wallet) external view returns (uint256) {
return mintedPerAddress[tokenContract][tokenId][wallet];
}
| mapping(address => mapping(uint256 => mapping(address => uint256))) internal mintedPerAddress;
function getMintedPerWallet(address tokenContract, uint256 tokenId, address wallet) external view returns (uint256) {
return mintedPerAddress[tokenContract][tokenId][wallet];
}
| 27,095 |
4 | // Interface to the digital media store external contract that isresponsible for storing the common digital media and collection data.This allows for new token contracts to be deployed and continue to referencethe digital media and collection data. / | abstract contract ApprovedCreatorRegistryInterface {
function getVersion() virtual public pure returns (uint);
function typeOfContract() virtual public pure returns (string calldata);
function isOperatorApprovedForCustodialAccount(
address _operator,
address _custodialAddress) virtual publi... | abstract contract ApprovedCreatorRegistryInterface {
function getVersion() virtual public pure returns (uint);
function typeOfContract() virtual public pure returns (string calldata);
function isOperatorApprovedForCustodialAccount(
address _operator,
address _custodialAddress) virtual publi... | 54,240 |
1 | // transfer ETH from this contract to recipient | function ethThisTransferTo(
address recipient,
uint256 amount
)external;
| function ethThisTransferTo(
address recipient,
uint256 amount
)external;
| 54,929 |
147 | // Grants `role` to `account`. | * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "Not admin");
_grantRole... | * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "Not admin");
_grantRole... | 25,433 |
4 | // Used by Voter to allow batched reward claims | function getRewardForOwner(uint tokenId, address[] memory tokens)
external
override
| function getRewardForOwner(uint tokenId, address[] memory tokens)
external
override
| 28,742 |
19 | // Method: _buyFor, privatePayable the sends equivilent tokens calculated based on the rate to the _receiver set by msg.sender. Parameters:- `address _receiver` -> non zero address of the receiver of the tokens.- `uint256 _msgValue` -> non zero amount of ETH in WEI the sender sent.Returns:The total amount of tokens the... | function _buyFor(address _receiver, uint256 _msgValue) private returns(uint256) {
require(_msgValue > 0, "Error! Invalid or Insufficient Amount.");
require(self != address(0), "Error! Uninitialized self.");
uint256 tokenAmount = _msgValue.div(rate);
uint256 tokenAllowance = ... | function _buyFor(address _receiver, uint256 _msgValue) private returns(uint256) {
require(_msgValue > 0, "Error! Invalid or Insufficient Amount.");
require(self != address(0), "Error! Uninitialized self.");
uint256 tokenAmount = _msgValue.div(rate);
uint256 tokenAllowance = ... | 32,810 |
138 | // Update the message sender's account. This will assure that any credit that was earned is not overridden. | _poke(msg.sender);
uint256 shares = _yieldTokens[yieldToken].totalShares - _accounts[msg.sender].balances[yieldToken];
_yieldTokens[yieldToken].accruedWeight += amount * FIXED_POINT_SCALAR / shares;
_accounts[msg.sender].lastAccruedWeights[yieldToken] = _yieldTokens[yieldToken].accrued... | _poke(msg.sender);
uint256 shares = _yieldTokens[yieldToken].totalShares - _accounts[msg.sender].balances[yieldToken];
_yieldTokens[yieldToken].accruedWeight += amount * FIXED_POINT_SCALAR / shares;
_accounts[msg.sender].lastAccruedWeights[yieldToken] = _yieldTokens[yieldToken].accrued... | 68,978 |
4 | // Define the state machine for leasing | enum LeaseState {Created, Signed, Occupied, Terminated}
// Lease as the state variable
Lease public lease;
// Keep a record of all payments and account balance
struct Deposit
// التأمين
{
uint sequence;
uint amount;
}
| enum LeaseState {Created, Signed, Occupied, Terminated}
// Lease as the state variable
Lease public lease;
// Keep a record of all payments and account balance
struct Deposit
// التأمين
{
uint sequence;
uint amount;
}
| 31,789 |
336 | // ensure the caller owns the egg they want to hatch | require(_owns(msg.sender, _fishId));
_hatchFish(_fishId, _geneSet1, _geneSet2);
| require(_owns(msg.sender, _fishId));
_hatchFish(_fishId, _geneSet1, _geneSet2);
| 37,072 |
37 | // TODO conversion? safe math? prevent over withdrawals | assert(int(left.withdrawal) <= int(left.deposit) + left.credit);
| assert(int(left.withdrawal) <= int(left.deposit) + left.credit);
| 9,361 |
71 | // solhint-disable func-order // Balancer Labs Highly opinionated token implementation/ | contract PCToken is IERC20 {
using BalancerSafeMath for uint;
// State variables
string public constant NAME = "Spook Smart Pool";
uint8 public constant DECIMALS = 18;
// No leading underscore per naming convention (non-private)
// Cannot call totalSupply (name conflict)
// solhint-disable... | contract PCToken is IERC20 {
using BalancerSafeMath for uint;
// State variables
string public constant NAME = "Spook Smart Pool";
uint8 public constant DECIMALS = 18;
// No leading underscore per naming convention (non-private)
// Cannot call totalSupply (name conflict)
// solhint-disable... | 24,635 |
19 | // else enable refunds | vault.enableRefunds();
| vault.enableRefunds();
| 49,468 |
1 | // A processed deposit event. | event DepositEvent(
bytes pubkey,
bytes withdrawal_credentials,
bytes amount,
bytes signature,
bytes index
);
| event DepositEvent(
bytes pubkey,
bytes withdrawal_credentials,
bytes amount,
bytes signature,
bytes index
);
| 18,127 |
196 | // dont overmint | require(amount <= TOKEN_LIMIT-numTokens,"Not enough Birbs left to mint");
| require(amount <= TOKEN_LIMIT-numTokens,"Not enough Birbs left to mint");
| 62,246 |
175 | // Because this is removing the token from the pool, the in-memory denorm value is irrelevant, as it is only used to calculate the new spot price, but the spot price calc will throw if it is passed 0 for the denorm. | _unbind(token);
| _unbind(token);
| 12,434 |
32 | // par is a ray, pip returns a wad | tag[ilk] = wdiv(spot.par(), uint(pip.read()));
| tag[ilk] = wdiv(spot.par(), uint(pip.read()));
| 40,390 |
161 | // Call addPaid on model | paid = _safePay(id, debt.model, available);
require(paid <= available, "Paid can't exceed available");
| paid = _safePay(id, debt.model, available);
require(paid <= available, "Paid can't exceed available");
| 44,100 |
11 | // events --- | event Created(bytes32 _tradeHash);
event SellerCancelDisabled(bytes32 _tradeHash);
event SellerRequestedCancel(bytes32 _tradeHash);
event CancelledBySeller(bytes32 _tradeHash);
event CancelledByBuyer(bytes32 _tradeHash);
event Released(bytes32 _tradeHash);
event DisputeResolved(bytes32 _trad... | event Created(bytes32 _tradeHash);
event SellerCancelDisabled(bytes32 _tradeHash);
event SellerRequestedCancel(bytes32 _tradeHash);
event CancelledBySeller(bytes32 _tradeHash);
event CancelledByBuyer(bytes32 _tradeHash);
event Released(bytes32 _tradeHash);
event DisputeResolved(bytes32 _trad... | 2,270 |
129 | // reduce the netPosted (in storage) to value after excess settlement funds deducted | receipt.netPosted = requiredAmountPosted.toUint232();
| receipt.netPosted = requiredAmountPosted.toUint232();
| 37,821 |
101 | // Convenience method to get account balances for given tokens./_trader Account to check balances for./_assetAddresses Array of token addresses./ return Account balances for each token. | function getExternalBalances(address _trader, address[] memory _assetAddresses)
public
view
returns (uint256[] memory)
| function getExternalBalances(address _trader, address[] memory _assetAddresses)
public
view
returns (uint256[] memory)
| 52,631 |
10 | // Proxy Implements delegation of calls to other contracts, with properforwarding of return values and bubbling of failures.It defines a fallback function that delegates all calls to the addressreturned by the abstract _implementation() internal function. / | abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
receive () payable external {}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view virtual returns (ad... | abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
receive () payable external {}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view virtual returns (ad... | 2,039 |
1 | // DEFINE CONSTANTS //DEFINE STRUCTURES // Admin Struct handles the admin mapping of address as well as the id to which they are / | struct Admin {
bool authorized;
uint id;
}
| struct Admin {
bool authorized;
uint id;
}
| 16,704 |
12 | // PLAYER DATA | mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address
mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name
mapping (uint256 => RSdatasets.Player) public plyr_; // (pID => data) player data
mapping (uint256 =>... | mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address
mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name
mapping (uint256 => RSdatasets.Player) public plyr_; // (pID => data) player data
mapping (uint256 =>... | 28,177 |
68 | // Loop until an address that matches the provided one is found. | bool found = false;
address target;
uint256 nonce = 0;
while (nonce < 10) {
target = address( // derive the target deployment address.
uint160( // downcast to match the address type.
uint256( // cast to uint to truncate upper digits.
... | bool found = false;
address target;
uint256 nonce = 0;
while (nonce < 10) {
target = address( // derive the target deployment address.
uint160( // downcast to match the address type.
uint256( // cast to uint to truncate upper digits.
... | 30,013 |
762 | // Gets the vote id of a given claim of a given Claim Assessor. / | function getUserClaimVoteCA(
address _add,
uint _claimId
)
external
view
returns (uint idVote)
| function getUserClaimVoteCA(
address _add,
uint _claimId
)
external
view
returns (uint idVote)
| 28,855 |
23 | // uint _sqrt = wmul(wmul(_x1, _y1), wmul(_x2, _y2)); _sqrt = sqrt(_sqrt); arbNum = sub(_sqrt, a); arbNum = arbNum / b; | }
| }
| 17,521 |
15 | // The token being sold | MintableToken public token;
| MintableToken public token;
| 840 |
61 | // Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}./ | function _exists(uint256 tokenId) internal view returns (bool) {
return _tokenOwners.contains(tokenId);
}
| function _exists(uint256 tokenId) internal view returns (bool) {
return _tokenOwners.contains(tokenId);
}
| 18,741 |
85 | // Equals to bytes4(keccak256("onERC721Received(address,uint256,bytes)")) | bytes4 ERC721_RECEIVED = bytes4(0xf0b9e5ba);
require(
IERC721Receiver(to).onERC721Received(
assetId, holder, userData
) == ERC721_RECEIVED
);
| bytes4 ERC721_RECEIVED = bytes4(0xf0b9e5ba);
require(
IERC721Receiver(to).onERC721Received(
assetId, holder, userData
) == ERC721_RECEIVED
);
| 8,123 |
92 | // Called to get the current pool shares of a user/userAddress User address/ return Current pool shares of the user | function userShares(address userAddress)
public
view
override
returns (uint256)
| function userShares(address userAddress)
public
view
override
returns (uint256)
| 48,978 |
5 | // We read and store the value's index to prevent multiple reads from the same storage slot | uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
| uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
| 8,100 |
123 | // Developer team coverage | percentDevteam = _percentDevteam;
| percentDevteam = _percentDevteam;
| 54,057 |
20 | // Error codes that describe all possible failure reasons reported in the `TransactionRelayed` event `status` field.OK The transaction was successfully relayed and execution successful - never included in the event.RelayedCallFailed The transaction was relayed, but the relayed call failed.RejectedByPreRelayed The trans... | enum RelayCallStatus {
address to,
address relayWorker,
bytes4 selector,
uint256 innerGasUsed,
bytes reason
);
address indexed relayManager,
address indexed relayWorker,
bytes32 indexed relayRequestID,
address from,
address to,
... | enum RelayCallStatus {
address to,
address relayWorker,
bytes4 selector,
uint256 innerGasUsed,
bytes reason
);
address indexed relayManager,
address indexed relayWorker,
bytes32 indexed relayRequestID,
address from,
address to,
... | 11,189 |
25 | // Expiration timestamp for migrated domains. | uint public transferPeriodEnds;
| uint public transferPeriodEnds;
| 33,810 |
30 | // Transfers the NFT to the owner/tokenId The id of the erc721 | function retrieveNFT(uint256 tokenId) external {
// must be the owner of the NFT
require(msg.sender == deposits[tokenId].owner, "Not the owner");
// remove information related to tokenId
delete deposits[tokenId];
// transfer ownership to original owner
INonfungiblePos... | function retrieveNFT(uint256 tokenId) external {
// must be the owner of the NFT
require(msg.sender == deposits[tokenId].owner, "Not the owner");
// remove information related to tokenId
delete deposits[tokenId];
// transfer ownership to original owner
INonfungiblePos... | 57,039 |
31 | // lambo delivery service | withdraw();
| withdraw();
| 2,134 |
74 | // Update all values | _claimAndLock(msg.sender);
UserInfo storage user = users[msg.sender];
if (user.depositAmount == 0) {
revert SasWecoin__NoBalanceToWithdraw();
}
| _claimAndLock(msg.sender);
UserInfo storage user = users[msg.sender];
if (user.depositAmount == 0) {
revert SasWecoin__NoBalanceToWithdraw();
}
| 10,613 |
42 | // Set the additional logic handlers _priceHandlerAddr The price handler _refundHandlerAddr The refund handler / | // function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr, address _missionEventsHandlerAddr ) external onlyAdmin {
function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr ) external onlyAdmin {
// Set the handler
priceHandler = PriceHandler(_priceHandle... | // function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr, address _missionEventsHandlerAddr ) external onlyAdmin {
function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr ) external onlyAdmin {
// Set the handler
priceHandler = PriceHandler(_priceHandle... | 29,420 |
0 | // Addresses that can unlock | address[] public ADMIN_ADDRESS;
mapping(uint256 => bool) public aiUnlocked; // Token ID => unlocked
event Unlock(uint256[] tokenIds);
| address[] public ADMIN_ADDRESS;
mapping(uint256 => bool) public aiUnlocked; // Token ID => unlocked
event Unlock(uint256[] tokenIds);
| 29,185 |
322 | // redeemTokens = redeemAmountIn 1e18 / exchangeRate. must be more than 0a rounding error means we need another small addition | if(deleveragedAmount.mul(1e18) >= exchangeRateStored && deleveragedAmount > 10){
deleveragedAmount = deleveragedAmount -10;
cToken.redeemUnderlying(deleveragedAmount);
| if(deleveragedAmount.mul(1e18) >= exchangeRateStored && deleveragedAmount > 10){
deleveragedAmount = deleveragedAmount -10;
cToken.redeemUnderlying(deleveragedAmount);
| 30,716 |
270 | // Set max supply, cost per category and size. | function setRate(uint256 _size, uint256 _cost, uint256 _total, string memory _rarity) public onlyOwner {
rates[_size][_rarity].cost = _cost;
rates[_size][_rarity].total = _total;
rates[_size][_rarity].valid = true;
}
| function setRate(uint256 _size, uint256 _cost, uint256 _total, string memory _rarity) public onlyOwner {
rates[_size][_rarity].cost = _cost;
rates[_size][_rarity].total = _total;
rates[_size][_rarity].valid = true;
}
| 39,024 |
247 | // transfer funds to token owner | (bool success, ) = payable(msg.sender).call{ value: totalPayout }("");
| (bool success, ) = payable(msg.sender).call{ value: totalPayout }("");
| 48,764 |
6 | // IERC165 | function supportsInterface(bytes4 interfaceId) public view virtual override( IERC165, WaifuHouseDAOCore ) returns( bool ){
return
interfaceId == type(IERC721Enumerable).interfaceId ||
interfaceId == type(IERC721).interfaceId ||
super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override( IERC165, WaifuHouseDAOCore ) returns( bool ){
return
interfaceId == type(IERC721Enumerable).interfaceId ||
interfaceId == type(IERC721).interfaceId ||
super.supportsInterface(interfaceId);
}
| 103 |
55 | // Map of users address and their configuration data (userAddress => userConfiguration) | mapping(address => UserConfigurationMap) _usersConfig;
| mapping(address => UserConfigurationMap) _usersConfig;
| 22,780 |
88 | // return Number of transactions, both enabled and disabled, in transactions list. / |
function transactionsSize()
external
view
returns (uint256)
|
function transactionsSize()
external
view
returns (uint256)
| 3,311 |
1 | // Methods |
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function app... |
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function app... | 4,380 |
32 | // function to handle ERC20 bridging to receipent via NativeOptimism-Bridge This method is payable because the caller is doing token transfer and briding operation token address of token being bridged receiverAddress address of receiver of bridged tokens customBridgeAddress OptimismBridge that Performs the logic for de... | function bridgeERC20To(
address token,
address receiverAddress,
address customBridgeAddress,
uint32 l2Gas,
OptimismERC20Data calldata optimismData,
uint256 amount,
uint256 interfaceId,
address l2Token,
bytes calldata data
| function bridgeERC20To(
address token,
address receiverAddress,
address customBridgeAddress,
uint32 l2Gas,
OptimismERC20Data calldata optimismData,
uint256 amount,
uint256 interfaceId,
address l2Token,
bytes calldata data
| 3,361 |
195 | // function _doSafePowahUpdatedAcceptanceCheck(address _owner,uint256 _id,uint256 _oldPowah,uint256 _newPowah)private | // {
// if (_owner.isContract() && _owner.supportsERC165()) {
// if (
// IERC165(_owner).supportsInterface(
// IStarUpdateListener(0).onPowahUpdated.selector
// )
// ) {
// IStarUpdateListener... | // {
// if (_owner.isContract() && _owner.supportsERC165()) {
// if (
// IERC165(_owner).supportsInterface(
// IStarUpdateListener(0).onPowahUpdated.selector
// )
// ) {
// IStarUpdateListener... | 42,130 |
9 | // check to see if artist exists, if not then add it |
if(!artist_exists[_artist]) {
artist.push(_artist);
artist_exists[_artist] = true;
genreToArtists[_genre].push(_artist);
}
|
if(!artist_exists[_artist]) {
artist.push(_artist);
artist_exists[_artist] = true;
genreToArtists[_genre].push(_artist);
}
| 27,416 |
54 | // We use a single lock for the whole contract. / | bool private reentrancy_lock = false;
| bool private reentrancy_lock = false;
| 25,848 |
1 | // V1 - V5: OK | address public owner;
| address public owner;
| 13,144 |
172 | // _amount The total settlement proceeds of a trade or claimreturn The amount of fees the market creator will receive / | function deriveMarketCreatorFeeAmount(uint256 _amount) public view returns (uint256) {
return feeDivisor == 0 ? 0 : _amount / feeDivisor;
}
| function deriveMarketCreatorFeeAmount(uint256 _amount) public view returns (uint256) {
return feeDivisor == 0 ? 0 : _amount / feeDivisor;
}
| 31,622 |
28 | // Do not allow approval if amount exceeds locked amount | unapprovbal=balanceOf[msg.sender].sub(_value,"ERC20: Allowance exceeds balance of approver");
require(unapprovbal>=LockedTokens[msg.sender],"ERC20: Approval amount exceeds locked amount ");
_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _va... | unapprovbal=balanceOf[msg.sender].sub(_value,"ERC20: Allowance exceeds balance of approver");
require(unapprovbal>=LockedTokens[msg.sender],"ERC20: Approval amount exceeds locked amount ");
_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _va... | 4,469 |
9 | // Define a struct 'Item' with the following fields: | struct Item {
uint sku; // Stock Keeping Unit (SKU)
uint upc; // Universal Product Code (UPC), generated by the Farmer, goes on the package, can be verified by the Consumer
address ownerID; // Metamask-Ethereum address of the current owner as the product moves through 8 stages
address originFa... | struct Item {
uint sku; // Stock Keeping Unit (SKU)
uint upc; // Universal Product Code (UPC), generated by the Farmer, goes on the package, can be verified by the Consumer
address ownerID; // Metamask-Ethereum address of the current owner as the product moves through 8 stages
address originFa... | 39,948 |
6 | // Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 4,052 |
121 | // Flat fee for NFT<->NFT trades (represented in wei of ETHER) Default to 0.001 ETH | uint256 public flatFee = 1000000000000000;
| uint256 public flatFee = 1000000000000000;
| 39,760 |
137 | // get the current status for the proposal. / | function getStatus(bytes32 proposeId)
external
view
override
returns (
uint128 appliedMinimumVote,
uint128 currentApprovalVoteSum,
uint128 currentDenialVoteSum,
uint32 prevoteDeadline,
uint32 mainvoteDeadline,
| function getStatus(bytes32 proposeId)
external
view
override
returns (
uint128 appliedMinimumVote,
uint128 currentApprovalVoteSum,
uint128 currentDenialVoteSum,
uint32 prevoteDeadline,
uint32 mainvoteDeadline,
| 2,125 |
10 | // set reward multiplier for users who staked in LM staking contract based on NFT locked by users | function _setLMStakingRewardMultiplier() internal {
uint256 _multiplier;
if (_nftStakerTokens[_msgSender()].contains(SILVER_NFT_ID)) {
_multiplier = SILVER_NFT_BOOST;
} else if (_nftStakerTokens[_msgSender()].contains(BRONZE_NFT_ID)) {
_multiplier = BRONZE_NFT_BOOST;... | function _setLMStakingRewardMultiplier() internal {
uint256 _multiplier;
if (_nftStakerTokens[_msgSender()].contains(SILVER_NFT_ID)) {
_multiplier = SILVER_NFT_BOOST;
} else if (_nftStakerTokens[_msgSender()].contains(BRONZE_NFT_ID)) {
_multiplier = BRONZE_NFT_BOOST;... | 59,746 |
5 | // No calls to zero address allows us to check that minion submitted the proposal without getting the proposal struct from parent moloch | require(actionTo != address(0), "invalid actionTo");
uint256 proposalId = moloch.submitProposal(
address(this),
0,
0,
0,
molochDepositToken,
0,
molochDepositToken,
| require(actionTo != address(0), "invalid actionTo");
uint256 proposalId = moloch.submitProposal(
address(this),
0,
0,
0,
molochDepositToken,
0,
molochDepositToken,
| 34,937 |
5 | // Emitted when `claim` is called on the origin domain recipient - Address on origin chain to send claimed funds to total - Total amount claimed transferIds - TransferIds to claim / | event Claimed(address indexed recipient, uint256 total, bytes32[] transferIds);
| event Claimed(address indexed recipient, uint256 total, bytes32[] transferIds);
| 11,905 |
36 | // mint the amount | totalSupply += amount;
| totalSupply += amount;
| 4,308 |
172 | // Uniswap exchange protocol references | IUniswap private uniswapFactory = IUniswap(0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95);
address public uniswapExchange;
constructor(
string memory name,
string memory symbol,
string memory _stamp,
uint8 decimals,
address _fundsToken,
address[] memory ownership,
| IUniswap private uniswapFactory = IUniswap(0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95);
address public uniswapExchange;
constructor(
string memory name,
string memory symbol,
string memory _stamp,
uint8 decimals,
address _fundsToken,
address[] memory ownership,
| 41,384 |
101 | // make the swap | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
| 4,414 |
17 | // Pause the contract | function pause() public onlyOwner {
require(
msg.sender == owner,
"Only the contract owner can call this function"
);
require(!investmentContractData.paused, "Contract is already paused"); // Check if the contract is already paused
investmentContractData.pause... | function pause() public onlyOwner {
require(
msg.sender == owner,
"Only the contract owner can call this function"
);
require(!investmentContractData.paused, "Contract is already paused"); // Check if the contract is already paused
investmentContractData.pause... | 21,875 |
10 | // internal function to switch to new month. records for new month the current monthlyReputationDistribution / | function _updateMonth() internal {
uint256 month = block.timestamp / 30 days;
if (month != currentMonth) {
//update new month
currentMonth = month;
months[currentMonth]
.monthlyDistribution = monthlyReputationDistribution;
}
}
| function _updateMonth() internal {
uint256 month = block.timestamp / 30 days;
if (month != currentMonth) {
//update new month
currentMonth = month;
months[currentMonth]
.monthlyDistribution = monthlyReputationDistribution;
}
}
| 31,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.