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
72
// Getter for the total number of controllersreturn Total number of controllers /
function getTotalControllers() public view returns (uint256) { return controllerList.length; }
function getTotalControllers() public view returns (uint256) { return controllerList.length; }
50,225
42
// Function addmultiple whiteListedAddresses to the vesting contract _whiteListedAddresses Array of whiteListedAddress addresses. The array length should be less than 230, otherwise it will overflow the gas limit _withdrawPercentages Corresponding percentages of the whiteListedAddresses /
function addMultipleWhiteListedAddresses( address[] memory _whiteListedAddresses, uint256[] memory _withdrawPercentages
function addMultipleWhiteListedAddresses( address[] memory _whiteListedAddresses, uint256[] memory _withdrawPercentages
32,878
129
// Include an address to specify the WitnetRequestBoard._wrb WitnetRequestBoard address./
constructor(address _wrb) { wrb = WitnetRequestBoardInterface(_wrb); }
constructor(address _wrb) { wrb = WitnetRequestBoardInterface(_wrb); }
59,805
411
// If in the past, this was the voting round where this price was resolved. If current or the upcoming round, this is the voting round where this price will be voted on, but not necessarily resolved.
uint256 lastVotingRound;
uint256 lastVotingRound;
51,798
146
// Get owner's address of the manager contract return The address of owner/
function getOwner() public view returns (address)
function getOwner() public view returns (address)
59,223
0
// The root of the MerkleTree /
bytes32 public merkleRoot;
bytes32 public merkleRoot;
1,365
318
// square root of a UQ112x112
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56)); }
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56)); }
33,337
170
// Calculates EIP712 encoding for a hash struct with a given domain hash./eip712DomainHash Hash of the domain domain separator data, computed/ with getDomainHash()./hashStruct The EIP712 hash struct./ return EIP712 hash applied to the given EIP712 Domain.
function hashEIP712Message(bytes32 eip712DomainHash, bytes32 hashStruct) internal pure returns (bytes32 result)
function hashEIP712Message(bytes32 eip712DomainHash, bytes32 hashStruct) internal pure returns (bytes32 result)
31,724
21
// Enforces that the passed timestamp is within signatureTimeout seconds of now./timestamp The timestamp to check the validity of.
modifier ensureSignatureTimeValid(uint timestamp) { require( // solium-disable-next-line security/no-block-members block.timestamp >= timestamp && block.timestamp < timestamp + signatureTimeout, "Timestamp is not valid." ); _; }
modifier ensureSignatureTimeValid(uint timestamp) { require( // solium-disable-next-line security/no-block-members block.timestamp >= timestamp && block.timestamp < timestamp + signatureTimeout, "Timestamp is not valid." ); _; }
30,201
74
// Add to the blacklist
slashed[_addr] = true;
slashed[_addr] = true;
41,290
12
// withdraw any matic
function withdraw() public onlyOwner { payable(msg.sender).transfer(address(this).balance); }
function withdraw() public onlyOwner { payable(msg.sender).transfer(address(this).balance); }
19,797
57
// Transfer many tokens between 2 addresses ensuring the receiving contract has a receiver method from The sender of the token to The recipient of the token ids The ids of the tokens data additional data/
function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external { _batchTransferFrom(from, to, ids, data, true); }
function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, bytes calldata data) external { _batchTransferFrom(from, to, ids, data, true); }
51,378
9
// remove an address from the whitelist_account address return true if the address was removed from the whitelist, false if the address wasn't already in the whitelist/
// function removeAddressFromWhitelist(address _account) public onlyCapper returns (bool) { // require(_account != address(0)); // _whitelist[_account] = 0; // return isWhitelisted(_account); // }
// function removeAddressFromWhitelist(address _account) public onlyCapper returns (bool) { // require(_account != address(0)); // _whitelist[_account] = 0; // return isWhitelisted(_account); // }
26,947
29
// trusted call to send posterity fee
(bool feeSuccess, ) = POSTERITY_WALLET.call{ value: feePerToken * _numberOfTokens }("");
(bool feeSuccess, ) = POSTERITY_WALLET.call{ value: feePerToken * _numberOfTokens }("");
19,097
464
// Withdraw CV tokens from CV token staking.
function leaveStaking(uint256 amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][_msgSender()]; require(user.amount >= amount, "don't have CV token enough to withdraw"); updatePool(0); uint256 pending = (user.amount * pool.accCVTokenPerShare / ACC_CV_TOKEN_PRECISION) - (user.rewardDebt); if(pending > 0) { _cvToken.mint(_msgSender(), _devAddr, pending); } if(amount > 0) { user.amount -= amount; pool.lpToken.safeTransfer(address(_msgSender()), amount); } user.rewardDebt = user.amount * pool.accCVTokenPerShare / ACC_CV_TOKEN_PRECISION; emit Withdraw(_msgSender(), 0, amount); }
function leaveStaking(uint256 amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][_msgSender()]; require(user.amount >= amount, "don't have CV token enough to withdraw"); updatePool(0); uint256 pending = (user.amount * pool.accCVTokenPerShare / ACC_CV_TOKEN_PRECISION) - (user.rewardDebt); if(pending > 0) { _cvToken.mint(_msgSender(), _devAddr, pending); } if(amount > 0) { user.amount -= amount; pool.lpToken.safeTransfer(address(_msgSender()), amount); } user.rewardDebt = user.amount * pool.accCVTokenPerShare / ACC_CV_TOKEN_PRECISION; emit Withdraw(_msgSender(), 0, amount); }
41,958
195
// allows for verified claim mint against a single tokenID. Must be owned by the ownerthis mint action allows the original NFT to remain in the holders wallet, but its claim is logged.tokenId the token to be redeemed.
* Emits a {VerifiedClaim} event. **/ function verifedClaim(address redemptionContract, uint256 tokenId) public payable { if(getNextTokenId() > collectionSize) revert CapExceeded(); if(!verifiedClaimModeEnabled) revert ClaimModeDisabled(); if(redemptionContract == address(0)) revert CannotBeNullAddress(); if(!redemptionContracts[redemptionContract]) revert IneligibleRedemptionContract(); if(msg.value != redemptionSurcharge) revert InvalidPayment(); if(tokenRedemptions[redemptionContract][tokenId]) revert TokenAlreadyRedeemed(); tokenRedemptions[redemptionContract][tokenId] = true; emit VerifiedClaim(_msgSender(), tokenId, redemptionContract); _safeMint(_msgSender(), 1, false); }
* Emits a {VerifiedClaim} event. **/ function verifedClaim(address redemptionContract, uint256 tokenId) public payable { if(getNextTokenId() > collectionSize) revert CapExceeded(); if(!verifiedClaimModeEnabled) revert ClaimModeDisabled(); if(redemptionContract == address(0)) revert CannotBeNullAddress(); if(!redemptionContracts[redemptionContract]) revert IneligibleRedemptionContract(); if(msg.value != redemptionSurcharge) revert InvalidPayment(); if(tokenRedemptions[redemptionContract][tokenId]) revert TokenAlreadyRedeemed(); tokenRedemptions[redemptionContract][tokenId] = true; emit VerifiedClaim(_msgSender(), tokenId, redemptionContract); _safeMint(_msgSender(), 1, false); }
16,332
23
// Returns total lock count, regardless of whether it has been unlocked or not
return _locks.length;
return _locks.length;
38,185
11
// =============== QUERY FUNCTIONS =============== /
function lastBatchNonce(address _erc20Address) public view returns (uint256) { return state_lastBatchNonces[_erc20Address]; }
function lastBatchNonce(address _erc20Address) public view returns (uint256) { return state_lastBatchNonces[_erc20Address]; }
45,831
45
// implement the EIP 2981 functions
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual returns (address, uint256)
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual returns (address, uint256)
22,963
45
// Performs a call to purchase an ERC1155, then transfers the ERC1155 to a specified recipient/inputs The inputs for the protocol and ERC1155 transfer, encoded/protocol The protocol to pass the calldata to/ return success True on success of the command, false on failure/ return output The outputs or error messages, if any, from the command
function callAndTransfer1155(bytes calldata inputs, address protocol) internal returns (bool success, bytes memory output)
function callAndTransfer1155(bytes calldata inputs, address protocol) internal returns (bool success, bytes memory output)
23,326
156
// Shed/
{ DiamondStorage storage ds = diamondStorage(); address[] memory path = new address[](2); path[0] = ds.bean; path[1] = ds.weth; uint[] memory amounts = IUniswapV2Router02(ds.router).swapExactTokensForTokens( sellBeanAmount, minBuyEthAmount, path, to, block.timestamp.add(1) ); return (amounts[0], amounts[1]); }
{ DiamondStorage storage ds = diamondStorage(); address[] memory path = new address[](2); path[0] = ds.bean; path[1] = ds.weth; uint[] memory amounts = IUniswapV2Router02(ds.router).swapExactTokensForTokens( sellBeanAmount, minBuyEthAmount, path, to, block.timestamp.add(1) ); return (amounts[0], amounts[1]); }
9,220
11
// The enum for launching `ValidationError` events and mapping them to an error. /
enum Errors { InsufficientEndowment, ReservedWindowBiggerThanExecutionWindow, InvalidTemporalUnit, ExecutionWindowTooSoon, CallGasTooHigh, EmptyToAddress }
enum Errors { InsufficientEndowment, ReservedWindowBiggerThanExecutionWindow, InvalidTemporalUnit, ExecutionWindowTooSoon, CallGasTooHigh, EmptyToAddress }
33,594
3
// Update the status of the operator
function updateOperator(address _operator, bool _status) external onlyOwner { operators[_operator] = _status; emit OperatorUpdated(_operator, _status); }
function updateOperator(address _operator, bool _status) external onlyOwner { operators[_operator] = _status; emit OperatorUpdated(_operator, _status); }
31,130
64
// used to change the fee of the setup cost _newSetupCost new setup cost /
function changeFactorySetupFee(uint256 _newSetupCost) public onlyOwner { uint256 _oldSetupcost = setupCost; setupCost = _newSetupCost; emit LogChangeFactorySetupFee(_oldSetupcost, setupCost, address(this)); }
function changeFactorySetupFee(uint256 _newSetupCost) public onlyOwner { uint256 _oldSetupcost = setupCost; setupCost = _newSetupCost; emit LogChangeFactorySetupFee(_oldSetupcost, setupCost, address(this)); }
3,652
2
// Modifiers // /
modifier isNotPaused() { require(!settings().isPaused(), "PLATFORM_IS_PAUSED"); _; }
modifier isNotPaused() { require(!settings().isPaused(), "PLATFORM_IS_PAUSED"); _; }
47,691
6
// All tokens in a swap are either sent from the `sender` account to the Vault, or from the Vault to the`recipient` account. If the caller is not `sender`, it must be an authorized relayer for them. If `fromInternalBalance` is true, the `sender`'s Internal Balance will be preferred, performing an ERC20transfer for the difference between the requested amount and the User's Internal Balance (if any). The `sender`must have allowed the Vault to use their tokens via `IERC20.approve()`. This matches the behavior of`joinPool`. If `toInternalBalance` is true, tokens will be deposited to `recipient`'s internal balance instead oftransferred. This matches the behavior of
struct FundManagement { address sender; bool fromInternalBalance; address payable recipient; bool toInternalBalance; }
struct FundManagement { address sender; bool fromInternalBalance; address payable recipient; bool toInternalBalance; }
19,942
115
// Functions to Verify total rewards for safe and Risky rewards
function totalRewards() public view returns(uint256) ////Safe Staking
function totalRewards() public view returns(uint256) ////Safe Staking
18,083
17
// allows the option owner to claim proceeds if the option was settled/ by another account. The option NFT is burned after settlement./this mechanism prevents the proceeds from being sent to an account/ temporarily custodying the option asset./optionId the option to claim and burn.
function claimOptionProceeds(uint256 optionId) external;
function claimOptionProceeds(uint256 optionId) external;
39,624
25
// DELEGATED TRANSFER EVENTS
event BetaDelegatedTransfer( address indexed from, address indexed to, uint256 value, uint256 seq, uint256 fee ); event BetaDelegateWhitelisterSet( address indexed oldWhitelister, address indexed newWhitelister ); event BetaDelegateWhitelisted(address indexed newDelegate); event BetaDelegateUnwhitelisted(address indexed oldDelegate);
event BetaDelegatedTransfer( address indexed from, address indexed to, uint256 value, uint256 seq, uint256 fee ); event BetaDelegateWhitelisterSet( address indexed oldWhitelister, address indexed newWhitelister ); event BetaDelegateWhitelisted(address indexed newDelegate); event BetaDelegateUnwhitelisted(address indexed oldDelegate);
4,539
305
// Allow the ratio to move a bit in either direction to avoid cycles
uint256 currentRatio = getCurrentMakerVaultRatio(); if (currentRatio < collateralizationRatio.sub(rebalanceTolerance)) { _repayDebt(currentRatio); } else if (
uint256 currentRatio = getCurrentMakerVaultRatio(); if (currentRatio < collateralizationRatio.sub(rebalanceTolerance)) { _repayDebt(currentRatio); } else if (
69,448
12
// Update contract state.
claimCondition.supplyClaimed += _quantity; lastClaimTimestamp[activeConditionId][_dropMsgSender()] = block.timestamp;
claimCondition.supplyClaimed += _quantity; lastClaimTimestamp[activeConditionId][_dropMsgSender()] = block.timestamp;
52,188
16
// YFI Pool
poolVotingValueLeftBitRanges[0x70b83A7f5E83B3698d136887253E0bf426C9A117] = 10; poolVotingValueRightBitRanges[0x70b83A7f5E83B3698d136887253E0bf426C9A117] = 5;
poolVotingValueLeftBitRanges[0x70b83A7f5E83B3698d136887253E0bf426C9A117] = 10; poolVotingValueRightBitRanges[0x70b83A7f5E83B3698d136887253E0bf426C9A117] = 5;
83,600
454
// Duration of vesting penalty period
uint256 public duration = 86400; uint256 public vesting = duration * 90;
uint256 public duration = 86400; uint256 public vesting = duration * 90;
6,116
185
// Update the max transfer amount rate.Can only be called by the current operator. /
function updateMaxTransferAmountRate(uint16 _maxTransferAmountRate) public onlyOperator { require(_maxTransferAmountRate <= 10000, "FARMING::updateMaxTransferAmountRate: Max transfer amount rate must not exceed the maximum rate."); emit MaxTransferAmountRateUpdated(msg.sender, maxTransferAmountRate, _maxTransferAmountRate); maxTransferAmountRate = _maxTransferAmountRate; }
function updateMaxTransferAmountRate(uint16 _maxTransferAmountRate) public onlyOperator { require(_maxTransferAmountRate <= 10000, "FARMING::updateMaxTransferAmountRate: Max transfer amount rate must not exceed the maximum rate."); emit MaxTransferAmountRateUpdated(msg.sender, maxTransferAmountRate, _maxTransferAmountRate); maxTransferAmountRate = _maxTransferAmountRate; }
24,583
1
// if condition
require( campaign.deadline < block.timestamp, "The deadline should be date in future" ); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline;
require( campaign.deadline < block.timestamp, "The deadline should be date in future" ); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline;
33,575
11
// Intelligence random Genes
Gen( _generateRandomGen(INT_GEN_INDEX), // first gen _generateRandomGen(INT_GEN_INDEX), // second gen _generateRandomGen(INT_GEN_INDEX) // third gen ) );
Gen( _generateRandomGen(INT_GEN_INDEX), // first gen _generateRandomGen(INT_GEN_INDEX), // second gen _generateRandomGen(INT_GEN_INDEX) // third gen ) );
20,067
10
// Multi-Send the ETHs
for (uint256 i = 0; i < addresses_.length; i++) { _sendETH(addresses_[i], amounts_[i]); }
for (uint256 i = 0; i < addresses_.length; i++) { _sendETH(addresses_[i], amounts_[i]); }
45,703
6
// Fee recipeint for governance distributions.
address payable feeRecipient;
address payable feeRecipient;
26,293
20
// END Range Normal // Range Abnormal (overlapping) /
) private pure returns (uint256 total, AbnormalRangeInfo memory info) { for (uint64 i = 0; i < ranges.length; i++) { (bool e1, uint64[2] memory ele1) = _getElement(i, ranges); (bool e2, uint64[2] memory ele2) = _getElement(i + 1, ranges); if (e1 && e2) { if (info.startInit) info = _calculateAbnormalRangeEnd(i, v2, ele1, ele2, info); else info = _calculateAbnormalRange(i, v1, v2, ele1, ele2, info); } else if (e1) { if (info.startInit) info = _calculateAbnormalRange(i, v2, ele1, info); else info = _calculateAbnormalRange(i, v1, v2, ele1, info); } if (info.endInit) total = _calculateAbnormalRangeTotal(curCount, info); if (total > 0) return (total, info); } }
) private pure returns (uint256 total, AbnormalRangeInfo memory info) { for (uint64 i = 0; i < ranges.length; i++) { (bool e1, uint64[2] memory ele1) = _getElement(i, ranges); (bool e2, uint64[2] memory ele2) = _getElement(i + 1, ranges); if (e1 && e2) { if (info.startInit) info = _calculateAbnormalRangeEnd(i, v2, ele1, ele2, info); else info = _calculateAbnormalRange(i, v1, v2, ele1, ele2, info); } else if (e1) { if (info.startInit) info = _calculateAbnormalRange(i, v2, ele1, info); else info = _calculateAbnormalRange(i, v1, v2, ele1, info); } if (info.endInit) total = _calculateAbnormalRangeTotal(curCount, info); if (total > 0) return (total, info); } }
19,173
4
// Wraps arguments for challenging in-flight exit input spent inFlightTx RLP-encoded in-flight transaction inFlightTxInputIndex Index of spent input challengingTx RLP-encoded challenging transaction challengingTxInputIndex Index of spent input in a challenging transaction challengingTxWitness Witness for challenging transactions inputTx RLP-encoded input transaction inputUtxoPos UTXO position of input transaction's output senderData A keccak256 hash of the sender's address /
struct ChallengeInputSpentArgs { bytes inFlightTx; uint16 inFlightTxInputIndex; bytes challengingTx; uint16 challengingTxInputIndex; bytes challengingTxWitness; bytes inputTx; uint256 inputUtxoPos; bytes32 senderData; }
struct ChallengeInputSpentArgs { bytes inFlightTx; uint16 inFlightTxInputIndex; bytes challengingTx; uint16 challengingTxInputIndex; bytes challengingTxWitness; bytes inputTx; uint256 inputUtxoPos; bytes32 senderData; }
1,994
9
// "Consume a nonce": return the current value and increment. _Available since v4.1._ /
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
2,112
4
// block avg time 14,44
uint256 public constant oneweek = 41883; uint256 public constant oneday = 5983; uint256 public constant onehour = 248; uint256 public constant onemonth = 179501; uint256 public constant fourweeks= 167534; uint256 public fundingStartBlock = 4663338;// 02.12 18 UTC +2; //campaign aims 04.12 UTC 12
uint256 public constant oneweek = 41883; uint256 public constant oneday = 5983; uint256 public constant onehour = 248; uint256 public constant onemonth = 179501; uint256 public constant fourweeks= 167534; uint256 public fundingStartBlock = 4663338;// 02.12 18 UTC +2; //campaign aims 04.12 UTC 12
28,851
62
// transfer the entire pool's balance to a new wallet.
function emergencyWithdraw() external; /* onlyMigrationManager */
function emergencyWithdraw() external; /* onlyMigrationManager */
2,307
9
// Emitted when proposal threshold is set
event ProposalThresholdSet( uint256 oldProposalThreshold, uint256 newProposalThreshold );
event ProposalThresholdSet( uint256 oldProposalThreshold, uint256 newProposalThreshold );
24,379
56
// allows to register identities and change associated claims keccak256("IdentityManager")
bytes32 internal constant ROLE_IDENTITY_MANAGER = 0x32964e6bc50f2aaab2094a1d311be8bda920fc4fb32b2fb054917bdb153a9e9e;
bytes32 internal constant ROLE_IDENTITY_MANAGER = 0x32964e6bc50f2aaab2094a1d311be8bda920fc4fb32b2fb054917bdb153a9e9e;
26,934
8
// Initialize the transaction info
TranCount ++; Transactions[TranCount] = Transaction(TranCount, _address, new address[](100), _amount, now, 12, IR, true, 1000, 1); TranCountNum.push(TranCount);
TranCount ++; Transactions[TranCount] = Transaction(TranCount, _address, new address[](100), _amount, now, 12, IR, true, 1000, 1); TranCountNum.push(TranCount);
27,882
6
// TODO use a min-max and avoid revert this way ?
require(sale.spaceshipsLeftToSell > numSpaceships, "NOT_ENOUGH_ON_SALE");
require(sale.spaceshipsLeftToSell > numSpaceships, "NOT_ENOUGH_ON_SALE");
17,404
84
// enables owner to pause / unpause minting/
function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); }
function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); }
4,991
61
// Verify link signature is valid and unused V _currentAddress Address signing intention to link _addressToAdd Address being linked _nonce Unique nonce for this request _linkSignature Signature of address a /
function validateLinkSignature( address _currentAddress, address _addressToAdd, bytes32 _nonce, bytes _linkSignature
function validateLinkSignature( address _currentAddress, address _addressToAdd, bytes32 _nonce, bytes _linkSignature
18,366
41
// Interface for `RelayHub`, the core contract of the GSN. Users should not need to interact with this contractdirectly. how to deploy an instance of `RelayHub` on your local test network. /
contract IRelayHub { // Relay management /** * @dev Adds stake to a relay and sets its `unstakeDelay`. If the relay does not exist, it is created, and the caller * of this function becomes its owner. If the relay already exists, only the owner can call this function. A relay * cannot be its own owner. * * All Ether in this function call will be added to the relay's stake. * Its unstake delay will be assigned to `unstakeDelay`, but the new value must be greater or equal to the current one. * * Emits a {Staked} event. */ function stake(address relayaddr, uint256 unstakeDelay) external payable; /** * @dev Emitted when a relay's stake or unstakeDelay are increased */ event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); /** * @dev Registers the caller as a relay. * The relay must be staked for, and not be a contract (i.e. this function must be called directly from an EOA). * * This function can be called multiple times, emitting new {RelayAdded} events. Note that the received * `transactionFee` is not enforced by {relayCall}. * * Emits a {RelayAdded} event. */ function registerRelay(uint256 transactionFee, string memory url) public; /** * @dev Emitted when a relay is registered or re-registerd. Looking at these events (and filtering out * {RelayRemoved} events) lets a client discover the list of available relays. */ event RelayAdded(address indexed relay, address indexed owner, uint256 transactionFee, uint256 stake, uint256 unstakeDelay, string url); /** * @dev Removes (deregisters) a relay. Unregistered (but staked for) relays can also be removed. * * Can only be called by the owner of the relay. After the relay's `unstakeDelay` has elapsed, {unstake} will be * callable. * * Emits a {RelayRemoved} event. */ function removeRelayByOwner(address relay) public; /** * @dev Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable. */ event RelayRemoved(address indexed relay, uint256 unstakeTime); /** Deletes the relay from the system, and gives back its stake to the owner. * * Can only be called by the relay owner, after `unstakeDelay` has elapsed since {removeRelayByOwner} was called. * * Emits an {Unstaked} event. */ function unstake(address relay) public; /** * @dev Emitted when a relay is unstaked for, including the returned stake. */ event Unstaked(address indexed relay, uint256 stake); // States a relay can be in enum RelayState { Unknown, // The relay is unknown to the system: it has never been staked for Staked, // The relay has been staked for, but it is not yet active Registered, // The relay has registered itself, and is active (can relay calls) Removed // The relay has been removed by its owner and can no longer relay calls. It must wait for its unstakeDelay to elapse before it can unstake } /** * @dev Returns a relay's status. Note that relays can be deleted when unstaked or penalized, causing this function * to return an empty entry. */ function getRelay(address relay) external view returns (uint256 totalStake, uint256 unstakeDelay, uint256 unstakeTime, address payable owner, RelayState state); // Balance management /** * @dev Deposits Ether for a contract, so that it can receive (and pay for) relayed transactions. * * Unused balance can only be withdrawn by the contract itself, by calling {withdraw}. * * Emits a {Deposited} event. */ function depositFor(address target) public payable; /** * @dev Emitted when {depositFor} is called, including the amount and account that was funded. */ event Deposited(address indexed recipient, address indexed from, uint256 amount); /** * @dev Returns an account's deposits. These can be either a contracts's funds, or a relay owner's revenue. */ function balanceOf(address target) external view returns (uint256); /** * Withdraws from an account's balance, sending it back to it. Relay owners call this to retrieve their revenue, and * contracts can use it to reduce their funding. * * Emits a {Withdrawn} event. */ function withdraw(uint256 amount, address payable dest) public; /** * @dev Emitted when an account withdraws funds from `RelayHub`. */ event Withdrawn(address indexed account, address indexed dest, uint256 amount); // Relaying /** * @dev Checks if the `RelayHub` will accept a relayed operation. * Multiple things must be true for this to happen: * - all arguments must be signed for by the sender (`from`) * - the sender's nonce must be the current one * - the recipient must accept this transaction (via {acceptRelayedCall}) * * Returns a `PreconditionCheck` value (`OK` when the transaction can be relayed), or a recipient-specific error * code if it returns one in {acceptRelayedCall}. */ function canRelay( address relay, address from, address to, bytes memory encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce, bytes memory signature, bytes memory approvalData ) public view returns (uint256 status, bytes memory recipientContext); // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values. enum PreconditionCheck { OK, // All checks passed, the call can be relayed WrongSignature, // The transaction to relay is not signed by requested sender WrongNonce, // The provided nonce has already been used by the sender AcceptRelayedCallReverted, // The recipient rejected this call via acceptRelayedCall InvalidRecipientStatusCode // The recipient returned an invalid (reserved) status code } /** * @dev Relays a transaction. * * For this to succeed, multiple conditions must be met: * - {canRelay} must `return PreconditionCheck.OK` * - the sender must be a registered relay * - the transaction's gas price must be larger or equal to the one that was requested by the sender * - the transaction must have enough gas to not run out of gas if all internal transactions (calls to the * recipient) use all gas available to them * - the recipient must have enough balance to pay the relay for the worst-case scenario (i.e. when all gas is * spent) * * If all conditions are met, the call will be relayed and the recipient charged. {preRelayedCall}, the encoded * function and {postRelayedCall} will be called in that order. * * Parameters: * - `from`: the client originating the request * - `to`: the target {IRelayRecipient} contract * - `encodedFunction`: the function call to relay, including data * - `transactionFee`: fee (%) the relay takes over actual gas cost * - `gasPrice`: gas price the client is willing to pay * - `gasLimit`: gas to forward when calling the encoded function * - `nonce`: client's nonce * - `signature`: client's signature over all previous params, plus the relay and RelayHub addresses * - `approvalData`: dapp-specific data forwared to {acceptRelayedCall}. This value is *not* verified by the * `RelayHub`, but it still can be used for e.g. a signature. * * Emits a {TransactionRelayed} event. */ function relayCall( address from, address to, bytes memory encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce, bytes memory signature, bytes memory approvalData ) public; /** * @dev Emitted when an attempt to relay a call failed. * * This can happen due to incorrect {relayCall} arguments, or the recipient not accepting the relayed call. The * actual relayed call was not executed, and the recipient not charged. * * The `reason` parameter contains an error code: values 1-10 correspond to `PreconditionCheck` entries, and values * over 10 are custom recipient error codes returned from {acceptRelayedCall}. */ event CanRelayFailed(address indexed relay, address indexed from, address indexed to, bytes4 selector, uint256 reason); /** * @dev Emitted when a transaction is relayed. * Useful when monitoring a relay's operation and relayed calls to a contract * * Note that the actual encoded function might be reverted: this is indicated in the `status` parameter. * * `charge` is the Ether value deducted from the recipient's balance, paid to the relay's owner. */ event TransactionRelayed(address indexed relay, address indexed from, address indexed to, bytes4 selector, RelayCallStatus status, uint256 charge); // Reason error codes for the TransactionRelayed event enum RelayCallStatus { OK, // The transaction was successfully relayed and execution successful - never included in the event RelayedCallFailed, // The transaction was relayed, but the relayed call failed PreRelayedFailed, // The transaction was not relayed due to preRelatedCall reverting PostRelayedFailed, // The transaction was relayed and reverted due to postRelatedCall reverting RecipientBalanceChanged // The transaction was relayed and reverted due to the recipient's balance changing } /** * @dev Returns how much gas should be forwarded to a call to {relayCall}, in order to relay a transaction that will * spend up to `relayedCallStipend` gas. */ function requiredGas(uint256 relayedCallStipend) public view returns (uint256); /** * @dev Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee. */ function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) public view returns (uint256); // Relay penalization. // Any account can penalize relays, removing them from the system immediately, and rewarding the // reporter with half of the relay's stake. The other half is burned so that, even if the relay penalizes itself, it // still loses half of its stake. /** * @dev Penalize a relay that signed two transactions using the same nonce (making only the first one valid) and * different data (gas price, gas limit, etc. may be different). * * The (unsigned) transaction data and signature for both transactions must be provided. */ function penalizeRepeatedNonce(bytes memory unsignedTx1, bytes memory signature1, bytes memory unsignedTx2, bytes memory signature2) public; /** * @dev Penalize a relay that sent a transaction that didn't target `RelayHub`'s {registerRelay} or {relayCall}. */ function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public; /** * @dev Emitted when a relay is penalized. */ event Penalized(address indexed relay, address sender, uint256 amount); /** * @dev Returns an account's nonce in `RelayHub`. */ function getNonce(address from) external view returns (uint256); }
contract IRelayHub { // Relay management /** * @dev Adds stake to a relay and sets its `unstakeDelay`. If the relay does not exist, it is created, and the caller * of this function becomes its owner. If the relay already exists, only the owner can call this function. A relay * cannot be its own owner. * * All Ether in this function call will be added to the relay's stake. * Its unstake delay will be assigned to `unstakeDelay`, but the new value must be greater or equal to the current one. * * Emits a {Staked} event. */ function stake(address relayaddr, uint256 unstakeDelay) external payable; /** * @dev Emitted when a relay's stake or unstakeDelay are increased */ event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); /** * @dev Registers the caller as a relay. * The relay must be staked for, and not be a contract (i.e. this function must be called directly from an EOA). * * This function can be called multiple times, emitting new {RelayAdded} events. Note that the received * `transactionFee` is not enforced by {relayCall}. * * Emits a {RelayAdded} event. */ function registerRelay(uint256 transactionFee, string memory url) public; /** * @dev Emitted when a relay is registered or re-registerd. Looking at these events (and filtering out * {RelayRemoved} events) lets a client discover the list of available relays. */ event RelayAdded(address indexed relay, address indexed owner, uint256 transactionFee, uint256 stake, uint256 unstakeDelay, string url); /** * @dev Removes (deregisters) a relay. Unregistered (but staked for) relays can also be removed. * * Can only be called by the owner of the relay. After the relay's `unstakeDelay` has elapsed, {unstake} will be * callable. * * Emits a {RelayRemoved} event. */ function removeRelayByOwner(address relay) public; /** * @dev Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable. */ event RelayRemoved(address indexed relay, uint256 unstakeTime); /** Deletes the relay from the system, and gives back its stake to the owner. * * Can only be called by the relay owner, after `unstakeDelay` has elapsed since {removeRelayByOwner} was called. * * Emits an {Unstaked} event. */ function unstake(address relay) public; /** * @dev Emitted when a relay is unstaked for, including the returned stake. */ event Unstaked(address indexed relay, uint256 stake); // States a relay can be in enum RelayState { Unknown, // The relay is unknown to the system: it has never been staked for Staked, // The relay has been staked for, but it is not yet active Registered, // The relay has registered itself, and is active (can relay calls) Removed // The relay has been removed by its owner and can no longer relay calls. It must wait for its unstakeDelay to elapse before it can unstake } /** * @dev Returns a relay's status. Note that relays can be deleted when unstaked or penalized, causing this function * to return an empty entry. */ function getRelay(address relay) external view returns (uint256 totalStake, uint256 unstakeDelay, uint256 unstakeTime, address payable owner, RelayState state); // Balance management /** * @dev Deposits Ether for a contract, so that it can receive (and pay for) relayed transactions. * * Unused balance can only be withdrawn by the contract itself, by calling {withdraw}. * * Emits a {Deposited} event. */ function depositFor(address target) public payable; /** * @dev Emitted when {depositFor} is called, including the amount and account that was funded. */ event Deposited(address indexed recipient, address indexed from, uint256 amount); /** * @dev Returns an account's deposits. These can be either a contracts's funds, or a relay owner's revenue. */ function balanceOf(address target) external view returns (uint256); /** * Withdraws from an account's balance, sending it back to it. Relay owners call this to retrieve their revenue, and * contracts can use it to reduce their funding. * * Emits a {Withdrawn} event. */ function withdraw(uint256 amount, address payable dest) public; /** * @dev Emitted when an account withdraws funds from `RelayHub`. */ event Withdrawn(address indexed account, address indexed dest, uint256 amount); // Relaying /** * @dev Checks if the `RelayHub` will accept a relayed operation. * Multiple things must be true for this to happen: * - all arguments must be signed for by the sender (`from`) * - the sender's nonce must be the current one * - the recipient must accept this transaction (via {acceptRelayedCall}) * * Returns a `PreconditionCheck` value (`OK` when the transaction can be relayed), or a recipient-specific error * code if it returns one in {acceptRelayedCall}. */ function canRelay( address relay, address from, address to, bytes memory encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce, bytes memory signature, bytes memory approvalData ) public view returns (uint256 status, bytes memory recipientContext); // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values. enum PreconditionCheck { OK, // All checks passed, the call can be relayed WrongSignature, // The transaction to relay is not signed by requested sender WrongNonce, // The provided nonce has already been used by the sender AcceptRelayedCallReverted, // The recipient rejected this call via acceptRelayedCall InvalidRecipientStatusCode // The recipient returned an invalid (reserved) status code } /** * @dev Relays a transaction. * * For this to succeed, multiple conditions must be met: * - {canRelay} must `return PreconditionCheck.OK` * - the sender must be a registered relay * - the transaction's gas price must be larger or equal to the one that was requested by the sender * - the transaction must have enough gas to not run out of gas if all internal transactions (calls to the * recipient) use all gas available to them * - the recipient must have enough balance to pay the relay for the worst-case scenario (i.e. when all gas is * spent) * * If all conditions are met, the call will be relayed and the recipient charged. {preRelayedCall}, the encoded * function and {postRelayedCall} will be called in that order. * * Parameters: * - `from`: the client originating the request * - `to`: the target {IRelayRecipient} contract * - `encodedFunction`: the function call to relay, including data * - `transactionFee`: fee (%) the relay takes over actual gas cost * - `gasPrice`: gas price the client is willing to pay * - `gasLimit`: gas to forward when calling the encoded function * - `nonce`: client's nonce * - `signature`: client's signature over all previous params, plus the relay and RelayHub addresses * - `approvalData`: dapp-specific data forwared to {acceptRelayedCall}. This value is *not* verified by the * `RelayHub`, but it still can be used for e.g. a signature. * * Emits a {TransactionRelayed} event. */ function relayCall( address from, address to, bytes memory encodedFunction, uint256 transactionFee, uint256 gasPrice, uint256 gasLimit, uint256 nonce, bytes memory signature, bytes memory approvalData ) public; /** * @dev Emitted when an attempt to relay a call failed. * * This can happen due to incorrect {relayCall} arguments, or the recipient not accepting the relayed call. The * actual relayed call was not executed, and the recipient not charged. * * The `reason` parameter contains an error code: values 1-10 correspond to `PreconditionCheck` entries, and values * over 10 are custom recipient error codes returned from {acceptRelayedCall}. */ event CanRelayFailed(address indexed relay, address indexed from, address indexed to, bytes4 selector, uint256 reason); /** * @dev Emitted when a transaction is relayed. * Useful when monitoring a relay's operation and relayed calls to a contract * * Note that the actual encoded function might be reverted: this is indicated in the `status` parameter. * * `charge` is the Ether value deducted from the recipient's balance, paid to the relay's owner. */ event TransactionRelayed(address indexed relay, address indexed from, address indexed to, bytes4 selector, RelayCallStatus status, uint256 charge); // Reason error codes for the TransactionRelayed event enum RelayCallStatus { OK, // The transaction was successfully relayed and execution successful - never included in the event RelayedCallFailed, // The transaction was relayed, but the relayed call failed PreRelayedFailed, // The transaction was not relayed due to preRelatedCall reverting PostRelayedFailed, // The transaction was relayed and reverted due to postRelatedCall reverting RecipientBalanceChanged // The transaction was relayed and reverted due to the recipient's balance changing } /** * @dev Returns how much gas should be forwarded to a call to {relayCall}, in order to relay a transaction that will * spend up to `relayedCallStipend` gas. */ function requiredGas(uint256 relayedCallStipend) public view returns (uint256); /** * @dev Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee. */ function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) public view returns (uint256); // Relay penalization. // Any account can penalize relays, removing them from the system immediately, and rewarding the // reporter with half of the relay's stake. The other half is burned so that, even if the relay penalizes itself, it // still loses half of its stake. /** * @dev Penalize a relay that signed two transactions using the same nonce (making only the first one valid) and * different data (gas price, gas limit, etc. may be different). * * The (unsigned) transaction data and signature for both transactions must be provided. */ function penalizeRepeatedNonce(bytes memory unsignedTx1, bytes memory signature1, bytes memory unsignedTx2, bytes memory signature2) public; /** * @dev Penalize a relay that sent a transaction that didn't target `RelayHub`'s {registerRelay} or {relayCall}. */ function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public; /** * @dev Emitted when a relay is penalized. */ event Penalized(address indexed relay, address sender, uint256 amount); /** * @dev Returns an account's nonce in `RelayHub`. */ function getNonce(address from) external view returns (uint256); }
8,345
439
// See dropBptFromTokens for a detailed explanation of how this works.
mstore(add(registeredBalances, 32), sub(mload(registeredBalances), 1)) balances := add(registeredBalances, 32)
mstore(add(registeredBalances, 32), sub(mload(registeredBalances), 1)) balances := add(registeredBalances, 32)
29,335
24
// --- Internal ---
function _buy( IRarible.Order calldata orderLeft, bytes calldata signatureLeft, IRarible.Order calldata orderRight, bytes calldata signatureRight, address receiver, bool revertIfIncomplete, uint256 value
function _buy( IRarible.Order calldata orderLeft, bytes calldata signatureLeft, IRarible.Order calldata orderRight, bytes calldata signatureRight, address receiver, bool revertIfIncomplete, uint256 value
4,454
198
// Executing all minting
for (uint256 i = 0; i < nMint; i++) {
for (uint256 i = 0; i < nMint; i++) {
10,265
77
// amount of raised money in wei /
uint256 public weiRaised;
uint256 public weiRaised;
3,069
9
// @inheritdoc IHealthCheck
function check( address strategy, uint256 profit, uint256 loss, uint256 /*debtPayment*/, uint256 /*debtOutstanding*/, uint256 totalDebt, uint256 /*gasCost*/ ) external view returns (uint8)
function check( address strategy, uint256 profit, uint256 loss, uint256 /*debtPayment*/, uint256 /*debtOutstanding*/, uint256 totalDebt, uint256 /*gasCost*/ ) external view returns (uint8)
16,063
228
// solium-enable function-order, mixedcase //Get the address of an app instance or base implementation_namespace App namespace to use_appId Identifier for app return Address of the app/
function getApp(bytes32 _namespace, bytes32 _appId) public view returns (address) { return apps[_namespace][_appId]; }
function getApp(bytes32 _namespace, bytes32 _appId) public view returns (address) { return apps[_namespace][_appId]; }
17,612
50
// Destroys `amount` tokens from `account`, reducing thetotal supply.
* Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
* Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
32,265
120
// ----------------- RPS Functions ----------------- Note that this function is not nonReentrant because the RPS.commit will reenter via stakeNFTs, and that's OK.
function rpsCommit(bytes32 commitment, uint32[] calldata crystalIDs) external { require(rps != address(0), "RPSNotSet"); // Update the owner's rewards first. This also updates the current epoch. _updateRewards(msg.sender); // Unstake the crystals for (uint256 i = 0; i < crystalIDs.length; i++) { uint256 contractTokenId = 4_000_000 + uint256(crystalIDs[i]); require(stakedTokenOwners[contractTokenId].owner == msg.sender, "DontOwnNFT"); _removeTokenFromOwnerEnumeration(msg.sender, contractTokenId); stakedNFTsAndTokens[msg.sender].numFullCrystalsStaked -= 1; } // Commit it for the player IRPS(rps).commit(commitment, msg.sender, crystalIDs); }
function rpsCommit(bytes32 commitment, uint32[] calldata crystalIDs) external { require(rps != address(0), "RPSNotSet"); // Update the owner's rewards first. This also updates the current epoch. _updateRewards(msg.sender); // Unstake the crystals for (uint256 i = 0; i < crystalIDs.length; i++) { uint256 contractTokenId = 4_000_000 + uint256(crystalIDs[i]); require(stakedTokenOwners[contractTokenId].owner == msg.sender, "DontOwnNFT"); _removeTokenFromOwnerEnumeration(msg.sender, contractTokenId); stakedNFTsAndTokens[msg.sender].numFullCrystalsStaked -= 1; } // Commit it for the player IRPS(rps).commit(commitment, msg.sender, crystalIDs); }
6,047
10
// @custom:legacy/ @custom:spacer ReentrancyGuardUpgradeable's __gap/Spacer for backwards compatibility.
uint256[49] private spacer_152_0_1568;
uint256[49] private spacer_152_0_1568;
27,707
98
// All considered/summed orders are sufficient to close the auction fully at price between current and previous orders.
uint256 uncoveredBids = currentBidSum.sub( fullAuctionedAmount.mul(sellAmountOfIter).div( buyAmountOfIter ) ); if (sellAmountOfIter >= uncoveredBids) {
uint256 uncoveredBids = currentBidSum.sub( fullAuctionedAmount.mul(sellAmountOfIter).div( buyAmountOfIter ) ); if (sellAmountOfIter >= uncoveredBids) {
22,587
8
// Only bridge can call functions marked by this modifier. /
modifier onlyBridge() { _onlyBridge(); _; }
modifier onlyBridge() { _onlyBridge(); _; }
36,586
0
// Sets {name} as "GBP Stable Token", {symbol} as "GBPST" and {decimals} with 18. Setup roles {DEFAULT_ADMIN_ROLE}, {MINTER_ROLE}, {WIPER_ROLE} and {REGISTRY_MANAGER_ROLE}. Mints `initialSupply` tokens and assigns them to the caller. /
constructor( uint256 _initialSupply, IUserRegistry _userRegistry, address _minter, address _wiper, address _registryManager ) public ERC20("GBP Stable Token", "GBPST") { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); require(_minter != address(0), "_minter cannot be zero address");
constructor( uint256 _initialSupply, IUserRegistry _userRegistry, address _minter, address _wiper, address _registryManager ) public ERC20("GBP Stable Token", "GBPST") { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); require(_minter != address(0), "_minter cannot be zero address");
34,993
14
// Calculates and stores Escrow Fee.
currentEscrow.escrow_fee = getEscrowFee(escrowAddress)*msg.value/1000;
currentEscrow.escrow_fee = getEscrowFee(escrowAddress)*msg.value/1000;
49,869
73
// ERC827, an extension of ERC20 token standardImplementation the ERC827, following the ERC20 standard with extra methods to transfer value and data and execute calls in transfers and approvals.Uses OpenZeppelin StandardToken. /
contract ERC827Token is ERC827, StandardToken { ERC827Caller internal caller_; constructor() public { caller_ = new ERC827Caller(); } /** * @dev Addition to ERC20 token methods. It allows to * @dev approve the transfer of value and execute a call with the sent data. * * @dev Beware that changing an allowance with this method brings the risk that * @dev someone may use both the old and the new allowance by unfortunate * @dev transaction ordering. One possible solution to mitigate this race condition * @dev is to first reduce the spender's allowance to 0 and set the desired value * @dev afterwards: * @dev https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * @param _spender The address that will spend the funds. * @param _value The amount of tokens to be spent. * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function approveAndCall( address _spender, uint256 _value, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.approve(_spender, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } /** * @dev Addition to ERC20 token methods. Transfer tokens to a specified * @dev address and execute a call with the sent data on the same transaction * * @param _to address The address which you want to transfer to * @param _value uint256 the amout of tokens to be transfered * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function transferAndCall( address _to, uint256 _value, bytes _data ) public payable returns (bool) { require(_to != address(this)); super.transfer(_to, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_to, _data)); return true; } /** * @dev Addition to ERC20 token methods. Transfer tokens from one address to * @dev another and make a contract call on the same transaction * * @param _from The address which you want to send tokens from * @param _to The address which you want to transfer to * @param _value The amout of tokens to be transferred * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function transferFromAndCall( address _from, address _to, uint256 _value, bytes _data ) public payable returns (bool) { require(_to != address(this)); super.transferFrom(_from, _to, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_to, _data)); return true; } /** * @dev Addition to StandardToken methods. Increase the amount of tokens that * @dev an owner allowed to a spender and execute a call with the sent data. * * @dev approve should be called when allowed[_spender] == 0. To increment * @dev allowed value is better to use this function to avoid 2 calls (and wait until * @dev the first transaction is mined) * @dev From MonolithDAO Token.sol * * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. * @param _data ABI-encoded contract call to call `_spender` address. */ function increaseApprovalAndCall( address _spender, uint _addedValue, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.increaseApproval(_spender, _addedValue); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } /** * @dev Addition to StandardToken methods. Decrease the amount of tokens that * @dev an owner allowed to a spender and execute a call with the sent data. * * @dev approve should be called when allowed[_spender] == 0. To decrement * @dev allowed value is better to use this function to avoid 2 calls (and wait until * @dev the first transaction is mined) * @dev From MonolithDAO Token.sol * * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. * @param _data ABI-encoded contract call to call `_spender` address. */ function decreaseApprovalAndCall( address _spender, uint _subtractedValue, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.decreaseApproval(_spender, _subtractedValue); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } }
contract ERC827Token is ERC827, StandardToken { ERC827Caller internal caller_; constructor() public { caller_ = new ERC827Caller(); } /** * @dev Addition to ERC20 token methods. It allows to * @dev approve the transfer of value and execute a call with the sent data. * * @dev Beware that changing an allowance with this method brings the risk that * @dev someone may use both the old and the new allowance by unfortunate * @dev transaction ordering. One possible solution to mitigate this race condition * @dev is to first reduce the spender's allowance to 0 and set the desired value * @dev afterwards: * @dev https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * @param _spender The address that will spend the funds. * @param _value The amount of tokens to be spent. * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function approveAndCall( address _spender, uint256 _value, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.approve(_spender, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } /** * @dev Addition to ERC20 token methods. Transfer tokens to a specified * @dev address and execute a call with the sent data on the same transaction * * @param _to address The address which you want to transfer to * @param _value uint256 the amout of tokens to be transfered * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function transferAndCall( address _to, uint256 _value, bytes _data ) public payable returns (bool) { require(_to != address(this)); super.transfer(_to, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_to, _data)); return true; } /** * @dev Addition to ERC20 token methods. Transfer tokens from one address to * @dev another and make a contract call on the same transaction * * @param _from The address which you want to send tokens from * @param _to The address which you want to transfer to * @param _value The amout of tokens to be transferred * @param _data ABI-encoded contract call to call `_to` address. * * @return true if the call function was executed successfully */ function transferFromAndCall( address _from, address _to, uint256 _value, bytes _data ) public payable returns (bool) { require(_to != address(this)); super.transferFrom(_from, _to, _value); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_to, _data)); return true; } /** * @dev Addition to StandardToken methods. Increase the amount of tokens that * @dev an owner allowed to a spender and execute a call with the sent data. * * @dev approve should be called when allowed[_spender] == 0. To increment * @dev allowed value is better to use this function to avoid 2 calls (and wait until * @dev the first transaction is mined) * @dev From MonolithDAO Token.sol * * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. * @param _data ABI-encoded contract call to call `_spender` address. */ function increaseApprovalAndCall( address _spender, uint _addedValue, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.increaseApproval(_spender, _addedValue); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } /** * @dev Addition to StandardToken methods. Decrease the amount of tokens that * @dev an owner allowed to a spender and execute a call with the sent data. * * @dev approve should be called when allowed[_spender] == 0. To decrement * @dev allowed value is better to use this function to avoid 2 calls (and wait until * @dev the first transaction is mined) * @dev From MonolithDAO Token.sol * * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. * @param _data ABI-encoded contract call to call `_spender` address. */ function decreaseApprovalAndCall( address _spender, uint _subtractedValue, bytes _data ) public payable returns (bool) { require(_spender != address(this)); super.decreaseApproval(_spender, _subtractedValue); // solium-disable-next-line security/no-call-value require(caller_.makeCall.value(msg.value)(_spender, _data)); return true; } }
11,314
106
// set registration step count /
function setRegistrationStep(uint256 registrationStep) public onlyGovernance
function setRegistrationStep(uint256 registrationStep) public onlyGovernance
36,985
8
// Retrieve pending rewards
FEE_ADDRESS.splitFees();
FEE_ADDRESS.splitFees();
38,432
60
// round setup: first HasWinners, second is ghost
data.tournaments[address(this)].rounds.length = 2; LibTournament.RoundData storage roundZero = data.tournaments[address(this)].rounds[0]; roundZero.details.start = now - 61; roundZero.details.duration = 60; roundZero.details.review = 60; roundZero.details.bounty = 10; roundZero.info.winners = wData; roundZero.info.submissions.push(winner);
data.tournaments[address(this)].rounds.length = 2; LibTournament.RoundData storage roundZero = data.tournaments[address(this)].rounds[0]; roundZero.details.start = now - 61; roundZero.details.duration = 60; roundZero.details.review = 60; roundZero.details.bounty = 10; roundZero.info.winners = wData; roundZero.info.submissions.push(winner);
36
11
// Public method to list non-fungible token(s) on the main registry permissionless listing from dApp - array of tokens (can be one). Willensure token is owned by caller. tokens An array of NFT struct instances /
function bulkAddToMainRegistry(NFT[] calldata tokens) public { NFT[] memory listedTokens = new NFT[](tokens.length); Listing[] memory bundleListings = new Listing[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { mainRegistry[tokens[i].tokenContract][tokens[i].tokenId] = true; listedTokens[i] = tokens[i]; bundleListings[i] = Listing({signedMessage: bytes("0"), nft: tokens[i]}); } OwnerBundle[] memory bundle = new OwnerBundle[](1); bundle[0] = OwnerBundle({listings: bundleListings, owner: address(msg.sender)}); emit TokensListed(bundle); }
function bulkAddToMainRegistry(NFT[] calldata tokens) public { NFT[] memory listedTokens = new NFT[](tokens.length); Listing[] memory bundleListings = new Listing[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { mainRegistry[tokens[i].tokenContract][tokens[i].tokenId] = true; listedTokens[i] = tokens[i]; bundleListings[i] = Listing({signedMessage: bytes("0"), nft: tokens[i]}); } OwnerBundle[] memory bundle = new OwnerBundle[](1); bundle[0] = OwnerBundle({listings: bundleListings, owner: address(msg.sender)}); emit TokensListed(bundle); }
51,599
14
// halving interest rate
c.interest_rate_2w.div(2);
c.interest_rate_2w.div(2);
4,054
365
// `setGovernance()` should be called by the existing governanceaddress prior to calling this function. /
function setGovernance(address _governance) external onlyGovernance { pendingGovernance = _governance; }
function setGovernance(address _governance) external onlyGovernance { pendingGovernance = _governance; }
18,780
14
// Main abstraction of ZetaConnector.This contract manages interactions between TSS and different chains.There's an instance of this contract on each chain supported by ZetaChain. /
contract ZetaConnectorBase is ConnectorErrors, Pausable { address public immutable zetaToken; /** * @dev Multisig contract to pause incoming transactions. * The responsibility of pausing outgoing transactions is left to the protocol for more flexibility. */ address public pauserAddress; /** * @dev Collectively held by ZetaChain validators. */ address public tssAddress; /** * @dev This address will start pointing to a multisig contract, then it will become the TSS address itself. */ address public tssAddressUpdater; event ZetaSent( address sourceTxOriginAddress, address indexed zetaTxSenderAddress, uint256 indexed destinationChainId, bytes destinationAddress, uint256 zetaValueAndGas, uint256 destinationGasLimit, bytes message, bytes zetaParams ); event ZetaReceived( bytes zetaTxSenderAddress, uint256 indexed sourceChainId, address indexed destinationAddress, uint256 zetaValue, bytes message, bytes32 indexed internalSendHash ); event ZetaReverted( address zetaTxSenderAddress, uint256 sourceChainId, uint256 indexed destinationChainId, bytes destinationAddress, uint256 remainingZetaValue, bytes message, bytes32 indexed internalSendHash ); event TSSAddressUpdated(address callerAddress, address newTssAddress); event TSSAddressUpdaterUpdated(address callerAddress, address newTssUpdaterAddress); event PauserAddressUpdated(address callerAddress, address newTssAddress); /** * @dev Constructor requires initial addresses. * zetaToken address is the only immutable one, while others can be updated. */ constructor(address zetaToken_, address tssAddress_, address tssAddressUpdater_, address pauserAddress_) { if ( zetaToken_ == address(0) || tssAddress_ == address(0) || tssAddressUpdater_ == address(0) || pauserAddress_ == address(0) ) { revert ZetaCommonErrors.InvalidAddress(); } zetaToken = zetaToken_; tssAddress = tssAddress_; tssAddressUpdater = tssAddressUpdater_; pauserAddress = pauserAddress_; } /** * @dev Modifier to restrict actions to pauser address. */ modifier onlyPauser() { if (msg.sender != pauserAddress) revert CallerIsNotPauser(msg.sender); _; } /** * @dev Modifier to restrict actions to TSS address. */ modifier onlyTssAddress() { if (msg.sender != tssAddress) revert CallerIsNotTss(msg.sender); _; } /** * @dev Modifier to restrict actions to TSS updater address. */ modifier onlyTssUpdater() { if (msg.sender != tssAddressUpdater) revert CallerIsNotTssUpdater(msg.sender); _; } /** * @dev Update the pauser address. The only address allowed to do that is the current pauser. */ function updatePauserAddress(address pauserAddress_) external onlyPauser { if (pauserAddress_ == address(0)) revert ZetaCommonErrors.InvalidAddress(); pauserAddress = pauserAddress_; emit PauserAddressUpdated(msg.sender, pauserAddress_); } /** * @dev Update the TSS address. The address can be updated by the TSS updater or the TSS address itself. */ function updateTssAddress(address tssAddress_) external { if (msg.sender != tssAddress && msg.sender != tssAddressUpdater) revert CallerIsNotTssOrUpdater(msg.sender); if (tssAddress_ == address(0)) revert ZetaCommonErrors.InvalidAddress(); tssAddress = tssAddress_; emit TSSAddressUpdated(msg.sender, tssAddress_); } /** * @dev Changes the ownership of tssAddressUpdater to be the one held by the ZetaChain TSS Signer nodes. */ function renounceTssAddressUpdater() external onlyTssUpdater { if (tssAddress == address(0)) revert ZetaCommonErrors.InvalidAddress(); tssAddressUpdater = tssAddress; emit TSSAddressUpdaterUpdated(msg.sender, tssAddressUpdater); } /** * @dev Pause the input (send) transactions. */ function pause() external onlyPauser { _pause(); } /** * @dev Unpause the contract to allow transactions again. */ function unpause() external onlyPauser { _unpause(); } /** * @dev Entrypoint to send data and value through ZetaChain. */ function send(ZetaInterfaces.SendInput calldata input) external virtual {} /** * @dev Handler to receive data from other chain. * This method can be called only by TSS. Access validation is in implementation. */ function onReceive( bytes calldata zetaTxSenderAddress, uint256 sourceChainId, address destinationAddress, uint256 zetaValue, bytes calldata message, bytes32 internalSendHash ) external virtual {} /** * @dev Handler to receive errors from other chain. * This method can be called only by TSS. Access validation is in implementation. */ function onRevert( address zetaTxSenderAddress, uint256 sourceChainId, bytes calldata destinationAddress, uint256 destinationChainId, uint256 remainingZetaValue, bytes calldata message, bytes32 internalSendHash ) external virtual {} }
contract ZetaConnectorBase is ConnectorErrors, Pausable { address public immutable zetaToken; /** * @dev Multisig contract to pause incoming transactions. * The responsibility of pausing outgoing transactions is left to the protocol for more flexibility. */ address public pauserAddress; /** * @dev Collectively held by ZetaChain validators. */ address public tssAddress; /** * @dev This address will start pointing to a multisig contract, then it will become the TSS address itself. */ address public tssAddressUpdater; event ZetaSent( address sourceTxOriginAddress, address indexed zetaTxSenderAddress, uint256 indexed destinationChainId, bytes destinationAddress, uint256 zetaValueAndGas, uint256 destinationGasLimit, bytes message, bytes zetaParams ); event ZetaReceived( bytes zetaTxSenderAddress, uint256 indexed sourceChainId, address indexed destinationAddress, uint256 zetaValue, bytes message, bytes32 indexed internalSendHash ); event ZetaReverted( address zetaTxSenderAddress, uint256 sourceChainId, uint256 indexed destinationChainId, bytes destinationAddress, uint256 remainingZetaValue, bytes message, bytes32 indexed internalSendHash ); event TSSAddressUpdated(address callerAddress, address newTssAddress); event TSSAddressUpdaterUpdated(address callerAddress, address newTssUpdaterAddress); event PauserAddressUpdated(address callerAddress, address newTssAddress); /** * @dev Constructor requires initial addresses. * zetaToken address is the only immutable one, while others can be updated. */ constructor(address zetaToken_, address tssAddress_, address tssAddressUpdater_, address pauserAddress_) { if ( zetaToken_ == address(0) || tssAddress_ == address(0) || tssAddressUpdater_ == address(0) || pauserAddress_ == address(0) ) { revert ZetaCommonErrors.InvalidAddress(); } zetaToken = zetaToken_; tssAddress = tssAddress_; tssAddressUpdater = tssAddressUpdater_; pauserAddress = pauserAddress_; } /** * @dev Modifier to restrict actions to pauser address. */ modifier onlyPauser() { if (msg.sender != pauserAddress) revert CallerIsNotPauser(msg.sender); _; } /** * @dev Modifier to restrict actions to TSS address. */ modifier onlyTssAddress() { if (msg.sender != tssAddress) revert CallerIsNotTss(msg.sender); _; } /** * @dev Modifier to restrict actions to TSS updater address. */ modifier onlyTssUpdater() { if (msg.sender != tssAddressUpdater) revert CallerIsNotTssUpdater(msg.sender); _; } /** * @dev Update the pauser address. The only address allowed to do that is the current pauser. */ function updatePauserAddress(address pauserAddress_) external onlyPauser { if (pauserAddress_ == address(0)) revert ZetaCommonErrors.InvalidAddress(); pauserAddress = pauserAddress_; emit PauserAddressUpdated(msg.sender, pauserAddress_); } /** * @dev Update the TSS address. The address can be updated by the TSS updater or the TSS address itself. */ function updateTssAddress(address tssAddress_) external { if (msg.sender != tssAddress && msg.sender != tssAddressUpdater) revert CallerIsNotTssOrUpdater(msg.sender); if (tssAddress_ == address(0)) revert ZetaCommonErrors.InvalidAddress(); tssAddress = tssAddress_; emit TSSAddressUpdated(msg.sender, tssAddress_); } /** * @dev Changes the ownership of tssAddressUpdater to be the one held by the ZetaChain TSS Signer nodes. */ function renounceTssAddressUpdater() external onlyTssUpdater { if (tssAddress == address(0)) revert ZetaCommonErrors.InvalidAddress(); tssAddressUpdater = tssAddress; emit TSSAddressUpdaterUpdated(msg.sender, tssAddressUpdater); } /** * @dev Pause the input (send) transactions. */ function pause() external onlyPauser { _pause(); } /** * @dev Unpause the contract to allow transactions again. */ function unpause() external onlyPauser { _unpause(); } /** * @dev Entrypoint to send data and value through ZetaChain. */ function send(ZetaInterfaces.SendInput calldata input) external virtual {} /** * @dev Handler to receive data from other chain. * This method can be called only by TSS. Access validation is in implementation. */ function onReceive( bytes calldata zetaTxSenderAddress, uint256 sourceChainId, address destinationAddress, uint256 zetaValue, bytes calldata message, bytes32 internalSendHash ) external virtual {} /** * @dev Handler to receive errors from other chain. * This method can be called only by TSS. Access validation is in implementation. */ function onRevert( address zetaTxSenderAddress, uint256 sourceChainId, bytes calldata destinationAddress, uint256 destinationChainId, uint256 remainingZetaValue, bytes calldata message, bytes32 internalSendHash ) external virtual {} }
37,519
232
// Returns the number of payment destinations and amounts pushed to the storage buffer -
function paid() internal pure returns (uint num_paid) { if (buffPtr() == bytes32(0)) return 0; // Load number paid from buffer - assembly { num_paid := mload(0x160) } }
function paid() internal pure returns (uint num_paid) { if (buffPtr() == bytes32(0)) return 0; // Load number paid from buffer - assembly { num_paid := mload(0x160) } }
74,556
87
// Transfers collateral tokens (this market) to the liquidator. Will fail unless called by another auToken during the process of liquidation. Its absolutely critical to use msg.sender as the borrowed auToken and not a parameter. liquidator The account receiving seized collateral borrower The account having collateral seized seizeTokens The number of auTokens to seizereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) { return seizeInternal(msg.sender, liquidator, borrower, seizeTokens); }
function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) { return seizeInternal(msg.sender, liquidator, borrower, seizeTokens); }
23,055
52
// https:ethereum.stackexchange.com/questions/13862/is-it-possible-to-check-string-variables-length-inside-the-contract
function utfStringLength(string memory str) pure internal returns (uint length) { uint i=0; bytes memory string_rep = bytes(str); while (i<string_rep.length) { if (string_rep[i]>>7==0) i+=1; else if (string_rep[i]>>5==bytes1(uint8(0x6))) i+=2; else if (string_rep[i]>>4==bytes1(uint8(0xE))) i+=3; else if (string_rep[i]>>3==bytes1(uint8(0x1E))) i+=4; else //For safety i+=1; length++; } }
function utfStringLength(string memory str) pure internal returns (uint length) { uint i=0; bytes memory string_rep = bytes(str); while (i<string_rep.length) { if (string_rep[i]>>7==0) i+=1; else if (string_rep[i]>>5==bytes1(uint8(0x6))) i+=2; else if (string_rep[i]>>4==bytes1(uint8(0xE))) i+=3; else if (string_rep[i]>>3==bytes1(uint8(0x1E))) i+=4; else //For safety i+=1; length++; } }
35,596
31
// Can be called by any address to update a block header can only upload new block data or the same block data with more confirmations
function updateHash( uint16 _srcChainId, bytes32 _lookupHash, uint _confirmations, bytes32 _blockData
function updateHash( uint16 _srcChainId, bytes32 _lookupHash, uint _confirmations, bytes32 _blockData
25,973
700
// Gets the current votes balance. _account The address to get votes balance.return The number of current votes. /
function getCurrentVotes(address _account) external view returns (uint96) { uint256 numCheckpointsAccount = numCheckpoints[_account]; return numCheckpointsAccount > 0 ? checkpoints[_account][numCheckpointsAccount - 1].votes : 0; }
function getCurrentVotes(address _account) external view returns (uint96) { uint256 numCheckpointsAccount = numCheckpoints[_account]; return numCheckpointsAccount > 0 ? checkpoints[_account][numCheckpointsAccount - 1].votes : 0; }
35,064
55
// Web3 call functions //Returns number of confirmations of a tokentransfer./tokentransferId TokenTransfer ID./ return Number of confirmations.
function getConfirmationCountBytokentransferId(uint tokentransferId) public onlyOwner constant returns (uint count)
function getConfirmationCountBytokentransferId(uint tokentransferId) public onlyOwner constant returns (uint count)
11,363
69
// Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} iscalled. NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including{IERC20-balanceOf} and {IERC20-transfer}. /
function decimals() public view virtual returns (uint8) { return _decimals; }
function decimals() public view virtual returns (uint8) { return _decimals; }
78,044
222
// Tranfer ZRX fee from taker if applicable
if (order.takerFee > 0) { transferRelayerFee( order.takerFee, order.takerAssetAmount, _caller, zeroExFillAmount ); }
if (order.takerFee > 0) { transferRelayerFee( order.takerFee, order.takerAssetAmount, _caller, zeroExFillAmount ); }
35,471
38
// Fired whenever ownership is successfully transferred. /
event OwnershipTransferred( address indexed previousOwner, address indexed newOwner );
event OwnershipTransferred( address indexed previousOwner, address indexed newOwner );
11,609
42
// if all conditions pass, then send the user the right ether
uint256 rightAmount = (maxUsers - 1) * contributionAmount; payable(msg.sender).transfer(rightAmount);
uint256 rightAmount = (maxUsers - 1) * contributionAmount; payable(msg.sender).transfer(rightAmount);
19,454
29
// owner erc20 owned
contract Reverse is owned, TokenERC20 { mapping (address => bool) public frozenAccount; event FrozenFunds(address target, bool frozen); constructor( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public { } function _transfer(address _from, address _to, uint _value) internal onlyReleased { require (_to != 0x0); require (balanceOf[_from] >= _value); require (balanceOf[_to] + _value >= balanceOf[_to]); require(!frozenAccount[_from]); require(!frozenAccount[_to]); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); } function mintToken(address target, uint256 mintedAmount) onlyOwner public { require (mintedAmount > 0); totalSupply = totalSupply.add(mintedAmount); balanceOf[target] = balanceOf[target].add(mintedAmount); emit Transfer(0, this, mintedAmount); emit Transfer(this, target, mintedAmount); } ///reverse -s ast Preview ///code testing ///funct frez function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); } }
contract Reverse is owned, TokenERC20 { mapping (address => bool) public frozenAccount; event FrozenFunds(address target, bool frozen); constructor( uint256 initialSupply, string tokenName, string tokenSymbol ) TokenERC20(initialSupply, tokenName, tokenSymbol) public { } function _transfer(address _from, address _to, uint _value) internal onlyReleased { require (_to != 0x0); require (balanceOf[_from] >= _value); require (balanceOf[_to] + _value >= balanceOf[_to]); require(!frozenAccount[_from]); require(!frozenAccount[_to]); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); } function mintToken(address target, uint256 mintedAmount) onlyOwner public { require (mintedAmount > 0); totalSupply = totalSupply.add(mintedAmount); balanceOf[target] = balanceOf[target].add(mintedAmount); emit Transfer(0, this, mintedAmount); emit Transfer(this, target, mintedAmount); } ///reverse -s ast Preview ///code testing ///funct frez function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); } }
28,828
7
// needed for pool.withdraw() to work
receive() external payable {} }
receive() external payable {} }
2,145
59
// Get pointer to beginning of receivedItem.
add(offerArrPtr, OneWord),
add(offerArrPtr, OneWord),
20,103
158
// Returns an id of the currently processed message. return id of the message that originated on the other side./
function messageId() public view returns (bytes32) { return bytes32(uintStorage[MESSAGE_ID]); }
function messageId() public view returns (bytes32) { return bytes32(uintStorage[MESSAGE_ID]); }
24,439
10
// Counts the number of signatures in a signatures bytes array. Returns 0 if the length is invalid./_signatures The signatures bytes array/Signatures are 65 bytes long and are densely packed.
function countSignatures( bytes memory _signatures ) pure public returns (uint)
function countSignatures( bytes memory _signatures ) pure public returns (uint)
28,636
35
// mints fungible tokens/id token type/to beneficiaries of minted tokens/quantities amounts of minted tokens
function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external override onlyCreator(id)
function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external override onlyCreator(id)
12,676
32
// where last block is before start
else if (lastBlock <= startBlock){ _deltaBlock = block.number.sub(startBlock); }
else if (lastBlock <= startBlock){ _deltaBlock = block.number.sub(startBlock); }
27,811
108
// Updates Period before executing function If Period changed, calculates new period Out Token for exchange & Out Token Debt_startNow set periodStartTime = now if true/
modifier updatePeriod(bool _startNow) { uint256 _period = period; _updatePeriod(_startNow); if(_period != period){ uint256 _nextPeriodForExchange; uint256 _previousPeriodDebt; (_nextPeriodForExchange, _previousPeriodDebt) = _getOutTokenForExchange(_period); historyOutTokenForExchange[period] = _nextPeriodForExchange; outTokenDebt = outTokenDebt.add(_previousPeriodDebt); } _; }
modifier updatePeriod(bool _startNow) { uint256 _period = period; _updatePeriod(_startNow); if(_period != period){ uint256 _nextPeriodForExchange; uint256 _previousPeriodDebt; (_nextPeriodForExchange, _previousPeriodDebt) = _getOutTokenForExchange(_period); historyOutTokenForExchange[period] = _nextPeriodForExchange; outTokenDebt = outTokenDebt.add(_previousPeriodDebt); } _; }
40,705
7
// return the token being sold. /
function token() public view returns (IERC20) { return _token; }
function token() public view returns (IERC20) { return _token; }
4,232
3
// 给指定帐户初始化代币总量,初始化用于奖励合约创建者
balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol;
balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol;
67,316
56
// Let the network know the user has voted on the dispute and their casted vote
emit Voted(_disputeId, _supportsDispute, msg.sender, voteWeight);
emit Voted(_disputeId, _supportsDispute, msg.sender, voteWeight);
3,369
4
// The speedbump variable records the first timestamp where redemption was attempted to be performed on a tranche where loss occurred. It blocks redemptions for 48 hours after it is triggered in order to (1) prevent atomic flash loan price manipulation (2) give 48 hours to remediate any other loss scenario before allowing withdraws
uint256 public speedbump;
uint256 public speedbump;
62,971
188
// Helper functions Sum of arrays
function sumOfArray (uint[10] memory array) internal pure returns (uint sum) { for(uint i = 0; i < array.length; i++) { sum = sum + array[i]; } }
function sumOfArray (uint[10] memory array) internal pure returns (uint sum) { for(uint i = 0; i < array.length; i++) { sum = sum + array[i]; } }
49,527
106
// This internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`. /
function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount);
function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount);
195
2
// Execute meta transaction on contract containing EIP-712 stuff natively userAddress User to be considered as sender functionSignature Function to call on contract, with arguments encoded sigR Elliptic curve signature component sigS Elliptic curve signature component sigV Elliptic curve signature component /
function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) external payable returns (bytes memory);
function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) external payable returns (bytes memory);
18,550
86
// Total rewards
uint private _rewards; uint private _remainingRewards;
uint private _rewards; uint private _remainingRewards;
44,948
344
// ============ Modifiers ============/ Throws if called by any account other than the attester manager. /
modifier onlyAttesterManager() { address indexed previousAttesterManager, address indexed newAttesterManager ); require(msg.sender == _attesterManager, "Caller not attester manager"); _; }
modifier onlyAttesterManager() { address indexed previousAttesterManager, address indexed newAttesterManager ); require(msg.sender == _attesterManager, "Caller not attester manager"); _; }
16,948
89
// `_safeERC20Transfer` is used internally to/transfer a quantity of ERC20 tokens safely.
function _safeERC20Transfer(ERC20 _token, address payable _to, uint _amount) internal { require(_to != address(0)); require(_token.transfer(_to, _amount)); }
function _safeERC20Transfer(ERC20 _token, address payable _to, uint _amount) internal { require(_to != address(0)); require(_token.transfer(_to, _amount)); }
59,843
17
// Transfers fees from the caller to this wrapper in the event of taker relayer fees on the 0x order _takerFee Taker fee of the 0x order_takerAssetAmount Taker asset of the original_caller Address of original caller who is supploying ZRX_fillAmount Amount of takerAssetAmount to fill to calculate partial fee /
function transferRelayerFee( uint256 _takerFee, uint256 _takerAssetAmount, address _caller, uint256 _fillAmount ) private
function transferRelayerFee( uint256 _takerFee, uint256 _takerAssetAmount, address _caller, uint256 _fillAmount ) private
12,701