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 |
|---|---|---|---|---|
242 | // transfer above the limit | (bytes32 id, uint256 executeAfter) = addPendingAction(ActionType.Transfer, _wallet, _token, _to, _amount, _data);
emit PendingTransferCreated(address(_wallet), id, executeAfter, _token, _to, _amount, _data);
| (bytes32 id, uint256 executeAfter) = addPendingAction(ActionType.Transfer, _wallet, _token, _to, _amount, _data);
emit PendingTransferCreated(address(_wallet), id, executeAfter, _token, _to, _amount, _data);
| 27,551 |
623 | // Get the length of time, in number of blocks, before valuescan be retrieved. / | function defaultLockPeriod() external returns (uint256 period);
| function defaultLockPeriod() external returns (uint256 period);
| 8,716 |
87 | // Revoke acess to mint heroes. | function revokeAccessMint(address _address)
onlyOwner
public
| function revokeAccessMint(address _address)
onlyOwner
public
| 11,903 |
103 | // return True if the market is enabled for this DMM token (IE DMM: DAI) or false if it is not enabled. / | function isMarketEnabledByDmmTokenAddress(address dmmToken) external view returns (bool);
| function isMarketEnabledByDmmTokenAddress(address dmmToken) external view returns (bool);
| 31,830 |
73 | // Edit user payment info / | function editPaymentByUserId(
uint uId,
uint payId,
uint _payValue,
uint _usdAmount,
uint _currencyUSD,
uint _totalToken,
uint _tokenWithoutBonus,
uint _tokenBonus,
uint _bonusPercent
| function editPaymentByUserId(
uint uId,
uint payId,
uint _payValue,
uint _usdAmount,
uint _currencyUSD,
uint _totalToken,
uint _tokenWithoutBonus,
uint _tokenBonus,
uint _bonusPercent
| 42,344 |
58 | // Allow unlocking of allocated tokens by transferring them to whitelisted addresses.Need to be called by each address / | function unlock() external {
require(REB != address(0));
assert(now >= unlockedAt);
// During first unlock attempt fetch total number of locked tokens.
if (tokensCreated == 0) {
tokensCreated = REB.balanceOf(this);
}
uint256 transferAllocation = lockedAl... | function unlock() external {
require(REB != address(0));
assert(now >= unlockedAt);
// During first unlock attempt fetch total number of locked tokens.
if (tokensCreated == 0) {
tokensCreated = REB.balanceOf(this);
}
uint256 transferAllocation = lockedAl... | 46,685 |
56 | // Returns whether the specified token exists.tokenId uint256 ID of the token to query the existence of return bool whether the token exists/ | function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| 23,357 |
32 | // Asserts that vault is not in catastrophic failure mode. | function _assertNotInCatastrophicFailure() private view {
require(!isInCatastrophicFailure, "GRG_VAULT_IN_CATASTROPHIC_FAILURE_ERROR");
}
| function _assertNotInCatastrophicFailure() private view {
require(!isInCatastrophicFailure, "GRG_VAULT_IN_CATASTROPHIC_FAILURE_ERROR");
}
| 26,916 |
2 | // State variables =============== |
PKT public pkt;
address public team;
|
PKT public pkt;
address public team;
| 11,732 |
3,468 | // 1735 | entry "unsoled" : ENG_ADJECTIVE
| entry "unsoled" : ENG_ADJECTIVE
| 18,347 |
19 | // Send all the staked tokens out of the contract so we can migrate them to the next version.Calling this will turn off staking on the contract. / | function emergencyTransfer() external onlyOwner{
require(!emergencyLock,"AttentionFUD : Lock activated, can no monger be called.");
stakeIsActive=false;
uint total = tokensInHolding();
IERC1155(contractAddressFUD).safeTransferFrom(address(this),WALLETFUD, 7123, total,"" );
}
| function emergencyTransfer() external onlyOwner{
require(!emergencyLock,"AttentionFUD : Lock activated, can no monger be called.");
stakeIsActive=false;
uint total = tokensInHolding();
IERC1155(contractAddressFUD).safeTransferFrom(address(this),WALLETFUD, 7123, total,"" );
}
| 38,790 |
22 | // Put element 2 in 1 | _nftQuestions[_contract][id][scene][questionId1] = _nftQuestions[_contract][id][scene][questionId2];
| _nftQuestions[_contract][id][scene][questionId1] = _nftQuestions[_contract][id][scene][questionId2];
| 16,089 |
76 | // Receives newly ended stake properties/stakeId The HEX stakeId/heartsEarned Hearts earned from the stake | function onEarningsMinted(uint40 stakeId, uint72 heartsEarned) external virtual;
| function onEarningsMinted(uint40 stakeId, uint72 heartsEarned) external virtual;
| 79,328 |
188 | // View function to see pending BCDCs on frontend. | function pendingBcdc(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accBcdcPerShare = pool.accBcdcPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pendingBcdc(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accBcdcPerShare = pool.accBcdcPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 9,832 |
61 | // Remove the address from blacklist | function removeBlacklist(address _addr) external onlyOwner {
blackList[_addr] = false;
}
| function removeBlacklist(address _addr) external onlyOwner {
blackList[_addr] = false;
}
| 14,368 |
14 | // ensure that the owner key is a root key, and that the keyId is within the ring. | (bool ownerValid,, uint256 ownerTrustId, bool ownerIsRoot,) = ILocksmith(locksmith).inspectKey(ownerKey);
(bool targetValid,, uint256 targetTrustId,,) = ILocksmith(locksmith).inspectKey(keyId);
require(ownerValid && ownerIsRoot, 'OWNER_NOT_ROOT');
require(targetValid && (targetTrustId ==... | (bool ownerValid,, uint256 ownerTrustId, bool ownerIsRoot,) = ILocksmith(locksmith).inspectKey(ownerKey);
(bool targetValid,, uint256 targetTrustId,,) = ILocksmith(locksmith).inspectKey(keyId);
require(ownerValid && ownerIsRoot, 'OWNER_NOT_ROOT');
require(targetValid && (targetTrustId ==... | 15,800 |
27 | // Return the pending payment / | function getPendingPaymentAmount(address passenger)
external
view
returns (uint256)
| function getPendingPaymentAmount(address passenger)
external
view
returns (uint256)
| 15,135 |
9 | // Multiplies value a by value b (result is rounded down). It's assumed that the value b is the significandof a number with 18 decimals precision. / | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return (a * b) / PRECISE_UNIT;
}
| function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return (a * b) / PRECISE_UNIT;
}
| 29,599 |
3 | // Called by a participant who wishes to register as a guardian | function registerGuardian(bytes4 ip, address orbsAddr, string calldata name, string calldata website) external {
require(!isRegistered(msg.sender), "registerGuardian: Guardian is already registered");
guardians[msg.sender].registrationTime = uint32(block.timestamp);
_updateGuardian(msg.sender, ip, orbsAddr, na... | function registerGuardian(bytes4 ip, address orbsAddr, string calldata name, string calldata website) external {
require(!isRegistered(msg.sender), "registerGuardian: Guardian is already registered");
guardians[msg.sender].registrationTime = uint32(block.timestamp);
_updateGuardian(msg.sender, ip, orbsAddr, na... | 3,493 |
203 | // BSCX tokens created per block. | uint256 public REWARD_PER_BLOCK; // 100000000000000000
| uint256 public REWARD_PER_BLOCK; // 100000000000000000
| 17,256 |
9 | // create dummy mutable split with this contract as controller; recipients & distributorFee will be updated on first payout | address[] memory recipients = new address[](2);
recipients[0] = address(0);
recipients[1] = address(1);
uint32[] memory percentAllocations = new uint32[](2);
percentAllocations[0] = uint32(500000);
percentAllocations[1] = uint32(500000);
payoutSplit = payable(
... | address[] memory recipients = new address[](2);
recipients[0] = address(0);
recipients[1] = address(1);
uint32[] memory percentAllocations = new uint32[](2);
percentAllocations[0] = uint32(500000);
percentAllocations[1] = uint32(500000);
payoutSplit = payable(
... | 22,155 |
11 | // convert all token into equivalent USDC(i.e. USD) value , in "decimals = 18" | if(_amounts[0]==0){ token_0_value = 0 ; }
| if(_amounts[0]==0){ token_0_value = 0 ; }
| 29,363 |
3 | // 訂閱 ID,部署的時候會傳入,我目前使用「7667」 | uint64 s_subscriptionId = 7667;
| uint64 s_subscriptionId = 7667;
| 21,884 |
185 | // Extends lock for a specified reason and time_of The address whose tokens are locked_reason The reason to lock tokens_time Lock extension time in seconds/ | function _extendLock(address _of, bytes32 _reason, uint256 _time) internal {
require(_tokensLocked(_of, _reason) > 0);
emit Unlocked(_of, _reason, locked[_of][_reason].amount);
locked[_of][_reason].validity = locked[_of][_reason].validity.add(_time);
emit Locked(_of, _reason, locked[... | function _extendLock(address _of, bytes32 _reason, uint256 _time) internal {
require(_tokensLocked(_of, _reason) > 0);
emit Unlocked(_of, _reason, locked[_of][_reason].amount);
locked[_of][_reason].validity = locked[_of][_reason].validity.add(_time);
emit Locked(_of, _reason, locked[... | 33,311 |
25 | // constructor, where first user is an administrator / | constructor() {
ownerList[msg.sender] = ++index;
creator = msg.sender;
owner = msg.sender;
}
| constructor() {
ownerList[msg.sender] = ++index;
creator = msg.sender;
owner = msg.sender;
}
| 59,931 |
35 | // RequestCurrencyContractInterfaceRequestCurrencyContractInterface is the currency contract managing the request in Ethereum The contract can be paused. In this case, nobody can create Requests anymore but people can still interact with them or withdraw funds.Requests can be created by the Payee with createRequestAsPa... | contract RequestCurrencyContractInterface is RequestCollectInterface {
using SafeMath for uint256;
using SafeMathInt for int256;
using SafeMathUint8 for uint8;
// RequestCore object
RequestCore public requestCore;
/*
* @dev Constructor
* @param _requestCoreAddress Request Core address
*/
function Request... | contract RequestCurrencyContractInterface is RequestCollectInterface {
using SafeMath for uint256;
using SafeMathInt for int256;
using SafeMathUint8 for uint8;
// RequestCore object
RequestCore public requestCore;
/*
* @dev Constructor
* @param _requestCoreAddress Request Core address
*/
function Request... | 10,956 |
75 | // 30% of ETH is used to market purchase DEFLCT | uint256 ethForBuyingDeflect = msg.value.div(100).mul(30);
ethUsedForDeflectPair = ethUsedForDeflectPair.add(ethForBuyingDeflect);
uint256 deadline = block.timestamp + 15;
address[] memory path = new address[](2);
path[0] = WETH;
path[1] = DEFLCT;
require(IERC20(DEFLCT).approve(address(unis... | uint256 ethForBuyingDeflect = msg.value.div(100).mul(30);
ethUsedForDeflectPair = ethUsedForDeflectPair.add(ethForBuyingDeflect);
uint256 deadline = block.timestamp + 15;
address[] memory path = new address[](2);
path[0] = WETH;
path[1] = DEFLCT;
require(IERC20(DEFLCT).approve(address(unis... | 12,661 |
61 | // mapping to keep track of transfering from wallet to ensure values arent changed during crucial processes |
mapping(address => uint256) internal transferingFromWallet_;
|
mapping(address => uint256) internal transferingFromWallet_;
| 29,302 |
256 | // inkprice = 2daiDebt | uint stoplossPrice = 1e18 * TARGET_COLLATERAL_FACTOR * daiDebt / ink;
return reserve.submitOrder(cdp, stoplossPrice, orderSize);
| uint stoplossPrice = 1e18 * TARGET_COLLATERAL_FACTOR * daiDebt / ink;
return reserve.submitOrder(cdp, stoplossPrice, orderSize);
| 37,160 |
42 | // Maintain a memory counter for the current write location in the temp bytes array by adding the 32 bytes for the array length to the starting location. | let mc := add(tempBytes, 0x20)
| let mc := add(tempBytes, 0x20)
| 15,736 |
64 | // Function is called by contract owner to set new period to start auction periodToStartAuction_ New period to start auction / | function setPeriodToStartAuction(uint256 periodToStartAuction_)
external
onlyOwner
| function setPeriodToStartAuction(uint256 periodToStartAuction_)
external
onlyOwner
| 32,453 |
30 | // DEPLOYMENT ACCOUNT FUNCTION TO SET MIN TRADE AMOUNT FOR A TRADEPAIR | function setMinTradeAmount(bytes32 _tradePairId, uint _minTradeAmount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "E-OACC-15");
tradePairs.setMinTradeAmount(_tradePairId, _minTradeAmount);
}
| function setMinTradeAmount(bytes32 _tradePairId, uint _minTradeAmount) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "E-OACC-15");
tradePairs.setMinTradeAmount(_tradePairId, _minTradeAmount);
}
| 47,849 |
36 | // if zeroForOne is true, I give token 0 (USDC) for asset | bool zeroForOne = (pool.token0() != address(USDC));
pool.swap(
address(this),
zeroForOne,
-int256(params.amount),
(
zeroForOne
? TickMath.MIN_SQRT_RATIO + 1
: TickMath.MAX_SQRT_RATIO - 1
| bool zeroForOne = (pool.token0() != address(USDC));
pool.swap(
address(this),
zeroForOne,
-int256(params.amount),
(
zeroForOne
? TickMath.MIN_SQRT_RATIO + 1
: TickMath.MAX_SQRT_RATIO - 1
| 7,892 |
20 | // Returns the contents joined with commas between them/contents1 The first content to join/contents2 The second content to join/contents3 The third content to join/contents4 The fourth content to join/contents5 The fifth content to join/ return A collection of bytes that represent all contents joined with commas | function commaSeparated(bytes memory contents1, bytes memory contents2, bytes memory contents3, bytes memory contents4, bytes memory contents5) internal pure returns (bytes memory) {
return abi.encodePacked(commaSeparated(contents1, contents2, contents3, contents4), continuesWith(contents5));
}
| function commaSeparated(bytes memory contents1, bytes memory contents2, bytes memory contents3, bytes memory contents4, bytes memory contents5) internal pure returns (bytes memory) {
return abi.encodePacked(commaSeparated(contents1, contents2, contents3, contents4), continuesWith(contents5));
}
| 81,245 |
476 | // _baseAmount the total amount to calculate the fee internal function to execute the payments to referrers if any is set / | function _payProtocol(uint _baseAmount) internal {
// get fee from Unlock
uint protocolFee;
// make sure unlock is a contract, and we catch possible reverts
if (address(unlockProtocol).code.length > 0) {
try unlockProtocol.protocolFee() returns (uint _fee) {
// calculate fee to be paid
... | function _payProtocol(uint _baseAmount) internal {
// get fee from Unlock
uint protocolFee;
// make sure unlock is a contract, and we catch possible reverts
if (address(unlockProtocol).code.length > 0) {
try unlockProtocol.protocolFee() returns (uint _fee) {
// calculate fee to be paid
... | 18,348 |
175 | // Distribution vault. | VestingMultiVault public immutable vault;
| VestingMultiVault public immutable vault;
| 33,216 |
5 | // if(bytes(newPurpose).length == 0){ revert EmptyPurposeError({ code: 1, message: "Purpose can not be empty" }); } |
purpose = newPurpose;
console.log(msg.sender, 'set purpose to', purpose);
emit SetPurpose(msg.sender, purpose);
|
purpose = newPurpose;
console.log(msg.sender, 'set purpose to', purpose);
emit SetPurpose(msg.sender, purpose);
| 37,159 |
18 | // Set the spender's token allowance to order source amount. | approveTokensTo(sourceToken, address(proxy), _order.sourceAmount);
| approveTokensTo(sourceToken, address(proxy), _order.sourceAmount);
| 42,389 |
22 | // _forwardFunds(basePrice[WETH]); |
if (remaining > 0) {
TransferHelper.safeTransferETH(msg.sender, remaining);
}
|
if (remaining > 0) {
TransferHelper.safeTransferETH(msg.sender, remaining);
}
| 75,926 |
678 | // Returns the payments owed to an address. dest The creditor's address. / | function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
| function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
| 14,094 |
6 | // Set enzyme vault swap details | swapDetails[enzymeVaultAddress] = SwapDetails(
15_000 ether, // minAmount
16_000 ether, // maxAmount
1660673114, // lastSwapTime
2_50 // maxSlippageRatio (2.5%)
);
| swapDetails[enzymeVaultAddress] = SwapDetails(
15_000 ether, // minAmount
16_000 ether, // maxAmount
1660673114, // lastSwapTime
2_50 // maxSlippageRatio (2.5%)
);
| 12,177 |
58 | // Returns the token generator version. / | function version() public view returns (string memory) {
return _version;
}
| function version() public view returns (string memory) {
return _version;
}
| 1,845 |
6 | // keyType 1 for Silver | if (premintKeysContract.getPremintKeyType(_keyId) == 1){
require( _num <= OGMC_LIMIT_SILVER, "EXCEED_PER_MINT_SILVER");
usedPremintKeys[_keyId] = true;
for(uint256 i = 1; i <= _num; i++){
publicAmountMinted++;
_safeMint( msg.sender, sup... | if (premintKeysContract.getPremintKeyType(_keyId) == 1){
require( _num <= OGMC_LIMIT_SILVER, "EXCEED_PER_MINT_SILVER");
usedPremintKeys[_keyId] = true;
for(uint256 i = 1; i <= _num; i++){
publicAmountMinted++;
_safeMint( msg.sender, sup... | 31,227 |
328 | // Calc liquidity for base ticks | cache.liquidity = pool.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, cache.tickLower, cache.tickUpper);
| cache.liquidity = pool.liquidityForAmounts(cache.amount0Desired, cache.amount1Desired, cache.tickLower, cache.tickUpper);
| 2,962 |
21 | // Add Filehash to Map | FileHashCurrentOwnerMap[filehash] = msg.sender;
| FileHashCurrentOwnerMap[filehash] = msg.sender;
| 48,325 |
13 | // Reserved for people who helped this project and giveaways | for (index = 0; index < numChubbies; index++) {
_safeMint(owner(), currentSupply + index);
}
| for (index = 0; index < numChubbies; index++) {
_safeMint(owner(), currentSupply + index);
}
| 16,158 |
260 | // Return lower and upper ticks for the ask limit order. This order/ sits just above the mid price and helps rebalance closer to 50/50. | function _askRange(int24 mid) internal view returns (int24, int24) {
int24 midCeil = _floor(mid) + tickSpacing;
return (midCeil, midCeil + limitThreshold);
}
| function _askRange(int24 mid) internal view returns (int24, int24) {
int24 midCeil = _floor(mid) + tickSpacing;
return (midCeil, midCeil + limitThreshold);
}
| 62,381 |
93 | // Withdraw collateral token from Compound. _amount Amount of collateral token / | function withdraw(uint256 _amount) external override onlyAuthorized {
_withdraw(_amount);
}
| function withdraw(uint256 _amount) external override onlyAuthorized {
_withdraw(_amount);
}
| 39,302 |
157 | // Ensures the provided reward amount is not more than the balance in the contract. This keeps the reward rate in the right range, preventing overflows due to very high values of `rewardRate` in the earned and `rewardsPerToken` functions; Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. | uint256 balance = rewardToken.balanceOf(address(this));
require(rewardRate <= balance / rewardsDuration, "91");
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp + rewardsDuration; // Change the duration
emit RewardAdded(reward);
| uint256 balance = rewardToken.balanceOf(address(this));
require(rewardRate <= balance / rewardsDuration, "91");
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp + rewardsDuration; // Change the duration
emit RewardAdded(reward);
| 58,728 |
22 | // Create Multiple Locks / | function createMultipleLocks(address _tokenAddress, address _withdrawalAddress, uint256[] memory _amounts, uint256[] memory _unlockTimes) public payable returns (uint256 _id) {
require(_amounts.length > 0);
require(_amounts.length == _unlockTimes.length);
uint256 fee = getSystemFees... | function createMultipleLocks(address _tokenAddress, address _withdrawalAddress, uint256[] memory _amounts, uint256[] memory _unlockTimes) public payable returns (uint256 _id) {
require(_amounts.length > 0);
require(_amounts.length == _unlockTimes.length);
uint256 fee = getSystemFees... | 23,966 |
339 | // A list of all markets | BToken[] public allMarkets;
| BToken[] public allMarkets;
| 16,310 |
121 | // Reimburse leftover ETH. | _contributor.send(remainingETH); // Deliberate use of send in order to not block the contract in case of reverting fallback.
| _contributor.send(remainingETH); // Deliberate use of send in order to not block the contract in case of reverting fallback.
| 15,634 |
6 | // The Proportion of the shardsCreator's shards | uint256 public shardsCreatorProportion = 5;
| uint256 public shardsCreatorProportion = 5;
| 6,917 |
80 | // Mint in game currency tokens | champzToken.mintTokens(_msgSender(), NUM_CHAMPZ_MINTED_ON_HERO_MINTED);
| champzToken.mintTokens(_msgSender(), NUM_CHAMPZ_MINTED_ON_HERO_MINTED);
| 39,687 |
35 | // Internal Functions//Encodes a standard OVM transaction. _transaction OVM transaction to encode.return Encoded transaction bytes. / | function encodeTransaction(Transaction memory _transaction)
internal
pure
returns (bytes memory)
| function encodeTransaction(Transaction memory _transaction)
internal
pure
returns (bytes memory)
| 29,819 |
2 | // See {IERC1155MetadataURI-uri(uint256)}. | function uri(uint256 id) external view virtual override returns (string memory) {
return _uri(id);
}
| function uri(uint256 id) external view virtual override returns (string memory) {
return _uri(id);
}
| 42,035 |
33 | // retrieve battery charge rate/_batteryID battery identifier/ return battery charge rate | function getBatteryChargeRate (uint _batteryID) external view returns (uint) {
return batteries[_batteryID].chargeRate;
}
| function getBatteryChargeRate (uint _batteryID) external view returns (uint) {
return batteries[_batteryID].chargeRate;
}
| 33,156 |
16 | // 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 => F3Ddatasets.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 => F3Ddatasets.Player) public plyr_; // (pID => data) player data
mapping (uint256 ... | 35,601 |
7 | // the current tick | int24 tick;
| int24 tick;
| 3,361 |
1 | // pool index => whitelist merkle root | mapping(uint256 => bytes32) public whitelistRootP;
| mapping(uint256 => bytes32) public whitelistRootP;
| 13,307 |
16 | // Gets the start time for the poll Set the start time in the constructor of the poll as Unix Standard Timereturn start time as Unix Standard Time / | function getStartTime() external view returns (uint256);
| function getStartTime() external view returns (uint256);
| 54,986 |
15 | // Shutdown this contract | function shutdown() external onlyGovernance
| function shutdown() external onlyGovernance
| 12,822 |
77 | // Get information for a handlerhandlerID Handler ID return (success or failure, handler address, handler name)/ | function getTokenHandlerInfo(uint256 handlerID) external view override returns (bool, address, string memory)
| function getTokenHandlerInfo(uint256 handlerID) external view override returns (bool, address, string memory)
| 9,956 |
576 | // If the account has an owner, don't allow withdrawing to the zero address (which will be the protocol fee vault contract). | require(withdrawal.from == address(0) || withdrawal.to != address(0), "INVALID_WITHDRAWAL_RECIPIENT");
| require(withdrawal.from == address(0) || withdrawal.to != address(0), "INVALID_WITHDRAWAL_RECIPIENT");
| 31,707 |
238 | // get output twap amount.return how many quote asset you will get with the input base amount on twap price. _dir ADD_TO_AMM for short, REMOVE_FROM_AMM for long, opposite direction from `getInputTwap`. _baseAssetAmount base asset amountreturn quote asset amount / | function getOutputTwap(Dir _dir, Decimal.decimal memory _baseAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| function getOutputTwap(Dir _dir, Decimal.decimal memory _baseAssetAmount)
public
view
override
returns (Decimal.decimal memory)
| 34,282 |
61 | // 减少转账代理方spender的代理的许可额度 意义不大的function/ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) | // {
// // uint256 oldValue = allowed[msg.sender][_spender];
// // if (_subtractedValue > oldValue) {
// // allowed[msg.sender][_spender] = 0;
// // } else {
// // uint256 newValue = oldValue.sub(_subtractedValue);
// // require(newValue <= balances[msg.sende... | // {
// // uint256 oldValue = allowed[msg.sender][_spender];
// // if (_subtractedValue > oldValue) {
// // allowed[msg.sender][_spender] = 0;
// // } else {
// // uint256 newValue = oldValue.sub(_subtractedValue);
// // require(newValue <= balances[msg.sende... | 77,939 |
91 | // See {IERC721Wrapper-updateApprovedTokenRanges}. / | function updateApprovedTokenRanges(address contract_, uint256 minTokenId, uint256 maxTokenId) public virtual override;
| function updateApprovedTokenRanges(address contract_, uint256 minTokenId, uint256 maxTokenId) public virtual override;
| 69,105 |
17 | // Event for going on retirement | event Retired(address indexed upgradedVersion);
| event Retired(address indexed upgradedVersion);
| 48,859 |
14 | // Returns a pointer to the value `x`./ If the value `x` is not in the tree, the returned pointer will be empty. | function find(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
(uint256 nodes,, uint256 key) = _find(tree, x);
result = _pack(nodes, key);
}
| function find(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
(uint256 nodes,, uint256 key) = _find(tree, x);
result = _pack(nodes, key);
}
| 20,475 |
81 | // Only allow the Seller to close their own Option. | require(msg.sender == seller);
| require(msg.sender == seller);
| 27,215 |
59 | // Public Views //Compute the start and end of the dispute's current or next appeal period, if possible. _disputeID ID of the dispute.return The start and end of the period./ | function appealPeriod(uint _disputeID) public view returns(uint start, uint end) {
if (appealDisputes[_disputeID].arbitrator != Arbitrator(address(0)))
(start, end) = appealDisputes[_disputeID].arbitrator.appealPeriod(appealDisputes[_disputeID].appealDisputeID);
else {
start = appealDisputes[_disp... | function appealPeriod(uint _disputeID) public view returns(uint start, uint end) {
if (appealDisputes[_disputeID].arbitrator != Arbitrator(address(0)))
(start, end) = appealDisputes[_disputeID].arbitrator.appealPeriod(appealDisputes[_disputeID].appealDisputeID);
else {
start = appealDisputes[_disp... | 51,264 |
90 | // Each custom card has its own level. Level will be used whencalculating rewards and raiding power.tokenId The ID of the token whose level is being set cardLevel The new level of the specified token / | function setCustomCardLevel(uint256 tokenId, uint8 cardLevel) external;
| function setCustomCardLevel(uint256 tokenId, uint8 cardLevel) external;
| 21,789 |
127 | // return The admin slot. / | function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
//solium-disable-next-line
assembly {
adm := sload(slot)
}
}
| function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
//solium-disable-next-line
assembly {
adm := sload(slot)
}
}
| 34,802 |
23 | // Returns token's total supply/ | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 20,839 |
12 | // The `quantity` minted with ERC2309 exceeds the safety limit. / | error MintERC2309QuantityExceedsLimit();
| error MintERC2309QuantityExceedsLimit();
| 11,076 |
39 | // Get details on sender if available | int senderScore;
uint senderRatings;
int senderCumulative = 0;
(senderScore, senderRatings) = store.get(msg.sender);
| int senderScore;
uint senderRatings;
int senderCumulative = 0;
(senderScore, senderRatings) = store.get(msg.sender);
| 36,119 |
65 | // Called by a system administrator to add an owner.Reverts if `_ownerAddress` already has owner role _ownerAddress approved ownerreturn added boolean indicating whether the role was granted / | function addOwner(address _ownerAddress) external onlySysAdmin {
owners.add(_ownerAddress);
require(owners.has(_ownerAddress));
}
| function addOwner(address _ownerAddress) external onlySysAdmin {
owners.add(_ownerAddress);
require(owners.has(_ownerAddress));
}
| 29,297 |
58 | // NOTE: The contract address is always the message sender. | address _tokenAddress = msg.sender;
require(
listedTokenTypes.contains(_tokenAddress) &&
listedTokenIDs[_tokenAddress].contains(_id),
"Token ID not listed"
);
return IERC721ReceiverUpgradeable.onERC721Received.selector;
| address _tokenAddress = msg.sender;
require(
listedTokenTypes.contains(_tokenAddress) &&
listedTokenIDs[_tokenAddress].contains(_id),
"Token ID not listed"
);
return IERC721ReceiverUpgradeable.onERC721Received.selector;
| 51,092 |
9 | // Don't double count the owner (if set); | if (owner != 0x0 && !CommonAuthority(authority).hasUserRole(owner, RECOVERY_ROLE)) {
totalAuthorized += 1;
}
| if (owner != 0x0 && !CommonAuthority(authority).hasUserRole(owner, RECOVERY_ROLE)) {
totalAuthorized += 1;
}
| 23,225 |
344 | // An array of developer addresses for finding shares in the share mapping. | address[] public developerAddresses;
| address[] public developerAddresses;
| 46,519 |
48 | // Decode an Item into a uint. This will not work if the/ Item is a list./self The Item./ return The decoded string. | function toUint(Item memory self) internal pure returns (uint) {
require(isData(self), "Rlp.sol:Rlp:toUint:1");
(uint256 rStartPos, uint256 len) = _decode(self);
require(len <= 32, "Rlp.sol:Rlp:toUint:3");
require(len != 0, "Rlp.sol:Rlp:toUint:4");
uint data;
assembly {
data := div(mload(rStartPos), exp... | function toUint(Item memory self) internal pure returns (uint) {
require(isData(self), "Rlp.sol:Rlp:toUint:1");
(uint256 rStartPos, uint256 len) = _decode(self);
require(len <= 32, "Rlp.sol:Rlp:toUint:3");
require(len != 0, "Rlp.sol:Rlp:toUint:4");
uint data;
assembly {
data := div(mload(rStartPos), exp... | 70,125 |
10 | // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
... | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
... | 4,539 |
69 | // return true if the crowdsale has raised enough money to be a successful. / | function isMinimumGoalReached() public constant returns (bool reached) {
return weiRaised >= minimumFundingGoal;
}
| function isMinimumGoalReached() public constant returns (bool reached) {
return weiRaised >= minimumFundingGoal;
}
| 70,179 |
94 | // Hashmasks contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract Masks is Context, Ownable, ERC165, IMasks, IERC721Metadata {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Public variables
// This is the ... | contract Masks is Context, Ownable, ERC165, IMasks, IERC721Metadata {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Public variables
// This is the ... | 6,947 |
0 | // The accumulated revenue for each stakeholder. / | mapping(address => uint256) internal revenues;
| mapping(address => uint256) internal revenues;
| 28,247 |
76 | // Internal function to mint a new tokenReverts if the given token ID already exists _to The address that will own the minted token _tokenId uint256 ID of the token to be minted by the msg.sender / | function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
| function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
| 8,569 |
43 | // Token Information | string public constant name = "SCALE";
string public constant symbol = "SCALE";
uint8 public constant decimals = 18;
| string public constant name = "SCALE";
string public constant symbol = "SCALE";
uint8 public constant decimals = 18;
| 37,296 |
11 | // returns the percentage of deviation from the peg multiplied by amountwhen uAD is <1$ | function _getPercentDeviationFromUnderPeg(uint256 amount)
internal
returns (uint256)
| function _getPercentDeviationFromUnderPeg(uint256 amount)
internal
returns (uint256)
| 42,199 |
21 | // Requiring msg.sender has Holdings of Forever rose | require(tokenToOwnersHoldings[foreverRoseId][msg.sender] >= _divisibility);
| require(tokenToOwnersHoldings[foreverRoseId][msg.sender] >= _divisibility);
| 16,100 |
1 | // Optional | function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
| function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
| 47,548 |
18 | // Failure event / | event Failure(uint error, uint info, uint detail);
| event Failure(uint error, uint info, uint detail);
| 5,373 |
4 | // At this point we know that the sender is a trusted forwarder, we copy the msg.data , except the last 20 bytes (and update the total length) | assembly {
let ptr := mload(0x40)
| assembly {
let ptr := mload(0x40)
| 27,586 |
4 | // Address of second 'power of attoney'. Not implemented in UI./to be used for transferring owner or allowing multisig distribution. | address public POA2;
| address public POA2;
| 41,453 |
397 | // Ignore tx failing to prevent a single pool from halting reward distribution | address(pool.poolContract).call(abi.encodeWithSelector(pool.poolContract.distributeRewards.selector, poolRewardAmount));
| address(pool.poolContract).call(abi.encodeWithSelector(pool.poolContract.distributeRewards.selector, poolRewardAmount));
| 27,523 |
4 | // Safe cake transfer function, just in case if rounding error causes pool to not have enough SILVERs. | function safeCakeTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 cakeBal = cake.balanceOf(address(this));
if (_amount > cakeBal) {
cake.transfer(_to, cakeBal);
} else {
cake.transfer(_to, _amount);
}
}
| function safeCakeTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 cakeBal = cake.balanceOf(address(this));
if (_amount > cakeBal) {
cake.transfer(_to, cakeBal);
} else {
cake.transfer(_to, _amount);
}
}
| 18,896 |
29 | // function to withdraw Ether to owner&39;s account | function withdrawEther(uint256 _amount) onlyOwner {
if (_amount == 0) {
// withdraw all available Ether
_amount = _etherAmount;
}
require(_amount > 0 && _etherAmount >= _amount);
_etherAmount -= _amount;
msg.sender.transfer(_amount);
}
| function withdrawEther(uint256 _amount) onlyOwner {
if (_amount == 0) {
// withdraw all available Ether
_amount = _etherAmount;
}
require(_amount > 0 && _etherAmount >= _amount);
_etherAmount -= _amount;
msg.sender.transfer(_amount);
}
| 11,859 |
656 | // If royalty, substract amount seller will receive after LP fees were calculated Note: Royalty will be a bit lower since LF fees are substracted first | (address royaltyRecipient, uint256 royaltyAmount) = getRoyaltyInfo(idSold, currencyAmount);
if (royaltyAmount > 0) {
royaltiesNumerator[royaltyRecipient] = royaltiesNumerator[royaltyRecipient].add(royaltyAmount.mul(ROYALTIES_DENOMINATOR));
}
| (address royaltyRecipient, uint256 royaltyAmount) = getRoyaltyInfo(idSold, currencyAmount);
if (royaltyAmount > 0) {
royaltiesNumerator[royaltyRecipient] = royaltiesNumerator[royaltyRecipient].add(royaltyAmount.mul(ROYALTIES_DENOMINATOR));
}
| 35,219 |
18 | // _originDigits == digits()) | return x;
| return x;
| 5,349 |
129 | // Update Uniswap pair | try IUniswapV2Pair(uniswapPair).sync() {}
catch (bytes memory uniswapRevertReason) {
emit FailedUniswapPairSync(uniswapRevertReason);
}
| try IUniswapV2Pair(uniswapPair).sync() {}
catch (bytes memory uniswapRevertReason) {
emit FailedUniswapPairSync(uniswapRevertReason);
}
| 73,559 |
59 | // iterate until we find our nft's next | while(infos[cursor].expiresAt < expiresAt){
cursor = infos[cursor].next;
}
| while(infos[cursor].expiresAt < expiresAt){
cursor = infos[cursor].next;
}
| 4,761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.