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 |
|---|---|---|---|---|
10 | // ROYALTY FUNCTIONS / | function getRoyalties(uint256) external view returns (address payable[] memory recipients, uint256[] memory bps);
| function getRoyalties(uint256) external view returns (address payable[] memory recipients, uint256[] memory bps);
| 20,184 |
6 | // What's better than withdrawing? Re-investing profits! | function reinvest()
checkZeroBalance()
| function reinvest()
checkZeroBalance()
| 28,126 |
32 | // math calculations work with the assumption that the price diff is capped to 5% since tick distance is uncapped between currentTick and nextTick we use tempNextTick to satisfy our assumption with MAX_TICK_DISTANCE is set to be matched this condition |
int24 tempNextTick = swapData.nextTick;
if (willUpTick && tempNextTick > C.MAX_TICK_DISTANCE + swapData.currentTick) {
tempNextTick = swapData.currentTick + C.MAX_TICK_DISTANCE;
} else if (!willUpTick && tempNextTick < swapData.currentTick - C.MAX_TICK_DISTANCE) {
|
int24 tempNextTick = swapData.nextTick;
if (willUpTick && tempNextTick > C.MAX_TICK_DISTANCE + swapData.currentTick) {
tempNextTick = swapData.currentTick + C.MAX_TICK_DISTANCE;
} else if (!willUpTick && tempNextTick < swapData.currentTick - C.MAX_TICK_DISTANCE) {
| 26,853 |
12 | // Mapping of Item to a TokenStatus struct | mapping(uint256 => TokenStatus) private _idToItemStatus;
| mapping(uint256 => TokenStatus) private _idToItemStatus;
| 11,240 |
169 | // scale rate proportionally up to 100% | uint256 thisMaxRange = WEI_PERCENT_PRECISION - thisKinkLevel; // will not overflow
utilRate -= thisKinkLevel;
if (utilRate > thisMaxRange)
utilRate = thisMaxRange;
thisMaxRate = thisRateMultiplier
.add(thisBaseRate)
.mul(t... | uint256 thisMaxRange = WEI_PERCENT_PRECISION - thisKinkLevel; // will not overflow
utilRate -= thisKinkLevel;
if (utilRate > thisMaxRange)
utilRate = thisMaxRange;
thisMaxRate = thisRateMultiplier
.add(thisBaseRate)
.mul(t... | 13,988 |
27 | // Get media URI for a given Avastar Token ID. _tokenId the Token ID of a previously minted Avastar Prime or Replicantreturn uri the off-chain URI to the Avastar image / | function mediaURI(uint _tokenId)
public view
returns (string memory uri)
| function mediaURI(uint _tokenId)
public view
returns (string memory uri)
| 7,596 |
469 | // Update fee, implicitly requiring that partner name is registered | uint256 oldFee = _setPartnerFeeByIndex(indexByName(name) - 1, newFee);
| uint256 oldFee = _setPartnerFeeByIndex(indexByName(name) - 1, newFee);
| 11,556 |
1 | // Hashing function | Hasher hasher;
| Hasher hasher;
| 51,247 |
203 | // 1,2 period, 1,2 period | if(fromPeriod == 1 && toPeriod == 1) {
return _to.sub(_from).mul(64);
| if(fromPeriod == 1 && toPeriod == 1) {
return _to.sub(_from).mul(64);
| 8,915 |
361 | // if no time has passed since the reference time, return current weights (also ensures a single update per block) | uint256 elapsedTime = currentTime - referenceTime;
if (elapsedTime == 0) {
return (primaryReserveWeight, externalPrimaryReserveWeight);
}
| uint256 elapsedTime = currentTime - referenceTime;
if (elapsedTime == 0) {
return (primaryReserveWeight, externalPrimaryReserveWeight);
}
| 17,431 |
8 | // Upgrade a pass / | function _upgradePass(uint256 tokenId, uint8 level) private {
_tokenLevel[tokenId] = level;
emit TokenLevel(tokenId, level);
}
| function _upgradePass(uint256 tokenId, uint8 level) private {
_tokenLevel[tokenId] = level;
emit TokenLevel(tokenId, level);
}
| 10,152 |
118 | // Calculate binary exponent of x.Revert on overflow.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function exp_2 (int128 x) internal pure returns (int128) {
unchecked {
require (x < 0x400000000000000000); // Overflow
if (x < -0x400000000000000000) return 0; // Underflow
uint256 result = 0x80000000000000000000000000000000;
if (x & 0x8000000000000000 > 0)
result ... | function exp_2 (int128 x) internal pure returns (int128) {
unchecked {
require (x < 0x400000000000000000); // Overflow
if (x < -0x400000000000000000) return 0; // Underflow
uint256 result = 0x80000000000000000000000000000000;
if (x & 0x8000000000000000 > 0)
result ... | 46,511 |
173 | // Internal call to refund all WETH to the current executor as native ETH. | function doRefundETH() internal {
uint balance = IWETH(weth).balanceOf(address(this));
if (balance > 0) {
IWETH(weth).withdraw(balance);
(bool success, ) = bank.EXECUTOR().call{value: balance}(new bytes(0));
require(success, 'refund ETH failed');
}
}
| function doRefundETH() internal {
uint balance = IWETH(weth).balanceOf(address(this));
if (balance > 0) {
IWETH(weth).withdraw(balance);
(bool success, ) = bank.EXECUTOR().call{value: balance}(new bytes(0));
require(success, 'refund ETH failed');
}
}
| 54,105 |
361 | // Check if player has already minted and record | if (hasMintedPreMarket[player]) {
return;
}
| if (hasMintedPreMarket[player]) {
return;
}
| 12,329 |
26 | // add the ambassadors here - Tokens will be distributed to these addresses from main premine | ambassadors_[0xb2A13A5AE7922325290ce4eAf5029Ef18045Ee2B] = true;
| ambassadors_[0xb2A13A5AE7922325290ce4eAf5029Ef18045Ee2B] = true;
| 44,858 |
85 | // index_delta = w_1_omega - w_1 | let index_delta := addmod(mload(W1_OMEGA_EVAL_LOC), sub(p, mload(W1_EVAL_LOC)), p)
| let index_delta := addmod(mload(W1_OMEGA_EVAL_LOC), sub(p, mload(W1_EVAL_LOC)), p)
| 32,476 |
11 | // returns allocated result | function allocate(address staking, uint rewardAmount) external view returns (uint stakingPart, address[] memory others, uint[] memory othersParts);
| function allocate(address staking, uint rewardAmount) external view returns (uint stakingPart, address[] memory others, uint[] memory othersParts);
| 47,727 |
24 | // `onlyDonor` Approves the proposed milestone list/_hashProposals The keccak256() of the proposed milestone list's/bytecode; this confirms that the `donor` knows the set of milestones/they are approving | function acceptProposedMilestones(bytes32 _hashProposals
| function acceptProposedMilestones(bytes32 _hashProposals
| 40,336 |
167 | // Enumerable mapping from token ids to their owners | EnumerableMap.UintToAddressMap private _tokenOwners;
| EnumerableMap.UintToAddressMap private _tokenOwners;
| 4,821 |
90 | // totalICO = totalICO.sub(token.balanceOf(msg.sender)); | }
| }
| 47,456 |
104 | // Kyber Network main contract | contract KyberNetwork is Withdrawable, Utils2, KyberNetworkInterface, ReentrancyGuard {
bytes public constant PERM_HINT = "PERM";
uint public constant PERM_HINT_GET_RATE = 1 << 255; // for get rate. bit mask hint.
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveI... | contract KyberNetwork is Withdrawable, Utils2, KyberNetworkInterface, ReentrancyGuard {
bytes public constant PERM_HINT = "PERM";
uint public constant PERM_HINT_GET_RATE = 1 << 255; // for get rate. bit mask hint.
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveI... | 80,216 |
2 | // address public constant CURVE_PREMINT_RESERVE = address(uint160(uint256(keccak256("CURVE_PREMINT_RESERVE")) - 1)); | address public constant CURVE_PREMINT_RESERVE = 0x3cc5B802b34A42Db4cBe41ae3aD5c06e1A4481c9;
| address public constant CURVE_PREMINT_RESERVE = 0x3cc5B802b34A42Db4cBe41ae3aD5c06e1A4481c9;
| 73,084 |
55 | // The next contract where the tokens will be migrated. | TokenUpgrader public tokenUpgrader;
| TokenUpgrader public tokenUpgrader;
| 13,266 |
32 | // Starting Added Time (SAT) | uint256 constant public SAT = 30; // seconds
| uint256 constant public SAT = 30; // seconds
| 15,751 |
12 | // Returns message's body field as bytes29 (refer to TypedMemView library for details on bytes29 type) | function body(bytes29 _message) internal pure returns (bytes29) {
return _message.slice(PREFIX_LENGTH, _message.len() - PREFIX_LENGTH, 0);
}
| function body(bytes29 _message) internal pure returns (bytes29) {
return _message.slice(PREFIX_LENGTH, _message.len() - PREFIX_LENGTH, 0);
}
| 23,858 |
12 | // This allows for gas(less) future collection approval for cross-collection interaction. | mapping(address => bool) public proxyToApproved;
| mapping(address => bool) public proxyToApproved;
| 22,079 |
3 | // See {IERC721Collection-withdraw}. / | function withdraw(address payable recipient, uint256 amount) external override adminRequired {
_withdraw(recipient, amount);
}
| function withdraw(address payable recipient, uint256 amount) external override adminRequired {
_withdraw(recipient, amount);
}
| 62,807 |
9 | // transfer user's cashback to his wallet / | function withdrawCashback() public activeOnly {
uint256 amount = totalCashback[msg.sender];
totalCashback[msg.sender] = 0;
msg.sender.transfer(amount);
emit CashbackWithdrawn(msg.sender, amount);
}
| function withdrawCashback() public activeOnly {
uint256 amount = totalCashback[msg.sender];
totalCashback[msg.sender] = 0;
msg.sender.transfer(amount);
emit CashbackWithdrawn(msg.sender, amount);
}
| 31,840 |
26 | // As defined in the 'ERC777TokensSender And The tokensToSend Hook' section of https:eips.ethereum.org/EIPS/eip-777 | interface IERC777Sender {
function tokensToSend(address operator, address from, address to, uint256 amount, bytes calldata data,
bytes calldata operatorData) external;
}
| interface IERC777Sender {
function tokensToSend(address operator, address from, address to, uint256 amount, bytes calldata data,
bytes calldata operatorData) external;
}
| 2,481 |
126 | // Claim Aave. Also unstake all Aave if favorable condition exits or start cooldown. If we unstake all Aave, we can't start cooldown because it requires StakedAave balance. DO NOT convert 'if else' to 2 'if's as we are reading cooldown state once to save gas. / | function _claimAave() internal returns (uint256) {
(uint256 _cooldownStart, uint256 _cooldownEnd, uint256 _unstakeEnd) = cooldownData();
if (_cooldownStart == 0 || block.timestamp > _unstakeEnd) {
// claim stkAave when its first rebalance or unstake period passed.
address[] m... | function _claimAave() internal returns (uint256) {
(uint256 _cooldownStart, uint256 _cooldownEnd, uint256 _unstakeEnd) = cooldownData();
if (_cooldownStart == 0 || block.timestamp > _unstakeEnd) {
// claim stkAave when its first rebalance or unstake period passed.
address[] m... | 46,821 |
3 | // Emitted when ETH is transferred to a recipient through this split contract. account The account which received payment. amount The amount of ETH payment sent to this recipient. / | event ETHTransferred(address indexed account, uint256 amount);
| event ETHTransferred(address indexed account, uint256 amount);
| 20,182 |
116 | // Delegate call to get total supplyreturn Total supply / | function delegateTotalSupply() public view returns (uint256) {
return totalSupply();
}
| function delegateTotalSupply() public view returns (uint256) {
return totalSupply();
}
| 11,614 |
19 | // Emits an {Approval} event. Parameters check should be carried out before calling this function. / | function _approve(address owner, address spender, uint256 amount) internal {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| function _approve(address owner, address spender, uint256 amount) internal {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 36,732 |
74 | // Events | event Reinvest(address indexed caller, uint256 reward, uint256 bounty);
event AddShare(uint256 indexed id, uint256 share);
event RemoveShare(uint256 indexed id, uint256 share);
event Liquidate(uint256 indexed id, uint256 wad);
| event Reinvest(address indexed caller, uint256 reward, uint256 bounty);
event AddShare(uint256 indexed id, uint256 share);
event RemoveShare(uint256 indexed id, uint256 share);
event Liquidate(uint256 indexed id, uint256 wad);
| 43,218 |
1,500 | // 751 | entry "unpaced" : ENG_ADJECTIVE
| entry "unpaced" : ENG_ADJECTIVE
| 17,363 |
4 | // Creates a DataOrder. The `msg.sender` will become the buyer of the order. audience Target audience of the order. price Price that sellers will receive in exchange of their data. requestedData Requested data type (Geolocation, Facebook, etc). termsAndConditionsHash Hash of the Buyer's terms and conditions for the ord... | function createDataOrder(
string calldata audience,
uint256 price,
string calldata requestedData,
bytes32 termsAndConditionsHash,
string calldata buyerUrl
| function createDataOrder(
string calldata audience,
uint256 price,
string calldata requestedData,
bytes32 termsAndConditionsHash,
string calldata buyerUrl
| 49,440 |
3 | // First delegate gets to initialize the delegator (i.e. storage contract) | delegateTo(implementation, abi.encodeWithSignature("initialize(address,address,address,address,uint256,uint256,string,string,uint8)",
underlying_,
registry_,
... | delegateTo(implementation, abi.encodeWithSignature("initialize(address,address,address,address,uint256,uint256,string,string,uint8)",
underlying_,
registry_,
... | 3,075 |
72 | // Tell the network... | emit onRebase(totalBalance(), _currentTimestamp);
| emit onRebase(totalBalance(), _currentTimestamp);
| 21,309 |
135 | // Safe NTS transfer function, just in case if rounding error causes pool to not have enough NTSs. | function safeNTSTransfer(address _to, uint256 _amount) internal {
uint256 NTSBal = NTS.balanceOf(address(this));
if (_amount > NTSBal) {
NTS.transfer(_to, NTSBal);
} else {
NTS.transfer(_to, _amount);
}
}
| function safeNTSTransfer(address _to, uint256 _amount) internal {
uint256 NTSBal = NTS.balanceOf(address(this));
if (_amount > NTSBal) {
NTS.transfer(_to, NTSBal);
} else {
NTS.transfer(_to, _amount);
}
}
| 15,713 |
3 | // Lib Sanitize/Utilities to sanitize input values | library LibSanitize {
/// @notice Reverts if address is 0
/// @param _address Address to check
function _notZeroAddress(address _address) internal pure {
if (_address == address(0)) {
revert LibErrors.InvalidZeroAddress();
}
}
/// @notice Reverts if string is empty
/... | library LibSanitize {
/// @notice Reverts if address is 0
/// @param _address Address to check
function _notZeroAddress(address _address) internal pure {
if (_address == address(0)) {
revert LibErrors.InvalidZeroAddress();
}
}
/// @notice Reverts if string is empty
/... | 43,500 |
147 | // Extend parent behavior requiring beneficiary to be in whitelist. _beneficiary Token beneficiary _weiAmount Amount of wei contributed / | function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
isWhitelisted(_beneficiary)
| function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
isWhitelisted(_beneficiary)
| 41,131 |
13 | // Vest the next PNG allocation. Requires vestingCliff seconds in between calls. PNG willbe distributed to the recipient. / | function claim() external nonReentrant returns (uint) {
require(vestingEnabled, 'TreasuryVester::claim: vesting not enabled');
require(msg.sender == recipient, 'TreasuryVester::claim: only recipient can claim');
require(block.timestamp >= lastUpdate + vestingCliff, 'TreasuryVester::claim: no... | function claim() external nonReentrant returns (uint) {
require(vestingEnabled, 'TreasuryVester::claim: vesting not enabled');
require(msg.sender == recipient, 'TreasuryVester::claim: only recipient can claim');
require(block.timestamp >= lastUpdate + vestingCliff, 'TreasuryVester::claim: no... | 30,423 |
3 | // Modifier to ensure only current EVs can execute a function | modifier onlyEv() {
require(current_evs[msg.sender] == true);
_;
}
| modifier onlyEv() {
require(current_evs[msg.sender] == true);
_;
}
| 47,612 |
11 | // Marketing100,000,000 (10%) | uint constant public maxMktSupply = 100000000 * E18;
| uint constant public maxMktSupply = 100000000 * E18;
| 83,436 |
10 | // ---------------------------------------------------DPS:TEST : NEW | if (_key == 170) {
trustedAgentEnabled = 0; //-------------------THIS IS A PERMANENT ACTION AND CANNOT BE UNDONE
}
| if (_key == 170) {
trustedAgentEnabled = 0; //-------------------THIS IS A PERMANENT ACTION AND CANNOT BE UNDONE
}
| 32,925 |
16 | // change the Transaction cost_newTxFee the new Transaction cost | function setTxFee( uint256 _newTxFee ) onlyOwner external {
txFee = _newTxFee;
emit SetTxFee( _newTxFee );
}
| function setTxFee( uint256 _newTxFee ) onlyOwner external {
txFee = _newTxFee;
emit SetTxFee( _newTxFee );
}
| 29,781 |
37 | // Public sale is not open yet | require(PublicSaleActived, 'Not open yet!');
| require(PublicSaleActived, 'Not open yet!');
| 67,289 |
5 | // Gets the tokens scheduled to be distributed for a specific period. / | function getTokensForPeriod(uint256 _periodIndex)
external
view
override
returns (uint256)
| function getTokensForPeriod(uint256 _periodIndex)
external
view
override
returns (uint256)
| 23,460 |
16 | // address of distributor | address public distributor;
| address public distributor;
| 14,305 |
5 | // Returns a list of all supported pools. | function allPools() external view returns (Pool[] memory pools);
| function allPools() external view returns (Pool[] memory pools);
| 8,116 |
87 | // Send to Marketing address | transferToAddressETH(marketingAddress, transferredBalance.mul(marketingDivisor).div(100));
| transferToAddressETH(marketingAddress, transferredBalance.mul(marketingDivisor).div(100));
| 2,882 |
56 | // User provided data for app callbacks | bytes userData;
| bytes userData;
| 23,962 |
2 | // =============================================== Setters ======================================================== |
function sendCoins()
public
|
function sendCoins()
public
| 26,941 |
90 | // keep track of issuers | for(uint256 i=0; i<issuers.length; i++){
if(issuers[i]==payer)
found = true;
}
| for(uint256 i=0; i<issuers.length; i++){
if(issuers[i]==payer)
found = true;
}
| 26,140 |
84 | // View function to see pending Apes on frontend. | function pendingAPE(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accApePerShare = pool.accApePerShare;
uint256 tokenSupply = pool.token.balanceOf(address(this));
i... | function pendingAPE(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accApePerShare = pool.accApePerShare;
uint256 tokenSupply = pool.token.balanceOf(address(this));
i... | 81,028 |
41 | // Logged when the owner of a node transfers ownership to a new account. | event Transfer(bytes32 indexed node, address owner);
| event Transfer(bytes32 indexed node, address owner);
| 2,750 |
6 | // Reflection Token | address public reflectionToken;
uint256 public accReflectionPerPoint;
bool public hasDividend;
bool public autoAdjustableForRewardRate = false;
| address public reflectionToken;
uint256 public accReflectionPerPoint;
bool public hasDividend;
bool public autoAdjustableForRewardRate = false;
| 7,813 |
10 | // Meta numberOfSides,targetSupply, prize, gradientDominator, ended | function getMatch(uint256 _index) public view returns(uint8, uint256, uint256, uint256, bool) {
return (matches[_index].numberOfSides, matches[_index].targetSupply, matches[_index].prize, matches[_index].gradient, matches[_index].ended);
}
| function getMatch(uint256 _index) public view returns(uint8, uint256, uint256, uint256, bool) {
return (matches[_index].numberOfSides, matches[_index].targetSupply, matches[_index].prize, matches[_index].gradient, matches[_index].ended);
}
| 13,813 |
2 | // The operator can only update EmissionRate and AllocPoint to protect tokenomicsi.e some wrong setting and a pools get too much allocation accidentally | address private _operator;
| address private _operator;
| 28,484 |
9 | // The block number when PAW mining starts. | uint256 public immutable startBlock;
event Add(address indexed user, uint256 allocPoint, IERC20 indexed token, bool massUpdatePools);
event Set(address indexed user, uint256 pid, uint256 allocPoint);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, bool harvest);
event Withd... | uint256 public immutable startBlock;
event Add(address indexed user, uint256 allocPoint, IERC20 indexed token, bool massUpdatePools);
event Set(address indexed user, uint256 pid, uint256 allocPoint);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, bool harvest);
event Withd... | 12,969 |
1 | // Calculated borrow rate based on expectedLiquidity and availableLiquidity/expectedLiquidity Expected liquidity in the pool/availableLiquidity Available liquidity in the pool | function calcBorrowRate(uint256 expectedLiquidity, uint256 availableLiquidity)
external
view
returns (uint256);
| function calcBorrowRate(uint256 expectedLiquidity, uint256 availableLiquidity)
external
view
returns (uint256);
| 6,778 |
2 | // It emits with the user's address and the the value after the change. | event ProductivityIncreased(address indexed user, uint256 value); /// @dev This emit when a users' productivity has changed
| event ProductivityIncreased(address indexed user, uint256 value); /// @dev This emit when a users' productivity has changed
| 17,059 |
13 | // See {IERC1155Collection-withdraw}. / | function withdraw(address payable recipient, uint256 amount) external override adminRequired {
_withdraw(recipient, amount);
}
| function withdraw(address payable recipient, uint256 amount) external override adminRequired {
_withdraw(recipient, amount);
}
| 7,095 |
13 | // ERC721AQueryable.ERC721A subclass with convenience query functions. / | abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
... | abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
... | 34,655 |
30 | // Call this when in Phase.Enrollment for more than joinTimeout blocks and not enough members have joined. | function joinTimedOut()
inPhase(Phase.Enrollment)
external
| function joinTimedOut()
inPhase(Phase.Enrollment)
external
| 31,190 |
29 | // The duration of voting on a proposal, in blocks | function votingPeriod() external pure returns (uint);
| function votingPeriod() external pure returns (uint);
| 16,972 |
28 | // Calculate the amount of underlying token available to withdrawwhen withdrawing via only single token account the address that is withdrawing tokens tokenAmount the amount of LP token to burn tokenIndex index of which token will be withdrawnreturn availableTokenAmount calculated amount of underlying tokenavailable to... | function calculateRemoveLiquidityOneToken(
address account,
uint256 tokenAmount,
uint8 tokenIndex
| function calculateRemoveLiquidityOneToken(
address account,
uint256 tokenAmount,
uint8 tokenIndex
| 5,461 |
32 | // note: Testing revert condition; token owner calls `wrap` with insufficient value when wrapping native tokens. / | function test_revert_wrap_nativeTokens_insufficientValue() public {
address recipient = address(0x123);
ITokenBundle.Token[] memory nativeTokenContentToWrap = new ITokenBundle.Token[](1);
vm.deal(address(tokenOwner), 100 ether);
nativeTokenContentToWrap[0] = ITokenBundle.Token({
... | function test_revert_wrap_nativeTokens_insufficientValue() public {
address recipient = address(0x123);
ITokenBundle.Token[] memory nativeTokenContentToWrap = new ITokenBundle.Token[](1);
vm.deal(address(tokenOwner), 100 ether);
nativeTokenContentToWrap[0] = ITokenBundle.Token({
... | 4,909 |
23 | // Players only paying ============================================ | function payToCharm(string toCharmName, uint256 value) onlyPlayers {
require(_validCharm(toCharmName));
_transfer(msg.sender, ownerToCharm[msg.sender], charmToOwner[toCharmName], toCharmName, value);
}
| function payToCharm(string toCharmName, uint256 value) onlyPlayers {
require(_validCharm(toCharmName));
_transfer(msg.sender, ownerToCharm[msg.sender], charmToOwner[toCharmName], toCharmName, value);
}
| 25,771 |
8 | // EnumDefinition | enum Enum { E1, E2 }
| enum Enum { E1, E2 }
| 54,993 |
38 | // Allows the owner to change the symbol of the contract / | function changeSymbol(bytes32 newSymbol) onlyOwner() public {
symbol = newSymbol;
}
| function changeSymbol(bytes32 newSymbol) onlyOwner() public {
symbol = newSymbol;
}
| 41,337 |
114 | // Enum describing the current state of a loanState change flow: Created -> Active -> Repaid -> Auction -> Defaulted / | enum LoanState {
// We need a default that is not 'Created' - this is the zero value
None,
// The loan data is stored, but not initiated yet.
Created,
// The loan has been initialized, funds have been delivered to the borrower and the collateral is held.
Active,
// The loan is in auction, ... | enum LoanState {
// We need a default that is not 'Created' - this is the zero value
None,
// The loan data is stored, but not initiated yet.
Created,
// The loan has been initialized, funds have been delivered to the borrower and the collateral is held.
Active,
// The loan is in auction, ... | 26,348 |
39 | // Variables related to fees | mapping (address => uint) private _isTimeLimit;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _excludeFromMaxTxLimit;
mapping (address => bool) private _excludeFromTimeLimit;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
... | mapping (address => uint) private _isTimeLimit;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _excludeFromMaxTxLimit;
mapping (address => bool) private _excludeFromTimeLimit;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
... | 3,050 |
3 | // HUNDRED_PERCENT Calculate what % we are off from the target | uint256 deltaAbsolute = totalStakedNowPercentage < stakeTarget
? stakeTarget - totalStakedNowPercentage
: totalStakedNowPercentage - stakeTarget;
uint256 deltaPercentage = deltaAbsolute * HUNDRED_PERCENT / stakeTarget;
| uint256 deltaAbsolute = totalStakedNowPercentage < stakeTarget
? stakeTarget - totalStakedNowPercentage
: totalStakedNowPercentage - stakeTarget;
uint256 deltaPercentage = deltaAbsolute * HUNDRED_PERCENT / stakeTarget;
| 9,356 |
2 | // Allowed withdrawals of previous bids | mapping(address => uint) pendingReturns;
| mapping(address => uint) pendingReturns;
| 16,163 |
0 | // DNN Token Contract/ | DNNToken public dnnToken;
| DNNToken public dnnToken;
| 45,950 |
32 | // Public Functions //Set claim status and partially or fully approve claim. By Lockdrop contract creator only Allow the combined approved amount for lock and signal to be greater than the current user token balance since setting the claim status may occur after the term is finished when the user may have already moved... | function setClaimStatus(address _user, ClaimType _claimType, address _tokenContractAddress,
ClaimStatus _claimStatus, uint256 _approvedTokenERC20Amount, uint256 _pendingTokenERC20Amount, uint256 _rejectedTokenERC20Amount
)
public onlylockdropContractCreator
| function setClaimStatus(address _user, ClaimType _claimType, address _tokenContractAddress,
ClaimStatus _claimStatus, uint256 _approvedTokenERC20Amount, uint256 _pendingTokenERC20Amount, uint256 _rejectedTokenERC20Amount
)
public onlylockdropContractCreator
| 20,903 |
76 | // Removes single address from whitelist./_beneficiary Address to be removed to the whitelist | function removeFromWhitelist(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = false;
WhitelistAddressRemoved(_beneficiary);
}
| function removeFromWhitelist(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = false;
WhitelistAddressRemoved(_beneficiary);
}
| 7,510 |
7 | // bytes4(keccak256("Error(string)")) | mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
| mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
| 39,093 |
8 | // Ratio of (time elapsed since last claim) / (duration of vesting schedule). | uint256 lastTimeApplicable = (block.timestamp >= schedule.endTime) ? schedule.endTime : block.timestamp;
uint256 availableTokens = schedule.numberOfTokens.mul(lastTimeApplicable.sub(schedule.lastClaimTime)).div(schedule.endTime.sub(schedule.startTime));
schedules[msg.sender].lastClaimTime = bl... | uint256 lastTimeApplicable = (block.timestamp >= schedule.endTime) ? schedule.endTime : block.timestamp;
uint256 availableTokens = schedule.numberOfTokens.mul(lastTimeApplicable.sub(schedule.lastClaimTime)).div(schedule.endTime.sub(schedule.startTime));
schedules[msg.sender].lastClaimTime = bl... | 9,462 |
81 | // ambassador pre-mine within 1 hour before startTime, sequences enforced | (now >= startTime - 1 hours && !ambassadorsPremined[msg.sender] && ambassadorsPremined[ambassadorsPrerequisite[msg.sender]] && _incomingEthereum <= ambassadorsMaxPremine[msg.sender]) ||
| (now >= startTime - 1 hours && !ambassadorsPremined[msg.sender] && ambassadorsPremined[ambassadorsPrerequisite[msg.sender]] && _incomingEthereum <= ambassadorsMaxPremine[msg.sender]) ||
| 22,981 |
36 | // Update users reward debt | user.rewardDebt = boostedLiquidityAfter.mul(pool.accJoePerShare).div(ACC_TOKEN_PRECISION);
| user.rewardDebt = boostedLiquidityAfter.mul(pool.accJoePerShare).div(ACC_TOKEN_PRECISION);
| 14,481 |
123 | // 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 returns (uint256) {
(uint256 tokenId, ) = tokenOwners.at(_index);
return tokenId;
}
| function tokenByIndex(uint256 _index) public view returns (uint256) {
(uint256 tokenId, ) = tokenOwners.at(_index);
return tokenId;
}
| 50,413 |
6 | // https:github.com/m1guelpf/erc721-drop/blob/main/src/LilOwnable.sol | abstract contract Ownable {
address internal _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(_owner == msg.sender);
_;
}
constructor() {
_owner = msg.sender;
}
functi... | abstract contract Ownable {
address internal _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(_owner == msg.sender);
_;
}
constructor() {
_owner = msg.sender;
}
functi... | 35,426 |
82 | // Gets the balance of the specified address._owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
| function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
| 40,832 |
8 | // ------------------------ SafeMath Library ------------------------- | library SafeMath {
|/ |/ /___) / / ' / ) / / ) /___) / / )
__/__|____(___ _/___(___ _(___/_/_/__/_(___ _____/______(___/__o_o_
____ _____ _____ _____
| _ \ / ____|/ ____| | __ \
| |_) | (___ | | | | | | _____ __
| _ < \___ \| |... | library SafeMath {
|/ |/ /___) / / ' / ) / / ) /___) / / )
__/__|____(___ _/___(___ _(___/_/_/__/_(___ _____/______(___/__o_o_
____ _____ _____ _____
| _ \ / ____|/ ____| | __ \
| |_) | (___ | | | | | | _____ __
| _ < \___ \| |... | 25,031 |
0 | // return whether given signature is signed by contract owner / | function _isValidSignature (
bytes32 hash,
bytes memory signature
| function _isValidSignature (
bytes32 hash,
bytes memory signature
| 5,521 |
15 | // callback function to keep the returned value from Oracle contract / | function fulfill(bytes32 _requestId, uint256 _data)
public
recordChainlinkFulfillment(_requestId)
| function fulfill(bytes32 _requestId, uint256 _data)
public
recordChainlinkFulfillment(_requestId)
| 9,105 |
12 | // Product id => order | mapping(uint256 => Order) public orderById;
| mapping(uint256 => Order) public orderById;
| 40,066 |
30 | // retrieve stable coins total staked per user in epoch | uint valueUsdc = _staking.getEpochUserBalance(userAddress, _usdc, epochId).mul(10 ** 12); // for usdc which has 6 decimals add a 10**12 to get to a common ground
uint valueSusd = _staking.getEpochUserBalance(userAddress, _susd, epochId);
uint valueDai = _staking.getEpochUserBalance(userAddress, ... | uint valueUsdc = _staking.getEpochUserBalance(userAddress, _usdc, epochId).mul(10 ** 12); // for usdc which has 6 decimals add a 10**12 to get to a common ground
uint valueSusd = _staking.getEpochUserBalance(userAddress, _susd, epochId);
uint valueDai = _staking.getEpochUserBalance(userAddress, ... | 42,521 |
14 | // Returns the scaled balance of the user and the scaled total supply. user The address of the userreturn The scaled balance of the userreturn The scaled balance and the scaled total supply / | {
return (super.balanceOf(user), super.totalSupply());
}
| {
return (super.balanceOf(user), super.totalSupply());
}
| 21,852 |
13 | // Withdraws refund amount/ return refundAmount Refund amount | function refund()
public
timedTransitions
atStage(Stages.AuctionFailed)
returns (uint refundAmount)
| function refund()
public
timedTransitions
atStage(Stages.AuctionFailed)
returns (uint refundAmount)
| 23,898 |
920 | // 461 | entry "unmonetized" : ENG_ADJECTIVE
| entry "unmonetized" : ENG_ADJECTIVE
| 17,073 |
211 | // Mint claimable giraffes to sender | for (uint256 i = 0; i < claimableGiraffes/100; i++) {
uint256 index = totalSupply();
if (index < maxGiraffes) {
_safeMint(msg.sender, index);
}
| for (uint256 i = 0; i < claimableGiraffes/100; i++) {
uint256 index = totalSupply();
if (index < maxGiraffes) {
_safeMint(msg.sender, index);
}
| 51,338 |
140 | // Emit an event to track the minting | emit Transfer(address(0), account, amount);
| emit Transfer(address(0), account, amount);
| 15,256 |
32 | // Get the amount of this pools token owned by the SaffronStaking contract | uint256 lpSupply = pool.lpToken.balanceOf(address(this));
| uint256 lpSupply = pool.lpToken.balanceOf(address(this));
| 21,824 |
34 | // Storage for Governor Bravo Delegate For future upgrades, do not change DegenDAOStorageV1. Create a newcontract which implements DegenDAOStorageV1 and following the naming conventionDegenDAOStorageVX. / | contract DegenDAOStorageV1 is DegenDAOProxyStorage {
/// @notice Vetoer who has the ability to veto any proposal
address public vetoer;
/// @notice The delay before voting on a proposal may take place, once proposed, in blocks
uint256 public votingDelay;
/// @notice The duration of voting on a pro... | contract DegenDAOStorageV1 is DegenDAOProxyStorage {
/// @notice Vetoer who has the ability to veto any proposal
address public vetoer;
/// @notice The delay before voting on a proposal may take place, once proposed, in blocks
uint256 public votingDelay;
/// @notice The duration of voting on a pro... | 38,079 |
90 | // This contract is used to generate clone contracts from a contract./In solidity this is the way to create a contract from a contract of the/same class | contract MiniMeTokenFactory {
/// @notice Update the DApp by creating a new token with new functionalities
/// the msg.sender becomes the controller of this clone token
/// @param _parentToken Address of the token being cloned
/// @param _snapshotBlock Block of the parent token that will
/// dete... | contract MiniMeTokenFactory {
/// @notice Update the DApp by creating a new token with new functionalities
/// the msg.sender becomes the controller of this clone token
/// @param _parentToken Address of the token being cloned
/// @param _snapshotBlock Block of the parent token that will
/// dete... | 20,015 |
20 | // Conversion functionality for migrating VNL v1 tokens to VNL v1.1 | abstract contract VanillaV1Converter is IVanillaV1Converter {
/// @inheritdoc IVanillaV1Converter
IVanillaV1MigrationState public override migrationState;
IERC20 internal vnl;
constructor(IVanillaV1MigrationState _state, IERC20 _VNLv1) {
migrationState = _state;
vnl = _VNLv1;
}
... | abstract contract VanillaV1Converter is IVanillaV1Converter {
/// @inheritdoc IVanillaV1Converter
IVanillaV1MigrationState public override migrationState;
IERC20 internal vnl;
constructor(IVanillaV1MigrationState _state, IERC20 _VNLv1) {
migrationState = _state;
vnl = _VNLv1;
}
... | 67,201 |
53 | // set the initial nonce to be provided when constructing the salt. | uint256 nonce = 0;
| uint256 nonce = 0;
| 23,388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.