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 |
|---|---|---|---|---|
118 | // transfer remainingamount to lastOwner | erc20Token.transferFrom(msg.sender, lastOwner2, lastOwner_funds);
| erc20Token.transferFrom(msg.sender, lastOwner2, lastOwner_funds);
| 45,334 |
28 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first r... | function approve(address _spender, uint256 _value) external returns (bool) {
require(allowed[msg.sender][_spender] == 0 || _value == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) external returns (bool) {
require(allowed[msg.sender][_spender] == 0 || _value == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 33,945 |
53 | // Assigns a new NFT to an address. Use and override this function with caution. Wrong usage can have serious consequences. _to Address to which we want to add the NFT. _tokenId Which NFT we want to add. / | function _addNFToken(address _to, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == address(0));
idToOwner[_tokenId] = _to;
uint256 length = ownerToIds[_to].push(_tokenId);
idToOwnerIndex[_tokenId] = length - 1;
}
| function _addNFToken(address _to, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == address(0));
idToOwner[_tokenId] = _to;
uint256 length = ownerToIds[_to].push(_tokenId);
idToOwnerIndex[_tokenId] = length - 1;
}
| 51,573 |
147 | // DolphinToken with Governance. | contract DolphinToken is BEP20("Dolphin Token", "Dolphin") {
// Burn address
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public... | contract DolphinToken is BEP20("Dolphin Token", "Dolphin") {
// Burn address
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public... | 8,098 |
18 | // check whether the signature is valid (assertionMethod) | address attesterAssertionMethod = (_assertionMethodMapping[tokenInfo.attester] == address(0) ? tokenInfo.attester : _assertionMethodMapping[tokenInfo.attester]);
if (Tokens.verifyAttesterSignature(attesterAssertionMethod, tokenInfo.attesterSignature, tokenInfo.digest, tokenInfo.vcVersion) == false) {
... | address attesterAssertionMethod = (_assertionMethodMapping[tokenInfo.attester] == address(0) ? tokenInfo.attester : _assertionMethodMapping[tokenInfo.attester]);
if (Tokens.verifyAttesterSignature(attesterAssertionMethod, tokenInfo.attesterSignature, tokenInfo.digest, tokenInfo.vcVersion) == false) {
... | 15,064 |
158 | // Emitted when a loan gets liquidated loan Loan that has been liquidated defaultedValue Remaining loan debt to repay withdrawnTru Amount of TRU transferred to compensate defaulted loan / | event Liquidated(ILoanToken2 loan, uint256 defaultedValue, uint256 withdrawnTru);
| event Liquidated(ILoanToken2 loan, uint256 defaultedValue, uint256 withdrawnTru);
| 72,285 |
8 | // if there are NO bids, the minimum bid is the reserve price | return market.reservePrice();
| return market.reservePrice();
| 17,399 |
59 | // PalPool errors | string public constant INSUFFICIENT_CASH = '9';
string public constant INSUFFICIENT_BALANCE = '10';
string public constant FAIL_DEPOSIT = '11';
string public constant FAIL_LOAN_INITIATE = '12';
string public constant FAIL_BORROW = '13';
string public constant ZERO_BORROW = '27';
string publi... | string public constant INSUFFICIENT_CASH = '9';
string public constant INSUFFICIENT_BALANCE = '10';
string public constant FAIL_DEPOSIT = '11';
string public constant FAIL_LOAN_INITIATE = '12';
string public constant FAIL_BORROW = '13';
string public constant ZERO_BORROW = '27';
string publi... | 51,906 |
106 | // Updates the catnip fee divider._val Number to divide votes by./ | function setVoteDiv(uint256 _val) public _onlyOwner delegatedOnly _updateState(msg.sender) {
voteDiv = _val;
}
| function setVoteDiv(uint256 _val) public _onlyOwner delegatedOnly _updateState(msg.sender) {
voteDiv = _val;
}
| 34,659 |
10 | // Override function Brings information about locked tokens from player_account on depositContract for the time of the game. _player Player address _value that will be given to the player in game session / | function startGame(address _player, uint256 _value) external {
// only registred depositContract is allowed to execute this function
require(msg.sender == address(m_playerDeposits));
// don't allow player to have two open sessions
require(openSessions[_player] == false);
//... | function startGame(address _player, uint256 _value) external {
// only registred depositContract is allowed to execute this function
require(msg.sender == address(m_playerDeposits));
// don't allow player to have two open sessions
require(openSessions[_player] == false);
//... | 39,288 |
344 | // Emitted when a Safe is gibbed./user The user who gibbed the Safe./to The recipient of the impounded collateral./assetAmount The amount of underling tokens impounded. | event SafeGibbed(address indexed user, address indexed to, uint256 assetAmount);
| event SafeGibbed(address indexed user, address indexed to, uint256 assetAmount);
| 34,933 |
107 | // Calculate x / y rounding towards zero, where x and y are signed 256-bitinteger numbers.Revert on overflow or when y is zero.x signed 256-bit integer number y signed 256-bit integer numberreturn signed 64.64-bit fixed point number / | function divi (int256 x, int256 y) internal pure returns (int128) {
unchecked {
require (y != 0);
bool negativeResult = false;
if (x < 0) {
x = -x; // We rely on overflow behavior here
negativeResult = true;
}
if (y < 0) {
y = -y; // W... | function divi (int256 x, int256 y) internal pure returns (int128) {
unchecked {
require (y != 0);
bool negativeResult = false;
if (x < 0) {
x = -x; // We rely on overflow behavior here
negativeResult = true;
}
if (y < 0) {
y = -y; // W... | 46,500 |
38 | // uint256[] attributes; attributes setting in another mapping per boxId. note: series should've all attributes [Done] uint256 attributesRarity;rarity should be 100, how to ensure ? from available attrubets fill them in 100 index of array as per their rarity. divide all available rarites into 100 | emit BoxMintNonGen(_boxId.current(), seriesId);
| emit BoxMintNonGen(_boxId.current(), seriesId);
| 28,511 |
343 | // tokenAmountsArray will keep track of the token amounts to be reinvested throughout the series of swaps, updating in place. here, it starts as the initially harvested SUSHI and dual reward token amounts. the order semantics are fixed, and match poolInfo.pathsFromRewards - see addPool() and updateRewardPath() above | uint256[] memory tokenAmountsArray = new uint256[](2);
tokenAmountsArray[0] = sushiAmount;
tokenAmountsArray[1] = rewardTokenAmount;
for (uint256 i = 0; i < 2; i++) {
| uint256[] memory tokenAmountsArray = new uint256[](2);
tokenAmountsArray[0] = sushiAmount;
tokenAmountsArray[1] = rewardTokenAmount;
for (uint256 i = 0; i < 2; i++) {
| 15,324 |
69 | // SafeMath Math operations with safety checks that throw on error / | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/... | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/... | 1,022 |
90 | // As the last deposit block exists, the block is also a check point on index curve. | uint256 accruedRate = IBank(globalConfig.bank()).getDepositAccruedRate(_token, tokenInfo.getLastDepositBlock());
return tokenInfo.calculateDepositInterest(accruedRate);
| uint256 accruedRate = IBank(globalConfig.bank()).getDepositAccruedRate(_token, tokenInfo.getLastDepositBlock());
return tokenInfo.calculateDepositInterest(accruedRate);
| 77,332 |
339 | // Adds liquidity to Uniswap V2 Pair and returns liquidity shares to the "getCaller()" address. | (amountA, amountB, liquidity) = _addLiquidity(redeem, underlying, params);
| (amountA, amountB, liquidity) = _addLiquidity(redeem, underlying, params);
| 13,229 |
193 | // Percentage of pool rewards that goes to the treasury. | uint256 public treasuryPercent;
| uint256 public treasuryPercent;
| 5,356 |
34 | // Initializes a new buffer from an existing bytes object. Changes to the buffer may mutate the original value. b The bytes object to initialize the buffer with.return A new buffer. / | function fromBytes(bytes memory b) internal pure returns (buffer memory) {
buffer memory buf;
buf.buf = b;
buf.capacity = b.length;
return buf;
}
| function fromBytes(bytes memory b) internal pure returns (buffer memory) {
buffer memory buf;
buf.buf = b;
buf.capacity = b.length;
return buf;
}
| 28,980 |
143 | // Get the hash of the participant addresses, ordered/ lexicographically/participant Address of a channel participant/partner Address of the other channel participant | function getParticipantsHash(address participant, address partner)
public
pure
returns (bytes32)
| function getParticipantsHash(address participant, address partner)
public
pure
returns (bytes32)
| 68,257 |
9 | // Remove last token address | feeTokensAddresses.pop();
delete feeTokensAddressesIndexes[_token];
| feeTokensAddresses.pop();
delete feeTokensAddressesIndexes[_token];
| 29,307 |
196 | // (bool _isStaker, ) = isStaker(msg.sender); | (bool _isStaker, ) = is_m_Staker(msg.sender);
require(_isStaker, "You are not staker");
_;
| (bool _isStaker, ) = is_m_Staker(msg.sender);
require(_isStaker, "You are not staker");
_;
| 18,998 |
15 | // Signer information./status Status of the signer./index Index of the signer. | struct SignerInfo {
SignerStatus status;
uint8 index;
}
| struct SignerInfo {
SignerStatus status;
uint8 index;
}
| 14,538 |
53 | // Calculate interest amount for a user with BIR and SIR (interal) handlerDataStorageAddr The address of handlerDataStorage contract userAddr The address of userreturn (bool, uint256, uint256, bool, uint256, uint256) / | function _calcInterestAmount(address handlerDataStorageAddr, address payable userAddr, uint256 delta, uint256 actionDepositEXR, uint256 actionBorrowEXR) internal view returns (bool, uint256, uint256, bool, uint256, uint256)
| function _calcInterestAmount(address handlerDataStorageAddr, address payable userAddr, uint256 delta, uint256 actionDepositEXR, uint256 actionBorrowEXR) internal view returns (bool, uint256, uint256, bool, uint256, uint256)
| 9,578 |
59 | // Account presale sales separately, so that they do not count against pricing tranches | uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals());
if(tokenAmount == 0) {
| uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals());
if(tokenAmount == 0) {
| 31,272 |
36 | // Make sure observationCardinalityNext has enough points on the lp_pool first Otherwise, any observation greater then 0 will return 0 values | (int56[] memory tickCumulatives, ) = lp_pool.observe(secondsAgo);
int24 avg_tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int32(twap_duration));
| (int56[] memory tickCumulatives, ) = lp_pool.observe(secondsAgo);
int24 avg_tick = int24((tickCumulatives[1] - tickCumulatives[0]) / int32(twap_duration));
| 24,688 |
250 | // Searches TWAB history and calculate the difference between amount(s)/timestamp(s) to return average balance_twabsIndividual user Observation recorded checkpoints passed as storage pointer_accountDetails User AccountDetails struct loaded in memory_targetTime Target timestamp to filter Observations in the ring buffer ... | function _getBalanceAt(
ObservationLib.Observation[MAX_CARDINALITY] storage _twabs,
AccountDetails memory _accountDetails,
uint32 _targetTime,
uint32 _currentTime
| function _getBalanceAt(
ObservationLib.Observation[MAX_CARDINALITY] storage _twabs,
AccountDetails memory _accountDetails,
uint32 _targetTime,
uint32 _currentTime
| 69,860 |
285 | // Indicates the priority given to shrinking the Uniswap position to account for/ decreased volatility. A value of 2 means that shrinking is half as important as/ sliding. | function DIVISOR_OF_SHRINK_URGENCY() external view returns (uint8);
| function DIVISOR_OF_SHRINK_URGENCY() external view returns (uint8);
| 33,871 |
11 | // adds account to the allowedBridges list/ meant to be used only for cross-chain bridging | function addToAllowedBridges(address account) external virtual onlyOwner {
bool isAllowed = allowedBridges[account];
require(!isAllowed, 'Already allowed');
allowedBridges[account] = true;
emit AddedToAllowedBridges(account);
}
| function addToAllowedBridges(address account) external virtual onlyOwner {
bool isAllowed = allowedBridges[account];
require(!isAllowed, 'Already allowed');
allowedBridges[account] = true;
emit AddedToAllowedBridges(account);
}
| 14,433 |
11 | // A mapping from PersonIDs to the price of the token. | mapping (uint256 => uint256) private personIndexToPrice;
| mapping (uint256 => uint256) private personIndexToPrice;
| 41,170 |
39 | // Order ID | bytes32 id;
| bytes32 id;
| 14,087 |
6 | // The third wallet receives the remaining tokens | IERC20(token).transfer(
_split[2],
IERC20(token).balanceOf(address(this))
);
| IERC20(token).transfer(
_split[2],
IERC20(token).balanceOf(address(this))
);
| 27,349 |
15 | // Interface of the ERC777TokensRecipient standard as defined in the EIP. | * Accounts can be notified of {IERC777} tokens being sent to them by having a
* contract implement this interface (contract holders can be their own
* implementer) and registering it on the
* https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
*
* See {IERC1820Registry} and {ERC1820Implementer}.
*/... | * Accounts can be notified of {IERC777} tokens being sent to them by having a
* contract implement this interface (contract holders can be their own
* implementer) and registering it on the
* https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
*
* See {IERC1820Registry} and {ERC1820Implementer}.
*/... | 7,156 |
105 | // Gets the token ID at a given index of all the tokens in this contractReverts if the index is greater or equal to the total number of tokens. index uint256 representing the index to be accessed of the tokens listreturn uint256 token ID at the given index of the tokens list / | function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
| function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
| 1,666 |
17 | // CompilerError: Stack too deep when compiling inline assembly: Variable length is 1 slot(s) too deep inside the stack. /returns the publisher of nft | // function getPublisher() public view returns (string memory) {
// return publisher;
// }
| // function getPublisher() public view returns (string memory) {
// return publisher;
// }
| 15,460 |
20 | // Set user state for last harvested | lastEpochIdHarvested[msg.sender] = epochId;
| lastEpochIdHarvested[msg.sender] = epochId;
| 17,969 |
290 | // Constructs the FeePayer contract. Called by child contracts. collateralAddress ERC20 token that is used as the underlying collateral for the synthetic. finderAddress UMA protocol Finder used to discover other protocol contracts. timerAddress Contract that stores the current time in a testing environment.Must be set ... | constructor(address collateralAddress, address finderAddress, address timerAddress) public Testable(timerAddress) {
collateralCurrency = IERC20(collateralAddress);
finder = FinderInterface(finderAddress);
lastPaymentTime = getCurrentTime();
cumulativeFeeMultiplier = FixedPoint.fromUn... | constructor(address collateralAddress, address finderAddress, address timerAddress) public Testable(timerAddress) {
collateralCurrency = IERC20(collateralAddress);
finder = FinderInterface(finderAddress);
lastPaymentTime = getCurrentTime();
cumulativeFeeMultiplier = FixedPoint.fromUn... | 11,935 |
5 | // Integer division of two numbers truncating the quotient, reverts on division by zero./ | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 1,751 |
153 | // mint USDP to user | vault.borrow(asset, user, usdpAmount);
| vault.borrow(asset, user, usdpAmount);
| 31,188 |
41 | // Attach the token contract, can only be done once | function setToken(address _tokenAddress) nonZeroAddress(_tokenAddress) onlyfounder {
require(tokenDeployed == false);
token = HRAToken(_tokenAddress);
tokenDeployed = true;
}
| function setToken(address _tokenAddress) nonZeroAddress(_tokenAddress) onlyfounder {
require(tokenDeployed == false);
token = HRAToken(_tokenAddress);
tokenDeployed = true;
}
| 50,016 |
41 | // we want miners to spend 10 minutes to mine each 'block', about 60 ethereum blocks = one ORAK 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
| 17,632 |
29 | // Get the network identifier that signers must sign overThis provides protection signatures being replayed on other chainsThis must be a virtual function because chain-specific contracts will need to override with their own network ids. It also can't be a field to allow this contract to be used by proxy with delegatec... | function getNetworkId() internal virtual pure returns (string memory) {
return 'ETHER';
}
| function getNetworkId() internal virtual pure returns (string memory) {
return 'ETHER';
}
| 6,971 |
17 | // @inheritdoc IERC165 | function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IRelayHub).interfaceId ||
interfaceId == type(Ownable).interfaceId ||
super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IRelayHub).interfaceId ||
interfaceId == type(Ownable).interfaceId ||
super.supportsInterface(interfaceId);
}
| 5,249 |
18 | // Calculates the needed bracket size based on the current round | uint256 currentBracketSize = 2**tournaments[_tournamentId].currentRound;
uint256 playerId1;
uint256 playerId2;
uint256 i = 0;
| uint256 currentBracketSize = 2**tournaments[_tournamentId].currentRound;
uint256 playerId1;
uint256 playerId2;
uint256 i = 0;
| 61,417 |
17 | // this assertion is required only for erc721 because the spend should correspond to the same NFT | if (registry.predicates(predicate) == Registry.Type.ERC721) {
require(
referenceTxData.closingBalance == _exit.receiptAmountOrNFTId && challengeTxData.amountOrToken == _exit.receiptAmountOrNFTId,
"LogTransferReceipt, challengeTx NFT and challenged utxo NFT do not match"
);
}
| if (registry.predicates(predicate) == Registry.Type.ERC721) {
require(
referenceTxData.closingBalance == _exit.receiptAmountOrNFTId && challengeTxData.amountOrToken == _exit.receiptAmountOrNFTId,
"LogTransferReceipt, challengeTx NFT and challenged utxo NFT do not match"
);
}
| 17,946 |
191 | // Fetches the pool's prices, ticks and lock status/ return sqrtP sqrt of current price: sqrt(token1/token0)/ return currentTick pool's current tick/ return nearestCurrentTick pool's nearest initialized tick that is <= currentTick/ return locked true if pool is locked, false otherwise | function getPoolState()
external
view
returns (uint160 sqrtP, int24 currentTick, int24 nearestCurrentTick, bool locked);
| function getPoolState()
external
view
returns (uint160 sqrtP, int24 currentTick, int24 nearestCurrentTick, bool locked);
| 4,166 |
31 | // Assigns the special transfer right, before transfers are enabled _to The address receiving the transfer grant / | function grantTransferRight(address _to) onlyOwner public {
require(!transferable);
require(!transferGrants[_to]);
require(_to != address(0));
transferGrants[_to] = true;
emit TransferRightGiven(_to);
}
| function grantTransferRight(address _to) onlyOwner public {
require(!transferable);
require(!transferGrants[_to]);
require(_to != address(0));
transferGrants[_to] = true;
emit TransferRightGiven(_to);
}
| 45,494 |
102 | // Set maxPriceDiff. _maxPriceDiff Numberator to calculate max allowed difference between Vader / ETH TWAP and spot price. / | function _setMaxPriceDiff(uint _maxPriceDiff) private {
require(
_maxPriceDiff <= MAX_PRICE_DIFF_DENOMINATOR,
"price diff > max"
);
maxPriceDiff = _maxPriceDiff;
}
| function _setMaxPriceDiff(uint _maxPriceDiff) private {
require(
_maxPriceDiff <= MAX_PRICE_DIFF_DENOMINATOR,
"price diff > max"
);
maxPriceDiff = _maxPriceDiff;
}
| 16,852 |
36 | // Returns the token name./ | function name() external view override returns (string memory) {
return _name;
}
| function name() external view override returns (string memory) {
return _name;
}
| 1,109 |
70 | // the intical price of token | uint256 private tokenPerETH = 0;
| uint256 private tokenPerETH = 0;
| 41,027 |
20 | // Save the receipt before performing any other action | intentReceipt[id] = _encodeReceipt(false, block.number, msg.sender);
| intentReceipt[id] = _encodeReceipt(false, block.number, msg.sender);
| 50,781 |
6 | // get code | extcodecopy(_address, add(code, 0x20), 0, size)
| extcodecopy(_address, add(code, 0x20), 0, size)
| 41,107 |
27 | // olit address | address public immutable olit;
| address public immutable olit;
| 10,382 |
24 | // We need to track how much of the received ETH was used and wrapped into WETH to return any excess. | uint256 wrappedEth = 0;
finalBalances = new bytes32[](balances.length);
for (uint256 i = 0; i < change.assets.length; ++i) {
uint256 amountIn = amountsIn[i];
_require(amountIn <= change.limits[i], Errors.JOIN_ABOVE_MAX);
| uint256 wrappedEth = 0;
finalBalances = new bytes32[](balances.length);
for (uint256 i = 0; i < change.assets.length; ++i) {
uint256 amountIn = amountsIn[i];
_require(amountIn <= change.limits[i], Errors.JOIN_ABOVE_MAX);
| 45,373 |
28 | // Sets the `merkleRootHash` for (`edition`, `mintId`). editionAddress of the song edition contract we are minting for. mintId The mint ID. merkleRootHash The Merkle root hash of the entries. / | function setMerkleRootHash(
| function setMerkleRootHash(
| 36,873 |
147 | // Finds the max amount of value an `owner` can remove from the cellar. owner address of the user to find max value. inShares if false, then returns value in terms of assetsif true then returns value in terms of shares / | function _findMax(address owner, bool inShares) internal view returns (uint256 maxOut) {
// Check if owner shares are locked, return 0 if so.
uint256 lockTime = userShareLockStartTime[owner];
if (lockTime != 0) {
uint256 timeSharesAreUnlocked = lockTime + shareLockPeriod;
... | function _findMax(address owner, bool inShares) internal view returns (uint256 maxOut) {
// Check if owner shares are locked, return 0 if so.
uint256 lockTime = userShareLockStartTime[owner];
if (lockTime != 0) {
uint256 timeSharesAreUnlocked = lockTime + shareLockPeriod;
... | 3,883 |
26 | // Layer 1 contract for bridging ERC20s and custom fungible tokens This contract handles token deposits, holds the escrowed tokens on layer 1, and (ulimately) finalizes withdrawals. Custom tokens that are sufficiently "weird," (i.e., dynamic supply adjustment, say) should use their own, custom bridge.All messages to la... | contract EthERC20Bridge is IEthERC20Bridge, WhitelistConsumer, TokenAddressHandler {
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../arbitrum/IArbTokenBridge.sol";
import "arb-bridge-eth/contracts/bridge/interfaces/IInbox.sol";
import "../../buddybridge/ethereum/L1Buddy.sol";
import "arb-brid... | contract EthERC20Bridge is IEthERC20Bridge, WhitelistConsumer, TokenAddressHandler {
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../arbitrum/IArbTokenBridge.sol";
import "arb-bridge-eth/contracts/bridge/interfaces/IInbox.sol";
import "../../buddybridge/ethereum/L1Buddy.sol";
import "arb-brid... | 32,955 |
4 | // Restrict the accessors of functions which apply this modifier | modifier onlyOwner{
if (msg.sender != serviceProvider){
throw; //throw in Solidity will consume all the gas message sender provide
}else{
_;
}
}
| modifier onlyOwner{
if (msg.sender != serviceProvider){
throw; //throw in Solidity will consume all the gas message sender provide
}else{
_;
}
}
| 3,427 |
7 | // Default to 0, so to paused | SalePhase public currentPhase;
| SalePhase public currentPhase;
| 2,513 |
16 | // If the version is correct return the signer address | if (v != 27 && v != 28) {
return false;
} else {
| if (v != 27 && v != 28) {
return false;
} else {
| 19,181 |
14 | // the owedTokens of the two BucketLenders must be the same | require (
owedToken == BucketLender(withdrawFrom).OWED_TOKEN(),
"BucketLenderTokenProxy#rollover: Token mismatch"
);
| require (
owedToken == BucketLender(withdrawFrom).OWED_TOKEN(),
"BucketLenderTokenProxy#rollover: Token mismatch"
);
| 52,744 |
40 | // ------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------ | function allowance(address tokenOwner, address spender) public view returns(uint remaining) {
return allowed[tokenOwner][spender];
}
| function allowance(address tokenOwner, address spender) public view returns(uint remaining) {
return allowed[tokenOwner][spender];
}
| 38,281 |
56 | // this is necessary to avoid multiplication overflow. | uint private constant PROFIT_DERIVATIVE_DOWNSCALING_BITS_STEP = 8;
| uint private constant PROFIT_DERIVATIVE_DOWNSCALING_BITS_STEP = 8;
| 41,129 |
33 | // Update the sum of tokens sold during the presale. | totalTokensSold = totalTokensSold.add(_tokenAmount).add(bonus);
| totalTokensSold = totalTokensSold.add(_tokenAmount).add(bonus);
| 34,046 |
2 | // Emit an event when the contract is deployed. | event ContractDeployed(address indexed owner, string contractUri, string name, string symbol, address indexed defaultReceiverRoyalty, uint96 indexed defaultPercentageRoyalty);
| event ContractDeployed(address indexed owner, string contractUri, string name, string symbol, address indexed defaultReceiverRoyalty, uint96 indexed defaultPercentageRoyalty);
| 17,894 |
57 | // Private Function to remap file from one group to another self is the pointer to the File Struct (IceFMS Library) passed _existingFileIndex is the file index in the user's FMS files mapping _oldGroup is the pointer to the old group where the file was present in the user's FMS _newGroup is the pointer to the new group... | function remapFileToGroup(
File storage self,
uint _existingFileIndex,
Group storage _oldGroup,
Group storage _newGroup,
uint _newGroupIndex
)
public
| function remapFileToGroup(
File storage self,
uint _existingFileIndex,
Group storage _oldGroup,
Group storage _newGroup,
uint _newGroupIndex
)
public
| 32,373 |
434 | // User burn function for token id. tokenId token edition identifier to burn / | function burn(uint256 tokenId) external {
require(_isApprovedOrOwner(_msgSender(), tokenId), "Not approved");
_burn(tokenId);
}
| function burn(uint256 tokenId) external {
require(_isApprovedOrOwner(_msgSender(), tokenId), "Not approved");
_burn(tokenId);
}
| 15,981 |
26 | // emitted after each successful withdrawalaccount Address that funds were withdrawn toethAmount Amount of ETH withdrawntokens Addresses of ERC20s withdrawntokenAmounts Amounts of corresponding ERC20s withdrawn / | event Withdrawal(
| event Withdrawal(
| 72,455 |
315 | // add equivalent underlying MOVE for MOVE-ETH LP | uint256 moveInLP = IERC20Upgradeable(tokenMoveEthLPAddress).balanceOf(tokenMoveAddress);
uint256 totalLP = IERC20Upgradeable(tokenMoveEthLPAddress).totalSupply();
if (totalLP > 0) {
totalMoveStakedEquivalent = totalMoveStakedEquivalent.add(totalStakedMoveEthLP.mul(moveInLP).div(totalLP));
... | uint256 moveInLP = IERC20Upgradeable(tokenMoveEthLPAddress).balanceOf(tokenMoveAddress);
uint256 totalLP = IERC20Upgradeable(tokenMoveEthLPAddress).totalSupply();
if (totalLP > 0) {
totalMoveStakedEquivalent = totalMoveStakedEquivalent.add(totalStakedMoveEthLP.mul(moveInLP).div(totalLP));
... | 80,147 |
155 | // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` | bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
| bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
| 7,719 |
67 | // Delete the slot where the moved value was stored | set._values.pop();
| set._values.pop();
| 349 |
9 | // Lockup duration in seconds for each time period | uint64 public lockupDuration = 604800;
| uint64 public lockupDuration = 604800;
| 47,690 |
14 | // Addresses of Zion stackers.Reload each time globalClaim is activated | address[] private _zionStackers;
| address[] private _zionStackers;
| 31,097 |
144 | // Read the first 32 bytes of _preBytes storage, which is the length of the array. (We don't need to use the offset into the slot because arrays use the entire slot.) | let fslot := sload(_preBytes.slot)
| let fslot := sload(_preBytes.slot)
| 74,822 |
110 | // Find out why USDC transfer reverted (doesn't give revert reasons). | _DIAGNOSEANDEMITUSDCSPECIFICERROR976(_usdc146.TRANSFER153.selector);
| _DIAGNOSEANDEMITUSDCSPECIFICERROR976(_usdc146.TRANSFER153.selector);
| 27,283 |
13 | // Schedules an action for execution, allowing for challenges and vetos on a defined time window. Pulls collateral from submitter into contract. _container A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and / | function schedule(ERC3000Data.Container memory _container) // TO FIX: Container is in memory and function has to be public to avoid an unestrutable solidity crash
public
override
auth(this.schedule.selector) // note that all functions in this contract are ACL protected (commonly some of them... | function schedule(ERC3000Data.Container memory _container) // TO FIX: Container is in memory and function has to be public to avoid an unestrutable solidity crash
public
override
auth(this.schedule.selector) // note that all functions in this contract are ACL protected (commonly some of them... | 16,528 |
192 | // Destroys 'tokenId'.The approval is cleared when the token is burned.This is an internal function that does not check if the sender is authorized to operate on the token. Requirements: - 'tokenId' must exist. | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by '_beforeTokenTransfer' hook
... | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by '_beforeTokenTransfer' hook
... | 20,748 |
21 | // require(msg.value > 0, "Fund must be more than 0"); | Project storage project = stagesToProject[stageCount][projectId];
Stage storage stage = stages[stageCount];
require(project.stageId != 0, "Project not initialized");
require(
!isAddressFundProject[msg.sender][stageCount][projectId],
"You have funded already"
... | Project storage project = stagesToProject[stageCount][projectId];
Stage storage stage = stages[stageCount];
require(project.stageId != 0, "Project not initialized");
require(
!isAddressFundProject[msg.sender][stageCount][projectId],
"You have funded already"
... | 28,270 |
75 | // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. | _balances[to] += value;
| _balances[to] += value;
| 9,311 |
10 | // Grants the smart contract role to an address The sender must have the admin role _address EOA or contract receiving the new role / | function addSmartContractRole(address _address) external {
grantRole(SMART_CONTRACT_ROLE, _address);
emit SmartContractRoleGranted(_address, _msgSender());
}
| function addSmartContractRole(address _address) external {
grantRole(SMART_CONTRACT_ROLE, _address);
emit SmartContractRoleGranted(_address, _msgSender());
}
| 9,323 |
77 | // Keep track of who burned the token, and the timestamp of burning. | _ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
| _ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
| 3,961 |
207 | // the auxiliary function for payback./ | function _paybackWorth(uint256 worth,uint256 feeType) internal {
uint256 totalPrice = 0;
uint whiteLen = whiteList.length;
uint256[] memory balances = new uint256[](whiteLen);
uint256 i=0;
for(;i<whiteLen;i++){
address addr = whiteList[i];
if (checkAdd... | function _paybackWorth(uint256 worth,uint256 feeType) internal {
uint256 totalPrice = 0;
uint whiteLen = whiteList.length;
uint256[] memory balances = new uint256[](whiteLen);
uint256 i=0;
for(;i<whiteLen;i++){
address addr = whiteList[i];
if (checkAdd... | 54,836 |
95 | // ISetToken Set Protocol The ISetToken interface provides a light-weight, structured way to interact with theSetToken contract from another contract. / | interface ISetToken {
/* ============ External Functions ============ */
/*
* Get natural unit of Set
*
* @return uint256 Natural unit of Set
*/
function naturalUnit()
external
view
returns (uint256);
/*
* Get addresses of all components in the ... | interface ISetToken {
/* ============ External Functions ============ */
/*
* Get natural unit of Set
*
* @return uint256 Natural unit of Set
*/
function naturalUnit()
external
view
returns (uint256);
/*
* Get addresses of all components in the ... | 7,031 |
38 | // Balance of contract, minus eth balance of user and accrued dev fees | return this.balance.sub(ethBalanceOf(_customerAddress)).sub(devFeeBalance);
| return this.balance.sub(ethBalanceOf(_customerAddress)).sub(devFeeBalance);
| 7,061 |
1 | // Emit when borrow action occurs.sender who calls {IVault-borrow} receiver of the borrowed 'debt' amount owner who will incur the debt debt amount shares amount of 'debtShares' received / | event Borrow(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 debt,
uint256 shares
);
| event Borrow(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 debt,
uint256 shares
);
| 13,620 |
2 | // Mapping from NFT ID to metadata uri. / | mapping (uint256 => string) internal idToUri;
| mapping (uint256 => string) internal idToUri;
| 27,092 |
3 | // emit LogFundsAdded(receiver2, half);uint mod = msg.value %2; | funds[msg.sender] = funds[msg.sender]+msg.value %2;
emit LogFundsAdded(msg.sender, msg.value, receiver1, receiver2);
| funds[msg.sender] = funds[msg.sender]+msg.value %2;
emit LogFundsAdded(msg.sender, msg.value, receiver1, receiver2);
| 1,239 |
4 | // Adds the given key and value to the enumerable mapping. self The enumerable mapping to update. offset The offset to add to the key. key The key to add. value The value associated with the key.return True if the key was added to the enumerable mapping, that is if it was not already in the enumerable mapping. / | function _add(
| function _add(
| 17,326 |
12 | // structs and enums | struct ContractOwner {
string name;
uint8 age;
address userAddress;
bool isNice;
}
| struct ContractOwner {
string name;
uint8 age;
address userAddress;
bool isNice;
}
| 23,160 |
85 | // 1.0 - Get the dial's reward balance | if (dialData.balance == 0) {
continue;
}
| if (dialData.balance == 0) {
continue;
}
| 63,887 |
20 | // Assigns a new address to act as the CEO. Only available to the current CEO./_newCEO The address of the new CEO | function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
newCeoAddress = _newCEO;
}
| function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
newCeoAddress = _newCEO;
}
| 28,157 |
78 | // Getter for rebalancing period for a vault | function getRebalancingPeriod(uint256 _vaultNumber) public view returns (uint256) {
return vaults[_vaultNumber].rebalancingPeriod;
}
| function getRebalancingPeriod(uint256 _vaultNumber) public view returns (uint256) {
return vaults[_vaultNumber].rebalancingPeriod;
}
| 22,350 |
20 | // calculate ETH returned | uint256 ethReturned = IBondingCurve(bondingCurve).calculateSaleReturn(
totalSupply,
poolBalance,
reserveRatio,
_tokens
);
require(ethReturned >= _minETHReturned, "Slippage");
| uint256 ethReturned = IBondingCurve(bondingCurve).calculateSaleReturn(
totalSupply,
poolBalance,
reserveRatio,
_tokens
);
require(ethReturned >= _minETHReturned, "Slippage");
| 32,792 |
108 | // Copy over the first `submod` bytes of the new data as in case 1 above. | let slengthmod := mod(slength, 32)
let mlengthmod := mod(mlength, 32)
let submod := sub(32, slengthmod)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
... | let slengthmod := mod(slength, 32)
let mlengthmod := mod(mlength, 32)
let submod := sub(32, slengthmod)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
... | 1,491 |
1,858 | // 931 | entry "salutiferously" : ENG_ADVERB
| entry "salutiferously" : ENG_ADVERB
| 21,767 |
23 | // Gets the last payment cashed out by the specified _investor/ | function getLastPayment(address _aInvestor) public view returns (uint256) {
return mapLastPaymentSnapshot[_aInvestor];
}
| function getLastPayment(address _aInvestor) public view returns (uint256) {
return mapLastPaymentSnapshot[_aInvestor];
}
| 8,600 |
126 | // Get a value from the set Since set length is > 0 it is guaranteed that there is a value at index 0 | uint256 value = boostedNftIds.at(0);
| uint256 value = boostedNftIds.at(0);
| 39,432 |
0 | // Just needed for testing !! | contract WETHY {
constructor () {}
} | contract WETHY {
constructor () {}
} | 22,604 |
70 | // volt balance of contract/ return volt amount held | function voltBalance() public view override returns (uint256) {
return _volt.balanceOf(address(this));
}
| function voltBalance() public view override returns (uint256) {
return _volt.balanceOf(address(this));
}
| 48,393 |
5 | // Searches train from a given source to destination/source Source/destination Destination/ return Array of Trains starting at source and ending at destination | function searchTrains(string memory source, string memory destination)
public
view
returns (Train[] memory)
| function searchTrains(string memory source, string memory destination)
public
view
returns (Train[] memory)
| 35,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.