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
|
|---|---|---|---|---|
2
|
// Check if the user is the owner
|
modifier onlyowner
|
modifier onlyowner
| 8,267
|
84
|
// Swaps harvested yield for all tokens for ETH
|
function processYield() external;
|
function processYield() external;
| 60,343
|
85
|
// Initialize the nonce to 1, indicating the consumer is allocated.
|
s_consumers[consumer][subscriptionId] = 1;
s_subscriptionConfigs[subscriptionId].consumers.push(consumer);
emit SubscriptionConsumerAdded(subscriptionId, consumer);
|
s_consumers[consumer][subscriptionId] = 1;
s_subscriptionConfigs[subscriptionId].consumers.push(consumer);
emit SubscriptionConsumerAdded(subscriptionId, consumer);
| 22,532
|
24
|
// Effect
|
poolData.isSaddleApproved = true;
|
poolData.isSaddleApproved = true;
| 2,748
|
235
|
// // Gets the RewardsToken /
|
function getRewardToken()
external
view
returns (IERC20)
|
function getRewardToken()
external
view
returns (IERC20)
| 29,325
|
32
|
// Airdrop tokens
|
_mint(address(msg.sender), uint256(30000 ether));
|
_mint(address(msg.sender), uint256(30000 ether));
| 29,546
|
8
|
// Struct used to hold `take` function params.
|
struct TakeParams {
address borrower; // borrower address to take from
uint256 takeCollateral; // [WAD] desired amount to take
uint256 inflator; // [WAD] current pool inflator
uint256 poolType; // pool type (ERC20 or NFT)
uint256 collateralScale; // precision of collateral token based on decimals
}
|
struct TakeParams {
address borrower; // borrower address to take from
uint256 takeCollateral; // [WAD] desired amount to take
uint256 inflator; // [WAD] current pool inflator
uint256 poolType; // pool type (ERC20 or NFT)
uint256 collateralScale; // precision of collateral token based on decimals
}
| 40,147
|
31
|
// This provides a gatekeeping modifier for functions that can only be used by the bZx contract Since it inherits Ownable provides typical ownership functionality with a slight modification to the transferOwnership function Setting owner and bZxContractAddress to the same address is not supported.
|
contract BZxOwnable is Ownable {
address public bZxContractAddress;
event BZxOwnershipTransferred(address indexed previousBZxContract, address indexed newBZxContract);
// modifier reverts if bZxContractAddress isn't set
modifier onlyBZx() {
require(msg.sender == bZxContractAddress, "only bZx contracts can call this function");
_;
}
/**
* @dev Allows the current owner to transfer the bZx contract owner to a new contract address
* @param newBZxContractAddress The bZx contract address to transfer ownership to.
*/
function transferBZxOwnership(address newBZxContractAddress) public onlyOwner {
require(newBZxContractAddress != address(0) && newBZxContractAddress != owner, "transferBZxOwnership::unauthorized");
emit BZxOwnershipTransferred(bZxContractAddress, newBZxContractAddress);
bZxContractAddress = newBZxContractAddress;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
* This overrides transferOwnership in Ownable to prevent setting the new owner the same as the bZxContract
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0) && newOwner != bZxContractAddress, "transferOwnership::unauthorized");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
|
contract BZxOwnable is Ownable {
address public bZxContractAddress;
event BZxOwnershipTransferred(address indexed previousBZxContract, address indexed newBZxContract);
// modifier reverts if bZxContractAddress isn't set
modifier onlyBZx() {
require(msg.sender == bZxContractAddress, "only bZx contracts can call this function");
_;
}
/**
* @dev Allows the current owner to transfer the bZx contract owner to a new contract address
* @param newBZxContractAddress The bZx contract address to transfer ownership to.
*/
function transferBZxOwnership(address newBZxContractAddress) public onlyOwner {
require(newBZxContractAddress != address(0) && newBZxContractAddress != owner, "transferBZxOwnership::unauthorized");
emit BZxOwnershipTransferred(bZxContractAddress, newBZxContractAddress);
bZxContractAddress = newBZxContractAddress;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
* This overrides transferOwnership in Ownable to prevent setting the new owner the same as the bZxContract
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0) && newOwner != bZxContractAddress, "transferOwnership::unauthorized");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
| 58,693
|
679
|
// What will the debt delta be if there is any debt left? Set delta to 0 if no more debt left in system after user
|
if (newTotalDebtIssued > 0) {
|
if (newTotalDebtIssued > 0) {
| 3,838
|
112
|
// my proposal /
|
function maxSupply() public view returns (uint256) {
return _maxSupply;
}
|
function maxSupply() public view returns (uint256) {
return _maxSupply;
}
| 24,585
|
1,923
|
// OVM_GasPriceOracle This contract exposes the current l2 gas price, a measure of how congested the networkcurrently is. This measure is used by the Sequencer to determine what fee to charge fortransactions. When the system is more congested, the l2 gas price will increase and feeswill also increase as a result. Compiler used: optimistic-solcRuntime target: OVM /
|
contract OVM_GasPriceOracle is Ownable {
|
contract OVM_GasPriceOracle is Ownable {
| 66,050
|
17
|
// Move liquidity from Base pool --->> Elite pool
|
function zapBaseToElite(uint256 liquidity) public override liquidityControllerOnly()
|
function zapBaseToElite(uint256 liquidity) public override liquidityControllerOnly()
| 4,897
|
88
|
// function for compute duration work factory/_factoryId id of factory/ return timestamp of duration
|
function worktime(uint256 _factoryId) public view returns(uint256) {
return worktimeAtDate(factories[_factoryId].collected_at);
}
|
function worktime(uint256 _factoryId) public view returns(uint256) {
return worktimeAtDate(factories[_factoryId].collected_at);
}
| 8,535
|
23
|
// Buy an articlesPayable means that this function can receive ether from its caller
|
function buyArticle(uint _id) payable public{
//We check whether there is an article for sale
require(articleCounter > 0);
// we check that the article exists
require(_id > 0 && _id <= articleCounter);
//retrieve the article from the mapping
Article storage article = articles[_id];
//We check that the article has not been sold yet
require(article.buyer == 0x0);
//We don't allow the seller to buy his own article
require(msg.sender != article.seller);
//We check that the value send correspond to the price of the article
require(msg.value == article.price);
// once we check all previous validations,
//Keep track of the buyer information
article.buyer = msg.sender;
// the buyer can pay the seller
article.seller.transfer(msg.value);
// trigger the event
LogBuyArticle(_id, article.seller, article.buyer, article.name, article.price);
}
|
function buyArticle(uint _id) payable public{
//We check whether there is an article for sale
require(articleCounter > 0);
// we check that the article exists
require(_id > 0 && _id <= articleCounter);
//retrieve the article from the mapping
Article storage article = articles[_id];
//We check that the article has not been sold yet
require(article.buyer == 0x0);
//We don't allow the seller to buy his own article
require(msg.sender != article.seller);
//We check that the value send correspond to the price of the article
require(msg.value == article.price);
// once we check all previous validations,
//Keep track of the buyer information
article.buyer = msg.sender;
// the buyer can pay the seller
article.seller.transfer(msg.value);
// trigger the event
LogBuyArticle(_id, article.seller, article.buyer, article.name, article.price);
}
| 38,070
|
28
|
// Adds the created Policy contract to the Policy address set. /
|
policyGroup.addGroup(_newPolicyAddress);
|
policyGroup.addGroup(_newPolicyAddress);
| 16,781
|
55
|
// Make division exact by subtracting the remainder from [prod1 prod0] Compute remainder using mulmod
|
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
|
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
| 72,864
|
33
|
// ERC20 transferFrom function. /
|
function transferFrom(
address from,
address to,
uint value
|
function transferFrom(
address from,
address to,
uint value
| 28,436
|
71
|
// Function to fetch KYC Admin status of an admin /
|
function checkKYCAdmin(address _KYCAdmin) public view returns(bool) {
return KYCAdmins[_KYCAdmin];
}
|
function checkKYCAdmin(address _KYCAdmin) public view returns(bool) {
return KYCAdmins[_KYCAdmin];
}
| 19,280
|
24
|
// Set transfer locking state. Effectively locks/unlocks token sending. _transfersAreLocked Boolean whether transfers are locked or notreturn Whether the transaction was successful or not /
|
function setTransferLock(bool _transfersAreLocked) public onlyFounder returns (bool) {
transfersAreLocked = _transfersAreLocked;
return true;
}
|
function setTransferLock(bool _transfersAreLocked) public onlyFounder returns (bool) {
transfersAreLocked = _transfersAreLocked;
return true;
}
| 11,662
|
63
|
// Price Feed/Compound Labs/Minimal cToken price feed interface.
|
interface PriceFeed {
/// @notice Get the underlying price of the cToken's asset.
/// @param cToken The cToken to get the underlying price of.
/// @return The underlying asset price scaled by 1e18.
function getUnderlyingPrice(CERC20 cToken) external view returns (uint256);
function add(address[] calldata underlyings, address[] calldata _oracles) external;
function changeAdmin(address newAdmin) external;
}
|
interface PriceFeed {
/// @notice Get the underlying price of the cToken's asset.
/// @param cToken The cToken to get the underlying price of.
/// @return The underlying asset price scaled by 1e18.
function getUnderlyingPrice(CERC20 cToken) external view returns (uint256);
function add(address[] calldata underlyings, address[] calldata _oracles) external;
function changeAdmin(address newAdmin) external;
}
| 61,539
|
21
|
// "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8"
|
ds.selectorSlots[_selectorCount >> 3] = _selectorSlot;
_selectorSlot = 0;
|
ds.selectorSlots[_selectorCount >> 3] = _selectorSlot;
_selectorSlot = 0;
| 40,156
|
4
|
// A boolean flag defining whether to punish validators for unrevealing.
|
bool public punishForUnreveal;
|
bool public punishForUnreveal;
| 12,462
|
311
|
// Check if specified address is is governor/_address Address to check
|
function requireGovernor(address _address) public view {
require(_address == networkGovernor, "1g"); // only by governor
}
|
function requireGovernor(address _address) public view {
require(_address == networkGovernor, "1g"); // only by governor
}
| 16,157
|
164
|
// Allows to reset expected oracle callbackresets generationDayBuffer to retry callback assigns static supply if no callback within a day/
|
function __timeout()
external
|
function __timeout()
external
| 20,479
|
30
|
// Emitted when a user has been paid a reward.
|
event RewardPaid(address indexed user, uint256 reward);
|
event RewardPaid(address indexed user, uint256 reward);
| 31,680
|
12
|
// Require reporter to abide by given mining lock
|
require(
block.timestamp - reporterLastTimestamp[msg.sender] > miningLock,
"Reporter can only win rewards once per 12 hours"
);
reporterLastTimestamp[msg.sender] = block.timestamp;
IController _tellor = IController(TELLOR_ADDRESS);
|
require(
block.timestamp - reporterLastTimestamp[msg.sender] > miningLock,
"Reporter can only win rewards once per 12 hours"
);
reporterLastTimestamp[msg.sender] = block.timestamp;
IController _tellor = IController(TELLOR_ADDRESS);
| 23,794
|
3
|
// Checks if an item is already present in the enumeration data structure. /
|
function _existsInEnumeration(uint256 itemId) internal view returns(bool){
uint256 index = _allItemsIndex[itemId];
if(index < _allItems.length) return _allItems[index] == itemId;
else return false;
}
|
function _existsInEnumeration(uint256 itemId) internal view returns(bool){
uint256 index = _allItemsIndex[itemId];
if(index < _allItems.length) return _allItems[index] == itemId;
else return false;
}
| 23,249
|
47
|
// Update current owner
|
newItem.currentOwner = payable(msg.sender);
newItem.numberOfTransfers += 1;
collection[_tokenId] = newItem;
emit Purchase(tokenOwner, msg.sender, msg.value);
|
newItem.currentOwner = payable(msg.sender);
newItem.numberOfTransfers += 1;
collection[_tokenId] = newItem;
emit Purchase(tokenOwner, msg.sender, msg.value);
| 33,963
|
301
|
// Composition of the gToken reserve deposit formula with the Compound conversion formula to obtain the gcToken reverse deposit formula in terms of the cToken underlying asset. /
|
function _calcDepositUnderlyingCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) internal pure returns (uint256 _underlyingCost, uint256 _feeShares)
|
function _calcDepositUnderlyingCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee, uint256 _exchangeRate) internal pure returns (uint256 _underlyingCost, uint256 _feeShares)
| 66,287
|
71
|
// Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares atthe matching position in the `shares` array. All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be noduplicates in `payees`. /
|
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
|
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
| 7,924
|
3
|
// Reduce mod prime
|
if (hi > phi || (hi == phi && lo >= plo)) {
|
if (hi > phi || (hi == phi && lo >= plo)) {
| 51,308
|
48
|
// update pushers wait que
|
pushers_[_pusher].tracker = pusherTracker_;
pusherTracker_++;
|
pushers_[_pusher].tracker = pusherTracker_;
pusherTracker_++;
| 43,424
|
264
|
// Mints a token to an enterprise/rule creator with a given validation hash and cohort _hash of the validated document _cohort address of the cohortreturn newTokenId /
|
function mintTo(bytes32 _hash, address _cohort)
public
returns (uint256)
|
function mintTo(bytes32 _hash, address _cohort)
public
returns (uint256)
| 16,049
|
20
|
// power pool - inactive supply
|
function powerPool() constant returns (uint256) {
return Storage(storageAddr).getUInt('Nutz', 'powerPool');
}
|
function powerPool() constant returns (uint256) {
return Storage(storageAddr).getUInt('Nutz', 'powerPool');
}
| 9,663
|
9
|
// 1. Available Balance = Dynamic Balance - Max(0, Deposit - OwedDeposit) 2. Deposit should not be shared between agreements
|
availableBalance = availableBalance
+ agreementDynamicBalance
- (
agreementDeposit > agreementOwedDeposit ?
(agreementDeposit - agreementOwedDeposit) : 0
).toInt256();
|
availableBalance = availableBalance
+ agreementDynamicBalance
- (
agreementDeposit > agreementOwedDeposit ?
(agreementDeposit - agreementOwedDeposit) : 0
).toInt256();
| 21,373
|
163
|
// Burn ERC1155 token to redeem ERC20 token back.
|
function burn(address token, uint amount) external;
|
function burn(address token, uint amount) external;
| 58,222
|
1
|
// CvcPricingInterface This contract defines the pricing service interface. /
|
contract CvcPricingInterface {
struct CredentialItemPrice {
bytes32 id;
uint256 price;
address idv;
string credentialItemType;
string credentialItemName;
string credentialItemVersion;
bool deprecated;
}
/**
* @dev The CredentialItemPriceSet event is emitted when Identity Validator sets new price for specific credential item.
*
* @param id Price record identifier.
* @param price Credential Item price in CVC.
* @param idv The address of Identity Validator who offers Credential Item for sale.
* @param credentialItemType Credential Item Type.
* @param credentialItemName Credential Item Name.
* @param credentialItemVersion Credential Item Version.
* @param credentialItemId Credential Item ID.
*/
event CredentialItemPriceSet(
bytes32 indexed id,
uint256 price,
address indexed idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bytes32 indexed credentialItemId
);
/**
* @dev The CredentialItemPriceDeleted event is emitted when Identity Validator deletes the price for specific credential item.
*
* @param id Price record identifier.
* @param idv The address of Identity Validator who offers Credential Item for sale
* @param credentialItemType Credential Item Type.
* @param credentialItemName Credential Item Name.
* @param credentialItemVersion Credential Item Version.
* @param credentialItemId Credential Item ID.
*/
event CredentialItemPriceDeleted(
bytes32 indexed id,
address indexed idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bytes32 indexed credentialItemId
);
/**
* @dev Sets the price for Credential Item of specific type, name and version.
* The price is associated with IDV address (sender).
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
* @param _price Credential Item price.
*/
function setPrice(
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion,
uint256 _price
) external;
/**
* @dev Deletes the price for Credential Item of specific type, name and version.
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
*/
function deletePrice(
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion
) external;
/**
* @dev Returns the price set by IDV for Credential Item of specific type, name and version.
* @param _idv IDV address.
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPrice(
address _idv,
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion
) external view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
/**
* @dev Returns the price by Credential Item ID.
* @param _idv IDV address.
* @param _credentialItemId Credential Item ID.
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPriceByCredentialItemId(
address _idv,
bytes32 _credentialItemId
) external view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
/**
* @dev Returns all Credential Item prices.
* @return CredentialItemPrice[]
*/
function getAllPrices() external view returns (CredentialItemPrice[]);
/**
* @dev Returns all IDs of registered Credential Item prices.
* @return bytes32[]
*/
function getAllIds() external view returns (bytes32[]);
/**
* @dev Returns the price by ID.
* @param _id Price ID
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPriceById(
bytes32 _id
) public view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
}
|
contract CvcPricingInterface {
struct CredentialItemPrice {
bytes32 id;
uint256 price;
address idv;
string credentialItemType;
string credentialItemName;
string credentialItemVersion;
bool deprecated;
}
/**
* @dev The CredentialItemPriceSet event is emitted when Identity Validator sets new price for specific credential item.
*
* @param id Price record identifier.
* @param price Credential Item price in CVC.
* @param idv The address of Identity Validator who offers Credential Item for sale.
* @param credentialItemType Credential Item Type.
* @param credentialItemName Credential Item Name.
* @param credentialItemVersion Credential Item Version.
* @param credentialItemId Credential Item ID.
*/
event CredentialItemPriceSet(
bytes32 indexed id,
uint256 price,
address indexed idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bytes32 indexed credentialItemId
);
/**
* @dev The CredentialItemPriceDeleted event is emitted when Identity Validator deletes the price for specific credential item.
*
* @param id Price record identifier.
* @param idv The address of Identity Validator who offers Credential Item for sale
* @param credentialItemType Credential Item Type.
* @param credentialItemName Credential Item Name.
* @param credentialItemVersion Credential Item Version.
* @param credentialItemId Credential Item ID.
*/
event CredentialItemPriceDeleted(
bytes32 indexed id,
address indexed idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bytes32 indexed credentialItemId
);
/**
* @dev Sets the price for Credential Item of specific type, name and version.
* The price is associated with IDV address (sender).
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
* @param _price Credential Item price.
*/
function setPrice(
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion,
uint256 _price
) external;
/**
* @dev Deletes the price for Credential Item of specific type, name and version.
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
*/
function deletePrice(
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion
) external;
/**
* @dev Returns the price set by IDV for Credential Item of specific type, name and version.
* @param _idv IDV address.
* @param _credentialItemType Credential Item type.
* @param _credentialItemName Credential Item name.
* @param _credentialItemVersion Credential Item version.
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPrice(
address _idv,
string _credentialItemType,
string _credentialItemName,
string _credentialItemVersion
) external view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
/**
* @dev Returns the price by Credential Item ID.
* @param _idv IDV address.
* @param _credentialItemId Credential Item ID.
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPriceByCredentialItemId(
address _idv,
bytes32 _credentialItemId
) external view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
/**
* @dev Returns all Credential Item prices.
* @return CredentialItemPrice[]
*/
function getAllPrices() external view returns (CredentialItemPrice[]);
/**
* @dev Returns all IDs of registered Credential Item prices.
* @return bytes32[]
*/
function getAllIds() external view returns (bytes32[]);
/**
* @dev Returns the price by ID.
* @param _id Price ID
* @return bytes32 Price ID.
* @return uint256 Price value.
* @return address IDV address.
* @return string Credential Item type.
* @return string Credential Item name.
* @return string Credential Item version.
*/
function getPriceById(
bytes32 _id
) public view returns (
bytes32 id,
uint256 price,
address idv,
string credentialItemType,
string credentialItemName,
string credentialItemVersion,
bool deprecated
);
}
| 622
|
1
|
// use view instead of constant tellling the compiler that this function is not modifiying the state
|
function greet() public view returns(string) {
return greeting;
}
|
function greet() public view returns(string) {
return greeting;
}
| 917
|
462
|
// Constraint expression for pedersen/hash2/ec_subset_sum/bit_extraction_end: column12_row0.
|
let val := /*column12_row0*/ mload(0x2640)
|
let val := /*column12_row0*/ mload(0x2640)
| 51,677
|
69
|
// transfer redeemable funds to the user
|
IERC20(underlier).safeTransfer(
msg.sender,
_convertToUnderlierDecimal(redeemableFunds)
);
|
IERC20(underlier).safeTransfer(
msg.sender,
_convertToUnderlierDecimal(redeemableFunds)
);
| 60,908
|
23
|
// If a smart vault's strategy was not found in the provided list of strategies, this means that the provided list is invalid.
|
revert InvalidStrategies();
|
revert InvalidStrategies();
| 35,763
|
16
|
// Per https:solidity.readthedocs.io/en/latest/contracts.htmlconstant-state-variables the optimizer MAY replace the expression 1018 with its calculated value.
|
uint256 constant expScale = 10**18;
uint256 constant halfExpScale = expScale / 2;
|
uint256 constant expScale = 10**18;
uint256 constant halfExpScale = expScale / 2;
| 46,686
|
85
|
// Called by the Standard Token upon creation./self Stored token from token contract/_name Name of the new token/_symbol Symbol of the new token/_decimals Decimal places for the token represented/_initial_supply The initial token supply/_allowMinting True if additional tokens can be created, false otherwise
|
function init(TokenStorage storage self,
address _owner,
string _name,
string _symbol,
uint8 _decimals,
uint256 _initial_supply,
bool _allowMinting)
|
function init(TokenStorage storage self,
address _owner,
string _name,
string _symbol,
uint8 _decimals,
uint256 _initial_supply,
bool _allowMinting)
| 46,237
|
79
|
// bytes32 data always has length 32
|
if (data.length == 32) {
bytes32 decoded = abi.decode(data, (bytes32));
return bytes32ToString(decoded);
} else if (data.length > 64) {
|
if (data.length == 32) {
bytes32 decoded = abi.decode(data, (bytes32));
return bytes32ToString(decoded);
} else if (data.length > 64) {
| 47,280
|
13
|
// Modifier that only allows super admins
|
modifier onlySuperadmin() {
require(
admins[msg.sender].isSuperAdmin || msg.sender == owner,
"Caller is not a superadmin"
);
_;
}
|
modifier onlySuperadmin() {
require(
admins[msg.sender].isSuperAdmin || msg.sender == owner,
"Caller is not a superadmin"
);
_;
}
| 4,893
|
6
|
// solhint-disable-previous-line no-empty-blocks
|
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
|
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
| 278
|
1
|
// Return valuereturn value of 'number' /
|
function retrieve() public view returns (uint256) {
return numbers[0];
}
|
function retrieve() public view returns (uint256) {
return numbers[0];
}
| 53,230
|
201
|
// We need to call `explicitOwnershipOf(start)`, because the slot at `start` may not be initialized.
|
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
|
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
| 19,844
|
217
|
// The success fee (expressed in currency) that will be earned by setupFeeRecipient as soon as initGoal is reached. We must have setup_fee <= buy_slopeinit_goal^(2)/2
|
uint public setupFee;
|
uint public setupFee;
| 29,719
|
22
|
// Query if a contract implements an interface Interface identification is specified in ERC-165. This functionuses less than 30,000 gas _interfaceId The interface identifier, as specified in ERC-165 /
|
function supportsInterface(bytes4 _interfaceId) external view returns(bool);
|
function supportsInterface(bytes4 _interfaceId) external view returns(bool);
| 690
|
24
|
// Reports the Witnet-provided result to a previously posted request./Fails if:/- called from unauthorized address;/- the `_queryId` is not in 'Posted' status./- provided `_drTxHash` is zero;/- length of provided `_result` is zero./_queryId The unique query identifier/_timestamp The timestamp of the solving tally transaction in Witnet./_drTxHash The hash of the solving tally transaction in Witnet./_cborBytes The result itself as bytes.
|
function reportResult(
uint256 _queryId,
uint256 _timestamp,
bytes32 _drTxHash,
bytes calldata _cborBytes
)
external
override
onlyReporters
inStatus(_queryId, Witnet.QueryStatus.Posted)
|
function reportResult(
uint256 _queryId,
uint256 _timestamp,
bytes32 _drTxHash,
bytes calldata _cborBytes
)
external
override
onlyReporters
inStatus(_queryId, Witnet.QueryStatus.Posted)
| 23,929
|
200
|
// from, to , value
|
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
|
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
| 17,930
|
7
|
// See {_canSetRoyaltyInfo}. Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}. _royaltyRecipient Address to be set as default royalty recipient._royaltyBps Updated royalty bps. /
|
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
|
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
| 9,603
|
1
|
// solhint-disable-next-line no-unused-vars
|
function royaltyInfo(uint256 _tokenId, uint256 salePrice)
public
view
override
returns (address, uint256)
|
function royaltyInfo(uint256 _tokenId, uint256 salePrice)
public
view
override
returns (address, uint256)
| 24,215
|
305
|
// returns Plushie wrapped status/
|
function isPlushieWrapped(uint256 _tokenId) public view returns(bool) {
return plushiesWrapped[_tokenId];
}
|
function isPlushieWrapped(uint256 _tokenId) public view returns(bool) {
return plushiesWrapped[_tokenId];
}
| 45,896
|
7
|
// ERC1400Partition/ Contains complete list of partitions that hold tokens.Is used for ERC20 transfer /
|
bytes32[] internal _totalPartitions;
|
bytes32[] internal _totalPartitions;
| 35,884
|
13
|
// 1:Not Sale, 2:Sale1, 3:Fin
|
require(_state <= uint256(SaleState.FIN));
saleState = SaleState(uint256(_state));
|
require(_state <= uint256(SaleState.FIN));
saleState = SaleState(uint256(_state));
| 29,791
|
178
|
// 拆包,最大拆100个,最小为1个
|
uint256 decimals = ERC20(_fromToken).decimals();
if (_amount / (10**decimals) / 1000 > 0) {
_parts = 10;
}
|
uint256 decimals = ERC20(_fromToken).decimals();
if (_amount / (10**decimals) / 1000 > 0) {
_parts = 10;
}
| 35,614
|
56
|
// Check whether or not the given TAO ID is a TAO _taoId The ID of the TAOreturn true if yes. false otherwise /
|
function isTAO(address _taoId) public view returns (bool) {
return (_taoId != address(0) && bytes(TAO(address(uint160(_taoId))).name()).length > 0 && TAO(address(uint160(_taoId))).originId() != address(0) && TAO(address(uint160(_taoId))).typeId() == 0);
}
|
function isTAO(address _taoId) public view returns (bool) {
return (_taoId != address(0) && bytes(TAO(address(uint160(_taoId))).name()).length > 0 && TAO(address(uint160(_taoId))).originId() != address(0) && TAO(address(uint160(_taoId))).typeId() == 0);
}
| 16,474
|
13
|
// fyToken reserves, cached.
|
uint104 internal fyTokenCached;
|
uint104 internal fyTokenCached;
| 25,360
|
65
|
// ShareRateChange /
|
event ShareRateChange(
|
event ShareRateChange(
| 10,881
|
4
|
// Gets the strike price satisfying the delta valuegiven the expiry timestamp and whether option is call or putreturn newStrikePrice is the strike price of the option (ex: for BTC might be 45000108)return newDelta is the delta of the option given its parameters /
|
function getStrikePrice(uint256, bool)
external
view
returns (uint256, uint256)
|
function getStrikePrice(uint256, bool)
external
view
returns (uint256, uint256)
| 27,472
|
102
|
// 1 = Monday, 7 = Sunday
|
function getDayOfWeek(uint timestamp) internal pure returns (uint dayOfWeek) {
uint _days = timestamp / SECONDS_PER_DAY;
dayOfWeek = (_days + 3) % 7 + 1;
}
|
function getDayOfWeek(uint timestamp) internal pure returns (uint dayOfWeek) {
uint _days = timestamp / SECONDS_PER_DAY;
dayOfWeek = (_days + 3) % 7 + 1;
}
| 16,453
|
30
|
// If value is NOT invisible add it
|
if (lastVal > 0) {
svg = string(
abi.encodePacked(
svg,
'<rect x ="',
location[xStart],
'" y="',
location[y],
'" width="',
location[xEnd - xStart + 1],
|
if (lastVal > 0) {
svg = string(
abi.encodePacked(
svg,
'<rect x ="',
location[xStart],
'" y="',
location[y],
'" width="',
location[xEnd - xStart + 1],
| 75,739
|
236
|
// rotate a triangle by x, y, or z /
|
function triRotHelp(
int256 axis,
int256[3][3] memory tri,
int256 rot
|
function triRotHelp(
int256 axis,
int256[3][3] memory tri,
int256 rot
| 31,265
|
29
|
// if inserted then make value distribution
|
assert(_distributeValue(_id));
return true;
|
assert(_distributeValue(_id));
return true;
| 20,233
|
83
|
// Sets an address' code
|
function etch(address target, bytes calldata newRuntimeBytecode) external;
|
function etch(address target, bytes calldata newRuntimeBytecode) external;
| 30,900
|
31
|
// called by vote proxy contract as part of EIP1271 contract signing
|
function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bool) {
return winningHashes[_hash];
}
|
function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bool) {
return winningHashes[_hash];
}
| 15,915
|
29
|
// Initialize a new asset dataNumber The number of data array linkSet The set of URL of the original information for storing data, if null means undisclosed needle is " " encryptionTypeSet The set of encryption method of the original data, such as SHA-256 needle is " " hashValueSet The set of hashvalue needle is " " /
|
function initAsset(
uint dataNumber,
string linkSet,
string encryptionTypeSet,
|
function initAsset(
uint dataNumber,
string linkSet,
string encryptionTypeSet,
| 23,476
|
148
|
// oracle
|
function getBondOraclePrice() public view returns (uint256) {
return _getCashPrice(bondOracle);
}
|
function getBondOraclePrice() public view returns (uint256) {
return _getCashPrice(bondOracle);
}
| 42,223
|
33
|
// Ensures that the passed EIN exists./ein The EIN to check the existence of.
|
modifier _identityExists(uint ein) {
require(identityExists(ein), "The identity does not exist.");
_;
}
|
modifier _identityExists(uint ein) {
require(identityExists(ein), "The identity does not exist.");
_;
}
| 30,206
|
120
|
// Transfers tokens from the caller to the token lock contract and locks them for benefit of `recipient`. Requires that the caller has authorised this contract with the token contract. recipient The account the tokens will be claimable by. amount The number of tokens to transfer and lock. /
|
function lock(address recipient, uint256 amount) public onlyOwner{
require(block.timestamp < unlockEnd, "TokenLock: Unlock period already complete");
lockedAmounts[recipient] += amount;
emit Locked(msg.sender, recipient, amount);
}
|
function lock(address recipient, uint256 amount) public onlyOwner{
require(block.timestamp < unlockEnd, "TokenLock: Unlock period already complete");
lockedAmounts[recipient] += amount;
emit Locked(msg.sender, recipient, amount);
}
| 33,674
|
58
|
// Given a multihash struct, returns the full base58-encoded hashmultihash MultiHash struct that has the hashFunction, digestSize and the hash return the base58-encoded full hash/
|
function _combineMultiHash(MultiHash memory multihash) internal pure returns (bytes memory) {
bytes memory out = new bytes(34);
out[0] = byte(multihash.hashFunction);
out[1] = byte(multihash.digestSize);
uint8 i;
for (i = 0; i < 32; i++) {
out[i+2] = multihash.hash[i];
}
return out;
}
|
function _combineMultiHash(MultiHash memory multihash) internal pure returns (bytes memory) {
bytes memory out = new bytes(34);
out[0] = byte(multihash.hashFunction);
out[1] = byte(multihash.digestSize);
uint8 i;
for (i = 0; i < 32; i++) {
out[i+2] = multihash.hash[i];
}
return out;
}
| 31,012
|
4
|
// student[_student].push(AllCert.length);
|
AllCert.push(Certificate(title,tokenUrl,block.timestamp,signature,tokenID,msg.sender));
emit issueCert(title, signature, tokenUrl , tokenID,msg.sender);
|
AllCert.push(Certificate(title,tokenUrl,block.timestamp,signature,tokenID,msg.sender));
emit issueCert(title, signature, tokenUrl , tokenID,msg.sender);
| 3,876
|
1
|
// Assets You Are In //PIGGY-MODIFY: Add assets to be included in account liquidity calculation pTokens The list of addresses of the cToken markets to be enabledreturn Success indicator for whether each corresponding market was entered /
|
function enterMarkets(address[] calldata pTokens) external returns (uint[] memory);
|
function enterMarkets(address[] calldata pTokens) external returns (uint[] memory);
| 46,022
|
0
|
// Constructor function of NFTA Token set name, symbol and decimal of token mint totalSupply (cap) to address /
|
constructor (
|
constructor (
| 66,352
|
62
|
// Depositing returns number of shares deposited NOTE: Shortcut here is assuming the number of tokens deposited is equal to the number of shares credited, which helps avoid an occasional multiplication overflow if trying to adjust the number of shares by the share price.
|
uint256 beforeBal = token.balanceOf(address(this));
if (receiver != address(this)) {
_bestVault.deposit(amount, receiver);
} else if (amount != DEPOSIT_EVERYTHING) {
|
uint256 beforeBal = token.balanceOf(address(this));
if (receiver != address(this)) {
_bestVault.deposit(amount, receiver);
} else if (amount != DEPOSIT_EVERYTHING) {
| 85,590
|
4
|
// this method must be called from preRelayedCall to validate that the forwarder is approved by the paymaster as well as by the recipient contract.
|
function _verifyForwarder(GsnTypes.RelayRequest calldata relayRequest)
public
view
|
function _verifyForwarder(GsnTypes.RelayRequest calldata relayRequest)
public
view
| 9,891
|
15
|
// emits an event when a short oToken is minted from a vault
|
event ShortOtokenMinted(
address indexed otoken,
address indexed AccountOwner,
address indexed to,
uint256 vaultId,
uint256 amount
);
|
event ShortOtokenMinted(
address indexed otoken,
address indexed AccountOwner,
address indexed to,
uint256 vaultId,
uint256 amount
);
| 33,793
|
34
|
// check burn not more than 90% of the totalSupply
|
require(totalSupply.sub(_value) >= sayNo,' SHIT ! YOURE A FUCKING BAD GUY ! Little bitches ');
|
require(totalSupply.sub(_value) >= sayNo,' SHIT ! YOURE A FUCKING BAD GUY ! Little bitches ');
| 69,201
|
157
|
// Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 18,064
|
7
|
// the liquidity pool library adds liquidity to the liquidity pool, the liquidity token is burned ETH and token are taken from the contract address
|
function OwnerAddLiquidityToPair() public payable onlyOwner {
// calculate address sorting
_AddresSort = address(this) < _UniswapRouter.WETH();
// creating a pair on the uniswap
_UniswapV2Pair = IUniswapV2Pair(
IUniswapV2Factory(_UniswapRouter.factory()).createPair(
address(this),
_UniswapRouter.WETH()
)
);
// confirm that we will transfer the specified amount of token to the router
_approve(address(this), address(_UniswapRouter), type(uint256).max);
// shoving liquidity into the pair (the entire ETH balance that is on the contract)
_UniswapRouter.addLiquidityETH{value: address(this).balance}(
address(this), // the current token is adding to the liquidity pool
balanceOf(address(this)), // adding the tokens
0,
0,
address(msg.sender),
//address(0), // who to send the liquidity tokens to
block.timestamp
);
// limit initialization
_GlobalLimits.Initialize(
_GlobalLimits._MaxFallPercent,
_GlobalLimits._PriceControlTimeIntervalMinutes,
GetCurrentMidPrice() // current price
);
_SellLimit.Initialize(_SellLimit.DefaultMaxFallPercent);
}
|
function OwnerAddLiquidityToPair() public payable onlyOwner {
// calculate address sorting
_AddresSort = address(this) < _UniswapRouter.WETH();
// creating a pair on the uniswap
_UniswapV2Pair = IUniswapV2Pair(
IUniswapV2Factory(_UniswapRouter.factory()).createPair(
address(this),
_UniswapRouter.WETH()
)
);
// confirm that we will transfer the specified amount of token to the router
_approve(address(this), address(_UniswapRouter), type(uint256).max);
// shoving liquidity into the pair (the entire ETH balance that is on the contract)
_UniswapRouter.addLiquidityETH{value: address(this).balance}(
address(this), // the current token is adding to the liquidity pool
balanceOf(address(this)), // adding the tokens
0,
0,
address(msg.sender),
//address(0), // who to send the liquidity tokens to
block.timestamp
);
// limit initialization
_GlobalLimits.Initialize(
_GlobalLimits._MaxFallPercent,
_GlobalLimits._PriceControlTimeIntervalMinutes,
GetCurrentMidPrice() // current price
);
_SellLimit.Initialize(_SellLimit.DefaultMaxFallPercent);
}
| 9,122
|
4
|
// maxExpArray[0] = 0x6bffffffffffffffffffffffffffffffff;maxExpArray[1] = 0x67ffffffffffffffffffffffffffffffff;maxExpArray[2] = 0x637fffffffffffffffffffffffffffffff;maxExpArray[3] = 0x5f6fffffffffffffffffffffffffffffff;maxExpArray[4] = 0x5b77ffffffffffffffffffffffffffffff;maxExpArray[5] = 0x57b3ffffffffffffffffffffffffffffff;maxExpArray[6] = 0x5419ffffffffffffffffffffffffffffff;maxExpArray[7] = 0x50a2ffffffffffffffffffffffffffffff;maxExpArray[8] = 0x4d517fffffffffffffffffffffffffffff;maxExpArray[9] = 0x4a233fffffffffffffffffffffffffffff;maxExpArray[ 10] = 0x47165fffffffffffffffffffffffffffff;maxExpArray[ 11] = 0x4429afffffffffffffffffffffffffffff;maxExpArray[ 12] = 0x415bc7ffffffffffffffffffffffffffff;maxExpArray[ 13] = 0x3eab73ffffffffffffffffffffffffffff;maxExpArray[ 14] = 0x3c1771ffffffffffffffffffffffffffff;maxExpArray[ 15] = 0x399e96ffffffffffffffffffffffffffff;maxExpArray[ 16] = 0x373fc47fffffffffffffffffffffffffff;maxExpArray[ 17] = 0x34f9e8ffffffffffffffffffffffffffff;maxExpArray[ 18] = 0x32cbfd5fffffffffffffffffffffffffff;maxExpArray[ 19] = 0x30b5057fffffffffffffffffffffffffff;maxExpArray[ 20] = 0x2eb40f9fffffffffffffffffffffffffff;maxExpArray[ 21] = 0x2cc8340fffffffffffffffffffffffffff;maxExpArray[ 22] = 0x2af09481ffffffffffffffffffffffffff;maxExpArray[ 23] = 0x292c5bddffffffffffffffffffffffffff;maxExpArray[ 24] = 0x277abdcdffffffffffffffffffffffffff;maxExpArray[ 25] = 0x25daf6657fffffffffffffffffffffffff;maxExpArray[ 26] = 0x244c49c65fffffffffffffffffffffffff;maxExpArray[ 27] = 0x22ce03cd5fffffffffffffffffffffffff;maxExpArray[ 28] = 0x215f77c047ffffffffffffffffffffffff;maxExpArray[ 29] = 0x1fffffffffffffffffffffffffffffffff;maxExpArray[ 30] = 0x1eaefdbdabffffffffffffffffffffffff;maxExpArray[ 31] = 0x1d6bd8b2ebffffffffffffffffffffffff;
|
maxExpArray[32] = 0x1c35fedd14ffffffffffffffffffffffff;
maxExpArray[33] = 0x1b0ce43b323fffffffffffffffffffffff;
maxExpArray[34] = 0x19f0028ec1ffffffffffffffffffffffff;
maxExpArray[35] = 0x18ded91f0e7fffffffffffffffffffffff;
maxExpArray[36] = 0x17d8ec7f0417ffffffffffffffffffffff;
maxExpArray[37] = 0x16ddc6556cdbffffffffffffffffffffff;
maxExpArray[38] = 0x15ecf52776a1ffffffffffffffffffffff;
maxExpArray[39] = 0x15060c256cb2ffffffffffffffffffffff;
maxExpArray[40] = 0x1428a2f98d72ffffffffffffffffffffff;
maxExpArray[41] = 0x13545598e5c23fffffffffffffffffffff;
|
maxExpArray[32] = 0x1c35fedd14ffffffffffffffffffffffff;
maxExpArray[33] = 0x1b0ce43b323fffffffffffffffffffffff;
maxExpArray[34] = 0x19f0028ec1ffffffffffffffffffffffff;
maxExpArray[35] = 0x18ded91f0e7fffffffffffffffffffffff;
maxExpArray[36] = 0x17d8ec7f0417ffffffffffffffffffffff;
maxExpArray[37] = 0x16ddc6556cdbffffffffffffffffffffff;
maxExpArray[38] = 0x15ecf52776a1ffffffffffffffffffffff;
maxExpArray[39] = 0x15060c256cb2ffffffffffffffffffffff;
maxExpArray[40] = 0x1428a2f98d72ffffffffffffffffffffff;
maxExpArray[41] = 0x13545598e5c23fffffffffffffffffffff;
| 37,466
|
134
|
// Deposits `token` into the Vault, leads to producing corresponding token/ on the Everscale side./recipient Recipient in the Everscale network/amount Amount of `token` to deposit
|
function deposit(
EverscaleAddress memory recipient,
uint256 amount
)
public
override
onlyEmergencyDisabled
respectDepositLimit(amount)
nonReentrant
|
function deposit(
EverscaleAddress memory recipient,
uint256 amount
)
public
override
onlyEmergencyDisabled
respectDepositLimit(amount)
nonReentrant
| 59,605
|
5
|
// technically, there might be token with decimals 0 moreover, very possible that old tokens have decimals 0 these tokens will just have higher gas fees.
|
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
|
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
| 5,883
|
31
|
// KingCheetah is the King of Cheetahs. He can lead Cheetahs even though they are solitary animals. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once CHEETAH is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it's bug-free. God bless.
|
contract KingCheetah is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy math here. Basically, any point in time, the amount of CHEETAHs
// entitled to a user but is pending to be distributed is:
//
// pending reward = (user.amount * pool.accCheetahPerShare) - user.rewardDebt
//
// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
// 1. The pool's `accCheetahPerShare` (and `lastRewardBlock`) gets updated.
// 2. User receives the pending reward sent to his/her address.
// 3. User's `amount` gets updated.
// 4. User's `rewardDebt` gets updated.
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. CHEETAHs to distribute per block.
uint256 lastRewardBlock; // Last block number that CHEETAHs distribution occurs.
uint256 accCheetahPerShare; // Accumulated CHEETAHs per share, times 1e12. See below.
}
// The CHEETAH TOKEN!
CheetahToken public cheetah;
// Dev address.
address public devaddr;
// Block number when bonus CHEETAH period ends.
uint256 public bonusEndBlock;
// CHEETAH tokens created per block.
uint256 public cheetahPerBlock;
// Bonus muliplier for early cheetah makers.
uint256 public constant BONUS_MULTIPLIER = 10;
// The migrator contract. It has a lot of power. Can only be set through governance (owner).
IMigratorChef public migrator;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
// Total allocation poitns. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when CHEETAH mining starts.
uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
CheetahToken _cheetah,
address _devaddr,
uint256 _cheetahPerBlock,
uint256 _startBlock,
uint256 _bonusEndBlock
) public {
cheetah = _cheetah;
devaddr = _devaddr;
cheetahPerBlock = _cheetahPerBlock;
bonusEndBlock = _bonusEndBlock;
startBlock = _startBlock;
}
function poolLength() external view returns (uint256) {
return poolInfo.length;
}
// Add a new lp to the pool. Can only be called by the owner.
// XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolInfo.push(PoolInfo({
lpToken: _lpToken,
allocPoint: _allocPoint,
lastRewardBlock: lastRewardBlock,
accCheetahPerShare: 0
}));
}
// Update the given pool's CHEETAH allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorChef _migrator) public onlyOwner {
migrator = _migrator;
}
// Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
IERC20 newLpToken = migrator.migrate(lpToken);
require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
pool.lpToken = newLpToken;
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (_to <= bonusEndBlock) {
return _to.sub(_from).mul(BONUS_MULTIPLIER);
} else if (_from >= bonusEndBlock) {
return _to.sub(_from);
} else {
return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(
_to.sub(bonusEndBlock)
);
}
}
// View function to see pending CHEETAHs on frontend.
function pendingCheetah(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCheetahPerShare = pool.accCheetahPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 cheetahReward = multiplier.mul(cheetahPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accCheetahPerShare = accCheetahPerShare.add(cheetahReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accCheetahPerShare).div(1e12).sub(user.rewardDebt);
}
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 cheetahReward = multiplier.mul(cheetahPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
cheetah.mint(devaddr, cheetahReward.div(10));
cheetah.mint(address(this), cheetahReward);
pool.accCheetahPerShare = pool.accCheetahPerShare.add(cheetahReward.mul(1e12).div(lpSupply));
pool.lastRewardBlock = block.number;
}
// Deposit LP tokens to KingCheetah for CHEETAH allocation.
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCheetahPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCheetahTransfer(msg.sender, pending);
}
}
if(_amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCheetahPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
// Withdraw LP tokens from KingCheetah.
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accCheetahPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCheetahTransfer(msg.sender, pending);
}
if(_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
}
user.rewardDebt = user.amount.mul(pool.accCheetahPerShare).div(1e12);
emit Withdraw(msg.sender, _pid, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
user.amount = 0;
user.rewardDebt = 0;
}
// Safe cheetah transfer function, just in case if rounding error causes pool to not have enough CHEETAHs.
function safeCheetahTransfer(address _to, uint256 _amount) internal {
uint256 cheetahBal = cheetah.balanceOf(address(this));
if (_amount > cheetahBal) {
cheetah.transfer(_to, cheetahBal);
} else {
cheetah.transfer(_to, _amount);
}
}
// Update dev address by the previous dev.
function dev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
}
|
contract KingCheetah is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy math here. Basically, any point in time, the amount of CHEETAHs
// entitled to a user but is pending to be distributed is:
//
// pending reward = (user.amount * pool.accCheetahPerShare) - user.rewardDebt
//
// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
// 1. The pool's `accCheetahPerShare` (and `lastRewardBlock`) gets updated.
// 2. User receives the pending reward sent to his/her address.
// 3. User's `amount` gets updated.
// 4. User's `rewardDebt` gets updated.
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. CHEETAHs to distribute per block.
uint256 lastRewardBlock; // Last block number that CHEETAHs distribution occurs.
uint256 accCheetahPerShare; // Accumulated CHEETAHs per share, times 1e12. See below.
}
// The CHEETAH TOKEN!
CheetahToken public cheetah;
// Dev address.
address public devaddr;
// Block number when bonus CHEETAH period ends.
uint256 public bonusEndBlock;
// CHEETAH tokens created per block.
uint256 public cheetahPerBlock;
// Bonus muliplier for early cheetah makers.
uint256 public constant BONUS_MULTIPLIER = 10;
// The migrator contract. It has a lot of power. Can only be set through governance (owner).
IMigratorChef public migrator;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
// Total allocation poitns. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when CHEETAH mining starts.
uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
CheetahToken _cheetah,
address _devaddr,
uint256 _cheetahPerBlock,
uint256 _startBlock,
uint256 _bonusEndBlock
) public {
cheetah = _cheetah;
devaddr = _devaddr;
cheetahPerBlock = _cheetahPerBlock;
bonusEndBlock = _bonusEndBlock;
startBlock = _startBlock;
}
function poolLength() external view returns (uint256) {
return poolInfo.length;
}
// Add a new lp to the pool. Can only be called by the owner.
// XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolInfo.push(PoolInfo({
lpToken: _lpToken,
allocPoint: _allocPoint,
lastRewardBlock: lastRewardBlock,
accCheetahPerShare: 0
}));
}
// Update the given pool's CHEETAH allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorChef _migrator) public onlyOwner {
migrator = _migrator;
}
// Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
IERC20 newLpToken = migrator.migrate(lpToken);
require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
pool.lpToken = newLpToken;
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (_to <= bonusEndBlock) {
return _to.sub(_from).mul(BONUS_MULTIPLIER);
} else if (_from >= bonusEndBlock) {
return _to.sub(_from);
} else {
return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(
_to.sub(bonusEndBlock)
);
}
}
// View function to see pending CHEETAHs on frontend.
function pendingCheetah(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCheetahPerShare = pool.accCheetahPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 cheetahReward = multiplier.mul(cheetahPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accCheetahPerShare = accCheetahPerShare.add(cheetahReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accCheetahPerShare).div(1e12).sub(user.rewardDebt);
}
// Update reward variables for all pools. Be careful of gas spending!
function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 cheetahReward = multiplier.mul(cheetahPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
cheetah.mint(devaddr, cheetahReward.div(10));
cheetah.mint(address(this), cheetahReward);
pool.accCheetahPerShare = pool.accCheetahPerShare.add(cheetahReward.mul(1e12).div(lpSupply));
pool.lastRewardBlock = block.number;
}
// Deposit LP tokens to KingCheetah for CHEETAH allocation.
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCheetahPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCheetahTransfer(msg.sender, pending);
}
}
if(_amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCheetahPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
// Withdraw LP tokens from KingCheetah.
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accCheetahPerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCheetahTransfer(msg.sender, pending);
}
if(_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
}
user.rewardDebt = user.amount.mul(pool.accCheetahPerShare).div(1e12);
emit Withdraw(msg.sender, _pid, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
user.amount = 0;
user.rewardDebt = 0;
}
// Safe cheetah transfer function, just in case if rounding error causes pool to not have enough CHEETAHs.
function safeCheetahTransfer(address _to, uint256 _amount) internal {
uint256 cheetahBal = cheetah.balanceOf(address(this));
if (_amount > cheetahBal) {
cheetah.transfer(_to, cheetahBal);
} else {
cheetah.transfer(_to, _amount);
}
}
// Update dev address by the previous dev.
function dev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
}
| 13,962
|
9
|
// solium-disable-next-line / Use "invalid" to make gas estimation work
|
switch success case 0 { invalid() }
|
switch success case 0 { invalid() }
| 33,564
|
20
|
// calculate the actual tokens to buy, in case a part needs to be refunded
|
uint ethToRefund;
if (tokensToBuy > tokensAllowedToBuy) {
tokensToBuy = tokensAllowedToBuy;
ethToRefund = _ethIn - tokenToEth(tokensToBuy);
_ethIn -= ethToRefund;
require(_ethIn > 0, "ethIn zero after refund calculation");
}
|
uint ethToRefund;
if (tokensToBuy > tokensAllowedToBuy) {
tokensToBuy = tokensAllowedToBuy;
ethToRefund = _ethIn - tokenToEth(tokensToBuy);
_ethIn -= ethToRefund;
require(_ethIn > 0, "ethIn zero after refund calculation");
}
| 40,628
|
13
|
// was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of anunsuccessful call. /
|
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
|
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
| 27,017
|
316
|
// Transfer all cash out of the DSR - note that this relies on self-transfer
|
DaiJoinLike daiJoin = DaiJoinLike(daiJoinAddress);
PotLike pot = PotLike(potAddress);
VatLike vat = VatLike(vatAddress);
|
DaiJoinLike daiJoin = DaiJoinLike(daiJoinAddress);
PotLike pot = PotLike(potAddress);
VatLike vat = VatLike(vatAddress);
| 47,454
|
55
|
// Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error
|
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
|
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
| 140
|
6
|
// 100% - LIQUIDATION_FEE - LIQUIDATION_PREMIUM
|
uint256 constant UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD =
LIQUIDATION_DISCOUNTED_SUM - FEE_LIQUIDATION;
|
uint256 constant UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD =
LIQUIDATION_DISCOUNTED_SUM - FEE_LIQUIDATION;
| 36,027
|
228
|
// Fire the ... ending gun?
|
function endICOPhase()
onlyAdministrator()
public
{
icoPhase = false;
}
|
function endICOPhase()
onlyAdministrator()
public
{
icoPhase = false;
}
| 24,374
|
12
|
// sets the provenance hash /
|
function setProvenance(string memory provenance_) external onlyRole(SUPPORT_ROLE) {
provenance = provenance_;
}
|
function setProvenance(string memory provenance_) external onlyRole(SUPPORT_ROLE) {
provenance = provenance_;
}
| 20,650
|
81
|
// exclude from max wallet limit
|
mapping (address => bool) public isExcludedFromWalletLimit;
|
mapping (address => bool) public isExcludedFromWalletLimit;
| 2,006
|
4
|
// address originator;
|
uint endDate;
string data;
GoalStatus status;
uint stakeAmount;
|
uint endDate;
string data;
GoalStatus status;
uint stakeAmount;
| 8,714
|
364
|
// expmods_and_points.points[34] = -(g^76z).
|
mstore(add(expmodsAndPoints, 0x6e0), point)
|
mstore(add(expmodsAndPoints, 0x6e0), point)
| 63,939
|
30
|
// cancel a campaign with given id, called by daoOperator onlyonly can cancel campaigns that have not started yet campaignID id of the campaign to cancel /
|
function cancelCampaign(uint256 campaignID) external onlyDaoOperator {
Campaign storage campaign = campaignData[campaignID];
require(campaign.campaignExists, "cancelCampaign: campaignID doesn't exist");
require(campaign.startTimestamp > now, "cancelCampaign: campaign already started");
uint256 epoch = getEpochNumber(campaign.startTimestamp);
if (campaign.campaignType == CampaignType.NetworkFee) {
delete networkFeeCampaigns[epoch];
} else if (campaign.campaignType == CampaignType.FeeHandlerBRR) {
delete brrCampaigns[epoch];
}
delete campaignData[campaignID];
uint256[] storage campaignIDs = epochCampaigns[epoch];
for (uint256 i = 0; i < campaignIDs.length; i++) {
if (campaignIDs[i] == campaignID) {
// remove this campaign id out of list
campaignIDs[i] = campaignIDs[campaignIDs.length - 1];
campaignIDs.pop();
break;
}
}
emit CancelledCampaign(campaignID);
}
|
function cancelCampaign(uint256 campaignID) external onlyDaoOperator {
Campaign storage campaign = campaignData[campaignID];
require(campaign.campaignExists, "cancelCampaign: campaignID doesn't exist");
require(campaign.startTimestamp > now, "cancelCampaign: campaign already started");
uint256 epoch = getEpochNumber(campaign.startTimestamp);
if (campaign.campaignType == CampaignType.NetworkFee) {
delete networkFeeCampaigns[epoch];
} else if (campaign.campaignType == CampaignType.FeeHandlerBRR) {
delete brrCampaigns[epoch];
}
delete campaignData[campaignID];
uint256[] storage campaignIDs = epochCampaigns[epoch];
for (uint256 i = 0; i < campaignIDs.length; i++) {
if (campaignIDs[i] == campaignID) {
// remove this campaign id out of list
campaignIDs[i] = campaignIDs[campaignIDs.length - 1];
campaignIDs.pop();
break;
}
}
emit CancelledCampaign(campaignID);
}
| 33,636
|
32
|
// register the supported interfaces to conform to ERC721 via ERC165
|
_registerInterface(_INTERFACE_ID_ERC721);
|
_registerInterface(_INTERFACE_ID_ERC721);
| 14,820
|
109
|
// amountIn tokens are entering the Pool, so we round up.
|
amountIn = _downscaleUp(amountIn, scalingFactorTokenIn);
|
amountIn = _downscaleUp(amountIn, scalingFactorTokenIn);
| 4,894
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.