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 |
|---|---|---|---|---|
145 | // Flash swap types | enum FlashSwapType {
FlashSwapWETHForExactTokens
}
| enum FlashSwapType {
FlashSwapWETHForExactTokens
}
| 16,553 |
3 | // setter to set the position of an implementation from the implementation position onwards | function _setImplementation(address _newImplementation) internal {
require(msg.sender == proxyOwner());
bytes32 position = implementationPosition;
assembly {
sstore(position, _newImplementation)
}
}
| function _setImplementation(address _newImplementation) internal {
require(msg.sender == proxyOwner());
bytes32 position = implementationPosition;
assembly {
sstore(position, _newImplementation)
}
}
| 42,135 |
19 | // on stake axion gets burned | IToken(addresses.mainToken).burn(msg.sender, amount);
| IToken(addresses.mainToken).burn(msg.sender, amount);
| 50,996 |
6 | // some helper functions for demo purposes (not required) | function getMyLockedFunds() public view returns (uint x) {
return accounts[msg.sender].balance;
}
| function getMyLockedFunds() public view returns (uint x) {
return accounts[msg.sender].balance;
}
| 39,553 |
11 | // Will evaluate if an array of addresses are past their subscription date and set their payment status to false .array of address. | function resetUserPaidStatus(address[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
if (userPastExpiration(_address[i])) {
UserRegistion[_address[i]].isPaid = false;
}
}
}
| function resetUserPaidStatus(address[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
if (userPastExpiration(_address[i])) {
UserRegistion[_address[i]].isPaid = false;
}
}
}
| 33,837 |
43 | // Fallback functions allowing to perform a delegatecall to the given implementation.This function will return whatever the implementation call returns / | fallback() external payable {
proxyCall();
}
| fallback() external payable {
proxyCall();
}
| 6,558 |
130 | // Sells can't exceed the sell limit(50.000 Tokens at start, can be updated to circulating supply) | if(amount>sellLimit) {
triedToDump.push(sender);
}
| if(amount>sellLimit) {
triedToDump.push(sender);
}
| 40,287 |
25 | // Fonskyionların public/private ları ayarlanacak, Contract ikinci oyuncuyu kabul etmiyorEğer kimse kazanamazsa bir sistem kur / | contract PickTheNumber is VRFConsumerBase {
//Chainlink değişkenleri
uint256 public vrf_fee = 0.005 ether; //VRF Coordinatorüne gönderdiğimiz ücret.
bytes32 public keyHash; //Coordinator ve aramızda yapılan bağıntı.
uint public _entryFee = 0.005 ether; // Oyuncular oyuna katılmak için ödemeliler.
... | contract PickTheNumber is VRFConsumerBase {
//Chainlink değişkenleri
uint256 public vrf_fee = 0.005 ether; //VRF Coordinatorüne gönderdiğimiz ücret.
bytes32 public keyHash; //Coordinator ve aramızda yapılan bağıntı.
uint public _entryFee = 0.005 ether; // Oyuncular oyuna katılmak için ödemeliler.
... | 6,672 |
2 | // pragma solidity ^0.8.0; //Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending... | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
| abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
| 8,531 |
89 | // Calculate the pure black-scholes premium for given params | function _getPurePremium(
uint secondsToExpiry,
uint vol,
uint spotPrice,
uint strikePrice
| function _getPurePremium(
uint secondsToExpiry,
uint vol,
uint spotPrice,
uint strikePrice
| 15,675 |
52 | // Insert the leaf | stateTree.insertLeaf(hashedLeaf);
| stateTree.insertLeaf(hashedLeaf);
| 21,009 |
18 | // Returns the amount of `debtShares` owned by `owner`.owner to check balance / | function balanceOfDebtShares(address owner) external view returns (uint256 debtShares);
| function balanceOfDebtShares(address owner) external view returns (uint256 debtShares);
| 13,635 |
3 | // Retrieves data of a randomization request that got successfully posted to the WRB within a given block./Returns zero values if no randomness request was actually posted within a given block./_block Block number whose randomness request is being queried for./ return _from Address from which the latest randomness requ... | function getRandomizeData(uint256 _block)
external view returns (address _from, uint256 _id, uint256 _prevBlock, uint256 _nextBlock);
| function getRandomizeData(uint256 _block)
external view returns (address _from, uint256 _id, uint256 _prevBlock, uint256 _nextBlock);
| 14,058 |
27 | // do the actual transfer | balances[from] -= value;
balances[to] += value;
CheckBest(balances[to], to);
| balances[from] -= value;
balances[to] += value;
CheckBest(balances[to], to);
| 28,704 |
32 | // Payout half to ownerPayee and half to updaterPayee | if (propertyOwnerPayee != 0) {
balances[propertyOwnerPayee] += payout / 2;
}
| if (propertyOwnerPayee != 0) {
balances[propertyOwnerPayee] += payout / 2;
}
| 50,473 |
164 | // Store the Advocate/Listener/Speaker information | require (_nameTAOPosition.initialize(nameId, nameId, nameId, nameId));
| require (_nameTAOPosition.initialize(nameId, nameId, nameId, nameId));
| 47,101 |
141 | // _newAmount : amount of underlying tokens that needs to be minted with this rebalance _clientProtocolAmounts : client side calculated amounts to put on each lending protocolreturn : whether has rebalanced or not / | function rebalance(uint256 _newAmount, uint256[] calldata _clientProtocolAmounts) external returns (bool);
| function rebalance(uint256 _newAmount, uint256[] calldata _clientProtocolAmounts) external returns (bool);
| 37,564 |
33 | // Pixel / | function testGetNonExistingPixel() public {
uint256 mintTax = 10 * (10**uint256(currency.decimals()));
_setMintTax(mintTax);
ITheSpaceRegistry.Pixel memory pixel = thespace.getPixel(PIXEL_ID);
assertEq(pixel.price, mintTax);
assertEq(pixel.color, 0);
assertEq(pixel.... | function testGetNonExistingPixel() public {
uint256 mintTax = 10 * (10**uint256(currency.decimals()));
_setMintTax(mintTax);
ITheSpaceRegistry.Pixel memory pixel = thespace.getPixel(PIXEL_ID);
assertEq(pixel.price, mintTax);
assertEq(pixel.color, 0);
assertEq(pixel.... | 19,519 |
20 | // Construct a new Tribe token account The initial account to grant all the tokens minter_ The account with minting ability / | constructor(address account, address minter_) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
minter = minter_;
emit MinterChanged(address(0), minter);
}
| constructor(address account, address minter_) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
minter = minter_;
emit MinterChanged(address(0), minter);
}
| 67,473 |
150 | // If the reserve has been met, then bidding will end in 24 hours if we are near the end, we have bids, then extend the bidding end | bool isCountDownTriggered = originalBiddingEnd > 0;
if (msg.value >= reserveAuction.reservePrice && !isCountDownTriggered) {
reserveAuction.biddingEnd = uint128(block.timestamp) + reserveAuctionLengthOnceReserveMet;
}
| bool isCountDownTriggered = originalBiddingEnd > 0;
if (msg.value >= reserveAuction.reservePrice && !isCountDownTriggered) {
reserveAuction.biddingEnd = uint128(block.timestamp) + reserveAuctionLengthOnceReserveMet;
}
| 23,950 |
68 | // Try to deal a new limit order or insert it into orderbook its suggested order id is 'id' and suggested positions are in 'prevKey' prevKey points to 3 existing orders in the single-linked list the order's sender is 'sender'. the order's amount is amountstockUnit, which is the stock amount to be sold or bought. the or... | function addLimitOrder(bool isBuy, address sender, uint64 amount, uint32 price32, uint32 id, uint72 prevKey) external payable;
| function addLimitOrder(bool isBuy, address sender, uint64 amount, uint32 price32, uint32 id, uint72 prevKey) external payable;
| 38,740 |
128 | // Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
| function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
| 28,182 |
21 | // Supply caps enforced by mintAllowed for each kToken address. Defaults to zero which corresponds to unlimited supplying. | mapping(address => uint) public supplyCaps;
| mapping(address => uint) public supplyCaps;
| 28,530 |
160 | // globalConstraintsCount return the global constraint pre and post count return uint globalConstraintsPre count. return uint globalConstraintsPost count./ | function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint,uint)
| function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint,uint)
| 35,341 |
40 | // Queries the amount of unclaimed rewards for the pool member in a given epoch and feeHandlerreturn 0 if PoolMaster has not called claimRewardMasterreturn 0 if PoolMember has previously claimed reward for the epochreturn 0 if PoolMember has not stake for the epochreturn 0 if PoolMember has not delegated it stake to th... | function getUnclaimedRewardsMember(
address _poolMember,
uint256 _epoch,
address _feeHandler
| function getUnclaimedRewardsMember(
address _poolMember,
uint256 _epoch,
address _feeHandler
| 25,055 |
35 | // There cannot be an owner with address 0. | address lastOwner = address(0);
address currentOwner;
uint8 v;
bytes32 r;
bytes32 s;
uint256 i;
for (i = 0; i < requiredSignatures; i++) {
(v, r, s) = signatureSplit(signatures, i);
if (v == 0) {
| address lastOwner = address(0);
address currentOwner;
uint8 v;
bytes32 r;
bytes32 s;
uint256 i;
for (i = 0; i < requiredSignatures; i++) {
(v, r, s) = signatureSplit(signatures, i);
if (v == 0) {
| 40,681 |
39 | // count confirmation | uint256 remaining;
| uint256 remaining;
| 40,025 |
3 | // value used to divide collateral to adjust the decimal places | uint256 public immutable collateralDecimalsAdjustmentFactor;
| uint256 public immutable collateralDecimalsAdjustmentFactor;
| 34,404 |
179 | // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering. | require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
address... | require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
address... | 872 |
75 | // pause/unpause entire protocol, including mint/redeem/borrow/seize/transfer Admin function, only owner and pauseGuardian can call this _paused whether to pause or unpause / | function _setProtocolPaused(bool _paused)
external
override
checkPauser(_paused)
| function _setProtocolPaused(bool _paused)
external
override
checkPauser(_paused)
| 57,758 |
115 | // remove stake | orderPool.salesRate[orderId] = 0;
| orderPool.salesRate[orderId] = 0;
| 35,124 |
37 | // try to choose a sacrifice in an already full stage (finalize a stage) | tryFinalizeStage();
| tryFinalizeStage();
| 27,623 |
24 | // Triggered on set SELL order | event Order_sell(address indexed _owner, uint256 _max_amount, uint256 _price);
| event Order_sell(address indexed _owner, uint256 _max_amount, uint256 _price);
| 47,609 |
2 | // Emitted when a `severity` is aggregated for a given `season` + `region` | event SeverityAggregated(
uint16 indexed season,
bytes32 region,
Common.Severity severity,
address indexed keeper
);
| event SeverityAggregated(
uint16 indexed season,
bytes32 region,
Common.Severity severity,
address indexed keeper
);
| 11,047 |
91 | // See README.md for updgrade plan | contractsGrantedAccess[_v2Address] = true;
| contractsGrantedAccess[_v2Address] = true;
| 1,727 |
4 | // Returns the average of two numbers. The result is rounded towardszero. / | function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
| function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
| 21,017 |
38 | // Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to `transfer`, and can be used toe.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.- `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(sender != _jailedAddress, "Address jailed");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[send... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(sender != _jailedAddress, "Address jailed");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[send... | 16,430 |
119 | // Function selector for ERC721Receiver.onERC721Received 0x150b7a02 | bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
| bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
| 23,983 |
47 | // allowMinting | mintingEnabled=enable;
| mintingEnabled=enable;
| 9,422 |
10 | // TODO: tranfer cUSD to _user, using _unitspricePerUnit | emit CheckpointOpportunity(_id, _units, _user);
| emit CheckpointOpportunity(_id, _units, _user);
| 2,756 |
33 | // Removing a bit of dust to avoid rounding errorsrepayAmount = maxClose - 1e1; | repayAmount = maxClose;
| repayAmount = maxClose;
| 31,934 |
69 | // Transfer the token from the caller and revert on failure. | _transferInToken(tokenProvided, msg.sender, tokenProvidedAmount);
totalTokensSold = _tradeTokenForToken(
msg.sender,
tokenProvided,
tokenReceived,
tokenProvidedAmount,
quotedTokenReceivedAmount,
deadline,
routeThroughEther
| _transferInToken(tokenProvided, msg.sender, tokenProvidedAmount);
totalTokensSold = _tradeTokenForToken(
msg.sender,
tokenProvided,
tokenReceived,
tokenProvidedAmount,
quotedTokenReceivedAmount,
deadline,
routeThroughEther
| 78,151 |
7 | // Transfer tokens to attacker | token.transferFrom(address(wallet), owner(), 10 ether);
| token.transferFrom(address(wallet), owner(), 10 ether);
| 38,598 |
267 | // https:docs.synthetix.io/contracts/source/contracts/binaryoptionmarket | contract BinaryOptionMarket is Owned, MixinResolver, IBinaryOptionMarket {
/* ========== LIBRARIES ========== */
using SafeMath for uint;
using SafeDecimalMath for uint;
/* ========== TYPES ========== */
struct Options {
BinaryOption long;
BinaryOption short;
}
struct Pri... | contract BinaryOptionMarket is Owned, MixinResolver, IBinaryOptionMarket {
/* ========== LIBRARIES ========== */
using SafeMath for uint;
using SafeDecimalMath for uint;
/* ========== TYPES ========== */
struct Options {
BinaryOption long;
BinaryOption short;
}
struct Pri... | 30,151 |
22 | // Check if point is the neutral of the curve / | function ecZZ_IsZero (uint x0, uint y0, uint zz0, uint zzz0) internal pure returns (bool)
| function ecZZ_IsZero (uint x0, uint y0, uint zz0, uint zzz0) internal pure returns (bool)
| 22,080 |
2 | // 0.75 $RAD / day | uint256 constant MED = 0.75 ether;
| uint256 constant MED = 0.75 ether;
| 28,031 |
155 | // ERC1363Spender interface Interface for any contract that wants to support `approveAndCall` from ERC1363 token contracts. / | interface IERC1363Spender {
/*
* Note: the ERC-165 identifier for this interface is 0.8.04a2d0.
* 0.8.04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
*/
/**
* @notice Handle the approval of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipien... | interface IERC1363Spender {
/*
* Note: the ERC-165 identifier for this interface is 0.8.04a2d0.
* 0.8.04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
*/
/**
* @notice Handle the approval of ERC1363 tokens
* @dev Any ERC1363 smart contract calls this function on the recipien... | 19,492 |
0 | // Represents the deposit of an NFT | struct Deposit {
address owner;
uint128 liquidity;
address token0;
address token1;
}
| struct Deposit {
address owner;
uint128 liquidity;
address token0;
address token1;
}
| 57,022 |
26 | // unpackMessage will revert if anything else other than XChainMsgType.XFER is in the _payload to support additional message types in the future implement something like if (xchainMsgType == XChainMsgType.XFER) ... | IPortfolio.XFER memory xfer = unpackXFerMessage(msgdata);
xfer.symbol = getSymbolForId(xfer.symbol);
return (xfer.trader, xfer.symbol, xfer.quantity);
| IPortfolio.XFER memory xfer = unpackXFerMessage(msgdata);
xfer.symbol = getSymbolForId(xfer.symbol);
return (xfer.trader, xfer.symbol, xfer.quantity);
| 34,676 |
283 | // Mints tokens/ | function mintDoges(uint256 numberOfTokens) external payable {
require(saleIsActive, "Sale must be active to mint");
require(numberOfTokens <= maxToMint, "Invalid amount to mint per once");
require(mintAmount.add(numberOfTokens).add(MAX_CLAIM) <= MAX_DOGE_SUPPLY, "Purchase would exceed max su... | function mintDoges(uint256 numberOfTokens) external payable {
require(saleIsActive, "Sale must be active to mint");
require(numberOfTokens <= maxToMint, "Invalid amount to mint per once");
require(mintAmount.add(numberOfTokens).add(MAX_CLAIM) <= MAX_DOGE_SUPPLY, "Purchase would exceed max su... | 34,035 |
7 | // Here we don't have enough money so partially pay to investor | dep.depositor.send(money); // Send to him everything we have
dep.payout += money; // Update the payout amount
break; // Exit cycle
| dep.depositor.send(money); // Send to him everything we have
dep.payout += money; // Update the payout amount
break; // Exit cycle
| 14,745 |
8 | // Test helper for STQCrowdsale, DONT use it in production! | contract STQCrowdsaleTestHelper is STQCrowdsale {
function STQCrowdsaleTestHelper(address[] _owners, address _token, address _funds, address _teamTokens)
STQCrowdsale(_owners, _token, _funds, _teamTokens)
{
}
function getCurrentTime() internal constant returns (uint) {
return m_time;
... | contract STQCrowdsaleTestHelper is STQCrowdsale {
function STQCrowdsaleTestHelper(address[] _owners, address _token, address _funds, address _teamTokens)
STQCrowdsale(_owners, _token, _funds, _teamTokens)
{
}
function getCurrentTime() internal constant returns (uint) {
return m_time;
... | 2,033 |
28 | // Update the number of decimals for the token newDecimals The new number of decimals for the token / | function _setDecimals(uint8 newDecimals) internal {
_decimals = newDecimals;
}
| function _setDecimals(uint8 newDecimals) internal {
_decimals = newDecimals;
}
| 4,649 |
36 | // The `order` must be verified by calling `Orders.verifyOrder` before calling this function. | function executeDeposit(Orders.Order calldata order) internal {
uint256 gasStart = gasleft();
orders.dequeueOrder(order.orderId);
(bool executionSuccess, bytes memory data) = address(this).call{
gas: order.gasLimit.sub(
Orders.ORDER_BASE_COST.add(orders.transferG... | function executeDeposit(Orders.Order calldata order) internal {
uint256 gasStart = gasleft();
orders.dequeueOrder(order.orderId);
(bool executionSuccess, bytes memory data) = address(this).call{
gas: order.gasLimit.sub(
Orders.ORDER_BASE_COST.add(orders.transferG... | 28,495 |
274 | // Increase the withdrawable funds for the given address owner Address of the account to add withdrawable funds to / | function increaseWithdrawableFunds(address owner, uint256 amount) internal {
_withdrawableFunds[owner] = _withdrawableFunds[owner].add(amount);
}
| function increaseWithdrawableFunds(address owner, uint256 amount) internal {
_withdrawableFunds[owner] = _withdrawableFunds[owner].add(amount);
}
| 35,857 |
217 | // Returns tax as a proper fraction for the given country, defined by `_tokenId` _tokenId country id to query tax forreturn tax as a proper fraction (tuple containing nominator and denominator) / | function getTax(uint256 _tokenId) public constant returns(uint8, uint8) {
// obtain token's tax as packed fraction
uint16 tax = getTaxPacked(_tokenId);
// return tax as a proper fraction
return (tax.getNominator(), tax.getDenominator());
}
| function getTax(uint256 _tokenId) public constant returns(uint8, uint8) {
// obtain token's tax as packed fraction
uint16 tax = getTaxPacked(_tokenId);
// return tax as a proper fraction
return (tax.getNominator(), tax.getDenominator());
}
| 32,393 |
12 | // return true if the account is the owner of the contract. / | function isOwner(address account) public view returns(bool) {
return account == _owner;
}
| function isOwner(address account) public view returns(bool) {
return account == _owner;
}
| 10,195 |
17 | // Get the approved address for a single NFT. Throws if `_tokenId` is not a valid NFT. _tokenId The NFT to find the approved address for.return Address that _tokenId is approved for. / | function getApproved(uint256 _tokenId) public view returns (address) {
address _owner = owners[_tokenId];
require(_owner != address(0));
address _approved = approveds[_tokenId];
return _approved;
}
| function getApproved(uint256 _tokenId) public view returns (address) {
address _owner = owners[_tokenId];
require(_owner != address(0));
address _approved = approveds[_tokenId];
return _approved;
}
| 26,114 |
18 | // Sets the siloed borrowing flag for the reserve. When this flag is set to true, users borrowing this asset will not be allowed to borrow any other asset. self The reserve configuration siloed True if the asset is siloed / | {
self.data =
(self.data & SILOED_BORROWING_MASK) |
(uint256(siloed ? 1 : 0) << SILOED_BORROWING_START_BIT_POSITION);
}
| {
self.data =
(self.data & SILOED_BORROWING_MASK) |
(uint256(siloed ? 1 : 0) << SILOED_BORROWING_START_BIT_POSITION);
}
| 36,435 |
16 | // This basically means if a minter burns more than its usedAllownace,there will be tokens left unburned,and some other minter will have to burn it. / | bool burningMoreThanUsedAllowance = (usedAllowance < amount);
| bool burningMoreThanUsedAllowance = (usedAllowance < amount);
| 30,263 |
24 | // We always want to assess for the most recently past nextDueTime. So if the recalculation above sets the nextDueTime into the future, then ensure we pass in the one just before this. | if (timeToAssess > currentTime()) {
uint256 secondsPerPeriod = paymentPeriodInDays.mul(SECONDS_PER_DAY);
timeToAssess = timeToAssess.sub(secondsPerPeriod);
}
| if (timeToAssess > currentTime()) {
uint256 secondsPerPeriod = paymentPeriodInDays.mul(SECONDS_PER_DAY);
timeToAssess = timeToAssess.sub(secondsPerPeriod);
}
| 6,041 |
11 | // Add Emergency pause/_pause to set Emergency Pause ON/OFF/_by to set who Start/Stop EP | function addEmergencyPause(bool _pause, bytes4 _by) public {
require(_by == "AB" || _by == "AUT","Invalid call.");
require(msg.sender == getLatestAddress("P1") || msg.sender == getLatestAddress("GV"),"Callable by P1 and GV only.");
emergencyPaused.push(EmergencyPause(_pause, now, _by));
... | function addEmergencyPause(bool _pause, bytes4 _by) public {
require(_by == "AB" || _by == "AUT","Invalid call.");
require(msg.sender == getLatestAddress("P1") || msg.sender == getLatestAddress("GV"),"Callable by P1 and GV only.");
emergencyPaused.push(EmergencyPause(_pause, now, _by));
... | 36,595 |
153 | // uint remainingAmount = amountAfterFee.sub(_75Percent); |
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
holders.add(msg.sender);
if (referrals[msg.sender] == address(0)) {
referrals[msg.sender] = referrer;
}
|
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
holders.add(msg.sender);
if (referrals[msg.sender] == address(0)) {
referrals[msg.sender] = referrer;
}
| 3,721 |
16 | // path = remoteAddress + localAddress | require(
chainAddressSize != 0 && _path.length == 20 + chainAddressSize,
"LayerZero: incorrect remote address size"
);
address srcInPath;
bytes memory path = _path; // copy to memory
assembly {
srcInPath := mload... | require(
chainAddressSize != 0 && _path.length == 20 + chainAddressSize,
"LayerZero: incorrect remote address size"
);
address srcInPath;
bytes memory path = _path; // copy to memory
assembly {
srcInPath := mload... | 25,963 |
10 | // modify internal contract state before transfering funds | delete _entries;
| delete _entries;
| 3,476 |
128 | // toogle market pair status | function setMarketPairStatus(address account, bool newValue) public onlyOwner {
isMarketPair[account] = newValue;
}
| function setMarketPairStatus(address account, bool newValue) public onlyOwner {
isMarketPair[account] = newValue;
}
| 23,092 |
0 | // should access position of caller using delegatecall | function shouldBuy(Position memory position, uint _reserve0, uint _reserve1) external pure override returns(uint){
return position.blockTimestamp == 0 ? position.amount : 0 ;
}
| function shouldBuy(Position memory position, uint _reserve0, uint _reserve1) external pure override returns(uint){
return position.blockTimestamp == 0 ? position.amount : 0 ;
}
| 3,796 |
6 | // find the corresponding request of the letter: | string memory letterStudentId = letters[_letterId].studentId;
string memory letterRecommenderId = letters[_letterId].recommenderId;
string memory letterProgramId = letters[_letterId].schoolProgramId;
for (uint i = 0; i < requests.length; i++) {
if ( (keccak256(requests[i].stu... | string memory letterStudentId = letters[_letterId].studentId;
string memory letterRecommenderId = letters[_letterId].recommenderId;
string memory letterProgramId = letters[_letterId].schoolProgramId;
for (uint i = 0; i < requests.length; i++) {
if ( (keccak256(requests[i].stu... | 42,645 |
107 | // removes all fee from transaction if takefee is set to false / | function removeAllFee() private {
if(_totalFee == 0) return;
_previousTotalFee = _totalFee;
_totalFee = 0;
}
| function removeAllFee() private {
if(_totalFee == 0) return;
_previousTotalFee = _totalFee;
_totalFee = 0;
}
| 57,457 |
49 | // Wrapper around addLiquidity() and optionStake() tokenIds The tokenIds of the nfts to send to the sudoswap pool. minPrice The min price to lp at. maxPrice The max price to lp at. termIndex Index into the terms array which tells how long to stake for. / | function addLiquidityAndOptionStake(
uint256[] calldata tokenIds,
uint256 minPrice,
uint256 maxPrice,
uint256 termIndex
)
public
payable
returns (uint256 tokenId)
| function addLiquidityAndOptionStake(
uint256[] calldata tokenIds,
uint256 minPrice,
uint256 maxPrice,
uint256 termIndex
)
public
payable
returns (uint256 tokenId)
| 20,850 |
128 | // Process withdrawal fee | uint256 _fee = _processWithdrawalFee(_toWithdraw);
| uint256 _fee = _processWithdrawalFee(_toWithdraw);
| 34,046 |
85 | // Pancake Profile is requested | bool public pancakeProfileIsRequested;
| bool public pancakeProfileIsRequested;
| 39,179 |
26 | // sets the executor address/_executorAddress the address of the executor contract | function setExecutor(address _executorAddress) external onlyOwner {
executor = IExecutor(_executorAddress);
emit ExecutorSet(_executorAddress);
}
| function setExecutor(address _executorAddress) external onlyOwner {
executor = IExecutor(_executorAddress);
emit ExecutorSet(_executorAddress);
}
| 18,337 |
315 | // Jackpot holding contract. This accepts token payouts from a game for every player loss, and on a win, pays out half of the jackpot to the winner. Jackpot payout should only be called from the game./ | contract JackpotHolding is ERC223Receiving {
/****************************
* FIELDS
****************************/
// How many times we've paid out the jackpot
uint public payOutNumber = 0;
// The amount to divide the token balance by for a pay out (defaults to half the token balance)
uint public payO... | contract JackpotHolding is ERC223Receiving {
/****************************
* FIELDS
****************************/
// How many times we've paid out the jackpot
uint public payOutNumber = 0;
// The amount to divide the token balance by for a pay out (defaults to half the token balance)
uint public payO... | 76,644 |
328 | // DepositCollateralDelegator dYdX Interface that smart contracts must implement in order to let other addresses deposit heldTokensinto a position owned by the smart contract. NOTE: Any contract implementing this interface should also use OnlyMargin to control accessto these functions / | interface DepositCollateralDelegator {
// ============ Public Interface functions ============
/**
* Function a contract must implement in order to let other addresses call depositCollateral().
*
* @param depositor Address of the caller of the depositCollateral() function
* @param posi... | interface DepositCollateralDelegator {
// ============ Public Interface functions ============
/**
* Function a contract must implement in order to let other addresses call depositCollateral().
*
* @param depositor Address of the caller of the depositCollateral() function
* @param posi... | 5,744 |
58 | // it worked, _sender placed a bid | lastAuction.highestBidder = _sender;
zoneFactory.fillCurrentZoneBidder(_sender);
zoneFactory.emitBid(geohash, _sender, currentAuctionId, _dthAmount);
| lastAuction.highestBidder = _sender;
zoneFactory.fillCurrentZoneBidder(_sender);
zoneFactory.emitBid(geohash, _sender, currentAuctionId, _dthAmount);
| 10,120 |
3 | // Verifies if the given value is valid as a move for the givennamespace.If it is not, the function throws.If it is, the fee thatshould be charged is returned. Note that the function does not know the exact name.This ensures thatthe policy cannot be abused to censor specific names (and the associatedgame assets) after ... | function checkMove (string memory ns, string memory mv)
external returns (uint256);
| function checkMove (string memory ns, string memory mv)
external returns (uint256);
| 6,451 |
8 | // --- gift | function freeMint(uint256 quantity) external {
require(giftedList[msg.sender], "NOT_WHITELISTED");
require(quantity <= GIFT_PER_ADDRESS, "ONLY_ONE_GIFT");
require(giftedAmount + quantity <= GIFT_LIMIT, "SUPPLY_LIMIT_EXPIRED");
require(totalMinted() + quantity <= MAX_SUPPLY, "TOKENS_E... | function freeMint(uint256 quantity) external {
require(giftedList[msg.sender], "NOT_WHITELISTED");
require(quantity <= GIFT_PER_ADDRESS, "ONLY_ONE_GIFT");
require(giftedAmount + quantity <= GIFT_LIMIT, "SUPPLY_LIMIT_EXPIRED");
require(totalMinted() + quantity <= MAX_SUPPLY, "TOKENS_E... | 16,083 |
160 | // globalConstraintsCount return the global constraint pre and post count return uint globalConstraintsPre count. return uint globalConstraintsPost count./ | function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint,uint)
| function globalConstraintsCount(address _avatar)
external
isAvatarValid(_avatar)
view
returns(uint,uint)
| 8,080 |
14 | // Multiplies two numbers, throws on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (... | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (... | 13,110 |
130 | // Cannot recover the staking token or the rewards token | require(tokenAddress != address(stakingToken) && tokenAddress != address(sporeToken), "Cannot withdraw the staking or rewards tokens");
| require(tokenAddress != address(stakingToken) && tokenAddress != address(sporeToken), "Cannot withdraw the staking or rewards tokens");
| 11,546 |
284 | // the creator of the contract is the initial CEO | ceoAddress = msg.sender;
| ceoAddress = msg.sender;
| 8,207 |
3 | // Event emitted when a Burner role is granted to an address./beneficiary The address that is granted the Burner role./caller The address that performed the role grant operation. | event BurnerRoleGranted(
address indexed beneficiary,
address indexed caller
);
| event BurnerRoleGranted(
address indexed beneficiary,
address indexed caller
);
| 33,247 |
360 | // What percentage of the debt will they be left with? | uint newDebt = existingDebt.sub(debtToRemove);
uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove);
uint newDebtPercentage = newDebt.divideDecimalRoundPrecise(newTotalDebtIssued);
| uint newDebt = existingDebt.sub(debtToRemove);
uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove);
uint newDebtPercentage = newDebt.divideDecimalRoundPrecise(newTotalDebtIssued);
| 6,219 |
2 | // 任务完成的评价(viewers mark) | int8 result;
| int8 result;
| 42,305 |
2 | // Emitted when the allowance of a `spender` for an `owner` is set by | * a call to {approve}. `value` is the new allowance.
*/
event QuantizedTokenGenerated(address account, address indexed token, uint256 amount);
}
| * a call to {approve}. `value` is the new allowance.
*/
event QuantizedTokenGenerated(address account, address indexed token, uint256 amount);
}
| 7,223 |
220 | // amountSpecified (Exact input: positive) (Exact output: negative) | int256 amountSpecified = -1 * int256(_amountOut);
uint160 sqrtPriceLimitX96 = (zeroForOne ? 4295128740 : 1461446703485210103287273052203988822378723970341);
| int256 amountSpecified = -1 * int256(_amountOut);
uint160 sqrtPriceLimitX96 = (zeroForOne ? 4295128740 : 1461446703485210103287273052203988822378723970341);
| 16,597 |
5 | // Returns the amount of tokens in existence. / |
function totalSupply() external view returns (uint256);
|
function totalSupply() external view returns (uint256);
| 613 |
257 | // 创建新的拍卖 | function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
) external {
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
... | function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
) external {
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
... | 44,134 |
6 | // Super simple bridge that bridges Eth from Mainnet and Optimism. | contract Bridge {
address public owner;
event BridgeEth(uint256 amount, uint256 targetChain);
constructor(address _owner) {
owner = _owner;
}
function verifyChain(uint256 targetChain) public pure returns (bool) {
// optimism = 420
// mainnet = 1
if (targetChain == ... | contract Bridge {
address public owner;
event BridgeEth(uint256 amount, uint256 targetChain);
constructor(address _owner) {
owner = _owner;
}
function verifyChain(uint256 targetChain) public pure returns (bool) {
// optimism = 420
// mainnet = 1
if (targetChain == ... | 24,149 |
3 | // Ownership Marketplace library. / | library Ownership {
bytes32 public constant SPLIT_TYPEHASH = keccak256("Split(address account,uint96 shares)");
struct Split {
address payable account;
uint96 shares;
}
struct Royalties {
Split[] splits;
uint96 percentage;
}
function hash(Split memory split) in... | library Ownership {
bytes32 public constant SPLIT_TYPEHASH = keccak256("Split(address account,uint96 shares)");
struct Split {
address payable account;
uint96 shares;
}
struct Royalties {
Split[] splits;
uint96 percentage;
}
function hash(Split memory split) in... | 28,516 |
17 | // this function is called by buyer to finalize the transaction/ | function releaseFunds(bytes32 escrowID) external onlyBuyer(escrowID) {
require(
escrowTransactions[escrowID].status == EscrowStatus.Delivered,
"Can't release funds"
);
escrowTransactions[escrowID].status = EscrowStatus.Released;
if (escrowTransactions[escrowID].escrow_type == EscrowType.Bu... | function releaseFunds(bytes32 escrowID) external onlyBuyer(escrowID) {
require(
escrowTransactions[escrowID].status == EscrowStatus.Delivered,
"Can't release funds"
);
escrowTransactions[escrowID].status = EscrowStatus.Released;
if (escrowTransactions[escrowID].escrow_type == EscrowType.Bu... | 12,122 |
25 | // set the Oracle to be used by this UA for LayerZero messages | function setOracle(uint16 dstChainId, address oracle) external {
// should technically be onlyOwner but this is a mock
uint TYPE_ORACLE = 6; // from UltraLightNode
// set the Oracle
// uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config
endpoint.setConf... | function setOracle(uint16 dstChainId, address oracle) external {
// should technically be onlyOwner but this is a mock
uint TYPE_ORACLE = 6; // from UltraLightNode
// set the Oracle
// uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config
endpoint.setConf... | 27,450 |
130 | // Emits a {Approval} event | function _approve(address _owner, address _spender, uint96 amount) internal {
require(_owner != address(0), "ERC20: approve from the zero address");
require(_spender != address(0), "ERC20: approve to the zero address");
allowances[_owner][_spender] = amount;
emit Approval(_owner, _s... | function _approve(address _owner, address _spender, uint96 amount) internal {
require(_owner != address(0), "ERC20: approve from the zero address");
require(_spender != address(0), "ERC20: approve to the zero address");
allowances[_owner][_spender] = amount;
emit Approval(_owner, _s... | 58,383 |
6,366 | // 3185 | entry "reduplicatively" : ENG_ADVERB
| entry "reduplicatively" : ENG_ADVERB
| 24,021 |
155 | // mint_amount = token_supply(D2 - D0) / D0 | mint_amount = totalSupply().mul(D2.sub(D0)).div(D0);
| mint_amount = totalSupply().mul(D2.sub(D0)).div(D0);
| 52,790 |
20 | // Store the persons details into the arrays | for(uint i = 0; i<personCount; i++){
NationalIDArray[i] = PersonsArray[i];
FirstNameArray[i] = PersonMap[PersonsArray[i]].FirstName;
LastNameArray[i] = PersonMap[PersonsArray[i]].LastName;
GenderArray[i] = PersonMap[PersonsArray[i]].Gender;
DateOfBirthArray[i] = PersonMap[PersonsArray[i]].DateOf... | for(uint i = 0; i<personCount; i++){
NationalIDArray[i] = PersonsArray[i];
FirstNameArray[i] = PersonMap[PersonsArray[i]].FirstName;
LastNameArray[i] = PersonMap[PersonsArray[i]].LastName;
GenderArray[i] = PersonMap[PersonsArray[i]].Gender;
DateOfBirthArray[i] = PersonMap[PersonsArray[i]].DateOf... | 32,449 |
230 | // Verify signature | bytes32 signedMessageHash = hashForSignature(
_symbol,
_recipient,
_amount,
msg.sender,
_nHash
);
require(
status[signedMessageHash] == false,
"Gateway: nonce hash already spent"
| bytes32 signedMessageHash = hashForSignature(
_symbol,
_recipient,
_amount,
msg.sender,
_nHash
);
require(
status[signedMessageHash] == false,
"Gateway: nonce hash already spent"
| 9,985 |
187 | // Maximum number of premium and ultra premium mints | uint256 public constant MAXIMUM_PREMIUM_MINTS = 2000;
uint256 public constant MAXIMUM_ULTRA_PREMIUM_MINTS = 500;
| uint256 public constant MAXIMUM_PREMIUM_MINTS = 2000;
uint256 public constant MAXIMUM_ULTRA_PREMIUM_MINTS = 500;
| 20,094 |
54 | // Calculates sqrt(a), following the selected rounding direction. / | function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
| function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
| 440 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.