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
9
// Returns the downcasted uint176 from uint256, reverting onoverflow (when the input is greater than largest uint176). Counterpart to Solidity's `uint176` operator. Requirements: - input must fit into 176 bits /
function toUint176(uint256 value) internal pure returns (uint176) { require(value < 2**176, "SafeCast: value doesn\'t fit in 176 bits"); return uint176(value); }
function toUint176(uint256 value) internal pure returns (uint176) { require(value < 2**176, "SafeCast: value doesn\'t fit in 176 bits"); return uint176(value); }
12,225
119
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; }
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; }
590
42
// Redeem a specific collateral type using an amount of internal system coins from your bag collateralType The collateral type to redeem coinsAmount The amount of internal coins to use from your bag /
function redeemCollateral(bytes32 collateralType, uint256 coinsAmount) external { require(collateralCashPrice[collateralType] != 0, "GlobalSettlement/collateral-cash-price-not-defined"); uint256 collateralAmount = rmultiply(coinsAmount, collateralCashPrice[collateralType]); safeEngine.transf...
function redeemCollateral(bytes32 collateralType, uint256 coinsAmount) external { require(collateralCashPrice[collateralType] != 0, "GlobalSettlement/collateral-cash-price-not-defined"); uint256 collateralAmount = rmultiply(coinsAmount, collateralCashPrice[collateralType]); safeEngine.transf...
38,080
3
// called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw /
function withdraw(uint256 amount) external { _burn(_msgSender(), amount); }
function withdraw(uint256 amount) external { _burn(_msgSender(), amount); }
6,219
10
// ERC 20 /
function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) ...
function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) ...
17,702
0
// Calculator of pool owner commission for each block reward/Danilo Tuler/This provides flexibility for different commission models
interface Fee { /// @notice calculates the total amount of the reward that will be directed to the pool owner /// @return amount of tokens taken by the pool owner as commission function getCommission(uint256 posIndex, uint256 rewardAmount) external view returns (uint256); }
interface Fee { /// @notice calculates the total amount of the reward that will be directed to the pool owner /// @return amount of tokens taken by the pool owner as commission function getCommission(uint256 posIndex, uint256 rewardAmount) external view returns (uint256); }
24,425
12
// Utility function to convert string to bytes32 /
function stringToBytes32(string memory source) private pure returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } }
function stringToBytes32(string memory source) private pure returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } }
27,018
23
// Event emitted when the DAO contract is changed/daoContract The address of the new DAO contract/admin The admin account that made the change
event DAOContractChanged(address daoContract, address admin);
event DAOContractChanged(address daoContract, address admin);
21,333
0
// _airnode Address of the Airnode contract
constructor (address _airnode) public
constructor (address _airnode) public
1,707
34
// The Ownable constructor sets the original `owner` of the contract to the senderaccount. /
function initialize(address sender) public initializer { _owner = sender; }
function initialize(address sender) public initializer { _owner = sender; }
39,773
8
// TODO: extract the correct part of the block header for this
bytes32 signedmsg = keccak256(""); address signer = ecrecover(signedmsg, v, r, s); console.log(signer, miner);
bytes32 signedmsg = keccak256(""); address signer = ecrecover(signedmsg, v, r, s); console.log(signer, miner);
1,735
16
// Manage Holders List
_addHolder(from); _addHolder(to); if (balanceOf(from) == 0) _removeHolder(from); return;
_addHolder(from); _addHolder(to); if (balanceOf(from) == 0) _removeHolder(from); return;
15,016
7
// Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`/sender The account from which the transfer will be initiated/recipient The recipient of the transfer/amount The amount of the transfer/ return Returns true for a successful transfer, false for unsuccessful
function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool);
function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool);
7,636
9
// Add a new version of the logic contract _version The version to be associated with the new contract. _logic New logic contract.return Success of the transaction. /
function addLogicVersion ( uint256 _version, address _logic ) external returns(bool)
function addLogicVersion ( uint256 _version, address _logic ) external returns(bool)
13,957
16
// Reverts if the proposer didn't specify a target address
error PROPOSAL_TARGET_MISSING();
error PROPOSAL_TARGET_MISSING();
32,282
53
// Restart the process of vendor minting with vendorMint().
function unpause() public isManager virtual
function unpause() public isManager virtual
43,618
7
// NFT Token Metadata Provides common functions for various NFT metadata standards. This extension supports base URI, per-token URI, and a fallback URI. You can also freeze URIs until a certain token ID. @custom:type eip-2535-facet@custom:category NFTs@custom:provides-interfaces ITokenMetadata /
contract TokenMetadata is ITokenMetadata { function baseURI() external view virtual returns (string memory) { return TokenMetadataStorage.layout().baseURI; } function fallbackURI() external view virtual returns (string memory) { return TokenMetadataStorage.layout().fallbackURI; } f...
contract TokenMetadata is ITokenMetadata { function baseURI() external view virtual returns (string memory) { return TokenMetadataStorage.layout().baseURI; } function fallbackURI() external view virtual returns (string memory) { return TokenMetadataStorage.layout().fallbackURI; } f...
8,412
11
// Make sure this is not a duplicate pool
mapping(IERC20 => bool) public supportedToken; 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 ...
mapping(IERC20 => bool) public supportedToken; 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 ...
70,903
4,066
// 2034
entry "untasked" : ENG_ADJECTIVE
entry "untasked" : ENG_ADJECTIVE
18,646
38
// Publish a new version of an existing subgraph. _subgraphID Subgraph ID _subgraphDeploymentID Subgraph deployment ID of the new version _versionMetadata IPFS hash for the subgraph version metadata /
function publishNewVersion( uint256 _subgraphID, bytes32 _subgraphDeploymentID, bytes32 _versionMetadata
function publishNewVersion( uint256 _subgraphID, bytes32 _subgraphDeploymentID, bytes32 _versionMetadata
80,523
208
// swap up to slippage limit, taking entire kassiahotel reserves, and minting part of total
uniVars.mintToReserves = mintAmount.sub((tokens_to_max_slippage - excess)); pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
uniVars.mintToReserves = mintAmount.sub((tokens_to_max_slippage - excess)); pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
19,696
22
// if the time hasn't been set before, then track it now else just leave the time which has been set already this prevents double entries if checkIfProjectEnded is called multiple times
if (completedAt == 0) {
if (completedAt == 0) {
17,250
200
// priceFeed Chainlink contract for asset price assetContract_ ERC20 asset contract address /
constructor(string memory name_, IERC20 assetContract_, AggregatorV3Interface priceFeed) PandaBase(priceFeed, assetContract_.decimals(), PoolDirection.CALL)
constructor(string memory name_, IERC20 assetContract_, AggregatorV3Interface priceFeed) PandaBase(priceFeed, assetContract_.decimals(), PoolDirection.CALL)
41,894
66
// rounding to nearest duration
uint timediff = optionContract.expiryDate().sub(block.timestamp).add(60); uint duration = timediff.div(120).mul(120); // round to 2min
uint timediff = optionContract.expiryDate().sub(block.timestamp).add(60); uint duration = timediff.div(120).mul(120); // round to 2min
41,773
211
// Tells whether the Agent app is a forwarder or notIForwarder interface conformance return Always true/
function isForwarder() external pure returns (bool) { return true; }
function isForwarder() external pure returns (bool) { return true; }
44,265
35
// Convert ether to tokens and transfer tokens to `recipient`./ Specify the maximum input (in ether) and the exact output (in tokens)./ Any remaining ether is refunded./tokensBought The exact amount of tokens you want to buy and transfer to/`recipient`. Will revert if less than `tokensBought` tokens can be bought/with ...
function ethToTokenTransferOutput(uint256 tokensBought, uint256 deadline, address recipient) external payable returns (uint256)
function ethToTokenTransferOutput(uint256 tokensBought, uint256 deadline, address recipient) external payable returns (uint256)
8,752
2
// NFTRentMarketplace
struct Item { uint256 nftId; uint256 poolId; bool isRented; uint256 categoryId; address payable owner; address rentee; }
struct Item { uint256 nftId; uint256 poolId; bool isRented; uint256 categoryId; address payable owner; address rentee; }
32,007
12
// Divide the signature into its three components
assembly { r := mload(add(_signature, 32)) s := mload(add(_signature, 64)) v := and(mload(add(_signature, 65)), 255) }
assembly { r := mload(add(_signature, 32)) s := mload(add(_signature, 64)) v := and(mload(add(_signature, 65)), 255) }
2,892
26
// transfer bmi profit to the user
bmiToken.transfer(_msgSender(), profit); emit StakingBMIProfitWithdrawn(tokenId, policyBookAddress, _msgSender(), profit);
bmiToken.transfer(_msgSender(), profit); emit StakingBMIProfitWithdrawn(tokenId, policyBookAddress, _msgSender(), profit);
24,280
10
// Returns the cost to mint a number of tokens for a specific address. _address - The address that wants to mint the tokens. _count - The number of tokens to mint.return The cost to mint the tokens. /
function getCost(address _address, uint256 _count) public view returns (uint256) { if (canClaim(_address)) { uint256 freeCount = freePerWallet - mintedByAddress[_address]; if (_count <= freeCount) { return 0; } return costPublic * (_count - fre...
function getCost(address _address, uint256 _count) public view returns (uint256) { if (canClaim(_address)) { uint256 freeCount = freePerWallet - mintedByAddress[_address]; if (_count <= freeCount) { return 0; } return costPublic * (_count - fre...
23,322
3
// Init
constructor(address _ticket, string memory _name, string memory _symbol, string memory iconUrl_) ERC721(_name, _symbol) { creator = msg.sender; _setDefaultRoyalty(creator, __fee); setTicket(_ticket); _iconUrl = iconUrl_; }
constructor(address _ticket, string memory _name, string memory _symbol, string memory iconUrl_) ERC721(_name, _symbol) { creator = msg.sender; _setDefaultRoyalty(creator, __fee); setTicket(_ticket); _iconUrl = iconUrl_; }
9,636
106
// if we own the token, pass ownership to our owner when finalized
if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) { token.transferOwnership(owner); }
if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) { token.transferOwnership(owner); }
42,048
76
// Internal functions -----------------------------------------------------------------------------------------------------------------
function hashString(string _string) internal pure returns (bytes32)
function hashString(string _string) internal pure returns (bytes32)
29,018
4
// Tracking
uint32 public fake_nonce;
uint32 public fake_nonce;
73,317
268
// Calculate amount of tokens for a given wei amount. Apply special bonuses depending on weiAmount Amount of wei for token purchase. bonusPercent Percentage of bonus tokens.return Number of tokens with possible bonus. /
function getTokenAmount( uint256 weiAmount, uint256 bonusPercent ) internal view returns(uint256)
function getTokenAmount( uint256 weiAmount, uint256 bonusPercent ) internal view returns(uint256)
54,034
36
// Withdraw Ether from the contract and send it to the address that is specified by the owner. It can be called only by the owner. /
function withdraw(uint256 amount) external onlyOwner returns(bool success) { require(address(this).balance >= amount, "Not enough fund"); /// Checks the contract's ETH balance //require(contractBalance >= amount, "Not enough fund"); /// Checks the contract's ETH balance ...
function withdraw(uint256 amount) external onlyOwner returns(bool success) { require(address(this).balance >= amount, "Not enough fund"); /// Checks the contract's ETH balance //require(contractBalance >= amount, "Not enough fund"); /// Checks the contract's ETH balance ...
43,366
30
// �����û��˻���ָ��������Remove `_value` tokens from the system irreversibly on behalf of `_from _from the address of the sender _value the amount of money to burn/
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtr...
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtr...
432
191
// Team can emergency start/pause sale
bool public saleStarted = true;
bool public saleStarted = true;
10,701
60
// method which allows to burn a predefined amount of tokens amount - the amount of tokens to burn only callable by the owner only callable if the token is not paused only callable if the token supports burning /
function burn(uint256 amount) public override onlyOwner whenNotPaused { if (!isBurnable()) { revert BurningNotEnabled(); } super.burn(amount); }
function burn(uint256 amount) public override onlyOwner whenNotPaused { if (!isBurnable()) { revert BurningNotEnabled(); } super.burn(amount); }
5,699
22
// @inheritdoc ERC721/Returns Base64 encoded JSON metadata for the given tokenId
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); require(metadataAssigned[tokenId], "Metadata is not assigned to the token yet"); string memory namePostfix = '"'; i...
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); require(metadataAssigned[tokenId], "Metadata is not assigned to the token yet"); string memory namePostfix = '"'; i...
25,518
24
// Update the DApp by creating a new token with new functionalities/the msg.sender becomes the controller of this clone token/_parentToken Address of the token being cloned/_snapshotBlock Block of the parent token that will/determine the initial distribution of the clone token/_tokenName Name of the new token/_decimalU...
function createCloneToken( address _parentToken, uint _snapshotBlock, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, bool _transfersEnabled ) public returns (MiniMeToken)
function createCloneToken( address _parentToken, uint _snapshotBlock, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, bool _transfersEnabled ) public returns (MiniMeToken)
19,863
56
// Calculate count of shares what can buy with selected amount for default price amountWei amount for buy sharereturn number of shares /
function weiToShare(uint256 amountWei) public view returns (uint256) { uint256 shareNumber = amountWei.mulDiv(priceUnits, price); uint256 comissionShare = shareNumber.mulDiv(buyComission, buyComissionUnits); return shareNumber.sub(comissionShare); }
function weiToShare(uint256 amountWei) public view returns (uint256) { uint256 shareNumber = amountWei.mulDiv(priceUnits, price); uint256 comissionShare = shareNumber.mulDiv(buyComission, buyComissionUnits); return shareNumber.sub(comissionShare); }
23,671
25
// get register fee
function seizeEth() external { uint256 _currentBalance = address(this).balance; _ETHFeeWallet.transfer(_currentBalance); }
function seizeEth() external { uint256 _currentBalance = address(this).balance; _ETHFeeWallet.transfer(_currentBalance); }
25,961
78
// Retrieve fixed governance parameters./ return gv The governance parameters of this party.
function getGovernanceValues() external view returns (GovernanceValues memory gv) { return _governanceValues; }
function getGovernanceValues() external view returns (GovernanceValues memory gv) { return _governanceValues; }
12,839
83
// One way function to release the tokens to the wild. Can be called only from the release agent that is the final ICO contract. It is only called if the crowdsale has been success (first milestone reached). /
function releaseTokenTransfer() public onlyReleaseAgent { released = true; }
function releaseTokenTransfer() public onlyReleaseAgent { released = true; }
27,601
7
// Returns the current balance of TAK tokens for an account. /
function balanceOf(address account) public view override returns (uint256) { return super.balanceOf(account); }
function balanceOf(address account) public view override returns (uint256) { return super.balanceOf(account); }
5,877
209
// setProvenance- Provenance for data integrity
function setProvenance(string memory _provenance) external onlyOwner
function setProvenance(string memory _provenance) external onlyOwner
50,248
296
// We'll start at the tip of the stack and traverse backwards.
uint256 currentIndex = withdrawalStack.length - 1;
uint256 currentIndex = withdrawalStack.length - 1;
55,524
79
// Extend crowdsale. newClosingTime Crowdsale closing time /
function _extendTime(uint256 newClosingTime) internal virtual { require(!hasClosed(), "TimedCrowdsale: already closed"); // solhint-disable-next-line max-line-length require(newClosingTime > _closingTime, "TimedCrowdsale: new closing time is before current closing time"); emit Timed...
function _extendTime(uint256 newClosingTime) internal virtual { require(!hasClosed(), "TimedCrowdsale: already closed"); // solhint-disable-next-line max-line-length require(newClosingTime > _closingTime, "TimedCrowdsale: new closing time is before current closing time"); emit Timed...
23,091
10
// Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to mo...
function transferFrom(
function transferFrom(
18,256
90
// 发放token给创始人
TIC.push(founderList[i], all_token_num - locked_token_num);
TIC.push(founderList[i], all_token_num - locked_token_num);
37,771
10
// If the merkle root is non-zero this is a private sale and requires a valid proof
if (sales[saleId].merkleRoot != bytes32(0)) { require( this._isAllowed( sales[saleId].merkleRoot, msg.sender, proof ) == true, "bad merkle proof for sale" ); }
if (sales[saleId].merkleRoot != bytes32(0)) { require( this._isAllowed( sales[saleId].merkleRoot, msg.sender, proof ) == true, "bad merkle proof for sale" ); }
20,733
36
// Calculate ERC20 token amount to send with ether amount input using KyberSwap ethSwapTokenAddress ERC20 token address to swap ether ethAmount ether amount to use as inputreturn minConversionRate KyberSwap's conversion rate. if can be swapped, return value with not 0, else return 0return tokenAmount KyberSwap's sendin...
function calculateTokenAmountByEthAmountKyber(address ethSwapTokenAddress, uint256 ethAmount) private view returns (uint256, uint256) { EIP20Interface ethSwapToken = EthSwapToken; if(ethSwapTokenAddress!=address(0x0)) { ethSwapToken = EIP20Interface(ethSwapTokenAddress); } ...
function calculateTokenAmountByEthAmountKyber(address ethSwapTokenAddress, uint256 ethAmount) private view returns (uint256, uint256) { EIP20Interface ethSwapToken = EthSwapToken; if(ethSwapTokenAddress!=address(0x0)) { ethSwapToken = EIP20Interface(ethSwapTokenAddress); } ...
51,515
5
// Allows a whitelist authority to set the whitelistedUntil state for a given lender Anyone can create their own whitelist, and borrowers can decide if and which whitelist they want to use lenders Array of lender addresses whitelistedUntil Timestamp until which lenders shall be whitelisted under given whitelist authori...
function updateLenderWhitelist(
function updateLenderWhitelist(
38,466
11
// The number of tokens that have been claimed by the owner.
uint256 public numClaimedByOwner;
uint256 public numClaimedByOwner;
3,890
19
// Changes a specific leaderboard's "canScoresDecrease" property.If set to `true`, then a new player's score always replaces their previous score.If set to `false`, then a new score is compared to that player's previous score and is only accepted if it's better. leaderboardId number of the leaderboard to be configured....
function setCanScoresDecrease(uint256 leaderboardId, bool _canScoresDecrease) public
function setCanScoresDecrease(uint256 leaderboardId, bool _canScoresDecrease) public
34,471
156
// if its not the first execution, lets make sure the msgData matches
} else if (self.proposal_[_whatProposal].msgData == _msgData) {
} else if (self.proposal_[_whatProposal].msgData == _msgData) {
2,971
4
// Require naturalUnit passed is greater than 0
require( _naturalUnit > 0, "SetToken.constructor: Natural unit must be positive" );
require( _naturalUnit > 0, "SetToken.constructor: Natural unit must be positive" );
7,803
47
// Log a vote for a proposal Vote `supportsProposal? in support of : against` proposal `proposalNumber`proposalNumber number of proposal supportsProposal either in favor or against it justificationText optional justification text /
function vote( uint proposalNumber, bool supportsProposal, string justificationText ) onlyMembers public returns (uint voteID)
function vote( uint proposalNumber, bool supportsProposal, string justificationText ) onlyMembers public returns (uint voteID)
21,362
43
// Delists a ticket from sale - prevents purchase of ticket
function delistTicket(uint256 ticketNumber) external { // Require that the sender be the owner of this ticket / ticket exists require(ticketNumberToOwner[ticketNumber] == msg.sender, "RE-7"); // Diable this ticket from being sold) - price doesn't need to be updated it will be overrided when...
function delistTicket(uint256 ticketNumber) external { // Require that the sender be the owner of this ticket / ticket exists require(ticketNumberToOwner[ticketNumber] == msg.sender, "RE-7"); // Diable this ticket from being sold) - price doesn't need to be updated it will be overrided when...
45,908
105
// triggered when a new data point is being added_address the address we're collecting the data for _time the checkpoint /
event CheckpointUpdated(address indexed _address, uint256 _time);
event CheckpointUpdated(address indexed _address, uint256 _time);
18,285
42
// Before the token is finalized, only owner and ops are allowed to initiate transfers. This allows them to move tokens while the sale is still in private sale.
require(isOwnerOrOps(_sender), 'Require is owner or ops allowed to initiate transfer');
require(isOwnerOrOps(_sender), 'Require is owner or ops allowed to initiate transfer');
24,915
122
// differentiate between buy/sell/transfer to apply different taxes/restrictions
bool isBuy=sender==_pancakePairAddress|| sender == pancakeRouter; bool isSell=recipient==_pancakePairAddress|| recipient == pancakeRouter;
bool isBuy=sender==_pancakePairAddress|| sender == pancakeRouter; bool isSell=recipient==_pancakePairAddress|| recipient == pancakeRouter;
11,480
65
// start liquid variables etc.
IUniswapV2Router02 public immutable uniswapV2Router;
IUniswapV2Router02 public immutable uniswapV2Router;
2,976
17
// If the current exchange rate is within this fractional distance from the target, no supply update is performed. Fixed point number--same format as the rate. (ie) abs(rate - targetRate) / targetRate < deviationThreshold, then no supply change.
uint256 public deviationThreshold;
uint256 public deviationThreshold;
20,903
12
// INTERNAL NON-VIEW
function _swapOnOneInch( address tokenIn, address tokenOut, uint256 amountIn, bytes calldata oneInchTxData
function _swapOnOneInch( address tokenIn, address tokenOut, uint256 amountIn, bytes calldata oneInchTxData
9,453
140
// CakeToken with Governance.
contract CakeToken is BEP20('PancakeSwap Token', 'Cake') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
contract CakeToken is BEP20('PancakeSwap Token', 'Cake') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
35,577
0
// Packed value for claim computation uint128: timestamp of start uint128: timestamp of end
uint256 private immutable VESTING_START_AND_END;
uint256 private immutable VESTING_START_AND_END;
9,324
39
// Amount of tranches that have been issued so far
uint256 issuedTranches = cofoundersSupplyVestingTranchesIssued;
uint256 issuedTranches = cofoundersSupplyVestingTranchesIssued;
6,237
24
// Performs the proxy call via a delegatecall. /
function _doProxyCall() internal { address implementation = _getImplementation(); require(implementation != address(0), "Proxy: implementation not initialized"); assembly { // Copy calldata into memory at 0x0....calldatasize. calldatacopy(0x0, 0x0, calldatasize()) ...
function _doProxyCall() internal { address implementation = _getImplementation(); require(implementation != address(0), "Proxy: implementation not initialized"); assembly { // Copy calldata into memory at 0x0....calldatasize. calldatacopy(0x0, 0x0, calldatasize()) ...
562
12
// The address of the {ButtonswapFactory} instance used to create this Pair. Set to `msg.sender` in the Pair constructor.return factory The factory address /
function factory() external view returns (address factory);
function factory() external view returns (address factory);
28,743
27
// The ```setMinimumCurvePoolVirtualPrice``` function is used to set the minimum virtual price/_newMinimum the new minimum virtual price
function setMinimumCurvePoolVirtualPrice(uint256 _newMinimum) external override { _requireTimelock(); _setMinimumCurvePoolVirtualPrice({ _newMinimum: _newMinimum }); }
function setMinimumCurvePoolVirtualPrice(uint256 _newMinimum) external override { _requireTimelock(); _setMinimumCurvePoolVirtualPrice({ _newMinimum: _newMinimum }); }
29,139
168
// return true if the crowdsale has raised enough money to be a succes /
function isMinimumGoalReached() public constant returns (bool reached) { return weiRaised >= minimumFundingGoal; }
function isMinimumGoalReached() public constant returns (bool reached) { return weiRaised >= minimumFundingGoal; }
2,612
2
// A record of PHAYC that are offered for sale at a specific minimum value, and perhaps to a specific person
mapping (uint => Offer) public phaycOfferedForSale;
mapping (uint => Offer) public phaycOfferedForSale;
10,202
9
// delete employee from mapping
delete employees[_addr];
delete employees[_addr];
17,290
2
// Thx Cyberkongs VX <3
function getRandomToken(address _wallet, uint256 _totalMinted) private returns (uint256)
function getRandomToken(address _wallet, uint256 _totalMinted) private returns (uint256)
50,429
479
// Wrap BNB
address WBNB = BakerySwapRouter02.WBNB();
address WBNB = BakerySwapRouter02.WBNB();
10,039
22
// update the counter of tax intervals
++_TaxIntervalNumber; emit OnTaxInterval(_TaxIntervalNumber, _lastTaxPool, _lastTotalOnAccounts);
++_TaxIntervalNumber; emit OnTaxInterval(_TaxIntervalNumber, _lastTaxPool, _lastTotalOnAccounts);
28,920
19
// Allows smartcontracts to access the liquidity of the pool within one transaction,as long as the amount taken plus a fee is returned.IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. receiverAddress The address of the contract receiving the fund...
) external override whenNotPaused { FlashLoanLocalVars memory vars; ValidationLogic.validateFlashloan(assets, amounts); address[] memory aTokenAddresses = new address[](assets.length); uint256[] memory premiums = new uint256[](assets.length); vars.receiver = IFlashLoanReceiver(receiverAddress);...
) external override whenNotPaused { FlashLoanLocalVars memory vars; ValidationLogic.validateFlashloan(assets, amounts); address[] memory aTokenAddresses = new address[](assets.length); uint256[] memory premiums = new uint256[](assets.length); vars.receiver = IFlashLoanReceiver(receiverAddress);...
15,920
7
// Divides two unsigned integers and returns the remainder (unsigned integer modulo), reverts when dividing by zero./
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; }
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; }
34,672
55
// base 1000, 0.5% = value5 / 1000
uint256 public lpFeePercent = 0; address payable public feeWithdrawalAddress;
uint256 public lpFeePercent = 0; address payable public feeWithdrawalAddress;
25,173
188
// return implementation
return _versions[entity][version];
return _versions[entity][version];
78,858
38
// tinlake contracts
CoordinatorLike_1 public coordinator; AssessorLike_2 public assessor; ReserveLike_2 public reserve; TrancheLike_1 public tranche;
CoordinatorLike_1 public coordinator; AssessorLike_2 public assessor; ReserveLike_2 public reserve; TrancheLike_1 public tranche;
22,279
4
// suspend deployment
rc.suspendDeployment(address(2));
rc.suspendDeployment(address(2));
39,198
0
// Compound C Token interface /
interface ICERC20 { /** * @notice The mint function transfers an asset into the protocol, which begins accumulating * interest based on the current Supply Rate for the asset. The user receives a quantity of * cTokens equal to the underlying tokens supplied, divided by the current Exchange Rate. ...
interface ICERC20 { /** * @notice The mint function transfers an asset into the protocol, which begins accumulating * interest based on the current Supply Rate for the asset. The user receives a quantity of * cTokens equal to the underlying tokens supplied, divided by the current Exchange Rate. ...
16,981
43
// calculates the amount
if(promotionsUsed < 50 && msg.value >= 100000000000000000) { amount = mul(msg.value, buyFactorPromotion); }
if(promotionsUsed < 50 && msg.value >= 100000000000000000) { amount = mul(msg.value, buyFactorPromotion); }
47,088
152
// Changes the admin of `proxy` to `newAdmin`.Requirements:- This contract must be the current admin of `proxy`. /
function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public onlyOwner { proxy.changeAdmin(newAdmin); }
function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public onlyOwner { proxy.changeAdmin(newAdmin); }
35,052
43
// Deposit to SeniorPool and stake your shares in the same transaction./usdcAmount The amount of USDC to deposit into the senior pool. All shares from deposit/ will be staked.
function depositAndStake(uint256 usdcAmount) public nonReentrant whenNotPaused updateReward(0) { uint256 fiduAmount = depositToSeniorPool(usdcAmount); uint256 lockedUntil = 0; uint256 tokenId = _stakeWithLockup(address(this), msg.sender, fiduAmount, lockedUntil, MULTIPLIER_DECIMALS); emit DepositedAnd...
function depositAndStake(uint256 usdcAmount) public nonReentrant whenNotPaused updateReward(0) { uint256 fiduAmount = depositToSeniorPool(usdcAmount); uint256 lockedUntil = 0; uint256 tokenId = _stakeWithLockup(address(this), msg.sender, fiduAmount, lockedUntil, MULTIPLIER_DECIMALS); emit DepositedAnd...
27,293
77
// Send a stability fee reward to an addressproposedFeeReceiver The SF receiverreward The system coin amount to send/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { // If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) ...
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { // If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) ...
32,223
160
// Remove fee and refund eth in case final purchase needed to end sale without dust errors
if (address(this).balance > hardcap) { fee = 0; excess = address(this).balance.sub(hardcap); depositEther = depositEther.sub(excess); }
if (address(this).balance > hardcap) { fee = 0; excess = address(this).balance.sub(hardcap); depositEther = depositEther.sub(excess); }
55,388
3
// START - Setters
function setBrokenTokenAddress(address account) public onlyOwner { BrokenToken = IBrokenToken(account); }
function setBrokenTokenAddress(address account) public onlyOwner { BrokenToken = IBrokenToken(account); }
27,442
0
// Balances never exceed 96 bits
uint256 internal constant MAX_SUPPLY = 2 ** 96 - 1;
uint256 internal constant MAX_SUPPLY = 2 ** 96 - 1;
61,296
2
// swap_fund
swap_fund = address(0x6f32D91F08112E71C4A84DDb1fC04F72940D77a5); _mint(swap_fund, (100*T) * d );
swap_fund = address(0x6f32D91F08112E71C4A84DDb1fC04F72940D77a5); _mint(swap_fund, (100*T) * d );
27,332
22
// If true, no changes can be made
function unchangeable() public view returns (bool){ return _unchangeable; }
function unchangeable() public view returns (bool){ return _unchangeable; }
54,661
102
// buy bet core/
function betCore_(uint256 _option, uint256 _odds, uint256 _eth) private
function betCore_(uint256 _option, uint256 _odds, uint256 _eth) private
34,664
15
// Step 1:Day 1: +10% bonusDay 2: +5% bonusDay 3: +3% bonusDay 4: no bonuses/
function getBonus(uint256 _tokens) constant returns (uint256 bonus) { require(_tokens != 0); if (1 == getCurrentPeriod()) { if (startFirstStep <= now && now < startFirstStep + 1 days) { return _tokens.div(10); } else if (startFirstStep + 1 days <= now && now <...
function getBonus(uint256 _tokens) constant returns (uint256 bonus) { require(_tokens != 0); if (1 == getCurrentPeriod()) { if (startFirstStep <= now && now < startFirstStep + 1 days) { return _tokens.div(10); } else if (startFirstStep + 1 days <= now && now <...
3,183
76
// 发送者为非lockerAddrs,且存在lockValues的情况보내는 사람이 lockerAddrs가 아니며, lockValues가 있는 경우 when sender is not lockerAddrs, and has lockValues
if(lockValues[msg.sender] > 0) { uint256 _totalAmount = balances[msg.sender]; uint256 lockValue = lockValues[msg.sender].div(5);
if(lockValues[msg.sender] > 0) { uint256 _totalAmount = balances[msg.sender]; uint256 lockValue = lockValues[msg.sender].div(5);
20,851
86
// Set release manager if token not released yet addr address The new Release Manager address /
function setReleaseManager(address addr) public onlyOwner onlyNotReleased
function setReleaseManager(address addr) public onlyOwner onlyNotReleased
50,787
24
// setter function to pause/start level one mint
function setCanMintL1(bool _isPausedMintL1) public onlyOwner { isPausedMintL1 = _isPausedMintL1; }
function setCanMintL1(bool _isPausedMintL1) public onlyOwner { isPausedMintL1 = _isPausedMintL1; }
29,927
9
// URI manager is responsible for managing baseURI part of the tokenURI IERC721Metadata interface Role ROLE_URI_MANAGER allows updating the base URI (executing `setBaseURI` function) /
bytes32 public constant ROLE_URI_MANAGER = keccak256("ROLE_URI_MANAGER");
bytes32 public constant ROLE_URI_MANAGER = keccak256("ROLE_URI_MANAGER");
34,416