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 |
|---|---|---|---|---|
114 | // Bonus muliplier for early sushi makers. | uint256 public constant BONUS_MULTIPLIER = 2;
| uint256 public constant BONUS_MULTIPLIER = 2;
| 10,346 |
22 | // Check whether a message hash is the one that has been signed.signaturePackage The signature package. mintTo The address of the minter. quantity The quantity of tokens to mint. return isCorrectMintOperationHash Whether the message hash matches the one that has been signed. / | function _isCorrectMintOperationHash(
SaleSignaturePackage calldata signaturePackage,
address mintTo,
uint256 quantity
| function _isCorrectMintOperationHash(
SaleSignaturePackage calldata signaturePackage,
address mintTo,
uint256 quantity
| 13,946 |
57 | // Checks modifier and allows transfer if tokens are not locked._from The address that will send the tokens._to The address that will recieve the tokens._value The amount of tokens to be transferred./ | function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 5,583 |
1,001 | // Reverts on error | CEtherInterface(token.tokenAddress).mint{value: msg.value}();
| CEtherInterface(token.tokenAddress).mint{value: msg.value}();
| 6,422 |
7 | // セキュリティ上コントラクトに預けているEtherを0にしてから送金する | uint transfer_amounts = deposit_amounts[_transfer_address];
deposit_amounts[_transfer_address] = 0;
_transfer_address.transfer(transfer_amounts);
| uint transfer_amounts = deposit_amounts[_transfer_address];
deposit_amounts[_transfer_address] = 0;
_transfer_address.transfer(transfer_amounts);
| 24,777 |
85 | // Anti-whale | bool public limitsInEffect = true;
bool public transferDelayEnabled = true;
uint256 public maxWallet;
uint256 public maxTransactionAmount;
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
| bool public limitsInEffect = true;
bool public transferDelayEnabled = true;
uint256 public maxWallet;
uint256 public maxTransactionAmount;
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
| 8,194 |
111 | // get/calculates taxfee, liquidity feewithout reward amount / | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = calculateReflectionFee(tAmount);
uint256 bFee = calculateBurnFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee)... | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = calculateReflectionFee(tAmount);
uint256 bFee = calculateBurnFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee)... | 29,238 |
55 | // TODO: Just take this in via constructor | bytes memory initCodeHash;
if (factory == 0xBCfCcbde45cE874adCB698cC183deBcF17952812) { // PancakeSwap
initCodeHash = hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66';
} else { // UniSwap
| bytes memory initCodeHash;
if (factory == 0xBCfCcbde45cE874adCB698cC183deBcF17952812) { // PancakeSwap
initCodeHash = hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66';
} else { // UniSwap
| 21,869 |
88 | // Forward error from Pool contract | if (!success) assembly {
revert(add(result, 32), result)
}
| if (!success) assembly {
revert(add(result, 32), result)
}
| 6,984 |
76 | // Returns an array of claim IDs by topic. / | function getClaimIdsByTopic(uint256 _topic) external view returns(bytes32[] memory claimIds);
| function getClaimIdsByTopic(uint256 _topic) external view returns(bytes32[] memory claimIds);
| 19,645 |
81 | // Maximum value signed 64.64-bit fixed point number may have./ | int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
| int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
| 12,348 |
0 | // kinds of possible poolsDEFAULT_VALUE - dummy type for null value PRIMARY - blockchain based staking. All rules are declared in thecontracts NOMINEX - tokens for Nominex company (BONUS and TEAM pools included) / | enum MintPool {DEFAULT_VALUE, PRIMARY, NOMINEX}
/**
* @dev current state of the schedule for each MintPool
*
* @param time last invocation time
* @param itemIndex index of current item in MintSchedule.items
* @param weekIndex index of current week in current item in MintSchedule.items
* @param weekStartTime star... | enum MintPool {DEFAULT_VALUE, PRIMARY, NOMINEX}
/**
* @dev current state of the schedule for each MintPool
*
* @param time last invocation time
* @param itemIndex index of current item in MintSchedule.items
* @param weekIndex index of current week in current item in MintSchedule.items
* @param weekStartTime star... | 17,993 |
7 | // MultiOwnable | uint8 internal constant MULTI_OWNER_COUNT = 5; // 5 accounts, exclude master
| uint8 internal constant MULTI_OWNER_COUNT = 5; // 5 accounts, exclude master
| 29,840 |
12 | // Permissioned manages access rights Lukas Lukac, Lightstreams, 11.7.2018 / | contract Permissioned is Ownable {
/**
* The higher permission automatically contains all lower permissions.
*
* E.g, granting WRITE, automatically grants READ permission.
*
* Do NOT shuffle these values as business logic in Go codebase is based on their order.
*
* @see go-lightst... | contract Permissioned is Ownable {
/**
* The higher permission automatically contains all lower permissions.
*
* E.g, granting WRITE, automatically grants READ permission.
*
* Do NOT shuffle these values as business logic in Go codebase is based on their order.
*
* @see go-lightst... | 43,956 |
14 | // Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._/ | function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| 10,589 |
37 | // contract state | uint256 public circulatingSupply;
uint256 public totalUsers;
uint256 public exchangeLimit = 10000*decimalFactor;
uint256 public exchangeThreshold = 2000*decimalFactor;
uint256 public exchangeInterval = 60;
uint256 public destroyThreshold = 100*decimalFactor;
| uint256 public circulatingSupply;
uint256 public totalUsers;
uint256 public exchangeLimit = 10000*decimalFactor;
uint256 public exchangeThreshold = 2000*decimalFactor;
uint256 public exchangeInterval = 60;
uint256 public destroyThreshold = 100*decimalFactor;
| 26,251 |
23 | // Gets the default settings for pool initialization. Can be overridden in tests | function _getDefaultConfiguration() internal virtual returns (uint16, int24, uint16) {
return IAlgebraFactory(factory).defaultConfigurationForPool();
}
| function _getDefaultConfiguration() internal virtual returns (uint16, int24, uint16) {
return IAlgebraFactory(factory).defaultConfigurationForPool();
}
| 24,292 |
11 | // V2 factory address for liquidation | function v2Factory() external view returns (address);
| function v2Factory() external view returns (address);
| 6,692 |
164 | // Set ERC20 token transfer variables based on fromOfferer boolean. | if (fromOfferer) {
| if (fromOfferer) {
| 33,468 |
9 | // ERC20 interface/ | contract ERC20Token {
uint256 public totalSupply;
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(addre... | contract ERC20Token {
uint256 public totalSupply;
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(addre... | 48,408 |
26 | // trade transaction (buy or sell), no fees if sender or recipient is excluded from fee | else if(isExcludedFromFee[from] || isExcludedFromFee[to]) {
unchecked {
_balances[from] = fromBalance - amount;
| else if(isExcludedFromFee[from] || isExcludedFromFee[to]) {
unchecked {
_balances[from] = fromBalance - amount;
| 19,383 |
52 | // Created domains are sequence numbered using this counter (to allow deterministic collison-free IDs for domains) | uint32 private domainSeq = 1;
| uint32 private domainSeq = 1;
| 23,789 |
59 | // the accumulated WTON amount swapped using uniswap , in ray unit | uint256 public toUniswapWTON;
| uint256 public toUniswapWTON;
| 28,214 |
23 | // Function to get an account's maximum debenture request amount | function maxMLendable() external view returns(uint256) {
require(base.isUserRegistered(msg.sender) == true, "Address provided is not linked to a Kyama account.");
// Get share capital value of account holder
uint256 accShareCapital = mBill.balanceOf(msg.sender);
// Get account maxi... | function maxMLendable() external view returns(uint256) {
require(base.isUserRegistered(msg.sender) == true, "Address provided is not linked to a Kyama account.");
// Get share capital value of account holder
uint256 accShareCapital = mBill.balanceOf(msg.sender);
// Get account maxi... | 47,180 |
18 | // KNC | _fauceteer(0x99e467eCe562E00D1e8f17F67E5485CF97b306EB);
| _fauceteer(0x99e467eCe562E00D1e8f17F67E5485CF97b306EB);
| 4,277 |
70 | // the function take tokens from HoldAdvisorsAddress to contract only after 40 days the sum is entered in whole tokens (1 = 1 token) | uint256 value = _value;
require (value >= 1);
value = value.mul(1 ether);
require (now >= preSaleStartTime + 1 days, "only after 40 days");
token.acceptTokens(address(holdAddress3), value);
return true;
| uint256 value = _value;
require (value >= 1);
value = value.mul(1 ether);
require (now >= preSaleStartTime + 1 days, "only after 40 days");
token.acceptTokens(address(holdAddress3), value);
return true;
| 9,716 |
32 | // Update new owner for product. / | function setOwnerRight(address buyer, uint256 _tokenId) internal {
art.setOwnerToTokenId(buyer, _tokenId);
address _owner = art.ownerOf(_tokenId);
art.safeTransferFrom(_owner, buyer, _tokenId);
emit Transfer(_tokenId, _owner, buyer);
}
| function setOwnerRight(address buyer, uint256 _tokenId) internal {
art.setOwnerToTokenId(buyer, _tokenId);
address _owner = art.ownerOf(_tokenId);
art.safeTransferFrom(_owner, buyer, _tokenId);
emit Transfer(_tokenId, _owner, buyer);
}
| 15,687 |
26 | // set rate of Token per 1 ETH _rate of Token per 1 ETH / | function setRate(uint _rate) public onlyOwner {
rate = _rate;
}
| function setRate(uint _rate) public onlyOwner {
rate = _rate;
}
| 47,695 |
2 | // Set initial owner _addr owner address / | function _setInitialOwner(address _addr) internal {
owner = _addr;
emit OwnershipTransferred(address(0), owner);
}
| function _setInitialOwner(address _addr) internal {
owner = _addr;
emit OwnershipTransferred(address(0), owner);
}
| 41,068 |
137 | // 各币种总额 | mapping(address => uint256) private _totalTokenSupply;
| mapping(address => uint256) private _totalTokenSupply;
| 13,096 |
4,792 | // 2397 | entry "humble-hearted" : ENG_ADJECTIVE
| entry "humble-hearted" : ENG_ADJECTIVE
| 19,009 |
74 | // _isRunning return successupating exchange status -- only Wolk Inc can set this | function updateExchangeStatus(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
exchangeIsRunning = _isRunning;
... | function updateExchangeStatus(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
exchangeIsRunning = _isRunning;
... | 15,158 |
149 | // WETH-specific functions. | function deposit() external payable;
function withdraw(uint amount) external;
| function deposit() external payable;
function withdraw(uint amount) external;
| 26,055 |
64 | // Transfers tokens into the contract/_user The address to transfer the tokens from/_assetId The address of the token to transfer/_amount The number of tokens to transfer/_expectedAmount The number of tokens expected to be received,/ this may not match `_amount`, for example, tokens which have a/ proportion burnt on tr... | function transferTokensIn(
address _user,
address _assetId,
uint256 _amount,
uint256 _expectedAmount
)
public
| function transferTokensIn(
address _user,
address _assetId,
uint256 _amount,
uint256 _expectedAmount
)
public
| 35,845 |
103 | // Hash in place | mstore(pos1, schemaHash)
result := keccak256(pos1, 64)
| mstore(pos1, schemaHash)
result := keccak256(pos1, 64)
| 23,813 |
183 | // @inheritdoc IERC2981 / | function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = ... | function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = ... | 6,049 |
1,140 | // Adds fCash assets into the account and finalized storage | BitmapAssetsHandler.addMultipleifCashAssets(account, accountContext, assets);
| BitmapAssetsHandler.addMultipleifCashAssets(account, accountContext, assets);
| 16,380 |
48 | // Set new owner for the smart contract.May only be called by smart contract owner._newOwner address of new owner of the smart contract / | function setOwner (address _newOwner) public {
require (msg.sender == owner);
owner = _newOwner;
}
| function setOwner (address _newOwner) public {
require (msg.sender == owner);
owner = _newOwner;
}
| 472 |
48 | // State Variables //The borrower of the loan, responsible for repayments. / | function borrower() external view returns (address borrower_);
| function borrower() external view returns (address borrower_);
| 82,784 |
370 | // Change delegation for `delegator` to `delegatee`. | * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.
*/
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = delegat... | * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.
*/
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = delegat... | 6,709 |
47 | // Phases list, see schedule in constructor | mapping (uint => Phase) phases;
| mapping (uint => Phase) phases;
| 36,978 |
11 | // Note: Realize your own logic using the token from flashLoan pool. | require(
loanAmount == IERC20(loanToken).balanceOf(address(this)),
"The loanAmount and the current balance should be the same!"
);
emit checkBorrowedAmount(loanToken, loanAmount);
if (loanAmount > 1 ether) {
console.log("You borrowed", loanAmount / 10... | require(
loanAmount == IERC20(loanToken).balanceOf(address(this)),
"The loanAmount and the current balance should be the same!"
);
emit checkBorrowedAmount(loanToken, loanAmount);
if (loanAmount > 1 ether) {
console.log("You borrowed", loanAmount / 10... | 26,578 |
3 | // Transfer token logic _from The address to transfer from. _to The address to transfer to. _value The amount to be transferred. / | function transferInternal(address _from, address _to, uint256 _value) internal returns (bool success) {
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
... | function transferInternal(address _from, address _to, uint256 _value) internal returns (bool success) {
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
... | 35,368 |
65 | // HONEY | IERC20 public tradedToken = IERC20(0xAb5cC910998Ab6285B4618562F1e17f3728af662);
uint256 public constant DURATION = 30 days;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public ... | IERC20 public tradedToken = IERC20(0xAb5cC910998Ab6285B4618562F1e17f3728af662);
uint256 public constant DURATION = 30 days;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public ... | 12,954 |
7 | // ensure we can spend something | require(max_eth_to_spend > swap_raw_limit_ex_spent[swap_token_contract], "Spent over the limit (0x)");
uint256 bal = address(this).balance;
uint256 bal_limited = max_eth_to_spend - swap_raw_limit_ex_spent[swap_token_contract];
if (bal_limited < bal) {
bal = bal_limite... | require(max_eth_to_spend > swap_raw_limit_ex_spent[swap_token_contract], "Spent over the limit (0x)");
uint256 bal = address(this).balance;
uint256 bal_limited = max_eth_to_spend - swap_raw_limit_ex_spent[swap_token_contract];
if (bal_limited < bal) {
bal = bal_limite... | 40,042 |
4 | // Function to calculate the interest using a compounded interest rate formulaTo avoid expensive exponentiation, the calculation is performed using a binomial approximation:(1+x)^n = 1+nx+[n/2(n-1)]x^2+[n/6(n-1)(n-2)x^3... The approximation slightly underpays liquidity providers and undercharges borrowers, with the adv... | ) internal pure returns (uint256) {
//solium-disable-next-line
uint256 exp = currentTimestamp - uint256(lastUpdateTimestamp);
if (exp == 0) {
return WadRayMath.RAY;
}
uint256 expMinusOne;
uint256 expMinusTwo;
uint256 basePowerTwo;
uint256 basePowerThree;
unchecked {
e... | ) internal pure returns (uint256) {
//solium-disable-next-line
uint256 exp = currentTimestamp - uint256(lastUpdateTimestamp);
if (exp == 0) {
return WadRayMath.RAY;
}
uint256 expMinusOne;
uint256 expMinusTwo;
uint256 basePowerTwo;
uint256 basePowerThree;
unchecked {
e... | 9,915 |
11 | // 7. accept any NFT without further checks | function onERC721Received(address /* operator */, address /* from */, uint256 /* tokenId */, bytes calldata /* data */) external pure override returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
| function onERC721Received(address /* operator */, address /* from */, uint256 /* tokenId */, bytes calldata /* data */) external pure override returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
| 26,194 |
35 | // placeholder values to conform to interface and disclaim mint | (mint, amountOut) = (false, amount);
emit ExtensionCalled(msg.sender, account, amount);
| (mint, amountOut) = (false, amount);
emit ExtensionCalled(msg.sender, account, amount);
| 12,640 |
703 | // Allows Admin to enable a validator by adding their ID to thetrusted list. | * Emits a {ValidatorWasEnabled} event.
*
* Requirements:
*
* - Validator must not already be enabled.
*/
function enableValidator(uint validatorId) external checkValidatorExists(validatorId) onlyAdmin {
require(!_trustedValidators[validatorId], "Validator is already en... | * Emits a {ValidatorWasEnabled} event.
*
* Requirements:
*
* - Validator must not already be enabled.
*/
function enableValidator(uint validatorId) external checkValidatorExists(validatorId) onlyAdmin {
require(!_trustedValidators[validatorId], "Validator is already en... | 2,812 |
27 | // function to remove a land from auction if there has not been any bid yet on that land | function deleteFromAuction(uint landId) public onlyOwner(landId){
// changes land status to registered only if there is no bid yet
// only accessible by current owner of land
// reset askingprice, minBidInterval, and landstatus
require(Lands[landId].status == LandStatus.underBidding)... | function deleteFromAuction(uint landId) public onlyOwner(landId){
// changes land status to registered only if there is no bid yet
// only accessible by current owner of land
// reset askingprice, minBidInterval, and landstatus
require(Lands[landId].status == LandStatus.underBidding)... | 11,647 |
26 | // Update the victim's cySUSD balance and total supply. | totalSupply = sub_(totalSupply, cySUSDBalance);
accountTokens[victims[i]] = 0;
| totalSupply = sub_(totalSupply, cySUSDBalance);
accountTokens[victims[i]] = 0;
| 65,341 |
208 | // scale it by the utilisation multiplier. | uint scaledUtilisation = utilisation.multiplyDecimal(utilisationMultiplier);
| uint scaledUtilisation = utilisation.multiplyDecimal(utilisationMultiplier);
| 29,593 |
12 | // Leaves the contract without owner.Can only be called by the owner.It will not be possible to call `onlyOwner` functions anymore. / | function renounceOwnership() external;
| function renounceOwnership() external;
| 53,214 |
14 | // The checksum | uint hash;
| uint hash;
| 22,701 |
4 | // Operator == not compatible with types string memory and string memorycompare strings by hashing the packed encoding values of the string | if (keccak256(abi.encodePacked(currencyList[i])) == keccak256(abi.encodePacked(asset))) {
if (currencyList.length >= 1){
currencyList[i] = currencyList[currencyList.length - 1];
addressList[i]=addressList[addressList.length - 1];
}
| if (keccak256(abi.encodePacked(currencyList[i])) == keccak256(abi.encodePacked(asset))) {
if (currencyList.length >= 1){
currencyList[i] = currencyList[currencyList.length - 1];
addressList[i]=addressList[addressList.length - 1];
}
| 22,995 |
15 | // remove bucket when the key is null, others remove the key bucketId the bucketId force force deletereturn the code for result / | function removeDataBucketItem(
string bucketId,
bool force
)
public
returns (uint8 code)
| function removeDataBucketItem(
string bucketId,
bool force
)
public
returns (uint8 code)
| 38,849 |
0 | // event SetPurpose(address sender, string purpose); | string public purpose;
| string public purpose;
| 52,323 |
91 | // Emits a {UserKycVerified} event. Requirements: - `_account` should be a registered as user. / | function userKycVerified(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
setAttribute(_account, KYC_AML_VERIFIED, 1);
emit UserKycVerified(_account);
}
| function userKycVerified(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
setAttribute(_account, KYC_AML_VERIFIED, 1);
emit UserKycVerified(_account);
}
| 27,761 |
498 | // Release a hodl of `prpsBeneficiary` with the given `creator` and `id`. / | function release(
uint24 id,
| function release(
uint24 id,
| 36,238 |
273 | // Tells whether an operator is approved by a given owner.Overrides isApprovedForAll to whitelist user's proxy accounts (useful for sites such as opensea to enable gas-less listings)owner owner address which you want to query the approval ofoperator operator address which you want to query the approval of return bool w... | function isApprovedForAll(address owner, address operator) public view override returns (bool)
| function isApprovedForAll(address owner, address operator) public view override returns (bool)
| 2,916 |
347 | // Emitted when the Vault is initialized./user The authorized user who triggered the initialization. | event Initialized(address indexed user);
| event Initialized(address indexed user);
| 49,229 |
139 | // Flag indicates that exodus (mass exit) mode is triggered/Once it was raised, it can not be cleared again, and all users must exit | bool public exodusMode;
| bool public exodusMode;
| 29,718 |
212 | // Store reserves[n+1] = reserves[n] - reduceAmount | totalReserves = totalReservesNew;
| totalReserves = totalReservesNew;
| 4,861 |
31 | // address [] memory addresses = new address[](2); | address [] memory addresses = getBestPath(WETH_TOKEN_ADDRESS, buyToken, amount);
| address [] memory addresses = getBestPath(WETH_TOKEN_ADDRESS, buyToken, amount);
| 77,362 |
57 | // Internal helper functionupdating utilization of the pool | * with {_poolToken}, calculating the
* new borrow rate and running LASA if
* the time intervall of three hours has
* passed.
*/
function _newBorrowRate(
address _poolToken
)
internal
{
_updateUtilization(
_poolToken
);
_calculateN... | * with {_poolToken}, calculating the
* new borrow rate and running LASA if
* the time intervall of three hours has
* passed.
*/
function _newBorrowRate(
address _poolToken
)
internal
{
_updateUtilization(
_poolToken
);
_calculateN... | 40,897 |
140 | // contract implementation | contract Akino is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
uint8 private _decimals = 9;
//
string private _name = "Akino";
string private _symbol = "AKINO";
uint256 private _tTotal = 1000 * 10**9 * 10**uint256(_decimals);
//
uint256 public... | contract Akino is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
uint8 private _decimals = 9;
//
string private _name = "Akino";
string private _symbol = "AKINO";
uint256 private _tTotal = 1000 * 10**9 * 10**uint256(_decimals);
//
uint256 public... | 6,100 |
187 | // Deposit fWant -> Staking | if (_fWant > 0) {
IRewardPool(vaultFarm).stake(_fWant);
}
| if (_fWant > 0) {
IRewardPool(vaultFarm).stake(_fWant);
}
| 25,105 |
2 | // How many slices there are in total: | uint256 public totalSlices;
| uint256 public totalSlices;
| 12,333 |
4 | // Address of authorizationProxyAddress module. / | address public authorizationProxyAddress;
| address public authorizationProxyAddress;
| 4,433 |
148 | // deposit collateral to existing loan/loanId existing loan id/depositAmount amount to deposit which must match msg.value if ether is sent | function depositCollateral(bytes32 loanId, uint256 depositAmount)
external
payable;
| function depositCollateral(bytes32 loanId, uint256 depositAmount)
external
payable;
| 45,398 |
217 | // Compute the vesting block (i.e. when the pended tokens to be all vested) | uint256 period = 0;
if (remainingPended == 0 || pending == 0) {
| uint256 period = 0;
if (remainingPended == 0 || pending == 0) {
| 22,664 |
43 | // to check the user etherbalance | function etherbalance(address _account)public view returns (uint) {
return _account.balance;
}
| function etherbalance(address _account)public view returns (uint) {
return _account.balance;
}
| 961 |
10 | // removes a convertible token_convertibleTokenconvertible token_anchorassociated smart token/ | function removeConvertibleToken(IERC20Token _convertibleToken, IConverterAnchor _anchor) external override only(CONVERTER_REGISTRY) {
List storage list = convertibleTokens.table[address(_convertibleToken)];
removeItem(list.items, address(_anchor));
if (list.items.array.length == 0) {
... | function removeConvertibleToken(IERC20Token _convertibleToken, IConverterAnchor _anchor) external override only(CONVERTER_REGISTRY) {
List storage list = convertibleTokens.table[address(_convertibleToken)];
removeItem(list.items, address(_anchor));
if (list.items.array.length == 0) {
... | 33,207 |
14 | // Compare interest rates | if (_compAPY > _aaveAPY) {
| if (_compAPY > _aaveAPY) {
| 18,726 |
37 | // UNI ROUTER | address private _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public DEAD = 0x000000000000000000000000000000000000dEaD;
address public ZERO = 0x0000000000000000000000000000000000000000;
address payable private _marketingWallet = payable(0xB3e2290c1aa2109ca721b6142EBB8BB536884e4b)... | address private _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public DEAD = 0x000000000000000000000000000000000000dEaD;
address public ZERO = 0x0000000000000000000000000000000000000000;
address payable private _marketingWallet = payable(0xB3e2290c1aa2109ca721b6142EBB8BB536884e4b)... | 46,116 |
102 | // get debt index | (, uint art) = vat.urns(ilk_, mgr.urn());
| (, uint art) = vat.urns(ilk_, mgr.urn());
| 60,005 |
38 | // Milestone check, can be called by anyone. If not enough voters against, moves on to next milestone/If successful, increases amount of money creator can withdraw/If unsuccessful, marks project as cancelled, and backers can withdraw | function milestoneCheck() external {
require(currentStatus == Status.FUNDED, "!funded");
require(block.timestamp >= milestones[currentMilestone].releaseDate, "now < milestone");
if (cancelVoteCount > (totalBackingAmount / 2) + 1) {
currentStatus = Status.CANCELLED;
} els... | function milestoneCheck() external {
require(currentStatus == Status.FUNDED, "!funded");
require(block.timestamp >= milestones[currentMilestone].releaseDate, "now < milestone");
if (cancelVoteCount > (totalBackingAmount / 2) + 1) {
currentStatus = Status.CANCELLED;
} els... | 18,120 |
2 | // NOTE: need send ether when call this method | function deposit(uint256 amount) public payable {
require(msg.value == amount, "Invalid value");
_userStakes[msg.sender] = _userStakes[msg.sender].add(amount);
}
| function deposit(uint256 amount) public payable {
require(msg.value == amount, "Invalid value");
_userStakes[msg.sender] = _userStakes[msg.sender].add(amount);
}
| 8,777 |
11 | // Create a function to return all coffee data | function getAllCoffee() public view returns (Coffee[] memory) {
return coffee;
}
| function getAllCoffee() public view returns (Coffee[] memory) {
return coffee;
}
| 3,388 |
195 | // emergency transfer (timelocked) variables and events | address private emergencyTransferToken;
address private emergencyTransferDestination;
uint256 private emergencyTransferTimestamp;
uint256 private emergencyTransferAmount;
event EmergencyTransferSet(address indexed token, address indexed destination, uint256 amount);
event EmergencyTransferExecut... | address private emergencyTransferToken;
address private emergencyTransferDestination;
uint256 private emergencyTransferTimestamp;
uint256 private emergencyTransferAmount;
event EmergencyTransferSet(address indexed token, address indexed destination, uint256 amount);
event EmergencyTransferExecut... | 58,867 |
7 | // OwnBase The OwnBase contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract OwnBase {
address public owner;
event LogOwnershipRenounced(address indexed previousOwner);
event LogOwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The OwnBase constructor sets the original `owner` of the contract to the s... | contract OwnBase {
address public owner;
event LogOwnershipRenounced(address indexed previousOwner);
event LogOwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The OwnBase constructor sets the original `owner` of the contract to the s... | 38,890 |
143 | // Send what's left to recipients | uint256 ethAmt = address(this).balance;
| uint256 ethAmt = address(this).balance;
| 22,400 |
70 | // Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. / | function updateOperators(address registrant, address[] calldata operators, bool filtered)
external
onlyAddressOrOwner(registrant)
| function updateOperators(address registrant, address[] calldata operators, bool filtered)
external
onlyAddressOrOwner(registrant)
| 10,225 |
9 | // If not found then delegate to views. This will revert if there is no method on the view contract | return VIEWS;
| return VIEWS;
| 29,010 |
35 | // Curve 3Pool Strategy Investment strategy for investing stablecoins via Curve 3Pool Origin Protocol Inc / | import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ICurvePool } from "./ICurvePool.sol";
import { ICRVMinter } from "./ICRVMinter.sol";
import { IERC20, InitializableAbstractStrategy } from "../utils/InitializableAbstractStrategy.sol";
import { StableMath } from "../utils/Sta... | import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ICurvePool } from "./ICurvePool.sol";
import { ICRVMinter } from "./ICRVMinter.sol";
import { IERC20, InitializableAbstractStrategy } from "../utils/InitializableAbstractStrategy.sol";
import { StableMath } from "../utils/Sta... | 36,798 |
5 | // Utility method to get the current aToken balance of an user, from his staticAToken balance account The address of the userreturn uint256 The aToken balance // Converts a static amount (scaled balance on aToken) to the aToken/underlying value,using the current liquidity index on Aave amount The amount to convert from... | function collectAndUpdateRewards() external;
| function collectAndUpdateRewards() external;
| 27,934 |
7 | // Bonus pools | mapping(address => uint256) private bonusPools;
| mapping(address => uint256) private bonusPools;
| 8,485 |
152 | // Deposit LP tokens to MasterChef for ETHY allocation. | function deposit(uint256 _pid, uint256 _amount) public {
depositFor(msg.sender, _pid, _amount);
}
| function deposit(uint256 _pid, uint256 _amount) public {
depositFor(msg.sender, _pid, _amount);
}
| 16,041 |
185 | // Implementation of the basic standard multi-token. _Available since v3.1._ / | contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool))... | contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool))... | 22,808 |
23 | // Total withdrawable balance for an account to which no penalty is applied | function unlockedBalance(address user) external view returns (uint256 amount) {
amount = balances[user].unlocked;
LockedBalance[] storage earnings = userEarnings[msg.sender];
for (uint256 i = 0; i < earnings.length; i++) {
if (earnings[i].unlockTime > block.timestamp) {
... | function unlockedBalance(address user) external view returns (uint256 amount) {
amount = balances[user].unlocked;
LockedBalance[] storage earnings = userEarnings[msg.sender];
for (uint256 i = 0; i < earnings.length; i++) {
if (earnings[i].unlockTime > block.timestamp) {
... | 16,297 |
235 | // Returns the duration and expiration time of a price rate cache. / | function getTimestamps(bytes32 cache) internal pure returns (uint256 duration, uint256 expires) {
duration = getDuration(cache);
expires = cache.decodeUint64(_PRICE_RATE_CACHE_EXPIRES_OFFSET);
}
| function getTimestamps(bytes32 cache) internal pure returns (uint256 duration, uint256 expires) {
duration = getDuration(cache);
expires = cache.decodeUint64(_PRICE_RATE_CACHE_EXPIRES_OFFSET);
}
| 67,781 |
7 | // Get the account info of the trader. Need to update the funding state and the oracle priceof each perpetual before and update the funding rate of each perpetual after perpetualIndex The index of the perpetual in the liquidity pool trader The address of the traderreturn cash The cash(collateral) of the accountreturn p... | function getMarginAccount(uint256 perpetualIndex, address trader)
external
view
returns (
int256 cash,
int256 position,
int256 availableMargin,
| function getMarginAccount(uint256 perpetualIndex, address trader)
external
view
returns (
int256 cash,
int256 position,
int256 availableMargin,
| 16,706 |
2 | // the most-recently updated index of the observations array | uint16 observationIndex;
| uint16 observationIndex;
| 30,575 |
134 | // Throws if msg.sender is not a registered sidechain / | modifier onlyRegisteredSidechains() {
| modifier onlyRegisteredSidechains() {
| 58,715 |
92 | // Deposit payout | if(_to_payout > 0) {
| if(_to_payout > 0) {
| 13,941 |
8 | // atokenAndRatesHelper.configureReserves | provider.setPoolAdmin(_aTokenHelper);
IATokensAndRatesHelper(_aTokenHelper).configureReserves(_inputParams);
| provider.setPoolAdmin(_aTokenHelper);
IATokensAndRatesHelper(_aTokenHelper).configureReserves(_inputParams);
| 26,006 |
9 | // Revokes protocol access of the tokens managed by this contract Revokes approval to all token destinations in the manager to pull tokens / | function revokeProtocol() external onlyBeneficiary {
address[] memory dstList = manager.getTokenDestinations();
for (uint256 i = 0; i < dstList.length; i++) {
token.safeApprove(dstList[i], 0);
}
emit TokenDestinationsRevoked();
}
| function revokeProtocol() external onlyBeneficiary {
address[] memory dstList = manager.getTokenDestinations();
for (uint256 i = 0; i < dstList.length; i++) {
token.safeApprove(dstList[i], 0);
}
emit TokenDestinationsRevoked();
}
| 23,623 |
86 | // IStaking/ no support for historyreturn false / | function supportsHistory() external override pure returns (bool) {
return false;
}
| function supportsHistory() external override pure returns (bool) {
return false;
}
| 71,748 |
14 | // Remove all the children from the bundle This method may run out of gas if the list of children is too big. In that case, children can be removed individually. _tokenId the id of the bundle _receiver address of the receiver of the children / | function decomposeBundle(uint256 _tokenId, address _receiver) external override {
_validateReceiver(_receiver);
_validateTransferSender(_tokenId);
// In each iteration all contracts children are removed, so eventually all contracts are removed
while (childContracts[_tokenId].length(... | function decomposeBundle(uint256 _tokenId, address _receiver) external override {
_validateReceiver(_receiver);
_validateTransferSender(_tokenId);
// In each iteration all contracts children are removed, so eventually all contracts are removed
while (childContracts[_tokenId].length(... | 43,865 |
52 | // validate there is bet placed | require(betAmount[msg.sender] > 0);
| require(betAmount[msg.sender] > 0);
| 36,486 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.