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 |
|---|---|---|---|---|
20 | // This withdraws the contract's balance of ETH to the Owner's (whoever launched the contract) address. | function withdraw() public payable onlyOwner {
require(payable(teamWallet).send(address(this).balance));
}
| function withdraw() public payable onlyOwner {
require(payable(teamWallet).send(address(this).balance));
}
| 14,025 |
5 | // get the high byte which stores the length of the string when unpacked | uint256 len = uint256(packed >> 248);
| uint256 len = uint256(packed >> 248);
| 9,776 |
70 | // Option type the vault is selling | bool isPut;
| bool isPut;
| 64,913 |
76 | // Retrieve the dividends owned by the caller. / | function myDividends(bool _includeReferralBonus)
public
view
returns (uint256)
| function myDividends(bool _includeReferralBonus)
public
view
returns (uint256)
| 18,667 |
0 | // A data structure to store data of members for a given role. indexCurrent index in the list of accounts that have a role.membersmap from index => address of account that has a roleindexOfmap from address => index which the account has. / | struct RoleMembers {
uint256 index;
mapping(uint256 => address) members;
mapping(address => uint256) indexOf;
}
| struct RoleMembers {
uint256 index;
mapping(uint256 => address) members;
mapping(address => uint256) indexOf;
}
| 591 |
130 | // If we've reached the maximum burn point, send half the profits to the treasury to reward holders | uint256 retirementYeld = stakingProfits;
| uint256 retirementYeld = stakingProfits;
| 8,008 |
2 | // Advanced Token | res[30] = this.approve.selector;
| res[30] = this.approve.selector;
| 7,675 |
44 | // | _addBeneficiary(development, 8000000, 25);
_addBeneficiary(teamReserved, 8000000, 25);
_addBeneficiary(LockedAndReserved, 6000000, 25);
| _addBeneficiary(development, 8000000, 25);
_addBeneficiary(teamReserved, 8000000, 25);
_addBeneficiary(LockedAndReserved, 6000000, 25);
| 22,429 |
6 | // --- Public view functions | function getNext(
Data storage self,
address current
)
internal
view
returns (address)
| function getNext(
Data storage self,
address current
)
internal
view
returns (address)
| 31,176 |
16 | // Proceed with execution of proposal. | if (proposals[index].isMint) {
reserve.mint(addr, value);
} else {
| if (proposals[index].isMint) {
reserve.mint(addr, value);
} else {
| 9,347 |
35 | // Checks whether it can transfer or otherwise throws. / | modifier canTransfer(address _sender, uint256 _value) {
require(_value <= transferableTokens(_sender, uint64(now)));
_;
}
| modifier canTransfer(address _sender, uint256 _value) {
require(_value <= transferableTokens(_sender, uint64(now)));
_;
}
| 1,253 |
159 | // whitelist | function toggle_whitelist(bool change) external onlyOwner {
_is_whitelist_only = change;
}
| function toggle_whitelist(bool change) external onlyOwner {
_is_whitelist_only = change;
}
| 16,587 |
2 | // Internal Out Of Gas/Throw: revert this transaction too; Call Stack Depth Limit reached: revert this transaction too; Recursive Call: safe, no any changes applied yet, we are inside of modifier. | _safeSend(msg.sender, msg.value);
| _safeSend(msg.sender, msg.value);
| 53,680 |
24 | // Setup the channel on storage | channels[newChannel.id] = newChannel;
| channels[newChannel.id] = newChannel;
| 45,157 |
7 | // the auction stage | AuctionStage stage; // 1 byte
| AuctionStage stage; // 1 byte
| 2,934 |
50 | // Overwrite due to lockup_from address The address which you want to send tokens from_to address The address which you want to transfer to_value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public isValidTransfer() returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint256 _value) public isValidTransfer() returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 55,593 |
5 | // Transfers `amount` tokens to `receiver` address/Only Signer or Owner can execute this function | function transferTo(address receiver, uint256 amount) external{
require((msg.sender == owner()) || (msg.sender == singer), "TokenDisributor: Only singer role");
token.transfer(receiver, amount);
}
| function transferTo(address receiver, uint256 amount) external{
require((msg.sender == owner()) || (msg.sender == singer), "TokenDisributor: Only singer role");
token.transfer(receiver, amount);
}
| 35,576 |
112 | // Autonomous Converter contract for MET <=> ETH exchange | contract AutonomousConverter is Formula, Owned {
SmartToken public smartToken;
METToken public reserveToken;
Auctions public auctions;
enum WhichToken { Eth, Met }
bool internal initialized = false;
event LogFundsIn(address indexed from, uint value);
event ConvertEthToMet(address indexed ... | contract AutonomousConverter is Formula, Owned {
SmartToken public smartToken;
METToken public reserveToken;
Auctions public auctions;
enum WhichToken { Eth, Met }
bool internal initialized = false;
event LogFundsIn(address indexed from, uint value);
event ConvertEthToMet(address indexed ... | 36,881 |
16 | // A record of balance checkpoints for each token, by index | mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
| mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
| 33,169 |
63 | // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) | bytes4 internal constant _ERC1155_RECEIVED = 0xf23a6e61;
| bytes4 internal constant _ERC1155_RECEIVED = 0xf23a6e61;
| 31,237 |
15 | // If client agrees or if judge decides, funds are transfered to flexiana. / | function transferToFlexiana() public {
require(customerStatus == Statuses.ShouldTransferToCustomer || msg.sender == owner);
flexiana.transfer(address(this).balance);
}
| function transferToFlexiana() public {
require(customerStatus == Statuses.ShouldTransferToCustomer || msg.sender == owner);
flexiana.transfer(address(this).balance);
}
| 38,060 |
8 | // Check this after adding tokens so that we can check once for contribute. | require(card.tokens.length < 5, "OVER_MAX_TOKENS_PER_CARD");
| require(card.tokens.length < 5, "OVER_MAX_TOKENS_PER_CARD");
| 20,604 |
19 | // Updates the admin address Only callable by admin newAdmin New admin address / | function transferAdmin(address newAdmin) override external onlyAdmin {
require(newAdmin != admin, "ContinuousRewardToken: new admin address is the same as the old admin address");
address previousAdmin = admin;
admin = newAdmin;
emit AdminTransferred(previousAdmin, newAdmin);
}
| function transferAdmin(address newAdmin) override external onlyAdmin {
require(newAdmin != admin, "ContinuousRewardToken: new admin address is the same as the old admin address");
address previousAdmin = admin;
admin = newAdmin;
emit AdminTransferred(previousAdmin, newAdmin);
}
| 13,935 |
14 | // Removes _purpose for _key from the identity. Triggers Event: `KeyRemoved` Specification: MUST only be done by keys of purpose 1, or the identity itself. If it's the identity itself, the approval process will determine its approval. / | function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
| function removeKey(bytes32 _key, uint256 _purpose) external returns (bool success);
| 35,217 |
83 | // bubble up the error | revert(string(error));
| revert(string(error));
| 40,979 |
190 | // Record Burnt Token for reminting after 365 Days | uint256 bTime = block.timestamp;
Burn memory myburn = Burn(amount, bTime);
_burnCount +=_burnCount;
burned[_burnCount] = myburn;
| uint256 bTime = block.timestamp;
Burn memory myburn = Burn(amount, bTime);
_burnCount +=_burnCount;
burned[_burnCount] = myburn;
| 32,010 |
59 | // INTERNAL / | function _makeDepositForPeriod(bytes32 _userKey, uint _value, uint _lockupDate) internal {
Period storage _transferPeriod = periods[periodsCount];
_transferPeriod.user2bmcDays[_userKey] = _getBmcDaysAmountForUser(_userKey, now, periodsCount);
_transferPeriod.totalBmcDays = _getTotalBmcDaysA... | function _makeDepositForPeriod(bytes32 _userKey, uint _value, uint _lockupDate) internal {
Period storage _transferPeriod = periods[periodsCount];
_transferPeriod.user2bmcDays[_userKey] = _getBmcDaysAmountForUser(_userKey, now, periodsCount);
_transferPeriod.totalBmcDays = _getTotalBmcDaysA... | 14,880 |
55 | // |
if(sender == tokenUniswapPair)
require(lastTotalSupplyOfLPTokens <= _LPSupplyOfPairTotal, "Liquidity withdrawals forbidden");
|
if(sender == tokenUniswapPair)
require(lastTotalSupplyOfLPTokens <= _LPSupplyOfPairTotal, "Liquidity withdrawals forbidden");
| 30,429 |
10 | // The withdrawal period is now over. Deposits can be performed again. Set the next withdrawal cycle | if (block.timestamp > end) {
| if (block.timestamp > end) {
| 1,324 |
60 | // Upgrade agent transfers tokens to a new contract.Upgrade agent itself can be the token contract, or just a middle man contract doing the heavy lifting. The Upgrade agent is the interface used to implement a tokenmigration in the case of an emergency.The function upgradeFrom has to implement the part of the creationo... | contract UpgradeAgent {
/** This value should be the same as the original token's total supply */
uint public originalSupply;
/** Interface to ensure the contract is correctly configured */
function isUpgradeAgent() public pure returns (bool) {
return true;
}
/**
Upgrade an account
When the toke... | contract UpgradeAgent {
/** This value should be the same as the original token's total supply */
uint public originalSupply;
/** Interface to ensure the contract is correctly configured */
function isUpgradeAgent() public pure returns (bool) {
return true;
}
/**
Upgrade an account
When the toke... | 44,284 |
249 | // returns the number of minted tokens/ uses some extra gas but makes etherscan and users happy so :shrug:/ partial erc721enumerable implemntation | function totalSupply() public view returns (uint256) {
return mintedCounter.current();
}
| function totalSupply() public view returns (uint256) {
return mintedCounter.current();
}
| 14,490 |
57 | // ======================================== Fallback and receive functions to receive simple transfers. | fallback() external {}
receive () external {}
//========================================
// Subscription functions
function calculateFutureSubscriptionAddress(address serviceAddress) private inline view returns (address, TvmCell)
{
TvmCell stateInit = tvm.buildStateInit({
co... | fallback() external {}
receive () external {}
//========================================
// Subscription functions
function calculateFutureSubscriptionAddress(address serviceAddress) private inline view returns (address, TvmCell)
{
TvmCell stateInit = tvm.buildStateInit({
co... | 30,492 |
19 | // returns the liquidity pool at a given index / | function getLiquidityPool(uint256 index) external view override returns (IConverterAnchor) {
return IConverterAnchor(_liquidityPools.array[index]);
}
| function getLiquidityPool(uint256 index) external view override returns (IConverterAnchor) {
return IConverterAnchor(_liquidityPools.array[index]);
}
| 26,944 |
16 | // net total principal amount to reduce the slippage imapct from amm strategies. | uint256 public netTotalGamePrincipal;
| uint256 public netTotalGamePrincipal;
| 6,968 |
0 | // This event is fired whenever a flashloan is initiated to pull an airdrop loanId - A unique identifier for this particular loan, sourced from the Loan Coordinator.borrower - The address of the borrower.nftCollateralId - The ID within the AirdropReceiver for the NFT being used as collateral for thisloan.nftCollateralC... | event AirdropPulledFlashloan(
uint256 indexed loanId,
address indexed borrower,
uint256 nftCollateralId,
address nftCollateralContract,
address target,
bytes data
);
| event AirdropPulledFlashloan(
uint256 indexed loanId,
address indexed borrower,
uint256 nftCollateralId,
address nftCollateralContract,
address target,
bytes data
);
| 55,419 |
30 | // require(totalEther >= softcap); | _to.send(_valueWei);
| _to.send(_valueWei);
| 30,569 |
12 | // ================================ amount of shares for each address (scaled number) | mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
... | mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
... | 19,752 |
13 | // Withdraws available balance from marketplace contract. / | function transferFromMarketplace(ISqwidMarketplace _marketplace) external onlyOwner {
_marketplace.withdraw();
}
| function transferFromMarketplace(ISqwidMarketplace _marketplace) external onlyOwner {
_marketplace.withdraw();
}
| 44,579 |
120 | // for determine the exact number of received pool | uint256 poolAmountReceive;
| uint256 poolAmountReceive;
| 57,863 |
7 | // person => rarity => count | mapping(uint256 => mapping(uint256 => uint256)) rarity_counters;
mapping(uint256 => uint256) total_rarity_counters;
mapping(uint256 => uint256) total_rarity_limits;
| mapping(uint256 => mapping(uint256 => uint256)) rarity_counters;
mapping(uint256 => uint256) total_rarity_counters;
mapping(uint256 => uint256) total_rarity_limits;
| 9,257 |
88 | // dont try to send specific awards to the contract | if(to != address(this)) awardsOf[to][award] += value;
| if(to != address(this)) awardsOf[to][award] += value;
| 45,616 |
17 | // return token balance this contract has return _address token balance this contract has./ | function balanceOfContract() public view returns (uint) {
return token.balanceOf(this);
}
| function balanceOfContract() public view returns (uint) {
return token.balanceOf(this);
}
| 27,651 |
52 | // Storage slot with the address of the current implementation.This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and isvalidated in the constructor. / | bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
| bytes32 internal constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
| 8,094 |
34 | // Set the values | fraxDollarBalanceStored = _new_frax_dollar_balance;
collatDollarBalanceStored = _new_collat_dollar_balance;
last_timestamp = block.timestamp;
| fraxDollarBalanceStored = _new_frax_dollar_balance;
collatDollarBalanceStored = _new_collat_dollar_balance;
last_timestamp = block.timestamp;
| 8,375 |
82 | // ability for controller to step down and make this contract completely automatic (without third-party control) | function detachControllerForever() external onlyController {
assert(m_attaching_enabled);
address was = m_controller;
m_controller = address(0);
m_attaching_enabled = false;
ControllerRetiredForever(was);
}
| function detachControllerForever() external onlyController {
assert(m_attaching_enabled);
address was = m_controller;
m_controller = address(0);
m_attaching_enabled = false;
ControllerRetiredForever(was);
}
| 56,666 |
54 | // add the tokens to the user's locked balance | lockedBalances[_userAddress] = lockedBalances[_userAddress].add(_amount);
LockedBalance(_userAddress, _amount);
| lockedBalances[_userAddress] = lockedBalances[_userAddress].add(_amount);
LockedBalance(_userAddress, _amount);
| 45,139 |
10 | // Its possible to revert monitor to last used monitor | function revertMonitor() public onlyAllowed {
require(lastMonitor != address(0));
monitor = lastMonitor;
emit MonitorChangeReverted(monitor);
}
| function revertMonitor() public onlyAllowed {
require(lastMonitor != address(0));
monitor = lastMonitor;
emit MonitorChangeReverted(monitor);
}
| 11,546 |
31 | // Pays for data/_in Input data/ return out_ Output data | function payData(bytes memory _in)
public
payable
extensionManagerSet
returns (bytes memory out_)
| function payData(bytes memory _in)
public
payable
extensionManagerSet
returns (bytes memory out_)
| 57,823 |
1,226 | // Return asset cash value | return factors.cashGroup.assetRate.convertFromUnderlying(netPortfolioValueUnderlying);
| return factors.cashGroup.assetRate.convertFromUnderlying(netPortfolioValueUnderlying);
| 63,543 |
203 | // check strike prices are increasing | for (uint256 i = 0; i < _strikePrices.length - 1; i++) {
require(_strikePrices[i] < _strikePrices[i + 1], "Strike prices must be increasing");
}
| for (uint256 i = 0; i < _strikePrices.length - 1; i++) {
require(_strikePrices[i] < _strikePrices[i + 1], "Strike prices must be increasing");
}
| 36,380 |
17 | // Adds properties and/or items to be pseudo-randomly chosen from during token minting/_names The names of the properties to add/_items The items to add to each property/_ipfsGroup The IPFS base URI and extension | function addProperties(
string[] calldata _names,
ItemParam[] calldata _items,
IPFSGroup calldata _ipfsGroup
| function addProperties(
string[] calldata _names,
ItemParam[] calldata _items,
IPFSGroup calldata _ipfsGroup
| 16,963 |
3 | // Harvest farm tokens | ISushiStake(masterchefAddress).harvest(pid, address(this));
| ISushiStake(masterchefAddress).harvest(pid, address(this));
| 9,131 |
241 | // Save dividend paying supply | _dividendPayingSDVDSupplySnapshots[snapshotId] = dividendPayingSDVDSupply();
| _dividendPayingSDVDSupplySnapshots[snapshotId] = dividendPayingSDVDSupply();
| 42,629 |
314 | // We must manually initialize Ownable.sol | Ownable.initialize(_owner);
| Ownable.initialize(_owner);
| 45,530 |
11 | // Included here instead of Ownable because the Deposit contracts don't need it. | function changeOwner(address newOwner) onlyOwner external
| function changeOwner(address newOwner) onlyOwner external
| 24,851 |
26 | // Create a cumulative reward entry at the current epoch. | _addCumulativeReward(poolId, membersReward, membersStake);
| _addCumulativeReward(poolId, membersReward, membersStake);
| 11,486 |
72 | // / | interface ILOCKABLETOKEN{
/**
* @dev Returns the amount of tokens that are unlocked i.e. transferrable by `who`
*
*/
function balanceUnlocked(address who) external view returns (uint256 amount);
/**
* @dev Returns the amount of tokens that are locked and not transferrable by `who`
*... | interface ILOCKABLETOKEN{
/**
* @dev Returns the amount of tokens that are unlocked i.e. transferrable by `who`
*
*/
function balanceUnlocked(address who) external view returns (uint256 amount);
/**
* @dev Returns the amount of tokens that are locked and not transferrable by `who`
*... | 5,482 |
2 | // Admin of the CommunityProxy is CommunityAdmin.communityProxyAdmin the owner of CommunityAdmin.communityProxyAdmin is CommunityAdmin so: CommunityAdmin.communityProxyAdmin = IProxyAdmin(_admin()) CommunityAdmin = (CommunityAdmin.communityProxyAdmin).owner = (IProxyAdmin(_admin())).owner() communityImplementation = Co... | return address(ICommunityAdmin(IProxyAdmin(_admin()).owner()).communityImplementation());
| return address(ICommunityAdmin(IProxyAdmin(_admin()).owner()).communityImplementation());
| 26,841 |
23 | // total pool opts: old total - migrated emp2 (all opts) - migrated emp1 == poolfade (remainder retrurned) | assertEq(esop.totalPoolOptions(), totPool - emp2issued - poolfade, "total pool opts2");
| assertEq(esop.totalPoolOptions(), totPool - emp2issued - poolfade, "total pool opts2");
| 44,090 |
7 | // Investor buy Sale Token use ETH/ | function buyToken() public payable returns (bool) {
uint tokenToFund = _calculateToken();
_checkNoToken(tokenToFund);
//collect eth
_collectMoney();
bool ret = smzoToken.transferByEth(msg.sender, msg.value, tokenToFund);
if (ret) {
sold = sold.a... | function buyToken() public payable returns (bool) {
uint tokenToFund = _calculateToken();
_checkNoToken(tokenToFund);
//collect eth
_collectMoney();
bool ret = smzoToken.transferByEth(msg.sender, msg.value, tokenToFund);
if (ret) {
sold = sold.a... | 26,719 |
35 | // burn the credit | _burnCredit(from, controlledToken, burnedCredit);
| _burnCredit(from, controlledToken, burnedCredit);
| 38,822 |
433 | // Remaining values | nftvi.total_value_usd = (nftvi.token0_val_usd + nftvi.token1_val_usd);
nftvi.token0_symbol = ERC20(lp_basic_info.token0).symbol();
nftvi.token1_symbol = ERC20(lp_basic_info.token1).symbol();
nftvi.usd_per_liq = (nftvi.total_value_usd * PRECISE_PRICE_PRECISION) / uint256(lp_basic_info.liq... | nftvi.total_value_usd = (nftvi.token0_val_usd + nftvi.token1_val_usd);
nftvi.token0_symbol = ERC20(lp_basic_info.token0).symbol();
nftvi.token1_symbol = ERC20(lp_basic_info.token1).symbol();
nftvi.usd_per_liq = (nftvi.total_value_usd * PRECISE_PRICE_PRECISION) / uint256(lp_basic_info.liq... | 30,550 |
1 | // Returns total amount of tokens counted as stake/_userAddress user to retrieve staked balance from/ return finalized staked of _userAddress | function getStakedBalance(
address _userAddress) external view returns (uint256);
| function getStakedBalance(
address _userAddress) external view returns (uint256);
| 26,122 |
104 | // tokensLeft is equal to amount at the beginning | tokens[1] = _data[0];
_src = wethToKyberEth(_src);
_dest = wethToKyberEth(_dest);
| tokens[1] = _data[0];
_src = wethToKyberEth(_src);
_dest = wethToKyberEth(_dest);
| 41,014 |
181 | // invoked by Messenger on L1 after L2 waiting period elapses | function finalizeWithdrawal(address to, uint256 amount) external {
// ensure function only callable from L2 Bridge via messenger (aka relayer)
require(msg.sender == address(messenger()), "Only the relayer can call this");
require(messenger().xDomainMessageSender() == synthetixBridgeToBase(),... | function finalizeWithdrawal(address to, uint256 amount) external {
// ensure function only callable from L2 Bridge via messenger (aka relayer)
require(msg.sender == address(messenger()), "Only the relayer can call this");
require(messenger().xDomainMessageSender() == synthetixBridgeToBase(),... | 13,077 |
278 | // Get the underlying price of a aToken assetaToken The aToken to get the underlying price of return The underlying asset price mantissa (scaled by 1e18).Zero means the price is unavailable./ | function getUnderlyingPrice(AToken aToken) external view returns (uint);
| function getUnderlyingPrice(AToken aToken) external view returns (uint);
| 7,931 |
11 | // returns the difference of _x minus _y, reverts if the calculation underflows_x minuend_y subtrahend return difference/ | function sub(uint256 _x, uint256 _y) internal pure returns (uint256) {
require(_x >= _y, "ERR_UNDERFLOW");
return _x - _y;
}
| function sub(uint256 _x, uint256 _y) internal pure returns (uint256) {
require(_x >= _y, "ERR_UNDERFLOW");
return _x - _y;
}
| 45,230 |
4 | // 起始时间 | uint256 begin;
| uint256 begin;
| 23,283 |
210 | // Token Info | uint256 public constant MAX_TOKEN = 3333;
uint256 public constant MAX_PRESALE_TOKEN = 999;
uint256 private constant INIT_RESERVED = 33;
uint256 public constant tokenPrice = 0.07 ether;
| uint256 public constant MAX_TOKEN = 3333;
uint256 public constant MAX_PRESALE_TOKEN = 999;
uint256 private constant INIT_RESERVED = 33;
uint256 public constant tokenPrice = 0.07 ether;
| 31,773 |
130 | // Allows to swap any token to an accepted collateral via 1Inch API/minAmountOut Minimum amount accepted for the swap to happen/payload Bytes needed for 1Inch API | function _swapOn1Inch(
IERC20 inToken,
uint256 minAmountOut,
bytes memory payload
| function _swapOn1Inch(
IERC20 inToken,
uint256 minAmountOut,
bytes memory payload
| 49,295 |
157 | // Mapping id => color | mapping(uint => string) internal _idColor;
| mapping(uint => string) internal _idColor;
| 78,929 |
21 | // Returns a specific store belonging to the current store owner (msg.sender).storeIndex the id of the store return the name of the store/ | function getStoreForOwner(uint256 storeIndex) public view returns (string) {
require(ownersByAddress[msg.sender].addr != address(0));
return ownersByAddress[msg.sender].stores[storeIndex].name();
}
| function getStoreForOwner(uint256 storeIndex) public view returns (string) {
require(ownersByAddress[msg.sender].addr != address(0));
return ownersByAddress[msg.sender].stores[storeIndex].name();
}
| 19,127 |
240 | // Compute the message hash - the hashed, EIP-191-0x45-prefixed action ID. | bytes32 messageHash = actionID.toEthSignedMessageHash();
| bytes32 messageHash = actionID.toEthSignedMessageHash();
| 32,101 |
131 | // ethAllowance is userStake % minus eth used | uint256 lpSupply = ERC20(nyanV2LP).totalSupply();
uint256 ethAllowance = lpStaked.mul(ethAvailable).div(lpSupply);
return ethAllowance.mul(ethBoost);
| uint256 lpSupply = ERC20(nyanV2LP).totalSupply();
uint256 ethAllowance = lpStaked.mul(ethAvailable).div(lpSupply);
return ethAllowance.mul(ethBoost);
| 31,388 |
2 | // bytes32 calculated = keccak256(abi.encodePacked(_secret)); emit LogSecrets(_hashedSecret, _secret, calculated); | require(keccak256(abi.encodePacked(_secret)) == _hashedSecret, "secrets do not match");
require(
block.timestamp <
swaps[_hashedSecret].initTimestamp +
swaps[_hashedSecret].refundTime,
"too early to redeem"
);
require(swaps[_has... | require(keccak256(abi.encodePacked(_secret)) == _hashedSecret, "secrets do not match");
require(
block.timestamp <
swaps[_hashedSecret].initTimestamp +
swaps[_hashedSecret].refundTime,
"too early to redeem"
);
require(swaps[_has... | 1,117 |
1 | // Emits when ownership of any NFT changes by any mechanism. This event emits when NFTs arecreated (`from` == 0) and destroyed (`to` == 0). Exception: during contract creation, anynumber of NFTs may be created and assigned without emitting Transfer. At the time of anytransfer, the approved address for that NFT (if any)... | event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
| event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
| 2,219 |
35 | // ERC165 || ERC721 || ERC165^ERC721 | return (_interfaceId == 0x01ffc9a7 || _interfaceId == 0x80ac58cd || _interfaceId == 0x8153916a) && (_interfaceId != 0xffffffff);
| return (_interfaceId == 0x01ffc9a7 || _interfaceId == 0x80ac58cd || _interfaceId == 0x8153916a) && (_interfaceId != 0xffffffff);
| 77,558 |
4 | // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. we then downcast because we know the result always fits within 160 bits due to our tick input constraint we round up in the division so getTickAtSqrtRatio of the output price is always consistent | sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| 7,164 |
14 | // Sets `token`'s balance in a General Pool to the result of the `mutation` function when called with thecurrent balance and `amount`. This function assumes `poolId` exists, corresponds to the General specialization setting, and that `token` isregistered for that Pool. Returns the managed balance delta as a result of t... | function _updateGeneralPoolBalance(
bytes32 poolId,
IERC20 token,
function(bytes32, uint256) returns (bytes32) mutation,
uint256 amount
| function _updateGeneralPoolBalance(
bytes32 poolId,
IERC20 token,
function(bytes32, uint256) returns (bytes32) mutation,
uint256 amount
| 55 |
6 | // Total amount of the underlying asset that/ is "managed" by Vault. | function totalAssets() external view virtual returns (uint256 totalAssets);
/*////////////////////////////////////////////////////////
Deposit/Withdrawal Logic
| function totalAssets() external view virtual returns (uint256 totalAssets);
/*////////////////////////////////////////////////////////
Deposit/Withdrawal Logic
| 19,798 |
73 | // Rescue tokens | function rescueTokens(
address token,
address to,
uint256 amount
| function rescueTokens(
address token,
address to,
uint256 amount
| 3,492 |
87 | // AllowanceCrowdsale Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale. / | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private _tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address ... | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private _tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address ... | 26,448 |
34 | // Private: set permissions of account | function _setPermissions(address _account, address[] _permissions)
private
returns (bool)
| function _setPermissions(address _account, address[] _permissions)
private
returns (bool)
| 20,557 |
444 | // update remaining unstakeAmount | unstakeAmount = unstakeAmount.sub(currentAmount);
| unstakeAmount = unstakeAmount.sub(currentAmount);
| 30,688 |
381 | // Inserts 192 bit shifted by an offset into a 256 bit word, replacing the old value. Returns the new word. Assumes `value` can be represented using 192 bits. / | function insertBits192(
bytes32 word,
bytes32 value,
uint256 offset
| function insertBits192(
bytes32 word,
bytes32 value,
uint256 offset
| 53,541 |
298 | // : Modifier to restrict erc20 can be locked / | modifier onlyEthTokenWhiteList(address _token) {
require(
getTokenInEthWhiteList(_token),
"Only token in whitelist can be transferred to cosmos"
);
_;
}
| modifier onlyEthTokenWhiteList(address _token) {
require(
getTokenInEthWhiteList(_token),
"Only token in whitelist can be transferred to cosmos"
);
_;
}
| 7,870 |
20 | // Up to fourth airline can be registered by a previously registered airline | if (airlineCount < 4) {
airlines[airline] = Airline({
isRegistered: true,
votes: 1,
ante: 0
});
| if (airlineCount < 4) {
airlines[airline] = Airline({
isRegistered: true,
votes: 1,
ante: 0
});
| 4,695 |
72 | // Transfer NFT to buyer | IERC721(_collection).safeTransferFrom(address(this), address(msg.sender), _tokenId);
| IERC721(_collection).safeTransferFrom(address(this), address(msg.sender), _tokenId);
| 24,945 |
25 | // Change your employee account address to `_newAccountAddress` Initialization check is implicitly provided by `employeeMatches` as new employees can only be added via `addEmployee(),` which requires initialization. As the employee is allowed to call this, we enforce non-reentrancy. _newAccountAddress New address to re... | function changeAddressByEmployee(address _newAccountAddress) external employeeMatches nonReentrant {
uint256 employeeId = employeeIds[msg.sender];
address oldAddress = employees[employeeId].accountAddress;
_setEmployeeAddress(employeeId, _newAccountAddress);
// Don't delete the old ... | function changeAddressByEmployee(address _newAccountAddress) external employeeMatches nonReentrant {
uint256 employeeId = employeeIds[msg.sender];
address oldAddress = employees[employeeId].accountAddress;
_setEmployeeAddress(employeeId, _newAccountAddress);
// Don't delete the old ... | 18,973 |
10 | // Constructor / | constructor(address _zora, address _weth) public {
require(
IERC165(_zora).supportsInterface(interfaceId),
"Doesn't support NFT interface"
);
zora = _zora;
wethAddress = _weth;
timeBuffer = 15 * 60; // extend 15 minutes after every bid made in last 15 ... | constructor(address _zora, address _weth) public {
require(
IERC165(_zora).supportsInterface(interfaceId),
"Doesn't support NFT interface"
);
zora = _zora;
wethAddress = _weth;
timeBuffer = 15 * 60; // extend 15 minutes after every bid made in last 15 ... | 41,878 |
121 | // the Metadata extension.Made for efficiancy! / | contract ERC721 is ERC165, IERC721, IERC721Metadata, Ownable {
using Address for address;
using Strings for uint256;
uint16 public totalSupply;
address public proxyRegistryAddress;
string private baseURI;
// Mapping from token ID to owner address
mapping(uint256 => address) internal _own... | contract ERC721 is ERC165, IERC721, IERC721Metadata, Ownable {
using Address for address;
using Strings for uint256;
uint16 public totalSupply;
address public proxyRegistryAddress;
string private baseURI;
// Mapping from token ID to owner address
mapping(uint256 => address) internal _own... | 47,607 |
102 | // Not sure what was returned: don't mark as success | default { }
| default { }
| 23,050 |
123 | // //Account information | struct Account {
// Staked of current account
uint160 balance;
// Token dividend value mark of the unit that the account has received
uint96 rewardCursor;
//? 已经领取的,手动设置
uint claimed;
}
| struct Account {
// Staked of current account
uint160 balance;
// Token dividend value mark of the unit that the account has received
uint96 rewardCursor;
//? 已经领取的,手动设置
uint claimed;
}
| 55,886 |
0 | // IBondingCurve - Partial bonding curve interface | contract IBondingCurve {
/// @dev Get the price in collateralTokens to mint bondedTokens
/// @param numTokens The number of tokens to calculate price for
function priceToBuy(uint256 numTokens) public view returns(uint256);
/// @dev Get the reward in collateralTokens to ... | contract IBondingCurve {
/// @dev Get the price in collateralTokens to mint bondedTokens
/// @param numTokens The number of tokens to calculate price for
function priceToBuy(uint256 numTokens) public view returns(uint256);
/// @dev Get the reward in collateralTokens to ... | 34,819 |
6 | // transfer NFT to owner | nft.safeTransferFrom(address(this), owner(), nftID);
| nft.safeTransferFrom(address(this), owner(), nftID);
| 48,255 |
9 | // override if the SuperApp shall have custom logic invoked when an existing flow/to it is updated (flowrate change). | function onFlowUpdated(
ISuperToken /*superToken*/,
address /*sender*/,
int96 /*previousFlowRate*/,
uint256 /*lastUpdated*/,
bytes calldata ctx
| function onFlowUpdated(
ISuperToken /*superToken*/,
address /*sender*/,
int96 /*previousFlowRate*/,
uint256 /*lastUpdated*/,
bytes calldata ctx
| 28,130 |
157 | // called from 'executeProposal' | function changeAdminKeyByBackup(address payable _account, address _pkNew) external allowSelfCallsOnly {
require(_pkNew != address(0), "0x0 is invalid");
address pk = accountStorage.getKeyData(_account, 0);
require(pk != _pkNew, "identical admin key exists");
require(accountStorage.getDelayDataHash(_account, CH... | function changeAdminKeyByBackup(address payable _account, address _pkNew) external allowSelfCallsOnly {
require(_pkNew != address(0), "0x0 is invalid");
address pk = accountStorage.getKeyData(_account, 0);
require(pk != _pkNew, "identical admin key exists");
require(accountStorage.getDelayDataHash(_account, CH... | 24,765 |
17 | // Cannot exit during ongoing challenge | require(!challenges[listing.challengeID].isInitialized() ||
challenges[listing.challengeID].isResolved());
| require(!challenges[listing.challengeID].isInitialized() ||
challenges[listing.challengeID].isResolved());
| 33,370 |
19 | // Reset owners array and index reverse lookup table | for (i = 0; i < owners.length; i++) {
delete ownersIndices[owners[i]];
}
| for (i = 0; i < owners.length; i++) {
delete ownersIndices[owners[i]];
}
| 36,324 |
0 | // A minimum normalized weight imposes a maximum weight ratio. We need this due to limitations in the implementation of the power function, as these ratios are often exponents. | uint256 internal constant _MIN_WEIGHT = 0.01e18;
| uint256 internal constant _MIN_WEIGHT = 0.01e18;
| 16,720 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.