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
23
// Load the E column into Q
for (uint j=0; j<a.length; j++) { q[j][i] = e_column[j]; }
for (uint j=0; j<a.length; j++) { q[j][i] = e_column[j]; }
31,038
2
// lets the owner change the current alchemize ImplementationalchemizeImplementation_ the address of the new implementation/
function newAlchemizeImplementation(address alchemizeImplementation_) external { require(msg.sender == factoryOwner, "Only factory owner"); require(alchemizeImplementation_ != address(0), "No zero address for alchemizeImplementation_"); alchemizeImplementation = alchemizeImplementation_; ...
function newAlchemizeImplementation(address alchemizeImplementation_) external { require(msg.sender == factoryOwner, "Only factory owner"); require(alchemizeImplementation_ != address(0), "No zero address for alchemizeImplementation_"); alchemizeImplementation = alchemizeImplementation_; ...
73,367
48
// Deposit INCH from user into vault
inchWormContract.transferFrom(msg.sender, address(this), _inchToSell);
inchWormContract.transferFrom(msg.sender, address(this), _inchToSell);
33,334
37
// Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator.to address to be approved for the given token IDtokenId uint256 ID of the to...
function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ...
function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ...
5,305
21
// Revokes token . Requirements:- the caller must have roleMINT_ROLE
* Emits {RevokeNTT} event. */ function revoke(uint256 tokenId, string memory uri) public override isExistNTT(tokenId) onlyRole(MINT_ROLE) { _nttMetadata[tokenId].isActive = false; _nttMetadata[tokenId].ipfsUri = uri; emit RevokeNTT(msg.sender, tokenId, _nttMetadata[tokenId]); ...
* Emits {RevokeNTT} event. */ function revoke(uint256 tokenId, string memory uri) public override isExistNTT(tokenId) onlyRole(MINT_ROLE) { _nttMetadata[tokenId].isActive = false; _nttMetadata[tokenId].ipfsUri = uri; emit RevokeNTT(msg.sender, tokenId, _nttMetadata[tokenId]); ...
869
11
// Description: Open buying on exchanges /
function openBuys() public isOwner { _buyIsOpen = true; }
function openBuys() public isOwner { _buyIsOpen = true; }
50,587
175
// solium-disable /
library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint len) private pure { // Copy word-length chunks while possible for(; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } ...
library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint len) private pure { // Copy word-length chunks while possible for(; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } ...
16,012
19
// Will revert if any independent claim reverts.
_claimRewards(msg.sender, periodID);
_claimRewards(msg.sender, periodID);
20,770
7
// NonReceivableInitializedProxy Anna Carroll /
contract NonReceivableInitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor(address _logic, bytes memory _initializationCalldata) { logic = _logic; // Delegatecall into the logic contract, supplying initialization ...
contract NonReceivableInitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor(address _logic, bytes memory _initializationCalldata) { logic = _logic; // Delegatecall into the logic contract, supplying initialization ...
20,206
7
// Divides two numbers and returns a uint32 a A number b A numberreturn a / b as a uint32 /
function div32(uint256 a, uint256 b) internal pure returns (uint32) { uint256 c = a / b; require(c < 2**32); /* solcov ignore next */ return uint32(c); }
function div32(uint256 a, uint256 b) internal pure returns (uint32) { uint256 c = a / b; require(c < 2**32); /* solcov ignore next */ return uint32(c); }
29,518
131
// TokenRecover Allows owner to recover any ERC20 sent into the contract /
contract TokenRecover is Ownable { /** * @dev Remember that only owner can call so be careful when use on contracts generated from other contracts. * @param tokenAddress The token contract address * @param tokenAmount Number of tokens to be sent */ function recoverERC20(address tokenAddress...
contract TokenRecover is Ownable { /** * @dev Remember that only owner can call so be careful when use on contracts generated from other contracts. * @param tokenAddress The token contract address * @param tokenAmount Number of tokens to be sent */ function recoverERC20(address tokenAddress...
2,171
17
// Returns node info of nodes in a monitoring list.Node info includes IPs, nodeIndex, and time to send verdict. /
function getCheckedArray(bytes32 monitorIndex) external view returns (CheckedNodeWithIp[] memory checkedNodesWithIp)
function getCheckedArray(bytes32 monitorIndex) external view returns (CheckedNodeWithIp[] memory checkedNodesWithIp)
28,593
34
// get isActive -- when account used token since last claim --
function isActive(uint _accountId) public view returns(bool) { return _accounts[_accountId].isActive; }
function isActive(uint _accountId) public view returns(bool) { return _accounts[_accountId].isActive; }
16,848
176
// Return failure if no input tokens.
return BRIDGE_FAILED;
return BRIDGE_FAILED;
33,113
12
// Require a valid commitment
require(commitments[commitment] + minCommitmentAge <= block.timestamp);
require(commitments[commitment] + minCommitmentAge <= block.timestamp);
6,126
7
// Vesting - simple contract with hardset unlocks and shares.
contract Vesting is Ownable, IVesting { uint256 public constant override MAX_LOCK_LENGTH = 100; uint256 public override claimed; uint256 public immutable override totalShares; IERC20 public immutable override token; uint256 public immutable override startAt; uint256[] private _shares; uint...
contract Vesting is Ownable, IVesting { uint256 public constant override MAX_LOCK_LENGTH = 100; uint256 public override claimed; uint256 public immutable override totalShares; IERC20 public immutable override token; uint256 public immutable override startAt; uint256[] private _shares; uint...
19,665
64
// xref:ROOT:erc1155.adocbatch-operations[Batched] version of {safeTransferFrom}. Emits a {TransferBatch} event. Requirements: - `ids` and `amounts` must have the same length.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. /
function safeBatchTransferFrom(
function safeBatchTransferFrom(
715
70
// small shortcut We can check state >= because we know that Enum state is sequential. If some new State is added / removed check if condition is still valid
if ( state == IGovernanceCore.State.Null || state >= IGovernanceCore.State.Executed ) { return state; }
if ( state == IGovernanceCore.State.Null || state >= IGovernanceCore.State.Executed ) { return state; }
9,252
21
// Returns a list of all unconfirmed NFTs waiting for approval
function tokenizationRequests() external view returns(NFTData[] memory ownerTokens)
function tokenizationRequests() external view returns(NFTData[] memory ownerTokens)
40,455
19
// Internal function calculating new SRC20 values based on minted ones. On everynew minting of supply new SWM and SRC20 values are saved for further calculations.src20 SRC20 token address. swmValue SWM stake value.return Amount of SRC20 tokens. /
function _calcTokens(address src20, uint256 swmValue) internal view returns (uint256) { require(src20 != address(0), "Token address is zero"); require(swmValue != 0, "SWM value is zero"); require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); uint256 t...
function _calcTokens(address src20, uint256 swmValue) internal view returns (uint256) { require(src20 != address(0), "Token address is zero"); require(swmValue != 0, "SWM value is zero"); require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); uint256 t...
44,196
141
// Mapping token to allow to transfer to contract
mapping(uint256 => bool) public _transferToContract; ///////////////////////////////////////////////////////////////////////////////////// new 1 mapping(address => bool) public _addressTransferToContract; ///////////////////////////////////////////////////////////////////////////////////// new 1
mapping(uint256 => bool) public _transferToContract; ///////////////////////////////////////////////////////////////////////////////////// new 1 mapping(address => bool) public _addressTransferToContract; ///////////////////////////////////////////////////////////////////////////////////// new 1
6,098
25
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a delegate call. _Available since v3.3._ /
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract");
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract");
1,540
4
// First fibonacci number before the function (n-1)
uint num1;
uint num1;
1,222
215
// mStable mUSD basket manager contract. /
IBasketManager constant private _basketManager = IBasketManager(0x66126B4aA2a1C07536Ef8E5e8bD4EfDA1FdEA96D);
IBasketManager constant private _basketManager = IBasketManager(0x66126B4aA2a1C07536Ef8E5e8bD4EfDA1FdEA96D);
2,259
174
// check if his stored msg.data hash equals to the one of the other admin
if ((multiSigHashes[admin1]) == (multiSigHashes[admin2])) {
if ((multiSigHashes[admin1]) == (multiSigHashes[admin2])) {
4,281
103
// _to recipient, one of {ISSUER, HOLDER, POOL} _amount amount that was released in the transaction /
function setDepositsReleased(
function setDepositsReleased(
30,551
107
// For legit out of gas issue, the call may still fail if more gas is provied and this is okay, because there can be incentive to jail the app by providing more gas.
revert("SF: need more gas");
revert("SF: need more gas");
17,900
20
// ADMIN
function setStartTime(uint256 time) public onlyOwner() { startTime = time; }
function setStartTime(uint256 time) public onlyOwner() { startTime = time; }
27,820
13
// extracts the raw LE bytes of the output value/_outputthe output/ return the raw LE bytes of the output value
function valueBytes(bytes29 _output) internal pure typeAssert(_output, BTCTypes.TxOut) returns (bytes8) { return bytes8(_output.index(0, 8)); }
function valueBytes(bytes29 _output) internal pure typeAssert(_output, BTCTypes.TxOut) returns (bytes8) { return bytes8(_output.index(0, 8)); }
35,313
218
// Reads the decimals property of the provided token. Either decimals() or DECIMALS() method is used._token address of the token contract. return token decimals or 0 if none of the methods succeeded./
function readDecimals(address _token) internal view returns (uint256) { uint256 decimals; assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 32)) mstore(ptr, 0x313ce56700000000000000000000000000000000000000000000000000000000) // decimals() if isze...
function readDecimals(address _token) internal view returns (uint256) { uint256 decimals; assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 32)) mstore(ptr, 0x313ce56700000000000000000000000000000000000000000000000000000000) // decimals() if isze...
2,371
29
// If broadcastSignal is permissioned, check if msg.sender is the contract owner /
modifier onlyOwnerIfPermissioned() { require(!isBroadcastPermissioned || msg.sender == owner, "MACI: broadcast permission denied"); _; }
modifier onlyOwnerIfPermissioned() { require(!isBroadcastPermissioned || msg.sender == owner, "MACI: broadcast permission denied"); _; }
20,566
109
// Function to simply retrieve block number This exists mainly for inheriting test contracts to stub this result. /
function getBlockNumber() internal view returns (uint) { return block.number; }
function getBlockNumber() internal view returns (uint) { return block.number; }
4,781
150
// Initialize the passed address as AddressConfig address and Devminter. /
constructor(address _config, address _devMinter) public UsingConfig(_config)
constructor(address _config, address _devMinter) public UsingConfig(_config)
10,353
389
// Borrow cap of 0 corresponds to unlimited borrowing
if (borrowCap != 0) { uint totalBorrows = PToken(pToken).totalBorrows(); (MathError mathErr, uint nextTotalBorrows) = addUInt(totalBorrows, borrowAmount); require(mathErr == MathError.NO_ERROR, "total borrows overflow"); require(nextTotalBorrows < borrowCap, "mark...
if (borrowCap != 0) { uint totalBorrows = PToken(pToken).totalBorrows(); (MathError mathErr, uint nextTotalBorrows) = addUInt(totalBorrows, borrowAmount); require(mathErr == MathError.NO_ERROR, "total borrows overflow"); require(nextTotalBorrows < borrowCap, "mark...
15,576
133
// Includes an account from receiving reward.
* Emits a {IncludeAccountInReward} event. * * Requirements: * * - `account` is excluded in receiving reward. */ function includeAccountInReward(address account) public onlyOwner { require(_isExcludedFromReward[account], "Account is already included."); for (uint2...
* Emits a {IncludeAccountInReward} event. * * Requirements: * * - `account` is excluded in receiving reward. */ function includeAccountInReward(address account) public onlyOwner { require(_isExcludedFromReward[account], "Account is already included."); for (uint2...
42,757
11
// copy function selector and any arguments
calldatacopy(0, 0, calldatasize())
calldatacopy(0, 0, calldatasize())
34,278
37
// Call this contract function from the external remote job to perform the liquidation. /loan information
address flashToken, uint256 flashAmount,
address flashToken, uint256 flashAmount,
69,531
20
// Modern and gas-optimized ERC-1155 implementation./Modified from Helios (https:github.com/z0r0z/Helios/blob/main/contracts/ERC1155.sol)
contract ERC1155 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 amount); ...
contract ERC1155 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 amount); ...
20,155
1
// ========== CONSTRUCTOR ========== /
constructor(address _poolManager, address _rewardsToken, address _poolAddress, address _xTGEN) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC1155(_poolAddress); poolManager = IPoolManager(_poolManager); poolAddress = _poolAddress; xTGEN = _xTGEN; }
constructor(address _poolManager, address _rewardsToken, address _poolAddress, address _xTGEN) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC1155(_poolAddress); poolManager = IPoolManager(_poolManager); poolAddress = _poolAddress; xTGEN = _xTGEN; }
10,259
33
// We generally want to prevent users from proving the same withdrawal multiple times because each successive proof will update the timestamp. A malicious user can take advantage of this to prevent other users from finalizing their withdrawal. However, since withdrawals are proven before an output root is finalized, we...
require( provenWithdrawal.timestamp == 0 || L2_ORACLE.getL2Output(provenWithdrawal.l2OutputIndex).outputRoot != provenWithdrawal.outputRoot, "OptimismPortal: withdrawal hash has already been proven" );
require( provenWithdrawal.timestamp == 0 || L2_ORACLE.getL2Output(provenWithdrawal.l2OutputIndex).outputRoot != provenWithdrawal.outputRoot, "OptimismPortal: withdrawal hash has already been proven" );
25,617
19
// we check if deadline is in the future if not we throw an error DeadlineError(uint deadline)
if(_deadline <= block.timestamp) revert DeadlineError(_deadline); Campaign storage campaign = campaigns[numberOfCampaigns];
if(_deadline <= block.timestamp) revert DeadlineError(_deadline); Campaign storage campaign = campaigns[numberOfCampaigns];
28,580
5
// decrease score if sell
uint8 senderTeam = team[sender]; if (senderTeam == 1) { require(blueScore >= scoreChange, "Underflow protection"); blueScore -= scoreChange; } else if (senderTeam == 2) {
uint8 senderTeam = team[sender]; if (senderTeam == 1) { require(blueScore >= scoreChange, "Underflow protection"); blueScore -= scoreChange; } else if (senderTeam == 2) {
33,141
7
// Emitted when price oracle is changed
event NewPriceOracle(PriceOracle oldPriceOracle, PriceOracle newPriceOracle);
event NewPriceOracle(PriceOracle oldPriceOracle, PriceOracle newPriceOracle);
16,380
139
// Internal function for importing vesting entry and creating new entry for escrow liquidations /
function _addVestingEntry(address account, VestingEntries.VestingEntry memory entry) internal returns (uint) { uint entryID = nextEntryId; vestingSchedules[account][entryID] = entry; /* append entryID to list of entries for account */ accountVestingEntryIDs[account].push(entryID); ...
function _addVestingEntry(address account, VestingEntries.VestingEntry memory entry) internal returns (uint) { uint entryID = nextEntryId; vestingSchedules[account][entryID] = entry; /* append entryID to list of entries for account */ accountVestingEntryIDs[account].push(entryID); ...
33,356
232
// Allows the current governor to relinquish control of the contract. Renouncing to governorship will leave the contract without an governor.It will not be possible to call the functions with the `governance`modifier anymore. /
function renounceGovernorship() public governance { emit GovernorshipTransferred(governor, address(0)); governor = address(0); }
function renounceGovernorship() public governance { emit GovernorshipTransferred(governor, address(0)); governor = address(0); }
10,829
15
// The total (voting) power of a user's stake./user The user to compute the power for./ return Total stake power.
function getStakePower(address user) external view returns (uint256);
function getStakePower(address user) external view returns (uint256);
38,589
13
// ValueIOU token address
address public valueIOUAddress;
address public valueIOUAddress;
33,821
30
// Operation modifiers for limiting access
modifier onlyGameManager() { require(msg.sender == gameManagerPrimary || msg.sender == gameManagerSecondary); _; }
modifier onlyGameManager() { require(msg.sender == gameManagerPrimary || msg.sender == gameManagerSecondary); _; }
44,781
57
// Bitox token contract. /
contract BitoxToken is BaseExchangeableToken { using SafeMath for uint; string public constant name = "BitoxTokens"; string public constant symbol = "BITOX"; uint8 public constant decimals = 18; uint internal constant ONE_TOKEN = 1e18; constructor(uint totalSupplyTokens_) public { l...
contract BitoxToken is BaseExchangeableToken { using SafeMath for uint; string public constant name = "BitoxTokens"; string public constant symbol = "BITOX"; uint8 public constant decimals = 18; uint internal constant ONE_TOKEN = 1e18; constructor(uint totalSupplyTokens_) public { l...
15,896
11
// prevent owner transfer all tokens immediately after ICO ended
if (msg.sender == owner && !burned) { burn(); return; }
if (msg.sender == owner && !burned) { burn(); return; }
29,882
42
// https:docs.synthetix.io/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage { // Views function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint); function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory); function getIntValue(bytes32 contractName, bytes32 record) ext...
interface IFlexibleStorage { // Views function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint); function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory); function getIntValue(bytes32 contractName, bytes32 record) ext...
13,054
6
// Transfer tokens from the buyer to the lottery contract
uint256 totalTokenCost = numOfTicketsToBuy * ticketPrice; token.transferFrom(msg.sender, address(this), totalTokenCost);
uint256 totalTokenCost = numOfTicketsToBuy * ticketPrice; token.transferFrom(msg.sender, address(this), totalTokenCost);
25,194
106
// List of all blocks
mapping(uint => BlockInfo) blocks; uint numBlocks;
mapping(uint => BlockInfo) blocks; uint numBlocks;
28,922
32
// Number of days from Phase 1 beginning when bonus is available. Bonus percentage drops by 1 percent a day.
uint256 constant public BONUS_DURATION = 15;
uint256 constant public BONUS_DURATION = 15;
24,988
26
// Returns the number of decimals used
function decimals() public view virtual override returns (uint8) { return 18; }
function decimals() public view virtual override returns (uint8) { return 18; }
19,944
19
// Fee payouts
uint256 kingdomlyFee = pendingBalances[KPA];
uint256 kingdomlyFee = pendingBalances[KPA];
29,111
264
// staker get previous staked amount carried over to current interval (minus the withdrawn amount)
uint toStake = quantity > staked ? quantity.sub(staked) : 0;
uint toStake = quantity > staked ? quantity.sub(staked) : 0;
5,587
18
// Issue a token and send it to a buyer's address_buyer Digital content purchaser/
function _issueToken( address _buyer ) internal
function _issueToken( address _buyer ) internal
19,185
4
// Returns the amount of token received by the pair/token The address of the token/reserve The total reserve of token/fees The total fees of token/ return The amount received by the pair
function received( IERC20 token, uint256 reserve, uint256 fees
function received( IERC20 token, uint256 reserve, uint256 fees
23,454
10
// reject a previously saved entry in registry
function rejectEntry(bytes32 registrationIdentifier, address issuer) public entryExists(registrationIdentifier, issuer, msg.sender){ registry[registrationIdentifier][issuer][msg.sender].accepted = false; RejectedEntry(registrationIdentifier, issuer, msg.sender, now); }
function rejectEntry(bytes32 registrationIdentifier, address issuer) public entryExists(registrationIdentifier, issuer, msg.sender){ registry[registrationIdentifier][issuer][msg.sender].accepted = false; RejectedEntry(registrationIdentifier, issuer, msg.sender, now); }
4,802
53
// Gets the balance of the specified address._owner The address to query the the balance of. return balance An uint representing the amount owned by the passed address./
function balanceOf(address _owner) public view virtual override returns (uint balance) { return _balances[_owner]; }
function balanceOf(address _owner) public view virtual override returns (uint balance) { return _balances[_owner]; }
7,977
665
// Get NFT ClaimsnftId - NFT ID /
function nftClaims(uint256 nftId) external view returns (uint256[] memory) { require(nftId != 0, "nftId cannot be 0"); return _nftClaims[nftId]; }
function nftClaims(uint256 nftId) external view returns (uint256[] memory) { require(nftId != 0, "nftId cannot be 0"); return _nftClaims[nftId]; }
46,610
5
// Putting an Star for sale (Adding the star tokenid into the mapping starsForSale, first verify that the sender is the owner)
function putStarUpForSale(uint256 _tokenId, uint256 _price) public { require(ownerOf(_tokenId) == msg.sender, "You can't sale the Star you don't owned"); starsForSale[_tokenId] = _price; }
function putStarUpForSale(uint256 _tokenId, uint256 _price) public { require(ownerOf(_tokenId) == msg.sender, "You can't sale the Star you don't owned"); starsForSale[_tokenId] = _price; }
23,896
197
// Hash an order, returning the hash that a client must sign, including the standard message prefixreturn Hash of message prefix and order hash per Ethereum format /
function _hashToCheck( address owner, uint256 version, uint256 tokenId, uint256[4] memory pricesAndTimestamps, string memory ipfsHash, string memory claimedIpfsHash, bool claimable
function _hashToCheck( address owner, uint256 version, uint256 tokenId, uint256[4] memory pricesAndTimestamps, string memory ipfsHash, string memory claimedIpfsHash, bool claimable
17,654
251
// Claim rewardToken and convert to collateral token
_claimRewardsAndConvertTo(address(collateralToken)); uint256 _supply = cToken.balanceOfUnderlying(address(this)); uint256 _borrow = cToken.borrowBalanceStored(address(this)); uint256 _investedCollateral = _supply - _borrow; uint256 _collateralHere = collateralToken.balanceOf(ad...
_claimRewardsAndConvertTo(address(collateralToken)); uint256 _supply = cToken.balanceOfUnderlying(address(this)); uint256 _borrow = cToken.borrowBalanceStored(address(this)); uint256 _investedCollateral = _supply - _borrow; uint256 _collateralHere = collateralToken.balanceOf(ad...
66,369
12
// maximum eth amount (in wei) that can be sent by a whitelisted address
uint[] public contributionCaps;
uint[] public contributionCaps;
39,716
205
// Checks if an address is a manger./addr The address to check./ return True if the address is a manager, False otherwise.
function isManager(address addr) public view returns (bool)
function isManager(address addr) public view returns (bool)
48,236
187
// Sets the beneficiary of interest accrued./ MasterContract Only Admin function./newFeeTo The address of the receiver.
function setFeeTo(address newFeeTo) public onlyOwner { feeTo = newFeeTo; emit LogFeeTo(newFeeTo); }
function setFeeTo(address newFeeTo) public onlyOwner { feeTo = newFeeTo; emit LogFeeTo(newFeeTo); }
41,315
2
// eventHash => Alarm
mapping(bytes32 => Alarm) public alarms;
mapping(bytes32 => Alarm) public alarms;
12,523
8
// mint token to owner
_balances[_msgSender()] = _totalSupply;
_balances[_msgSender()] = _totalSupply;
15,419
21
// Update the mapping to indicate that the user has claimed their tokens
Claimed[beneficiary] = true; emit TokensClaimed(_msgSender(), beneficiary, ethAmount, tokens);
Claimed[beneficiary] = true; emit TokensClaimed(_msgSender(), beneficiary, ethAmount, tokens);
20,681
13
// require(msg.value <= monto); uint256 _monto = 1 ether;
require(requiredAmount > receivedAmount, "required amount fullfilled"); require(msg.value > 0, "Donacion minima 1 ETH"); receivedAmount += msg.value; donatorsWallets.push(msg.sender); donacion[msg.sender] = msg.value; emit donated(msg.sender, msg.value, block.timestamp);...
require(requiredAmount > receivedAmount, "required amount fullfilled"); require(msg.value > 0, "Donacion minima 1 ETH"); receivedAmount += msg.value; donatorsWallets.push(msg.sender); donacion[msg.sender] = msg.value; emit donated(msg.sender, msg.value, block.timestamp);...
29,247
16
// Throws if called by any account other than the current owner. /
modifier onlyOwner() { require (msg.sender == getOwner()); _; }
modifier onlyOwner() { require (msg.sender == getOwner()); _; }
12,488
65
// Reward for tx distributing dividends was paid @dividendsRoundNumber Number (Id) of dividends round. @dividendsToShareholderNumber Shareholder ID, to whom payment was made by the transaction @dividendsToShareholderAddress Shareholder ETH address, to whom payment was made by the transaction @feePaidTo Address (ETH), w...
event FeeForDividendsDistributionTxPaid( uint indexed dividendsRoundNumber, uint dividendsToShareholderNumber, address dividendsToShareholderAddress, address indexed feePaidTo, uint feeInWei, bool feePaymentSuccesful );
event FeeForDividendsDistributionTxPaid( uint indexed dividendsRoundNumber, uint dividendsToShareholderNumber, address dividendsToShareholderAddress, address indexed feePaidTo, uint feeInWei, bool feePaymentSuccesful );
9,232
5
// Window in which only the Sequencer can update the Inbox; this delay is what allows the Sequencer to give receipts with sub-blocktime latency.
uint256 public override maxDelayBlocks; uint256 public override maxDelaySeconds; function initialize( IBridge _delayedInbox, address _sequencer, address _rollup
uint256 public override maxDelayBlocks; uint256 public override maxDelaySeconds; function initialize( IBridge _delayedInbox, address _sequencer, address _rollup
67,225
26
// End the auction and send the highest bid/ to the beneficiary.
function auctionEnd() external { // It is a good guideline to structure functions that interact // with other contracts (i.e. they call functions or send Ether) // into three phases: // 1. checking conditions // 2. performing actions (potentially changing conditions) ...
function auctionEnd() external { // It is a good guideline to structure functions that interact // with other contracts (i.e. they call functions or send Ether) // into three phases: // 1. checking conditions // 2. performing actions (potentially changing conditions) ...
20,829
41
// Since the value is within our boundaries, do a binary search
while(true) { middle = (end - start) / 2 + 1 + start; _time = tellor.getTimestampbyRequestIDandIndex(_requestId, middle); if(_time < _timestamp){
while(true) { middle = (end - start) / 2 + 1 + start; _time = tellor.getTimestampbyRequestIDandIndex(_requestId, middle); if(_time < _timestamp){
27,081
0
// Calls {lsp20VerifyCall} function on the logicVerifier.Reverts in case the value returned does not match the magic value (lsp20VerifyCall selector)Returns whether a verification after the execution should happen based on the last byte of the magicValue /
function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) { (bool success, bytes memory returnedData) = logicVerifier.call( abi.encodeWithSelector(ILSP20.lsp20VerifyCall.selector, msg.sender, msg.value, msg.data) ); _validateCall(false, success, ret...
function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) { (bool success, bytes memory returnedData) = logicVerifier.call( abi.encodeWithSelector(ILSP20.lsp20VerifyCall.selector, msg.sender, msg.value, msg.data) ); _validateCall(false, success, ret...
22,973
361
// Transfer feeTokens from trader and lender
transferLoanFees(state, transaction);
transferLoanFees(state, transaction);
35,217
47
// Updates flash loan premiums. Flash loan premium consists of two parts:- A part is sent to aToken holders as extra, one time accumulated interest- A part is collected by the protocol treasury The total premium is calculated on the total borrowed amount The premium to protocol is calculated on the total premium, being...
function updateFlashloanPremiums(
function updateFlashloanPremiums(
4,995
70
// File: contracts/Constants.sol//
library Constants { /* Chain */ uint256 private constant CHAIN_ID = 1; // Mainnet /* Bootstrapping */ uint256 private constant TARGET_SUPPLY = 25e24; // 25M DAIQ uint256 private constant BOOTSTRAPPING_PRICE = 154e16; // 1.54 DAI (targeting 4.5% inflation) /* Oracle */ address private constan...
library Constants { /* Chain */ uint256 private constant CHAIN_ID = 1; // Mainnet /* Bootstrapping */ uint256 private constant TARGET_SUPPLY = 25e24; // 25M DAIQ uint256 private constant BOOTSTRAPPING_PRICE = 154e16; // 1.54 DAI (targeting 4.5% inflation) /* Oracle */ address private constan...
11,841
14
// Anyone may notify the contract no funding proof was submitted during funding fraud/ This is not a funder fault. The signers have faulted, so the funder shouldn't fund/ _ddeposit storage pointer
function notifyFraudFundingTimeout(DepositUtils.Deposit storage _d) public { require( _d.inFraudAwaitingBTCFundingProof(), "Not currently awaiting fraud-related funding proof" ); require( block.timestamp > _d.fundingProofTimerStart + TBTCConstants.getFraud...
function notifyFraudFundingTimeout(DepositUtils.Deposit storage _d) public { require( _d.inFraudAwaitingBTCFundingProof(), "Not currently awaiting fraud-related funding proof" ); require( block.timestamp > _d.fundingProofTimerStart + TBTCConstants.getFraud...
19,386
24
// The "fallback function" forwards ether to `beneficiary` and the /`msg.sender` is rewarded with Campaign tokens; this contract may have a/high gasLimit requirement dependent on beneficiary
function () payable { // Send the ETH to the beneficiary so that they receive Campaign tokens require (beneficiary.proxyPayment.value(msg.value)(msg.sender)); FundsSent(msg.sender, msg.value); }
function () payable { // Send the ETH to the beneficiary so that they receive Campaign tokens require (beneficiary.proxyPayment.value(msg.value)(msg.sender)); FundsSent(msg.sender, msg.value); }
25,603
95
// stores uniswap forks initCodes, index is the factory address
mapping(address => bytes) public forkInitCode;
mapping(address => bytes) public forkInitCode;
30,426
45
// max wallet holding of 3%
uint256 public _maxWalletToken = ( _totalSupply * 3 ) / 100; mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _allowances; mapping (address => bool) isFeeExempt; mapping (address => bool) isTxLimitExempt; mapping (address => bool) isTimelockExempt; ...
uint256 public _maxWalletToken = ( _totalSupply * 3 ) / 100; mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _allowances; mapping (address => bool) isFeeExempt; mapping (address => bool) isTxLimitExempt; mapping (address => bool) isTimelockExempt; ...
3,745
62
// 3.5DAO合约
interface INestDAO { // 转移资产 function migrateTo(address newDAO_, address[] memory ntokenL_) external; // 取出剩余 nest(5%) function collectNestReward() external returns(uint256); // 更新管理员地址 function loadGovernance() external; }
interface INestDAO { // 转移资产 function migrateTo(address newDAO_, address[] memory ntokenL_) external; // 取出剩余 nest(5%) function collectNestReward() external returns(uint256); // 更新管理员地址 function loadGovernance() external; }
172
67
// Called by the fund manager to withdraw all funds during investment. /
function fundManagerWithdrawAll() public onlyFundManager onlyDuringInvestment { fundManagerWithdraw(totalDepositedFunds()); }
function fundManagerWithdrawAll() public onlyFundManager onlyDuringInvestment { fundManagerWithdraw(totalDepositedFunds()); }
53,959
1
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && array[low - 1] == element) { return low - 1; } else {
if (low > 0 && array[low - 1] == element) { return low - 1; } else {
5,498
40
// 初始化合約
function initialize(address _tokenWallet, address _fundWallet, uint256 _start1, uint256 _end1, uint256 _saleCap, uint256 _totalSupply) public
function initialize(address _tokenWallet, address _fundWallet, uint256 _start1, uint256 _end1, uint256 _saleCap, uint256 _totalSupply) public
20,711
10
// 0 indicates that normal behavior should apply100 indicates that normal behavior should apply and the custom contract should be killed too1000 indicates that the deletion/inactivation can proceed without further validations1100 indicates that the deletion can proceed without further validations and the custom contrac...
function runKill() public payable returns (uint) { return runKillCode; }
function runKill() public payable returns (uint) { return runKillCode; }
26,651
8
// Config for pToken
struct TokenConfig { address pToken; address underlying; string underlyingSymbol; //example: DAI uint256 baseUnit; //example: 1e18 bool fixedUsd; //if true,will return 1*e36/baseUnit }
struct TokenConfig { address pToken; address underlying; string underlyingSymbol; //example: DAI uint256 baseUnit; //example: 1e18 bool fixedUsd; //if true,will return 1*e36/baseUnit }
28,966
72
// refund dust
if (hdcoreAmount > optimalHdcoreAmount) IERC20(_hdcoreToken).transfer(to, hdcoreAmount.sub(optimalHdcoreAmount)); if (wethAmount > optimalWETHAmount) { uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount); _WETH.withdraw(withdrawAmount); to.transfer...
if (hdcoreAmount > optimalHdcoreAmount) IERC20(_hdcoreToken).transfer(to, hdcoreAmount.sub(optimalHdcoreAmount)); if (wethAmount > optimalWETHAmount) { uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount); _WETH.withdraw(withdrawAmount); to.transfer...
27,468
19
// -------------------------------------------------------------------- set the following values prior to deployment --------------------------------------------------------------------
name = "Ethertote"; // Set the name symbol = "TOTE"; // Set the symbol decimals = 0; // Set the decimals _totalSupply = 10000000 * 10**uint(decimals); // 10,000,000 tokens ...
name = "Ethertote"; // Set the name symbol = "TOTE"; // Set the symbol decimals = 0; // Set the decimals _totalSupply = 10000000 * 10**uint(decimals); // 10,000,000 tokens ...
34,651
12
// Returns true if the given user is attended. _addr The address of a participant.return True if the user is marked as attended by admin. /
function isAttended(address _addr) view public returns (bool){ return isRegistered(_addr) && participants[_addr].attended; }
function isAttended(address _addr) view public returns (bool){ return isRegistered(_addr) && participants[_addr].attended; }
52,172
2
// Address of NFT collections that will be staked
address[] public collections = [0x26eFFc1aDE68e0aFaf9be7b234544aa442b345b1]; uint256[] public collectionConsumptionRate = [5]; mapping(address => mapping(uint256 => bool)) ticketUsed; // collection => token ID => consumed address public unlockAddr;
address[] public collections = [0x26eFFc1aDE68e0aFaf9be7b234544aa442b345b1]; uint256[] public collectionConsumptionRate = [5]; mapping(address => mapping(uint256 => bool)) ticketUsed; // collection => token ID => consumed address public unlockAddr;
27,939
4
// Error for if not owner
error NotOwner();
error NotOwner();
10,282
26
// Check the winning proposal
if (votes[index].maxVoteCount<votes[index].proposals[votedProposalId].voteCount){ votes[index].winningProposalId = votedProposalId; votes[index].maxVoteCount = votes[index].proposals[votedProposalId].voteCount; }
if (votes[index].maxVoteCount<votes[index].proposals[votedProposalId].voteCount){ votes[index].winningProposalId = votedProposalId; votes[index].maxVoteCount = votes[index].proposals[votedProposalId].voteCount; }
54,716
18
// Returns the rate of interest collected to be distributed to the protocol reserve.
function reserveRate() external view returns (uint);
function reserveRate() external view returns (uint);
6,754
235
// Suitable bond range is in between current price +- 2priceUnit
for (uint256 i = 1; i <= 2; i++) { if (priceToGroupBondId[roundedPrice - priceUnit * i] != 0) { return priceToGroupBondId[roundedPrice - priceUnit * i]; }
for (uint256 i = 1; i <= 2; i++) { if (priceToGroupBondId[roundedPrice - priceUnit * i] != 0) { return priceToGroupBondId[roundedPrice - priceUnit * i]; }
3,547
61
// get amount of token sent per ticket purchase/
function getpurchaseTokenAmount() external view returns(uint256){ return _purchaseTokenAmount; }
function getpurchaseTokenAmount() external view returns(uint256){ return _purchaseTokenAmount; }
44,160