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 |
|---|---|---|---|---|
119 | // Otherwise, the data exists and is not burned. We can skip the scan. This is possible because we have already achieved the target condition. This saves 2143 gas on transfers of initialized tokens. | return packed;
| return packed;
| 8,165 |
42 | // See addresses eligible for fee-staking / | function viewFeeStakingAddresses() external view returns (address[] memory) {
uint256 length = _feeStakingAddresses.length();
address[] memory feeStakingAddresses = new address[](length);
for (uint256 i = 0; i < length; i++) {
feeStakingAddresses[i] = _feeStakingAddresses.at(i)... | function viewFeeStakingAddresses() external view returns (address[] memory) {
uint256 length = _feeStakingAddresses.length();
address[] memory feeStakingAddresses = new address[](length);
for (uint256 i = 0; i < length; i++) {
feeStakingAddresses[i] = _feeStakingAddresses.at(i)... | 69,994 |
25 | // Gas limit that YPool need to proceed withdraw request | uint256 public completeWithdrawGasLimit;
| uint256 public completeWithdrawGasLimit;
| 43,632 |
6 | // Total number of claimed QI tokens by user address => purchase round => claimed tokens | mapping(address => mapping(uint => uint)) public claimedTokens;
| mapping(address => mapping(uint => uint)) public claimedTokens;
| 2,557 |
239 | // cap the amount of debt we are taking according to our acceptable costs if with the new loan we are increasing our cost of capital over what is healthy | if (currentProtocolDebt.add(amountToBorrowETH) > maxProtocolDebt) {
| if (currentProtocolDebt.add(amountToBorrowETH) > maxProtocolDebt) {
| 80,691 |
70 | // Token base URI | string baseURI;
| string baseURI;
| 46,280 |
34 | // get input amount | for(uint256 i = 0; i < _rounds.length; i ++) {
| for(uint256 i = 0; i < _rounds.length; i ++) {
| 57,503 |
113 | // Read length of the array from source and write to destination. | let length := mload(srcLength)
mstore(dstLength, length)
| let length := mload(srcLength)
mstore(dstLength, length)
| 20,768 |
23 | // import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { MerkleProof } from "@openzeppelin/contracts/cryptography/MerkleProof.sol"; import { IMerkleDistributor } from "../interfaces/IMerkleDistributor.sol"; | address public immutable override token;
bytes32 public immutable override merkleRoot;
| address public immutable override token;
bytes32 public immutable override merkleRoot;
| 79,368 |
183 | // Close presale if open, open presale if closed | function pausePreSale() public onlyOwner {
presaleOpen = false;
}
| function pausePreSale() public onlyOwner {
presaleOpen = false;
}
| 15,535 |
3 | // flashloan args | struct Flashloan {
uint16 platformId;
IERC20[] sourceTokens;
uint256[] sourceAmounts;
}
| struct Flashloan {
uint16 platformId;
IERC20[] sourceTokens;
uint256[] sourceAmounts;
}
| 13,541 |
1 | // Checks if token is a valid redeemable token | modifier onlyMintedTokens(address token) {
require(mintedTokens[token], 'Token not minted');
_;
}
| modifier onlyMintedTokens(address token) {
require(mintedTokens[token], 'Token not minted');
_;
}
| 28,925 |
8 | // Token ID -> ERC20 contract -> balance of ERC20 owned by token | mapping(uint256 => mapping(address => uint256)) public ERC20Balances;
| mapping(uint256 => mapping(address => uint256)) public ERC20Balances;
| 6,455 |
8 | // Called by an external message only; sends tokens to the TTW. The function must call the accept function of the token wallet and increase the totalGranted value. | function grant(address dest, uint128 tokens, uint128 grams) external;
| function grant(address dest, uint128 tokens, uint128 grams) external;
| 27,745 |
45 | // Handle slash | function _slash(uint256 slashAmount, address recipient) private {
require(slashAmount < getPoolTotalAssetsValue(), "cannot slash more than the pool balance");
baseTokenBalance -= slashAmount;
totalSlashedAllTime += slashAmount;
TransferHelper.safeTransfer(address(BASE_LIQUIDITY_TOKEN... | function _slash(uint256 slashAmount, address recipient) private {
require(slashAmount < getPoolTotalAssetsValue(), "cannot slash more than the pool balance");
baseTokenBalance -= slashAmount;
totalSlashedAllTime += slashAmount;
TransferHelper.safeTransfer(address(BASE_LIQUIDITY_TOKEN... | 69,345 |
340 | // Bids on the token, replacing the bid if the bid is higher than the current bid. You cannot bid on a token you already own._newBidAmount uint256 value in wei to bid, plus marketplace fee._tokenId uint256 ID of the token/ | function bid(uint256 _tokenId)
public payable isNotPaused(_tokenId)
| function bid(uint256 _tokenId)
public payable isNotPaused(_tokenId)
| 19,186 |
158 | // Returns an account's deposits. These can be either a contracts's funds, or a relay owner's revenue. / | function balanceOf(address target) external view returns (uint256);
| function balanceOf(address target) external view returns (uint256);
| 5,452 |
0 | // IInterchainGasPaymaster Manages payments on a source chain to cover gas costs of relayingmessages to destination chains. / | interface IInterchainGasPaymaster {
function payGasFor(
address _outbox,
uint256 _leafIndex,
uint32 _destinationDomain
) external payable;
}
| interface IInterchainGasPaymaster {
function payGasFor(
address _outbox,
uint256 _leafIndex,
uint32 _destinationDomain
) external payable;
}
| 16,080 |
199 | // Supported vote types. Matches Governor Bravo ordering. / | enum VoteType {
Against,
For,
Abstain
}
| enum VoteType {
Against,
For,
Abstain
}
| 7,873 |
12 | // amount of $CARROT earned so far | uint128 public totalCarrotEarned;
| uint128 public totalCarrotEarned;
| 79,376 |
53 | // make increase in creditline available to new loans | assessor.changeBorrowAmountEpoch(safeAdd(assessor.borrowAmountEpoch(), amountDAI));
| assessor.changeBorrowAmountEpoch(safeAdd(assessor.borrowAmountEpoch(), amountDAI));
| 33,038 |
162 | // unstake in gauge | ensureEnoughTokensAreAvailable(yAmount);
| ensureEnoughTokensAreAvailable(yAmount);
| 27,931 |
246 | // 2. Total minted is the difference between values, with respect to total supply | if (_config.supply == 0) {
mintAmount = kFinal - _k;
} else {
| if (_config.supply == 0) {
mintAmount = kFinal - _k;
} else {
| 34,730 |
48 | // Grant tokens to a specified address. Please note, that the trustee must have enough ungranted tokens to/ accomodate the new grant. Otherwise, the call with fail./_to address The holder address./_value uint256 The amount of tokens to be granted./_start uint256 The beginning of the vesting period./_cliff uint256 Durat... | function grant(address _to, uint256 _value, uint256 _start, uint256 _cliff, uint256 _end,
uint256 _installmentLength, bool _revokable)
| function grant(address _to, uint256 _value, uint256 _start, uint256 _cliff, uint256 _end,
uint256 _installmentLength, bool _revokable)
| 44,045 |
742 | // claim CRV | ITokenMinter(MINTER_ADDRESS).mint(GAUGE_ADDRESS);
| ITokenMinter(MINTER_ADDRESS).mint(GAUGE_ADDRESS);
| 13,011 |
88 | // Placeholder address of ETH, indicating this is strategy for ETH | address public constant override underlying =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
uint public constant override totalDebt = 0;
uint public constant override performanceFee = 0;
uint public constant override slippage = 0;
uint public constant override delta = 0;
bool public const... | address public constant override underlying =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
uint public constant override totalDebt = 0;
uint public constant override performanceFee = 0;
uint public constant override slippage = 0;
uint public constant override delta = 0;
bool public const... | 42,950 |
51 | // Max wallet holding (% at launch) | uint256 public _maxWalletToken = _tTotal.mul(2).div(100);
uint256 private _previousMaxWalletToken = _maxWalletToken;
| uint256 public _maxWalletToken = _tTotal.mul(2).div(100);
uint256 private _previousMaxWalletToken = _maxWalletToken;
| 4,853 |
305 | // Redeem unclaimed governance tokens and update governance global index and user index if neededif called during redeem it will send all gov tokens accrued by a user to the user_to : user address / | function _redeemGovTokens(address _to) internal {
_redeemGovTokensInternal(_to, new bool[](govTokens.length));
}
| function _redeemGovTokens(address _to) internal {
_redeemGovTokensInternal(_to, new bool[](govTokens.length));
}
| 19,683 |
139 | // Optimistically get pair | cDAIxcCOREUniswapPair = IUniswapV2Factory(uniswapFactory).getPair(cCORE , cDAI);
if(cDAIxcCOREUniswapPair == address(0)) { // Pair doesn't exist yet
| cDAIxcCOREUniswapPair = IUniswapV2Factory(uniswapFactory).getPair(cCORE , cDAI);
if(cDAIxcCOREUniswapPair == address(0)) { // Pair doesn't exist yet
| 13,740 |
308 | // Canonical NaN value. / | bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
| bytes16 private constant NaN = 0x7FFF8000000000000000000000000000;
| 20,105 |
546 | // 275 | entry "post-haste" : ENG_ADVERB
| entry "post-haste" : ENG_ADVERB
| 21,111 |
2 | // public sale | modifier publicSaleOpen() {
require(publicSale, "Public Sale Not Started");
_;
}
| modifier publicSaleOpen() {
require(publicSale, "Public Sale Not Started");
_;
}
| 13,761 |
4 | // Series information by index. | mapping(uint256 => IIkaniV1.Series) internal _SERIES_INFO_;
| mapping(uint256 => IIkaniV1.Series) internal _SERIES_INFO_;
| 30,877 |
2 | // Emitted when `minter` is added as `minter`. / | event MinterAdded(address minter);
| event MinterAdded(address minter);
| 30,065 |
1 | // Emitted when a validator fee is withdrawn. / | event WithdrawFee(
uint validatorId,
address destination,
| event WithdrawFee(
uint validatorId,
address destination,
| 28,615 |
158 | // read the current registrar / | function getRegistrar()
external
view
returns (
address
)
| function getRegistrar()
external
view
returns (
address
)
| 33,023 |
363 | // Check that the bid is greater than or equal to the current price | uint256 price = _currentPrice(auction);
require(_bidAmount >= price);
address seller = address(uint160(auction.seller));
| uint256 price = _currentPrice(auction);
require(_bidAmount >= price);
address seller = address(uint160(auction.seller));
| 25,205 |
40 | // allowed to spend on behalf of owner through {transferFrom}. This is zero by default.This value changes when {approve} or {transferFrom} are called owner address of token owner spender address of token spender / | function allowance(address owner, address spender) external view override returns (uint) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) external view override returns (uint) {
return _allowances[owner][spender];
}
| 34,475 |
155 | // Add `ethAmount` of ETH and `tokenAmount` of tokens to the LP.Depends on the current rate for the pair between this token and WETH,`ethAmount` and `tokenAmount` might not match perfectly. Dust(leftover) ETH or token will be refunded to this contract(usually very small quantity). | * Emits {Transfer} event. From this contract to the token and WETH Pai.
*/
function addLiquidity(uint256 ethAmount, uint256 tokenAmount) private lockTheSwap {
_approve(address(this), address(_uniswapV2Router), tokenAmount);
// Add the ETH and token to LP.
// The LP tokens will be ... | * Emits {Transfer} event. From this contract to the token and WETH Pai.
*/
function addLiquidity(uint256 ethAmount, uint256 tokenAmount) private lockTheSwap {
_approve(address(this), address(_uniswapV2Router), tokenAmount);
// Add the ETH and token to LP.
// The LP tokens will be ... | 42,777 |
316 | // require( cyberPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct" ); |
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = totalSupply();
if (totalSupply() < MAX_CYBERS) {
_safeMint(msg.sender, mintIndex);
}
|
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = totalSupply();
if (totalSupply() < MAX_CYBERS) {
_safeMint(msg.sender, mintIndex);
}
| 8,527 |
20 | // only check isContract if the call was successful and the return data is empty otherwise we already know that it was a contract | require(isContract(target), "Address: call to non-contract");
| require(isContract(target), "Address: call to non-contract");
| 3,895 |
217 | // Interface for the new (multicoin) addr function. / | interface IAddressResolver {
event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);
function addr(bytes32 node, uint coinType) external view returns(bytes memory);
}
| interface IAddressResolver {
event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);
function addr(bytes32 node, uint coinType) external view returns(bytes memory);
}
| 53,980 |
10 | // Check to see if there exists a request commitment consumersfor all consumers and keyhashes for a given sub. subId - ID of the subscriptionreturn true if there exists at least one unfulfilled request for the subscription, falseotherwise. / | function pendingRequestExists(uint64 subId) external view returns (bool);
| function pendingRequestExists(uint64 subId) external view returns (bool);
| 17,831 |
291 | // Checking for reserved bulldogs | require(totalSupply().add(numBulldogs) <= MAX_BULLDOGS - RESERVED_BULLDOGS_AMOUNT, "Purchase would exceed max supply of Bohemian Bulldogs");
| require(totalSupply().add(numBulldogs) <= MAX_BULLDOGS - RESERVED_BULLDOGS_AMOUNT, "Purchase would exceed max supply of Bohemian Bulldogs");
| 2,138 |
24 | // The number of gobblers minted to the reserves. | uint256 public numMintedForReserves;
/*//////////////////////////////////////////////////////////////
LEGENDARY GOBBLER AUCTION STATE
| uint256 public numMintedForReserves;
/*//////////////////////////////////////////////////////////////
LEGENDARY GOBBLER AUCTION STATE
| 37,470 |
32 | // Allow owner to send tokens without cost to multiple addresses / | function giftTokens(
uint256 _tokenId,
address[] calldata _receivers,
uint256[] calldata _mintNumber
| function giftTokens(
uint256 _tokenId,
address[] calldata _receivers,
uint256[] calldata _mintNumber
| 21,287 |
1 | // The SIContract structure: every SIContract is composed of:- Hash of contract bytecode- Account that submitted the address- Status - 0 = pending, 1 = active, 2 = rejected. / | struct SIContract {
bytes32 hash;
address submitter;
uint status;
}
| struct SIContract {
bytes32 hash;
address submitter;
uint status;
}
| 8,937 |
342 | // callable by admin to set pool for HolyValor should not be called if this contract holds invested funds | function setPool(address _poolAddress) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Admin only");
connectPool(_poolAddress);
}
| function setPool(address _poolAddress) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Admin only");
connectPool(_poolAddress);
}
| 41,477 |
0 | // Kyber Network interface | contract KyberNetworkProxy {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes32 id)... | contract KyberNetworkProxy {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes32 id)... | 12,909 |
28 | // Writes the value of null as an element of a JSON array. / | function writeNullValue(Json memory json)
internal
pure
returns (Json memory)
| function writeNullValue(Json memory json)
internal
pure
returns (Json memory)
| 16,622 |
15 | // Liquidates collateral to cover loan losses and does any other processing required by the oracle/loanOrder The loanOrder object/loanPosition The loanPosition object/positionId The position id of the loan/loanTokenAmountNeeded The amount of loan token needed to cover losses/isLiquidation A boolean indicating if the lo... | function processCollateral(
BZxObjects.LoanOrder memory loanOrder,
BZxObjects.LoanPosition memory loanPosition,
uint positionId,
uint loanTokenAmountNeeded,
bool isLiquidation)
public
returns (uint loanTokenAmountCovered, uint collateralTokenAmountUsed);
| function processCollateral(
BZxObjects.LoanOrder memory loanOrder,
BZxObjects.LoanPosition memory loanPosition,
uint positionId,
uint loanTokenAmountNeeded,
bool isLiquidation)
public
returns (uint loanTokenAmountCovered, uint collateralTokenAmountUsed);
| 27,414 |
71 | // Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between | * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() p... | * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() p... | 32,230 |
4 | // First, check if the price is out of the band | if(frax_price > FRAX_top_band){
new_collateral_ratio = last_collateral_ratio.sub(frax_step);
} else if (frax_price < FRAX_bottom_band){
| if(frax_price > FRAX_top_band){
new_collateral_ratio = last_collateral_ratio.sub(frax_step);
} else if (frax_price < FRAX_bottom_band){
| 32,297 |
28 | // Day of week. | dt.weekday = getWeekday(timestamp);
| dt.weekday = getWeekday(timestamp);
| 4,403 |
6 | // The first part of random zombie creation. | function createRandomZombieRequest(string calldata _zombieName) external {
require(ownerZombieCount[msg.sender] == 0, "Only one first zombie could be requested to create with this method.");
require(bytes(addressToRandomZombieNameRequested[msg.sender]).length == 0, "Only 1 request to create a random zombie ma... | function createRandomZombieRequest(string calldata _zombieName) external {
require(ownerZombieCount[msg.sender] == 0, "Only one first zombie could be requested to create with this method.");
require(bytes(addressToRandomZombieNameRequested[msg.sender]).length == 0, "Only 1 request to create a random zombie ma... | 11,003 |
30 | // Keep initial orders takerTokenAmount values | uint256 leftInitial = _leftOrder.takerTokenAmount;
uint256 rightInitial = _rightOrder.takerTokenAmount;
| uint256 leftInitial = _leftOrder.takerTokenAmount;
uint256 rightInitial = _rightOrder.takerTokenAmount;
| 6,841 |
260 | // Otherwise, both timestamps must be surrounded by twabs. | (
ObservationLib.Observation memory beforeOrAtStart,
ObservationLib.Observation memory afterOrAtStart
) = ObservationLib.binarySearch(
_twabs,
_newestTwabIndex,
_oldestTwabIndex,
_targetTimestamp,
_ac... | (
ObservationLib.Observation memory beforeOrAtStart,
ObservationLib.Observation memory afterOrAtStart
) = ObservationLib.binarySearch(
_twabs,
_newestTwabIndex,
_oldestTwabIndex,
_targetTimestamp,
_ac... | 69,869 |
122 | // BlockTower Legal Expenses - 133,466 DAI - 0xc4dB894A11B1eACE4CDb794d0753A3cB7A633767 | DssExecLib.sendPaymentFromSurplusBuffer(BLOCKTOWER_WALLET_2, 133_466);
DssExecLib.setChangelogVersion("1.14.14");
| DssExecLib.sendPaymentFromSurplusBuffer(BLOCKTOWER_WALLET_2, 133_466);
DssExecLib.setChangelogVersion("1.14.14");
| 28,213 |
126 | // make sure fund receive pool token | require(poolAmountReceive > 0, "EMPTY_POOL_RETURN");
| require(poolAmountReceive > 0, "EMPTY_POOL_RETURN");
| 57,869 |
99 | // owner => operator => approved | mapping(address => mapping(address => bool)) internal _operatorApprovals;
| mapping(address => mapping(address => bool)) internal _operatorApprovals;
| 37,271 |
61 | // CALLED BY JURY.ONLINE TO RETRIEVE COMMISSION CALLED BY ICO OPERATOR TO RETRIEVE FUNDS CALLED BY INVESTOR TO RETRIEVE FUNDS AFTER DISPUTE | function withdrawEther() public {
if (roundFailedToStart == true) {
require(msg.sender.send(deals[msg.sender].sumEther));
}
if (msg.sender == operator) {
require(projectWallet.send(ethForMilestone+postDisputeEth));
ethForMilestone = 0;
postDisp... | function withdrawEther() public {
if (roundFailedToStart == true) {
require(msg.sender.send(deals[msg.sender].sumEther));
}
if (msg.sender == operator) {
require(projectWallet.send(ethForMilestone+postDisputeEth));
ethForMilestone = 0;
postDisp... | 49,950 |
63 | // disable Transfer delay - cannot be reenabled | function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
| function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
| 25,781 |
8 | // 0xe83bbb76=>enterPool(address,address,address,uint256) | function enterPool(
address pool,
address fromToken,
uint256 amount
| function enterPool(
address pool,
address fromToken,
uint256 amount
| 57,710 |
35 | // Get the information about one relay. | function getinfo(uint16 i) view public returns (bytes memory){
require(msg.sender == owner);
return relay[i].encryptedSRI;
}
| function getinfo(uint16 i) view public returns (bytes memory){
require(msg.sender == owner);
return relay[i].encryptedSRI;
}
| 44,407 |
24 | // Calculate natural logarithm of x.Revert if x <= 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function ln (int128 x) internal pure returns (int128) {
unchecked {
require (x > 0);
return int128 (int256 (
uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));
}
}
| function ln (int128 x) internal pure returns (int128) {
unchecked {
require (x > 0);
return int128 (int256 (
uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128));
}
}
| 12,153 |
376 | // Getters dYdX Public read-only functions that allow transparency into the state of Solo / | contract Getters {
using Types for Types.Par;
/**
* Get an account's summary for each market.
*
* @param account The account to query
* @return The following values:
* - The ERC20 token address for each market
* - The account's princi... | contract Getters {
using Types for Types.Par;
/**
* Get an account's summary for each market.
*
* @param account The account to query
* @return The following values:
* - The ERC20 token address for each market
* - The account's princi... | 2,401 |
2 | // Getter for the total amount of Ether already released. / | function totalReleased() public view returns (uint256) {
return _totalReleased;
}
| function totalReleased() public view returns (uint256) {
return _totalReleased;
}
| 35,063 |
56 | // withdrawing Ether | if (address(token) == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
if (address(this).balance > 0){
tokenBalance = address(this).balance;
payable(msg.sender).transfer(address(this).balance);
}
| if (address(token) == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
if (address(this).balance > 0){
tokenBalance = address(this).balance;
payable(msg.sender).transfer(address(this).balance);
}
| 843 |
67 | // SimpleStake - stakes the value of an EIP20 token on Ethereum/for a utility token on the OpenST platform/OpenST Ltd. | contract SimpleStake is ProtocolVersioned {
using SafeMath for uint256;
/*
* Events
*/
event ReleasedStake(address indexed _protocol, address indexed _to, uint256 _amount);
/*
* Storage
*/
/// EIP20 token contract that can be staked
EIP20Interface public eip20Token;
/... | contract SimpleStake is ProtocolVersioned {
using SafeMath for uint256;
/*
* Events
*/
event ReleasedStake(address indexed _protocol, address indexed _to, uint256 _amount);
/*
* Storage
*/
/// EIP20 token contract that can be staked
EIP20Interface public eip20Token;
/... | 8,441 |
192 | // Other return size: return false | default { }
| default { }
| 12,450 |
10 | // Returns a random item from the list, always the same for the same token ID | function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
return sourceArray[rand % sourceArray.length];
}
| function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
return sourceArray[rand % sourceArray.length];
}
| 58,050 |
9 | // mintLegacyTokens// Mints the legacy tokens without emitting any events. _tokenIds uint256 array of token ids to mint. / | function mintLegacyTokens(uint256[] calldata _tokenIds) external onlyOwner {
require(
!_mintingCompleted,
"SuperRareLegacy: Cannot mint tokens once minting has completed."
);
for (uint256 i = 0; i < _tokenIds.length; i++) {
_createLegacyToken(_tokenIds[i])... | function mintLegacyTokens(uint256[] calldata _tokenIds) external onlyOwner {
require(
!_mintingCompleted,
"SuperRareLegacy: Cannot mint tokens once minting has completed."
);
for (uint256 i = 0; i < _tokenIds.length; i++) {
_createLegacyToken(_tokenIds[i])... | 18,224 |
174 | // Sends LP tokens recieved to burn address | burnLPTokens();
| burnLPTokens();
| 16,852 |
16 | // Update the forge address/_forge The new forge address/ return True if the update is successful | function updateForge(address _forge) external onlyOwner returns (bool) {
return _updateForge(_forge);
}
| function updateForge(address _forge) external onlyOwner returns (bool) {
return _updateForge(_forge);
}
| 17,796 |
384 | // Claim: claim details | struct Claim
| struct Claim
| 14,954 |
81 | // Returns auction details for a given auctionId. / | function getReserveAuction(uint256 auctionId) public view returns (ReserveAuction memory) {
return auctionIdToAuction[auctionId];
}
| function getReserveAuction(uint256 auctionId) public view returns (ReserveAuction memory) {
return auctionIdToAuction[auctionId];
}
| 32,251 |
36 | // returns how many elections there have been so far. | function getNumElections() public view returns (uint256) {
return numElections;
}
| function getNumElections() public view returns (uint256) {
return numElections;
}
| 17,813 |
10 | // Minimal ERC-20 interface Familiars implement / | interface ERC20Interface {
function balanceOf(address owner) external view returns (uint256 balance);
function transfer(address recipient, uint256 amount) external returns (bool);
}
| interface ERC20Interface {
function balanceOf(address owner) external view returns (uint256 balance);
function transfer(address recipient, uint256 amount) external returns (bool);
}
| 39,480 |
124 | // Internal function that mints tokens to an account./ Update magnifiedDividendCorrections to keep dividends unchanged./account The account that will receive the created tokens./value The amount that will be created. | function _mint(address account, uint256 value) internal override {
super._mint(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account] - (magnifiedDividendPerShare.mul(value)).toInt256Safe();
}
| function _mint(address account, uint256 value) internal override {
super._mint(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account] - (magnifiedDividendPerShare.mul(value)).toInt256Safe();
}
| 20,729 |
90 | // Retrieve the item's group ID. | uint256 groupId = (_ids[i] & GROUP_MASK) >> 128;
| uint256 groupId = (_ids[i] & GROUP_MASK) >> 128;
| 34,369 |
43 | // What time is it? / | function atNow() public view returns (uint) {
return now;
}
| function atNow() public view returns (uint) {
return now;
}
| 50,297 |
80 | // only use to prevent sniper buys in the first blocks. | if (gasLimitActive && automatedMarketMakerPairs[from]) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
| if (gasLimitActive && automatedMarketMakerPairs[from]) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
| 24,373 |
767 | // ERC2612 Token with permit – 712-signed approvals but with/bytes as signature/see https:eips.ethereum.org/EIPS/eip-2612/Daniel Wang - <daniel@loopring.org> | abstract contract ERC2612 is ERC20
| abstract contract ERC2612 is ERC20
| 9,466 |
90 | // Send numtokens to Burn Address | _burn(address(this),numtokenstoburn);
| _burn(address(this),numtokenstoburn);
| 38,159 |
3 | // The depositor wishes to increase the holdings against channelId to amount + expectedHeld The depositor need only deposit (at most) amount + (expectedHeld - holdings) (the term in parentheses is non-positive) |
amountDeposited = expectedHeld.add(amount).sub(holdings[destination]); // strictly positive
|
amountDeposited = expectedHeld.add(amount).sub(holdings[destination]); // strictly positive
| 21,834 |
26 | // All Avaco tokens on this address will be added to liquity here. | function liquidityAdding() public {
bool should = shouldLiquidy();
if (should) {
uint256 amountToSwap = IARC20(token_address).balanceOf(address(this)).div(2);
AVAXliquidityAdd(amountToSwap); // 50% of all tokens on This address get in AVAX liquidity Pool.
USDCliqu... | function liquidityAdding() public {
bool should = shouldLiquidy();
if (should) {
uint256 amountToSwap = IARC20(token_address).balanceOf(address(this)).div(2);
AVAXliquidityAdd(amountToSwap); // 50% of all tokens on This address get in AVAX liquidity Pool.
USDCliqu... | 8,619 |
160 | // Claim rewards harvested during reward time / | function getReward(address account, address rewardRecipient) external;
| function getReward(address account, address rewardRecipient) external;
| 66,411 |
15 | // prevent an upkeep from being performed in the future id upkeep to be canceled / | function cancelUpkeep(uint256 id) external override {
uint64 maxValid = s_upkeep[id].maxValidBlocknumber;
bool canceled = maxValid != UINT64_MAX;
bool isOwner = msg.sender == owner();
if (canceled && !(isOwner && maxValid > block.number)) revert CannotCancel();
if (!isOwner && msg.sender != s_upk... | function cancelUpkeep(uint256 id) external override {
uint64 maxValid = s_upkeep[id].maxValidBlocknumber;
bool canceled = maxValid != UINT64_MAX;
bool isOwner = msg.sender == owner();
if (canceled && !(isOwner && maxValid > block.number)) revert CannotCancel();
if (!isOwner && msg.sender != s_upk... | 22,144 |
220 | // Remove address from whitelist and reset max mint but don't reset whitelistClaimed | _whitelist[addresses[i]] = false;
_whitelistMaxMint[addresses[i]] = 0;
| _whitelist[addresses[i]] = false;
_whitelistMaxMint[addresses[i]] = 0;
| 46,336 |
391 | // Store in the FeePool the users current debt value in the system in XDRs. debtBalanceOf(messageSender, "XDR") to be used with totalIssuedSynths("XDR") to get users % of the system within a feePeriod. / | function _appendAccountIssuanceRecord()
internal
| function _appendAccountIssuanceRecord()
internal
| 35,745 |
120 | // IUniswapV2ERC20 token = IUniswapV2ERC20(_token); | IUniswapV2Pair token = IUniswapV2Pair(uniswapV2Pair);
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "Not enough LP tokens available to withdraw");
token.transfer(owner(), amount);
| IUniswapV2Pair token = IUniswapV2Pair(uniswapV2Pair);
uint256 amount = token.balanceOf(address(this));
require(amount > 0, "Not enough LP tokens available to withdraw");
token.transfer(owner(), amount);
| 11,601 |
0 | // Microservice Constructor metadataLink The IPFS location of the Metadata, saved in JSON Format / | constructor(string memory metadataLink) {
_metadataLink = metadataLink;
}
| constructor(string memory metadataLink) {
_metadataLink = metadataLink;
}
| 42,888 |
8 | // Removes the first bit from a label and returns the bit and a/ label containing the rest of the label (i.e. shifted to the left). | function chopFirstBit(Label memory self) internal pure returns (uint firstBit, Label memory tail) {
require(self.length > 0);
return (uint(self.data >> 255), Label(self.data << 1, self.length - 1));
}
| function chopFirstBit(Label memory self) internal pure returns (uint firstBit, Label memory tail) {
require(self.length > 0);
return (uint(self.data >> 255), Label(self.data << 1, self.length - 1));
}
| 28,673 |
73 | // The main contract managing Ramp Swaps escrows lifecycle: create, claim, release and return.Uses an abstract AssetAdapter to carry out the transfers and handle the particular asset data.With a corresponding off-chain protocol allows for atomic-swap-like transfer betweenfiat currencies and crypto assets.an active swap... | contract AbstractRampSwaps is Ownable, WithStatus, WithOracles, AssetAdapter {
/// @dev contract version, defined in semver
string public constant VERSION = "0.3.1";
/// @dev used as a special swap endTime value, to denote a yet unclaimed swap
uint32 internal constant SWAP_UNCLAIMED = 1;
uint32 in... | contract AbstractRampSwaps is Ownable, WithStatus, WithOracles, AssetAdapter {
/// @dev contract version, defined in semver
string public constant VERSION = "0.3.1";
/// @dev used as a special swap endTime value, to denote a yet unclaimed swap
uint32 internal constant SWAP_UNCLAIMED = 1;
uint32 in... | 9,391 |
157 | // Set access control roles | _setupRole(DEFAULT_ADMIN_ROLE, _admin);
| _setupRole(DEFAULT_ADMIN_ROLE, _admin);
| 9,615 |
1 | // is everything okay? | require(campaign.deadline < block.timestamp, "The deadline should be a date in the future," );
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollecte... | require(campaign.deadline < block.timestamp, "The deadline should be a date in the future," );
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollecte... | 12,275 |
287 | // returns the multiplier used to calculate the sell penalty/initialDeviation the percent from peg at start of trade/finalDeviation the percent from peg at the end of trade | function getSellPenaltyMultiplier(
Decimal.D256 calldata initialDeviation,
Decimal.D256 calldata finalDeviation
| function getSellPenaltyMultiplier(
Decimal.D256 calldata initialDeviation,
Decimal.D256 calldata finalDeviation
| 30,955 |
342 | // Strike's SErc20 Contract STokens which wrap an EIP-20 underlying Strike / | contract SErc20 is SToken, SErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | contract SErc20 is SToken, SErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptroller_ The address of the Comptroller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | 22,197 |
34 | // Red Eyes release token network limit | require(token.balanceOf(address(this)) < token_network_deposit_limit);
| require(token.balanceOf(address(this)) < token_network_deposit_limit);
| 16,875 |
209 | // See {Bozy - transferFrom} | function transferFrom(
address _from,
address _to,
uint256 _tokens
) public override returns (bool success) {
| function transferFrom(
address _from,
address _to,
uint256 _tokens
) public override returns (bool success) {
| 41,620 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.