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
|
---|---|---|---|---|
491 | // maps alpha to all Dog stakes with that alpha | mapping(uint256 => Stake[]) public dogStaking;
| mapping(uint256 => Stake[]) public dogStaking;
| 12,776 |
2 | // Constructor, takes maximum amount of tokens issued in the crowdsale._tokenCap Max amount of wei to be contributed/ | constructor(uint256 _tokenCap) public {
require(_tokenCap > 0, "Token cap is zero");
tokenCap = _tokenCap;
}
| constructor(uint256 _tokenCap) public {
require(_tokenCap > 0, "Token cap is zero");
tokenCap = _tokenCap;
}
| 43,417 |
54 | // Only claim reward one times | require(wars[warIndex].users[msg.sender].rewardClaimed == false, "You already claimed your reward");
| require(wars[warIndex].users[msg.sender].rewardClaimed == false, "You already claimed your reward");
| 12,148 |
5 | // Reverted digiest map | mapping(bytes32 => uint256) private digestIndexs;
| mapping(bytes32 => uint256) private digestIndexs;
| 12,381 |
188 | // Allows SkaleManager contract to complete a node exit procedure.Returns whether the operation is successful. | * Emits an {ExitCompleted} event.
*
* Requirements:
*
* - Node must have already initialized a node exit procedure.
*/
function completeExit(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
returns (bool)
{
require(isNodeLeaving(nodeIndex), "Node is not Leaving");
_setNodeLeft(nodeIndex);
emit ExitCompleted(
nodeIndex,
block.timestamp,
gasleft());
return true;
}
| * Emits an {ExitCompleted} event.
*
* Requirements:
*
* - Node must have already initialized a node exit procedure.
*/
function completeExit(uint nodeIndex)
external
checkNodeExists(nodeIndex)
allow("SkaleManager")
returns (bool)
{
require(isNodeLeaving(nodeIndex), "Node is not Leaving");
_setNodeLeft(nodeIndex);
emit ExitCompleted(
nodeIndex,
block.timestamp,
gasleft());
return true;
}
| 31,893 |
20 | // Assumes the subscription is funded sufficiently. | function _requestRandomWords() private {
// Will revert if subscription is not set and funded.
_sRequestId = COORDINATOR.requestRandomWords(
KEYHASH,
sSubscriptionId,
requestConfirmations,
callbackGasLimit,
numWords
);
}
| function _requestRandomWords() private {
// Will revert if subscription is not set and funded.
_sRequestId = COORDINATOR.requestRandomWords(
KEYHASH,
sSubscriptionId,
requestConfirmations,
callbackGasLimit,
numWords
);
}
| 77,572 |
57 | // verify receipt inclusion | require(
MerklePatriciaProof.verify(
inputDataRLPList[6].toBytes(), // receipt
inputDataRLPList[8].toBytes(), // branchMask
inputDataRLPList[7].toBytes(), // receiptProof
bytes32(inputDataRLPList[5].toUint()) // receiptRoot
),
"FxRootTunnel: INVALID_RECEIPT_PROOF"
);
| require(
MerklePatriciaProof.verify(
inputDataRLPList[6].toBytes(), // receipt
inputDataRLPList[8].toBytes(), // branchMask
inputDataRLPList[7].toBytes(), // receiptProof
bytes32(inputDataRLPList[5].toUint()) // receiptRoot
),
"FxRootTunnel: INVALID_RECEIPT_PROOF"
);
| 53,329 |
52 | // Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. / | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from the zero address');
_balances[account] = _balances[account].sub(
amount,
'ERC20: burn amount exceeds balance'
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from the zero address');
_balances[account] = _balances[account].sub(
amount,
'ERC20: burn amount exceeds balance'
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| 46,204 |
61 | // helper function to get current chain id/ return chain id | function getChainId() internal view returns (uint256) {
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId;
}
| function getChainId() internal view returns (uint256) {
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId;
}
| 45,180 |
214 | // only owner address can set maxProfitAsPercentOfHouse / | {
/* restrict each bet to a maximum profit of 1% contractBalance */
if(newMaxProfitAsPercent > 10000) throw;
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
| {
/* restrict each bet to a maximum profit of 1% contractBalance */
if(newMaxProfitAsPercent > 10000) throw;
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
| 40,205 |
87 | // Name and symbol were updated. // Minimum ammount of tokens every buyer can buy. //Construct the token. This token must be created through a team multisig wallet, so that it is owned by that wallet._name Token name _symbol Token symbol - should be all caps _initialSupply How many tokens we start with _decimals Number of decimal places _mintable Are new tokens created over the crowdsale or do we distribute only the initial supply? Note that when the token becomes transferable the minting always ends. / | function CrowdsaleTokenExt(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable, uint _globalMinCap)
| function CrowdsaleTokenExt(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable, uint _globalMinCap)
| 24,297 |
10 | // Minimum waiting time to lock another proposal | uint64 public cooldownTime;
| uint64 public cooldownTime;
| 1,573 |
39 | // Allows the owner to update the aggregator address. _aggregator The new address for the aggregator contract / | function setAggregator(address _aggregator)
public
onlyOwner()
| function setAggregator(address _aggregator)
public
onlyOwner()
| 13,062 |
4,280 | // 2142 | entry "omnipresently" : ENG_ADVERB
| entry "omnipresently" : ENG_ADVERB
| 22,978 |
60 | // Contract that implements request templates | contract TemplateUtilsV0 is ITemplateUtilsV0 {
struct Template {
address airnode;
bytes32 endpointId;
bytes parameters;
}
/// @notice Called to get a template
mapping(bytes32 => Template) public override templates;
/// @notice Creates a request template with the given parameters,
/// addressable by the ID it returns
/// @dev A specific set of request parameters will always have the same
/// template ID. This means a few things: (1) You can compute the expected
/// ID of a template before creating it, (2) Creating a new template with
/// the same parameters will overwrite the old one and return the same ID,
/// (3) After you query a template with its ID, you can verify its
/// integrity by applying the hash and comparing the result with the ID.
/// @param airnode Airnode address
/// @param endpointId Endpoint ID (allowed to be `bytes32(0)`)
/// @param parameters Static request parameters (i.e., parameters that will
/// not change between requests, unlike the dynamic parameters determined
/// at request-time)
/// @return templateId Request template ID
function createTemplate(
address airnode,
bytes32 endpointId,
bytes calldata parameters
) external override returns (bytes32 templateId) {
require(airnode != address(0), "Airnode address zero");
templateId = keccak256(
abi.encodePacked(airnode, endpointId, parameters)
);
templates[templateId] = Template({
airnode: airnode,
endpointId: endpointId,
parameters: parameters
});
emit CreatedTemplate(templateId, airnode, endpointId, parameters);
}
/// @notice A convenience method to retrieve multiple templates with a
/// single call
/// @dev Does not revert if the templates being indexed do not exist
/// @param templateIds Request template IDs
/// @return airnodes Array of Airnode addresses
/// @return endpointIds Array of endpoint IDs
/// @return parameters Array of request parameters
function getTemplates(bytes32[] calldata templateIds)
external
view
override
returns (
address[] memory airnodes,
bytes32[] memory endpointIds,
bytes[] memory parameters
)
{
airnodes = new address[](templateIds.length);
endpointIds = new bytes32[](templateIds.length);
parameters = new bytes[](templateIds.length);
for (uint256 ind = 0; ind < templateIds.length; ind++) {
Template storage template = templates[templateIds[ind]];
airnodes[ind] = template.airnode;
endpointIds[ind] = template.endpointId;
parameters[ind] = template.parameters;
}
}
}
| contract TemplateUtilsV0 is ITemplateUtilsV0 {
struct Template {
address airnode;
bytes32 endpointId;
bytes parameters;
}
/// @notice Called to get a template
mapping(bytes32 => Template) public override templates;
/// @notice Creates a request template with the given parameters,
/// addressable by the ID it returns
/// @dev A specific set of request parameters will always have the same
/// template ID. This means a few things: (1) You can compute the expected
/// ID of a template before creating it, (2) Creating a new template with
/// the same parameters will overwrite the old one and return the same ID,
/// (3) After you query a template with its ID, you can verify its
/// integrity by applying the hash and comparing the result with the ID.
/// @param airnode Airnode address
/// @param endpointId Endpoint ID (allowed to be `bytes32(0)`)
/// @param parameters Static request parameters (i.e., parameters that will
/// not change between requests, unlike the dynamic parameters determined
/// at request-time)
/// @return templateId Request template ID
function createTemplate(
address airnode,
bytes32 endpointId,
bytes calldata parameters
) external override returns (bytes32 templateId) {
require(airnode != address(0), "Airnode address zero");
templateId = keccak256(
abi.encodePacked(airnode, endpointId, parameters)
);
templates[templateId] = Template({
airnode: airnode,
endpointId: endpointId,
parameters: parameters
});
emit CreatedTemplate(templateId, airnode, endpointId, parameters);
}
/// @notice A convenience method to retrieve multiple templates with a
/// single call
/// @dev Does not revert if the templates being indexed do not exist
/// @param templateIds Request template IDs
/// @return airnodes Array of Airnode addresses
/// @return endpointIds Array of endpoint IDs
/// @return parameters Array of request parameters
function getTemplates(bytes32[] calldata templateIds)
external
view
override
returns (
address[] memory airnodes,
bytes32[] memory endpointIds,
bytes[] memory parameters
)
{
airnodes = new address[](templateIds.length);
endpointIds = new bytes32[](templateIds.length);
parameters = new bytes[](templateIds.length);
for (uint256 ind = 0; ind < templateIds.length; ind++) {
Template storage template = templates[templateIds[ind]];
airnodes[ind] = template.airnode;
endpointIds[ind] = template.endpointId;
parameters[ind] = template.parameters;
}
}
}
| 50,720 |
170 | // Contract initializer.called once by the factory at time of deployment / | function __Governable_init_unchained(address governor_)
public
virtual
initializer
| function __Governable_init_unchained(address governor_)
public
virtual
initializer
| 23,994 |
8 | // Logged when the owner of a node assigns a new owner to a subnode. | event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
| event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
| 28,896 |
3 | // Changes the {taxMan}. / | function transferTaxman(address taxMan_) external {
require(msg.sender == taxMan, "!taxMan");
taxMan = taxMan_;
}
| function transferTaxman(address taxMan_) external {
require(msg.sender == taxMan, "!taxMan");
taxMan = taxMan_;
}
| 26,370 |
10 | // This is the maximum possible amount of the selected collateral that can be liquidated, given the max amount of liquidatable debt | vars.maxAmountCollateralToLiquidate = vars
.debtAssetPrice
.mul(debtToCover)
.mul(10**vars.collateralDecimals)
.percentMul(vars.liquidationBonus)
.div(vars.collateralPrice.mul(10**vars.debtAssetDecimals));
if (vars.maxAmountCollateralToLiquidate > userCollateralBalance) {
collateralAmount = userCollateralBalance;
debtAmountNeeded = vars
| vars.maxAmountCollateralToLiquidate = vars
.debtAssetPrice
.mul(debtToCover)
.mul(10**vars.collateralDecimals)
.percentMul(vars.liquidationBonus)
.div(vars.collateralPrice.mul(10**vars.debtAssetDecimals));
if (vars.maxAmountCollateralToLiquidate > userCollateralBalance) {
collateralAmount = userCollateralBalance;
debtAmountNeeded = vars
| 30,505 |
16 | // The upper tick of the range | function tickUpper() external view returns (int24);
| function tickUpper() external view returns (int24);
| 6,637 |
41 | // 已经普通提现量 | uint256 public totalCommonWithdrawSupply;
| uint256 public totalCommonWithdrawSupply;
| 45,093 |
33 | // Current number of votes in opposition to this proposal | uint256 againstVotes;
bool canceled;
bool executed;
| uint256 againstVotes;
bool canceled;
bool executed;
| 16,611 |
11 | // ensure no state passed, no reentrancy, etc. | (bool success,) = executorAddress.call{value: ethValue}(callData);
| (bool success,) = executorAddress.call{value: ethValue}(callData);
| 13,610 |
62 | // Returns a tuple of the terms contract and its associated parametersfor a given issuance / | function getTerms(bytes32 agreementId)
public
view
onlyExtantEntry(agreementId)
returns(address, bytes32)
| function getTerms(bytes32 agreementId)
public
view
onlyExtantEntry(agreementId)
returns(address, bytes32)
| 53,216 |
240 | // Gives permission to `to` to transfer `tokenId` token to another account.The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving thezero address clears previous approvals. Requirements: - `tokenId` must exist. | * Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
| * Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
| 2,590 |
1 | // Use it when testing with testrpc and etherium bridge. Don't forget to change address | OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
| OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
| 21,815 |
149 | // burn | _removeTokenFromAllTokensEnumeration(tokenId);
| _removeTokenFromAllTokensEnumeration(tokenId);
| 8,254 |
1 | // v1 price oracle interface for use as backing of proxy | function getAssetPrices(address asset) external override view returns (uint) {
return prices[asset];
}
| function getAssetPrices(address asset) external override view returns (uint) {
return prices[asset];
}
| 6,052 |
17 | // Remove `lShares` of liquidity provider token The liquidity provider token will be burned andthe corresponding amount in base token will be sent to provider The first version is implemented with an on-chain oracle contractThe second version is implemented with off-chain price provider with signature / | function removeLiquidity(uint256 lShares) external;
| function removeLiquidity(uint256 lShares) external;
| 15,259 |
61 | // Validates borrow and reverts on rejection. May emit logs. sToken Asset whose underlying is being borrowed borrower The address borrowing the underlying borrowAmount The amount of the underlying asset requested to borrow / | function borrowVerify(address sToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
sToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| function borrowVerify(address sToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
sToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| 48,491 |
12 | // 下一个pending队列交易号 | function nextPendingTxId() external view returns(uint);
| function nextPendingTxId() external view returns(uint);
| 78,601 |
29 | // Set and get Slippage / | function _SetSlippage(uint _slippage) public onlyOwner{
slippage = _slippage;
}
| function _SetSlippage(uint _slippage) public onlyOwner{
slippage = _slippage;
}
| 8,753 |
452 | // Returns true if the resolver implements the interface specified by the provided hash. interfaceID The ID of the interface to check for.return True if the contract implements the requested interface. / | function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
return interfaceID == ADDR_INTERFACE_ID ||
interfaceID == CONTENT_INTERFACE_ID ||
interfaceID == NAME_INTERFACE_ID ||
interfaceID == ABI_INTERFACE_ID ||
interfaceID == PUBKEY_INTERFACE_ID ||
interfaceID == TEXT_INTERFACE_ID ||
interfaceID == INTERFACE_META_ID;
}
| function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
return interfaceID == ADDR_INTERFACE_ID ||
interfaceID == CONTENT_INTERFACE_ID ||
interfaceID == NAME_INTERFACE_ID ||
interfaceID == ABI_INTERFACE_ID ||
interfaceID == PUBKEY_INTERFACE_ID ||
interfaceID == TEXT_INTERFACE_ID ||
interfaceID == INTERFACE_META_ID;
}
| 22,497 |
101 | // FBTToken with Governance. | contract FBTToken is ERC20("FBT", "FBT"), Ownable {
/// @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);
}
}
| contract FBTToken is ERC20("FBT", "FBT"), Ownable {
/// @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);
}
}
| 40,882 |
86 | // Override base method transfer / | function transfer(address _to, uint256 value) public whenNotPaused returns (bool _success) {
return super.transfer(_to, value);
}
| function transfer(address _to, uint256 value) public whenNotPaused returns (bool _success) {
return super.transfer(_to, value);
}
| 39,491 |
203 | // Inactive. | if (maybeStaker != address(0)) {
return _INACTIVE_BALANCES_[maybeStaker];
}
| if (maybeStaker != address(0)) {
return _INACTIVE_BALANCES_[maybeStaker];
}
| 36,361 |
72 | // {IERC721Receiver-onERC721Received}, which is called for each safe transfer.- `quantity` must be greater than 0. Emits a {Transfer} event. / | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
| function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
| 9,672 |
2 | // Swap fee receiver / | address public swapFeeTo;
| address public swapFeeTo;
| 4,453 |
4 | // Returns the remaining number of tokens that `spender` will beallowed to spend on behalf of `owner` through {transferFrom}. This iszero by default. This value changes when {approve} or {transferFrom} are called. / | function allowance(address owner, address spender) external view returns (uint256);
| function allowance(address owner, address spender) external view returns (uint256);
| 4 |
25 | // Get start position and length of the data. | function _decode(RLPItem memory self) private constant returns (uint memPtr, uint len) {
if(!isData(self))
throw;
uint b0;
uint start = self._unsafe_memPtr;
assembly {
b0 := byte(0, mload(start))
}
if (b0 < DATA_SHORT_START) {
memPtr = start;
len = 1;
return;
}
if (b0 < DATA_LONG_START) {
len = self._unsafe_length - 1;
memPtr = start + 1;
} else {
uint bLen;
assembly {
bLen := sub(b0, 0xB7) // DATA_LONG_OFFSET
}
len = self._unsafe_length - 1 - bLen;
memPtr = start + bLen + 1;
}
return;
}
| function _decode(RLPItem memory self) private constant returns (uint memPtr, uint len) {
if(!isData(self))
throw;
uint b0;
uint start = self._unsafe_memPtr;
assembly {
b0 := byte(0, mload(start))
}
if (b0 < DATA_SHORT_START) {
memPtr = start;
len = 1;
return;
}
if (b0 < DATA_LONG_START) {
len = self._unsafe_length - 1;
memPtr = start + 1;
} else {
uint bLen;
assembly {
bLen := sub(b0, 0xB7) // DATA_LONG_OFFSET
}
len = self._unsafe_length - 1 - bLen;
memPtr = start + bLen + 1;
}
return;
}
| 148 |
57 | // emitted when a supported market is suspended by admin / | event SuspendedMarket(address asset);
| event SuspendedMarket(address asset);
| 28,561 |
119 | // This function allows users to retrieve all information about a staker _staker address of staker inquiring aboutreturn uint current state of stakerreturn uint startDate of staking / | function getStakerInfo(address _staker)
external
view
returns (uint256, uint256)
| function getStakerInfo(address _staker)
external
view
returns (uint256, uint256)
| 77,109 |
21 | // Used for residual purchase incentive and cash withholding buffer | uint256 internal constant TEN_BASIS_POINTS = 10 * BASIS_POINT;
| uint256 internal constant TEN_BASIS_POINTS = 10 * BASIS_POINT;
| 32,925 |
153 | // TODO: need review | function _approve(address userAddr, uint256 unifiedTokenAmount) internal returns (uint256)
| function _approve(address userAddr, uint256 unifiedTokenAmount) internal returns (uint256)
| 53,520 |
14 | // Collect amount owed | uint128 collect0 = collectAll ? type(uint128).max : _uint128Safe(owed0);
uint128 collect1 = collectAll ? type(uint128).max : _uint128Safe(owed1);
if (collect0 > 0 || collect1 > 0) {
(amount0, amount1) = pool.collect(to, tickLower, tickUpper, collect0, collect1);
}
| uint128 collect0 = collectAll ? type(uint128).max : _uint128Safe(owed0);
uint128 collect1 = collectAll ? type(uint128).max : _uint128Safe(owed1);
if (collect0 > 0 || collect1 > 0) {
(amount0, amount1) = pool.collect(to, tickLower, tickUpper, collect0, collect1);
}
| 36,034 |
131 | // Calculate the developer cut and deposit it to the developer wallet. | uint256 developerCut = (price * _config.developerRate) / PRECISION_SCALAR;
payable(_config.developerWallet).sendValue(developerCut);
| uint256 developerCut = (price * _config.developerRate) / PRECISION_SCALAR;
payable(_config.developerWallet).sendValue(developerCut);
| 30,947 |
407 | // Open up the new fee period. Increment periodId from the recent closed period feePeriodId | _recentFeePeriodsStorage(0).feePeriodId = uint64(uint256(_recentFeePeriodsStorage(1).feePeriodId).add(1));
_recentFeePeriodsStorage(0).startingDebtIndex = uint64(synthetixState().debtLedgerLength());
_recentFeePeriodsStorage(0).startTime = uint64(now);
emitFeePeriodClosed(_recentFeePeriodsStorage(1).feePeriodId);
| _recentFeePeriodsStorage(0).feePeriodId = uint64(uint256(_recentFeePeriodsStorage(1).feePeriodId).add(1));
_recentFeePeriodsStorage(0).startingDebtIndex = uint64(synthetixState().debtLedgerLength());
_recentFeePeriodsStorage(0).startTime = uint64(now);
emitFeePeriodClosed(_recentFeePeriodsStorage(1).feePeriodId);
| 5,862 |
46 | // Authenticate / Returns whether `_account` is authenticated/_account The account to authenticate/ return whether `_account` is successfully authenticated | function authenticate(address _account) external view returns (bool);
| function authenticate(address _account) external view returns (bool);
| 52,193 |
284 | // convert rewards to shares | _withdrawAndTransferReward(from);
| _withdrawAndTransferReward(from);
| 70,962 |
13 | // Secondary A Secondary contract can only be used by its primary account (the one that created it) / | contract Secondary {
address private _primary;
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal {
_primary = msg.sender;
emit PrimaryTransferred(_primary);
}
/**
* @dev Reverts if called from any account other than the primary.
*/
modifier onlyPrimary() {
require(msg.sender == _primary);
_;
}
/**
* @return the address of the primary.
*/
function primary() public view returns (address) {
return _primary;
}
/**
* @dev Transfers contract to a new primary.
* @param recipient The address of new primary.
*/
function transferPrimary(address recipient) public onlyPrimary {
require(recipient != address(0));
_primary = recipient;
emit PrimaryTransferred(_primary);
}
}
| contract Secondary {
address private _primary;
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal {
_primary = msg.sender;
emit PrimaryTransferred(_primary);
}
/**
* @dev Reverts if called from any account other than the primary.
*/
modifier onlyPrimary() {
require(msg.sender == _primary);
_;
}
/**
* @return the address of the primary.
*/
function primary() public view returns (address) {
return _primary;
}
/**
* @dev Transfers contract to a new primary.
* @param recipient The address of new primary.
*/
function transferPrimary(address recipient) public onlyPrimary {
require(recipient != address(0));
_primary = recipient;
emit PrimaryTransferred(_primary);
}
}
| 75,241 |
21 | // Allows users to place bids on an auction. auctionId The ID of the auction. bidAmount The bid amount. incentiveAmount The bidder incentive. / | function bid(uint256 auctionId, uint256 bidAmount, uint256 incentiveAmount) external nonReentrant whenNotPaused {
Auction storage auction = auctions[auctionId];
require(block.timestamp <= auction.endTime, "Auction has ended");
require(bidAmount > auction.highestBid, "Bid amount must be greater than the current highest bid");
require(incentiveAmount <= (Max_Incentive * bidAmount) / 100, "Bidder incentive too high");
IERC20 bidToken = IERC20(auction.bidTokenAddress);
require(bidToken.transferFrom(msg.sender, address(this), bidAmount), "Token transfer failed");
// Check for extra time condition
if (block.timestamp > auction.endTime - Extra_Time) {
auction.endTime += Extra_Time;
auction.status = AuctionStatus.ExtraTime;
emit ExtraTimeAdded(auctionId, msg.sender, auction.endTime);
} else {
auction.status = AuctionStatus.BidReceived;
}
// Refund previous bidder if applicable
if (auction.highestBidder != address(0) && block.timestamp >= auction.startTime + warmUpTime) {
uint256 refundAmount = auction.highestBid + auction.bidderIncentive;
bidToken.transfer(auction.highestBidder, refundAmount);
auction.totalIncentives += incentiveAmount;
emit IncentiveReceived(auction.highestBidder, auction.bidderIncentive);
} else if (auction.highestBidder != address(0)) {
bidToken.transfer(auction.highestBidder, auction.highestBid);
}
// Update auction details
auction.highestBidder = msg.sender;
auction.highestBid = bidAmount;
auction.bidderIncentive = incentiveAmount;
emit BidPlaced(auctionId, auction.highestBidder, auction.highestBid, auction.bidderIncentive);
}
| function bid(uint256 auctionId, uint256 bidAmount, uint256 incentiveAmount) external nonReentrant whenNotPaused {
Auction storage auction = auctions[auctionId];
require(block.timestamp <= auction.endTime, "Auction has ended");
require(bidAmount > auction.highestBid, "Bid amount must be greater than the current highest bid");
require(incentiveAmount <= (Max_Incentive * bidAmount) / 100, "Bidder incentive too high");
IERC20 bidToken = IERC20(auction.bidTokenAddress);
require(bidToken.transferFrom(msg.sender, address(this), bidAmount), "Token transfer failed");
// Check for extra time condition
if (block.timestamp > auction.endTime - Extra_Time) {
auction.endTime += Extra_Time;
auction.status = AuctionStatus.ExtraTime;
emit ExtraTimeAdded(auctionId, msg.sender, auction.endTime);
} else {
auction.status = AuctionStatus.BidReceived;
}
// Refund previous bidder if applicable
if (auction.highestBidder != address(0) && block.timestamp >= auction.startTime + warmUpTime) {
uint256 refundAmount = auction.highestBid + auction.bidderIncentive;
bidToken.transfer(auction.highestBidder, refundAmount);
auction.totalIncentives += incentiveAmount;
emit IncentiveReceived(auction.highestBidder, auction.bidderIncentive);
} else if (auction.highestBidder != address(0)) {
bidToken.transfer(auction.highestBidder, auction.highestBid);
}
// Update auction details
auction.highestBidder = msg.sender;
auction.highestBid = bidAmount;
auction.bidderIncentive = incentiveAmount;
emit BidPlaced(auctionId, auction.highestBidder, auction.highestBid, auction.bidderIncentive);
}
| 23,709 |
116 | // Is called whan after liability finalization _gas Liability finalization gas expenses / | function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
| function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
| 18,114 |
6 | // https:explorer.optimism.io/address/0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C | AddressResolver public constant addressresolver_i = AddressResolver(0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C);
| AddressResolver public constant addressresolver_i = AddressResolver(0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C);
| 27,829 |
7 | // 3001-5000: 9 CELO | }else if (currentSupply >= 1641) {
| }else if (currentSupply >= 1641) {
| 17,719 |
56 | // Registers `_label` username to `ensNode` setting msg.sender as owner.Terms of name registration:- SNT is deposited, not spent; the amount is locked up for 1 year.- After 1 year, the user can release the name and receive their deposit back (at any time).- User deposits are completely protected. The contract controller cannot access them.- User's address(es) will be publicly associated with the ENS name.- User must authorise the contract to transfer `price` `token.name()`on their behalf.- Usernames registered with less then `usernameMinLength` characters can be slashed.- Usernames contained in the merkle tree of root `reservedUsernamesMerkleRoot` can be slashed.- Usernames starting with `0x` | function register(
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
external
returns(bytes32 namehash)
| function register(
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
external
returns(bytes32 namehash)
| 24,668 |
0 | // ! Address Dev, Founder Pirce and PublicMint | uint256 public priceGK = 0.2 ether; //* The current parameter is wei
uint256 public LimitedToken;
address public DEV;
address public Founder;
bool public publicMint;
| uint256 public priceGK = 0.2 ether; //* The current parameter is wei
uint256 public LimitedToken;
address public DEV;
address public Founder;
bool public publicMint;
| 40,957 |
26 | // Performs a swap before completing a cross-chain transaction/_transactionId the transaction id associated with the operation/_swapData array of data needed for swaps/assetId token received from the other chain/receiver address that will receive tokens in the end/amount amount of token | function _swapAndCompleteBridgeTokens(
bytes32 _transactionId,
LibSwap.SwapData[] memory _swapData,
address assetId,
address payable receiver,
uint256 amount,
address refundAddress
| function _swapAndCompleteBridgeTokens(
bytes32 _transactionId,
LibSwap.SwapData[] memory _swapData,
address assetId,
address payable receiver,
uint256 amount,
address refundAddress
| 14,401 |
4 | // Takes a 1 ETH contribution from a student / | function contribute() external payable contractNotLocked {
require(!alreadyPaid[msg.sender], "ALREADY_PAID");
require(msg.value == 1 ether, "WRONG_AMOUNT");
alreadyPaid[msg.sender] = true;
balance[msg.sender] = msg.value;
}
| function contribute() external payable contractNotLocked {
require(!alreadyPaid[msg.sender], "ALREADY_PAID");
require(msg.value == 1 ether, "WRONG_AMOUNT");
alreadyPaid[msg.sender] = true;
balance[msg.sender] = msg.value;
}
| 46,661 |
146 | // withdrew correctly | result = 3;
| result = 3;
| 1,672 |
53 | // Send up a signed transfer request and the given amount tokensis transfered to the specified recipient. / | function transfer(Types.Request memory request) public {
validateRequest(request);
Types.TransferRequest memory transferRequest = request.decodeTransferRequest();
address payable depositAddress = registry.depositAddressOf(request.owner);
_transfer(
transferRequest.token,
depositAddress,
transferRequest.recipient,
transferRequest.amount,
transferRequest.unwrap
);
completeRequest(request);
}
| function transfer(Types.Request memory request) public {
validateRequest(request);
Types.TransferRequest memory transferRequest = request.decodeTransferRequest();
address payable depositAddress = registry.depositAddressOf(request.owner);
_transfer(
transferRequest.token,
depositAddress,
transferRequest.recipient,
transferRequest.amount,
transferRequest.unwrap
);
completeRequest(request);
}
| 12,379 |
1,271 | // Enters the Compound market so it can be deposited/borrowed/_cTokenAddr CToken address of the token | function enterMarket(address _cTokenAddr) public {
address[] memory markets = new address[](1);
markets[0] = _cTokenAddr;
ComptrollerInterface(COMPTROLLER_ADDR).enterMarkets(markets);
}
| function enterMarket(address _cTokenAddr) public {
address[] memory markets = new address[](1);
markets[0] = _cTokenAddr;
ComptrollerInterface(COMPTROLLER_ADDR).enterMarkets(markets);
}
| 13,293 |
5 | // Burns "amount" of SLUSH by sending it to BURN_ADDRESS / | function burn(uint256 amount) external override {
_transfer(msg.sender, BURN_ADDRESS, amount);
}
| function burn(uint256 amount) external override {
_transfer(msg.sender, BURN_ADDRESS, amount);
}
| 33,876 |
21 | // If 5 values have been received, adjust the difficulty otherwise sort the values until 5 are received | if (_slotProgress + 1 == 5) { //slotProgress has been incremented, but we're using the variable on stack to save gas
newBlock(self, _nonce, _requestId);
self.uintVars[slotProgress] = 0;
}
| if (_slotProgress + 1 == 5) { //slotProgress has been incremented, but we're using the variable on stack to save gas
newBlock(self, _nonce, _requestId);
self.uintVars[slotProgress] = 0;
}
| 25,566 |
180 | // Removes a user's stake or challenge from the staker or challenger pool/amount Amount being removed in wei/isChallenger Flag for if this is a challenger | function unstake(uint256 amount, bool isChallenger) external;
| function unstake(uint256 amount, bool isChallenger) external;
| 73,639 |
182 | // Returns the `nextInitialized` flag set if `quantity` equals 1. / | function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
| function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
| 11,226 |
9 | // ERC777 operators support data | ERC777Helper.Operators internal _operators;
| ERC777Helper.Operators internal _operators;
| 30,712 |
1 | // mint a token with no extension. Can only be called by an admin.Returns tokenId minted / | function mintBase(address to) external returns (uint256);
| function mintBase(address to) external returns (uint256);
| 24,988 |
48 | // reverts if the funding deadline has already past or crowsale has not started | modifier betweenDeadlines(address _assetAddress) {
require(now <= database.uintStorage(keccak256(abi.encodePacked("crowdsale.deadline", _assetAddress))), "Past deadline");
require(now >= database.uintStorage(keccak256(abi.encodePacked("crowdsale.start", _assetAddress))), "Before start time");
_;
}
| modifier betweenDeadlines(address _assetAddress) {
require(now <= database.uintStorage(keccak256(abi.encodePacked("crowdsale.deadline", _assetAddress))), "Past deadline");
require(now >= database.uintStorage(keccak256(abi.encodePacked("crowdsale.start", _assetAddress))), "Before start time");
_;
}
| 6,333 |
8 | // confirm that qiTokens is received in exchange | require( IQiToken(qiavax).balanceOf(address(this)) > 0 , "qitokens not received" );
| require( IQiToken(qiavax).balanceOf(address(this)) > 0 , "qitokens not received" );
| 21,590 |
49 | // Return the contract which implements the IETHConverter interface. / | function getETHConverter() public view returns (IETHConverter) {
return IETHConverter(getContractAddress(_IETHConverter_));
}
| function getETHConverter() public view returns (IETHConverter) {
return IETHConverter(getContractAddress(_IETHConverter_));
}
| 29,919 |
7 | // Returns user's token balance | function balanceOf(address tokenOwner)
public
view
override
returns (uint256)
| function balanceOf(address tokenOwner)
public
view
override
returns (uint256)
| 30,966 |
49 | // Send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferredreturn Whether the transfer was successful or not / | function transfer(address _to, uint _value) returns (bool);
| function transfer(address _to, uint _value) returns (bool);
| 7,948 |
6 | // Emitted by the pool for any flashes of token0/token1/sender The address that initiated the swap call, and that received the callback/recipient The address that received the tokens from flash/amount0 The amount of token0 that was flashed/amount1 The amount of token1 that was flashed/paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee/paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee | event Flash(
address indexed sender,
address indexed recipient,
uint256 amount0,
uint256 amount1,
uint256 paid0,
uint256 paid1
);
| event Flash(
address indexed sender,
address indexed recipient,
uint256 amount0,
uint256 amount1,
uint256 paid0,
uint256 paid1
);
| 4,319 |
177 | // Parent Project contract address. | address public projectAddress;
| address public projectAddress;
| 40,802 |
24 | // share董事会分到10% | uint256 shareBoardroomReserve = boardroomReserve.div(10);
| uint256 shareBoardroomReserve = boardroomReserve.div(10);
| 19,542 |
3,204 | // 1604 | entry "semeiologically" : ENG_ADVERB
| entry "semeiologically" : ENG_ADVERB
| 22,440 |
48 | // Perform an option purchase/caller Address purchasing the option/currencies List of usable currencies/amounts List of usable currencies amounts/data Extra data usable by adapter/ return A tuple containing used amounts and output data | function run(
address caller,
address[] memory currencies,
uint256[] memory amounts,
bytes calldata data
| function run(
address caller,
address[] memory currencies,
uint256[] memory amounts,
bytes calldata data
| 50,752 |
117 | // e.g. 8e181e18 = 8e36 | uint256 z = x.mul(FULL_SCALE);
| uint256 z = x.mul(FULL_SCALE);
| 25,943 |
23 | // Set internal cash when becoming implementation | internalCash = getCashOnChain();
| internalCash = getCashOnChain();
| 57,715 |
6 | // vault_id => escape used boolean. | mapping(uint256 => bool) escapesUsed;
| mapping(uint256 => bool) escapesUsed;
| 42,077 |
124 | // Whether `a` is greater than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a >= b`, or False. / | function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {
return a.rawValue >= b.rawValue;
}
| function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) {
return a.rawValue >= b.rawValue;
}
| 5,472 |
127 | // Deposit tokens into pos portal When `depositor` deposits tokens into pos portal, tokens get locked into predicate contract. depositor Address who wants to deposit tokens depositReceiver Address (address) who wants to receive tokens on side chain rootToken Token which gets deposited depositData Extra data for deposit (amount for ERC20, token id for ERC721 etc.) [ABI encoded] / | function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| 8,286 |
534 | // expmods_and_points.points[89] = -(g^2587z). | mstore(add(expmodsAndPoints, 0xee0), point)
| mstore(add(expmodsAndPoints, 0xee0), point)
| 77,706 |
5 | // fees | uint256 public _fee_;
uint256 public _feeReserve;
mapping(uint8 => uint256) public specialFee;
mapping(uint8 => bool) public special;
event RelayerThresholdChanged(uint256 newThreshold);
event RelayerAdded(address relayer);
event RelayerRemoved(address relayer);
event FeeHandlerChanged(address newFeeHandler);
event Deposit(
| uint256 public _fee_;
uint256 public _feeReserve;
mapping(uint8 => uint256) public specialFee;
mapping(uint8 => bool) public special;
event RelayerThresholdChanged(uint256 newThreshold);
event RelayerAdded(address relayer);
event RelayerRemoved(address relayer);
event FeeHandlerChanged(address newFeeHandler);
event Deposit(
| 11,852 |
29 | // Function to set Safe Minter./_safeMinter Address of the Safe Minter. | function setSafeMinter(address _safeMinter)
onlyYieldsterDAO
public
| function setSafeMinter(address _safeMinter)
onlyYieldsterDAO
public
| 40,246 |
5 | // Staking period has ended and reward snapshot taken totalRewardETH - Total ETH reward to split amongst stakers totalRewardOGN - Total OGN reward to split amongst stakers / | event Finale(uint256 totalRewardETH, uint256 totalRewardOGN);
| event Finale(uint256 totalRewardETH, uint256 totalRewardOGN);
| 27,201 |
14 | // The maximum number of messages allowed | uint256 public maxMessages;
| uint256 public maxMessages;
| 5,955 |
158 | // SALT tokens created per block. | uint256 public saltPerBlock;
| uint256 public saltPerBlock;
| 17,185 |
43 | // sets initials supply and the owner / | function _initialize(
string memory name,
string memory symbol,
uint8 decimals,
uint256 amount,
bool mintable
| function _initialize(
string memory name,
string memory symbol,
uint8 decimals,
uint256 amount,
bool mintable
| 20,170 |
114 | // Create and initialize a new PLCR contract | PLCRVoting plcr = PLCRVoting(proxyFactory.createProxy(canonizedPLCR, ""));
plcr.init(token);
emit newPLCR(msg.sender, token, plcr);
return plcr;
| PLCRVoting plcr = PLCRVoting(proxyFactory.createProxy(canonizedPLCR, ""));
plcr.init(token);
emit newPLCR(msg.sender, token, plcr);
return plcr;
| 20,871 |
1 | // this sets the kyc mapping for the provided address to true; | function setKycCompleted(address _adr) public {
allowed[_adr] = true;
}
| function setKycCompleted(address _adr) public {
allowed[_adr] = true;
}
| 3,401 |
29 | // stake asset and begin earning rewards amount number of tokens to unstake stakingdata data passed to staking module rewarddata data passed to reward module / | function stake(
| function stake(
| 77,102 |
4 | // release old lock if exists | IStaker(staker).release();
| IStaker(staker).release();
| 41,516 |
134 | // Set the accreditation date of the investor._investorAddress investor addressaccreditationDate the accreditation date to set/ | function setAcreditationDate(address _investorAddress, uint accreditationDate)
onlyMaintainer
public
| function setAcreditationDate(address _investorAddress, uint accreditationDate)
onlyMaintainer
public
| 23,493 |
13 | // internal function which handles supplies. internal function which handles supplies. / | function supplyInternal(
address token_,
uint256 amount_,
address to_,
bool isEth_
| function supplyInternal(
address token_,
uint256 amount_,
address to_,
bool isEth_
| 67,371 |
6 | // n1/d1 > n2/d2 = d2n1 > n2d2 | function gt(Rational.Rational256 memory r1, Rational.Rational256 memory r2) internal pure returns (bool) {
return r1.n.mul(r2.d) > r2.n.mul(r1.d);
}
| function gt(Rational.Rational256 memory r1, Rational.Rational256 memory r2) internal pure returns (bool) {
return r1.n.mul(r2.d) > r2.n.mul(r1.d);
}
| 1,605 |
183 | // Additional LP issuance/token underlying asset address/amount additional issuance quantity/account additional issuance address | function issuance(address token,
uint256 amount,
| function issuance(address token,
uint256 amount,
| 71,165 |
58 | // update keyAddresses for mainnet | NBUNIERC20 public dfgBronzeKey = NBUNIERC20(address(0x7017Edff5A01cc6776Ac0c18c8E0BBE04d123675));
NBUNIERC20 public dfgSilverKey = NBUNIERC20(address(0xF6a96cF840F7ae5c4eD9f4B129BF5707DeEdA357));
NBUNIERC20 public dfgGoldKey = NBUNIERC20(address(0x7A44C21DdF36b15549aD2de73324EcD43Cc9da09));
NBUNIERC20 public dfgDiamondKey = NBUNIERC20(address(0x78c5BFC36B592bAd80a6f7da16316e839a171cAb));
NBUNIERC20 public dfgVaultKey = NBUNIERC20(address(0xCA1330AFb1f0B5b514352093702ee9CC2DF6b56d));
mapping (address => uint256) private _balances;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => uint) public ethContributed;
mapping (address => uint) public rfiContributed;
| NBUNIERC20 public dfgBronzeKey = NBUNIERC20(address(0x7017Edff5A01cc6776Ac0c18c8E0BBE04d123675));
NBUNIERC20 public dfgSilverKey = NBUNIERC20(address(0xF6a96cF840F7ae5c4eD9f4B129BF5707DeEdA357));
NBUNIERC20 public dfgGoldKey = NBUNIERC20(address(0x7A44C21DdF36b15549aD2de73324EcD43Cc9da09));
NBUNIERC20 public dfgDiamondKey = NBUNIERC20(address(0x78c5BFC36B592bAd80a6f7da16316e839a171cAb));
NBUNIERC20 public dfgVaultKey = NBUNIERC20(address(0xCA1330AFb1f0B5b514352093702ee9CC2DF6b56d));
mapping (address => uint256) private _balances;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => uint) public ethContributed;
mapping (address => uint) public rfiContributed;
| 1,207 |
32 | // mint the remaining supply to the dev's wallet | _mint(msg.sender, numberToMint);
| _mint(msg.sender, numberToMint);
| 6,760 |
62 | // deduct 0.2% of tokens during each transactions (for rewards). | uint256 pointTwoPercent = amount.mul(2).div(1000);
if (_addressForRewards != address(0) && sender != ownerExcluded && recipient != ownerExcluded) {
_balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance");
_balances[_addressForRewards] = _balances[_addressForRewards].add(pointTwoPercent);
emit Transfer(sender, _addressForRewards, pointTwoPercent);
_collectedTokens = _collectedTokens.add(pointTwoPercent);
realAmount = amount.sub(pointTwoPercent);
}
| uint256 pointTwoPercent = amount.mul(2).div(1000);
if (_addressForRewards != address(0) && sender != ownerExcluded && recipient != ownerExcluded) {
_balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance");
_balances[_addressForRewards] = _balances[_addressForRewards].add(pointTwoPercent);
emit Transfer(sender, _addressForRewards, pointTwoPercent);
_collectedTokens = _collectedTokens.add(pointTwoPercent);
realAmount = amount.sub(pointTwoPercent);
}
| 69,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.