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 |
|---|---|---|---|---|
106 | // solhint-disable-next-line no-empty-blocks | receive() external virtual payable {}
} abstract contract CTokenInterface is ERC20 {
function mint(uint256 mintAmount) external virtual returns (uint256);
// function mint() external virtual payable;
function accrueInterest() public virtual returns (uint);
function redeem(uint256 redeemTokens) external virtual returns (uint256);
function redeemUnderlying(uint256 redeemAmount) external virtual returns (uint256);
function borrow(uint256 borrowAmount) external virtual returns (uint256);
function borrowIndex() public view virtual returns (uint);
function borrowBalanceStored(address) public view virtual returns(uint);
function repayBorrow(uint256 repayAmount) external virtual returns (uint256);
function repayBorrow() external virtual payable;
function repayBorrowBehalf(address borrower, uint256 repayAmount) external virtual returns (uint256);
function repayBorrowBehalf(address borrower) external virtual payable;
function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral)
external virtual
returns (uint256);
function liquidateBorrow(address borrower, address cTokenCollateral) external virtual payable;
function exchangeRateCurrent() external virtual returns (uint256);
function supplyRatePerBlock() external virtual returns (uint256);
function borrowRatePerBlock() external virtual returns (uint256);
function totalReserves() external virtual returns (uint256);
function reserveFactorMantissa() external virtual returns (uint256);
function borrowBalanceCurrent(address account) external virtual returns (uint256);
function totalBorrowsCurrent() external virtual returns (uint256);
function getCash() external virtual returns (uint256);
function balanceOfUnderlying(address owner) external virtual returns (uint256);
function underlying() external virtual returns (address);
function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint, uint);
} abstract contract CEtherInterface {
function mint() external virtual payable;
function repayBorrow() external virtual payable;
} abstract contract CompoundOracleInterface {
function getUnderlyingPrice(address cToken) external view virtual returns (uint);
}
| receive() external virtual payable {}
} abstract contract CTokenInterface is ERC20 {
function mint(uint256 mintAmount) external virtual returns (uint256);
// function mint() external virtual payable;
function accrueInterest() public virtual returns (uint);
function redeem(uint256 redeemTokens) external virtual returns (uint256);
function redeemUnderlying(uint256 redeemAmount) external virtual returns (uint256);
function borrow(uint256 borrowAmount) external virtual returns (uint256);
function borrowIndex() public view virtual returns (uint);
function borrowBalanceStored(address) public view virtual returns(uint);
function repayBorrow(uint256 repayAmount) external virtual returns (uint256);
function repayBorrow() external virtual payable;
function repayBorrowBehalf(address borrower, uint256 repayAmount) external virtual returns (uint256);
function repayBorrowBehalf(address borrower) external virtual payable;
function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral)
external virtual
returns (uint256);
function liquidateBorrow(address borrower, address cTokenCollateral) external virtual payable;
function exchangeRateCurrent() external virtual returns (uint256);
function supplyRatePerBlock() external virtual returns (uint256);
function borrowRatePerBlock() external virtual returns (uint256);
function totalReserves() external virtual returns (uint256);
function reserveFactorMantissa() external virtual returns (uint256);
function borrowBalanceCurrent(address account) external virtual returns (uint256);
function totalBorrowsCurrent() external virtual returns (uint256);
function getCash() external virtual returns (uint256);
function balanceOfUnderlying(address owner) external virtual returns (uint256);
function underlying() external virtual returns (address);
function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint, uint);
} abstract contract CEtherInterface {
function mint() external virtual payable;
function repayBorrow() external virtual payable;
} abstract contract CompoundOracleInterface {
function getUnderlyingPrice(address cToken) external view virtual returns (uint);
}
| 6,178 |
46 | // Exit rewards condition | maxIterations = 0;
| maxIterations = 0;
| 9,698 |
345 | // Returns the current total supply of votes. / | function _getTotalSupply() internal view virtual returns (uint256) {
return _totalCheckpoints.latest();
}
| function _getTotalSupply() internal view virtual returns (uint256) {
return _totalCheckpoints.latest();
}
| 62,786 |
48 | // Base pool hook called from `onJoinPool`. Forward to `onJoinExitPool` with `isJoin` set to true. / | function _onJoinPool(
bytes32,
address,
address,
uint256[] memory registeredBalances,
uint256,
uint256,
uint256[] memory scalingFactors,
bytes memory userData
| function _onJoinPool(
bytes32,
address,
address,
uint256[] memory registeredBalances,
uint256,
uint256,
uint256[] memory scalingFactors,
bytes memory userData
| 21,152 |
124 | // Distributes the provided amount of fees._feeManager address of the fee manager contract_fee total amount to be distributed to the list of reward accounts._messageId id of the message that generated fee distribution/ | function distributeFee(IMediatorFeeManager _feeManager, uint256 _fee, bytes32 _messageId) internal {
onFeeDistribution(_feeManager, _fee);
_feeManager.call(abi.encodeWithSelector(ON_TOKEN_TRANSFER, address(this), _fee, ""));
emit FeeDistributed(_fee, _messageId);
}
| function distributeFee(IMediatorFeeManager _feeManager, uint256 _fee, bytes32 _messageId) internal {
onFeeDistribution(_feeManager, _fee);
_feeManager.call(abi.encodeWithSelector(ON_TOKEN_TRANSFER, address(this), _fee, ""));
emit FeeDistributed(_fee, _messageId);
}
| 50,398 |
27 | // Gets the borrow cap of the reserve self The reserve configurationreturn The borrow cap / | {
return (self.data & ~BORROW_CAP_MASK) >> BORROW_CAP_START_BIT_POSITION;
}
| {
return (self.data & ~BORROW_CAP_MASK) >> BORROW_CAP_START_BIT_POSITION;
}
| 4,688 |
521 | // get the most recently reported answer[deprecated] Use latestRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point toan already answered Aggregator or use the recommended latestRoundDatainstead which includes better verification information. / | function latestAnswer() public view virtual override returns (int256) {
return rounds[latestRoundId].answer;
}
| function latestAnswer() public view virtual override returns (int256) {
return rounds[latestRoundId].answer;
}
| 12,929 |
29 | // modifier to check validation of lock status of smart contract / | modifier AllTransfersLockStatus()
| modifier AllTransfersLockStatus()
| 14,149 |
0 | // Functions that create transaction on block chain | function setName(string memory newName) public {
name = newName;
}
| function setName(string memory newName) public {
name = newName;
}
| 38,455 |
77 | // Create keeper listNOTE: Any function with onlyKeeper modifier will not work until this function is called.NOTE: Due to gas constraint this function cannot be called in constructor. _addressListFactory To support same code in eth side chain, user _addressListFactory as paramethereum- 0xded8217De022706A191eE7Ee0Dc9df1185Fb5dA3polygon-0xD10D5696A350D65A9AA15FE8B258caB4ab1bF291 / | function init(address _addressListFactory) external onlyGovernor {
require(address(keepers) == address(0), "keeper-list-already-created");
// Prepare keeper list
IAddressListFactory _factory = IAddressListFactory(_addressListFactory);
keepers = IAddressList(_factory.createList());
require(keepers.add(_msgSender()), "add-keeper-failed");
}
| function init(address _addressListFactory) external onlyGovernor {
require(address(keepers) == address(0), "keeper-list-already-created");
// Prepare keeper list
IAddressListFactory _factory = IAddressListFactory(_addressListFactory);
keepers = IAddressList(_factory.createList());
require(keepers.add(_msgSender()), "add-keeper-failed");
}
| 25,695 |
46 | // Don't allow setting bad agent | if(!finalizeAgent.isFinalizeAgent()) {
throw;
}
| if(!finalizeAgent.isFinalizeAgent()) {
throw;
}
| 6,052 |
99 | // Handle the receipt of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter a `transfer` or a `transferFrom`. This function MAY throw to revert and reject thetransfer. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message sender. operator address The address which called `transferAndCall` or `transferFromAndCall` function sender address The address which are token transferred from amount uint256 The amount of tokens transferred data bytes Additional data with no specified formatreturn `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` unless throwing / | function onTransferReceived(address operator, address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| function onTransferReceived(address operator, address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| 9,843 |
27 | // no vesting allowed | mVestingAllowed[target]=0;
| mVestingAllowed[target]=0;
| 28,132 |
91 | // `prevId` does not exist anymore or now has a smaller key than the given key | prevId = address(0);
| prevId = address(0);
| 5,934 |
0 | // Required interface of an ERC721 compliant contract. / | interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev 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 the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
} | interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev 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 the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
} | 2,813 |
83 | // This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. /function _msgSender()internaloverrideviewreturns (address sender) | // {
// return ContextMixin.msgSender();
// }
| // {
// return ContextMixin.msgSender();
// }
| 21,089 |
5 | // Address of the OptimistAllowlist contract. / | OptimistAllowlist public immutable OPTIMIST_ALLOWLIST;
| OptimistAllowlist public immutable OPTIMIST_ALLOWLIST;
| 10,667 |
166 | // removeLiquidity | _approveRouter(_pair,_lpAmount);
(uint256 removeAmount0,uint256 removeAmount1) = swapRouter.removeLiquidity(token0,token1,_lpAmount,0,0,
address(this), block.timestamp + 300);
| _approveRouter(_pair,_lpAmount);
(uint256 removeAmount0,uint256 removeAmount1) = swapRouter.removeLiquidity(token0,token1,_lpAmount,0,0,
address(this), block.timestamp + 300);
| 13,894 |
19 | // Populate U matrix | for (uint i=0; i<a[0].length; i++) {
| for (uint i=0; i<a[0].length; i++) {
| 31,034 |
10 | // Claim rewards owed | IRewardsHandler(rewardsHandlerAddress).claimRewards(fnftId, _msgSender());
| IRewardsHandler(rewardsHandlerAddress).claimRewards(fnftId, _msgSender());
| 5,660 |
32 | // IGarden Interface for operating with a Garden. / | interface ICoreGarden {
/* ============ Constructor ============ */
/* ============ View ============ */
function privateGarden() external view returns (bool);
function publicStrategists() external view returns (bool);
function publicStewards() external view returns (bool);
function controller() external view returns (IBabController);
function creator() external view returns (address);
function isGardenStrategy(address _strategy) external view returns (bool);
function getContributor(address _contributor)
external
view
returns (
uint256 lastDepositAt,
uint256 initialDepositAt,
uint256 claimedAt,
uint256 claimedBABL,
uint256 claimedRewards,
uint256 withdrawnSince,
uint256 totalDeposits,
uint256 nonce,
uint256 lockedBalance
);
function reserveAsset() external view returns (address);
function verifiedCategory() external view returns (uint256);
function canMintNftAfter() external view returns (uint256);
function hardlockStartsAt() external view returns (uint256);
function totalContributors() external view returns (uint256);
function gardenInitializedAt() external view returns (uint256);
function minContribution() external view returns (uint256);
function depositHardlock() external view returns (uint256);
function minLiquidityAsset() external view returns (uint256);
function minStrategyDuration() external view returns (uint256);
function maxStrategyDuration() external view returns (uint256);
function reserveAssetRewardsSetAside() external view returns (uint256);
function absoluteReturns() external view returns (int256);
function totalStake() external view returns (uint256);
function minVotesQuorum() external view returns (uint256);
function minVoters() external view returns (uint256);
function maxDepositLimit() external view returns (uint256);
function strategyCooldownPeriod() external view returns (uint256);
function getStrategies() external view returns (address[] memory);
function extraCreators(uint256 index) external view returns (address);
function getFinalizedStrategies() external view returns (address[] memory);
function strategyMapping(address _strategy) external view returns (bool);
function keeperDebt() external view returns (uint256);
function totalKeeperFees() external view returns (uint256);
function lastPricePerShare() external view returns (uint256);
function lastPricePerShareTS() external view returns (uint256);
function pricePerShareDecayRate() external view returns (uint256);
function pricePerShareDelta() external view returns (uint256);
/* ============ Write ============ */
function deposit(
uint256 _amountIn,
uint256 _minAmountOut,
address _to,
address _referrer
) external payable;
function depositBySig(
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _maxFee,
address _to,
uint256 _pricePerShare,
uint256 _fee,
address _signer,
address _referrer,
bytes memory signature
) external;
function withdraw(
uint256 _amountIn,
uint256 _minAmountOut,
address payable _to,
bool _withPenalty,
address _unwindStrategy
) external;
function withdrawBySig(
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _maxFee,
bool _withPenalty,
address _unwindStrategy,
uint256 _pricePerShare,
uint256 _strategyNAV,
uint256 _fee,
address _signer,
bytes memory signature
) external;
function claimReturns(address[] calldata _finalizedStrategies) external;
function claimAndStakeReturns(uint256 _minAmountOut, address[] calldata _finalizedStrategies) external;
function claimRewardsBySig(
uint256 _babl,
uint256 _profits,
uint256 _nonce,
uint256 _maxFee,
uint256 _fee,
address signer,
bytes memory signature
) external;
function claimAndStakeRewardsBySig(
uint256 _babl,
uint256 _profits,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _nonceHeart,
uint256 _maxFee,
uint256 _pricePerShare,
uint256 _fee,
address _signer,
bytes memory _signature
) external;
function stakeBySig(
uint256 _amountIn,
uint256 _profits,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _nonceHeart,
uint256 _maxFee,
address _to,
uint256 _pricePerShare,
address _signer,
bytes memory _signature
) external;
function claimNFT() external;
}
| interface ICoreGarden {
/* ============ Constructor ============ */
/* ============ View ============ */
function privateGarden() external view returns (bool);
function publicStrategists() external view returns (bool);
function publicStewards() external view returns (bool);
function controller() external view returns (IBabController);
function creator() external view returns (address);
function isGardenStrategy(address _strategy) external view returns (bool);
function getContributor(address _contributor)
external
view
returns (
uint256 lastDepositAt,
uint256 initialDepositAt,
uint256 claimedAt,
uint256 claimedBABL,
uint256 claimedRewards,
uint256 withdrawnSince,
uint256 totalDeposits,
uint256 nonce,
uint256 lockedBalance
);
function reserveAsset() external view returns (address);
function verifiedCategory() external view returns (uint256);
function canMintNftAfter() external view returns (uint256);
function hardlockStartsAt() external view returns (uint256);
function totalContributors() external view returns (uint256);
function gardenInitializedAt() external view returns (uint256);
function minContribution() external view returns (uint256);
function depositHardlock() external view returns (uint256);
function minLiquidityAsset() external view returns (uint256);
function minStrategyDuration() external view returns (uint256);
function maxStrategyDuration() external view returns (uint256);
function reserveAssetRewardsSetAside() external view returns (uint256);
function absoluteReturns() external view returns (int256);
function totalStake() external view returns (uint256);
function minVotesQuorum() external view returns (uint256);
function minVoters() external view returns (uint256);
function maxDepositLimit() external view returns (uint256);
function strategyCooldownPeriod() external view returns (uint256);
function getStrategies() external view returns (address[] memory);
function extraCreators(uint256 index) external view returns (address);
function getFinalizedStrategies() external view returns (address[] memory);
function strategyMapping(address _strategy) external view returns (bool);
function keeperDebt() external view returns (uint256);
function totalKeeperFees() external view returns (uint256);
function lastPricePerShare() external view returns (uint256);
function lastPricePerShareTS() external view returns (uint256);
function pricePerShareDecayRate() external view returns (uint256);
function pricePerShareDelta() external view returns (uint256);
/* ============ Write ============ */
function deposit(
uint256 _amountIn,
uint256 _minAmountOut,
address _to,
address _referrer
) external payable;
function depositBySig(
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _maxFee,
address _to,
uint256 _pricePerShare,
uint256 _fee,
address _signer,
address _referrer,
bytes memory signature
) external;
function withdraw(
uint256 _amountIn,
uint256 _minAmountOut,
address payable _to,
bool _withPenalty,
address _unwindStrategy
) external;
function withdrawBySig(
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _maxFee,
bool _withPenalty,
address _unwindStrategy,
uint256 _pricePerShare,
uint256 _strategyNAV,
uint256 _fee,
address _signer,
bytes memory signature
) external;
function claimReturns(address[] calldata _finalizedStrategies) external;
function claimAndStakeReturns(uint256 _minAmountOut, address[] calldata _finalizedStrategies) external;
function claimRewardsBySig(
uint256 _babl,
uint256 _profits,
uint256 _nonce,
uint256 _maxFee,
uint256 _fee,
address signer,
bytes memory signature
) external;
function claimAndStakeRewardsBySig(
uint256 _babl,
uint256 _profits,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _nonceHeart,
uint256 _maxFee,
uint256 _pricePerShare,
uint256 _fee,
address _signer,
bytes memory _signature
) external;
function stakeBySig(
uint256 _amountIn,
uint256 _profits,
uint256 _minAmountOut,
uint256 _nonce,
uint256 _nonceHeart,
uint256 _maxFee,
address _to,
uint256 _pricePerShare,
address _signer,
bytes memory _signature
) external;
function claimNFT() external;
}
| 35,502 |
80 | // Outside-visible transact entry point. Executes transaction immediately if below daily spend limit. If not, goes into multisig process. We provide a hash on return to allow the sender to provide shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value and _data arguments). They still get the option of using them if they want, anyways. | function execute(address _to, uint _value, bytes _data) onlyowner external returns (bytes32 o_hash) {
// first, take the opportunity to check that we're under the daily limit.
if ((_data.length == 0 && underLimit(_value)) || m_required == 1) {
// yes - just execute the call.
address created;
if (_to == 0) {
created = create(_value, _data);
} else {
require(_to.call.value(_value)(_data));
}
SingleTransact(msg.sender, _value, _to, _data, created);
} else {
// determine our operation hash.
o_hash = sha3(msg.data, block.number);
// store if it's new
if (m_txs[o_hash].to == 0 && m_txs[o_hash].value == 0 && m_txs[o_hash].data.length == 0) {
m_txs[o_hash].to = _to;
m_txs[o_hash].value = _value;
m_txs[o_hash].data = _data;
}
if (!confirm(o_hash)) {
ConfirmationNeeded(o_hash, msg.sender, _value, _to, _data);
}
}
}
| function execute(address _to, uint _value, bytes _data) onlyowner external returns (bytes32 o_hash) {
// first, take the opportunity to check that we're under the daily limit.
if ((_data.length == 0 && underLimit(_value)) || m_required == 1) {
// yes - just execute the call.
address created;
if (_to == 0) {
created = create(_value, _data);
} else {
require(_to.call.value(_value)(_data));
}
SingleTransact(msg.sender, _value, _to, _data, created);
} else {
// determine our operation hash.
o_hash = sha3(msg.data, block.number);
// store if it's new
if (m_txs[o_hash].to == 0 && m_txs[o_hash].value == 0 && m_txs[o_hash].data.length == 0) {
m_txs[o_hash].to = _to;
m_txs[o_hash].value = _value;
m_txs[o_hash].data = _data;
}
if (!confirm(o_hash)) {
ConfirmationNeeded(o_hash, msg.sender, _value, _to, _data);
}
}
}
| 87,260 |
497 | // Checks all cash group settings for invalid values and sets them into storage | function setCashGroupStorage(uint256 currencyId, CashGroupSettings calldata cashGroup)
internal
| function setCashGroupStorage(uint256 currencyId, CashGroupSettings calldata cashGroup)
internal
| 65,000 |
108 | // Start a new period needs corresponding permissions for sender / | function startNewPeriod() external;
| function startNewPeriod() external;
| 23,651 |
206 | // Get channel confirm settle open time _channelId ID of the channel to be viewedreturn channel confirm settle open time / | function getSettleFinalizedTime(bytes32 _channelId) public view returns(uint) {
| function getSettleFinalizedTime(bytes32 _channelId) public view returns(uint) {
| 55,329 |
197 | // return stakingToken.balanceOf(address(this)); | return totalStakedAmount;
| return totalStakedAmount;
| 77,405 |
93 | // Fetches Compound prices for tokens/_cTokens Arr. of cTokens for which to get the prices/ return prices Array of prices | function getPrices(address[] memory _cTokens) public view returns (uint[] memory prices) {
prices = new uint[](_cTokens.length);
address oracleAddr = Comptroller.oracle();
for (uint i = 0; i < _cTokens.length; ++i) {
prices[i] = ICompoundOracle(oracleAddr).getUnderlyingPrice(_cTokens[i]);
}
}
| function getPrices(address[] memory _cTokens) public view returns (uint[] memory prices) {
prices = new uint[](_cTokens.length);
address oracleAddr = Comptroller.oracle();
for (uint i = 0; i < _cTokens.length; ++i) {
prices[i] = ICompoundOracle(oracleAddr).getUnderlyingPrice(_cTokens[i]);
}
}
| 46,978 |
157 | // Calculates the how is gonna be a new cooldown timestamp depending on the sender/receiver situation - If the timestamp of the sender is "better" or the timestamp of the recipient is 0, we take the one of the recipient - Weighted average of from/to cooldown timestamps if:The sender doesn't have the cooldown activated (timestamp 0).The sender timestamp is expiredThe sender has a "worse" timestamp - If the receiver's cooldown timestamp expired (too old), the next is 0 fromCooldownTimestamp Cooldown timestamp of the sender amountToReceive Amount toAddress Address of the recipient toBalance Current balance of the receiverreturn The new cooldown timestamp | ) public view returns (uint256) {
uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
if (toCooldownTimestamp == 0) {
return 0;
}
uint256 minimalValidCooldownTimestamp =
block.timestamp.sub(COOLDOWN_SECONDS).sub(UNSTAKE_WINDOW);
if (minimalValidCooldownTimestamp > toCooldownTimestamp) {
toCooldownTimestamp = 0;
} else {
uint256 fromCooldownTimestamp =
(minimalValidCooldownTimestamp > fromCooldownTimestamp)
? block.timestamp
: fromCooldownTimestamp;
if (fromCooldownTimestamp < toCooldownTimestamp) {
return toCooldownTimestamp;
} else {
toCooldownTimestamp = (
amountToReceive.mul(fromCooldownTimestamp).add(toBalance.mul(toCooldownTimestamp))
)
.div(amountToReceive.add(toBalance));
}
}
return toCooldownTimestamp;
}
| ) public view returns (uint256) {
uint256 toCooldownTimestamp = stakersCooldowns[toAddress];
if (toCooldownTimestamp == 0) {
return 0;
}
uint256 minimalValidCooldownTimestamp =
block.timestamp.sub(COOLDOWN_SECONDS).sub(UNSTAKE_WINDOW);
if (minimalValidCooldownTimestamp > toCooldownTimestamp) {
toCooldownTimestamp = 0;
} else {
uint256 fromCooldownTimestamp =
(minimalValidCooldownTimestamp > fromCooldownTimestamp)
? block.timestamp
: fromCooldownTimestamp;
if (fromCooldownTimestamp < toCooldownTimestamp) {
return toCooldownTimestamp;
} else {
toCooldownTimestamp = (
amountToReceive.mul(fromCooldownTimestamp).add(toBalance.mul(toCooldownTimestamp))
)
.div(amountToReceive.add(toBalance));
}
}
return toCooldownTimestamp;
}
| 59,573 |
0 | // Block congestion level targeted by the gas price minimum calculation. | FixidityLib.Fraction public targetDensity;
| FixidityLib.Fraction public targetDensity;
| 27,397 |
10 | // Triggers stopped state. Requirements: - The buyer must not be paused. / | function _pauseBuyer() internal whenBuyerNotPaused {
_buyerPaused = true;
emit Paused(_msgSender());
}
| function _pauseBuyer() internal whenBuyerNotPaused {
_buyerPaused = true;
emit Paused(_msgSender());
}
| 41,722 |
994 | // Check the amount of token to send meets minDy | require(v.dy >= minDy, "Swap didn't result in min tokens");
| require(v.dy >= minDy, "Swap didn't result in min tokens");
| 88,363 |
6,338 | // 3171 | entry "nosewise" : ENG_ADVERB
| entry "nosewise" : ENG_ADVERB
| 24,007 |
38 | // Whether the `_tokenIds` can be transfered / | modifier canTransferInBatch(uint256[] _tokenIds) {
for(uint256 i = 0; i < _tokenIds.length; i++) {
address owner = dataSource.roomNightIndexToOwner(_tokenIds[i]);
bool isOwner = (msg.sender == owner);
bool isApproval = (msg.sender == dataSource.roomNightApprovals(_tokenIds[i]));
bool isOperator = (dataSource.operatorApprovals(owner, msg.sender));
require(isOwner || isApproval || isOperator);
}
_;
}
| modifier canTransferInBatch(uint256[] _tokenIds) {
for(uint256 i = 0; i < _tokenIds.length; i++) {
address owner = dataSource.roomNightIndexToOwner(_tokenIds[i]);
bool isOwner = (msg.sender == owner);
bool isApproval = (msg.sender == dataSource.roomNightApprovals(_tokenIds[i]));
bool isOperator = (dataSource.operatorApprovals(owner, msg.sender));
require(isOwner || isApproval || isOperator);
}
_;
}
| 14,419 |
4 | // no-op | return;
| return;
| 7,658 |
105 | // exchange | (uint256 tokenAmount,uint256 currencyAmount) = matchBuyOrderAmount(orderId,maker,taker,amount);
require(tokenAmount>0,"!tokenAmount");
require(currencyAmount>0,"!currencyAmount");
| (uint256 tokenAmount,uint256 currencyAmount) = matchBuyOrderAmount(orderId,maker,taker,amount);
require(tokenAmount>0,"!tokenAmount");
require(currencyAmount>0,"!currencyAmount");
| 24,800 |
4 | // Implements EIP-165 for standard interface detection/`0x01ffc9a7` is the IERC165 interface id/_interfaceId The identifier of a given interface/ return If the given interface is supported | function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {
return _interfaceId == type(IAsksCoreEth).interfaceId || _interfaceId == 0x01ffc9a7;
}
| function supportsInterface(bytes4 _interfaceId) external pure returns (bool) {
return _interfaceId == type(IAsksCoreEth).interfaceId || _interfaceId == 0x01ffc9a7;
}
| 18,593 |
269 | // DGCLTESTToken Implementation of the DGCLTESTToken / | contract DGCLTESTToken is ERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover {
// indicates if minting is finished
bool private _mintingFinished = false;
// indicates if transfer is enabled
bool private _transferEnabled = false;
/**
* @dev Emitted during finish minting
*/
event MintFinished();
/**
* @dev Emitted during transfer enabling
*/
event TransferEnabled();
/**
* @dev Tokens can be minted only before minting finished.
*/
modifier canMint() {
require(!_mintingFinished, "DGCLTESTToken: minting is finished");
_;
}
/**
* @dev Tokens can be moved only after if transfer enabled or if you are an approved operator.
*/
modifier canTransfer(address from) {
require(
_transferEnabled || hasRole(OPERATOR_ROLE, from),
"DGCLTESTToken: transfer is not enabled or from does not have the OPERATOR role"
);
_;
}
/**
* @param name Name of the token
* @param symbol A symbol to be used as ticker
* @param decimals Number of decimals. All the operations are done using the smallest and indivisible token unit
* @param cap Maximum number of tokens mintable
* @param initialSupply Initial token supply
* @param transferEnabled If transfer is enabled on token creation
* @param mintingFinished If minting is finished after token creation
*/
constructor(
string memory name,
string memory symbol,
uint8 decimals,
uint256 cap,
uint256 initialSupply,
bool transferEnabled,
bool mintingFinished
) public ERC20Capped(cap) ERC1363(name, symbol) {
require(
mintingFinished == false || cap == initialSupply,
"DGCLTESTToken: if finish minting, cap must be equal to initialSupply"
);
_setupDecimals(decimals);
if (initialSupply > 0) {
_mint(owner(), initialSupply);
}
if (mintingFinished) {
finishMinting();
}
if (transferEnabled) {
enableTransfer();
}
}
/**
* @return if minting is finished or not.
*/
function mintingFinished() public view returns (bool) {
return _mintingFinished;
}
/**
* @return if transfer is enabled or not.
*/
function transferEnabled() public view returns (bool) {
return _transferEnabled;
}
/**
* @dev Function to mint tokens.
* @param to The address that will receive the minted tokens
* @param value The amount of tokens to mint
*/
function mint(address to, uint256 value) public canMint onlyMinter {
_mint(to, value);
}
/**
* @dev Transfer tokens to a specified address.
* @param to The address to transfer to
* @param value The amount to be transferred
* @return A boolean that indicates if the operation was successful.
*/
function transfer(address to, uint256 value)
public
virtual
override(ERC20)
canTransfer(_msgSender())
returns (bool)
{
return super.transfer(to, value);
}
/**
* @dev Transfer tokens from one address to another.
* @param from The address which you want to send tokens from
* @param to The address which you want to transfer to
* @param value the amount of tokens to be transferred
* @return A boolean that indicates if the operation was successful.
*/
function transferFrom(
address from,
address to,
uint256 value
) public virtual override(ERC20) canTransfer(from) returns (bool) {
return super.transferFrom(from, to, value);
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() public canMint onlyOwner {
_mintingFinished = true;
emit MintFinished();
}
/**
* @dev Function to enable transfers.
*/
function enableTransfer() public onlyOwner {
_transferEnabled = true;
emit TransferEnabled();
}
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Capped) {
super._beforeTokenTransfer(from, to, amount);
}
}
| contract DGCLTESTToken is ERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover {
// indicates if minting is finished
bool private _mintingFinished = false;
// indicates if transfer is enabled
bool private _transferEnabled = false;
/**
* @dev Emitted during finish minting
*/
event MintFinished();
/**
* @dev Emitted during transfer enabling
*/
event TransferEnabled();
/**
* @dev Tokens can be minted only before minting finished.
*/
modifier canMint() {
require(!_mintingFinished, "DGCLTESTToken: minting is finished");
_;
}
/**
* @dev Tokens can be moved only after if transfer enabled or if you are an approved operator.
*/
modifier canTransfer(address from) {
require(
_transferEnabled || hasRole(OPERATOR_ROLE, from),
"DGCLTESTToken: transfer is not enabled or from does not have the OPERATOR role"
);
_;
}
/**
* @param name Name of the token
* @param symbol A symbol to be used as ticker
* @param decimals Number of decimals. All the operations are done using the smallest and indivisible token unit
* @param cap Maximum number of tokens mintable
* @param initialSupply Initial token supply
* @param transferEnabled If transfer is enabled on token creation
* @param mintingFinished If minting is finished after token creation
*/
constructor(
string memory name,
string memory symbol,
uint8 decimals,
uint256 cap,
uint256 initialSupply,
bool transferEnabled,
bool mintingFinished
) public ERC20Capped(cap) ERC1363(name, symbol) {
require(
mintingFinished == false || cap == initialSupply,
"DGCLTESTToken: if finish minting, cap must be equal to initialSupply"
);
_setupDecimals(decimals);
if (initialSupply > 0) {
_mint(owner(), initialSupply);
}
if (mintingFinished) {
finishMinting();
}
if (transferEnabled) {
enableTransfer();
}
}
/**
* @return if minting is finished or not.
*/
function mintingFinished() public view returns (bool) {
return _mintingFinished;
}
/**
* @return if transfer is enabled or not.
*/
function transferEnabled() public view returns (bool) {
return _transferEnabled;
}
/**
* @dev Function to mint tokens.
* @param to The address that will receive the minted tokens
* @param value The amount of tokens to mint
*/
function mint(address to, uint256 value) public canMint onlyMinter {
_mint(to, value);
}
/**
* @dev Transfer tokens to a specified address.
* @param to The address to transfer to
* @param value The amount to be transferred
* @return A boolean that indicates if the operation was successful.
*/
function transfer(address to, uint256 value)
public
virtual
override(ERC20)
canTransfer(_msgSender())
returns (bool)
{
return super.transfer(to, value);
}
/**
* @dev Transfer tokens from one address to another.
* @param from The address which you want to send tokens from
* @param to The address which you want to transfer to
* @param value the amount of tokens to be transferred
* @return A boolean that indicates if the operation was successful.
*/
function transferFrom(
address from,
address to,
uint256 value
) public virtual override(ERC20) canTransfer(from) returns (bool) {
return super.transferFrom(from, to, value);
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() public canMint onlyOwner {
_mintingFinished = true;
emit MintFinished();
}
/**
* @dev Function to enable transfers.
*/
function enableTransfer() public onlyOwner {
_transferEnabled = true;
emit TransferEnabled();
}
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Capped) {
super._beforeTokenTransfer(from, to, amount);
}
}
| 4,364 |
9 | // make seperate contract | function createAppointment(Appointment calldata appointment)
external
payable
| function createAppointment(Appointment calldata appointment)
external
payable
| 17,477 |
253 | // owner set a new address for signature verification | function setVerifySigner(address _verifySigner) external virtual onlyOwner {
verifySigner = _verifySigner;
emit ContractUpdated("verifySigner");
}
| function setVerifySigner(address _verifySigner) external virtual onlyOwner {
verifySigner = _verifySigner;
emit ContractUpdated("verifySigner");
}
| 40,947 |
5 | // Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation./ See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| 17,072 |
11 | // getOwner | function go_() external view isOwnerOrManager returns (address) {
return owner;
}
| function go_() external view isOwnerOrManager returns (address) {
return owner;
}
| 35,261 |
14 | // Launch and retire the founder / | function launch() public {
require(msg.sender == founder);
launched = block.timestamp;
founder = 0x0;
}
| function launch() public {
require(msg.sender == founder);
launched = block.timestamp;
founder = 0x0;
}
| 8,045 |
33 | // Assigns a new address to act as the Admin. Only available to the current Admin./_newAdminAddress The address of the new Admin | function setAdmin(address _newAdminAddress) public onlyAdmin {
require(_newAdminAddress != address(0));
adminAddress = _newAdminAddress;
}
| function setAdmin(address _newAdminAddress) public onlyAdmin {
require(_newAdminAddress != address(0));
adminAddress = _newAdminAddress;
}
| 41,976 |
44 | // only IRN Nodes can call, otherwise throw | modifier onlyIRNNode() {
require(network[msg.sender].isIRNNode, "must be an irn node");
_;
}
| modifier onlyIRNNode() {
require(network[msg.sender].isIRNNode, "must be an irn node");
_;
}
| 16,175 |
124 | // Address of a gambler, used to pay out winning bets. | address payable gambler;
| address payable gambler;
| 18,040 |
58 | // | constructor () ERC20("CZ PEPE", "CZPEPE") {
totalsupply_ = 100000000000000 * 10**9;
_mint(_msgSender(), totalsupply_);
}
| constructor () ERC20("CZ PEPE", "CZPEPE") {
totalsupply_ = 100000000000000 * 10**9;
_mint(_msgSender(), totalsupply_);
}
| 26,012 |
16 | // make sure that the variable is of storage type because we need a reference | Poll storage poll = polls[pollId];
| Poll storage poll = polls[pollId];
| 22 |
140 | // User will always withdraw everything available | function withdraw()
external
| function withdraw()
external
| 33,558 |
1 | // The address of an oracle - you can find node addresses on https:market.link/search/nodes | address ORACLE_ADDRESS = 0xB36d3709e22F7c708348E225b20b13eA546E6D9c;
| address ORACLE_ADDRESS = 0xB36d3709e22F7c708348E225b20b13eA546E6D9c;
| 19,567 |
27 | // 3pool | uint256[3] calldata amounts,
uint256 min_mint_amount
) external payable;
function add_liquidity(
| uint256[3] calldata amounts,
uint256 min_mint_amount
) external payable;
function add_liquidity(
| 39,304 |
366 | // Deletes a sponsor's position and updates global counters. Does not make any external transfers. | function _deleteSponsorPosition(address sponsor) internal returns (FixedPoint.Unsigned memory) {
PositionData storage positionToLiquidate = _getPositionData(sponsor);
FixedPoint.Unsigned memory startingGlobalCollateral = _getFeeAdjustedCollateral(rawTotalPositionCollateral);
// Remove the collateral and outstanding from the overall total position.
FixedPoint.Unsigned memory remainingRawCollateral = positionToLiquidate.rawCollateral;
rawTotalPositionCollateral = rawTotalPositionCollateral.sub(remainingRawCollateral);
totalTokensOutstanding = totalTokensOutstanding.sub(positionToLiquidate.tokensOutstanding);
// Reset the sponsors position to have zero outstanding and collateral.
delete positions[sponsor];
emit EndedSponsorPosition(sponsor);
// Return fee-adjusted amount of collateral deleted from position.
return startingGlobalCollateral.sub(_getFeeAdjustedCollateral(rawTotalPositionCollateral));
}
| function _deleteSponsorPosition(address sponsor) internal returns (FixedPoint.Unsigned memory) {
PositionData storage positionToLiquidate = _getPositionData(sponsor);
FixedPoint.Unsigned memory startingGlobalCollateral = _getFeeAdjustedCollateral(rawTotalPositionCollateral);
// Remove the collateral and outstanding from the overall total position.
FixedPoint.Unsigned memory remainingRawCollateral = positionToLiquidate.rawCollateral;
rawTotalPositionCollateral = rawTotalPositionCollateral.sub(remainingRawCollateral);
totalTokensOutstanding = totalTokensOutstanding.sub(positionToLiquidate.tokensOutstanding);
// Reset the sponsors position to have zero outstanding and collateral.
delete positions[sponsor];
emit EndedSponsorPosition(sponsor);
// Return fee-adjusted amount of collateral deleted from position.
return startingGlobalCollateral.sub(_getFeeAdjustedCollateral(rawTotalPositionCollateral));
}
| 34,905 |
27 | // Do not allow staking over occupied planets, they are going to zero at some point though | require(planetUpdate.owner == player, "OCCUPIED");
| require(planetUpdate.owner == player, "OCCUPIED");
| 23,218 |
0 | // declaring 50% chance, (0.5(uint256+1)) | uint256 constant half = 57896044618658097711785492504343953926634992332820282019728792003956564819968;
uint256 public randomResult;
mapping(uint256 => Game) public games;
event Withdraw(address admin, uint256 amount);
event Received(address indexed sender, uint256 amount);
event Result(uint256 id, uint256 bet, uint256 randomSeed, uint256 amount, address player, uint256 winAmount, uint256 randomResult, uint256 time);
| uint256 constant half = 57896044618658097711785492504343953926634992332820282019728792003956564819968;
uint256 public randomResult;
mapping(uint256 => Game) public games;
event Withdraw(address admin, uint256 amount);
event Received(address indexed sender, uint256 amount);
event Result(uint256 id, uint256 bet, uint256 randomSeed, uint256 amount, address player, uint256 winAmount, uint256 randomResult, uint256 time);
| 37,845 |
4 | // The Ownable constructor sets the original `owner` of the contract to the sender account./ | constructor() public {
_owner = msg.sender;
_operator = msg.sender;
emit OwnershipTransferred(address(0), _owner);
emit OperatorTransferred(address(0), _operator);
}
| constructor() public {
_owner = msg.sender;
_operator = msg.sender;
emit OwnershipTransferred(address(0), _owner);
emit OperatorTransferred(address(0), _operator);
}
| 25,213 |
16 | // Hardcaps & Softcaps | uint Hardcap = 100000;
uint Softcap = 10000;
| uint Hardcap = 100000;
uint Softcap = 10000;
| 12,636 |
12 | // tier pop | function populateTierTokens() public {
require((msg.sender == owner) && (initialTiers == false));
scheduleTokens[1] = 5.33696E18;
scheduleTokens[2] = 7.69493333E18;
scheduleTokens[3] = 4.75684324E18;
scheduleTokens[4] = 6.30846753E18;
scheduleTokens[5] = 6.21620513E18;
scheduleTokens[6] = 5.63157219E18;
scheduleTokens[7] = 5.80023669E18;
scheduleTokens[8] = 5.04458667E18;
scheduleTokens[9] = 4.58042767E18;
scheduleTokens[10] = 5E18;
scheduleTokens[11] = 5.59421053E18;
scheduleTokens[12] = 7.05050888E18;
scheduleTokens[13] = 1.93149011E19;
scheduleTokens[14] = 5.71055924E18;
scheduleTokens[15] = 1.087367665E19;
scheduleTokens[16] = 5.4685283E18;
scheduleTokens[17] = 7.58236145E18;
scheduleTokens[18] = 5.80773184E18;
scheduleTokens[19] = 4.74868639E18;
scheduleTokens[20] = 6.74810256E18;
scheduleTokens[21] = 5.52847682E18;
scheduleTokens[22] = 4.96611055E18;
scheduleTokens[23] = 5.45818182E18;
scheduleTokens[24] = 8.0597095E18;
scheduleTokens[25] = 1.459911381E19;
scheduleTokens[26] = 8.32598844E18;
scheduleTokens[27] = 4.555277509E19;
scheduleTokens[28] = 1.395674359E19;
scheduleTokens[29] = 9.78908515E18;
scheduleTokens[30] = 1.169045087E19;
}
| function populateTierTokens() public {
require((msg.sender == owner) && (initialTiers == false));
scheduleTokens[1] = 5.33696E18;
scheduleTokens[2] = 7.69493333E18;
scheduleTokens[3] = 4.75684324E18;
scheduleTokens[4] = 6.30846753E18;
scheduleTokens[5] = 6.21620513E18;
scheduleTokens[6] = 5.63157219E18;
scheduleTokens[7] = 5.80023669E18;
scheduleTokens[8] = 5.04458667E18;
scheduleTokens[9] = 4.58042767E18;
scheduleTokens[10] = 5E18;
scheduleTokens[11] = 5.59421053E18;
scheduleTokens[12] = 7.05050888E18;
scheduleTokens[13] = 1.93149011E19;
scheduleTokens[14] = 5.71055924E18;
scheduleTokens[15] = 1.087367665E19;
scheduleTokens[16] = 5.4685283E18;
scheduleTokens[17] = 7.58236145E18;
scheduleTokens[18] = 5.80773184E18;
scheduleTokens[19] = 4.74868639E18;
scheduleTokens[20] = 6.74810256E18;
scheduleTokens[21] = 5.52847682E18;
scheduleTokens[22] = 4.96611055E18;
scheduleTokens[23] = 5.45818182E18;
scheduleTokens[24] = 8.0597095E18;
scheduleTokens[25] = 1.459911381E19;
scheduleTokens[26] = 8.32598844E18;
scheduleTokens[27] = 4.555277509E19;
scheduleTokens[28] = 1.395674359E19;
scheduleTokens[29] = 9.78908515E18;
scheduleTokens[30] = 1.169045087E19;
}
| 67,138 |
187 | // Emit TokensUnlocked | emit TokensUnlocked(msg.sender, tokenLocked);
| emit TokensUnlocked(msg.sender, tokenLocked);
| 51,538 |
83 | // Two different getReward functions are needed because of delegateCall and msg.sender issues (important for migration) | function getReward() external nonReentrant returns (uint256) {
require(rewardsCollectionPaused == false,"Rewards collection paused");
return _getReward(msg.sender, msg.sender);
}
| function getReward() external nonReentrant returns (uint256) {
require(rewardsCollectionPaused == false,"Rewards collection paused");
return _getReward(msg.sender, msg.sender);
}
| 82,564 |
37 | // Called when `_owner` sends ether to the MiniMe Token contract/_owner The address that sent the ether to create tokens/ return True if the ether is accepted, false if it throws | function proxyPayment(address _owner) external payable returns(bool);
| function proxyPayment(address _owner) external payable returns(bool);
| 25,379 |
114 | // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and then delete the last slot (swap and pop). |
uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
uint256 tokenIndex = _ownedTokensIndex[tokenId];
|
uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
uint256 tokenIndex = _ownedTokensIndex[tokenId];
| 4,144 |
284 | // the stablecoin pool contract / | interface IStableSwap3Pool {
function exchange(
int128 i,
int128 j,
uint256 dx,
uint256 min_dy // solhint-disable-line func-param-name-mixedcase
) external;
function coins(uint256 coin) external view returns (address);
// solhint-disable-next-line func-name-mixedcase
function get_dy(
int128 i,
int128 j,
uint256 dx
) external view returns (uint256);
}
| interface IStableSwap3Pool {
function exchange(
int128 i,
int128 j,
uint256 dx,
uint256 min_dy // solhint-disable-line func-param-name-mixedcase
) external;
function coins(uint256 coin) external view returns (address);
// solhint-disable-next-line func-name-mixedcase
function get_dy(
int128 i,
int128 j,
uint256 dx
) external view returns (uint256);
}
| 44,021 |
433 | // Get an item from withdrawal request-chain./index The 0-based index of the request/ return accumulatedHash See @Request/ return accumulatedFeeSee @Request/ return timestamp See @Request | function getWithdrawRequest(
uint index
)
external
view
returns (
bytes32 accumulatedHash,
uint accumulatedFee,
uint32 timestamp
);
| function getWithdrawRequest(
uint index
)
external
view
returns (
bytes32 accumulatedHash,
uint accumulatedFee,
uint32 timestamp
);
| 28,734 |
29 | // Returns the square root of a number. It the number is not a perfect square, the value is rounded down. Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). / | function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`.
// We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
// This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
// Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
// good first aproximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1;
uint256 x = a;
if (x >> 128 > 0) {
x >>= 128;
result <<= 64;
}
if (x >> 64 > 0) {
x >>= 64;
result <<= 32;
}
if (x >> 32 > 0) {
x >>= 32;
result <<= 16;
}
if (x >> 16 > 0) {
x >>= 16;
result <<= 8;
}
if (x >> 8 > 0) {
x >>= 8;
result <<= 4;
}
if (x >> 4 > 0) {
x >>= 4;
result <<= 2;
}
if (x >> 2 > 0) {
result <<= 1;
}
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
| function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`.
// We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
// This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
// Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
// good first aproximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1;
uint256 x = a;
if (x >> 128 > 0) {
x >>= 128;
result <<= 64;
}
if (x >> 64 > 0) {
x >>= 64;
result <<= 32;
}
if (x >> 32 > 0) {
x >>= 32;
result <<= 16;
}
if (x >> 16 > 0) {
x >>= 16;
result <<= 8;
}
if (x >> 8 > 0) {
x >>= 8;
result <<= 4;
}
if (x >> 4 > 0) {
x >>= 4;
result <<= 2;
}
if (x >> 2 > 0) {
result <<= 1;
}
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
| 18,592 |
121 | // Someone claims rewards for a PoolMember in a given group of epochs in all feeHandlers. It will transfer rewards where epoch->feeHandler has been claimed by the pool and not yet by the member. This contract will keep locked remainings from rounding at a wei level. _epochGroup An array of epochs for which rewards are being claimed _poolMember PoolMember address to claim rewards for / | function claimRewardsMember(
address _poolMember,
uint256[] memory _epochGroup
| function claimRewardsMember(
address _poolMember,
uint256[] memory _epochGroup
| 87,348 |
51 | // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have `msb(a) <= a < 2msb(a)`. This value can be written `msb(a)=2k` with `k=log2(a)`. This can be rewritten `2log2(a) <= a < 2(log2(a) + 1)` → `sqrt(2k) <= sqrt(a) < sqrt(2(k+1))` → `2(k/2) <= sqrt(a) < 2((k+1)/2) <= 2(k/2 + 1)` Consequently, `2(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. | uint256 result = 1 << (log2(a) >> 1);
| uint256 result = 1 << (log2(a) >> 1);
| 437 |
2 | // stake token for miner | function deposit(uint256 _amount) external;
| function deposit(uint256 _amount) external;
| 20,913 |
16 | // Set access control roles | _setupRole(DEFAULT_ADMIN_ROLE, _admin);
| _setupRole(DEFAULT_ADMIN_ROLE, _admin);
| 29,013 |
2 | // Encode it | ret = new bytes(count + 4);
assembly {
mstore(add(ret, 32), selector)
}
| ret = new bytes(count + 4);
assembly {
mstore(add(ret, 32), selector)
}
| 21,916 |
114 | // if no one voted for an epoch (like epoch 0), no one gets rewards - should burn it./ Will move the epoch reward amount to burn amount. So can later be burned./ calls kyberDao contract to check if there were any votes for this epoch./epoch epoch number to check. | function makeEpochRewardBurnable(uint256 epoch) external {
require(kyberDao != IKyberDao(0), "kyberDao not set");
require(kyberDao.shouldBurnRewardForEpoch(epoch), "should not burn reward");
uint256 rewardAmount = rewardsPerEpoch[epoch];
require(rewardAmount > 0, "reward is 0");
// redundant check, can't happen
require(totalPayoutBalance >= rewardAmount, "total reward less than epoch reward");
totalPayoutBalance = totalPayoutBalance.sub(rewardAmount);
rewardsPerEpoch[epoch] = 0;
emit RewardsRemovedToBurn(epoch, rewardAmount);
}
| function makeEpochRewardBurnable(uint256 epoch) external {
require(kyberDao != IKyberDao(0), "kyberDao not set");
require(kyberDao.shouldBurnRewardForEpoch(epoch), "should not burn reward");
uint256 rewardAmount = rewardsPerEpoch[epoch];
require(rewardAmount > 0, "reward is 0");
// redundant check, can't happen
require(totalPayoutBalance >= rewardAmount, "total reward less than epoch reward");
totalPayoutBalance = totalPayoutBalance.sub(rewardAmount);
rewardsPerEpoch[epoch] = 0;
emit RewardsRemovedToBurn(epoch, rewardAmount);
}
| 11,909 |
5 | // Enable or disable the ability of `metaTransactionProcessor` to perform meta-tx (metaTransactionProcessor rights)./metaTransactionProcessor address that will be given/removed metaTransactionProcessor rights./enabled set whether the metaTransactionProcessor is enabled or disabled. | function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {
require(
msg.sender == _admin,
"only admin can setup metaTransactionProcessors"
);
_metaTransactionContracts[metaTransactionProcessor] = enabled;
emit MetaTransactionProcessor(metaTransactionProcessor, enabled);
}
| function setMetaTransactionProcessor(address metaTransactionProcessor, bool enabled) external {
require(
msg.sender == _admin,
"only admin can setup metaTransactionProcessors"
);
_metaTransactionContracts[metaTransactionProcessor] = enabled;
emit MetaTransactionProcessor(metaTransactionProcessor, enabled);
}
| 43,624 |
32 | // Update the total borrows based on the proportional rate of interest applied to the entire system | totalBorrowed = totalBorrowed.mul(borrowIndex).div(BASE);
| totalBorrowed = totalBorrowed.mul(borrowIndex).div(BASE);
| 49,868 |
1 | // lottoTimestamp => participants | mapping(uint256 => address[]) public lottoParticipants;
| mapping(uint256 => address[]) public lottoParticipants;
| 5,120 |
79 | // Allows the owner to complete the two-step ownership handover to `pendingOwner`./ Reverts if there is no existing ownership handover requested by `pendingOwner`. | function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
let handoverSlot := keccak256(0x0c, 0x20)
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
// Set the handover slot to 0.
sstore(handoverSlot, 0)
}
_setOwner(pendingOwner);
}
| function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
let handoverSlot := keccak256(0x0c, 0x20)
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
// Set the handover slot to 0.
sstore(handoverSlot, 0)
}
_setOwner(pendingOwner);
}
| 20,903 |
12 | // AcceptGame struct type encoding per EIP 712keccak256("AcceptGame(uint256 bet,bool isHost,address opponentAddress,bytes32 hashOfMySecret,bytes32 hashOfOpponentSecret)") / | bytes32 private constant ACCEPTGAME_TYPEHASH = 0x5ceee84403c984fbd9fb4ebf11b09c4f28f87290116c8b7f24a3e2a89d26588f;
| bytes32 private constant ACCEPTGAME_TYPEHASH = 0x5ceee84403c984fbd9fb4ebf11b09c4f28f87290116c8b7f24a3e2a89d26588f;
| 31,996 |
115 | // Returns the stake of the specified stake owner (excluding unstaked tokens)./_stakeOwner address The address to check./ return uint256 The total stake. | function getStakeBalanceOf(address _stakeOwner) external view returns (uint256);
| function getStakeBalanceOf(address _stakeOwner) external view returns (uint256);
| 43,032 |
52 | // disperse dividends among holders | profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
| profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
| 19,761 |
12 | // And Send 0.5 USDT to Target | currency.transfer(ERC721BaseInternal._ownerOf(targetId), 500000);
Settings storage x = getSettings();
x.contractERCBalance = x.contractERCBalance + 1000000;
emit Admired(invokerId, targetId);
| currency.transfer(ERC721BaseInternal._ownerOf(targetId), 500000);
Settings storage x = getSettings();
x.contractERCBalance = x.contractERCBalance + 1000000;
emit Admired(invokerId, targetId);
| 27,636 |
29 | // Fail if the sender code does not match | require(calculatedPaymentCode == paymentCode);
| require(calculatedPaymentCode == paymentCode);
| 24,776 |
18 | // Not whitelisted | error NotWhitelisted();
| error NotWhitelisted();
| 24,447 |
35 | // Get locked item's attributes for return | address payable sender = items[_id].sender;
address token = items[_id].token;
uint256 amount = items[_id].amount;
uint256 uniqueNonce = items[_id].nonce;
| address payable sender = items[_id].sender;
address token = items[_id].token;
uint256 amount = items[_id].amount;
uint256 uniqueNonce = items[_id].nonce;
| 44,180 |
85 | // allows the configurator to update the loan to value of a reserve_reserve the address of the reserve_ltv the new loan to value/ | {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| 39,912 |
324 | // Works out the amount of interest and principal after a repayment is made. | function _processPayment(Loan memory loanBefore, uint payment) internal returns (Loan memory loanAfter) {
loanAfter = loanBefore;
if (payment > 0 && loanBefore.accruedInterest > 0) {
uint interestPaid = payment > loanBefore.accruedInterest ? loanBefore.accruedInterest : payment;
loanAfter.accruedInterest = loanBefore.accruedInterest.sub(interestPaid);
payment = payment.sub(interestPaid);
_payFees(interestPaid, loanBefore.currency);
}
// If there is more payment left after the interest, pay down the principal.
if (payment > 0) {
loanAfter.amount = loanBefore.amount.sub(payment);
// And get the manager to reduce the total long/short balance.
if (loanAfter.short) {
_manager().decrementShorts(loanAfter.currency, payment);
if (shortingRewards[loanAfter.currency] != address(0)) {
IShortingRewards(shortingRewards[loanAfter.currency]).withdraw(loanAfter.account, payment);
}
} else {
_manager().decrementLongs(loanAfter.currency, payment);
}
}
}
| function _processPayment(Loan memory loanBefore, uint payment) internal returns (Loan memory loanAfter) {
loanAfter = loanBefore;
if (payment > 0 && loanBefore.accruedInterest > 0) {
uint interestPaid = payment > loanBefore.accruedInterest ? loanBefore.accruedInterest : payment;
loanAfter.accruedInterest = loanBefore.accruedInterest.sub(interestPaid);
payment = payment.sub(interestPaid);
_payFees(interestPaid, loanBefore.currency);
}
// If there is more payment left after the interest, pay down the principal.
if (payment > 0) {
loanAfter.amount = loanBefore.amount.sub(payment);
// And get the manager to reduce the total long/short balance.
if (loanAfter.short) {
_manager().decrementShorts(loanAfter.currency, payment);
if (shortingRewards[loanAfter.currency] != address(0)) {
IShortingRewards(shortingRewards[loanAfter.currency]).withdraw(loanAfter.account, payment);
}
} else {
_manager().decrementLongs(loanAfter.currency, payment);
}
}
}
| 29,030 |
39 | // Tool to verify that a low level call to smart-contract was successful, and reverts if the target | * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
| * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
| 32,184 |
19 | // called by the owner on emergency, triggers stopped state | function emergencyStop() external onlyOwner {
stopped = true;
}
| function emergencyStop() external onlyOwner {
stopped = true;
}
| 33,111 |
78 | // See {ERC20-approve}. Requirements: - `spender` cannot be the zero address. / | function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 15,457 |
161 | // Selector of `log(string,uint256,address)`. | mstore(0x00, 0x1c7ec448)
mstore(0x20, 0x60)
mstore(0x40, p1)
mstore(0x60, p2)
writeString(0x80, p0)
| mstore(0x00, 0x1c7ec448)
mstore(0x20, 0x60)
mstore(0x40, p1)
mstore(0x60, p2)
writeString(0x80, p0)
| 30,513 |
19 | // remove pool | pools[_poolId] = pools[pools.length - 1];
pools.pop();
poolAdded[poolAddress] = false;
emit PoolRemoved(_poolId, poolAddress);
| pools[_poolId] = pools[pools.length - 1];
pools.pop();
poolAdded[poolAddress] = false;
emit PoolRemoved(_poolId, poolAddress);
| 29,767 |
45 | // Calculates the amount that has already vested. account address of the user / | function _vestedAmount(address account) internal view returns (uint256) {
VestedToken storage vested = vestedUser[account];
uint256 totalToken = vested.totalToken;
if(block.timestamp < vested.start + (vested.cliff)){
return 0;
}else if(block.timestamp >= vested.start+(vested.duration) || vested.revoked){
return totalToken;
}else{
uint256 numberOfPeriods = (block.timestamp - (vested.start))/(vested.cliff);
return (totalToken*(numberOfPeriods*(vested.cliff)))/(vested.duration);
}
}
| function _vestedAmount(address account) internal view returns (uint256) {
VestedToken storage vested = vestedUser[account];
uint256 totalToken = vested.totalToken;
if(block.timestamp < vested.start + (vested.cliff)){
return 0;
}else if(block.timestamp >= vested.start+(vested.duration) || vested.revoked){
return totalToken;
}else{
uint256 numberOfPeriods = (block.timestamp - (vested.start))/(vested.cliff);
return (totalToken*(numberOfPeriods*(vested.cliff)))/(vested.duration);
}
}
| 14,403 |
6 | // To get the followed hashtag names for this msg.sender/ return bytes32[] The hashtags followed by this user | function getFollowedHashtags() public view returns(bytes32[] memory) {
return subscribedHashtags[msg.sender];
}
| function getFollowedHashtags() public view returns(bytes32[] memory) {
return subscribedHashtags[msg.sender];
}
| 25,983 |
25 | // Decode the passed variables from the data object | (
| (
| 40,004 |
168 | // if _amountNeeded != withdrawnBal, then we have an error | if (_amountNeeded != withdrawnBal) {
uint256 assets = estimatedTotalAssets();
uint256 debt = vault.strategies(address(this)).totalDebt;
_loss = debt.sub(assets);
}
| if (_amountNeeded != withdrawnBal) {
uint256 assets = estimatedTotalAssets();
uint256 debt = vault.strategies(address(this)).totalDebt;
_loss = debt.sub(assets);
}
| 16,839 |
3 | // 50 slots were consumed by adding ReentrancyGuardUpgradeable | uint256[950] private ______gap;
| uint256[950] private ______gap;
| 43,527 |
139 | // check the address is registered for token sale | mapping (address => bool) public registeredAddress;
| mapping (address => bool) public registeredAddress;
| 81,342 |
269 | // distribute funds between owner, creator and adminThis function will transfer the funds from the contract, which must have previously sent to the contract, to the beneficiaries of the saleThe "false" parameter at the end means: do a simple transfer / | distributeFunds(qty * openOffers[tokenId][index].price, openOffers[tokenId][index].user, _msgSender(), tokenId, false);
| distributeFunds(qty * openOffers[tokenId][index].price, openOffers[tokenId][index].user, _msgSender(), tokenId, false);
| 31,179 |
137 | // Function to check how many tokens of this product are currently available for purchase,by taking the difference between max cap count and current token in circulation or burned. return availablethe number of tokens available/ | function getAvailability()
public view virtual returns (uint32 available)
{
return maxTokenCount - uint32(totalSupply()) - tradeinCount; // add safemath for uint32 later
}
| function getAvailability()
public view virtual returns (uint32 available)
{
return maxTokenCount - uint32(totalSupply()) - tradeinCount; // add safemath for uint32 later
}
| 57,713 |
111 | // uint256 supply = totalSupply(); | require( SaleActive, "Sale isn't active" );
require( _amount > 0 && _amount < 11, "Can only mint between 1 and 10 tokens at once" );
require( TokensMinted + _amount <= Max_Supply, "Can't mint more than max supply" );
require( msg.value == SalePrice * _amount, "Wrong amount of ETH sent" );
for(uint256 i; i < _amount; i++){
_safeMint( msg.sender, TokensMinted + i );
}
| require( SaleActive, "Sale isn't active" );
require( _amount > 0 && _amount < 11, "Can only mint between 1 and 10 tokens at once" );
require( TokensMinted + _amount <= Max_Supply, "Can't mint more than max supply" );
require( msg.value == SalePrice * _amount, "Wrong amount of ETH sent" );
for(uint256 i; i < _amount; i++){
_safeMint( msg.sender, TokensMinted + i );
}
| 44,570 |
74 | // Mapping owner address to token count | mapping(address => uint256) private _balances;
| mapping(address => uint256) private _balances;
| 40,928 |
8 | // required for the claimed ether to be transfered here | function() public payable { }
function claim(address race) external
_validRace(race) {
BettingInterface raceContract = BettingInterface(race);
if(!ClaimedRaces[race]) {
toDistributeRace[race] = raceContract.checkReward();
raceContract.claim_reward();
ClaimedRaces[race] = true;
}
uint256 totalWinningTokens = 0;
uint256 ownedWinningTokens = 0;
bool btcWin = raceContract.winner_horse(bytes32("BTC"));
bool ltcWin = raceContract.winner_horse(bytes32("LTC"));
bool ethWin = raceContract.winner_horse(bytes32("ETH"));
if(btcWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("BTC")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("BTC")];
ClaimTokens[msg.sender][race][bytes32("BTC")] = 0;
}
if(ltcWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("LTC")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("LTC")];
ClaimTokens[msg.sender][race][bytes32("LTC")] = 0;
}
if(ethWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("ETH")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("ETH")];
ClaimTokens[msg.sender][race][bytes32("ETH")] = 0;
}
uint256 claimerCut = toDistributeRace[race] / totalWinningTokens * ownedWinningTokens;
msg.sender.transfer(claimerCut);
emit Claimed(race, claimerCut);
}
| function() public payable { }
function claim(address race) external
_validRace(race) {
BettingInterface raceContract = BettingInterface(race);
if(!ClaimedRaces[race]) {
toDistributeRace[race] = raceContract.checkReward();
raceContract.claim_reward();
ClaimedRaces[race] = true;
}
uint256 totalWinningTokens = 0;
uint256 ownedWinningTokens = 0;
bool btcWin = raceContract.winner_horse(bytes32("BTC"));
bool ltcWin = raceContract.winner_horse(bytes32("LTC"));
bool ethWin = raceContract.winner_horse(bytes32("ETH"));
if(btcWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("BTC")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("BTC")];
ClaimTokens[msg.sender][race][bytes32("BTC")] = 0;
}
if(ltcWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("LTC")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("LTC")];
ClaimTokens[msg.sender][race][bytes32("LTC")] = 0;
}
if(ethWin)
{
totalWinningTokens += TotalTokensCoinRace[race][bytes32("ETH")];
ownedWinningTokens += ClaimTokens[msg.sender][race][bytes32("ETH")];
ClaimTokens[msg.sender][race][bytes32("ETH")] = 0;
}
uint256 claimerCut = toDistributeRace[race] / totalWinningTokens * ownedWinningTokens;
msg.sender.transfer(claimerCut);
emit Claimed(race, claimerCut);
}
| 38,327 |
270 | // A structure for planet info | struct PlanetInfo {
string name;
uint256 radius;
}
| struct PlanetInfo {
string name;
uint256 radius;
}
| 44,284 |
10 | // immutable function example | function example() public pure returns (string memory) {
return "THIS IS AN EXAMPLE OF AN IMMUTABLE FUNCTION";
}
| function example() public pure returns (string memory) {
return "THIS IS AN EXAMPLE OF AN IMMUTABLE FUNCTION";
}
| 35,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.