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 | // anit-sniper | uint256 public tradingActiveBlock = 0; // 0 means trading is not active
mapping(address => bool) public boughtEarly; // mapping to track addresses that buy within the first 2 blocks pay a 3x tax for 24 hours to sell
uint256 public earlyBuyPenaltyEnd; // determines when snipers/bots can sell without extra pe... | uint256 public tradingActiveBlock = 0; // 0 means trading is not active
mapping(address => bool) public boughtEarly; // mapping to track addresses that buy within the first 2 blocks pay a 3x tax for 24 hours to sell
uint256 public earlyBuyPenaltyEnd; // determines when snipers/bots can sell without extra pe... | 15,104 |
98 | // Make sure the holder doesn't transfer more than what he already has. | uint256 transferable = vested.sub(grant.transferred);
if (transferable == 0) {
return;
}
| uint256 transferable = vested.sub(grant.transferred);
if (transferable == 0) {
return;
}
| 46,640 |
81 | // import { InitializableAdminUpgradeabilityProxy } from "../shared/@openzeppelin-2.5/upgrades/InitializableAdminUpgradeabilityProxy.sol"; | constructor(
address _logic,
address admin_,
bytes memory _data
| constructor(
address _logic,
address admin_,
bytes memory _data
| 43,746 |
18 | // workaround for stack too deep | uint16 srcChainId = _srcChainId;
bytes memory srcAddress = _srcAddress;
uint64 nonce = _nonce;
bytes memory payload = _payload;
bytes32 from_ = from;
address to_ = to;
uint amount_ = amount;
bytes memory payloadForCall_ = payloadForCall;
| uint16 srcChainId = _srcChainId;
bytes memory srcAddress = _srcAddress;
uint64 nonce = _nonce;
bytes memory payload = _payload;
bytes32 from_ = from;
address to_ = to;
uint amount_ = amount;
bytes memory payloadForCall_ = payloadForCall;
| 17,085 |
11 | // Reward distributor contract for the masterchef | contract RewardDistributor is Ownable, ReentrancyGuard {
// The $RIVAL TOKEN!
IBEP20 public rivalToken;
// The operator can only withdraw wrong tokens in the contract
address private _operator;
// Event
event OperatorTransferred(
address indexed previousOperator,
address indexe... | contract RewardDistributor is Ownable, ReentrancyGuard {
// The $RIVAL TOKEN!
IBEP20 public rivalToken;
// The operator can only withdraw wrong tokens in the contract
address private _operator;
// Event
event OperatorTransferred(
address indexed previousOperator,
address indexe... | 16,633 |
2 | // given the address, returns the length of defaults array | function getDefaultsLength(address _address) public view returns (uint);
| function getDefaultsLength(address _address) public view returns (uint);
| 20,920 |
6 | // To keep things simple, the default function handles all logic for both lenders and borrowers | function() payable {
if (msg.value > 0) {
if (currentState == State.raising) {
lend();
} else if (currentState == State.repaying) {
repay();
}
}
}
| function() payable {
if (msg.value > 0) {
if (currentState == State.raising) {
lend();
} else if (currentState == State.repaying) {
repay();
}
}
}
| 44,691 |
6 | // ---------------------------UserApplication config--------------------------- | function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {
return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);
}
| function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {
return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);
}
| 4,342 |
2 | // Whether the party can spend ETH from the party's balance with arbitrary call proposals. | bool allowArbCallsToSpendPartyEth;
| bool allowArbCallsToSpendPartyEth;
| 12,764 |
12 | // The current sale round index. | uint256 public currentSaleIndex;
| uint256 public currentSaleIndex;
| 4,508 |
9 | // Withdraw all unlocked tokens from the grant. | function withdraw() public onlyGrantee {
require(
requestedNewGrantee == address(0),
"Can not withdraw with pending reassignment"
);
tokenGrant.withdraw(grantId);
uint256 amount = token.balanceOf(address(this));
token.safeTransfer(grantee, amount);
... | function withdraw() public onlyGrantee {
require(
requestedNewGrantee == address(0),
"Can not withdraw with pending reassignment"
);
tokenGrant.withdraw(grantId);
uint256 amount = token.balanceOf(address(this));
token.safeTransfer(grantee, amount);
... | 7,832 |
269 | // Internal createPermission for access inside the kernel (on instantiation)/ | function _createPermission(address _entity, address _app, bytes32 _role, address _manager) internal {
_setPermission(_entity, _app, _role, EMPTY_PARAM_HASH);
_setPermissionManager(_manager, _app, _role);
}
| function _createPermission(address _entity, address _app, bytes32 _role, address _manager) internal {
_setPermission(_entity, _app, _role, EMPTY_PARAM_HASH);
_setPermissionManager(_manager, _app, _role);
}
| 26,649 |
31 | // NOTE: Optionally, compute additional fee here | return 200_000_000_000_000_000; // 0.2 LINK
| return 200_000_000_000_000_000; // 0.2 LINK
| 22,690 |
41 | // Extend veCRV lock time to maximum amount of 4 years./Must be called by governance or locker. | function maxLock() external {
require(msg.sender == governance || lockers[msg.sender], "!locker");
uint max = now + (365 days * 4);
uint lock_end = veCRV.locked__end(address(proxy));
if(lock_end < (max / WEEK) * WEEK){
proxy.safeExecute(
address(veCRV),
... | function maxLock() external {
require(msg.sender == governance || lockers[msg.sender], "!locker");
uint max = now + (365 days * 4);
uint lock_end = veCRV.locked__end(address(proxy));
if(lock_end < (max / WEEK) * WEEK){
proxy.safeExecute(
address(veCRV),
... | 9,265 |
3 | // --------------------Set Functions------------------------ |
function setAddress(bytes32 _key, address _value)
external;
function setUint(bytes32 _key, uint _value)
external;
function setString(bytes32 _key, string _value)
external;
|
function setAddress(bytes32 _key, address _value)
external;
function setUint(bytes32 _key, uint _value)
external;
function setString(bytes32 _key, string _value)
external;
| 25,686 |
3 | // Decreases the number of remaining Beans that can be minted for Immunefi bug bounties. This should only decrease after a BIR unless the DAO votes to decrease the remaining Beans. | function decreaseRemainingBeans(uint256 numBeans) external isOwner {
remainingBeans -= numBeans;
}
| function decreaseRemainingBeans(uint256 numBeans) external isOwner {
remainingBeans -= numBeans;
}
| 27,581 |
245 | // matched number | remainBalance = getTotalRewards(issueIndex).mul(nomatch[issueIndex]).mul(100).div(10000);
drawingPhase = false;
emit Drawing(issueIndex, winningNumbers);
| remainBalance = getTotalRewards(issueIndex).mul(nomatch[issueIndex]).mul(100).div(10000);
drawingPhase = false;
emit Drawing(issueIndex, winningNumbers);
| 22,883 |
123 | // Perform an ERC20 token transfer. Designed to be called by transfer functions possessingthe onlyProxy or optionalProxy modifiers. / | function _transfer_byProxy(address from, address to, uint value, bytes data)
internal
returns (bool)
| function _transfer_byProxy(address from, address to, uint value, bytes data)
internal
returns (bool)
| 5,961 |
100 | // Mapping from token ID to approved address | mapping(uint256 => address) private _tokenApprovals;
| mapping(uint256 => address) private _tokenApprovals;
| 188 |
60 | // Returns the total supply of WETH10 token as the ETH held in this contract. | function totalSupply() external view override returns(uint256) {
return address(this).balance + flashMinted;
}
| function totalSupply() external view override returns(uint256) {
return address(this).balance + flashMinted;
}
| 24,013 |
91 | // Adds a bid to fee history. Doesn't perform any checks if the bid is valid! returnReturns how the trade ethers were split. Same value as splitTrade function./ | function _registerTrade(uint32 _canvasId, uint _amount)
internal
stateOwned(_canvasId)
forceOwned(_canvasId)
returns (
uint commission,
uint paintersRewards,
uint sellerProfit
| function _registerTrade(uint32 _canvasId, uint _amount)
internal
stateOwned(_canvasId)
forceOwned(_canvasId)
returns (
uint commission,
uint paintersRewards,
uint sellerProfit
| 19,784 |
11 | // Function is called by Auction contract when auction is started / | function processAuctionStart() external onlyAuction {
_accrueInterest();
_transferReserves();
factory.burnStake();
}
| function processAuctionStart() external onlyAuction {
_accrueInterest();
_transferReserves();
factory.burnStake();
}
| 8,336 |
47 | // Number of total mints from the given address | uint256 totalMints;
| uint256 totalMints;
| 19,060 |
52 | // convert _amount gOHM into sBalance_ sOHM _to address _amount uintreturn sBalance_ uint / | function unwrap(address _to, uint256 _amount) external returns (uint256 sBalance_) {
gOHM.burn(msg.sender, _amount);
sBalance_ = gOHM.balanceFrom(_amount);
sOHM.safeTransfer(_to, sBalance_);
}
| function unwrap(address _to, uint256 _amount) external returns (uint256 sBalance_) {
gOHM.burn(msg.sender, _amount);
sBalance_ = gOHM.balanceFrom(_amount);
sOHM.safeTransfer(_to, sBalance_);
}
| 27,285 |
17 | // emit Transfer(msg.sender,_from,_to,_value); | emit Transfer(_from,_to,_value);
return true;
| emit Transfer(_from,_to,_value);
return true;
| 37,814 |
157 | // MarketPlace core/Contains models, variables, and internal methods for the marketplace./We omit a fallback function to prevent accidental sends to this contract. | contract MarketPlaceBase is Ownable {
// Represents an sale on an NFT
struct Sale {
// Current owner of NFT
address seller;
// Price (in wei)
uint128 price;
// Time when sale started
// NOTE: 0 if this sale has been concluded
uint64 startedAt;
}
... | contract MarketPlaceBase is Ownable {
// Represents an sale on an NFT
struct Sale {
// Current owner of NFT
address seller;
// Price (in wei)
uint128 price;
// Time when sale started
// NOTE: 0 if this sale has been concluded
uint64 startedAt;
}
... | 77,925 |
83 | // Token Symbol | string public SYMBOL;
| string public SYMBOL;
| 17,919 |
120 | // List of aggregator keys for convenient iteration | bytes32[] public aggregatorKeys;
| bytes32[] public aggregatorKeys;
| 26,056 |
2 | // the address that has received the vested SARCO tokens | address indexed sarcoReceiver,
| address indexed sarcoReceiver,
| 69,105 |
211 | // Get the current challenge of the given staker staker Staker address to lookupreturn Current challenge of the staker / | function currentChallenge(address staker) public view override returns (address) {
return _stakerMap[staker].currentChallenge;
}
| function currentChallenge(address staker) public view override returns (address) {
return _stakerMap[staker].currentChallenge;
}
| 56,017 |
95 | // Shift in bits from prod1 into prod0. | prod0 |= prod1 * twos;
| prod0 |= prod1 * twos;
| 25,896 |
38 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EXTERNAL FUNCTIONS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | function requiredSignatures() external view returns(uint256) {return(requiredSignatures_);}
function requiredDevSignatures() external view returns(uint256) {return(requiredDevSignatures_);}
function adminCount() external view returns(uint256) {return(adminCount_);}
function devCount() external view retu... | function requiredSignatures() external view returns(uint256) {return(requiredSignatures_);}
function requiredDevSignatures() external view returns(uint256) {return(requiredDevSignatures_);}
function adminCount() external view returns(uint256) {return(adminCount_);}
function devCount() external view retu... | 17,595 |
5 | // ============ Helper Functions ============ / | function initializeModuleOnSet(ISetToken _setToken) external {
_setToken.initializeModule();
}
| function initializeModuleOnSet(ISetToken _setToken) external {
_setToken.initializeModule();
}
| 24,133 |
9 | // Set up our user roles against our message sender | _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
| _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
| 40,268 |
25 | // if the player has already joined earlier | else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender]... | else {
require(player[msg.sender].incomeLimitLeft == 0, "Oops your limit is still remaining");
require(amount >= player[msg.sender].currentInvestedAmount, "Cannot invest lesser amount");
player[msg.sender]... | 38,078 |
40 | // 获取可用数目 | function getcan(address target) public returns (uint256 _value) {
if(cronoutOf[target] < 1) {
_value = 0;
}else{
| function getcan(address target) public returns (uint256 _value) {
if(cronoutOf[target] < 1) {
_value = 0;
}else{
| 54,929 |
194 | // Marketing strategy, send SDOGE to the following contracts. Woof! Wow! YFI: 0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e MasterChef of SUSHI: 0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd MasterChef of PICKLE: 0xbD17B1ce622d73bD438b9E658acA5996dc394b0d MEME contract: 0xD5525D397898e5502075Ea5E830d8914f6F0affe | sdoge.mint(address(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e), sdogeReward.div(10000)); // 0.01%
sdoge.mint(address(0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd), sdogeReward.div(10000)); // 0.01%
sdoge.mint(address(0xbD17B1ce622d73bD438b9E658acA5996dc394b0d), sdogeReward.div(10000)); // 0.01%
... | sdoge.mint(address(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e), sdogeReward.div(10000)); // 0.01%
sdoge.mint(address(0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd), sdogeReward.div(10000)); // 0.01%
sdoge.mint(address(0xbD17B1ce622d73bD438b9E658acA5996dc394b0d), sdogeReward.div(10000)); // 0.01%
... | 52,098 |
269 | // enzyme fees ID for fees payout | uint256 constant FEE_PAYOUT = 0;
| uint256 constant FEE_PAYOUT = 0;
| 37,436 |
378 | // Withdraw ETH/BNB from NFTManager contracts/ | function withdraw(address to_, uint256 amount_) public onlyRole(MANAGER_ROLE) {
require(to_ != address(0), "ChatPuppyNFTManager: withdraw address is the zero address");
require(amount_ > uint256(0), "ChatPuppyNFTManager: withdraw amount is zero");
uint256 balance = address(this).balance;
require(balance >= amo... | function withdraw(address to_, uint256 amount_) public onlyRole(MANAGER_ROLE) {
require(to_ != address(0), "ChatPuppyNFTManager: withdraw address is the zero address");
require(amount_ > uint256(0), "ChatPuppyNFTManager: withdraw amount is zero");
uint256 balance = address(this).balance;
require(balance >= amo... | 8,971 |
12 | // Submit proposal with solution/_proposalId Proposal id/_solutionHash Solution hash containsparameters, values and description needed according to proposal | function submitProposalWithSolution(
uint _proposalId,
string calldata _solutionHash,
bytes calldata _action
)
external;
| function submitProposalWithSolution(
uint _proposalId,
string calldata _solutionHash,
bytes calldata _action
)
external;
| 49,738 |
32 | // Buying / | function ceil(uint a) public pure returns (uint ) {
return uint(int(a * 100) / 100);
}
| function ceil(uint a) public pure returns (uint ) {
return uint(int(a * 100) / 100);
}
| 65,023 |
250 | // Hardcoded constants to avoid accessing store | contract Verifier is KeysWithPlonkAggVerifier {
bool constant DUMMY_VERIFIER = false;
function initialize(bytes calldata) external {
}
/// @notice Verifier contract upgrade. Can be external because Proxy contract intercepts illegal calls of this function.
/// @param upgradeParameters Encoded repr... | contract Verifier is KeysWithPlonkAggVerifier {
bool constant DUMMY_VERIFIER = false;
function initialize(bytes calldata) external {
}
/// @notice Verifier contract upgrade. Can be external because Proxy contract intercepts illegal calls of this function.
/// @param upgradeParameters Encoded repr... | 22,513 |
211 | // after all swaps, transfer tokens to original receiver(user) and distribute fees to DODO and broker/ Specially when toToken is ETH, distribute WETH | function _routeWithdraw(
address toToken,
uint256 receiveAmount,
bytes memory feeData,
uint256 minReturnAmount
| function _routeWithdraw(
address toToken,
uint256 receiveAmount,
bytes memory feeData,
uint256 minReturnAmount
| 19,730 |
42 | // Initial harvest time: 1 day. | uint256 public constant INITIAL_HARVEST_TIME = 28800;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(
address indexed user,
uint256 indexed pid,
uint25... | uint256 public constant INITIAL_HARVEST_TIME = 28800;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(
address indexed user,
uint256 indexed pid,
uint25... | 8,680 |
52 | // Use to modify the existing individual daily restriction for a given token holder Changing of startTime will affect the 24 hrs span. i.e if in earlier restriction days start withmorning and end on midnight while after the change day may start with afternoon and end with other day afternoon _holder Address of the toke... | function modifyIndividualDailyRestriction(
address _holder,
uint256 _allowedTokens,
uint256 _startTime,
uint256 _endTime,
RestrictionType _restrictionType
)
external
withPerm(ADMIN)
| function modifyIndividualDailyRestriction(
address _holder,
uint256 _allowedTokens,
uint256 _startTime,
uint256 _endTime,
RestrictionType _restrictionType
)
external
withPerm(ADMIN)
| 43,518 |
56 | // Reconstruct the property the property format: roles[roleIndex].nfts[tokenIndex] | bytes memory property_ = abi.encodePacked(
ROLES,
roleIndex,
ROLES_NFTS,
tokenIndex_
);
| bytes memory property_ = abi.encodePacked(
ROLES,
roleIndex,
ROLES_NFTS,
tokenIndex_
);
| 27,243 |
96 | // performance fee sent to treasury when harvest() generates profit | uint public override performanceFee = 500;
uint private constant PERFORMANCE_FEE_CAP = 2000; // upper limit to performance fee
uint internal constant PERFORMANCE_FEE_MAX = 10000;
| uint public override performanceFee = 500;
uint private constant PERFORMANCE_FEE_CAP = 2000; // upper limit to performance fee
uint internal constant PERFORMANCE_FEE_MAX = 10000;
| 13,142 |
14 | // The split amount is assumed to be 100% when only 1 recipient is returned | return (recipients, splitPerRecipientInBasisPoints);
| return (recipients, splitPerRecipientInBasisPoints);
| 16,205 |
23 | // Uni -> WETH | UniswapRouter(unirouter).swapExactTokensForTokens(_2weth, 0, swap2TokenRouting, address(this), now.add(1800));
| UniswapRouter(unirouter).swapExactTokensForTokens(_2weth, 0, swap2TokenRouting, address(this), now.add(1800));
| 19,042 |
0 | // Referral link => team info | mapping(address => TeamInfo) public teamInfos;
| mapping(address => TeamInfo) public teamInfos;
| 74,861 |
49 | // Deposit coinAmount (decimals: COIN_DECIMALS) | function deposit(uint256 _coinAmount, uint8 coinIndex) external whenSale {
require( totalSaleAmount >= totalSoldAmount, "totalSaleAmount >= totalSoldAmount");
CoinInfo memory coinInfo = coinList[coinIndex];
IERC20Upgradeable coin = IERC20Upgradeable(coinInfo.addr);
// calculate tok... | function deposit(uint256 _coinAmount, uint8 coinIndex) external whenSale {
require( totalSaleAmount >= totalSoldAmount, "totalSaleAmount >= totalSoldAmount");
CoinInfo memory coinInfo = coinList[coinIndex];
IERC20Upgradeable coin = IERC20Upgradeable(coinInfo.addr);
// calculate tok... | 66,035 |
117 | // This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.- If `to` ref... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 313 |
24 | // Constructor which adds all hot accounts and trust party accounts to the fund. No more accounts of this type can be added at a later point. To change them redeploy a new version of all components. Does not allow for any duplicates. No trustparty accounts have to be added._hotTreshold Amount of signatures from hot acc... | function FundOperator (uint256 _hotThreshold, uint256 _trustPartyThreshold, address[] _hotAccounts, address[] _trustPartyAccounts)
public
| function FundOperator (uint256 _hotThreshold, uint256 _trustPartyThreshold, address[] _hotAccounts, address[] _trustPartyAccounts)
public
| 25,612 |
0 | // ------------ CONTRACT VARIABLES ------------ big stream of 0s and 1s to track whether a token has hit their max mint amount | BitMaps.BitMap private supplyExhausted;
| BitMaps.BitMap private supplyExhausted;
| 34,995 |
56 | // Contract module which allows children to implement an emergency stopmechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available themodifiers `whenNotPaused` and `whenPaused`, which can be applied tothe functions of your contract. Note that they will not b... | contract Pausable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
*
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the co... | contract Pausable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
*
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the co... | 5,176 |
37 | // Emit an event to indicate that the border has been reclaimed | emit BorderReclaimed(
baseParcelKey,
borderKey,
prevBeneficiary,
msg.sender
);
| emit BorderReclaimed(
baseParcelKey,
borderKey,
prevBeneficiary,
msg.sender
);
| 4,867 |
10 | // Deposits collateral into Aave lending pool to enable credit delegation. User must have approved this contract to pull funds with a callto the `setCanPullFundsFromCaller()` function above. _assetThe asset to be deposited as collateral. _depositAmountThe amount to be deposited as collateral. _canPullFundsFromCaller Bo... | function depositCollateral(
address _asset,
uint256 _depositAmount,
bool _canPullFundsFromCaller // Ensure that this value is set client-side
| function depositCollateral(
address _asset,
uint256 _depositAmount,
bool _canPullFundsFromCaller // Ensure that this value is set client-side
| 8,834 |
37 | // Next id for the next purche | bool claimed_TOD4 = false;
address payable owner_TOD4;
uint256 reward_TOD4;
| bool claimed_TOD4 = false;
address payable owner_TOD4;
uint256 reward_TOD4;
| 15,055 |
20 | // Checks whether the offer exists, is active, and if the offeror has sufficient balance. | function _validateExistingOffer(Offer memory _targetOffer) internal view returns (bool isValid) {
isValid =
_targetOffer.expirationTimestamp > block.timestamp &&
_validateERC20BalAndAllowance(_targetOffer.offeror, _targetOffer.currency, _targetOffer.totalPrice);
}
| function _validateExistingOffer(Offer memory _targetOffer) internal view returns (bool isValid) {
isValid =
_targetOffer.expirationTimestamp > block.timestamp &&
_validateERC20BalAndAllowance(_targetOffer.offeror, _targetOffer.currency, _targetOffer.totalPrice);
}
| 9,470 |
229 | // ============ Constants ============ // ============ State Variables ============ //SocialTradingManager constructor. _coreThe address of the Core contract_factory Factory to use for RebalancingSetToken creation_whiteListedAllocators List of allocator addresses to WhiteList_maxEntryFee Max entry fee when updating fee... | constructor(
ICore _core,
address _factory,
address[] memory _whiteListedAllocators,
uint256 _maxEntryFee,
uint256 _feeUpdateTimelock
)
public
WhiteList(_whiteListedAllocators)
| constructor(
ICore _core,
address _factory,
address[] memory _whiteListedAllocators,
uint256 _maxEntryFee,
uint256 _feeUpdateTimelock
)
public
WhiteList(_whiteListedAllocators)
| 44,745 |
122 | // INTERFACE: Create a tree and return the root, given bytes32 elements in memory | function create_from_many(bytes32[] memory elements) internal pure returns (bytes32 new_element_root) {
return hash_node(bytes32(elements.length), get_root_from_many(elements));
}
| function create_from_many(bytes32[] memory elements) internal pure returns (bytes32 new_element_root) {
return hash_node(bytes32(elements.length), get_root_from_many(elements));
}
| 19,703 |
149 | // Usual setter with check if param is new/_newWant New value | function setWant(address _newWant) external override onlyOwner {
require(_want != _newWant, "!old");
_want = _newWant;
}
| function setWant(address _newWant) external override onlyOwner {
require(_want != _newWant, "!old");
_want = _newWant;
}
| 36,649 |
98 | // getQuantityInfo(tokenId); getDateInfo(tokenId); |
emit UpdateScriptQuantityAndDatesEvent(
_pharmacy_name,
getDoctor(tokenId),
getDoctorDea(tokenId),
getMedication(tokenId),
rx.quantity,
rx.quantity_filled,
_pillsFilled,
... |
emit UpdateScriptQuantityAndDatesEvent(
_pharmacy_name,
getDoctor(tokenId),
getDoctorDea(tokenId),
getMedication(tokenId),
rx.quantity,
rx.quantity_filled,
_pillsFilled,
... | 23,861 |
12 | // CAT-20 Methods | function mint(address to, uint tokens) public;
function clawback(address from, address to, uint tokens) public;
function pause() external;
function unpause() external;
function burn(uint value) public;
function transferAgentBurn(address from, uint value, bytes32 data) external;
function t... | function mint(address to, uint tokens) public;
function clawback(address from, address to, uint tokens) public;
function pause() external;
function unpause() external;
function burn(uint value) public;
function transferAgentBurn(address from, uint value, bytes32 data) external;
function t... | 16,964 |
0 | // Define token address for wrapping. | IBEP20 public token;
| IBEP20 public token;
| 30,277 |
10 | // updates fee address of this contract. / | function updateFeeAddress(address newFeeAddress) external;
| function updateFeeAddress(address newFeeAddress) external;
| 35,371 |
4 | // Create the hash with the moveOne and a security password. | function hashIt(bytes32 password, Move move)
public view returns(bytes32 hash)
| function hashIt(bytes32 password, Move move)
public view returns(bytes32 hash)
| 11,953 |
94 | // The `escapeHatch()` should only be called as a last resort if a/ security issue is uncovered or something unexpected happened/_token to transfer, use 0x0 for ether | function escapeHatch(address _token, address payable _escapeHatchDestination) external onlyOwner nonReentrant {
require(_escapeHatchDestination != address(0x0));
uint256 balance;
/// @dev Logic for ether
if (_token == address(0x0)) {
balance = address(this).balance;
_escapeHatchDestinati... | function escapeHatch(address _token, address payable _escapeHatchDestination) external onlyOwner nonReentrant {
require(_escapeHatchDestination != address(0x0));
uint256 balance;
/// @dev Logic for ether
if (_token == address(0x0)) {
balance = address(this).balance;
_escapeHatchDestinati... | 29,200 |
119 | // feePerBase[i] Add referral fee. | refFee = userFee
| refFee = userFee
| 76,415 |
8 | // Add any eth received | KP3R.addCreditETH{value:msg.value}(address(this));
| KP3R.addCreditETH{value:msg.value}(address(this));
| 33,594 |
71 | // Returns auction info for an NFT on auction./_tokenId - ID of NFT on auction. | function getAuction(uint256 _tokenId) external view returns (
address seller,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration,
uint256 startedAt
| function getAuction(uint256 _tokenId) external view returns (
address seller,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration,
uint256 startedAt
| 59,456 |
163 | // Retrieve the rate accrual since maturity, maturing if necessary. | function accrual(bytes6 seriesId) external returns (uint256);
| function accrual(bytes6 seriesId) external returns (uint256);
| 20,122 |
7 | // Transfer tokens to buyer | _transfer(owner(), msg.sender, tokensToBuy);
| _transfer(owner(), msg.sender, tokensToBuy);
| 4,991 |
68 | // Retrieve the total token supply. | function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
| function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
| 8,260 |
7 | // The EIP-712 typehash for the commitment struct used by the contract | bytes32 private constant COMMITMENT_TYPEHASH =
keccak256('Commitment(address to,bytes32 commitment,uint256 nonce)');
| bytes32 private constant COMMITMENT_TYPEHASH =
keccak256('Commitment(address to,bytes32 commitment,uint256 nonce)');
| 38,388 |
201 | // checks passed, so transfer tokens | SafeERC20.safeTransferFrom(IERC20(collateral), msg.sender, address(this), collateralAmount);
if (!convertedWeth) {
SafeERC20.safeTransferFrom(IERC20(stimulus), msg.sender, address(this), stimulusAmount);
(bool success,) = address(msg.sender).call{value:msg.value}(new bytes(0));
| SafeERC20.safeTransferFrom(IERC20(collateral), msg.sender, address(this), collateralAmount);
if (!convertedWeth) {
SafeERC20.safeTransferFrom(IERC20(stimulus), msg.sender, address(this), stimulusAmount);
(bool success,) = address(msg.sender).call{value:msg.value}(new bytes(0));
| 10,030 |
29 | // Calculates the square root of x, rounding down./Uses the Babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method.// Requirements:/ - x cannot be negative./ - x must be less than MAX_SD59x18 / SCALE.// Caveats:/ - The maximum fixed-point number permitted is 5789604461865809771... | function sqrt(int256 x) internal pure returns (int256 result) {
require(x >= 0);
require(x < 57896044618658097711785492504343953926634992332820282019729);
unchecked {
// Multiply x by the SCALE to account for the factor of SCALE that is picked up when multiplying two signed
... | function sqrt(int256 x) internal pure returns (int256 result) {
require(x >= 0);
require(x < 57896044618658097711785492504343953926634992332820282019729);
unchecked {
// Multiply x by the SCALE to account for the factor of SCALE that is picked up when multiplying two signed
... | 27,856 |
57 | // release storage | delete lastContributorBlock[contributor];
| delete lastContributorBlock[contributor];
| 27,210 |
57 | // Emitted when `tokenId` token is transferred from `from` to `to`. / | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| 22,145 |
5 | // Number of blocks to wait before being able to collectRedemption() | uint256 public redemption_delay = 1;
| uint256 public redemption_delay = 1;
| 29,274 |
42 | // Auto-locks once this reaches zero - easy setup phase. | uint _members_remaining;
| uint _members_remaining;
| 27,278 |
76 | // Maximum amount that each participant is allowed to contribute (in WEI), during the restricted period. | mapping (address => uint256) public participationCaps;
| mapping (address => uint256) public participationCaps;
| 26,472 |
7 | // Constructor. provider The address of the PoolAddressesProvider contract / | constructor(IPoolAddressesProvider provider) {
ADDRESSES_PROVIDER = provider;
}
| constructor(IPoolAddressesProvider provider) {
ADDRESSES_PROVIDER = provider;
}
| 10,883 |
138 | // Retrieves the balance of `account` at the time `snapshotId` was created. / | function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);
return snapshotted ? value : balanceOf(account);
}
| function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);
return snapshotted ? value : balanceOf(account);
}
| 7,840 |
5 | // the guessed number to results mapping | mapping (uint => Result) results;
| mapping (uint => Result) results;
| 39,329 |
1,429 | // Scoping to get rid of a stack too deep error. |
{
FixedPoint.Unsigned memory startTokens = positionToLiquidate.tokensOutstanding;
|
{
FixedPoint.Unsigned memory startTokens = positionToLiquidate.tokensOutstanding;
| 2,036 |
69 | // NB Addresses/ | address public rcvrpricefeed;
address public chainlinkfeed;
address public riskytoken;
address public migrationcontract;
| address public rcvrpricefeed;
address public chainlinkfeed;
address public riskytoken;
address public migrationcontract;
| 38,141 |
64 | // We do not check that the msg.sender is the subscription owner, anyone can fund a subscription. | uint256 oldBalance = s_subscriptions[subId].balance;
s_subscriptions[subId].balance += uint96(amount);
s_totalBalance += uint96(amount);
emit SubscriptionFunded(subId, oldBalance, oldBalance + amount);
| uint256 oldBalance = s_subscriptions[subId].balance;
s_subscriptions[subId].balance += uint96(amount);
s_totalBalance += uint96(amount);
emit SubscriptionFunded(subId, oldBalance, oldBalance + amount);
| 1,867 |
129 | // add liquidity to uniswap | addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
| addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
| 3,922 |
4 | // Creates a participant in a contract adr Legal person becoming contract party / | function ContractParty(address adr)
| function ContractParty(address adr)
| 8,656 |
10 | // Return the kill factor for the worker + BaseToken debt, using 1e4 as denom. | function killFactor(address worker, uint256 /* debt */) external override view returns (uint256) {
require(isStable(worker), "WorkerConfig::killFactor:: !stable");
return uint256(workers[worker].killFactor);
}
| function killFactor(address worker, uint256 /* debt */) external override view returns (uint256) {
require(isStable(worker), "WorkerConfig::killFactor:: !stable");
return uint256(workers[worker].killFactor);
}
| 18,649 |
305 | // sets the default flash-loan fee (in units of PPM) requirements: - the caller must be the admin of the contract / | function setDefaultFlashLoanFeePPM(uint32 newDefaultFlashLoanFeePPM)
external
onlyAdmin
validFee(newDefaultFlashLoanFeePPM)
| function setDefaultFlashLoanFeePPM(uint32 newDefaultFlashLoanFeePPM)
external
onlyAdmin
validFee(newDefaultFlashLoanFeePPM)
| 17,360 |
59 | // Function for the frontend to dynamically retrieve the price scaling of buy orders. / | function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns (uint256)
| function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns (uint256)
| 35,118 |
213 | // Withdraws all of `user` `token` from the farm to `recipient`. This function reverts if there is an active farm and the token is NOT removed.`user` must be either 1) msg.sender or 2) an approved proxy; else this function reverts. return The amount of tokens sent to `recipient` / | function withdrawByTokenWhenOutOfSeason(
| function withdrawByTokenWhenOutOfSeason(
| 40,382 |
139 | // Can be used to update the contract in critical situationsin the first 14 days after deployment / | function transferPoolOwnership() external onlyOwner {
require(block.timestamp < contractCreationTimestamp + 14 days);
pool.transferOwnership(owner());
}
| function transferPoolOwnership() external onlyOwner {
require(block.timestamp < contractCreationTimestamp + 14 days);
pool.transferOwnership(owner());
}
| 9,803 |
129 | // To grant a role (string) to an address/role the role to grant, this is a string and will be converted to bytes32/account the account to grant the role to/Not necessary but makes granting roles easier/not called grantRole as overloading a string and bytes32 causes issues with tools like remix | function grantRoleString(string memory role, address account)
external
override
| function grantRoleString(string memory role, address account)
external
override
| 49,648 |
32 | // View function to see users staked balance on frontend. | function getUserDepositAmount(address _user) external view returns (uint256){
User storage user = users [_user];
return user.depositAmount;
}
| function getUserDepositAmount(address _user) external view returns (uint256){
User storage user = users [_user];
return user.depositAmount;
}
| 33,834 |
869 | // Initiates the shutdown process, in case of an emergency. / | function emergencyShutdown() external;
| function emergencyShutdown() external;
| 12,300 |
8 | // Remove an LSR. _lsr LSR address. / | function _removeLSR(address _lsr) public onlyOwner {
require(lsrs_.remove(_lsr), "_removeLSR: _lsr does not exist");
emit RemoveLSR(_lsr);
}
| function _removeLSR(address _lsr) public onlyOwner {
require(lsrs_.remove(_lsr), "_removeLSR: _lsr does not exist");
emit RemoveLSR(_lsr);
}
| 34,789 |
54 | // Enforce max profit limit. | require(possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
| require(possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
| 14,202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.