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 |
|---|---|---|---|---|
134 | // address UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; uniswapRouter = IUniswapV2Router02(UNISWAP_ROUTER_ADDRESS); |
return uniswapRouter.getAmountsIn(_amount, getPathForDaitoSHIB());
|
return uniswapRouter.getAmountsIn(_amount, getPathForDaitoSHIB());
| 4,026 |
19 | // Update the end of contract obligation (user and Total)/This obligation determines the number of tokens claimable by owner at end of contract/_address The address to update | function _updateFixedObligation(address _address) private {
// Use the entire rewardlifetime if rewards have not yet started
uint128 newMaxObligation;
uint128 effectiveTime;
if (rewardStartTime == 0) {
effectiveTime = 0;
} else if (
uint128(block.time... | function _updateFixedObligation(address _address) private {
// Use the entire rewardlifetime if rewards have not yet started
uint128 newMaxObligation;
uint128 effectiveTime;
if (rewardStartTime == 0) {
effectiveTime = 0;
} else if (
uint128(block.time... | 6,348 |
4 | // Emitted when a collateral factor is changed by admin | event NewCollateralFactor(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
| event NewCollateralFactor(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
| 11,825 |
0 | // Initialized flag - indicates that initialization was made once | bool internal initialized;
| bool internal initialized;
| 46,379 |
8 | // require(name != "", "name can't be empty"); | _name = name;
| _name = name;
| 15,780 |
67 | // `transfer`. {sendValue} removes this limitation.IMPORTANT: because control is transferred to `recipient`, care must betaken to not create reentrancy vulnerabilities. Consider using{ReentrancyGuard} or the / | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
| function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
| 128 |
212 | // MasterChef is the master of Hpt. He can make Hpt and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once HPT is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it's b... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 sushiRewardDebt;
}
... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 sushiRewardDebt;
}
... | 23,362 |
69 | // assume 360 ethereum blocks per hourwe want miners to spend 10 minutes to mine each 'block', about 60 ethereum blocks = one BitcoinSoV epoch | uint epochsMined = _BLOCKS_PER_READJUSTMENT; //256
uint targetEthBlocksPerDiffPeriod = epochsMined * 60; //should be 60 times slower than ethereum
| uint epochsMined = _BLOCKS_PER_READJUSTMENT; //256
uint targetEthBlocksPerDiffPeriod = epochsMined * 60; //should be 60 times slower than ethereum
| 33,170 |
285 | // Mapping of CKToken to user deposit in a round, key is hashed by keccak256(user_address, round number) | mapping(ICKToken => mapping(bytes32 => uint256)) public userDeposits;
| mapping(ICKToken => mapping(bytes32 => uint256)) public userDeposits;
| 18,301 |
14 | // for now, fix wager to 1 USDC | require(
_wager == 1 * (10 ** betTokenDecimal),
"Wager must be 1 USDC for now"
);
| require(
_wager == 1 * (10 ** betTokenDecimal),
"Wager must be 1 USDC for now"
);
| 20,271 |
51 | // @custom:security-contact hello@metareset.org | contract MetaReset is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public marketingWallet;
address public devW... | contract MetaReset is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public marketingWallet;
address public devW... | 10,036 |
3 | // The constructor sets the original `owner` of the contract to the sender account. / | constructor()
| constructor()
| 1,257 |
31 | // Success, send the transaction | (bool success, ) = toAddress.call{ value: value }(data);
| (bool success, ) = toAddress.call{ value: value }(data);
| 85,361 |
106 | // Mints a token to an address._to address of the future owner of the token/ | function mintTo(address _to) public onlyOwner {
require(_to != address(0), "cannot mint to address 0");
_mint(_to);
}
| function mintTo(address _to) public onlyOwner {
require(_to != address(0), "cannot mint to address 0");
_mint(_to);
}
| 11,812 |
1 | // Lets an authorised module add a guardian to a vault. _vault - The target vault. _guardian - The guardian to add. / | function addGuardian(address _vault, address _guardian) external;
| function addGuardian(address _vault, address _guardian) external;
| 35,717 |
152 | // function that checks whether the token is LinkToken or not / | function isLinkToken (address contractAddress) public view returns (bool) {
return _isLinkToken[contractAddress];
}
| function isLinkToken (address contractAddress) public view returns (bool) {
return _isLinkToken[contractAddress];
}
| 20,242 |
27 | // create a lists of all auctions | mapping(uint256 => auctions) private Auctions;
| mapping(uint256 => auctions) private Auctions;
| 31,874 |
18 | // ------------------------------------------------------------------------ Balances for each account ------------------------------------------------------------------------ | mapping(address => uint) balances;
| mapping(address => uint) balances;
| 37,455 |
2 | // Counts number of set bits (1's) in 32-bit unsigned integer | function bit_count_32(uint32 n) internal pure returns (uint32) {
n = n - ((n >> 1) & 0x55555555);
n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
return (((n + (n >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
}
| function bit_count_32(uint32 n) internal pure returns (uint32) {
n = n - ((n >> 1) & 0x55555555);
n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
return (((n + (n >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
}
| 14,151 |
157 | // deploy virtual funds (RP vStable)/ deployedAmount uint256 the deployed amount to be added to the liquidity | function deployVirtualFundsAfterRebalance(uint256 deployedAmount) external;
| function deployVirtualFundsAfterRebalance(uint256 deployedAmount) external;
| 7,506 |
9 | // Token locked block length | uint256 public halvedBlock;
uint256 public halvedBlockLength = 2_000_000;
| uint256 public halvedBlock;
uint256 public halvedBlockLength = 2_000_000;
| 42,021 |
3 | // Cancel a pending grantee reassignment request./ Can only be called by the grantee. | function cancelReassignmentRequest()
public
onlyGrantee
withRequestedReassignment
| function cancelReassignmentRequest()
public
onlyGrantee
withRequestedReassignment
| 25,153 |
46 | // Updates the protocol fee on the bridging bridgeProtocolFee The part of the premium sent to the protocol treasury / | function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
| function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
| 25,489 |
325 | // check strike prices are increasing | for (uint256 i = 0; i < _strikePrices.length - 1; i++) {
require(_strikePrices[i] < _strikePrices[i + 1], "Strike prices must be increasing");
}
| for (uint256 i = 0; i < _strikePrices.length - 1; i++) {
require(_strikePrices[i] < _strikePrices[i + 1], "Strike prices must be increasing");
}
| 26,608 |
250 | // constructor deploys a new proxyFactory. | constructor(ParameterizerFactory _parameterizerFactory) public {
parameterizerFactory = _parameterizerFactory;
proxyFactory = parameterizerFactory.proxyFactory();
canonizedRegistry = new Registry();
}
| constructor(ParameterizerFactory _parameterizerFactory) public {
parameterizerFactory = _parameterizerFactory;
proxyFactory = parameterizerFactory.proxyFactory();
canonizedRegistry = new Registry();
}
| 5,339 |
31 | // Uniswap V3 NonfungiblePositionManager interface. Interface for any contract that wants to support UNI-V3-POS fee collection. / | interface INonfungiblePositionManager {
function positions(uint256 tokenId)
external
view
returns (
uint96 nonce,
address operator,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper... | interface INonfungiblePositionManager {
function positions(uint256 tokenId)
external
view
returns (
uint96 nonce,
address operator,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper... | 25,580 |
3 | // id of cammpiagn | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
(bool sent, ) = payable(campaign.owner).call{value: amount}("");
if (s... | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
(bool sent, ) = payable(campaign.owner).call{value: amount}("");
if (s... | 29,756 |
1 | // check for deadline | require(campaign.deadline < block.timestamp, "The deadline show be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected =... | require(campaign.deadline < block.timestamp, "The deadline show be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected =... | 28,429 |
6 | // transfer ownership of token to bridge | newChildToken = TokenUpgradeable(address(transparentUpgradeableProxy));
newChildToken.transferOwnership(bridgeUpgradeable);
| newChildToken = TokenUpgradeable(address(transparentUpgradeableProxy));
newChildToken.transferOwnership(bridgeUpgradeable);
| 10,297 |
27 | // Constructor. | function Gabicoin() EIP20(0, "Gabicoin", 2, "GCO") public
| function Gabicoin() EIP20(0, "Gabicoin", 2, "GCO") public
| 2,403 |
16 | // 1e32 adjustment is removed during claim | uint _ratio = (toFees * _FEE_PRECISION) / totalSupply;
if (_ratio > 0) {
index0 += _ratio;
}
| uint _ratio = (toFees * _FEE_PRECISION) / totalSupply;
if (_ratio > 0) {
index0 += _ratio;
}
| 28,418 |
193 | // View function to see pending SOMMAI on frontend. | function pendingSommai(uint256 _pid, address _user) external override view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSommaiPerShare = pool.accSommaiPerShare;
uint256 lpSupply = IERC20(pool.stakeToken).balanceOf(address(this));... | function pendingSommai(uint256 _pid, address _user) external override view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSommaiPerShare = pool.accSommaiPerShare;
uint256 lpSupply = IERC20(pool.stakeToken).balanceOf(address(this));... | 23,356 |
75 | // Make sure this is in sync with what create() does. | _mint(_owners[i], _tokenIdStart + i);
| _mint(_owners[i], _tokenIdStart + i);
| 52,357 |
231 | // Derived balance of the connector | uint256 inConnector;
| uint256 inConnector;
| 49,699 |
60 | // Claim refund, which will transfer refunded Wei amount back to buyer._token Deployed ERC20 token address / | function claimRefund(
address _token
)
public
nonZeroAddress(_token)
inState(_token, States.Refunding)
| function claimRefund(
address _token
)
public
nonZeroAddress(_token)
inState(_token, States.Refunding)
| 34,244 |
5 | // Exits liquidity tokens from a Balancer V2 pool. | function exitPool(
bytes32 poolId,
address sender,
address recipient,
ExitPoolRequest calldata request
) external;
| function exitPool(
bytes32 poolId,
address sender,
address recipient,
ExitPoolRequest calldata request
) external;
| 18,961 |
9 | // mint(): Mint a new Gen0 Beats.These are the tokens that other Beats will be "cloned from"./_to Address to mint to./_priceFinney Price of the Beats in Finney./_numEditionsAllowed Maximum number of times this Beats is allowed to be cloned./_tokenURI A URL to the JSON file containing the metadata for the Beats.See meta... | function mint(address _to, uint256 _priceFinney, uint256 _numEditionsAllowed, string memory _tokenURI, bool _remixable) public mintable returns (uint256 tokenId) {
Beat memory _beat = Beat({
priceFinney: _priceFinney,
numEditionsAllowed: _numEditionsAllowed,
numEditionsInWild: 0,
... | function mint(address _to, uint256 _priceFinney, uint256 _numEditionsAllowed, string memory _tokenURI, bool _remixable) public mintable returns (uint256 tokenId) {
Beat memory _beat = Beat({
priceFinney: _priceFinney,
numEditionsAllowed: _numEditionsAllowed,
numEditionsInWild: 0,
... | 32,163 |
18 | // force reserves to match balances --/ | function sync() external lock {
_update(
IERC20(token0).balanceOf(address(this)),
IERC20(token1).balanceOf(address(this)),
reserve0,
reserve1
);
}
| function sync() external lock {
_update(
IERC20(token0).balanceOf(address(this)),
IERC20(token1).balanceOf(address(this)),
reserve0,
reserve1
);
}
| 26,017 |
23 | // If the upgrade hasn't been registered, register with the current time. | if (registrationTime == 0) {
timeLockedUpgrades[upgradeHash] = block.timestamp;
emit UpgradeRegistered(
upgradeHash,
block.timestamp
);
return;
}
| if (registrationTime == 0) {
timeLockedUpgrades[upgradeHash] = block.timestamp;
emit UpgradeRegistered(
upgradeHash,
block.timestamp
);
return;
}
| 20,971 |
42 | // Returns list of transaction IDs in defined range./from Index start position of transaction array./to Index end position of transaction array./pending Include pending transactions./executed Include executed transactions./ return Returns array of transaction IDs. | function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
| function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
| 14,645 |
251 | // Skip the O(length) loop when source == dest. | if (source == dest) {
return;
}
| if (source == dest) {
return;
}
| 42,178 |
98 | // Emitted when the operator address permission has been changed. operator Address of the operator. previousPermission Whether the operator was authorized. newPermission Whether the operator will be authorized. / | event SetOperator(address indexed operator, bool indexed previousPermission, bool indexed newPermission);
| event SetOperator(address indexed operator, bool indexed previousPermission, bool indexed newPermission);
| 35,734 |
7 | // Index of most recent order. | uint256 internal _orderIndex;
| uint256 internal _orderIndex;
| 46,743 |
11 | // Save this for an assertion in the future. | uint previousBalances = balanceOf[_from] + balanceOf[_to];
| uint previousBalances = balanceOf[_from] + balanceOf[_to];
| 9,953 |
2 | // an Entry represents a single entry purchase for a raffle | struct Entry {
address player;
}
| struct Entry {
address player;
}
| 3,469 |
0 | // only the owner is allowed to burn tokens | function burn(uint256 _value) public onlyOwner {
_burn(msg.sender, _value);
}
| function burn(uint256 _value) public onlyOwner {
_burn(msg.sender, _value);
}
| 44,858 |
2 | // ----------- Revoker only state changing api ----------- |
function revokeOverride(bytes32 role, address account) external;
|
function revokeOverride(bytes32 role, address account) external;
| 16,924 |
18 | // As described in https:eips.ethereum.org/EIPS/eip-20 | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function name() external view returns (string memory); // optional method - see eip spec
function symbol() external view returns (string mem... | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function name() external view returns (string memory); // optional method - see eip spec
function symbol() external view returns (string mem... | 6,282 |
6 | // Transfers value amount of an _id from the _from address to the _to addresses specified. Each parameter array should be the same length, with each index correlating. MUST emit Transfer event on success.Caller must have sufficient allowance by _from for the _id/_value pair, or isApprovedForAll must be true.Throws if `... | function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
| function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
| 41,336 |
63 | // set approval for custom OFT bridge contract | LibAsset.maxApproveERC20(
IERC20(_bridgeData.sendingAssetId),
_oftWrapperData.customCode_approveTo,
_bridgeData.minAmount
);
| LibAsset.maxApproveERC20(
IERC20(_bridgeData.sendingAssetId),
_oftWrapperData.customCode_approveTo,
_bridgeData.minAmount
);
| 20,290 |
56 | // Third Owner saved reward withdraw | uint256 endRewardAmount = rewardToken.balanceOf(address(this));
if(endRewardAmount > 0){
rewardToken.transfer(owner, endRewardAmount);
}
| uint256 endRewardAmount = rewardToken.balanceOf(address(this));
if(endRewardAmount > 0){
rewardToken.transfer(owner, endRewardAmount);
}
| 41,921 |
77 | // Liquidity pool token interface | IUniswapV2Pair public pair;
| IUniswapV2Pair public pair;
| 28,065 |
16 | // Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. This module is used through inheritance. It will make available the modifier`onlyOwner`, which can be applied to your functions to restrict their use tothe o... | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = _msgSender();
emit O... | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = _msgSender();
emit O... | 8,363 |
305 | // returns the address to which the interest is redirected_user address of the user return 0 if there is no redirection, an address otherwise/ | function getInterestRedirectionAddress(address _user) external view returns(address) {
return interestRedirectionAddresses[_user];
}
| function getInterestRedirectionAddress(address _user) external view returns(address) {
return interestRedirectionAddresses[_user];
}
| 16,216 |
17 | // Returns true if the caller is the admin role / | function isAdmin() public view returns (bool) {
return hasRole(msg.sender, 0);
}
| function isAdmin() public view returns (bool) {
return hasRole(msg.sender, 0);
}
| 26,167 |
115 | // rateConfidence = currentTotalLotteryHours / (avgLotteryHours + currentTotalLotteryHours);But since we need to account for decimal pointsrateConfidence = (currentTotalLotteryHoursTWO_DECIMALS) / (avgLotteryHours + currentTotalLotteryHours);rateConfidence needs to be divided by TWO_DECIMALS later on / | rateConfidence = currentTotalLotteryHours.mul(TWO_DECIMALS).div(avgLotteryHours.add(currentTotalLotteryHours));
| rateConfidence = currentTotalLotteryHours.mul(TWO_DECIMALS).div(avgLotteryHours.add(currentTotalLotteryHours));
| 10,222 |
99 | // do we need to remember previous reward? IDK!add here if needed (not needed??) | rewardPerBlockPriorFibonaccening = rewardPerBlock; //remember new reward as current ?? IDK
| rewardPerBlockPriorFibonaccening = rewardPerBlock; //remember new reward as current ?? IDK
| 35,398 |
10 | // An event thats emitted when a delegate account's vote balance changes | event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| 25,320 |
27 | // Get the current mint fee floor price. Returns the lowest price for a token minting. / | function mintFeeFloor() public view returns (uint) {
return _mintFeeFloor;
}
| function mintFeeFloor() public view returns (uint) {
return _mintFeeFloor;
}
| 80,470 |
21 | // Claim a refund for a bid where the vote was not cast | function claimRefund(uint256) external;
| function claimRefund(uint256) external;
| 10,164 |
237 | // an optional (to be choosen by contract owner) fee on each option. A % of the bet money is sent as a fee. see devFundBetFee | if (devFundBetFee > 0) {
uint256 fee = msg.value.div(devFundBetFee).div(100);
require(devFund.send(fee), "devFund fee transfer failed");
depositValue = msg.value.sub(fee);
} else {
| if (devFundBetFee > 0) {
uint256 fee = msg.value.div(devFundBetFee).div(100);
require(devFund.send(fee), "devFund fee transfer failed");
depositValue = msg.value.sub(fee);
} else {
| 27,193 |
38 | // string marketID; | string storageTimeStamp;
string storageDetail; //storageDescription, storageTableName, storageUser and storageQuantity which includes storage UoM
uint256 BlockNumber; //block number of storage submission. previously hash
uint IsSet; // integer indication of whether storage Submission exi... | string storageTimeStamp;
string storageDetail; //storageDescription, storageTableName, storageUser and storageQuantity which includes storage UoM
uint256 BlockNumber; //block number of storage submission. previously hash
uint IsSet; // integer indication of whether storage Submission exi... | 25,081 |
168 | // Collects opium tokens | IStakingRewards(rewards).getReward();
uint256 _opium = IERC20_2(opium).balanceOf(address(this));
if (_opium > 0) {
| IStakingRewards(rewards).getReward();
uint256 _opium = IERC20_2(opium).balanceOf(address(this));
if (_opium > 0) {
| 31,631 |
50 | // Calculates the ETH gain earned by the deposit since its last snapshots were taken.Given by the formula:E = d0(S - S(0))/P(0)where S(0) and P(0) are the depositor's snapshots of the sum S and product P, respectively.d0 is the last recorded deposit value. / | function getDepositorETHGain(address _depositor) public view override returns (uint256) {
uint256 initialDeposit = deposits[_depositor].initialValue;
if (initialDeposit == 0) {
return 0;
}
Snapshots memory snapshots = depositSnapshots[_depositor];
uint256 ETHGa... | function getDepositorETHGain(address _depositor) public view override returns (uint256) {
uint256 initialDeposit = deposits[_depositor].initialValue;
if (initialDeposit == 0) {
return 0;
}
Snapshots memory snapshots = depositSnapshots[_depositor];
uint256 ETHGa... | 43,297 |
9 | // Unassigned Integer variable ~ tokenPrice ~ is equal to 1 ether | uint tokenPrice = 1 ether;
| uint tokenPrice = 1 ether;
| 9,116 |
165 | // Designed to manage delegation to staking contract / | contract DelegateManager is InitializableV2 {
using SafeMath for uint256;
string private constant ERROR_ONLY_GOVERNANCE = (
"DelegateManager: Only callable by Governance contract"
);
string private constant ERROR_MINIMUM_DELEGATION = (
"DelegateManager: Minimum delegation amount require... | contract DelegateManager is InitializableV2 {
using SafeMath for uint256;
string private constant ERROR_ONLY_GOVERNANCE = (
"DelegateManager: Only callable by Governance contract"
);
string private constant ERROR_MINIMUM_DELEGATION = (
"DelegateManager: Minimum delegation amount require... | 17,958 |
26 | // placeholder | _balancesArray.push(address(0));
| _balancesArray.push(address(0));
| 31,015 |
3 | // Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. / | function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Stri... | function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Stri... | 65,338 |
62 | // _proposalID Id of the new curator proposal/ return _newDAO Address of the new DAO | function getNewDAOAddress(uint _proposalID) public virtual view returns (address _newDAO);
| function getNewDAOAddress(uint _proposalID) public virtual view returns (address _newDAO);
| 22,145 |
464 | // register supported interfaces for ERC165 | _registerInterface(0x80ac58cd); // ERC721
_registerInterface(0x5b5e139f); // ERC721Metadata
_registerInterface(0x7f5828d0); // ERC173 (ownership)
| _registerInterface(0x80ac58cd); // ERC721
_registerInterface(0x5b5e139f); // ERC721Metadata
_registerInterface(0x7f5828d0); // ERC173 (ownership)
| 52,025 |
77 | // Withdraw crvLPToken from yearn amount_ The amount of crvLPToken which we deposit yearnVault_ The yearn Vault in which we deposit / | function _withdrawFromYearn(uint256 amount_, YearnVault yearnVault_)
internal
| function _withdrawFromYearn(uint256 amount_, YearnVault yearnVault_)
internal
| 12,267 |
34 | // Contains all logic for processing an unstake operation. For the given deposit, does share accounting and burns shares, returns staking tokens to the original owner, updates global deposit and share trackers, and claims rewards for the given deposit.depositId The specified deposit to unstake from. / | function _unstake(uint256 depositId) internal returns (uint256 reward) {
// Fetch stake and make sure it is withdrawable
UserStake storage s = stakes[msg.sender][depositId];
uint256 depositAmount = s.amount;
if (depositAmount == 0) revert USR_NoDeposit(depositId);
if (s.unb... | function _unstake(uint256 depositId) internal returns (uint256 reward) {
// Fetch stake and make sure it is withdrawable
UserStake storage s = stakes[msg.sender][depositId];
uint256 depositAmount = s.amount;
if (depositAmount == 0) revert USR_NoDeposit(depositId);
if (s.unb... | 72,086 |
308 | // EIP-712 contract's domain separator, / | bytes32 public immutable DOMAIN_SEPARATOR;
| bytes32 public immutable DOMAIN_SEPARATOR;
| 8,770 |
1 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address own... | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address own... | 70,051 |
49 | // Vault distributing incoming elastic token rewards equally amongst staked pools | contract Vault is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below. // elastic, in token underlying un... | contract Vault is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below. // elastic, in token underlying un... | 8,827 |
8 | // time contract was deployed | uint public createdAt;
| uint public createdAt;
| 85,692 |
8 | // `requestProofIssuance` - An authorized issuer requests proof issuance after a consensus is reached.This runs the automatic data verification and the certificate minting process. request - An IssuanceRequest struct containing the data needed to issue a certificate. / | function requestProofIssuance(IssuanceRequest memory request) external;
| function requestProofIssuance(IssuanceRequest memory request) external;
| 30,437 |
1 | // max count of latest blocks that _actionFlag can store actions | uint constant actionMaxBlocks = 14;
| uint constant actionMaxBlocks = 14;
| 2,022 |
293 | // Reduces reserves by transferring to admin Requires fresh interest accrual reduceAmount Amount of reduction to reservesreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _reduceReservesFresh(uint256 reduceAmount) internal returns (uint256) {
// totalReserves - reduceAmount
uint256 totalReservesNew;
// Check caller is Reserve Guardian or admin
if (msg.sender != comptroller.reserveGuardian() && msg.sender != admin) {
return fail(Error.UNAUTHORIZED, Failu... | function _reduceReservesFresh(uint256 reduceAmount) internal returns (uint256) {
// totalReserves - reduceAmount
uint256 totalReservesNew;
// Check caller is Reserve Guardian or admin
if (msg.sender != comptroller.reserveGuardian() && msg.sender != admin) {
return fail(Error.UNAUTHORIZED, Failu... | 65,991 |
9 | // Tells the maximum gas limit that a message can use on its execution by the AMB bridge on the other network.return the maximum gas limit value. / | function maxGasPerTx() internal view returns (uint256) {
return bridgeContract().maxGasPerTx();
}
| function maxGasPerTx() internal view returns (uint256) {
return bridgeContract().maxGasPerTx();
}
| 4,630 |
107 | // Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR _amount Amount to take the percentage of _fracNum Numerator of fraction representing the percentage with PERC_DIVISOR as the denominator / | function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {
return _amount.mul(_fracNum).div(PERC_DIVISOR);
}
| function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {
return _amount.mul(_fracNum).div(PERC_DIVISOR);
}
| 23,603 |
85 | // how much fee is being paid in | uint256 feeAmount;
| uint256 feeAmount;
| 27,604 |
16 | // Pay ether to fond | _fondContract.invest.value(toFond)(msg.sender);
| _fondContract.invest.value(toFond)(msg.sender);
| 45,784 |
127 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 4,873 |
2 | // Returns the platform fee recipient and bps. | function getPlatformFeeInfo() public view override returns (address, uint16) {
return (platformFeeRecipient, uint16(platformFeeBps));
}
| function getPlatformFeeInfo() public view override returns (address, uint16) {
return (platformFeeRecipient, uint16(platformFeeBps));
}
| 13,607 |
4 | // Emitted when an existing router is removed router - The address of the removed router caller - The account that called the function / | event RouterRemoved(address indexed router, address caller);
| event RouterRemoved(address indexed router, address caller);
| 23,777 |
4 | // Variables to store the start and end time of the election | uint public electionStartTime;
uint public electionEndTime;
| uint public electionStartTime;
uint public electionEndTime;
| 11,232 |
114 | // Sets the frozen state of the reserve self The reserve configuration frozen The frozen state / | function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure {
self.data =
(self.data & FROZEN_MASK) |
(uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION);
}
| function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure {
self.data =
(self.data & FROZEN_MASK) |
(uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION);
}
| 46,796 |
75 | // assign the end block | endBlock = _endBlock;
| endBlock = _endBlock;
| 6,847 |
0 | // track all members of the DAO with their roles | mapping(address => mapping(bytes32 => bool)) private _members;
| mapping(address => mapping(bytes32 => bool)) private _members;
| 23,915 |
121 | // Internal function to set the token URI for a given token. Reverts if the token ID does not exist.tokenId uint256 ID of the token to set its URIuri string URI to assign/ | function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = uri;
}
| function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = uri;
}
| 68,567 |
500 | // keccak256("decodeAndHashBoosterMessage(address,bytes)") | abi.encodeWithSelector(
0xaf6eec54,
msg.sender, /* msg.sender becomes the target booster */
boosterMessage
)
);
if (!success) {
continue;
}
| abi.encodeWithSelector(
0xaf6eec54,
msg.sender, /* msg.sender becomes the target booster */
boosterMessage
)
);
if (!success) {
continue;
}
| 5,378 |
3 | // asset that is held as collateral against short/written options | address public collateralAsset;
| address public collateralAsset;
| 43,266 |
80 | // CAUTION: do not input _from == _to s.t. this function will always fail | function _transfer(
IERC20Upgradeable _token,
address _to,
Decimal.decimal memory _value
| function _transfer(
IERC20Upgradeable _token,
address _to,
Decimal.decimal memory _value
| 8,601 |
264 | // Closes the specified stream. Pays out pending amounts, clears out the stream, and emits a StreamClosed event. streamId The id of the stream to close. / | function closeStream(uint256 streamId)
public
canManageStreams
| function closeStream(uint256 streamId)
public
canManageStreams
| 87,513 |
121 | // B. If rewards at this bracket are > 0, calculate, else, report the numberAddresses from previous bracket | if (_lotteries[_lotteryId].rewardsBreakdown[j] != 0) {
_lotteries[_lotteryId].dexTokenPerBracket[j] =
((_lotteries[_lotteryId].rewardsBreakdown[j] * amountToShareToWinners) /
(_numberTicketsPerLotteryId[_lotteryId][transformedWinnin... | if (_lotteries[_lotteryId].rewardsBreakdown[j] != 0) {
_lotteries[_lotteryId].dexTokenPerBracket[j] =
((_lotteries[_lotteryId].rewardsBreakdown[j] * amountToShareToWinners) /
(_numberTicketsPerLotteryId[_lotteryId][transformedWinnin... | 33,948 |
62 | // Closes user position id Position id / | function closePosition(bytes32 id) external {
_closePosition(_msgSender(), id, block.timestamp);
}
| function closePosition(bytes32 id) external {
_closePosition(_msgSender(), id, block.timestamp);
}
| 1,614 |
11 | // Changes the current state to `to`, and fires `StateChanged`. / | function setState(State to) internal {
State from = state;
state = to;
StateChanged(from, to);
}
| function setState(State to) internal {
State from = state;
state = to;
StateChanged(from, to);
}
| 4,961 |
24 | // Mark fill fraction as zero as the order will not be used. | advancedOrder.numerator = 0;
| advancedOrder.numerator = 0;
| 16,828 |
25 | // For methods only callable with withdraws enabled (all withdrawal operations). / | modifier onlyWithdrawEnabled() {
if (!withdrawEnabled) revert AV_WithdrawsDisabled();
_;
}
| modifier onlyWithdrawEnabled() {
if (!withdrawEnabled) revert AV_WithdrawsDisabled();
_;
}
| 36,254 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.