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 |
|---|---|---|---|---|
0 | // Number of pools | uint8 public constant NUMBER_POOLS = 8;
| uint8 public constant NUMBER_POOLS = 8;
| 36,335 |
51 | // withdraw rewards | if (reward > 0) {
rewards[msg.sender] = 0;
| if (reward > 0) {
rewards[msg.sender] = 0;
| 25,162 |
1,387 | // Constructs the SyntheticToken. tokenName The name which describes the new token. tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars. tokenDecimals The number of decimals to define token precision. / | constructor(
string memory tokenName,
string memory tokenSymbol,
uint8 tokenDecimals
| constructor(
string memory tokenName,
string memory tokenSymbol,
uint8 tokenDecimals
| 21,871 |
129 | // Do the swap for token and then update outputAmount Note: minExpectedTokenOutput is set to 0 since we're doing an aggregate slippage check below | outputAmount += swapList[i].pair.swapNFTsForToken(
swapList[i].nftIds,
0,
tokenRecipient,
true,
msg.sender
);
unchecked {
++i;
| outputAmount += swapList[i].pair.swapNFTsForToken(
swapList[i].nftIds,
0,
tokenRecipient,
true,
msg.sender
);
unchecked {
++i;
| 18,881 |
19 | // claim tokens | _setAllowListMinted(claimer, numberOfTokens);
_safeMint(msg.sender, numberOfTokens, "");
emit AllowListClaimMint(msg.sender, vault, numberOfTokens);
| _setAllowListMinted(claimer, numberOfTokens);
_safeMint(msg.sender, numberOfTokens, "");
emit AllowListClaimMint(msg.sender, vault, numberOfTokens);
| 24,921 |
146 | // 6. Sends msg.sender all the btf vault tokens | uint256 _retPAmount = IVault(_toVault).balanceOf(address(this));
IVault(_toVault).transfer(
msg.sender,
_retPAmount
);
return _retPAmount;
| uint256 _retPAmount = IVault(_toVault).balanceOf(address(this));
IVault(_toVault).transfer(
msg.sender,
_retPAmount
);
return _retPAmount;
| 50,275 |
12 | // Allows the owner to register new candidates | function registerCandidate(string candidateName, string candidateDescription) public onlyOwner {
uint candidateId = nextCandidateId++;
candidateDirectory[candidateId] = Candidate(candidateId, candidateName, candidateDescription);
emit CandidateRegistered(candidateId, candidateName, candidate... | function registerCandidate(string candidateName, string candidateDescription) public onlyOwner {
uint candidateId = nextCandidateId++;
candidateDirectory[candidateId] = Candidate(candidateId, candidateName, candidateDescription);
emit CandidateRegistered(candidateId, candidateName, candidate... | 38,569 |
213 | // Calculate the max amount of base that can be bought from the pool. baseReserves Base reserves amount fyTokenReserves fyToken reserves amount timeTillMaturity time till maturity in seconds ts time till maturity coefficient, multiplied by 2^64 g fee coefficient, multiplied by 2^64return max amount of base that can be ... | function maxBaseOut(
uint128 baseReserves, uint128 fyTokenReserves,
uint128 timeTillMaturity, int128 ts, int128 g)
| function maxBaseOut(
uint128 baseReserves, uint128 fyTokenReserves,
uint128 timeTillMaturity, int128 ts, int128 g)
| 38,778 |
10 | // if fee is on, mint liquidity equivalent to 8/25 of the growth in sqrt(k) | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IPancakeFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt... | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IPancakeFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt... | 12,986 |
54 | // forgefmt: disable-next-item | k := sub(or(k, byte(shr(251, mul(v, shl(224, 0x07c4acdd))),
0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)), 96)
| k := sub(or(k, byte(shr(251, mul(v, shl(224, 0x07c4acdd))),
0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)), 96)
| 27,392 |
187 | // allows a user to modify their orders after they have been submitted. Once an order has been submitted, it is not possible to change the ASSET, or the TIPFEE, or the ORDERTYPE. The other parameters are similar to those described above. Note: this function can only modify trailing orders. It is not possible to change ... | function modifyTrailingOrder(
uint order_id,
Decimal.decimal memory _newStop,
Decimal.decimal memory _newLimit,
SignedDecimal.signedDecimal memory _orderSize,
Decimal.decimal memory _collateral,
Decimal.decimal memory _leverage,
Decimal.decimal memory _slippage,
bool _reduceOnly,
| function modifyTrailingOrder(
uint order_id,
Decimal.decimal memory _newStop,
Decimal.decimal memory _newLimit,
SignedDecimal.signedDecimal memory _orderSize,
Decimal.decimal memory _collateral,
Decimal.decimal memory _leverage,
Decimal.decimal memory _slippage,
bool _reduceOnly,
| 27,698 |
323 | // SashimiLending's SLErc20 Contract SLTokens which wrap an EIP-20 underlying SashimiLending / | contract SLErc20 is SLToken, SLErc20Interface {
constructor() public {
// Creator of the contract is admin during initialization
admin = msg.sender;
}
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptrol... | contract SLErc20 is SLToken, SLErc20Interface {
constructor() public {
// Creator of the contract is admin during initialization
admin = msg.sender;
}
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param comptrol... | 36,325 |
218 | // mint tokens for owners | uint tokensPerOwner = m_token.totalSupply().mul(4).div(m_numOwners);
for (uint i = 0; i < m_numOwners; i++)
m_token.mint(getOwner(i), tokensPerOwner);
m_funds.changeState(FundsRegistry.State.SUCCEEDED);
m_funds.detachController();
m_token.disableMinting();
m... | uint tokensPerOwner = m_token.totalSupply().mul(4).div(m_numOwners);
for (uint i = 0; i < m_numOwners; i++)
m_token.mint(getOwner(i), tokensPerOwner);
m_funds.changeState(FundsRegistry.State.SUCCEEDED);
m_funds.detachController();
m_token.disableMinting();
m... | 6,648 |
113 | // Meanwhile there is amount to buy | offerId = getBestOffer(buy_gem, pay_gem); //Get the best offer for the token pair
require(offerId != 0);
| offerId = getBestOffer(buy_gem, pay_gem); //Get the best offer for the token pair
require(offerId != 0);
| 17,033 |
151 | // Automation entrypoint to whitelist ceva_ admin only / |
function adminWhitelistCEVA(address _identifier, bool _status)
public
onlyAdministrator(msg.sender)
|
function adminWhitelistCEVA(address _identifier, bool _status)
public
onlyAdministrator(msg.sender)
| 64,200 |
215 | // underlyingFees += takeFees_; | underlyingFees = underlyingFees.add(takeFees_);
ICompoundCumulator(controller)._beforeCTokenBalanceChange();
uint256 err = ICToken(cToken).redeemUnderlying(underlyingAmount_);
require(0 == err, "PPC: _withdrawProvider redeemUnderlying");
ICompoundCumulator(controller)._afterCTok... | underlyingFees = underlyingFees.add(takeFees_);
ICompoundCumulator(controller)._beforeCTokenBalanceChange();
uint256 err = ICToken(cToken).redeemUnderlying(underlyingAmount_);
require(0 == err, "PPC: _withdrawProvider redeemUnderlying");
ICompoundCumulator(controller)._afterCTok... | 13,872 |
28 | // Storage to plots array | plots.push(_plot);
delete plotsUnfinish[_id];
| plots.push(_plot);
delete plotsUnfinish[_id];
| 5,711 |
26 | // - `index` must be strictly less than {length}. / | function at(Bytes4Set storage set, uint256 index) internal view returns ( bytes4 ) {
return bytes4( _at( set._inner, index ) );
}
| function at(Bytes4Set storage set, uint256 index) internal view returns ( bytes4 ) {
return bytes4( _at( set._inner, index ) );
}
| 8,717 |
8 | // function to add multiple candidates to the main candidate array | for(uint256 i = 0; i < _name.length; i++)
{
addCandidate(_name[i], _rollno[i], _position[i], _hostel[i], _gender[i], _cy[i]);
}
| for(uint256 i = 0; i < _name.length; i++)
{
addCandidate(_name[i], _rollno[i], _position[i], _hostel[i], _gender[i], _cy[i]);
}
| 27,248 |
0 | // Map Ether to specific token / | address public ethTokenAddress;
| address public ethTokenAddress;
| 34,836 |
59 | // Get the bounds of the range to generate the ids inreturn lowerBound The starting position from which the tokenId will be randomly pickedreturn upperBound The ending position until which the tokenId will be randomly picked / | function getBounds()
internal
view
returns (uint256 lowerBound, uint256 upperBound)
| function getBounds()
internal
view
returns (uint256 lowerBound, uint256 upperBound)
| 15,697 |
5 | // Define a function 'addUser' that adds this role | function addUser(address account) public onlyUser() {
_addUser(account);
}
| function addUser(address account) public onlyUser() {
_addUser(account);
}
| 16,856 |
18 | // save gas when allowance is maximal by not reducing it (see https:github.com/ethereum/EIPs/issues/717) |
require(allowance >= amount, "NOT_AUTHOIZED_ALLOWANCE");
_mAllowed[from][msg.sender] = allowance - amount;
|
require(allowance >= amount, "NOT_AUTHOIZED_ALLOWANCE");
_mAllowed[from][msg.sender] = allowance - amount;
| 1,447 |
13 | // set tokenURI. / | function setTokenURI(string memory tokenURI_) external override onlyAdmin{
_tokenURI = tokenURI_;
}
| function setTokenURI(string memory tokenURI_) external override onlyAdmin{
_tokenURI = tokenURI_;
}
| 24,975 |
212 | // Interface of the OwnablePausableUpgradeable and OwnablePausable contracts. / | interface IOwnablePausable {
/**
* @dev Function for checking whether an account has an admin role.
* @param _account - account to check.
*/
function isAdmin(address _account) external view returns (bool);
/**
* @dev Function for assigning an admin role to the account.
* Can only be cal... | interface IOwnablePausable {
/**
* @dev Function for checking whether an account has an admin role.
* @param _account - account to check.
*/
function isAdmin(address _account) external view returns (bool);
/**
* @dev Function for assigning an admin role to the account.
* Can only be cal... | 67,507 |
6 | // ===== Registration ===== | function setRegisteredOptions(address[] calldata optionAddresses)
external
returns (bool);
function setRegisteredConnectors(
address[] calldata connectors,
bool[] calldata isValid
) external returns (bool);
| function setRegisteredOptions(address[] calldata optionAddresses)
external
returns (bool);
function setRegisteredConnectors(
address[] calldata connectors,
bool[] calldata isValid
) external returns (bool);
| 28,856 |
13 | // Returns the hash of the `index`th DataStore with the specified `duration` at the specified UTC `timestamp`. | function getDataStoreHashesForDurationAtTimestamp(uint8 duration, uint256 timestamp, uint32 index)
external
view
returns (bytes32);
| function getDataStoreHashesForDurationAtTimestamp(uint8 duration, uint256 timestamp, uint32 index)
external
view
returns (bytes32);
| 1,869 |
70 | // can later be changed with {transferOwnership}./Stake section information struct / | struct Stake {
address stakeholder;
uint256 createdAt;
address referredBy;
uint256 stakeAmount;
uint256 expiredAt;
}
| struct Stake {
address stakeholder;
uint256 createdAt;
address referredBy;
uint256 stakeAmount;
uint256 expiredAt;
}
| 7,313 |
121 | // Return the log in base 2, rounded down, of a positive value.Returns 0 if given 0. / | function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;... | function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;... | 8,263 |
2 | // Fixed, but can be adjusted for each proxy contract with setPlatformFields. | sunflowerMintPercent = 29;
sunflowerTokenRoyalty = 31; // Every 31th token, so 3.22%. Use a prime to reduce collisions.
artistBalance = 0;
tokenBaseURI = "";
| sunflowerMintPercent = 29;
sunflowerTokenRoyalty = 31; // Every 31th token, so 3.22%. Use a prime to reduce collisions.
artistBalance = 0;
tokenBaseURI = "";
| 26,701 |
325 | // set new cost of tokenId in WEI/_costnew price in wei | function setCostPrice(uint256 _cost) public onlyOwner{
costOfNFT = _cost;
}
| function setCostPrice(uint256 _cost) public onlyOwner{
costOfNFT = _cost;
}
| 1,944 |
6 | // Create a new managed pool_name - Pool name _symbol - Symbol representing the pool _tokens - Tokens in the pool _normalizedWeights - Normalized weights in the pool _assetManagers - Asset manager for the pool _swapFeePercentage - Fee applied to swaps _swapEnabledOnStart - Whether swaps are enabled straight away _mustA... | function createPool(string memory _name,
string memory _symbol,
IERC20[] memory _tokens,
uint256[] memory _normalizedWeights,
address[] memory _assetManagers,
uint256 _swapFeePercentage,
... | function createPool(string memory _name,
string memory _symbol,
IERC20[] memory _tokens,
uint256[] memory _normalizedWeights,
address[] memory _assetManagers,
uint256 _swapFeePercentage,
... | 24,840 |
31 | // factory contracts | TrancheFabLike_1 public immutable trancheFab;
ReserveFabLike_1 public immutable reserveFab;
AssessorFabLike_2 public immutable assessorFab;
CoordinatorFabLike_2 public immutable coordinatorFab;
OperatorFabLike_1 public immutable operatorFab;
MemberlistFabLi... | TrancheFabLike_1 public immutable trancheFab;
ReserveFabLike_1 public immutable reserveFab;
AssessorFabLike_2 public immutable assessorFab;
CoordinatorFabLike_2 public immutable coordinatorFab;
OperatorFabLike_1 public immutable operatorFab;
MemberlistFabLi... | 10,649 |
3 | // STATE VARIABLES |
function dataReceiver() external view returns (IDataReceiver _dataReceiver);
|
function dataReceiver() external view returns (IDataReceiver _dataReceiver);
| 15,832 |
387 | // Function to mint tokens to The address that will receive the minted tokens. value The amount of tokens to mint.return A boolean that indicates if the operation was successful. / | function mint(address to, uint256 value) public returns (bool) {
_mint(to, value);
return true;
}
| function mint(address to, uint256 value) public returns (bool) {
_mint(to, value);
return true;
}
| 13,247 |
161 | // Safe token transfer function, just in case if rounding error causes pool to not have enough Tokens. | function safeTokenTransfer(address _to, uint256 _amount) internal {
uint256 tokenBal = token.balanceOf(address(this));
if (_amount > tokenBal) {
token.transfer(_to, tokenBal);
} else {
token.transfer(_to, _amount);
}
}
| function safeTokenTransfer(address _to, uint256 _amount) internal {
uint256 tokenBal = token.balanceOf(address(this));
if (_amount > tokenBal) {
token.transfer(_to, tokenBal);
} else {
token.transfer(_to, _amount);
}
}
| 67,961 |
289 | // map & list with all CARD index, not id |
uint256 public constant MAX_ELEMENTS = 10100;
uint256 public PRICE = 3 * 10**16;
uint256 public constant MAX_BY_MINT = 10;
mapping(uint => bool) public ImgStatus;
|
uint256 public constant MAX_ELEMENTS = 10100;
uint256 public PRICE = 3 * 10**16;
uint256 public constant MAX_BY_MINT = 10;
mapping(uint => bool) public ImgStatus;
| 36,291 |
11 | // THe user should not be marked as fraudlent. | require(users[msg.sender].fraudStatus == false);
| require(users[msg.sender].fraudStatus == false);
| 11,413 |
151 | // Yield | address public poker;
uint256 public lastPoke;
uint256 public lastBalance;
uint256 public fraction;
IConnector public connector;
uint256 constant private POKE_CADENCE = 4 hours;
uint256 constant private MAX_APY = 2e18;
uint256 constant private SECONDS_IN_YEAR = 365 days;
| address public poker;
uint256 public lastPoke;
uint256 public lastBalance;
uint256 public fraction;
IConnector public connector;
uint256 constant private POKE_CADENCE = 4 hours;
uint256 constant private MAX_APY = 2e18;
uint256 constant private SECONDS_IN_YEAR = 365 days;
| 27,910 |
13 | // With the preconditions checked, we can return the verifier. | verifier = verifier_lut[batchSize];
| verifier = verifier_lut[batchSize];
| 25,206 |
36 | // Generate orderId for a given order by hashing the key params | function _getOrderIdFromFields(
address _nftContract,
uint256 _tokenId,
uint256 _price,
uint256 _createdAt,
address _seller
| function _getOrderIdFromFields(
address _nftContract,
uint256 _tokenId,
uint256 _price,
uint256 _createdAt,
address _seller
| 82,759 |
196 | // eg cDAI -> COMP | mapping(address => address) private protocolTokenToGov;
| mapping(address => address) private protocolTokenToGov;
| 72,554 |
94 | // Computes the next vesting schedule identifier for an address and an pidreturn The id string / | function computeVestingScheduleIdForAddressAndPid(address _holder, uint256 _pid) external view returns (bytes32) {
require(_pid < NUMBER_POOLS, "ComputeVestingScheduleId: Non valid pool id");
bytes32 vestingScheduleId = computeVestingScheduleIdForAddressAndIndex(_holder, 0);
VestingSchedule ... | function computeVestingScheduleIdForAddressAndPid(address _holder, uint256 _pid) external view returns (bytes32) {
require(_pid < NUMBER_POOLS, "ComputeVestingScheduleId: Non valid pool id");
bytes32 vestingScheduleId = computeVestingScheduleIdForAddressAndIndex(_holder, 0);
VestingSchedule ... | 36,418 |
148 | // Split the contract balance into two halves. | uint256 tokensToSwap = contractBalance / 2;
uint256 tokensAddToLiquidity = contractBalance - tokensToSwap;
| uint256 tokensToSwap = contractBalance / 2;
uint256 tokensAddToLiquidity = contractBalance - tokensToSwap;
| 7,045 |
24 | // FIXME | function _withdraw(address _receiver, uint256 _value) internal returns(bool) {
return false; // Implement escrow-dependent logic here
}
| function _withdraw(address _receiver, uint256 _value) internal returns(bool) {
return false; // Implement escrow-dependent logic here
}
| 45,779 |
45 | // Converts an address to a string. / | function addressToString(address _address)
internal
pure
returns (string memory)
| function addressToString(address _address)
internal
pure
returns (string memory)
| 33,881 |
1 | // Owner address | address payable public owner;
| address payable public owner;
| 52,545 |
15 | // Withdraw assets from the Prize Pool instantly.A fairness fee may be charged for an early exit./from The address to redeem tokens from./amount The amount of tokens to redeem for assets./ return The actual amount withdrawn | function withdrawFrom(address from, uint256 amount) external returns (uint256);
| function withdrawFrom(address from, uint256 amount) external returns (uint256);
| 6,538 |
171 | // Returns if the LendPool is paused / | function paused() external view returns (bool);
| function paused() external view returns (bool);
| 23,433 |
10 | // drip | PotLike(POT).drip();
JugLike(JUG).drip("ETH-A");
JugLike(JUG).drip("BAT-A");
| PotLike(POT).drip();
JugLike(JUG).drip("ETH-A");
JugLike(JUG).drip("BAT-A");
| 10,359 |
213 | // Base URI for computing {tokenURI}. If set, the resulting URI for eachtoken will be the concatenation of the `baseURI` and the `tokenId`. Empty by default, can be overriden in child contracts. / | function _baseURI() internal view virtual returns (string memory) {
return _tokenURI;
}
| function _baseURI() internal view virtual returns (string memory) {
return _tokenURI;
}
| 24,974 |
20 | // Use the typehash and the root hash to derive final bulk order hash | assembly {
mstore(0, rootTypeHash)
mstore(0x20, root)
bulkOrderHash := keccak256(0, 0x40)
}
| assembly {
mstore(0, rootTypeHash)
mstore(0x20, root)
bulkOrderHash := keccak256(0, 0x40)
}
| 38,562 |
98 | // return The amount of PERI mintable for the inflationary supply / | function mintableSupply() external view returns (uint) {
uint totalAmount;
if (!isMintable()) {
return totalAmount;
}
uint remainingWeeksToMint = weeksSinceLastIssuance();
uint currentWeek = weekCounter;
// Calculate total mintable supply from exponent... | function mintableSupply() external view returns (uint) {
uint totalAmount;
if (!isMintable()) {
return totalAmount;
}
uint remainingWeeksToMint = weeksSinceLastIssuance();
uint currentWeek = weekCounter;
// Calculate total mintable supply from exponent... | 10,424 |
33 | // An event emitted when a new proposal is created | event ProposalCreated(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
| event ProposalCreated(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
| 10,265 |
80 | // register the deposit/ | {
TokenDeposit(_tokenAddr,_from,_amount);
nonce++;
if (tokenBalances[_tokenAddr] == 0) {
tokens.push(_tokenAddr);
tokenBalances[_tokenAddr] = ERC20(_tokenAddr).balanceOf(this);
} else {
tokenBalances[_tokenAddr] += _amount;
}
}
| {
TokenDeposit(_tokenAddr,_from,_amount);
nonce++;
if (tokenBalances[_tokenAddr] == 0) {
tokens.push(_tokenAddr);
tokenBalances[_tokenAddr] = ERC20(_tokenAddr).balanceOf(this);
} else {
tokenBalances[_tokenAddr] += _amount;
}
}
| 31,802 |
22 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| 7,781 |
54 | // The owner is rating the guest | require(booking.guestRating == 0, 'Guest already rated, cannot re-rate');
| require(booking.guestRating == 0, 'Guest already rated, cannot re-rate');
| 29,347 |
27 | // Use : openseas transaction .. we need to emit events from our end to match with our events | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override{
super._beforeTokenTransfer(from, to, tokenId);
isSoldorBidded[referenceTotokenBatch[tokenId]] = true;
uint price;
if(isSellings[tokenId] == true) {
isSellings[tokenId] = fal... | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override{
super._beforeTokenTransfer(from, to, tokenId);
isSoldorBidded[referenceTotokenBatch[tokenId]] = true;
uint price;
if(isSellings[tokenId] == true) {
isSellings[tokenId] = fal... | 14,003 |
49 | // this is only to set first id will work only once | function setFirstID() public returns (string memory)
| function setFirstID() public returns (string memory)
| 2,512 |
3 | // Address of claimant => Symbol of token => roundId (or collectible id ?) | mapping(address => mapping(string => uint256)) public claims;
address public node;
address public tokenAddr;
| mapping(address => mapping(string => uint256)) public claims;
address public node;
address public tokenAddr;
| 32,460 |
9 | // End date of the promotion | uint256 public endDate;
event SuccessfulClaim(
bytes32 indexed scriptHash,
address indexed seller,
address indexed buyer,
uint256 amount
);
event UnsuccessfulClaim(
| uint256 public endDate;
event SuccessfulClaim(
bytes32 indexed scriptHash,
address indexed seller,
address indexed buyer,
uint256 amount
);
event UnsuccessfulClaim(
| 1,381 |
63 | // Events emitted by a pool/Contains all events emitted by the pool | interface IUniswapV3PoolEvents {
/// @notice Emitted exactly once by a pool when #initialize is first called on the pool
/// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
/// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
/// @param tick The initial tick of the... | interface IUniswapV3PoolEvents {
/// @notice Emitted exactly once by a pool when #initialize is first called on the pool
/// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
/// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
/// @param tick The initial tick of the... | 33,791 |
51 | // Adds two numbers, reverting on overflow. | function _add(int256 a, int256 b) private pure returns (int256 c) {
c = a + b;
if ((a < 0 && b < 0 && c > a) || (a > 0 && b > 0 && c < a)) {
revert("overflow");
}
}
| function _add(int256 a, int256 b) private pure returns (int256 c) {
c = a + b;
if ((a < 0 && b < 0 && c > a) || (a > 0 && b > 0 && c < a)) {
revert("overflow");
}
}
| 9,521 |
0 | // The ConfirmedOwner contract A contract with helpers for basic contract ownership. / | contract ConfirmedOwner is ConfirmedOwnerWithProposal {
constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}
}
| contract ConfirmedOwner is ConfirmedOwnerWithProposal {
constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}
}
| 45,675 |
12 | // Set status for whitelist, wether to use whitelist or not for the sale/ | function setWhitelistDesactivatedStatus(bool _status) external onlyOwner {
_whitelistDesactivated = _status;
}
| function setWhitelistDesactivatedStatus(bool _status) external onlyOwner {
_whitelistDesactivated = _status;
}
| 10,234 |
9 | // Check if these values are valid / | modifier isValid(
uint256 _startTime,
uint256 _duration,
uint256 _apy
| modifier isValid(
uint256 _startTime,
uint256 _duration,
uint256 _apy
| 1,943 |
9 | // swap owners | assets[pex.offeredAsset].owner = pex.to;
assets[pex.requestedAsset].owner = pex.from;
assets[pex.offeredAsset].isInExchangeProcess = false;
assets[pex.offeredAsset].isInExchangeProcess = false;
| assets[pex.offeredAsset].owner = pex.to;
assets[pex.requestedAsset].owner = pex.from;
assets[pex.offeredAsset].isInExchangeProcess = false;
assets[pex.offeredAsset].isInExchangeProcess = false;
| 14,687 |
0 | // Token metadata | string public constant name = "Test Network Token";
string public constant symbol = "TNT";
uint8 public constant decimals = 18; // 18 decimal places, the same as ETH.
| string public constant name = "Test Network Token";
string public constant symbol = "TNT";
uint8 public constant decimals = 18; // 18 decimal places, the same as ETH.
| 27,749 |
135 | // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. | sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
| sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
| 34,863 |
39 | // Mapping from token ID to owner address | mapping(uint256 => address) private _owners;
| mapping(uint256 => address) private _owners;
| 24,585 |
1 | // Claim function to be called by the receiver | function claim(uint256 index) public {
require(block.timestamp < endTime);
require(msg.sender == receivers[index]);
msg.sender.transfer(values[index]);
values[index] = 0;
}
| function claim(uint256 index) public {
require(block.timestamp < endTime);
require(msg.sender == receivers[index]);
msg.sender.transfer(values[index]);
values[index] = 0;
}
| 17,575 |
34 | // Used by the owner to set the withdrawal address for Bitwords. This addressis where Bitwords will receive all the cut from the advertisements.newAddressthe new withdrawal address / | function setBitwordsWithdrawlAddress (address newAddress) hasNotSuicided onlyOwner public {
bitwordsWithdrawlAddress = newAddress;
emit BitwordsWithdrawlAddressChanged(msg.sender, newAddress);
}
| function setBitwordsWithdrawlAddress (address newAddress) hasNotSuicided onlyOwner public {
bitwordsWithdrawlAddress = newAddress;
emit BitwordsWithdrawlAddressChanged(msg.sender, newAddress);
}
| 50,594 |
91 | // Getter function since constants can't be read directly from libraries. / | function preciseUnit() internal pure returns (uint256) {
return PRECISE_UNIT;
}
| function preciseUnit() internal pure returns (uint256) {
return PRECISE_UNIT;
}
| 5,465 |
32 | // require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); | if(!(AddressUpgradeable.isContract(target))) revert Address_DelegateCallToNonContract();
| if(!(AddressUpgradeable.isContract(target))) revert Address_DelegateCallToNonContract();
| 34,356 |
28 | // Executes a 0x trade using loaned funds./loanOrderHash A unique hash representing the loan order/orders0x Array of 0x V2 order structs/signatures0x Array of signatures for each of the V2 orders/ return The amount of token received in the trade. | function tradePositionWith0xV2(
bytes32 loanOrderHash,
ExchangeV2Interface.OrderV2[] memory orders0x,
bytes[] memory signatures0x)
public
returns (uint256);
| function tradePositionWith0xV2(
bytes32 loanOrderHash,
ExchangeV2Interface.OrderV2[] memory orders0x,
bytes[] memory signatures0x)
public
returns (uint256);
| 38,014 |
13 | // Allow given spender to transfer given number of tokens from message sender._spender address to allow the owner of to transfer tokens from message sender _value number of tokens to allow to transferreturn true if token transfer was successfully approved, false otherwise / | function approve (address _spender, uint256 _value)
| function approve (address _spender, uint256 _value)
| 50,116 |
129 | // Add to treasury | treasuryAmount += treasuryAmt;
emit RewardsCalculated(epoch, rewardBaseCalAmount, rewardAmount, treasuryAmt);
| treasuryAmount += treasuryAmt;
emit RewardsCalculated(epoch, rewardBaseCalAmount, rewardAmount, treasuryAmt);
| 3,514 |
25 | // ========== MODIFIERS ========== / | modifier onlyRewardsDistribution() {
require(
msg.sender == rewardsDistribution,
"TomiStaking: caller is not reward distribution"
);
_;
}
| modifier onlyRewardsDistribution() {
require(
msg.sender == rewardsDistribution,
"TomiStaking: caller is not reward distribution"
);
_;
}
| 6,463 |
114 | // Block withdrawals within 1 hour of depositing. | modifier onceAnHour {
require(block.timestamp >= balances[msg.sender].lastTime.add(1 hours), "You must wait an hour after your last update to withdraw.");
_;
}
| modifier onceAnHour {
require(block.timestamp >= balances[msg.sender].lastTime.add(1 hours), "You must wait an hour after your last update to withdraw.");
_;
}
| 31,356 |
176 | // / | function prepareClaim(string memory ticker) external nonReentrant {
require(isStakingPeriod()==false);
uint256 latest_staking_period = getCurrentPeriod()-1;
require(didRecordPeriodEndBalance[ticker][latest_staking_period]==false);
periodEndBalance[ticker][latest_staking_period] = IER... | function prepareClaim(string memory ticker) external nonReentrant {
require(isStakingPeriod()==false);
uint256 latest_staking_period = getCurrentPeriod()-1;
require(didRecordPeriodEndBalance[ticker][latest_staking_period]==false);
periodEndBalance[ticker][latest_staking_period] = IER... | 50,947 |
6 | // Day | for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
| for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
| 47,774 |
64 | // Find the highest set bit (will be floor(log_2)). Borrowed with <3 from https:github.com/ethereum/solidity-examples | uint256 val = _in;
uint256 highest = 0;
for (uint256 i = 128; i >= 1; i >>= 1) {
if (val & (((uint256(1) << i) - 1) << i) != 0) {
highest += i;
val >>= i;
}
| uint256 val = _in;
uint256 highest = 0;
for (uint256 i = 128; i >= 1; i >>= 1) {
if (val & (((uint256(1) << i) - 1) << i) != 0) {
highest += i;
val >>= i;
}
| 13,866 |
6 | // Opens a position on an existing order orderId order id com address of ConditionalOpeningManager comAdditionalParamsparams needed for ConditionalOpeningManager to calc canBeFilled firstAssetRoutes routes to swap first asset depositInThirdAssetRoutes routes to swap deposit asset / | struct OpenPositionParams {
uint256 orderId;
uint256 conditionIndex;
bytes comAdditionalParams;
PrimexPricingLibrary.Route[] firstAssetRoutes;
PrimexPricingLibrary.Route[] depositInThirdAssetRoutes;
address keeper;
}
| struct OpenPositionParams {
uint256 orderId;
uint256 conditionIndex;
bytes comAdditionalParams;
PrimexPricingLibrary.Route[] firstAssetRoutes;
PrimexPricingLibrary.Route[] depositInThirdAssetRoutes;
address keeper;
}
| 16,471 |
85 | // Decode a `Witnet.CBOR` structure into a native `int128[]` value whose inner values follow the same convention./ as explained in `decodeFixed16`./_cborValue An instance of `Witnet.CBOR`./ return The value represented by the input, as an `int128[]` value. | function decodeFixed16Array(Witnet.CBOR memory _cborValue) external pure returns(int32[] memory) {
require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `int128[]` from a `Witnet.CBOR` with majorType != 4");
uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
re... | function decodeFixed16Array(Witnet.CBOR memory _cborValue) external pure returns(int32[] memory) {
require(_cborValue.majorType == 4, "WitnetDecoderLib: Tried to read `int128[]` from a `Witnet.CBOR` with majorType != 4");
uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation);
re... | 82,256 |
17 | // verify a record. / | function verifyRecord(string memory _hash) public returns (bool) {
require(recordData[_hash].patient == msg.sender, "Just the patient can verify the record");
recordData[_hash].verified = true;
// Event
emit verifiedRecordLog(msg.sender, _hash);
return true;
}
| function verifyRecord(string memory _hash) public returns (bool) {
require(recordData[_hash].patient == msg.sender, "Just the patient can verify the record");
recordData[_hash].verified = true;
// Event
emit verifiedRecordLog(msg.sender, _hash);
return true;
}
| 9,685 |
13 | // return Address of PathFinder | function getLeveragedActions() external view returns (address);
| function getLeveragedActions() external view returns (address);
| 26,082 |
114 | // Network: KovanOracle: 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7eJob ID: 29fa9aa13bf1468788b7cc4a500a45b8Fee: 0.1 LINK / | constructor(address _oracle) public {
setPublicChainlinkToken();
oracle = 0x72f3dFf4CD17816604dd2df6C2741e739484CA62;
jobId = "5d1f6593e5c74d03ac9c24f4072745e0";
fee = 0.1 * 10 ** 18; // 0.1 LINK
oracleReport = _oracle;
}
| constructor(address _oracle) public {
setPublicChainlinkToken();
oracle = 0x72f3dFf4CD17816604dd2df6C2741e739484CA62;
jobId = "5d1f6593e5c74d03ac9c24f4072745e0";
fee = 0.1 * 10 ** 18; // 0.1 LINK
oracleReport = _oracle;
}
| 76,422 |
117 | // calculate token amount to be returned | uint256 tokens = _getTokenAmount(weiAmount);
_validateTokensAvailable(tokens);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
| uint256 tokens = _getTokenAmount(weiAmount);
_validateTokensAvailable(tokens);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
| 14,015 |
53 | // Helper to parse settlement arguments from encoded data for PostBuyShares fee hook | function __decodePostBuySharesSettlementData(bytes memory _settlementData)
internal
pure
returns (
address buyer_,
uint256 investmentAmount_,
uint256 sharesIssued_
)
| function __decodePostBuySharesSettlementData(bytes memory _settlementData)
internal
pure
returns (
address buyer_,
uint256 investmentAmount_,
uint256 sharesIssued_
)
| 22,247 |
2 | // Sets the KYC registry address for this client_kycRegistry The new KYC registry address / | function _setKYCRegistry(address _kycRegistry) internal {
if (_kycRegistry == address(0)) {
revert RegistryZeroAddress();
}
address oldKYCRegistry = address(kycRegistry);
kycRegistry = IKYCRegistry(_kycRegistry);
emit KYCRegistrySet(oldKYCRegistry, _kycRegistry);
}
| function _setKYCRegistry(address _kycRegistry) internal {
if (_kycRegistry == address(0)) {
revert RegistryZeroAddress();
}
address oldKYCRegistry = address(kycRegistry);
kycRegistry = IKYCRegistry(_kycRegistry);
emit KYCRegistrySet(oldKYCRegistry, _kycRegistry);
}
| 1,649 |
133 | // HELPERS / | function assertUint104(uint256 num) internal pure {
require(num <= type(uint104).max, "Overflow uint104");
}
| function assertUint104(uint256 num) internal pure {
require(num <= type(uint104).max, "Overflow uint104");
}
| 13,631 |
55 | // Getting funds destination address. / | function getFundsDestination() public view returns (address) {
return fundsDestination;
}
| function getFundsDestination() public view returns (address) {
return fundsDestination;
}
| 21,859 |
249 | // Set mappings | mapping(uint256 => BigFanMetadata.PlayerCard) public bigFunCards; // NFT Id => Metadata
mapping(uint256 => BigFanMetadata.Collection) public bigFunCollections; // collectionId => Metadata
mapping(uint256 => bool) public bigFunCollectionExists; // collectionId => Exists
mapping(uint256 => string) publi... | mapping(uint256 => BigFanMetadata.PlayerCard) public bigFunCards; // NFT Id => Metadata
mapping(uint256 => BigFanMetadata.Collection) public bigFunCollections; // collectionId => Metadata
mapping(uint256 => bool) public bigFunCollectionExists; // collectionId => Exists
mapping(uint256 => string) publi... | 17,277 |
280 | // check value | require(msg.value == TOKEN_PRICE, "Insufficient fund.");
| require(msg.value == TOKEN_PRICE, "Insufficient fund.");
| 48,459 |
329 | // Lets the owner migrate `ProtocolControl` instances from a previous registry. | function addProtocolControl(address _deployer, address _protocolControl) external onlyOwner {
// Get version for protocolControl
uint256 version = getNextVersion(_deployer);
_protocolControls[_deployer].protocolControlAddress[version] = _protocolControl;
emit MigratedProtocolContro... | function addProtocolControl(address _deployer, address _protocolControl) external onlyOwner {
// Get version for protocolControl
uint256 version = getNextVersion(_deployer);
_protocolControls[_deployer].protocolControlAddress[version] = _protocolControl;
emit MigratedProtocolContro... | 19,249 |
33 | // Safe Function/This method can be used by the controller to extract mistakenly/_token The address of the token contract that you want to recover | function claimTokens(address _token) public onlyOwner returns(bool){
require(_token != address(LBC));
ERC20 token = ERC20(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
emit ClaimedTokens(_token, owner, balance);
return true;
}
| function claimTokens(address _token) public onlyOwner returns(bool){
require(_token != address(LBC));
ERC20 token = ERC20(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
emit ClaimedTokens(_token, owner, balance);
return true;
}
| 73,216 |
57 | // 2) disable the permissions desired on the `target` | target &= FULL_PRIVILEGES_MASK ^ (p & (FULL_PRIVILEGES_MASK ^ desired));
| target &= FULL_PRIVILEGES_MASK ^ (p & (FULL_PRIVILEGES_MASK ^ desired));
| 6,582 |
98 | // Check address | require(_address != address(0x0), "The address is invalid");
| require(_address != address(0x0), "The address is invalid");
| 28,787 |
40 | // And then we finally add it to the variable tracking the total amount spent to maintain invariance. | totalPayouts += payoutDiff;
| totalPayouts += payoutDiff;
| 10,142 |
68 | // IInterestSetter dYdX Interface that Interest Setters for Solo must implement in order to report interest rates. / | interface IInterestSetter {
// ============ Public Functions ============
/**
* Get the interest rate of a token given some borrowed and supplied amounts
*
* @param token The address of the ERC20 token for the market
* @param borrowWei The total borrowed token amount for the ma... | interface IInterestSetter {
// ============ Public Functions ============
/**
* Get the interest rate of a token given some borrowed and supplied amounts
*
* @param token The address of the ERC20 token for the market
* @param borrowWei The total borrowed token amount for the ma... | 26,947 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.