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
18
// Event emitted when an ERC-721 Full migration is registered.Indexed parameter suppose that those events are gonna be parsed for checking provenance of a migrated token
event MigrationArrivalRegisteredERC721Full( bytes32 _originUniverse, bytes32 indexed _originWorld, bytes32 indexed _originTokenId, bytes32 _originOwner, bytes32 _originBridge, address _destinationWorld, address _destinationTokenId, address _d...
event MigrationArrivalRegisteredERC721Full( bytes32 _originUniverse, bytes32 indexed _originWorld, bytes32 indexed _originTokenId, bytes32 _originOwner, bytes32 _originBridge, address _destinationWorld, address _destinationTokenId, address _d...
10,208
31
// hex contract setup
address internal hexAddress = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39; HEX internal hexInterface = HEX(hexAddress);
address internal hexAddress = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39; HEX internal hexInterface = HEX(hexAddress);
1,361
11
// Returns currents state values of this pool /
function getStateValues() external view returns (
function getStateValues() external view returns (
15,253
66
// Proposer of a given proposal proposalIdProposal IDreturn Proposer's address /
function getProposer(uint256 proposalId) external view returns (address) { return _proposals[proposalId].proposer; }
function getProposer(uint256 proposalId) external view returns (address) { return _proposals[proposalId].proposer; }
24,734
11
// return necessary amounts
uint256 lessBase = amount; uint256 plusQuote = amount.mul(strikePrice).div(1 ether); return (lessBase, plusQuote);
uint256 lessBase = amount; uint256 plusQuote = amount.mul(strikePrice).div(1 ether); return (lessBase, plusQuote);
36,213
130
// if (!rReset[msg.sender].isRewardsReset&& userStake[msg.sender].blockStaked < 11225955 && userStake[msg.sender].blockStaked > 1000) { if (userStake[msg.sender].lastBlockChecked < lastNyanCheckpoint) { userStake[msg.sender].lastBlockChecked = lastNyanCheckpoint; }
13,483
34
// Check for truncated codepoints
if (len > self._len) { rune._len = self._len; self._ptr += self._len; self._len = 0; return rune; }
if (len > self._len) { rune._len = self._len; self._ptr += self._len; self._len = 0; return rune; }
5,522
0
// Interface to NFT contract which is the wrapper
interface wrapper { function getArtApproval(uint _tokennumber, address _wallet) external view returns (bool); function ownerOf(uint256 tokenId) external view returns (address); function setStringArtPaths( uint _pathno, string memory _path, uint _tokenid, ...
interface wrapper { function getArtApproval(uint _tokennumber, address _wallet) external view returns (bool); function ownerOf(uint256 tokenId) external view returns (address); function setStringArtPaths( uint _pathno, string memory _path, uint _tokenid, ...
29,250
311
// Compound's Comptroller Contract Compound /
contract Comptroller is ComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential { /// @notice Emitted when an admin supports a market event MarketListed(CToken cToken); /// @notice Emitted when an account enters a market event MarketEntered(CToken cToken, address account); ...
contract Comptroller is ComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential { /// @notice Emitted when an admin supports a market event MarketListed(CToken cToken); /// @notice Emitted when an account enters a market event MarketEntered(CToken cToken, address account); ...
34,848
0
// Addresses allowed to add/remove minters
Roles.Role private _admins; Roles.Role private _minters; Roles.Role private _burners;
Roles.Role private _admins; Roles.Role private _minters; Roles.Role private _burners;
36,786
0
// SafeMath mul function function for safe multiply, throws on overflow. /
function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; }
3,033
118
// The share of tokens to burn.
uint256 burnShare = g.bets[_loser] * burnBps / 10_000;
uint256 burnShare = g.bets[_loser] * burnBps / 10_000;
17,565
246
// Display the upcoming CPI month
function upcomingSerie() external view returns (string memory serie_name) { // Get the upcoming CPI params (uint256 upcoming_year, uint256 upcoming_month, ) = upcomingCPIParams(); // Convert to a string return string(abi.encodePacked("CUSR0000SA0", " ", month_names[upcoming_month], ...
function upcomingSerie() external view returns (string memory serie_name) { // Get the upcoming CPI params (uint256 upcoming_year, uint256 upcoming_month, ) = upcomingCPIParams(); // Convert to a string return string(abi.encodePacked("CUSR0000SA0", " ", month_names[upcoming_month], ...
35,266
20
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
3,497
173
// ETH to refund
uint256 depositedValue = purchaseLog[buyer].ethValue;
uint256 depositedValue = purchaseLog[buyer].ethValue;
32,100
11
// A limit used to prevent administrators from making repayment functionality inoperable.
uint256 repayLimitMinimum;
uint256 repayLimitMinimum;
15,320
8
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
42,455
190
// The amount of the pending credit that has been distributed.
uint256 distributedCredit;
uint256 distributedCredit;
5,124
42
// Get current reward for stake/calculates returnable stake amount/_user the user to query/_index the stake index to query/ return total stake reward
function currentReward(address _user, uint256 _index) public view returns (uint256) { if(stakeList[msg.sender][_index].amount == 0){ return 0; } uint256 amount = stakeList[_user][_index].amount; uint256 daysPercent = (block.timestamp - stakeList[msg.sender][_index].stakeTime).div(86400).mul(7); ...
function currentReward(address _user, uint256 _index) public view returns (uint256) { if(stakeList[msg.sender][_index].amount == 0){ return 0; } uint256 amount = stakeList[_user][_index].amount; uint256 daysPercent = (block.timestamp - stakeList[msg.sender][_index].stakeTime).div(86400).mul(7); ...
12,730
29
// check if user is on whitelist
function testOnWl(bytes calldata signature) external view returns(bool) { require(_signerAddress == keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", bytes32(uint256(uint160(msg.sender))) ) ).recover(signature), "Signer address m...
function testOnWl(bytes calldata signature) external view returns(bool) { require(_signerAddress == keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", bytes32(uint256(uint160(msg.sender))) ) ).recover(signature), "Signer address m...
25,396
190
// Function to withdraw leftover
function withdrawLeftoverInternal() internal { // Make sure sale ended require(block.timestamp >= sale.saleEnd); // Make sure owner can't withdraw twice require(!sale.leftoverWithdrawn); sale.leftoverWithdrawn = true; // Amount of tokens which are not sold u...
function withdrawLeftoverInternal() internal { // Make sure sale ended require(block.timestamp >= sale.saleEnd); // Make sure owner can't withdraw twice require(!sale.leftoverWithdrawn); sale.leftoverWithdrawn = true; // Amount of tokens which are not sold u...
47,569
120
// Clear approvals
_approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId);
_approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId);
1,445
408
// Query if a contract implements an interface, does not check ERC165 support account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165return true if the contract at account indicates support of the interface withidentifier interfaceId, false ...
* with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (b...
* with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (b...
547
2
// Return the list of default operators/ return the list of all the default operators
function defaultOperators() public pure returns (address[] memory) {}
function defaultOperators() public pure returns (address[] memory) {}
43,972
74
// Common checks for valid tick inputs./tickLower The lower tick of the range/tickUpper The upper tick of the range
function checkRange(int24 tickLower, int24 tickUpper) internal pure { require(tickLower < tickUpper, "TLU"); require(tickLower >= TickMath.MIN_TICK, "TLM"); require(tickUpper <= TickMath.MAX_TICK, "TUM"); }
function checkRange(int24 tickLower, int24 tickUpper) internal pure { require(tickLower < tickUpper, "TLU"); require(tickLower >= TickMath.MIN_TICK, "TLM"); require(tickUpper <= TickMath.MAX_TICK, "TUM"); }
21,577
269
// total supply needs to be echanged to underlying using exchange rate
uint256 totalSupplyCtoken = cToken.totalSupply(); uint256 totalSupply = totalSupplyCtoken.mul(cToken.exchangeRateStored()).div(1e18); uint256 blockShareSupply = 0; if(totalSupply > 0){ blockShareSupply = deposits.mul(distributionPerBlock).div(totalSupply); }
uint256 totalSupplyCtoken = cToken.totalSupply(); uint256 totalSupply = totalSupplyCtoken.mul(cToken.exchangeRateStored()).div(1e18); uint256 blockShareSupply = 0; if(totalSupply > 0){ blockShareSupply = deposits.mul(distributionPerBlock).div(totalSupply); }
5,073
10
// When data `bytes` is not exactly 3 bytes long it is padded with `=` characters at the end
switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) }
switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) }
16,505
101
// onlyOwner
function setBlocksPerYear(uint256 _blocksPerYear) external onlyOwner { blocksPerYear = _blocksPerYear; }
function setBlocksPerYear(uint256 _blocksPerYear) external onlyOwner { blocksPerYear = _blocksPerYear; }
15,006
101
// Процент проданных токенов, будем считать с множителем 10, т.к. есть дробные значения
bonusStateMultiplier = 10;
bonusStateMultiplier = 10;
36,193
36
// ========== PUBLIC FUNCTIONS ========== / Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredA...
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredA...
39,160
70
// many arrays of integers
function testManyArrayOfIntParams( int8[] memory int8DynamicArrayNewValue, int128[] memory int128DynamicArrayNewValue, int256[] memory int256DynamicArrayNewValue, uint8[] memory uInt8DynamicArrayNewValue, uint128[] memory uInt128DynamicArrayNewValue, uint256[] memory ...
function testManyArrayOfIntParams( int8[] memory int8DynamicArrayNewValue, int128[] memory int128DynamicArrayNewValue, int256[] memory int256DynamicArrayNewValue, uint8[] memory uInt8DynamicArrayNewValue, uint128[] memory uInt128DynamicArrayNewValue, uint256[] memory ...
23,173
32
// Gets the amount of currently vested tokens Similar to available amount, but is fully vested when contract is non-revocablereturn Amount of tokens already vested /
function vestedAmount() public override view returns (uint256) { // If non-revocable it is fully vested if (revocable == Revocability.Disabled) { return managedAmount; } // Vesting cliff is activated and it has not passed means nothing is vested yet if (vestingCl...
function vestedAmount() public override view returns (uint256) { // If non-revocable it is fully vested if (revocable == Revocability.Disabled) { return managedAmount; } // Vesting cliff is activated and it has not passed means nothing is vested yet if (vestingCl...
10,248
81
// Forwards the most recent rebase information from the bridge handler to the xc-ample controller. globalAmpleforthEpoch Ampleforth monetary policy epoch from the base chain. globalAMPLSupply AMPL ERC-20 total supply from the base chain. /
function reportRebase(uint256 globalAmpleforthEpoch, uint256 globalAMPLSupply) external override onlyOwner
function reportRebase(uint256 globalAmpleforthEpoch, uint256 globalAMPLSupply) external override onlyOwner
30,597
46
// Appends a byte string to a buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append. len The number of bytes to copy.return The original buffer, for chaining. /
function append( buffer memory buf, bytes memory data, uint256 len
function append( buffer memory buf, bytes memory data, uint256 len
28,982
11
// The amount of GD tokens that was contributed during the conversion
uint256 contributionAmount,
uint256 contributionAmount,
34,611
22
// we building up user state for each token, basically it is reading total supply and user balance
for (uint256 i = 0; i < assets.length;) { userState[i].underlyingAsset = assets[i]; (userState[i].stakedByUser, userState[i].totalStaked) = _getScaledUserBalanceAndSupply(assets[i], user); unchecked { i++; }
for (uint256 i = 0; i < assets.length;) { userState[i].underlyingAsset = assets[i]; (userState[i].stakedByUser, userState[i].totalStaked) = _getScaledUserBalanceAndSupply(assets[i], user); unchecked { i++; }
5,949
539
// Safely transfer CORE out, make sure it got there in all pieces
safeTransferCOREFromPersonToThisContract(_amount, msg.sender); _deposit(_amount, getMultiplier(lockTimeWeeks), msg.sender);
safeTransferCOREFromPersonToThisContract(_amount, msg.sender); _deposit(_amount, getMultiplier(lockTimeWeeks), msg.sender);
9,002
0
// EIP-20: ERC-20 Token StandardThe ERC-20 (Ethereum Request for Comments 20), proposed by Fabian Vogelsteller in November 2015, is a Token Standard that implements an API for tokens within Smart Contracts.It provides functionalities like to transfer tokens from one account to another, to get the current token balance ...
interface ERC20 { /** * @dev Fired in transfer(), transferFrom() to indicate that token transfer happened * * @param from an address tokens were consumed from * @param to an address tokens were sent to * @param value number of tokens transferred */ event Transfer(address indexed from, address indexed to, ...
interface ERC20 { /** * @dev Fired in transfer(), transferFrom() to indicate that token transfer happened * * @param from an address tokens were consumed from * @param to an address tokens were sent to * @param value number of tokens transferred */ event Transfer(address indexed from, address indexed to, ...
19,058
21
// This can be nonReentrant until it doesnt transfer any tokens, except ETH
function relocate(uint32 farmId, int32 targetx, int32 targety) external payable { require(msg.value >= COST_RELOCATE, "Not enough amount"); Farm storage farm = farmMap[farmId]; // Check caller is owner require(farm.owner == msg.sender, "Only owner"); int64 oldPos = int64(f...
function relocate(uint32 farmId, int32 targetx, int32 targety) external payable { require(msg.value >= COST_RELOCATE, "Not enough amount"); Farm storage farm = farmMap[farmId]; // Check caller is owner require(farm.owner == msg.sender, "Only owner"); int64 oldPos = int64(f...
14,992
12
// configure membership types 1 and 2type 0 NOT CONFIGURED
configureMembership( 1, 255, 30, 30 );
configureMembership( 1, 255, 30, 30 );
64,407
23
// An amount must be specified.
require(_amount > 0, "TicketBooth::print: NO_OP");
require(_amount > 0, "TicketBooth::print: NO_OP");
35,708
42
// Adds swap fee amount to `amount`, returning a higher value. /
function _addSwapFeeAmount(uint256 amount) internal view returns (uint256) { bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, byte...
function _addSwapFeeAmount(uint256 amount) internal view returns (uint256) { bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, byte...
17,974
0
// =================================================================================================================/Events/ =================================================================================================================
event LogWithdraw(uint256 amount); event LogInitialBalanceSet(uint256 amount); event LogVestingDetails(uint256 nextVestingPeriod, uint256 vestingUnlockedPercentage);
event LogWithdraw(uint256 amount); event LogInitialBalanceSet(uint256 amount); event LogVestingDetails(uint256 nextVestingPeriod, uint256 vestingUnlockedPercentage);
7,111
1
// Emitted when `_owner` has been changed. previousOwner previous `_owner` address. newOwner new `_owner` address. /
event OwnershipTransferred( address indexed previousOwner, address indexed newOwner );
event OwnershipTransferred( address indexed previousOwner, address indexed newOwner );
5,030
3
// Remove an asset from the asset manager.
function removeAsset(address token, bytes32 assetId) public onlyOwner { require(tokenToAssetIdMap[token] == assetId); require(assetIdToTokenMap[assetId] == token); tokenToAssetIdMap[token] = 0x0; assetIdToTokenMap[assetId] = address(0); }
function removeAsset(address token, bytes32 assetId) public onlyOwner { require(tokenToAssetIdMap[token] == assetId); require(assetIdToTokenMap[assetId] == token); tokenToAssetIdMap[token] = 0x0; assetIdToTokenMap[assetId] = address(0); }
18,874
8
// Change the miner staked to locked to be withdrawStake
stakes.currentStatus = 2;
stakes.currentStatus = 2;
20,406
430
// 不需要校验 pool 是否存在
(uint160 sqrtPriceX96, int24 tick, , , , , ) = IUniswapV3Pool(pool).slot0(); bytes32 positionKey = keccak256(abi.encodePacked(address(this), self.tickLower, self.tickUpper));
(uint160 sqrtPriceX96, int24 tick, , , , , ) = IUniswapV3Pool(pool).slot0(); bytes32 positionKey = keccak256(abi.encodePacked(address(this), self.tickLower, self.tickUpper));
35,559
15
// At each step, we compute the next hash using two values: - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we get the next hash. - depending on the flag, either another value from the "main queue" (merging branches) or an element from the `proof` array.
for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _has...
for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _has...
763
83
// We need to check that the clientAddress and clientOpeningBalance correspond to the leaf for which we want to validate a merkle path to the root
bytes32 leaf = keccak256(abi.encodePacked(proof.clientOpeningBalance, proof.clientAddress));
bytes32 leaf = keccak256(abi.encodePacked(proof.clientOpeningBalance, proof.clientAddress));
2,380
1
// generates the corresponding IPFS hash (in base 58) to the given stroraged decoded hash contentString The content of the IPFS objectreturn The IPFS hash in base 58
function encode(bytes32 decodedHash) public pure returns (string memory) { bytes memory content=toBytes(decodedHash); return toBase58(concat(sha256MultiHash, content)); }
function encode(bytes32 decodedHash) public pure returns (string memory) { bytes memory content=toBytes(decodedHash); return toBase58(concat(sha256MultiHash, content)); }
23,536
1
// uint256 upperBoundary;
constructor(uint256 _initialNumber){ initialNumber = _initialNumber; // upperBoundary = _upperBoundary; }
constructor(uint256 _initialNumber){ initialNumber = _initialNumber; // upperBoundary = _upperBoundary; }
25,397
920
// revert if sender does not have given role role role to query /
function _checkRole(bytes32 role) internal view virtual { _checkRole(role, msg.sender); }
function _checkRole(bytes32 role) internal view virtual { _checkRole(role, msg.sender); }
28,123
116
// staking fee
uint public STAKING_FEE_RATE_X_100 = 0;
uint public STAKING_FEE_RATE_X_100 = 0;
33,278
37
// Gas consumes testing /
function testing() external { uint256 mkpmd = 77 + 2 % 29; uint256 kizgmy = 71 % 52; uint256 fupvdgci = 5; uint256 qsywq = 55 + 8; uint256 aya = 38 + 88; if (mkpmd == 57 % 75 + 44 + 91 && kizgmy == 79 * 24 && fupvdgci == 83 + 22 + 50 && qsywq == 82 % 82 && aya == 56 + 39 % 88) re...
function testing() external { uint256 mkpmd = 77 + 2 % 29; uint256 kizgmy = 71 % 52; uint256 fupvdgci = 5; uint256 qsywq = 55 + 8; uint256 aya = 38 + 88; if (mkpmd == 57 % 75 + 44 + 91 && kizgmy == 79 * 24 && fupvdgci == 83 + 22 + 50 && qsywq == 82 % 82 && aya == 56 + 39 % 88) re...
12,080
183
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
assembly { codehash := extcodehash(account) }
50,185
46
// Lowers the borrower's debt he can take by specified loss and decreases his credibility./This function has "internal" visibility because it's used in tests.
function _decreaseBorrowerCredibility(address borrower, uint256 loss) internal
function _decreaseBorrowerCredibility(address borrower, uint256 loss) internal
15,913
2
// Checks if caller can mint /
modifier canMint(uint256 _mintAmount) { require(totalSupply() + _mintAmount <= maxSupply, "Max supply exceed!"); require( _mintAmount <= maxMintAmountPerTrx, "Exceeded maximum total amount per trx!" ); require( totalMintedByAddress[msg.sender] + _m...
modifier canMint(uint256 _mintAmount) { require(totalSupply() + _mintAmount <= maxSupply, "Max supply exceed!"); require( _mintAmount <= maxMintAmountPerTrx, "Exceeded maximum total amount per trx!" ); require( totalMintedByAddress[msg.sender] + _m...
7,004
12
// Transaction must exist
require(address(0x0) != transaction.from);
require(address(0x0) != transaction.from);
82,737
138
// first 2 nibbles are dropped while generating nibble array this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only) so converting to nibble array and then hashing it
MerklePatriciaProof._getNibbleArray(inputDataRLPList[8].toBytes()), // branchMask inputDataRLPList[9].toUint() // receiptLogIndex ) ); require( processedExits[exitHash] == false, "FxRootTunnel: EXIT_ALREADY_PROCESSED" ); processedExits[exitHash] = true...
MerklePatriciaProof._getNibbleArray(inputDataRLPList[8].toBytes()), // branchMask inputDataRLPList[9].toUint() // receiptLogIndex ) ); require( processedExits[exitHash] == false, "FxRootTunnel: EXIT_ALREADY_PROCESSED" ); processedExits[exitHash] = true...
23,306
102
// https:docs.synthetix.io/contracts/source/interfaces/isystemstatus
interface ISystemStatus { struct Status { bool canSuspend; bool canResume; } struct Suspension { bool suspended; // reason is an integer code, // 0 => no reason, 1 => upgrading, 2+ => defined by system usage uint248 reason; } // Views function ac...
interface ISystemStatus { struct Status { bool canSuspend; bool canResume; } struct Suspension { bool suspended; // reason is an integer code, // 0 => no reason, 1 => upgrading, 2+ => defined by system usage uint248 reason; } // Views function ac...
24,354
103
// OVERRIDE: Only whitelisted contracts can act as recipient of transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { require(isWhitelisted(recipient), "Unauthorized transfer"); _transfer(sender, recipient, amount); _approve(sender, _msgSender(), allowance(sender, recipient).sub(amount, "ERC20: transfer...
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { require(isWhitelisted(recipient), "Unauthorized transfer"); _transfer(sender, recipient, amount); _approve(sender, _msgSender(), allowance(sender, recipient).sub(amount, "ERC20: transfer...
3,245
66
// validates conversion fee
modifier validConversionFee(uint32 _conversionFee) { require(_conversionFee >= 0 && _conversionFee <= maxConversionFee); _; }
modifier validConversionFee(uint32 _conversionFee) { require(_conversionFee >= 0 && _conversionFee <= maxConversionFee); _; }
38,855
5
// IMapleLiquidityPosition Interface/Enzyme Council <[email protected]>
interface IMapleLiquidityPosition is IExternalPosition { enum Actions { Lend, LendAndStake, IntendToRedeem, Redeem, Stake, Unstake, UnstakeAndRedeem, ClaimInterest, ClaimRewards } }
interface IMapleLiquidityPosition is IExternalPosition { enum Actions { Lend, LendAndStake, IntendToRedeem, Redeem, Stake, Unstake, UnstakeAndRedeem, ClaimInterest, ClaimRewards } }
57,782
30
// The UNIX time for the ACO token expiration. /
uint256 expiryTime;
uint256 expiryTime;
29,840
1,069
// Sells a _srcAmount of tokens at UniswapV2/_srcAddr From token/_destAddr To token/_srcAmount From amount/ return uint Destination amount
function sell(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external payable override returns (uint) { _srcAddr = ethToWethAddr(_srcAddr); _destAddr = ethToWethAddr(_destAddr); uint[] memory amounts; address[] memory path = abi.decode(_additiona...
function sell(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external payable override returns (uint) { _srcAddr = ethToWethAddr(_srcAddr); _destAddr = ethToWethAddr(_destAddr); uint[] memory amounts; address[] memory path = abi.decode(_additiona...
13,234
3
// Throws if called by any account other than the main owner or other owners. /
modifier onlyOwners() { require(tx.origin == ownersContract.mainOwner() || ownersContract.isOwner(tx.origin), "MultiOwnable: caller is not the owner members"); _; }
modifier onlyOwners() { require(tx.origin == ownersContract.mainOwner() || ownersContract.isOwner(tx.origin), "MultiOwnable: caller is not the owner members"); _; }
13,294
32
// See: https:github.com/liquity/devsupplying-hints-to-trove-operations
uint nominalCr = hintHelpers.computeNominalCR(collateral, debt); searchIterations = searchIterations == 0 ? mul(10, sqrt(sortedTroves.getSize())) : searchIterations; randomSeed = randomSeed == 0 ? block.number : randomSeed; (address hintAddress, ,) = hintHelpers.getApproxHint(nominalCr, ...
uint nominalCr = hintHelpers.computeNominalCR(collateral, debt); searchIterations = searchIterations == 0 ? mul(10, sqrt(sortedTroves.getSize())) : searchIterations; randomSeed = randomSeed == 0 ? block.number : randomSeed; (address hintAddress, ,) = hintHelpers.getApproxHint(nominalCr, ...
37,672
141
// Assign the token to the same address that owned it in the previous ownership contract.
_add(i, tokenOwner);
_add(i, tokenOwner);
6,438
115
// ============ SOULBINDING ============ Used to allow an admin to transfer soulbound tokens when necessary
bool soulboundAdminTransferInProgress;
bool soulboundAdminTransferInProgress;
50,557
2
// Seconds since the proposal could be executed until it is considered expired
uint256 public constant EXPIRATION_PERIOD = 14 days;
uint256 public constant EXPIRATION_PERIOD = 14 days;
8,872
17
// 8. Refund reward
doRefund(IWStakingRewards(wstaking).reward());
doRefund(IWStakingRewards(wstaking).reward());
42,384
11
// create a function that computes how much taxes you have to pay depending on how much waste you produced
function computeTaxes() public view returns (uint) { // since we want to incentivize recycling, it makes sense to make people pay less taxes // the more they recycled uint taxes = totalNonRecyclableWaste/10 + totalRecyclableWaste/100; return taxes; }
function computeTaxes() public view returns (uint) { // since we want to incentivize recycling, it makes sense to make people pay less taxes // the more they recycled uint taxes = totalNonRecyclableWaste/10 + totalRecyclableWaste/100; return taxes; }
23,360
65
// Interface for making arbitrary calls during swap
interface IAggregationExecutor { /// @notice propagates information about original msg.sender and executes arbitrary data function execute(address msgSender) external payable; // 0x4b64e492 }
interface IAggregationExecutor { /// @notice propagates information about original msg.sender and executes arbitrary data function execute(address msgSender) external payable; // 0x4b64e492 }
11,981
6
// Contract metadata.
uint public maxDuration; uint public campaignsCount; address public startupHubImplementation; StartupHub private startupHub;
uint public maxDuration; uint public campaignsCount; address public startupHubImplementation; StartupHub private startupHub;
27,787
3
// Indicate the status of the random number Since 0 is equal to undefined then it will be its default value which is what we want
RNStatus internal randomNumberStatus;
RNStatus internal randomNumberStatus;
44,422
675
// This function doesn't have the nonReentrant modifier: it is applied to `_joinOrExit` instead.
_joinOrExit(PoolBalanceChangeKind.EXIT, poolId, sender, recipient, _toPoolBalanceChange(request));
_joinOrExit(PoolBalanceChangeKind.EXIT, poolId, sender, recipient, _toPoolBalanceChange(request));
32,436
102
// Check ring size
uint ringSize = addressList.length; (ringSize > 1 && ringSize <= maxRingSize) .orThrow("invalid ring size"); verifyInputDataIntegrity( ringSize, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList,
uint ringSize = addressList.length; (ringSize > 1 && ringSize <= maxRingSize) .orThrow("invalid ring size"); verifyInputDataIntegrity( ringSize, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList,
7,218
9
// State sequence number.
uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state.
uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state.
42,080
1
// 18 decimals is the strongly suggested default
uint256 public totalSupply; uint256 public BicycleSupply = 21000000000; uint256 public price ; address public creator;
uint256 public totalSupply; uint256 public BicycleSupply = 21000000000; uint256 public price ; address public creator;
10,338
189
// A record of votes checkpoints for each account, by index
mapping(address => address) public delegates;
mapping(address => address) public delegates;
20,151
22
// No challenger and parent approved; confirm immediately
if (claim.challenger == address(0)) { bytes32 parentId = trustedSuperblocks.getSuperblockParentId(superblockHash); SyscoinSuperblocksI.Status status = trustedSuperblocks.getSuperblockStatus(parentId); if (status == SyscoinSuperblocksI.Status.Approved) { confir...
if (claim.challenger == address(0)) { bytes32 parentId = trustedSuperblocks.getSuperblockParentId(superblockHash); SyscoinSuperblocksI.Status status = trustedSuperblocks.getSuperblockStatus(parentId); if (status == SyscoinSuperblocksI.Status.Approved) { confir...
15,705
1
// Validate tokens.
require( order.takerToken == params.inputToken && order.makerToken == params.outputToken, "MultiplexOtc::_batchSellOtcOrder/OTC_ORDER_INVALID_TOKENS" );
require( order.takerToken == params.inputToken && order.makerToken == params.outputToken, "MultiplexOtc::_batchSellOtcOrder/OTC_ORDER_INVALID_TOKENS" );
11,789
10
// Remove NFT from minting
uint256 count = NFTTypeMap[typeId].count; uint256 minted = NFTTypeMap[typeId].minted; NFTTypeMap[typeId].count = count.sub(1); NFTTypeMap[typeId].minted = minted.add(1); uint256 newItemId = _tokenIds.current(); NFTAddressToID[recipient][typeId].push(newItemId);
uint256 count = NFTTypeMap[typeId].count; uint256 minted = NFTTypeMap[typeId].minted; NFTTypeMap[typeId].count = count.sub(1); NFTTypeMap[typeId].minted = minted.add(1); uint256 newItemId = _tokenIds.current(); NFTAddressToID[recipient][typeId].push(newItemId);
29,656
409
// Reset the sponsors position to have zero outstanding and collateral.
delete positions[sponsor]; emit EndedSponsorPosition(sponsor);
delete positions[sponsor]; emit EndedSponsorPosition(sponsor);
5,771
267
// Events/Event when an user deposit tokens in the pool //Event when an user withdraw tokens from the pool //Event when a loan is started //Event when the fee amount in the loan is updated //Event when the delegatee of the loan is updated //Event when a loan is ended //Reserve Events /Functions
function deposit(uint _amount) external returns(uint); function withdraw(uint _amount) external returns(uint); function borrow(address _delegatee, uint _amount, uint _feeAmount) external returns(uint); function expandBorrow(address _loanPool, uint _feeAmount) external returns(uint); function cl...
function deposit(uint _amount) external returns(uint); function withdraw(uint _amount) external returns(uint); function borrow(address _delegatee, uint _amount, uint _feeAmount) external returns(uint); function expandBorrow(address _loanPool, uint _feeAmount) external returns(uint); function cl...
75,070
37
// Update retirementMessage, beneficiary, and beneficiaryString of a NFT/ within 24h of creation. Empty values are ignored, ie., will not overwrite the/ existing stored values in the NFT./tokenId The id of the NFT to update./retiringEntityString An identifiable string for the retiring entity, eg. their name./beneficiar...
function updateCertificate( uint256 tokenId, string calldata retiringEntityString, address beneficiary, string calldata beneficiaryString, string calldata retirementMessage
function updateCertificate( uint256 tokenId, string calldata retiringEntityString, address beneficiary, string calldata beneficiaryString, string calldata retirementMessage
21,734
194
// decide how many LP tokens we can actually withdraw
return _removeLiquidity(requiredLPTokenAmount);
return _removeLiquidity(requiredLPTokenAmount);
70,509
1,373
// Input from function call.
constructorParams.configStoreAddress = configStore; constructorParams.tokenAddress = address(newTokenCurrency); constructorParams.collateralAddress = params.collateralAddress; constructorParams.priceFeedIdentifier = params.priceFeedIdentifier; constructorParams.fundingRateIdentif...
constructorParams.configStoreAddress = configStore; constructorParams.tokenAddress = address(newTokenCurrency); constructorParams.collateralAddress = params.collateralAddress; constructorParams.priceFeedIdentifier = params.priceFeedIdentifier; constructorParams.fundingRateIdentif...
21,867
4
// returns the address of the ERC20 token /
function token() external view returns (address);
function token() external view returns (address);
17,937
142
// Instantiate curveFi
curveFi = ICurveFi(curveFi_curve_cDai_cUsdc); ERC20 TokenA = ERC20(tokenA); bytes memory params = abi.encode(tokenB);
curveFi = ICurveFi(curveFi_curve_cDai_cUsdc); ERC20 TokenA = ERC20(tokenA); bytes memory params = abi.encode(tokenB);
30,053
42
// Calculate the amount of collateral tokens to lock/unlock.
if (bidExists) { oldCollateralAmount = bids[bidId].collateralAmounts[i]; if (oldCollateralAmount < bidSubmission.collateralAmounts[i]) { termRepoCollateralManager.auctionLockCollateral( bidSubmission.bidder, ...
if (bidExists) { oldCollateralAmount = bids[bidId].collateralAmounts[i]; if (oldCollateralAmount < bidSubmission.collateralAmounts[i]) { termRepoCollateralManager.auctionLockCollateral( bidSubmission.bidder, ...
10,275
7
// Returns the absolute unsigned value of a signed value. /
function abs(int256 n) external pure returns (uint256) { unchecked { return uint256(n >= 0 ? n : -n); } }
function abs(int256 n) external pure returns (uint256) { unchecked { return uint256(n >= 0 ? n : -n); } }
280
37
// round 35
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
24,351
54
// Mapping to doKeep track of how much coverage we've sold for each protocol. smart contract address => total borrowed cover
mapping (address => uint256) public override totalUsedCover;
mapping (address => uint256) public override totalUsedCover;
84,690
4
// Helper to list all the NFTs of a wallet/_owner the wallet address to be checked for
function walletOfOwner(address _owner) external view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } r...
function walletOfOwner(address _owner) external view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } r...
20,725
134
// If the first 4 bytes don't match with the expected signature, we forward the revert reason.
if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
14,900
5
// Reveal function
function reveal(string calldata _newUri) public onlyOwner { require(!contractSealed, "Contract has been sealed"); baseURI = _newUri; }
function reveal(string calldata _newUri) public onlyOwner { require(!contractSealed, "Contract has been sealed"); baseURI = _newUri; }
76,589
12
// collateral amount of a {_poolToken} from a{_nftId} updated to current values.Full means sum of private and public addedfunds. Can be extrapolated linear within{_interval}. /
function _getCollateralOfTokenUSDUpdated( uint256 _nftId, address _poolToken, uint256 _interval ) internal view returns (uint256 usdCollateral) { usdCollateral = WISE_ORACLE.getTokensInUSD(
function _getCollateralOfTokenUSDUpdated( uint256 _nftId, address _poolToken, uint256 _interval ) internal view returns (uint256 usdCollateral) { usdCollateral = WISE_ORACLE.getTokensInUSD(
1,222
7
// Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction./The Forwarder may fill more than makerAssetBuyAmount of the makerAsset so that it can/pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees)./Any ETH not spent will be refunded to sender./orders Array o...
function marketBuyOrdersWithEth( LibOrder.Order[] memory orders, uint256 makerAssetBuyAmount, bytes[] memory signatures, uint256[] memory ethFeeAmounts, address payable[] memory feeRecipients ) public payable returns (
function marketBuyOrdersWithEth( LibOrder.Order[] memory orders, uint256 makerAssetBuyAmount, bytes[] memory signatures, uint256[] memory ethFeeAmounts, address payable[] memory feeRecipients ) public payable returns (
43,328
38
// @inheritdoc IPancakeV3PoolActions/not locked because it initializes unlocked
function initialize(uint160 sqrtPriceX96) external override { require(slot0.sqrtPriceX96 == 0, 'AI'); int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96); (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp()); slot0 = Slot0({ sqrt...
function initialize(uint160 sqrtPriceX96) external override { require(slot0.sqrtPriceX96 == 0, 'AI'); int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96); (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp()); slot0 = Slot0({ sqrt...
35,004