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 |
|---|---|---|---|---|
45 | // Emits a {Transfer} event. | function transfer(address to, uint256 amount) public virtual returns (bool) {
_beforeTokenTransfer(msg.sender, to, amount);
| function transfer(address to, uint256 amount) public virtual returns (bool) {
_beforeTokenTransfer(msg.sender, to, amount);
| 1,172 |
90 | // Address of the admin of all instruments / | address public instrumentAdmin;
| address public instrumentAdmin;
| 58,599 |
319 | // Calculate Price limit depending on price impact | uint160 exactSqrtPriceImpact = sqrtPriceX96.mul160(IOptimizerStrategy(strategy).priceImpactPercentage() / 2) / GLOBAL_DIVISIONER;
uint160 sqrtPriceLimitX96 = zeroForOne ? sqrtPriceX96.sub160(exactSqrtPriceImpact) : sqrtPriceX96.add160(exactSqrtPriceImpact);
| uint160 exactSqrtPriceImpact = sqrtPriceX96.mul160(IOptimizerStrategy(strategy).priceImpactPercentage() / 2) / GLOBAL_DIVISIONER;
uint160 sqrtPriceLimitX96 = zeroForOne ? sqrtPriceX96.sub160(exactSqrtPriceImpact) : sqrtPriceX96.add160(exactSqrtPriceImpact);
| 1,432 |
308 | // Retrieves the Set's natural unit, components, and units._setAddress of the Setreturn SetDetails Struct containing the natural unit, components, and units / | function getSetDetails(
| function getSetDetails(
| 44,256 |
7 | // constructor for the logic(!) contract | constructor(IWormhole wormhole, bytes32 emitterAddress, bytes memory baseUri) {
if (baseUri.length == 0) {
revert BaseUriEmpty();
}
| constructor(IWormhole wormhole, bytes32 emitterAddress, bytes memory baseUri) {
if (baseUri.length == 0) {
revert BaseUriEmpty();
}
| 17,400 |
4 | // Allow owner to set pool address to avoid unnecessary upgrades/Underlying Adapter handles permissions if msg.sender is allowed to call/_pool_address address of the pool/ return address of new pool | function setPoolAddress(address _pool_address)
external
nonReentrant
returns (address)
| function setPoolAddress(address _pool_address)
external
nonReentrant
returns (address)
| 11,559 |
53 | // Set goose prize percentage. / | function setGoosePrizePercentage(uint256 _percentage) external onlyOwner {
goosePrizePercentage = _percentage;
}
| function setGoosePrizePercentage(uint256 _percentage) external onlyOwner {
goosePrizePercentage = _percentage;
}
| 23,725 |
33 | // NOTE: must exclude any tokens used in the yield Controller role - withdraw should return to Controller | function withdraw(address) external;
| function withdraw(address) external;
| 24,155 |
0 | // Info of each pool. | struct PoolInfo {
address stakeToken; // Address of Staking token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. ALPACAs to distribute per block.
uint256 lastRewardBlock; // Last block number that ALPACAs distribution occurs.
uint256 accAlpacaPerShare; // Accumulated ALPACAs per share, times 1e12. See below.
uint256 accAlpacaPerShareTilBonusEnd; // Accumated ALPACAs per share until Bonus End.
}
| struct PoolInfo {
address stakeToken; // Address of Staking token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. ALPACAs to distribute per block.
uint256 lastRewardBlock; // Last block number that ALPACAs distribution occurs.
uint256 accAlpacaPerShare; // Accumulated ALPACAs per share, times 1e12. See below.
uint256 accAlpacaPerShareTilBonusEnd; // Accumated ALPACAs per share until Bonus End.
}
| 10,152 |
14 | // Optionality to set strike price manually strikePrice is the strike price of the new oTokens (decimals = 8) / | function setStrikePrice(uint128 strikePrice)
external
onlyOwner
nonReentrant
| function setStrikePrice(uint128 strikePrice)
external
onlyOwner
nonReentrant
| 20,917 |
17 | // No collateralFactorMantissa may exceed this value | uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9
| uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9
| 8,552 |
32 | // Changes The Current Operator Address (Address That Holds NFTs To Disperse) / | function ___ChangeOperator(address Operator) external onlyAdmin { AuctionParams._Operator = Operator; }
| function ___ChangeOperator(address Operator) external onlyAdmin { AuctionParams._Operator = Operator; }
| 16,475 |
20 | // Finally, transfer NFToken from this contract address to the nominated address | nfToken.safeTransferFrom(address(this), payTo, tokenId);
emit Burn(tokenId, payTo, na);
| nfToken.safeTransferFrom(address(this), payTo, tokenId);
emit Burn(tokenId, payTo, na);
| 3,941 |
108 | // Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in | * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
| * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
| 8,758 |
782 | // Get the recipient address | function getRecipientAddress() external view returns (bytes32) {
_requireIsInitialized();
return recipient;
}
| function getRecipientAddress() external view returns (bytes32) {
_requireIsInitialized();
return recipient;
}
| 41,564 |
24 | // Allows the current owner to relinquish control of the contract. / | function renounceOwnership() public onlyOwner {
owner = address(0);
emit OwnershipRenounced(owner);
}
| function renounceOwnership() public onlyOwner {
owner = address(0);
emit OwnershipRenounced(owner);
}
| 5,162 |
18 | // Points - Override to force update user discount on every transfer Note: minting/burning does not constitute as a transfer, so we must have the update function | function _transfer(address sender, address recipient, uint256 amount) internal override {
ERC20._transfer(sender, recipient, amount);
// force update discount if not governance
if (IDeFiatGov(governance).viewActorLevelOf(sender) == 0) {
uint256 tranche = viewEligibilityOf(sender);
_discounts[sender] = tranche * 10;
}
}
| function _transfer(address sender, address recipient, uint256 amount) internal override {
ERC20._transfer(sender, recipient, amount);
// force update discount if not governance
if (IDeFiatGov(governance).viewActorLevelOf(sender) == 0) {
uint256 tranche = viewEligibilityOf(sender);
_discounts[sender] = tranche * 10;
}
}
| 12,272 |
99 | // Sets transactions on time periods or cooldowns. Buzz Buzz Bots. Can only be set by owner set in seconds./ | function setTransactionCooldownTime(uint256 transactiontime) external onlyOwner {
_transactionCoolTime = transactiontime;
}
| function setTransactionCooldownTime(uint256 transactiontime) external onlyOwner {
_transactionCoolTime = transactiontime;
}
| 27,460 |
30 | // Last Compound redeem execution Id (it is an incremental number). / | uint256 public executionId;
| uint256 public executionId;
| 17,884 |
2,430 | // 1216 | entry "gorked" : ENG_ADJECTIVE
| entry "gorked" : ENG_ADJECTIVE
| 17,828 |
57 | // return percentages for ETH and token1000 = 1% | uint internal period1RPWeth;
uint internal period2RPWeth;
uint internal period3RPWeth;
uint internal period4RPWeth;
uint internal period1RPToken;
uint internal period2RPToken;
uint internal period3RPToken;
uint internal period4RPToken;
| uint internal period1RPWeth;
uint internal period2RPWeth;
uint internal period3RPWeth;
uint internal period4RPWeth;
uint internal period1RPToken;
uint internal period2RPToken;
uint internal period3RPToken;
uint internal period4RPToken;
| 22,268 |
33 | // redeem all shares | IMasterChefV2(manager.masterChefAddress()).withdraw(
msg.sender,
sharesToRemove,
_id
);
| IMasterChefV2(manager.masterChefAddress()).withdraw(
msg.sender,
sharesToRemove,
_id
);
| 49,893 |
169 | // Updates the address to which platform fees are paid out/_platform - the new platform wallet address | function setPlatform(address _platform)
external
onlyOwner
notToZeroAddress(_platform)
| function setPlatform(address _platform)
external
onlyOwner
notToZeroAddress(_platform)
| 10,387 |
57 | // Ensures team vesting stage doesn't go past teamVestingStages | if(stage > teamVestingStages){
stage = teamVestingStages;
}
| if(stage > teamVestingStages){
stage = teamVestingStages;
}
| 28,318 |
5 | // The initial Venus index for a market | uint224 public constant venusInitialIndex = 1e36;
| uint224 public constant venusInitialIndex = 1e36;
| 31,230 |
1 | // @inheritdoc ISiloFactory | function initRepository(address _repository) external {
// We don't perform a ping to the repository because this is meant to be called in its constructor
if (siloRepository != address(0)) revert RepositoryAlreadySet();
siloRepository = _repository;
emit InitSiloRepository();
}
| function initRepository(address _repository) external {
// We don't perform a ping to the repository because this is meant to be called in its constructor
if (siloRepository != address(0)) revert RepositoryAlreadySet();
siloRepository = _repository;
emit InitSiloRepository();
}
| 34,326 |
29 | // NOTE: theoretically possible overflow of (_offset + 32) | function readBytes32(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, bytes32 r) {
new_offset = _offset + 32;
r = bytesToBytes32(_data, _offset);
}
| function readBytes32(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, bytes32 r) {
new_offset = _offset + 32;
r = bytesToBytes32(_data, _offset);
}
| 15,313 |
16 | // Mapping of module => integration identifier => adapter address | mapping(address => mapping(bytes32 => address)) private integrations;
| mapping(address => mapping(bytes32 => address)) private integrations;
| 40,401 |
9 | // Map whether a mythic exists or not | mapping(uint16 => bool) public mythicCreated;
uint16 public constant MYTHIC_THRESHOLD = 65000;
constructor(
uint256 _batchSize,
string memory _name,
string memory _symbol
)
public
| mapping(uint16 => bool) public mythicCreated;
uint16 public constant MYTHIC_THRESHOLD = 65000;
constructor(
uint256 _batchSize,
string memory _name,
string memory _symbol
)
public
| 45,249 |
66 | // Signature of the mmLib's constructor function bytes4 sig = bytes4(keccak256("constructor(address,address,address)")); | bytes4 sig = 0x6dd23b5b;
| bytes4 sig = 0x6dd23b5b;
| 32,928 |
11 | // Send _value amount of tokens to address _to |
function transfer(address _to, uint256 _value) returns(bool success);
|
function transfer(address _to, uint256 _value) returns(bool success);
| 43,350 |
0 | // ethereum | return 101;
| return 101;
| 39,213 |
58 | // See {recover}. / | function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
| function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
| 50,895 |
148 | // How many wei can the msg.sender contribute now. | function howMuchCanIContributeNow() view public returns (uint256) {
return howMuchCanXContributeNow(msg.sender);
}
| function howMuchCanIContributeNow() view public returns (uint256) {
return howMuchCanXContributeNow(msg.sender);
}
| 6,973 |
7 | // Maximum supply which we are using | uint16 constant MAX_SUPPLY = 999;
| uint16 constant MAX_SUPPLY = 999;
| 27,728 |
0 | // 100% in parts per million | uint32 private constant MAX_PPM = 1000000;
| uint32 private constant MAX_PPM = 1000000;
| 22,778 |
3 | // return reId as confirmation | return reId;
| return reId;
| 1,304 |
133 | // Reveal a previously committed vote for `identifier` at `time`. The revealed `price`, `salt`, `address`, `time`, `roundId`, and `identifier`, must hash to the latest `hash`that `commitVote()` was called with. Only the committer can reveal their vote. identifier voted on in the commit phase. EG BTC/USD price pair. time specifies the unix timestamp of the price is being voted on. price voted on during the commit phase. salt value used to hide the commitment price during the commit phase. / | function revealVote(
| function revealVote(
| 21,263 |
18 | // withdraw all free liquidity and reassign set of short position to new underwriter isCallPool true for call, false for put tokenIds array of ERC1155 token ids (long or short) contractSizes array of quantities of option contract tokens to reassignreturn baseCosts quantities of tokens required to reassign each short positionreturn feeCosts quantities of tokens required to pay feesreturn amountOutCall quantity of call pool liquidity freed and transferred to ownerreturn amountOutPut quantity of put pool liquidity freed and transferred to owner / | function withdrawAllAndReassignBatch(
bool isCallPool,
uint256[] calldata tokenIds,
uint256[] calldata contractSizes
)
external
override
returns (
uint256[] memory baseCosts,
uint256[] memory feeCosts,
| function withdrawAllAndReassignBatch(
bool isCallPool,
uint256[] calldata tokenIds,
uint256[] calldata contractSizes
)
external
override
returns (
uint256[] memory baseCosts,
uint256[] memory feeCosts,
| 48,280 |
31 | // the primary modifier value will hold our attack bonus | (tmpSeed, tmpModulus) = tmpQuerySeed(tmpSeed, modifierAttBonusSum);
primaryModifierVal = cardBonusMinimum + cumulativeIndexOf(modifierAttBonusChances, tmpModulus);
| (tmpSeed, tmpModulus) = tmpQuerySeed(tmpSeed, modifierAttBonusSum);
primaryModifierVal = cardBonusMinimum + cumulativeIndexOf(modifierAttBonusChances, tmpModulus);
| 48,468 |
47 | // Set current preICO price in wei for one token/priceForPreIcoInWei - is the amount in wei for one token | function setPreICOPrice(uint256 priceForPreIcoInWei) isOwner {
require(priceForPreIcoInWei > 0);
require(preICOprice != priceForPreIcoInWei);
preICOprice = priceForPreIcoInWei;
updatePrices();
}
| function setPreICOPrice(uint256 priceForPreIcoInWei) isOwner {
require(priceForPreIcoInWei > 0);
require(preICOprice != priceForPreIcoInWei);
preICOprice = priceForPreIcoInWei;
updatePrices();
}
| 29,139 |
75 | // calculate deposit value in USD Cents | function calculateUSDcValue(uint256 _weiDeposit) public view returns (uint256) {
// wei per USD cent
uint256 weiPerUSDc = 1 ether/rateUSDcETH;
// Deposited value converted to USD cents
uint256 depositValueInUSDc = _weiDeposit.div(weiPerUSDc);
return depositValueInUSDc;
}
| function calculateUSDcValue(uint256 _weiDeposit) public view returns (uint256) {
// wei per USD cent
uint256 weiPerUSDc = 1 ether/rateUSDcETH;
// Deposited value converted to USD cents
uint256 depositValueInUSDc = _weiDeposit.div(weiPerUSDc);
return depositValueInUSDc;
}
| 8,251 |
0 | // emitted upon the withdrawal of a Shop's balance / | event ShopBalanceWithdrawn(uint256 shopId, uint256 amount);
| event ShopBalanceWithdrawn(uint256 shopId, uint256 amount);
| 37,491 |
6 | // Read only | function Query_user_exists(bytes32 username) public view returns (bool) {
return user_set[username];
}
| function Query_user_exists(bytes32 username) public view returns (bool) {
return user_set[username];
}
| 27,834 |
261 | // burn idleTokens | _burn(msg.sender, _amount);
| _burn(msg.sender, _amount);
| 35,231 |
14 | // The ConfirmedOwner contract A contract with helpers for basic contract ownership. / | contract ConfirmedOwnerWithProposal is OwnableInterface {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
address indexed to
);
constructor(
address newOwner,
address pendingOwner
) {
require(newOwner != address(0), "Cannot set owner to zero");
s_owner = newOwner;
if (pendingOwner != address(0)) {
_transferOwnership(pendingOwner);
}
}
/**
* @notice Allows an owner to begin transferring ownership to a new address,
* pending.
*/
function transferOwnership(
address to
)
public
override
onlyOwner()
{
_transferOwnership(to);
}
/**
* @notice Allows an ownership transfer to be completed by the recipient.
*/
function acceptOwnership()
external
override
{
require(msg.sender == s_pendingOwner, "Must be proposed owner");
address oldOwner = s_owner;
s_owner = msg.sender;
s_pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/**
* @notice Get the current owner
*/
function owner()
public
view
override
returns (
address
)
{
return s_owner;
}
/**
* @notice validate, transfer ownership, and emit relevant events
*/
function _transferOwnership(
address to
)
private
{
require(to != msg.sender, "Cannot transfer to self");
s_pendingOwner = to;
emit OwnershipTransferRequested(s_owner, to);
}
/**
* @notice validate access
*/
function _validateOwnership()
internal
view
{
require(msg.sender == s_owner, "Only callable by owner");
}
/**
* @notice Reverts if called by anyone other than the contract owner.
*/
modifier onlyOwner() {
_validateOwnership();
_;
}
}
| contract ConfirmedOwnerWithProposal is OwnableInterface {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
address indexed to
);
constructor(
address newOwner,
address pendingOwner
) {
require(newOwner != address(0), "Cannot set owner to zero");
s_owner = newOwner;
if (pendingOwner != address(0)) {
_transferOwnership(pendingOwner);
}
}
/**
* @notice Allows an owner to begin transferring ownership to a new address,
* pending.
*/
function transferOwnership(
address to
)
public
override
onlyOwner()
{
_transferOwnership(to);
}
/**
* @notice Allows an ownership transfer to be completed by the recipient.
*/
function acceptOwnership()
external
override
{
require(msg.sender == s_pendingOwner, "Must be proposed owner");
address oldOwner = s_owner;
s_owner = msg.sender;
s_pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/**
* @notice Get the current owner
*/
function owner()
public
view
override
returns (
address
)
{
return s_owner;
}
/**
* @notice validate, transfer ownership, and emit relevant events
*/
function _transferOwnership(
address to
)
private
{
require(to != msg.sender, "Cannot transfer to self");
s_pendingOwner = to;
emit OwnershipTransferRequested(s_owner, to);
}
/**
* @notice validate access
*/
function _validateOwnership()
internal
view
{
require(msg.sender == s_owner, "Only callable by owner");
}
/**
* @notice Reverts if called by anyone other than the contract owner.
*/
modifier onlyOwner() {
_validateOwnership();
_;
}
}
| 31,470 |
229 | // Transfers `tokenId` from `from` to `to`. | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_holderTokens[from].remove(tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(from, to, tokenId);
}
| * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_holderTokens[from].remove(tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(from, to, tokenId);
}
| 11,192 |
59 | // address where funds are collected | address public wallet;
| address public wallet;
| 5,737 |
2 | // Addresses | address _ownerAddress; //
address _authorityAddress; //
| address _ownerAddress; //
address _authorityAddress; //
| 31,041 |
22 | // 保证是注册用户 | modifier onlyUser(address account){
require(AuthService.isAuthUser(account)==true, "CarbonFrugalEvidence onlyUser:必须是注册用户,才可以进行碳节能存证!");
_;
}
| modifier onlyUser(address account){
require(AuthService.isAuthUser(account)==true, "CarbonFrugalEvidence onlyUser:必须是注册用户,才可以进行碳节能存证!");
_;
}
| 34,038 |
21 | // Mapping from token ID to owner address | mapping(uint256 => address) private _owners;
| mapping(uint256 => address) private _owners;
| 2 |
58 | // Retrieve the coin balance of any single address. / | function balanceOf(address _customerAddress)
view
public
returns(uint256)
| function balanceOf(address _customerAddress)
view
public
returns(uint256)
| 10,912 |
160 | // So "_stackidx <= _maxidx <= initial stakesCounters[msg.sender]" ===> "_stakidx <= stakesCounters[msg.sender] + _nbdeletes" ===> "_stackidx - _nbdeletes <= stakesCounters[msg.sender]" | assert(_currentidx >= 1); // makes sure _currentidx is within existing stakes range
| assert(_currentidx >= 1); // makes sure _currentidx is within existing stakes range
| 33,533 |
5 | // Function to add a new giveaway./merkleRoot The merkle root hash of the claim data./expiryTime The expiry time for the giveaway. | function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime) external onlyAdmin {
_expiryTime[merkleRoot] = expiryTime;
emit NewGiveaway(merkleRoot, expiryTime);
}
| function addNewGiveaway(bytes32 merkleRoot, uint256 expiryTime) external onlyAdmin {
_expiryTime[merkleRoot] = expiryTime;
emit NewGiveaway(merkleRoot, expiryTime);
}
| 18,805 |
6 | // Returns DeBot ABI./ Deprecated. | function getDebotOptions() public view returns (uint8 options, string debotAbi, string targetAbi, address targetAddr) {
debotAbi = m_debotAbi.hasValue() ? m_debotAbi.get() : "";
targetAbi = m_targetAbi.hasValue() ? m_targetAbi.get() : "";
targetAddr = m_target.hasValue() ? m_target.get() : address(0);
options = m_options;
}
| function getDebotOptions() public view returns (uint8 options, string debotAbi, string targetAbi, address targetAddr) {
debotAbi = m_debotAbi.hasValue() ? m_debotAbi.get() : "";
targetAbi = m_targetAbi.hasValue() ? m_targetAbi.get() : "";
targetAddr = m_target.hasValue() ? m_target.get() : address(0);
options = m_options;
}
| 46,739 |
34 | // Get the Guild balance of a specified token/_tokenAddress asset address/ return current guild balanceOf `_tokenAddres` | function guildBalance(address _tokenAddress) public view override returns (uint256) {
if (_approvedTokens[address(this)].contains(_tokenAddress)) {
if (tokenAddress != address(0)) {
return IERC20Upgradeable(tokenAddress).balanceOf(address(this));
}
return address(this).balance;
}
return 0;
}
| function guildBalance(address _tokenAddress) public view override returns (uint256) {
if (_approvedTokens[address(this)].contains(_tokenAddress)) {
if (tokenAddress != address(0)) {
return IERC20Upgradeable(tokenAddress).balanceOf(address(this));
}
return address(this).balance;
}
return 0;
}
| 25,317 |
114 | // Get the total number of ticket sets an account holds for a given round | function getTotalTicketSetsForRound(address accountAddress, uint256 roundId)
public
view
returns(uint256 ticketSets)
| function getTotalTicketSetsForRound(address accountAddress, uint256 roundId)
public
view
returns(uint256 ticketSets)
| 44,720 |
0 | // General Init. (item is reffering to NFT)_itemsIds counter of the item ID's, inherit from Counters _itemsSold counter of the amount of items sold, inherit from Counters owner address representing the owner of the item listingPrice integer representing the listing price of the item idToMarketItem struct of key and value pairs holding all the items (ex. idToMarketItem[1111]) / | using Counters for Counters.Counter;
Counters.Counter private _itemIds;
Counters.Counter private _itemsSold;
address payable owner;
uint256 listingPrice = 0.025 ether;
| using Counters for Counters.Counter;
Counters.Counter private _itemIds;
Counters.Counter private _itemsSold;
address payable owner;
uint256 listingPrice = 0.025 ether;
| 37,680 |
168 | // create the stream for First Deposit Bonus | if (_pid == votingPoolId) {
if (hasVotingStream == false) {
xdex.mint(address(this), bonusFirstDeposit);
xdex.approve(address(stream), bonusFirstDeposit);
stream.createStream(
msg.sender,
bonusFirstDeposit,
StreamTypeVoting,
streamStart
);
| if (_pid == votingPoolId) {
if (hasVotingStream == false) {
xdex.mint(address(this), bonusFirstDeposit);
xdex.approve(address(stream), bonusFirstDeposit);
stream.createStream(
msg.sender,
bonusFirstDeposit,
StreamTypeVoting,
streamStart
);
| 1,667 |
60 | // The amount of decimals lost on each multiplication operand. Test mulPrecision() equals sqrt(fixed1)Hardcoded to 24 digits. / | function mulPrecision() public pure returns(int256) {
return 1000000000000;
}
| function mulPrecision() public pure returns(int256) {
return 1000000000000;
}
| 53,114 |
365 | // Gets the multiplier awarded for a given weightedTimestamp _ts WeightedTimestamp of a userreturn timeMultiplier Ranging from 20 (0.2x) to 60 (0.6x) / | function _timeMultiplier(uint32 _ts) internal view returns (uint8 timeMultiplier) {
// If the user has no ts yet, they are not in the system
if (_ts == 0) return 0;
uint256 hodlLength = block.timestamp - _ts;
if (hodlLength < 13 weeks) {
// 0-3 months = 1x
return 0;
} else if (hodlLength < 26 weeks) {
// 3 months = 1.2x
return 20;
} else if (hodlLength < 52 weeks) {
// 6 months = 1.3x
return 30;
} else if (hodlLength < 78 weeks) {
// 12 months = 1.4x
return 40;
} else if (hodlLength < 104 weeks) {
// 18 months = 1.5x
return 50;
} else {
// > 24 months = 1.6x
return 60;
}
}
| function _timeMultiplier(uint32 _ts) internal view returns (uint8 timeMultiplier) {
// If the user has no ts yet, they are not in the system
if (_ts == 0) return 0;
uint256 hodlLength = block.timestamp - _ts;
if (hodlLength < 13 weeks) {
// 0-3 months = 1x
return 0;
} else if (hodlLength < 26 weeks) {
// 3 months = 1.2x
return 20;
} else if (hodlLength < 52 weeks) {
// 6 months = 1.3x
return 30;
} else if (hodlLength < 78 weeks) {
// 12 months = 1.4x
return 40;
} else if (hodlLength < 104 weeks) {
// 18 months = 1.5x
return 50;
} else {
// > 24 months = 1.6x
return 60;
}
}
| 58,016 |
294 | // Tell whether an action can be disputed_actionId Identification number of the action return True if the action can be disputed, false otherwise/ | function canDispute(uint256 _actionId) external view returns (bool) {
(, Challenge storage challenge, ) = _getChallengedAction(_actionId);
return _canDispute(challenge);
}
| function canDispute(uint256 _actionId) external view returns (bool) {
(, Challenge storage challenge, ) = _getChallengedAction(_actionId);
return _canDispute(challenge);
}
| 19,846 |
40 | // set defaults for fallback | uint256 amountRemaining = amount;
uint256 taxes = 0;
uint256 buyBack = 0;
| uint256 amountRemaining = amount;
uint256 taxes = 0;
uint256 buyBack = 0;
| 6,505 |
451 | // The rounding direction is irrelevant as we're about to introduce a much larger error when converting to log space. We use `divUp` as it prevents the result from being zero, which would make the logarithm revert. A result of zero is therefore only possible with zero balances, which are prevented via other means. | uint256 spotPrice = balanceA.divUp(normalizedWeightA).divUp(balanceB.divUp(normalizedWeightB));
return _toLowResLog(spotPrice);
| uint256 spotPrice = balanceA.divUp(normalizedWeightA).divUp(balanceB.divUp(normalizedWeightB));
return _toLowResLog(spotPrice);
| 5,056 |
3 | // Counter contracts are deployed at predefined addresses which can be hardcoded. | contract FixedAddress {
address constant ProxyAddress = 0x1234567896326230a28ee368825D11fE6571Be4a;
address constant TreasuryAddress = 0x12345678979f29eBc99E00bdc5693ddEa564cA80;
address constant RegistryAddress = 0x12345678982cB986Dd291B50239295E3Cb10Cdf6;
function getRegistry() internal pure returns (RegistryInterface) {
return RegistryInterface(RegistryAddress);
}
}
| contract FixedAddress {
address constant ProxyAddress = 0x1234567896326230a28ee368825D11fE6571Be4a;
address constant TreasuryAddress = 0x12345678979f29eBc99E00bdc5693ddEa564cA80;
address constant RegistryAddress = 0x12345678982cB986Dd291B50239295E3Cb10Cdf6;
function getRegistry() internal pure returns (RegistryInterface) {
return RegistryInterface(RegistryAddress);
}
}
| 36,283 |
7 | // Emitted when arbitrator rejects a `disputeID` for `indexer` created by `fisherman`.The event emits the amount `tokens` burned from the fisherman deposit. / | event DisputeRejected(
| event DisputeRejected(
| 42,726 |
2 | // Constructooor | constructor(
address newOwner
)
| constructor(
address newOwner
)
| 2,871 |
2 | // ecrecover returns zero on error | require(signature_address != address(0x0), "ECVerify revert");
return signature_address;
| require(signature_address != address(0x0), "ECVerify revert");
return signature_address;
| 10,601 |
37 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],but performing a delegate call. _Available since v3.4._ / | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| 39 |
13 | // ERC223 ERC223 contract interface with ERC20 functions and events Fully backward compatible with ERC20 / | contract ERC223 {
uint public totalSupply;
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
// ERC223 functions and events
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
| contract ERC223 {
uint public totalSupply;
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
// ERC223 functions and events
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
| 8,272 |
5 | // required for weth.withdraw() to work properly | require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
| require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
| 68,295 |
15 | // Registers a new earning strategy on this contract. An earning strategy must be deployed before the calling of this method. Can only be called by the current owner. strategy An address of a new earning strategy that should be added. timelock A number of seconds during which users can't withdrawtheir deposits after last deposit. Applies only forearning strategy that is adding. Can be updated later. cap A cap for the amount of deposited LP tokens. rewardPerBlock A reward amount that will be distributed betweenall users in a strategy every block. Can be updatedlater. initialFee A fees that will be applied | function addStrategy(
| function addStrategy(
| 36,059 |
59 | // An internal method that creates a new Pony and stores it. This/method doesn't do any checking and should only be called when the/input data is known to be valid. Will generate both a Birth event/and a Transfer event./_matronId The Pony ID of the matron of this pony (zero for gen0)/_sireId The Pony ID of the sire of this pony (zero for gen0)/_generation The generation number of this pony, must be computed by caller./_genes The Pony's genetic code./_owner The inital owner of this pony, must be non-zero (except for the unPony, ID 0) | function _createPony(
uint256 _matronId,
uint256 _sireId,
uint256 _generation,
uint256 _genes,
address _owner
)
internal
returns (uint)
| function _createPony(
uint256 _matronId,
uint256 _sireId,
uint256 _generation,
uint256 _genes,
address _owner
)
internal
returns (uint)
| 12,787 |
144 | // Creates a bidirectional link between two nodes on direction `_direction`/self stored linked list from contract/_node first node for linking/_linknode to link to in the _direction | function createLink(LinkedList storage self, uint256 _node, uint256 _link, bool _direction) internal {
self.list[_link][!_direction] = _node;
self.list[_node][_direction] = _link;
}
| function createLink(LinkedList storage self, uint256 _node, uint256 _link, bool _direction) internal {
self.list[_link][!_direction] = _node;
self.list[_node][_direction] = _link;
}
| 13,407 |
0 | // 使用 SafeMath | using SafeMath for uint256;
| using SafeMath for uint256;
| 34,342 |
16 | // Version name of the current implementation | uint256 internal _version;
| uint256 internal _version;
| 40,769 |
68 | // Initialize the deployed contract after creation This is a one time call which sets _deployer to msg.sender.Subsequent calls reverts. / | function initialize() external;
| function initialize() external;
| 21,773 |
12 | // Linear daily vesting.This contract holds ERC20 tokens and releases them to its beneficiaryaccording to a linear cliff vesting scheme proportional to the number of dayssince vestingStart. If cliffDays is greater than 0, no token will bereleased until vestingStart + cliffDays days.This vesting contract is optionally revocable by a revoker, which makesany non-released vested token to be sent to the beneficiary, and anynon-vested token to the revokedTokensDestination.This contract manages every token sent to it before its revokation.Tokens sent after revoking the contract will be lost.When or in how many transactions are the tokens sent to this contractdoesn't change the way it | contract LinearDailyVesting {
using SafeMath for uint256;
ERC20 public token;
uint256 public relasedTokens;
address public beneficiary;
uint256 public vestingStart;
uint256 public vestingDays;
uint256 public cliffDays;
bool public revocable;
address public revoker;
uint256 public revokedTokens;
address public revokedTokensDestination;
address public revokedTokensDestinationChanger;
bool public revoked;
event TokensReleased(uint256 amount);
event Revoked(
uint256 totalTokens,
uint256 revokedTokens,
address revokedTokensDestination
);
event RevokedTokensDestinationChanged(address previous, address current);
event RevokedTokensDestinationChangerChanged(
address previous,
address current
);
/**
* @dev Creates a vesting contract.
*
* @param _token The token involved in the vesting contract.
* @param _beneficiary The account that will receive the vested tokens.
* @param _vestingStart The number of seconds from the EPOCH where the
* vesting period starts.
* @param _vestingDays The duration of the vesting period in days.
* @param _cliffDays The number of days after _vestingStart before the
* tokens start vesting.
* @param _revocable True if this contract can be revoced.
* @param _revoker The only account that can #revoke() the contract.
* @param _revokedTokensDestination The account that will receive non-vested
* tokens on revokation.
* @param _revokedTokensDestinationChanger The only account that can change
* the value of #revokedTokensDestination.
*/
function LinearDailyVesting(
ERC20 _token,
address _beneficiary,
uint256 _vestingStart,
uint256 _vestingDays,
uint256 _cliffDays,
bool _revocable,
address _revoker,
address _revokedTokensDestination,
address _revokedTokensDestinationChanger
)
public
{
require(_token != address(0));
require(_beneficiary != address(0));
require(_vestingStart > 0);
require(_vestingDays > 0);
require(_cliffDays <= _vestingDays);
require(!_revocable || _revoker != address(0));
require(!_revocable || _revokedTokensDestination != address(0));
require(!_revocable || _revokedTokensDestinationChanger != address(0));
token = _token;
beneficiary = _beneficiary;
vestingStart = _vestingStart;
vestingDays = _vestingDays;
cliffDays = _cliffDays;
revoked = false;
revokedTokens = 0;
revocable = _revocable;
revoker = _revoker;
revokedTokensDestination = _revokedTokensDestination;
revokedTokensDestinationChanger = _revokedTokensDestinationChanger;
}
/**
* @dev Sends any vested token being held by this contract to the
* #beneficiary.
*/
function release() public {
require(revoked == false);
uint256 releasable = releasableTokens();
require(releasable > 0);
assert(token.transfer(beneficiary, releasable));
relasedTokens = relasedTokens.add(releasable);
TokensReleased(releasable);
}
/**
* @return The total number of tokens that have already vested, whether they
* have been released or not.
*/
function vestedTokens() public constant returns (uint256) {
if (vestingStart > now) {
return 0;
}
uint256 vestedDays = now.sub(vestingStart).div(1 days);
if (vestedDays < cliffDays) {
return 0;
}
if (vestedDays > vestingDays) {
vestedDays = vestingDays;
}
return totalTokens().mul(vestedDays).div(vestingDays);
}
/**
* @return The total number of tokens that this contract is or has managed.
*/
function totalTokens() public constant returns (uint256) {
return token.balanceOf(this).add(relasedTokens).add(revokedTokens);
}
/**
* @return The number of non-vested tokens held by this contract.
*/
function lockedTokens() public constant returns (uint256) {
if (revoked) {
return 0;
}
return totalTokens().sub(vestedTokens());
}
/**
* @return The number of non-released vested tokens.
*/
function releasableTokens() public constant returns (uint256) {
return vestedTokens().sub(relasedTokens);
}
/**
* @dev Revokes the contract, sending all non-released vested token to the
* #beneficiary, and all non-vested ones to the #revokedTokensDestination.
*
* @notice This contract enters in a locked mode after calling this method,
* so no token should be send after calling it.
*/
function revoke() public {
require(revocable == true);
require(msg.sender == revoker);
require(revoked == false);
uint256 locked = lockedTokens();
require(locked > 0);
if (releasableTokens() > 0) {
release();
}
revoked = true;
revokedTokens = locked;
assert(token.transfer(revokedTokensDestination, revokedTokens));
Revoked(totalTokens(), revokedTokens, revokedTokensDestination);
}
/**
* @dev Changes #revokedTokensDestination address.
*/
function changeRevokedTokensDestination(address _revokedTokensDestination)
public
{
require(revocable == true);
require(msg.sender == revokedTokensDestinationChanger);
require(revoked == false);
require(_revokedTokensDestination != address(0));
require(_revokedTokensDestination != revokedTokensDestination);
address previous = revokedTokensDestination;
revokedTokensDestination = _revokedTokensDestination;
RevokedTokensDestinationChanged(previous, revokedTokensDestination);
}
/**
* @dev Changes #revokedTokensDestinationChanger address.
*/
function changeRevokedTokensDestinationChanger(
address _revokedTokensDestinationChanger
)
public
{
require(revocable == true);
require(msg.sender == revokedTokensDestinationChanger);
require(revoked == false);
require(_revokedTokensDestinationChanger != address(0));
require(
_revokedTokensDestinationChanger != revokedTokensDestinationChanger
);
address previous = revokedTokensDestinationChanger;
revokedTokensDestinationChanger = _revokedTokensDestinationChanger;
RevokedTokensDestinationChangerChanged(
previous,
revokedTokensDestinationChanger
);
}
} | contract LinearDailyVesting {
using SafeMath for uint256;
ERC20 public token;
uint256 public relasedTokens;
address public beneficiary;
uint256 public vestingStart;
uint256 public vestingDays;
uint256 public cliffDays;
bool public revocable;
address public revoker;
uint256 public revokedTokens;
address public revokedTokensDestination;
address public revokedTokensDestinationChanger;
bool public revoked;
event TokensReleased(uint256 amount);
event Revoked(
uint256 totalTokens,
uint256 revokedTokens,
address revokedTokensDestination
);
event RevokedTokensDestinationChanged(address previous, address current);
event RevokedTokensDestinationChangerChanged(
address previous,
address current
);
/**
* @dev Creates a vesting contract.
*
* @param _token The token involved in the vesting contract.
* @param _beneficiary The account that will receive the vested tokens.
* @param _vestingStart The number of seconds from the EPOCH where the
* vesting period starts.
* @param _vestingDays The duration of the vesting period in days.
* @param _cliffDays The number of days after _vestingStart before the
* tokens start vesting.
* @param _revocable True if this contract can be revoced.
* @param _revoker The only account that can #revoke() the contract.
* @param _revokedTokensDestination The account that will receive non-vested
* tokens on revokation.
* @param _revokedTokensDestinationChanger The only account that can change
* the value of #revokedTokensDestination.
*/
function LinearDailyVesting(
ERC20 _token,
address _beneficiary,
uint256 _vestingStart,
uint256 _vestingDays,
uint256 _cliffDays,
bool _revocable,
address _revoker,
address _revokedTokensDestination,
address _revokedTokensDestinationChanger
)
public
{
require(_token != address(0));
require(_beneficiary != address(0));
require(_vestingStart > 0);
require(_vestingDays > 0);
require(_cliffDays <= _vestingDays);
require(!_revocable || _revoker != address(0));
require(!_revocable || _revokedTokensDestination != address(0));
require(!_revocable || _revokedTokensDestinationChanger != address(0));
token = _token;
beneficiary = _beneficiary;
vestingStart = _vestingStart;
vestingDays = _vestingDays;
cliffDays = _cliffDays;
revoked = false;
revokedTokens = 0;
revocable = _revocable;
revoker = _revoker;
revokedTokensDestination = _revokedTokensDestination;
revokedTokensDestinationChanger = _revokedTokensDestinationChanger;
}
/**
* @dev Sends any vested token being held by this contract to the
* #beneficiary.
*/
function release() public {
require(revoked == false);
uint256 releasable = releasableTokens();
require(releasable > 0);
assert(token.transfer(beneficiary, releasable));
relasedTokens = relasedTokens.add(releasable);
TokensReleased(releasable);
}
/**
* @return The total number of tokens that have already vested, whether they
* have been released or not.
*/
function vestedTokens() public constant returns (uint256) {
if (vestingStart > now) {
return 0;
}
uint256 vestedDays = now.sub(vestingStart).div(1 days);
if (vestedDays < cliffDays) {
return 0;
}
if (vestedDays > vestingDays) {
vestedDays = vestingDays;
}
return totalTokens().mul(vestedDays).div(vestingDays);
}
/**
* @return The total number of tokens that this contract is or has managed.
*/
function totalTokens() public constant returns (uint256) {
return token.balanceOf(this).add(relasedTokens).add(revokedTokens);
}
/**
* @return The number of non-vested tokens held by this contract.
*/
function lockedTokens() public constant returns (uint256) {
if (revoked) {
return 0;
}
return totalTokens().sub(vestedTokens());
}
/**
* @return The number of non-released vested tokens.
*/
function releasableTokens() public constant returns (uint256) {
return vestedTokens().sub(relasedTokens);
}
/**
* @dev Revokes the contract, sending all non-released vested token to the
* #beneficiary, and all non-vested ones to the #revokedTokensDestination.
*
* @notice This contract enters in a locked mode after calling this method,
* so no token should be send after calling it.
*/
function revoke() public {
require(revocable == true);
require(msg.sender == revoker);
require(revoked == false);
uint256 locked = lockedTokens();
require(locked > 0);
if (releasableTokens() > 0) {
release();
}
revoked = true;
revokedTokens = locked;
assert(token.transfer(revokedTokensDestination, revokedTokens));
Revoked(totalTokens(), revokedTokens, revokedTokensDestination);
}
/**
* @dev Changes #revokedTokensDestination address.
*/
function changeRevokedTokensDestination(address _revokedTokensDestination)
public
{
require(revocable == true);
require(msg.sender == revokedTokensDestinationChanger);
require(revoked == false);
require(_revokedTokensDestination != address(0));
require(_revokedTokensDestination != revokedTokensDestination);
address previous = revokedTokensDestination;
revokedTokensDestination = _revokedTokensDestination;
RevokedTokensDestinationChanged(previous, revokedTokensDestination);
}
/**
* @dev Changes #revokedTokensDestinationChanger address.
*/
function changeRevokedTokensDestinationChanger(
address _revokedTokensDestinationChanger
)
public
{
require(revocable == true);
require(msg.sender == revokedTokensDestinationChanger);
require(revoked == false);
require(_revokedTokensDestinationChanger != address(0));
require(
_revokedTokensDestinationChanger != revokedTokensDestinationChanger
);
address previous = revokedTokensDestinationChanger;
revokedTokensDestinationChanger = _revokedTokensDestinationChanger;
RevokedTokensDestinationChangerChanged(
previous,
revokedTokensDestinationChanger
);
}
} | 28,390 |
68 | // Returns the total rebate amount for gm and normal mints for the given collector./collector The address of the collector. | function getTotalRebateAmount(address collector)
public
view
whenAuctionFinished
returns (uint256)
| function getTotalRebateAmount(address collector)
public
view
whenAuctionFinished
returns (uint256)
| 39,182 |
109 | // it was started | started &&
| started &&
| 14,674 |
15 | // add to history | history[msg.sender].push(gameId);
| history[msg.sender].push(gameId);
| 24,854 |
195 | // Returns the index of a given node within the validator's node index. / | function _findNode(uint[] memory validatorNodeIndexes, uint nodeIndex) private pure returns (uint) {
uint i;
for (i = 0; i < validatorNodeIndexes.length; i++) {
if (validatorNodeIndexes[i] == nodeIndex) {
return i;
}
}
return validatorNodeIndexes.length;
}
| function _findNode(uint[] memory validatorNodeIndexes, uint nodeIndex) private pure returns (uint) {
uint i;
for (i = 0; i < validatorNodeIndexes.length; i++) {
if (validatorNodeIndexes[i] == nodeIndex) {
return i;
}
}
return validatorNodeIndexes.length;
}
| 52,768 |
26 | // Get the sport markets AMM volume for the account/account to get the sport markets AMM volume for/ return the sport markets AMM volume for the account | function getSportsAMMVolume(address account) external view returns (uint volumeforAccount) {
for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
if (periodsOfStaking < sportsAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
volumeforAccount = volumeforAccount.add(sportsAMMVolume[account][i].amount);
}
}
| function getSportsAMMVolume(address account) external view returns (uint volumeforAccount) {
for (uint i = 0; i < AMM_EXTRA_REWARD_PERIODS; i++) {
if (periodsOfStaking < sportsAMMVolume[account][i].period.add(AMM_EXTRA_REWARD_PERIODS))
volumeforAccount = volumeforAccount.add(sportsAMMVolume[account][i].amount);
}
}
| 18,878 |
384 | // Set royalties of an extension / | function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
| 1,772 |
170 | // Internal function that burns an amount of the token of a given account.Update pointsCorrection to keep funds unchanged. account The account whose tokens will be burnt. value The amount that will be burnt. / | function _burn(address account, uint256 value) internal override {
super._burn(account, value);
pointsCorrection[account] = pointsCorrection[account]
.add( (pointsPerShare.mul(value)).toInt256Safe() );
}
| function _burn(address account, uint256 value) internal override {
super._burn(account, value);
pointsCorrection[account] = pointsCorrection[account]
.add( (pointsPerShare.mul(value)).toInt256Safe() );
}
| 14,991 |
35 | // Appends a bytes20 to the buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append.return The original buffer, for chhaining. / | function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, bytes32(data), 20);
}
| function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, bytes32(data), 20);
}
| 36,217 |
47 | // duration since proposal creation till users can vote | uint public constant VOTE_DURATION = 3 days;
| uint public constant VOTE_DURATION = 3 days;
| 31,774 |
67 | // Returns an address by idreturn The address / | function getAddress(bytes32 id) public view override returns (address) {
return _addresses[id];
}
| function getAddress(bytes32 id) public view override returns (address) {
return _addresses[id];
}
| 39,778 |
1 | // duration of each epoch | uint256 public immutable epochDuration;
| uint256 public immutable epochDuration;
| 38,377 |
6 | // Burns some ERC721 token.Only bridge contract is authorized to burn tokens. _tokenId unique identifier of the burned token. / | function burn(uint256 _tokenId) external override onlyBridge {
_burn(_tokenId);
}
| function burn(uint256 _tokenId) external override onlyBridge {
_burn(_tokenId);
}
| 7,807 |
6 | // Emitted when a publisher's approval of an operator is updated. | event Approved(address indexed publisher, address indexed operator, bool isApproved);
| event Approved(address indexed publisher, address indexed operator, bool isApproved);
| 10,139 |
41 | // View governance address/ return governance address | function getGovernance() public view returns(address) {
return governance;
}
| function getGovernance() public view returns(address) {
return governance;
}
| 82,700 |
16 | // Lets the owner transfer ownership of the contract to a new owner. _newOwner The new owner. / | function changeOwner(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Address must not be null");
owner = _newOwner;
emit OwnerChanged(_newOwner);
}
| function changeOwner(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Address must not be null");
owner = _newOwner;
emit OwnerChanged(_newOwner);
}
| 1,169 |
61 | // ERC721Metadata standard / | interface ERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 _tokenId) external view returns (string memory);
}
| interface ERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 _tokenId) external view returns (string memory);
}
| 56,506 |
15 | // Enables the transfer of tokens for everyone / | function enableTransfers() onlyOwner public {
require(!transferable);
transferable = true;
TransfersEnabled();
}
| function enableTransfers() onlyOwner public {
require(!transferable);
transferable = true;
TransfersEnabled();
}
| 22,480 |
10 | // Now let's create a payroll object | Salary[] public payroll;
mapping (address => uint) public salaryId;
uint public payrollLength;
| Salary[] public payroll;
mapping (address => uint) public salaryId;
uint public payrollLength;
| 24,512 |
15 | // Reset the raffle, removing all entrants | function resetRaffle() public onlyOwner {
for (uint256 i = 0; i < entrants_array.length; i++) {
entrants[entrants_array[i]] = false;
}
delete entrants_array;
winner = address(0);
}
| function resetRaffle() public onlyOwner {
for (uint256 i = 0; i < entrants_array.length; i++) {
entrants[entrants_array[i]] = false;
}
delete entrants_array;
winner = address(0);
}
| 14,912 |
176 | // AddressToUintMap | struct AddressToUintMap {
Map _inner;
}
| struct AddressToUintMap {
Map _inner;
}
| 13,462 |
15 | // Fallback function is called when msg.data is not empty | fallback() external payable {}
| fallback() external payable {}
| 3,225 |
4 | // Hook that is called before any registration.It will pass if and only if the balance of the account is zero or the account is the owner. Balance is computed based on a function which is implemented in the implementation contract.account The address for which the registration is made. labelHash The hash of the label to register. / | function _beforeRegistration(address account, bytes32 labelHash)
internal
virtual
override
| function _beforeRegistration(address account, bytes32 labelHash)
internal
virtual
override
| 15,491 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.