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.accCVTokenPer...
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.accCVTokenPer...
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...
* 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...
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 ...
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, ...
{ 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, ...
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 ...
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 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); ...
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,...
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,...
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) { ...
) 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) { ...
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 tr...
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 ...
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 ...
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 a...
* 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 a...
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++) {...
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++) {...
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 c...
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 c...
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 changi...
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 changi...
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; ...
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; ...
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].toke...
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].toke...
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; ...
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; ...
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 s...
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))) ...
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))) ...
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 { } ...
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 { } ...
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); ...
modifier updatePeriod(bool _startNow) { uint256 _period = period; _updatePeriod(_startNow); if(_period != period){ uint256 _nextPeriodForExchange; uint256 _previousPeriodDebt; (_nextPeriodForExchange, _previousPeriodDebt) = _getOutTokenForExchange(_period); ...
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 allow...
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...
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...
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