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 |
|---|---|---|---|---|
24 | // Handles message receptions in a non blocking way/_srcChainId ChainId of the source chain - LayerZero standard/_srcAddress Sender of the source chain/_nonce Nounce of the message/_payload Data: recipient address and amount | function _nonblockingLzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) internal virtual;
| function _nonblockingLzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) internal virtual;
| 16,902 |
51 | // Returns the timestamp at which the beacon period endsreturn The timestamp at which the beacon period ends / | function _beaconPeriodEndAt() internal view returns (uint64) {
return beaconPeriodStartedAt + beaconPeriodSeconds;
}
| function _beaconPeriodEndAt() internal view returns (uint64) {
return beaconPeriodStartedAt + beaconPeriodSeconds;
}
| 7,266 |
34 | // transfer deposit back if (bid.tokenBob == address(0)) sendEth(bid.bobAddress, bid.amountBob); else IERC20(bid.tokenBob).safeTransfer(bid.bobAddress, bid.amountBob); |
emit BidCancelled({
offerId: offerId,
bobAddress: bid.bobAddress,
tokenBob: bid.tokenBob,
bidIdx: bidIdx,
bidId: bidId,
reason: reason,
bid: bid
});
|
emit BidCancelled({
offerId: offerId,
bobAddress: bid.bobAddress,
tokenBob: bid.tokenBob,
bidIdx: bidIdx,
bidId: bidId,
reason: reason,
bid: bid
});
| 23,398 |
2 | // Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). / | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| 12,738 |
25 | // inventor - the source behind the non-intrusive referral model. | ambassadors_[0x18E90Fc6F70344f53EBd4f6070bf6Aa23e2D748C] = true;
| ambassadors_[0x18E90Fc6F70344f53EBd4f6070bf6Aa23e2D748C] = true;
| 23,222 |
72 | // ---------------------------- Update Chainlog version ---------------------------- | DssExecLib.setChangelogVersion("1.7.0");
| DssExecLib.setChangelogVersion("1.7.0");
| 50,009 |
181 | // Recalculate profit | wantBalance = want.balanceOf(address(this));
if (wantBalance < _profit) {
_profit = wantBalance;
_debtPayment = 0;
} else if (wantBalance < _debtPayment.add(_profit)){
| wantBalance = want.balanceOf(address(this));
if (wantBalance < _profit) {
_profit = wantBalance;
_debtPayment = 0;
} else if (wantBalance < _debtPayment.add(_profit)){
| 24,828 |
11 | // function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr, address _missionEventsHandlerAddr ) external onlyAdmin { | function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr ) external onlyAdmin {
| function setHandlers (address _priceHandlerAddr, address _refundHandlerAddr ) external onlyAdmin {
| 24,323 |
45 | // updates the number of tokens for sale / | function setPaidTokens(uint256 _paidTokens) external onlyOwner {
PAID_TOKENS = _paidTokens;
}
| function setPaidTokens(uint256 _paidTokens) external onlyOwner {
PAID_TOKENS = _paidTokens;
}
| 2,209 |
404 | // Burning interface |
function burn(
address account,
uint256 id,
uint256 value
|
function burn(
address account,
uint256 id,
uint256 value
| 38,874 |
5 | // Alternativ : bytes memory data = abi.encodeWithSignature("isActivTechnician(address)", msg.sender); https:ethereum.stackexchange.com/questions/30383/difference-between-call-on-external-contract-address-function-and-creating-contr | ProfessionalOfficesImpl po = ProfessionalOfficesImpl(proOfficesContract);
return po.isActivTechnician(_technicianAddress);
| ProfessionalOfficesImpl po = ProfessionalOfficesImpl(proOfficesContract);
return po.isActivTechnician(_technicianAddress);
| 10,529 |
93 | // Same as {_processWithdrawData_Il8} but working on creator revenues:returns the amount of revenues claimable by the collection creatorand records that these revenues have now been collected. / | function _processWithdrawDataCreator_sFU(
Rewards storage revenueRecords
) private returns (uint256 accruedRevenues) {
unchecked {
uint256 lifetimeEarningsCr = (revenueRecords.lifetimeAccrued *
10000) / 15;
accruedRevenues =
lifetimeEarning... | function _processWithdrawDataCreator_sFU(
Rewards storage revenueRecords
) private returns (uint256 accruedRevenues) {
unchecked {
uint256 lifetimeEarningsCr = (revenueRecords.lifetimeAccrued *
10000) / 15;
accruedRevenues =
lifetimeEarning... | 28,385 |
195 | // MyCollectibleMyCollectible - a contract for my semi-fungible tokens. / | contract HypedHuskyMetaCityNFT is ERC1155Tradable {
constructor(string memory _name)//address _proxyRegistryAddress)
ERC1155Tradable(
_name,
"HHMC"
) public {
_setBaseMetadataURI("https://api.HypedHuskyMetaCityNFT.io/nft/");
}
} | contract HypedHuskyMetaCityNFT is ERC1155Tradable {
constructor(string memory _name)//address _proxyRegistryAddress)
ERC1155Tradable(
_name,
"HHMC"
) public {
_setBaseMetadataURI("https://api.HypedHuskyMetaCityNFT.io/nft/");
}
} | 51,826 |
58 | // Returns proposed next asset implementation contract address. return asset implementation contract address. / | function getPendingVersion() public view returns(address) {
return pendingVersion;
}
| function getPendingVersion() public view returns(address) {
return pendingVersion;
}
| 5,736 |
17 | // input in fee/min but calculated as fee per second for technical processing | parkingfee[_tokenId] = _fee/60;
| parkingfee[_tokenId] = _fee/60;
| 13,329 |
33 | // Note: transfer can fail or succeed if `amount` is zero. | lpToken[pid].safeTransfer(to, amount);
emit EmergencyWithdraw(msg.sender, pid, amount, to);
| lpToken[pid].safeTransfer(to, amount);
emit EmergencyWithdraw(msg.sender, pid, amount, to);
| 25,392 |
114 | // ETH fee equivalent predefined gas price | uint public constant MIN_ETH_FEE_IN_WEI = 40000 * 1 * 10**9;
address public constant TRUSTED_DEPOSIT_TOKEN_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address public constant TRUSTED_CTOKEN_ADDRESS = 0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9;
address public constant TRUSTED_PLATFORM_TOKE... | uint public constant MIN_ETH_FEE_IN_WEI = 40000 * 1 * 10**9;
address public constant TRUSTED_DEPOSIT_TOKEN_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address public constant TRUSTED_CTOKEN_ADDRESS = 0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9;
address public constant TRUSTED_PLATFORM_TOKE... | 6,950 |
225 | // If withdrawal fee is active, take the appropriate amount from the given value and transfer to rewards recipient/ return The withdrawal fee that was taken | function _processWithdrawalFee(uint256 _amount) internal returns (uint256) {
if (withdrawalFee == 0) {
return 0;
}
uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE);
IERC20Upgradeable(want).safeTransfer(IController(controller).rewards(), fee);
return fee;
... | function _processWithdrawalFee(uint256 _amount) internal returns (uint256) {
if (withdrawalFee == 0) {
return 0;
}
uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE);
IERC20Upgradeable(want).safeTransfer(IController(controller).rewards(), fee);
return fee;
... | 10,631 |
2 | // Needed to prevent cross chain collisions | uint256 public immutable startingTokenId;
uint256 public immutable maxTokenId;
uint256 internal _nextTokenId;
| uint256 public immutable startingTokenId;
uint256 public immutable maxTokenId;
uint256 internal _nextTokenId;
| 38,694 |
34 | // Transfer `amount` tokens from `src` to `dst`/auth:nTokenProxy/currencyId Currency id of the nToken/spender The address of the original caller/from The address of the source account/to The address of the destination account/amount The number of tokens to transfer/ return Whether or not the transfer succeeded | function nTokenTransferFrom(
uint16 currencyId,
address spender,
address from,
address to,
uint256 amount
| function nTokenTransferFrom(
uint16 currencyId,
address spender,
address from,
address to,
uint256 amount
| 62,996 |
607 | // Stake LP token for sender | _stake(address(this), msg.sender, liquidity);
| _stake(address(this), msg.sender, liquidity);
| 74,152 |
625 | // NOTE: previousRewardsDistributionBlockNumber kept even if not used so as not to break the proxy contract storage after an upgrade | mapping(address => uint64) private previousRewardsDistributionBlockNumber;
mapping(address => Reward[]) public addressUnlockedRewards;
mapping(address => Reward[]) public addressWithdrawnRewards; // kept even if not used so as not to break the proxy contract storage after an upgrade
event BaseVaultChan... | mapping(address => uint64) private previousRewardsDistributionBlockNumber;
mapping(address => Reward[]) public addressUnlockedRewards;
mapping(address => Reward[]) public addressWithdrawnRewards; // kept even if not used so as not to break the proxy contract storage after an upgrade
event BaseVaultChan... | 17,780 |
15 | // This cannot happen - just in case | last_point.slope = 0;
last_checkpoint = t_i;
last_point.ts = t_i;
last_point.blk = initial_last_point.blk + (block_slope * (t_i - initial_last_point.ts)) / MULTIPLIER;
_epoch += 1;
if (t_i == block.timestamp) {
... | last_point.slope = 0;
last_checkpoint = t_i;
last_point.ts = t_i;
last_point.blk = initial_last_point.blk + (block_slope * (t_i - initial_last_point.ts)) / MULTIPLIER;
_epoch += 1;
if (t_i == block.timestamp) {
... | 42,506 |
4 | // if_assigned.arr[x] 0 <= x && x <= s.arr.length; if_assigned.arr2[x][y] 0 <= y && y <= s.arr2[x].length; | S s;
| S s;
| 49,254 |
181 | // Reback the rate is going to be negative after reached to a threshold. | if (reserveBTCT >= reserveBTC && isDynamicBTCT) {
| if (reserveBTCT >= reserveBTC && isDynamicBTCT) {
| 53,866 |
136 | // Estimate the reward amount.Call to `estimate_gas_cost` function in the WitnetRequestBoard contract._gasPrice The gas price for which we want to retrieve the estimation. return The reward to be included for the given gas price./ | function witnetEstimateGasCost(uint256 _gasPrice) internal view returns (uint256) {
return wrb.estimateGasCost(_gasPrice);
}
| function witnetEstimateGasCost(uint256 _gasPrice) internal view returns (uint256) {
return wrb.estimateGasCost(_gasPrice);
}
| 47,578 |
32 | // Become hunter | self.isHunter = true;
| self.isHunter = true;
| 4,605 |
8 | // Get the ETH / USD price first, and cut it down to 1e6 precision | uint256 eth_usd_price = uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);
uint256 price_vs_eth;
if (choice == PriceChoice.PUSD) {
price_vs_eth = uint256(pusdEthOracle.consult(weth_address, PRICE_PRECISION)); // How much PUSD i... | uint256 eth_usd_price = uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);
uint256 price_vs_eth;
if (choice == PriceChoice.PUSD) {
price_vs_eth = uint256(pusdEthOracle.consult(weth_address, PRICE_PRECISION)); // How much PUSD i... | 32,039 |
55 | // burn | ERC20Burnable(address(stakingToken)).burn(_amount);
| ERC20Burnable(address(stakingToken)).burn(_amount);
| 36,481 |
139 | // uint256 ln = tmpWhiteList.length; | uint256[] memory colBalances = new uint256[](tmpWhiteList.length);
uint256[] memory PremiumBalances = new uint256[](tmpWhiteList.length);
uint256 totalWorth = 0;
uint256 PremiumWorth = 0;
uint256 i=0;
for(; i<tmpWhiteList.length;i++){
(colBalances[i],PremiumBa... | uint256[] memory colBalances = new uint256[](tmpWhiteList.length);
uint256[] memory PremiumBalances = new uint256[](tmpWhiteList.length);
uint256 totalWorth = 0;
uint256 PremiumWorth = 0;
uint256 i=0;
for(; i<tmpWhiteList.length;i++){
(colBalances[i],PremiumBa... | 24,349 |
7 | // Event emitted when the Merchant List is edited/action Tags "add" or "remove" for action type/addresses The list of merchant wallet address/metadata any comments on the addresses being added | event MerchantList(string action, address[] addresses, string metadata);
| event MerchantList(string action, address[] addresses, string metadata);
| 5,042 |
92 | // Mints `tokenId` and transfers it to `to`. | * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
... | * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
... | 6,549 |
8 | // service contracts | bytes32 constant CONTRACT_SERVICE_TOKEN_DEMURRAGE = "sv:tdemurrage";
bytes32 constant CONTRACT_SERVICE_MARKETPLACE = "sv:mp";
bytes32 constant CONTRACT_SERVICE_DIRECTORY = "sv:directory";
| bytes32 constant CONTRACT_SERVICE_TOKEN_DEMURRAGE = "sv:tdemurrage";
bytes32 constant CONTRACT_SERVICE_MARKETPLACE = "sv:mp";
bytes32 constant CONTRACT_SERVICE_DIRECTORY = "sv:directory";
| 8,227 |
169 | // Emits a {SetLiquidateBorrowAllowed} event. Requirements: - The caller must be the administrator.- The bond must be listed.fyToken The fyToken contract to update the permission for. state The new state to put in storage.return bool true = success, otherwise it reverts. / |
function setLiquidateBorrowAllowed(FyTokenInterface fyToken, bool state)
external
override
onlyAdmin
returns (bool)
|
function setLiquidateBorrowAllowed(FyTokenInterface fyToken, bool state)
external
override
onlyAdmin
returns (bool)
| 5,444 |
36 | // pauseMint is a safeguard that pauses mint (only artist can unpause). onlyAuhtorized modifier gates access. / | function pauseMint()
external
onlyAuthorized
| function pauseMint()
external
onlyAuthorized
| 590 |
1 | // ========== VIEWS ========== //Returns the address of each pool the user managesuser Address of the user return address[] The address of each pool the user manages/ | function getUserManagedPools(address user) external view returns(address[] memory) {
require(user != address(0), "Invalid address");
address[] memory addresses = new address[](userToManagedPools[user].length);
uint[] memory indexes = userToManagedPools[user];
for (uint i = 0; i < a... | function getUserManagedPools(address user) external view returns(address[] memory) {
require(user != address(0), "Invalid address");
address[] memory addresses = new address[](userToManagedPools[user].length);
uint[] memory indexes = userToManagedPools[user];
for (uint i = 0; i < a... | 14,913 |
31 | // Create a new bytes structure around [from, to) in-place. | assembly {
result := add(b, from)
mstore(result, sub(to, from))
}
| assembly {
result := add(b, from)
mstore(result, sub(to, from))
}
| 6,378 |
44 | // Set utilityToken/newUtilityToken new token | function setUtilityToken(address newUtilityToken) external onlyOwner {
utilityToken = ILostSocksThread(newUtilityToken);
}
| function setUtilityToken(address newUtilityToken) external onlyOwner {
utilityToken = ILostSocksThread(newUtilityToken);
}
| 70,196 |
7 | // build a uint64 key from blockNumber and tx index the left 32bit is the blocki number the right 32bit is the tx index | function getTxKey(uint32 blockNumber, uint32 txIndex) internal pure returns (uint64) {
return uint64((uint64(blockNumber) << 32) | txIndex);
}
| function getTxKey(uint32 blockNumber, uint32 txIndex) internal pure returns (uint64) {
return uint64((uint64(blockNumber) << 32) | txIndex);
}
| 37,546 |
124 | // Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. / | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| 9,675 |
192 | // Withdraw 50% to NFT artist's wallet | (bool hs, ) = payable(0x312F28dC52341a59D405Eb202970c9788F64F736).call{
value: (address(this).balance * 50) / 100
}("");
| (bool hs, ) = payable(0x312F28dC52341a59D405Eb202970c9788F64F736).call{
value: (address(this).balance * 50) / 100
}("");
| 6,162 |
22 | // Cancel a proposal. proposalId id of the proposal / | function cancel(uint256 proposalId) public onlyAdmin {
ProposalState proposalState = state(proposalId);
require(
proposalState == ProposalState.Queued ||
proposalState == ProposalState.Pending,
"Governor::execute: proposal can only be cancelled if it is queue... | function cancel(uint256 proposalId) public onlyAdmin {
ProposalState proposalState = state(proposalId);
require(
proposalState == ProposalState.Queued ||
proposalState == ProposalState.Pending,
"Governor::execute: proposal can only be cancelled if it is queue... | 15,631 |
18 | // 25% to the TeamEth Smart Contract 100/25 = 4 | uint public divForTeamEthContract = 4;
| uint public divForTeamEthContract = 4;
| 46,152 |
250 | // Initialize can only be called once. It saves the block number in which it was initialized.Initialize an ACL instance and set `_permissionsCreator` as the entity that can create other permissions_permissionsCreator Entity that will be given permission over createPermission/ | function initialize(address _permissionsCreator) public onlyInit {
initialized();
require(msg.sender == address(kernel()), ERROR_AUTH_INIT_KERNEL);
_createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
}
| function initialize(address _permissionsCreator) public onlyInit {
initialized();
require(msg.sender == address(kernel()), ERROR_AUTH_INIT_KERNEL);
_createPermission(_permissionsCreator, this, CREATE_PERMISSIONS_ROLE, _permissionsCreator);
}
| 34,562 |
290 | // Not all deposits got in, but there are no partial deposits | userInvested = investor.userSums[leastUpperBound];
excess = investor.userSums[length - 1] - userInvested;
| userInvested = investor.userSums[leastUpperBound];
excess = investor.userSums[length - 1] - userInvested;
| 61,314 |
3 | // Internal function for decrease user reward balance& delete user if balance is zerouser Address of current useramount Ammount of reward tokens/ | function _decreaseUserRewardBalance(address user, uint256 amount) internal virtual {
if(getUserRewardBalance(user) >= amount) {
_users[user] -= amount;
if(getUserRewardBalance(user) == 0) {
delete _users[user];
}
} else {
revert("UserU... | function _decreaseUserRewardBalance(address user, uint256 amount) internal virtual {
if(getUserRewardBalance(user) >= amount) {
_users[user] -= amount;
if(getUserRewardBalance(user) == 0) {
delete _users[user];
}
} else {
revert("UserU... | 21,836 |
333 | // gets existing or registers new pID.use this when a player may be newreturn pID / | function determinePIDQR(address _realSender, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
| function determinePIDQR(address _realSender, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
| 70,178 |
61 | // Calculates the definite inverse integral of the curve _x : collateral value for upper limit of definite integral/ | function inverseCurveIntegral(uint256 _x) external pure returns(uint256);
| function inverseCurveIntegral(uint256 _x) external pure returns(uint256);
| 4,947 |
149 | // transfer | _updateAccountSnapshot(from);
_updateAccountSnapshot(to);
| _updateAccountSnapshot(from);
_updateAccountSnapshot(to);
| 34,705 |
126 | // Exchange rates and update times stored by currency code, e.g. 'PERI', or 'pUSD' | mapping(bytes32 => mapping(uint => RateAndUpdatedTime)) private _rates;
| mapping(bytes32 => mapping(uint => RateAndUpdatedTime)) private _rates;
| 75,824 |
47 | // Address of sale agent (a contract) which can mint new tokens | address public mintAgent;
| address public mintAgent;
| 12,806 |
72 | // build the EIP-712 contract domain separator, see https:eips.ethereum.org/EIPS/eip-712definition-of-domainseparator note: we specify contract version in its name | DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes("AliERC721v1")), block.chainid, address(this)));
| DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes("AliERC721v1")), block.chainid, address(this)));
| 42,730 |
19 | // return balance of caller | function balanceOf() external view returns (uint256) {
return balances[msg.sender];
}
| function balanceOf() external view returns (uint256) {
return balances[msg.sender];
}
| 37,989 |
8 | // add query to list of unfulfilled queries | remainingQueries[queryId] = true;
return queryId;
| remainingQueries[queryId] = true;
return queryId;
| 10,797 |
45 | // Itterate all stakes and grab amount of stakes | for (uint256 s = 0; s < summary.stakes.length; s += 1){
uint256 availableReward = calculateStakeReward(summary.stakes[s]);
summary.stakes[s].reward = availableReward;
totalStakeAmount = totalStakeAmount+summary.stakes[s].amount;
}
| for (uint256 s = 0; s < summary.stakes.length; s += 1){
uint256 availableReward = calculateStakeReward(summary.stakes[s]);
summary.stakes[s].reward = availableReward;
totalStakeAmount = totalStakeAmount+summary.stakes[s].amount;
}
| 5,604 |
225 | // Advance the given staker to the given node stakerAddress Address of the staker adding their stake nodeNum Index of the node to stake on / | function stakeOnNode(
address stakerAddress,
uint256 nodeNum,
uint256 confirmPeriodBlocks
| function stakeOnNode(
address stakerAddress,
uint256 nodeNum,
uint256 confirmPeriodBlocks
| 47,673 |
32 | // Oracle View functions / | function getPrice(uint payment) external view override returns (uint256) {
IEPriceOracle oracle = ePriceOracle[payment];
return oracle.getPrice();
}
| function getPrice(uint payment) external view override returns (uint256) {
IEPriceOracle oracle = ePriceOracle[payment];
return oracle.getPrice();
}
| 14,014 |
3 | // the addresses that are able to migrate positions | mapping (address => bool) public g_migrators;
| mapping (address => bool) public g_migrators;
| 26,235 |
186 | // produces non-zero if sender does not have all of the perms in the old scheme | require(bytes4(0x0000001f)&(scheme.permissions&(~schemes[msg.sender].permissions)) == bytes4(0));
| require(bytes4(0x0000001f)&(scheme.permissions&(~schemes[msg.sender].permissions)) == bytes4(0));
| 10,617 |
77 | // LinkedList is a library for a circular double linked list. / | library LinkedList {
/*
* @notice A permanent NULL node (0x0) in the circular double linked list.
* NULL.next is the head, and NULL.previous is the tail.
*/
address public constant NULL = 0x0;
/**
* @notice A node points to the node before it, and the node after it. If
* node.previous ... | library LinkedList {
/*
* @notice A permanent NULL node (0x0) in the circular double linked list.
* NULL.next is the head, and NULL.previous is the tail.
*/
address public constant NULL = 0x0;
/**
* @notice A node points to the node before it, and the node after it. If
* node.previous ... | 12,352 |
135 | // Level 5 costs uranium | KingOfEthResource(contractFor(ResourceType.URANIUM)).interfaceBurnTokens(
_player
, 1
);
| KingOfEthResource(contractFor(ResourceType.URANIUM)).interfaceBurnTokens(
_player
, 1
);
| 47,923 |
88 | // Migrates the staking rewards balance of the given addresses to a new staking rewards contract/The new rewards contract is determined according to the contracts registry/No impact of the calling contract if the currently configured contract in the registry/may be called also while the contract is locked/addrs is the ... | function migrateRewardsBalance(address[] calldata addrs) external;
| function migrateRewardsBalance(address[] calldata addrs) external;
| 62,436 |
3 | // transfer the trc20Token from the sender to this contract | bool transferResult = trc20Token.transferFrom(sender, address(this), rawValue);
require(transferResult, "TransferFrom failed!");
require(noteCommitment[output[0]] == 0, "Duplicate noteCommitments!");
uint64 value = rawValueToValue(rawValue);
bytes32 signHash = sha256(abi.encodeP... | bool transferResult = trc20Token.transferFrom(sender, address(this), rawValue);
require(transferResult, "TransferFrom failed!");
require(noteCommitment[output[0]] == 0, "Duplicate noteCommitments!");
uint64 value = rawValueToValue(rawValue);
bytes32 signHash = sha256(abi.encodeP... | 44,341 |
29 | // External function that pauses the contract. Only callable by contract admins.FOR EMERGENCY USE ONLY - Pauses all aspects of the contract, not overly applicable forERC721BasicMint, but may be quite useful for future children of this contract./ | function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
_pause();
}
| function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
_pause();
}
| 20,175 |
9 | // Transaction Helpers //Confirms the transfer of `_quantityToInvest` currency to the contract.function _collectInvestment(uint _quantityToInvest,uint _msgValue,bool _refundRemainder) private | // {
// if(address(currency) == address(0))
// {
// // currency is ETH
// if(_refundRemainder)
// {
// // Math: if _msgValue was not sufficient then revert
// uint refund = _msgValue.sub(_quantityToInvest);
// if(refund > 0)
// {
// Address.sendValue(msg.sender... | // {
// if(address(currency) == address(0))
// {
// // currency is ETH
// if(_refundRemainder)
// {
// // Math: if _msgValue was not sufficient then revert
// uint refund = _msgValue.sub(_quantityToInvest);
// if(refund > 0)
// {
// Address.sendValue(msg.sender... | 39,022 |
43 | // Check protection bits against request access | if (((xwr >> uint(xwrShift)) & 1) == 0) {
return (false, 0);
}
| if (((xwr >> uint(xwrShift)) & 1) == 0) {
return (false, 0);
}
| 38,335 |
167 | // ============ Modifiers ============ |
modifier onlyReplica() {
require(isReplica(msg.sender), "!replica");
_;
}
|
modifier onlyReplica() {
require(isReplica(msg.sender), "!replica");
_;
}
| 21,519 |
6 | // Verify that we have the appropriate address | require(candidateContract.isAvastarMetadata());
| require(candidateContract.isAvastarMetadata());
| 11,460 |
127 | // Returns the cap of a specific beneficiary. beneficiary Address whose cap is to be checkedreturn Current cap for individual beneficiary / | // function getCap(address beneficiary) public view returns (uint256) {
// return _caps[beneficiary];
// }
| // function getCap(address beneficiary) public view returns (uint256) {
// return _caps[beneficiary];
// }
| 5,070 |
13 | // Checks if rebalance has been locked | if (founderRebalanceLocked) return;
uint256 founderAmount = totalShares
.mul(totalSupply - (contractBalance + totalReleased + externalReleased))
.mul(getFdvFactor())
.div(10**decimals())
.div(10**decimals());
if (founderAmount > (contractBalance ... | if (founderRebalanceLocked) return;
uint256 founderAmount = totalShares
.mul(totalSupply - (contractBalance + totalReleased + externalReleased))
.mul(getFdvFactor())
.div(10**decimals())
.div(10**decimals());
if (founderAmount > (contractBalance ... | 22,915 |
5,500 | // 2751 | entry "thymectomized" : ENG_ADJECTIVE
| entry "thymectomized" : ENG_ADJECTIVE
| 19,363 |
127 | // settle loan origination fee | function _payBorrowingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 borrowingFee)
internal
| function _payBorrowingFee(
address user,
bytes32 loanId,
address feeToken,
uint256 borrowingFee)
internal
| 31,799 |
3 | // Transfers a given amount of currency. (With native token wrapping) | function transferCurrencyWithWrapperAndBalanceCheck(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
| function transferCurrencyWithWrapperAndBalanceCheck(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
| 15,018 |
20 | // Internal functions / | function _epochInProgress() internal view returns (bool) {
uint256 epochId = Counters.current(_epochIds);
// return epochId > 0 && !CoordinapeEpoch(_epochs[epochId]).ended();
return epochId > 0 && block.number < _epochEnds[epochId];
}
| function _epochInProgress() internal view returns (bool) {
uint256 epochId = Counters.current(_epochIds);
// return epochId > 0 && !CoordinapeEpoch(_epochs[epochId]).ended();
return epochId > 0 && block.number < _epochEnds[epochId];
}
| 31,339 |
46 | // lockable | struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
| struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
| 15,441 |
201 | // Types.Call | function data(bytes29 _view) internal view returns (bytes memory _data) {
_data = TypedMemView.clone(
_view.slice(CALL_PREFIX_LEN, dataLen(_view), uint40(Types.Data))
);
}
| function data(bytes29 _view) internal view returns (bytes memory _data) {
_data = TypedMemView.clone(
_view.slice(CALL_PREFIX_LEN, dataLen(_view), uint40(Types.Data))
);
}
| 21,535 |
87 | // Removes selectors _selectors The selectors to remove / | function removeSelectors(bytes4[] memory _selectors) external;
| function removeSelectors(bytes4[] memory _selectors) external;
| 29,021 |
392 | // Mint advance reward to sender | uint256 incentive = calculateReward();
mintToAccount(msg.sender, incentive);
mintToAccount(Constants.getTreasuryAddress(), 5e18);
emit Incentivization(msg.sender, incentive);
_;
| uint256 incentive = calculateReward();
mintToAccount(msg.sender, incentive);
mintToAccount(Constants.getTreasuryAddress(), 5e18);
emit Incentivization(msg.sender, incentive);
_;
| 13,699 |
66 | // This event is fired when server rejects player's game. | event LogGameRejected(address indexed player, uint indexed gameId);
| event LogGameRejected(address indexed player, uint indexed gameId);
| 28,450 |
4 | // tokens which help balance the pool are given 100% of their token1 value in liquidity tokens if the deposit worsens the ratio, dock the max - min amount `penaltyPercent` | uint256 deposit0PricedInToken1 = deposit0.mul(price).div(1e18);
uint256 pool0PricedInToken1 = pool0.mul(price).div(1e18);
if (pool0PricedInToken1.add(deposit0PricedInToken1) >= pool1 && deposit0PricedInToken1 > deposit1) {
shares = reduceByPercent(deposit0PricedInToken1.sub(deposit1)... | uint256 deposit0PricedInToken1 = deposit0.mul(price).div(1e18);
uint256 pool0PricedInToken1 = pool0.mul(price).div(1e18);
if (pool0PricedInToken1.add(deposit0PricedInToken1) >= pool1 && deposit0PricedInToken1 > deposit1) {
shares = reduceByPercent(deposit0PricedInToken1.sub(deposit1)... | 36,106 |
275 | // WickedCraniums contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract WickedCraniums is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "b80d60a4defcca5af3ed6526d8c0f86089b9400659c89da2b2725b32f8686d4a";
uint256 public constant craniumPrice = 80000000000000000; //0.08 ETH
uint public constant maxCraniumPurchase = 100;
uint256 public MAX_CR... | contract WickedCraniums is ERC721, Ownable {
using SafeMath for uint256;
string public PROV = "b80d60a4defcca5af3ed6526d8c0f86089b9400659c89da2b2725b32f8686d4a";
uint256 public constant craniumPrice = 80000000000000000; //0.08 ETH
uint public constant maxCraniumPurchase = 100;
uint256 public MAX_CR... | 11,872 |
30 | // Token distribution to Team | function sendTeamSupplyToken(address to) public onlyOwner {
require ((to != 0x0) && (isDistributionTransferred == 0));
balances[multisig] = balances[multisig].sub(_teamSupply);
balances[to] = balances[to].add(_teamSupply);
Transfer(multisig, to, _teamSupply);
}
| function sendTeamSupplyToken(address to) public onlyOwner {
require ((to != 0x0) && (isDistributionTransferred == 0));
balances[multisig] = balances[multisig].sub(_teamSupply);
balances[to] = balances[to].add(_teamSupply);
Transfer(multisig, to, _teamSupply);
}
| 11,586 |
26 | // Internal override function for batch burning NFTs / | function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
| function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
| 11,596 |
69 | // increase length by the double of the memory bytes length | mul(mlength, 2)
)
)
)
| mul(mlength, 2)
)
)
)
| 10,060 |
169 | // multipliers for each pooled token's precision to get to POOL_PRECISION_DECIMALS for example, TBTC has 18 decimals, so the multiplier should be 1. WBTC has 8, so the multiplier should be 1018 / 108 => 1010 | uint256[] tokenPrecisionMultipliers;
| uint256[] tokenPrecisionMultipliers;
| 19,593 |
54 | // Calculate 1 / x rounding towards zero.Revert on overflow or when x iszero.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function inv (int128 x) internal pure returns (int128) {
unchecked {
require (x != 0);
int256 result = int256 (0x100000000000000000000000000000000) / x;
require (result >= MIN_64x64 && result <= MAX_64x64);
return int128 (result);
}
}
| function inv (int128 x) internal pure returns (int128) {
unchecked {
require (x != 0);
int256 result = int256 (0x100000000000000000000000000000000) / x;
require (result >= MIN_64x64 && result <= MAX_64x64);
return int128 (result);
}
}
| 39,870 |
48 | // the creator of the contract is the initial CEO | CEO = msg.sender;
| CEO = msg.sender;
| 14,764 |
46 | // Approve allowance for admin account | adminAddr = admin;
approve(adminAddr, ADMIN_ALLOWANCE);
| adminAddr = admin;
approve(adminAddr, ADMIN_ALLOWANCE);
| 17,514 |
94 | // @notify View function meant to return whether an increase in the debt ceiling is currently allowedredemptionRate A custom redemption ratecurrentDebtCeiling The current debt ceiling for the collateral type with collateralNameupdatedCeiling The new ceiling computed for the collateral type with collateralName/ | function allowsIncrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowIncrease) {
allowIncrease = either(redemptionRate <= RAY, both(redemptionRate > RAY, blockIncreaseWhenRevalue == 0));
allowIncrease = both(currentDebtCeiling <= updatedC... | function allowsIncrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowIncrease) {
allowIncrease = either(redemptionRate <= RAY, both(redemptionRate > RAY, blockIncreaseWhenRevalue == 0));
allowIncrease = both(currentDebtCeiling <= updatedC... | 9,918 |
50 | // Moves tokens `amount` from `sender` to `recipient`. | * This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - ... | * This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - ... | 4,770 |
184 | // The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as afraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by anoverride. / | function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
| function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
| 6,050 |
170 | // `moduleId` is collision resitant -- unique `_moduleType` and incrementing `numOfModuleType` | moduleId = keccak256(abi.encodePacked(numOfModuleType[_moduleType], _moduleType));
numOfModuleType[_moduleType] += 1;
modules[moduleId] = _newModuleAddress;
emit ModuleUpdated(moduleId, _newModuleAddress);
| moduleId = keccak256(abi.encodePacked(numOfModuleType[_moduleType], _moduleType));
numOfModuleType[_moduleType] += 1;
modules[moduleId] = _newModuleAddress;
emit ModuleUpdated(moduleId, _newModuleAddress);
| 19,216 |
32 | // Threshold of sold amount | uint256 public threshold;
| uint256 public threshold;
| 53,450 |
9 | // set loan stop time | loanAttributes.loanStopTime = block.timestamp.add(loanAttributes.loanDuration);
| loanAttributes.loanStopTime = block.timestamp.add(loanAttributes.loanDuration);
| 33,941 |
342 | // Get the current pool value in underlying return total : total AUM in underlying / | function _getCurrentPoolValue() internal view
| function _getCurrentPoolValue() internal view
| 72,667 |
203 | // Internal function for executing decoded message. Performs additional validation on the message fields.msgId id of the processed message.sender sender address on the other side.executor address of an executor.gasLimit gas limit for a call to executor.dataType AMB message dataType to be included as a part of the heade... | function _executeMessage(
bytes32 msgId,
address sender,
address executor,
uint32 gasLimit,
uint8 dataType,
uint256[2] memory chainIds,
bytes memory data
| function _executeMessage(
bytes32 msgId,
address sender,
address executor,
uint32 gasLimit,
uint8 dataType,
uint256[2] memory chainIds,
bytes memory data
| 42,370 |
97 | // Verifies that the caller is the Vault or Governor. / | modifier onlyVaultOrGovernor() {
require(
msg.sender == vaultAddress || msg.sender == governor(),
"Caller is not the Vault or Governor"
);
_;
}
| modifier onlyVaultOrGovernor() {
require(
msg.sender == vaultAddress || msg.sender == governor(),
"Caller is not the Vault or Governor"
);
_;
}
| 43,247 |
8 | // ERC165 / | interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 _interfaceId)
... | interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 _interfaceId)
... | 18,939 |
139 | // get staker data for chosen farm and pool | IFarm.UserInfo memory user = farms[_currentFid].userInfo(_pid, msg.sender);
require(user.amount > 0, "changePool: user amount is 0");
require(user.withdrawTime == 0, "changePool: user is unstaking");
require(_currentFid != _nextFid, "changePool: same farm chosen");
| IFarm.UserInfo memory user = farms[_currentFid].userInfo(_pid, msg.sender);
require(user.amount > 0, "changePool: user amount is 0");
require(user.withdrawTime == 0, "changePool: user is unstaking");
require(_currentFid != _nextFid, "changePool: same farm chosen");
| 6,455 |
52 | // Guarantees that the msg.sender is an owner or operator of the given NFT._tokenId ID of the NFT to validate./ | modifier canOperate(uint256 _tokenId) {
event SchoolInformation(address indexed schoolAddress, string name, string taxID, bool status);
event StudentLaurated(address indexed schoolAddress, string courseID, string indexed studentID, bytes32 hashDiploma, uint256 indexDiploma);
address token... | modifier canOperate(uint256 _tokenId) {
event SchoolInformation(address indexed schoolAddress, string name, string taxID, bool status);
event StudentLaurated(address indexed schoolAddress, string courseID, string indexed studentID, bytes32 hashDiploma, uint256 indexDiploma);
address token... | 627 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.