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 |
|---|---|---|---|---|
170 | // Returns the SECP256k1 public key associated with an ENS node.Defined in EIP 619. node The ENS node to queryreturn x, y the X and Y coordinates of the curve point for the public key. / | function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {
return (pubkeys[node].x, pubkeys[node].y);
}
| function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {
return (pubkeys[node].x, pubkeys[node].y);
}
| 5,050 |
28 | // Constant to simplify conversion of token amounts into integer form | uint256 public tokenUnit = uint256(10)**decimals;
| uint256 public tokenUnit = uint256(10)**decimals;
| 13,890 |
44 | // Burn selled tokens. | nftRegistry.burnBondedERC20(
_tokenId,
msgSender(),
_liquidationAmount,
reserveAmount
);
| nftRegistry.burnBondedERC20(
_tokenId,
msgSender(),
_liquidationAmount,
reserveAmount
);
| 49,868 |
45 | // these arrays will have 3 uints, 0 is 3 months, 1 is 6 months, 2 is 12 months | uint256[] public stakingAllocations;
uint256[] public stakingMaxs;
uint256[] public stakingShares;
bool public stakingActive;
IAddressIndex addressIndex;
UniswapInterface routerContract = UniswapInterface(uniswapRouter);
| uint256[] public stakingAllocations;
uint256[] public stakingMaxs;
uint256[] public stakingShares;
bool public stakingActive;
IAddressIndex addressIndex;
UniswapInterface routerContract = UniswapInterface(uniswapRouter);
| 31,483 |
37 | // returns the current debt based on actual block.timestamp (now) | function debt(uint loan) external view returns (uint) {
uint rate_ = loanRates[loan];
uint chi_ = rates[rate_].chi;
if (block.timestamp >= rates[rate_].lastUpdated) {
chi_ = chargeInterest(rates[rate_].chi, rates[rate_].ratePerSecond, rates[rate_].lastUpdated);
}
... | function debt(uint loan) external view returns (uint) {
uint rate_ = loanRates[loan];
uint chi_ = rates[rate_].chi;
if (block.timestamp >= rates[rate_].lastUpdated) {
chi_ = chargeInterest(rates[rate_].chi, rates[rate_].ratePerSecond, rates[rate_].lastUpdated);
}
... | 31,091 |
152 | // The amount (priced in want) of the total assets managed by this strategy should not count towards Yearn's TVL calculations. You can override this field to set it to a non-zero value if some of the assets of this Strategy is somehow delegated inside another part of of Yearn's ecosystem e.g. another Vault. Note that t... | function delegatedAssets() external override view returns (uint256) {
return 0;
}
| function delegatedAssets() external override view returns (uint256) {
return 0;
}
| 37,577 |
107 | // register itself in a lookup table | _registerInterface(InterfaceId_ERC165);
| _registerInterface(InterfaceId_ERC165);
| 32,299 |
59 | // We won't do any pre or post processing, so leave _preRelayedCall and _postRelayedCall empty | // function _preRelayedCall(bytes memory context) internal override returns (bytes32) {
// }
| // function _preRelayedCall(bytes memory context) internal override returns (bytes32) {
// }
| 28,536 |
167 | // total tokenIds | uint256 public totalTokens;
| uint256 public totalTokens;
| 67,763 |
486 | // Deposits waTokens into the transmuter// amount the amount of waTokens to stake | function stake(uint256 amount)
public
runPhasedDistribution()
updateAccount(msg.sender)
checkIfNewUser()
| function stake(uint256 amount)
public
runPhasedDistribution()
updateAccount(msg.sender)
checkIfNewUser()
| 22,943 |
111 | // max reward block | uint256 public maxRewardBlockNumber;
| uint256 public maxRewardBlockNumber;
| 11,543 |
112 | // Block withdrawals within 1 hour of depositing. | modifier onceAnHour {
require(block.timestamp >= balances[msg.sender].lastTime.add(1 hours), "You must wait an hour after your last update to withdraw.");
_;
}
| modifier onceAnHour {
require(block.timestamp >= balances[msg.sender].lastTime.add(1 hours), "You must wait an hour after your last update to withdraw.");
_;
}
| 80,919 |
1 | // ensure that at least one full period has passed since the last update | require(timeElapsed >= PERIOD, 'ExampleOracleSimple: PERIOD_NOT_ELAPSED');
| require(timeElapsed >= PERIOD, 'ExampleOracleSimple: PERIOD_NOT_ELAPSED');
| 2,338 |
1 | // The first word of a string is its length | length := mload(message)
| length := mload(message)
| 16,979 |
19 | // Set token URI / | function setTokenURI(uint256 tokenId, string memory newURI) external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
if (tokenId == 0) revert InvalidTokenId();
tokenMap[tokenId].URI = newURI;
}
| function setTokenURI(uint256 tokenId, string memory newURI) external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
if (tokenId == 0) revert InvalidTokenId();
tokenMap[tokenId].URI = newURI;
}
| 11,490 |
7 | // Return the wei owed on a payment at the current block timestamp. / | function paymentWeiOwed(uint256 index) public view returns (uint256) {
requirePaymentIndexInRange(index);
Payment memory payment = payments[index];
// Calculate owed wei based on current time and total wei owed/paid
return max(payment.weiPaid, payment.weiValue * min(block.timestamp - payment.timestamp... | function paymentWeiOwed(uint256 index) public view returns (uint256) {
requirePaymentIndexInRange(index);
Payment memory payment = payments[index];
// Calculate owed wei based on current time and total wei owed/paid
return max(payment.weiPaid, payment.weiValue * min(block.timestamp - payment.timestamp... | 38,960 |
303 | // require(false, "HELLO: HOW ARE YOU TODAY!"); |
liquidity = IUniswapV2Pair(pair).mint(to); // << PROBLEM IS HERE
|
liquidity = IUniswapV2Pair(pair).mint(to); // << PROBLEM IS HERE
| 38,450 |
71 | // Returns the link to artificat location for a given token by 'tokenId'.Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query.return The location where the artifact assets are stored. / | function tokenURI(uint256 tokenId) external view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory tokenIdStr = Strings.toString(tokenId);
return string(abi.encodePacked(_baseURI, tokenIdStr));
}
| function tokenURI(uint256 tokenId) external view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory tokenIdStr = Strings.toString(tokenId);
return string(abi.encodePacked(_baseURI, tokenIdStr));
}
| 15,966 |
7 | // Creates an upgradeable proxy version representing the first version to be set for the proxyreturn address of the new proxy created / | function createProxy(uint256 version, address _owner)
external
onlyOwner
returns (address)
| function createProxy(uint256 version, address _owner)
external
onlyOwner
returns (address)
| 13,512 |
103 | // We need to swap the current tokens to AVAX and send to the team wallet | swapTokensForAvax(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendAVAXToTeam(address(this).balance);
}
| swapTokensForAvax(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendAVAXToTeam(address(this).balance);
}
| 29,134 |
166 | // Throws if the sender is not the SetToken methodologist / | modifier onlyMethodologist() {
require(msg.sender == manager.methodologist(), "Must be methodologist");
_;
}
| modifier onlyMethodologist() {
require(msg.sender == manager.methodologist(), "Must be methodologist");
_;
}
| 29,387 |
62 | // Check valid params and number of choices: | require(parameters[_paramsHash].precReq > 0);
require(_numOfChoices > 0 && _numOfChoices <= MAX_NUM_OF_CHOICES);
| require(parameters[_paramsHash].precReq > 0);
require(_numOfChoices > 0 && _numOfChoices <= MAX_NUM_OF_CHOICES);
| 2,689 |
47 | // profits - liquidationFee gets paid out | int256 reducedProfit = user.profit - liquidationFee;
| int256 reducedProfit = user.profit - liquidationFee;
| 4,881 |
30 | // make sure we (the message sender) haven't confirmed this operation previously. | if (pending.membersDone & memberIndexBit == 0) {
Confirmation(msg.sender, _operation);
| if (pending.membersDone & memberIndexBit == 0) {
Confirmation(msg.sender, _operation);
| 20,121 |
114 | // tokenId id of the token/indices query indices for TokenDescriptor | function setTokenIndices(uint256 tokenId, uint256[2] memory indices)
public
override
onlyUpdateAdmin
| function setTokenIndices(uint256 tokenId, uint256[2] memory indices)
public
override
onlyUpdateAdmin
| 60,111 |
92 | // User can request to convert their tokens from older AugmintToken versions in 1:1/ | function transferNotification(address from, uint amount, uint /* data, not used */ ) external {
AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);
require(acceptedLegacyAugmintTokens[legacyToken], "msg.sender must be allowed in acceptedLegacyAugmintTokens");
legacyToken.... | function transferNotification(address from, uint amount, uint /* data, not used */ ) external {
AugmintTokenInterface legacyToken = AugmintTokenInterface(msg.sender);
require(acceptedLegacyAugmintTokens[legacyToken], "msg.sender must be allowed in acceptedLegacyAugmintTokens");
legacyToken.... | 49,195 |
171 | // Returns the number of key-value pairs in the map. O(1). / | function _length(Map storage map) private view returns (uint256) {
return map._entries.length;
}
| function _length(Map storage map) private view returns (uint256) {
return map._entries.length;
}
| 196 |
80 | // Redeem as much collateral as possible from _borrower's Trove in exchange for LUSD up to _maxLUSDamount | function _redeemCollateralFromTrove(
ContractsCache memory _contractsCache,
address _borrower,
uint _maxLUSDamount,
uint _price,
address _upperPartialRedemptionHint,
address _lowerPartialRedemptionHint,
uint _partialRedemptionHintNICR
)
internal re... | function _redeemCollateralFromTrove(
ContractsCache memory _contractsCache,
address _borrower,
uint _maxLUSDamount,
uint _price,
address _upperPartialRedemptionHint,
address _lowerPartialRedemptionHint,
uint _partialRedemptionHintNICR
)
internal re... | 9,121 |
37 | // function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data) private returns (bool) {
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
| function transferToAddress(address _to, uint _value, bytes _data) private returns (bool) {
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
| 49,344 |
101 | // Return the optimal rate and the strategy ID. | function optimizeSwap(
address _from,
address _to,
uint256 _amount
) external returns (address strategy, uint256 amount);
| function optimizeSwap(
address _from,
address _to,
uint256 _amount
) external returns (address strategy, uint256 amount);
| 48,770 |
5 | // This function sets the lifetime maximum deposit for a given asset/asset_source Contract address for given ERC20 token/lifetime_limit Deposit limit for a given ethereum address/nonce Vega-assigned single-use number that provides replay attack protection/signatures Vega-supplied signature bundle of a validator-signed ... | function set_lifetime_deposit_max(address asset_source, uint256 lifetime_limit, uint256 nonce, bytes calldata signatures) public virtual;
| function set_lifetime_deposit_max(address asset_source, uint256 lifetime_limit, uint256 nonce, bytes calldata signatures) public virtual;
| 3,769 |
4,718 | // 2361 | entry "uninquisitively" : ENG_ADVERB
| entry "uninquisitively" : ENG_ADVERB
| 23,197 |
91 | // initialize variables | minReportDelay = 0;
maxReportDelay = 86400;
profitFactor = 100;
debtThreshold = 0;
vault.approve(rewards, uint256(-1)); // Allow rewards to be pulled
| minReportDelay = 0;
maxReportDelay = 86400;
profitFactor = 100;
debtThreshold = 0;
vault.approve(rewards, uint256(-1)); // Allow rewards to be pulled
| 1,426 |
252 | // Update reward amount before addliquidity | if (addAmount != 0) {
balanceData.rewardAmount = _calcNextReward(balanceData, term);
balanceData.term = uint64(term);
balanceData.balance = balanceData.balance = uint256(balanceData.balance)
.add(uint256(addAmount))
.toUint128();
}
| if (addAmount != 0) {
balanceData.rewardAmount = _calcNextReward(balanceData, term);
balanceData.term = uint64(term);
balanceData.balance = balanceData.balance = uint256(balanceData.balance)
.add(uint256(addAmount))
.toUint128();
}
| 10,148 |
51 | // Return Manager Module address from the Nexusreturn Address of the Manager Module contract / | function _manager() internal view returns (address) {
return nexus.getModule(KEY_MANAGER);
}
| function _manager() internal view returns (address) {
return nexus.getModule(KEY_MANAGER);
}
| 23,245 |
50 | // checks if a token is a Wizards tokenId the ID of the token to checkreturn wizard - whether or not a token is a Wizards / | function isLlama(uint256 tokenId)
external
view
override
returns (bool)
| function isLlama(uint256 tokenId)
external
view
override
returns (bool)
| 81,969 |
156 | // Owner able to mint independent of contract state | function mintForOwner(uint256 _mintAmount) public onlyOwner {
require(_mintAmount > 0,"Need to mint 1 at least");
require(_mintAmount <= maxMintAmount);
require(supply.current() + _mintAmount <= maxSupply, "MaxSupply exceeded");
_mintLoop(msg.sender, _mintAmount);
}
| function mintForOwner(uint256 _mintAmount) public onlyOwner {
require(_mintAmount > 0,"Need to mint 1 at least");
require(_mintAmount <= maxMintAmount);
require(supply.current() + _mintAmount <= maxSupply, "MaxSupply exceeded");
_mintLoop(msg.sender, _mintAmount);
}
| 81,604 |
21 | // Move an existing element into the vacated key slot. | self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex;
self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1];
| self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex;
self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1];
| 3,610 |
132 | // Replacing pool token with existing piToken. _underlyingToken Token, which will be wrapped by piToken. _piToken Address of piToken. / | function replacePoolTokenWithExistingPiToken(address _underlyingToken, WrappedPiErc20Interface _piToken)
external
payable
onlyOwner
| function replacePoolTokenWithExistingPiToken(address _underlyingToken, WrappedPiErc20Interface _piToken)
external
payable
onlyOwner
| 10,293 |
1 | // Get total number of tokens in circulation. return total number of tokens in circulation / | function totalSupply () public view returns (uint256 supply);
| function totalSupply () public view returns (uint256 supply);
| 24,776 |
11 | // ,-.`-'/|\ |,----------------.,----------./ \ |ZoraNFTCreatorV1||ERC721Drop|Caller`-------+--------'`----+-----'| createDrop() || --------------------------------------------------------->| ||| |----.| || initialize NFT metadata| |<---'| ||| | deploy || | --------------------------->| ||| | initialize drop|| | ------... | function createDrop(
string memory name,
string memory symbol,
address defaultAdmin,
uint64 editionSize,
uint16 royaltyBPS,
address payable fundsRecipient,
IERC721Drop.ERC20SalesConfiguration memory saleConfig,
string memory metadataURIBase,
st... | function createDrop(
string memory name,
string memory symbol,
address defaultAdmin,
uint64 editionSize,
uint16 royaltyBPS,
address payable fundsRecipient,
IERC721Drop.ERC20SalesConfiguration memory saleConfig,
string memory metadataURIBase,
st... | 32,217 |
132 | // Wake up the avatar: can be modified/_tokenId The avatar id |
function wakeUp(
uint256 _tokenId
)
external
|
function wakeUp(
uint256 _tokenId
)
external
| 6,028 |
7 | // helper methods for interacting with BEP20 tokens and sending ETH that do not consistently return true/false | library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(suc... | library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(suc... | 3,850 |
52 | // return the accumulated fees/ | function getFees() constant public returns(uint) {
uint reserved = 0;
for (uint16 j = 0; j < numCharacters; j++)
reserved += characters[ids[j]].value;
return address(this).balance - reserved;
}
| function getFees() constant public returns(uint) {
uint reserved = 0;
for (uint16 j = 0; j < numCharacters; j++)
reserved += characters[ids[j]].value;
return address(this).balance - reserved;
}
| 49,544 |
13 | // Set Commission Rate / | {
Settings storage s = getSettings();
if (_permanent) s.perma_commission_rate = _msg;
else s.common_commission_rate = _msg;
}
| {
Settings storage s = getSettings();
if (_permanent) s.perma_commission_rate = _msg;
else s.common_commission_rate = _msg;
}
| 6,597 |
143 | // wrap given element in array of length 1 element element to wrapreturn singleton array / | function _asSingletonArray (
uint element
| function _asSingletonArray (
uint element
| 61,552 |
92 | // An event emitted when setting the fee amount for a token | event FeeSet(address token_, uint256 oldFee_, uint256 newFee_);
| event FeeSet(address token_, uint256 oldFee_, uint256 newFee_);
| 19,672 |
73 | // Returns the Wallet contract address associated to a user account. If the user account is not known, try tomigrate the wallet address from the old exchange instance. This function is equivalent to getWallet(), in additionit stores the wallet address fetched from old the exchange instance. userAccount The user account... | function retrieveWallet(address userAccount)
public
returns(address walletAddress)
{
walletAddress = userAccountToWallet_[userAccount];
if (walletAddress == address(0) && previousExchangeAddress_ != 0) {
| function retrieveWallet(address userAccount)
public
returns(address walletAddress)
{
walletAddress = userAccountToWallet_[userAccount];
if (walletAddress == address(0) && previousExchangeAddress_ != 0) {
| 41,705 |
111 | // Approve or remove 'operator' as an operator for the caller.Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The 'operator' cannot be the caller. Emits an {ApprovalForAll} event. / | function setApprovalForAll(address operator, bool _approved) external;
| function setApprovalForAll(address operator, bool _approved) external;
| 26,173 |
16 | // Remove our whole balance | daiJoin.exit(address(this), bal / RAY);
| daiJoin.exit(address(this), bal / RAY);
| 4,269 |
55 | // creates a new edgeless casino contract.predecessorAddress the address of the predecessing contract tokenContractthe address of the Edgeless token contractdepositLimit the maximum deposit allowedkGasPricethe price per kGas in WEI/ | function EdgelessCasino(address predecessorAddress, address tokenContract, uint depositLimit, uint kGasPrice) CasinoBank(depositLimit, predecessorAddress) mortal(tokenContract) chargingGas(kGasPrice) public{
}
| function EdgelessCasino(address predecessorAddress, address tokenContract, uint depositLimit, uint kGasPrice) CasinoBank(depositLimit, predecessorAddress) mortal(tokenContract) chargingGas(kGasPrice) public{
}
| 54,483 |
129 | // Should be executed after grand prize is received | uint256 mediumPrize = mediumPrizeTotal;
uint256 eligibleHolderCount = 100;
uint256 totalDisbursed = 0;
uint256 seed = 48;
address[] memory eligibleAddresses = new address[](100);
uint8 counter = 0;
| uint256 mediumPrize = mediumPrizeTotal;
uint256 eligibleHolderCount = 100;
uint256 totalDisbursed = 0;
uint256 seed = 48;
address[] memory eligibleAddresses = new address[](100);
uint8 counter = 0;
| 32,717 |
29 | // ERC20 tokenImplementation of the basic standard token. / | contract Likoin is SimpleToken{
// the token being converted to
Buck private _buck;
// How many bucks a buyer gets per token.
uint256 private _conversionRate;
// Balances
mapping (address => uint256[2]) _balances;
// Allowances mapping, used to allow an address to spend another address tokens
mappi... | contract Likoin is SimpleToken{
// the token being converted to
Buck private _buck;
// How many bucks a buyer gets per token.
uint256 private _conversionRate;
// Balances
mapping (address => uint256[2]) _balances;
// Allowances mapping, used to allow an address to spend another address tokens
mappi... | 5,722 |
232 | // This also deletes the contents at the last position of the array | delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
| delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
| 7,944 |
89 | // Getter functions | function gauge_types(address) external view returns (int128);
function gauge_relative_weight(address) external view returns (uint256);
function gauge_relative_weight(address, uint256) external view returns (uint256);
function get_gauge_weight(address) external view returns (uint256);
function get_ty... | function gauge_types(address) external view returns (int128);
function gauge_relative_weight(address) external view returns (uint256);
function gauge_relative_weight(address, uint256) external view returns (uint256);
function get_gauge_weight(address) external view returns (uint256);
function get_ty... | 18,500 |
30 | // TTC token contract. Implements / | contract TTC is StandardToken, Ownable {
string public constant name = "TTC";
string public constant symbol = "TTC";
uint public constant decimals = 18;
// Constructor
function TTC() public {
totalSupply = 1000000000000000000000000000;
balances[msg.sender] = totalSupply; // Send all tokens to ow... | contract TTC is StandardToken, Ownable {
string public constant name = "TTC";
string public constant symbol = "TTC";
uint public constant decimals = 18;
// Constructor
function TTC() public {
totalSupply = 1000000000000000000000000000;
balances[msg.sender] = totalSupply; // Send all tokens to ow... | 14,480 |
64 | // |
swapping = false;
|
swapping = false;
| 25,368 |
193 | // add the buffer to the current variable rate | return variableRate.add(maxBuffer);
| return variableRate.add(maxBuffer);
| 60,971 |
57 | // Totals for all members | RewardTotals private _rewardTotals;
| RewardTotals private _rewardTotals;
| 47,798 |
16 | // constructor / | constructor() public {
owners[msg.sender] = true;
}
| constructor() public {
owners[msg.sender] = true;
}
| 28,761 |
9 | // The reward tokens. | address[] public rewardTokens;
| address[] public rewardTokens;
| 34,521 |
79 | // Get the underlying price of a cToken Implements the PriceOracle interface for Compound v2. cToken The cToken address for price retrievalreturn Price denominated in USD, with 18 decimals, for the given cToken address / | function getUnderlyingPrice(address cToken) external view returns (uint) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e(36 - baseUnit)
// Since the prices in this view have 6 decimals, we must scale them by 1e(36 -... | function getUnderlyingPrice(address cToken) external view returns (uint) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e(36 - baseUnit)
// Since the prices in this view have 6 decimals, we must scale them by 1e(36 -... | 62,670 |
367 | // This emits when the approved address for an NFT is changed or/reaffirmed. The zero address indicates there is no approved address./When a Transfer event emits, this also indicates that the approved/address for that NFT (if any) is reset to none. | event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
| event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
| 54,878 |
19 | // max and min token buy limit per account | uint256 public minEthLimit = 100 finney;
uint256 public maxEthLimit = 3 ether;
mapping(address => uint256) public usersInvestments;
| uint256 public minEthLimit = 100 finney;
uint256 public maxEthLimit = 3 ether;
mapping(address => uint256) public usersInvestments;
| 3,981 |
2 | // admin events // user events // data types / | struct HypervisorData {
address stakingToken;
address rewardToken;
address rewardPool;
RewardScaling rewardScaling;
uint256 rewardSharesOutstanding;
uint256 totalStake;
uint256 totalStakeUnits;
uint256 lastUpdate;
RewardSchedule[] rewardSchedul... | struct HypervisorData {
address stakingToken;
address rewardToken;
address rewardPool;
RewardScaling rewardScaling;
uint256 rewardSharesOutstanding;
uint256 totalStake;
uint256 totalStakeUnits;
uint256 lastUpdate;
RewardSchedule[] rewardSchedul... | 11,549 |
7 | // Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio/Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may/ ever return./sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96/ return tick The greatest tick for which the ratio is l... | function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
// second inequality must be < because the price can never reach the price at the max tick
require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
uint256 ratio = uint256(sqrtPriceX9... | function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
// second inequality must be < because the price can never reach the price at the max tick
require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
uint256 ratio = uint256(sqrtPriceX9... | 24,553 |
248 | // Ensure that the action type is a valid custom action type. | bool validActionType = (
action == ActionType.Cancel ||
action == ActionType.SetUserSigningKey ||
action == ActionType.DAIWithdrawal ||
action == ActionType.USDCWithdrawal ||
action == ActionType.ETHWithdrawal ||
action == ActionType.SetEscapeHatch ||
action == ActionType.R... | bool validActionType = (
action == ActionType.Cancel ||
action == ActionType.SetUserSigningKey ||
action == ActionType.DAIWithdrawal ||
action == ActionType.USDCWithdrawal ||
action == ActionType.ETHWithdrawal ||
action == ActionType.SetEscapeHatch ||
action == ActionType.R... | 16,828 |
99 | // Kyber Proxy contract to trade tokens/ETH to tokenToBurn | IKyberNetworkProxyInterface public kyberProxy;
| IKyberNetworkProxyInterface public kyberProxy;
| 39,977 |
20 | // Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. / | function transferFrom(
| function transferFrom(
| 159 |
47 | // See {BEP20-balanceOf}. / | function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
| 4,251 |
39 | // Get VIP rank of a given owner.VIP ranking is valid for the lifetime of a token wallet address, as long as it meets VIP holding level._to participant address to get the vip rankreturn vip rank of the owner of given address / | function getVIPRank(address _to) constant public returns (uint256 rank) {
if (balances[_to] < VIP_MINIMUM) {
return 0;
}
return viprank[_to];
}
| function getVIPRank(address _to) constant public returns (uint256 rank) {
if (balances[_to] < VIP_MINIMUM) {
return 0;
}
return viprank[_to];
}
| 25,392 |
67 | // Change threshold if threshold was changed. | if (threshold != _threshold)
changeThreshold(_threshold);
| if (threshold != _threshold)
changeThreshold(_threshold);
| 6,675 |
1 | // Total Items. I am not sure why this variable is being used, seems like a waste of gas. | uint256 public constant totalItems = 11;
| uint256 public constant totalItems = 11;
| 33,347 |
7 | // Fee paid to feeRecipient by taker when order is filled. | uint256 takerFee;
| uint256 takerFee;
| 27,049 |
251 | // return if transfer is enabled or not. / | function transferEnabled() public view returns (bool) {
return _transferEnabled;
}
| function transferEnabled() public view returns (bool) {
return _transferEnabled;
}
| 11,910 |
181 | // This also ensures that _strategy must be a valid strategy contract. | require(address(token) == IStrategy(_strategy).want(), "different token");
| require(address(token) == IStrategy(_strategy).want(), "different token");
| 45,319 |
24 | // set contract address as Approved minter set active state to false log and emit current time | function setApprovedMinter(address minter, bool allowed) public onlyOwner {
allowedMinters[minter] = allowed;
enableRaffle();
startTime = block.timestamp;
emit Rafflestarted(minter, startTime);
}
| function setApprovedMinter(address minter, bool allowed) public onlyOwner {
allowedMinters[minter] = allowed;
enableRaffle();
startTime = block.timestamp;
emit Rafflestarted(minter, startTime);
}
| 5,752 |
7 | // The EIP-712 typehash for the delegation struct used by the contract | bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| 3,348 |
55 | // Calculate profit for correct staker | profit = potRemaining.mul(s.stakes[j].amount) / winningPot;
| profit = potRemaining.mul(s.stakes[j].amount) / winningPot;
| 18,997 |
59 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a static call. _Available since v3.3._/ | function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| 35,875 |
80 | // Payout recipient | (bool successFunds, ) = config.fundsRecipient.call{
value: funds,
gas: FUNDS_SEND_GAS_LIMIT
}("");
| (bool successFunds, ) = config.fundsRecipient.call{
value: funds,
gas: FUNDS_SEND_GAS_LIMIT
}("");
| 10,216 |
145 | // snap spin quad | return _animateTransform(
"rotate", duration, "0;90;90;180;180;270;270;360;360", "0;.125;.25;.375;.5;.625;.8;.925;1",
generateSplines(8,0), attr
);
| return _animateTransform(
"rotate", duration, "0;90;90;180;180;270;270;360;360", "0;.125;.25;.375;.5;.625;.8;.925;1",
generateSplines(8,0), attr
);
| 23,793 |
11 | // similar to take(), but with the block height joined to calculate return./for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interest./ return amount of interest and the block height. | function takeWithBlock() external view returns (uint, uint);
| function takeWithBlock() external view returns (uint, uint);
| 31,023 |
27 | // user action | function UpgradeLevelRobot() public whenNotPaused isHeroNFTJoinGame isNotUpgradeRobot
| function UpgradeLevelRobot() public whenNotPaused isHeroNFTJoinGame isNotUpgradeRobot
| 20,297 |
2 | // Begin: Trove // Deposit native ETH and borrow LUSD Opens a Trove by depositing ETH and borrowing LUSD depositAmount The amount of ETH to deposit maxFeePercentage The maximum borrow fee that this transaction should permitborrowAmount The amount of LUSD to borrow upperHint Address of the Trove near the upper bound of ... | function open(
uint depositAmount,
uint maxFeePercentage,
uint borrowAmount,
address upperHint,
address lowerHint,
uint[] memory getIds,
uint[] memory setIds
) external payable returns (string memory _eventName, bytes memory _eventParam) {
| function open(
uint depositAmount,
uint maxFeePercentage,
uint borrowAmount,
address upperHint,
address lowerHint,
uint[] memory getIds,
uint[] memory setIds
) external payable returns (string memory _eventName, bytes memory _eventParam) {
| 34,035 |
214 | // Get an address for a name. / | function getAddress(string memory name) external view returns (address);
| function getAddress(string memory name) external view returns (address);
| 40,506 |
50 | // compute actual token amount and actual pool | if (_poolType == 6 && ((_encoding >> 169) & 1) == 1) {
address _token = ICurveYPoolDeposit(_pool).coins(int128(_indexIn));
address _underlying = ICurveYPoolDeposit(_pool).underlying_coins(int128(_indexIn));
if (_token != _underlying) {
assembly {
| if (_poolType == 6 && ((_encoding >> 169) & 1) == 1) {
address _token = ICurveYPoolDeposit(_pool).coins(int128(_indexIn));
address _underlying = ICurveYPoolDeposit(_pool).underlying_coins(int128(_indexIn));
if (_token != _underlying) {
assembly {
| 26,339 |
12 | // Emitted when the address of the treasury account is set treasuryAddress The address of the treasury account / | event SetTreasuryAddress(address indexed treasuryAddress);
| event SetTreasuryAddress(address indexed treasuryAddress);
| 29,988 |
5 | // only allow the owner to authorize more accounts / | function authorize(address account, bool value) external override onlyOwner {
_authorize(account, value);
}
| function authorize(address account, bool value) external override onlyOwner {
_authorize(account, value);
}
| 3,710 |
33 | // If total duration of Vesting already crossed, return pending tokens to claimed | if (totalMonthsElapsed > vestData.vestingDuration) {
uint256 _totalTokensClaimed =
totalTokensClaimed(_userAddresses, _vestingIndex);
actualClaimableAmount = vestData.totalTokensAllocated.sub(
_totalTokensClaimed
);
| if (totalMonthsElapsed > vestData.vestingDuration) {
uint256 _totalTokensClaimed =
totalTokensClaimed(_userAddresses, _vestingIndex);
actualClaimableAmount = vestData.totalTokensAllocated.sub(
_totalTokensClaimed
);
| 77,649 |
146 | // Yearn Base Strategy yearn.finance BaseStrategy implements all of the required functionality to interoperate closely with the Vault contract. This contract should be inherited and the abstract methods implemented to adapt the Strategy to the particular needs it has to create a return.Of special interest is the relati... | abstract contract BaseStrategy {
using SafeMath for uint256;
using SafeERC20 for IERC20;
string public metadataURI;
/**
* @notice
* Used to track which version of `StrategyAPI` this Strategy
* implements.
* @dev The Strategy's version must match the Vault's `API_VERSION`.
* @... | abstract contract BaseStrategy {
using SafeMath for uint256;
using SafeERC20 for IERC20;
string public metadataURI;
/**
* @notice
* Used to track which version of `StrategyAPI` this Strategy
* implements.
* @dev The Strategy's version must match the Vault's `API_VERSION`.
* @... | 8,015 |
2 | // Fonction permettant de calculer le montant obtenu en sortie du swap pour une position donnee. / | function getAmountOut(
| function getAmountOut(
| 11,261 |
135 | // Internal method that preforms a buy on 0x/on-chain/Useful for other DFS contract to integrate for exchanging/exData Exchange data struct/ return (address, uint) Address of the wrapper used and srcAmount | function _buy(ExchangeData memory exData) internal returns (address, uint256) {
require(exData.destAmount != 0, ERR_DEST_AMOUNT_MISSING);
uint256 amountWithoutFee = exData.srcAmount;
address wrapper = exData.offchainData.wrapper;
bool offChainSwapSuccess;
uint256 destBalanc... | function _buy(ExchangeData memory exData) internal returns (address, uint256) {
require(exData.destAmount != 0, ERR_DEST_AMOUNT_MISSING);
uint256 amountWithoutFee = exData.srcAmount;
address wrapper = exData.offchainData.wrapper;
bool offChainSwapSuccess;
uint256 destBalanc... | 68,287 |
158 | // Wrapper around a call to the ERC20 function `transferFrom` that/ reverts also when the token returns `false`. | function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
| function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
| 35,601 |
18 | // Using an explicit getter allows for function overloading | function totalSupply()
public
constant
returns (uint)
| function totalSupply()
public
constant
returns (uint)
| 45,250 |
107 | // treasury address | address public treasuryAddress;
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,
uint256 amount
);
cons... | address public treasuryAddress;
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,
uint256 amount
);
cons... | 19,068 |
24 | // A temporary reserve variable used for calculating the reward the holder gets for buying tokens. (Yes, the buyer receives a part of the distribution as well!) | var res = reserve() - balance;
| var res = reserve() - balance;
| 44,603 |
18 | // 30 - 39 -> glow 10% | if (((100 - index) > 60) && ((100 - index) <= 70)) {
return "glow";
}
| if (((100 - index) > 60) && ((100 - index) <= 70)) {
return "glow";
}
| 27,702 |
25 | // invest only when ico is running | icoState = getCurrentState();
require(icoState == State.running);
require(msg.value >= minInvestment && msg.value <= maxInvestment);
uint tokens = msg.value / tokenPrice;
| icoState = getCurrentState();
require(icoState == State.running);
require(msg.value >= minInvestment && msg.value <= maxInvestment);
uint tokens = msg.value / tokenPrice;
| 31,356 |
80 | // price for 1 token in Wei | uint public price;
| uint public price;
| 22,344 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.