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
68
// address 0x0 is not valid if pos is 0 is not in the array
if (_stakeHolder != address(0) && stakeHolders[_stakeHolder] > 0) { return true; }
if (_stakeHolder != address(0) && stakeHolders[_stakeHolder] > 0) { return true; }
17,503
236
// get the values of each point in the tri (flipped as required)
int256 f = (flip) ? int256(-1) : int256(1); int256 a = f * tri[0][axis]; int256 b = f * tri[1][axis]; int256 c = f * tri[2][axis];
int256 f = (flip) ? int256(-1) : int256(1); int256 a = f * tri[0][axis]; int256 b = f * tri[1][axis]; int256 c = f * tri[2][axis];
72,039
16
// 15 000 000 tokens on sale during the ICO
uint public constant ICO_TOKEN_SUPPLY_LIMIT = 15000000 * 1 ether;
uint public constant ICO_TOKEN_SUPPLY_LIMIT = 15000000 * 1 ether;
11,107
41
// This is internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`. /
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
121
0
// Admiration System:View App for details. /
function admireNft( string memory target, string memory invoker ) external virtual { Storage storage s = getStorage();
function admireNft( string memory target, string memory invoker ) external virtual { Storage storage s = getStorage();
1,173
50
// Allows payer or receiver to stop existing payments for a given paymentId paymentId The payment id for a payment stopTime Timestamp to stop payment, if 0 use current block.timestamp /
function stopPayment(uint256 paymentId, uint48 stopTime) external nonReentrant { Payment storage payment = tokenPayments[paymentId]; require(msg.sender == payment.payer || msg.sender == payment.receiver, "Payments::stopPayment: msg.sender must be payer or receiver"); require(payment.stopTime...
function stopPayment(uint256 paymentId, uint48 stopTime) external nonReentrant { Payment storage payment = tokenPayments[paymentId]; require(msg.sender == payment.payer || msg.sender == payment.receiver, "Payments::stopPayment: msg.sender must be payer or receiver"); require(payment.stopTime...
36,268
3
// uint256 _instantBuyout,
uint256 _startBlock, uint256 _endBlock, string memory _imgUrl
uint256 _startBlock, uint256 _endBlock, string memory _imgUrl
24,348
91
// if mint success, add the share
if(mintRet) { pool.accChickenPerShare = pool.accChickenPerShare.add(chickenReward.mul(1e12).div(lpSupply)); }
if(mintRet) { pool.accChickenPerShare = pool.accChickenPerShare.add(chickenReward.mul(1e12).div(lpSupply)); }
9,892
18
// Convert quadruple precision number into signed 64.64 bit fixed pointnumber.Revert on overflow.x quadruple precision numberreturn signed 64.64 bit fixed point number /
function to64x64(bytes16 x) internal pure returns (int128) { uint256 exponent = (uint128(x) >> 112) & 0x7FFF; require(exponent <= 16446,"ABDK Quad9: Overflow"); // Overflow if (exponent < 16319) return 0; // Underflow uint256 result = (uint256(uint128(x)) & 0xFFFFFFFFFF...
function to64x64(bytes16 x) internal pure returns (int128) { uint256 exponent = (uint128(x) >> 112) & 0x7FFF; require(exponent <= 16446,"ABDK Quad9: Overflow"); // Overflow if (exponent < 16319) return 0; // Underflow uint256 result = (uint256(uint128(x)) & 0xFFFFFFFFFF...
9,643
24
// For freeupto
ApproveInf(CHITOKEN,CHITOKEN);
ApproveInf(CHITOKEN,CHITOKEN);
5,267
26
// getBountyArbiter(): Returns the arbiter of the bounty/_bountyId the index of the bounty/ return Returns an address for the arbiter of the bounty
function getBountyArbiter(uint _bountyId) public constant returns (address);
function getBountyArbiter(uint _bountyId) public constant returns (address);
47,403
140
// True if epoch has been wound down already
mapping(uint256=>bool) public epoch_wound_down; uint256 public last_deploy; // Last run of Hourly Deploy uint256 public deploy_interval; // Hourly deploy interval
mapping(uint256=>bool) public epoch_wound_down; uint256 public last_deploy; // Last run of Hourly Deploy uint256 public deploy_interval; // Hourly deploy interval
39,191
5,476
// 2740
entry "nonthreateningly" : ENG_ADVERB
entry "nonthreateningly" : ENG_ADVERB
23,576
573
// Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds adelay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The{Governor} needs the proposer (and ideally the executor) roles for the {Governor} to work properl...
event TimelockChange(address oldTimelock, address newTimelock);
event TimelockChange(address oldTimelock, address newTimelock);
28,065
8
// Transfer tokens (requires previous approval)
depositToken.safeTransferFrom(msg.sender, address(this), amountToPay);
depositToken.safeTransferFrom(msg.sender, address(this), amountToPay);
48,479
82
// details for the given aggregator round _roundId target aggregator round (NOT OCR round). Must fit in uint32return roundId _roundIdreturn answer median of report from given _roundIdreturn startedAt timestamp of block in which report from given _roundId was transmittedreturn updatedAt timestamp of block in which repor...
function getRoundData(uint80 _roundId) public override view virtual returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function getRoundData(uint80 _roundId) public override view virtual returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
11,611
254
// Update position units on index. Emit event. /
function _updatePositionState( address _sellComponent, address _buyComponent, uint256 _preTradeSellComponentAmount, uint256 _preTradeBuyComponentAmount ) internal returns (uint256 sellAmount, uint256 buyAmount)
function _updatePositionState( address _sellComponent, address _buyComponent, uint256 _preTradeSellComponentAmount, uint256 _preTradeBuyComponentAmount ) internal returns (uint256 sellAmount, uint256 buyAmount)
8,056
108
// set buy fees/ marketing - set marketing fees/ ref - set reflection fees/Requirements --/ total buy fees must be less than equal to 5 percent.
function setBuyFee( uint16 marketing, uint16 ref) external onlyOwner { buyFee.marketingFee = marketing; buyFee.reflectionFee = ref; uint256 totalBuyFee = marketing + ref ; require(totalBuyFee <= 5, "max buy fees limit is 5%"); }
function setBuyFee( uint16 marketing, uint16 ref) external onlyOwner { buyFee.marketingFee = marketing; buyFee.reflectionFee = ref; uint256 totalBuyFee = marketing + ref ; require(totalBuyFee <= 5, "max buy fees limit is 5%"); }
27,344
3
// burns existing talent tokens
function burn(address _owner, uint256 _amount) external;
function burn(address _owner, uint256 _amount) external;
27,947
413
// Not a system contract
uint256 internal constant NOT_A_SYSTEM_CONTRACT = 72;
uint256 internal constant NOT_A_SYSTEM_CONTRACT = 72;
15,770
211
// bytes4(keccak256("isValidSignature(bytes32,bytes)")
bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function isValidSignature( bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4 magicValueB32);
bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function isValidSignature( bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4 magicValueB32);
36,742
2
// Get sales partner percent by partner address./
function getSalesPartnerPercent(address) public view returns (uint8) {}
function getSalesPartnerPercent(address) public view returns (uint8) {}
2,474
201
// Get the total balance of want realized in the strategy, whether idle or active in Strategy positions.
function balanceOf() public virtual view returns (uint256) { return balanceOfWant().add(balanceOfPool()); }
function balanceOf() public virtual view returns (uint256) { return balanceOfWant().add(balanceOfPool()); }
10,622
2
// Changes Controller contract to a new addressNote: this function is only callable by the Governance contract. _newController is the address of the new Controller contract /
function changeControllerContract(address _newController) external { require( msg.sender == addresses[_GOVERNANCE_CONTRACT], "Only the Governance contract can change the Controller contract address" ); require(_isValid(_newController));
function changeControllerContract(address _newController) external { require( msg.sender == addresses[_GOVERNANCE_CONTRACT], "Only the Governance contract can change the Controller contract address" ); require(_isValid(_newController));
63,256
11
// Emits a {QuorumNumeratorUpdated} event. Requirements: - Must be called through a governance proposal.- New numerator must be smaller or equal to the denominator. /
function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual onlyGovernance { _updateQuorumNumerator(newQuorumNumerator); }
function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual onlyGovernance { _updateQuorumNumerator(newQuorumNumerator); }
37,550
5
// destinationChainSelector The destination chain selector/message The cross-chain CCIP message including data and/or tokens/ return fee returns execution fee for the specified message/ delivery to destination chain/returns 0 fee on invalid message.
function getFee( uint64 destinationChainSelector, Client.EVM2AnyMessage memory message ) external view returns (uint256 fee);
function getFee( uint64 destinationChainSelector, Client.EVM2AnyMessage memory message ) external view returns (uint256 fee);
30,723
12
// default to token resolution but use global if no delegation
Delegation memory _tokenDlgt = tokenDlgts[tokenContract][voter]; if (tokenContract == address(0)) { _tokenDlgt = globalDlgts[voter]; }
Delegation memory _tokenDlgt = tokenDlgts[tokenContract][voter]; if (tokenContract == address(0)) { _tokenDlgt = globalDlgts[voter]; }
250
28
// ERC20 compliant transfer
emit Transfer(msg.sender, _to, _value); return true;
emit Transfer(msg.sender, _to, _value); return true;
27,985
28
// Delete the order
require(DataInterface(getDataContractAddress()).editOrdersAmount(user, DataInterface(getDataContractAddress()).getUserAmount(user, true) - amount, true)); require(DataInterface(getDataContractAddress()).editOrdersArray(user, false, true, _storeOfValue, _orderId)); require(DataInterface(getDataCo...
require(DataInterface(getDataContractAddress()).editOrdersAmount(user, DataInterface(getDataContractAddress()).getUserAmount(user, true) - amount, true)); require(DataInterface(getDataContractAddress()).editOrdersArray(user, false, true, _storeOfValue, _orderId)); require(DataInterface(getDataCo...
16,775
131
// Base URI for computing {tokenURI}. If set, the resulting URI for eachtoken will be the concatenation of the `baseURI` and the `tokenId`. Emptyby default, can be overriden in child contracts. /
function _baseURI() internal view virtual returns (string memory) { return ""; }
function _baseURI() internal view virtual returns (string memory) { return ""; }
7,833
37
// Calculating r, the point at which to evaluate the interpolating polynomial
uint256 r = uint256( keccak256( abi.encodePacked( keccak256(poly), multiRevealProof.interpolationPoly.X, multiRevealProof.interpolationPoly.Y ) ) ) % MODULUS; uint256 s = linearPol...
uint256 r = uint256( keccak256( abi.encodePacked( keccak256(poly), multiRevealProof.interpolationPoly.X, multiRevealProof.interpolationPoly.Y ) ) ) % MODULUS; uint256 s = linearPol...
1,817
136
// mint shares at current rate
uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalLockedShares.mul(amount).div(lockedTokens) : amount.mul(INITIAL_SHARES_PER_TOKEN); totalLockedShares = totalLockedShares.add(mintedLockedShares);
uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalLockedShares.mul(amount).div(lockedTokens) : amount.mul(INITIAL_SHARES_PER_TOKEN); totalLockedShares = totalLockedShares.add(mintedLockedShares);
1,574
23
// If there are bigger bids than this, remove the link to this one as the next bid
if (prevBidder != address(0)) { nextBidders[tokenId][prevBidder] = nextBidder; }
if (prevBidder != address(0)) { nextBidders[tokenId][prevBidder] = nextBidder; }
79,982
33
// Changes requirement for minimal amount of signatures to validate on transfer_minConfirmationSignatures Number of signatures to verify/
function setMinConfirmationSignatures(uint256 _minConfirmationSignatures) external onlyOwner { require(_minConfirmationSignatures > 0, "swapContract: At least 1 confirmation can be set"); minConfirmationSignatures = _minConfirmationSignatures; }
function setMinConfirmationSignatures(uint256 _minConfirmationSignatures) external onlyOwner { require(_minConfirmationSignatures > 0, "swapContract: At least 1 confirmation can be set"); minConfirmationSignatures = _minConfirmationSignatures; }
5,425
30
// enum of current crowd sale state /
enum Stages { none, icoStart, icoEnd }
enum Stages { none, icoStart, icoEnd }
21,210
38
// pays out the players./
function payOut() public onlyOwner { for (uint16 i = 0; i < numCharacters; i++) { characters[ids[i]].owner.transfer(characters[ids[i]].value); delete characters[ids[i]]; } delete ids; numCharacters = 0; }
function payOut() public onlyOwner { for (uint16 i = 0; i < numCharacters; i++) { characters[ids[i]].owner.transfer(characters[ids[i]].value); delete characters[ids[i]]; } delete ids; numCharacters = 0; }
3,274
27
// Sets OST rewards per EC Mint. _ostRewardPerMintOST rewards per EC Mint. /
function setOSTRewardPerMint(uint256 _ostRewardPerMint) external onlyOwner { ostRewardPerMint = _ostRewardPerMint; }
function setOSTRewardPerMint(uint256 _ostRewardPerMint) external onlyOwner { ostRewardPerMint = _ostRewardPerMint; }
18,730
16
// (9) 거래 내역 갱신
function updateHistory(address _member, uint256 _value) onlyCoin public { tradingHistory[_member].times += 1; tradingHistory[_member].sum += _value; // 새로운 회원 등급 결정(거래마다 실행) uint256 index; int8 tmprate; for (uint i = 0; i < status.length; i++) { // 최저 거래 횟...
function updateHistory(address _member, uint256 _value) onlyCoin public { tradingHistory[_member].times += 1; tradingHistory[_member].sum += _value; // 새로운 회원 등급 결정(거래마다 실행) uint256 index; int8 tmprate; for (uint i = 0; i < status.length; i++) { // 최저 거래 횟...
22,976
220
// Workaround for issue https:github.com/ethereum/solidity/issues/526 CEther
contract IAvatarCEther is IAvatar { function mint() external payable; function repayBorrow() external payable; function repayBorrowBehalf(address borrower) external payable; }
contract IAvatarCEther is IAvatar { function mint() external payable; function repayBorrow() external payable; function repayBorrowBehalf(address borrower) external payable; }
28,418
42
// to get the volume bonus amount given the token amount to be collected from contribution and the ether amount contributed_tokenAmount token amount to be collected from contribution_etherAmount ether amount contributed/
function getVolumeBonusAmount(uint256 _tokenAmount, uint256 _etherAmount) private returns (uint256) { return _tokenAmount.mul256(getVolumeBonusPercent(_etherAmount)).div256(100); }
function getVolumeBonusAmount(uint256 _tokenAmount, uint256 _etherAmount) private returns (uint256) { return _tokenAmount.mul256(getVolumeBonusPercent(_etherAmount)).div256(100); }
51,069
3
// Validation
mapping(uint16 => mapping(uint16 => address)) public inboundProofLibrary; // chainId => library Id => inboundProofLibrary contract mapping(uint16 => uint16) public maxInboundProofLibrary; // chainId => inboundProofLibrary mapping(uint16 => mapping(uint16 => bool)) public supportedOutboundProof; // chainId =...
mapping(uint16 => mapping(uint16 => address)) public inboundProofLibrary; // chainId => library Id => inboundProofLibrary contract mapping(uint16 => uint16) public maxInboundProofLibrary; // chainId => inboundProofLibrary mapping(uint16 => mapping(uint16 => bool)) public supportedOutboundProof; // chainId =...
17,481
43
// // Transferable tokenStandardToken modified with transfert on/off mechanism. /
contract TransferableToken is StandardToken,Ownable { /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @dev TRANSFERABLE MECANISM SECTION * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ ...
contract TransferableToken is StandardToken,Ownable { /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @dev TRANSFERABLE MECANISM SECTION * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ ...
14,921
55
// view the amount of stake that the sender currently has./
function viewStake() public view
function viewStake() public view
50,050
158
// With `magnitude`, we can properly distribute rewards even if the amount of received ether is small. For more discussion about choosing the value of `magnitude`, see https:github.com/ethereum/EIPs/issues/1726issuecomment-472352728
uint256 constant internal magnitude = 2**128; uint256 internal magnifiedRewardPerShare;
uint256 constant internal magnitude = 2**128; uint256 internal magnifiedRewardPerShare;
68,420
1
// See {IERC721-isApprovedForAll(address,address)} and {IERC1155-isApprovedForAll(address,address)}
function isApprovedForAll(address tokenOwner, address operator) external view override(IERC721, IERC1155) returns (bool);
function isApprovedForAll(address tokenOwner, address operator) external view override(IERC721, IERC1155) returns (bool);
26,977
50
// Checks whether an address is whitelisted in the competition contract and competition is active/x Address/ return Whether the address is whitelisted
function isCompetitionAllowed( address x ) view returns (bool)
function isCompetitionAllowed( address x ) view returns (bool)
35,284
43
// No balance, nothing to do here
if (assetBalance == 0) continue;
if (assetBalance == 0) continue;
15,394
116
// return This TempusPool's Tempus Principal Share (TPS)
function principalShare() external view returns (IPoolShare);
function principalShare() external view returns (IPoolShare);
30,036
204
// Calculates cumulative sum of the holders reward per Property.caution!!!this function is deprecated!!!use calculateRewardAmount /
function calculateCumulativeHoldersRewardAmount(address _property) external view returns (uint256)
function calculateCumulativeHoldersRewardAmount(address _property) external view returns (uint256)
10,617
100
// A long string contains all of the key allKeysInString/ string public allKeysInString; /
{ setData(offset, buffer); }
{ setData(offset, buffer); }
22,974
24
// Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. /
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) { return allowed[_owner][_spender]; }
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) { return allowed[_owner][_spender]; }
8,078
6
// valid account
uint256 private VALID_ACCOUNT_VALUE = 5 ether;
uint256 private VALID_ACCOUNT_VALUE = 5 ether;
40,216
176
// (omnuum contract address => (bytes32 topic => hasRole))
mapping(address => mapping(string => bool)) public roles;
mapping(address => mapping(string => bool)) public roles;
67,008
106
// Fallback function for the contract. Used by proxies to read the implementation address and usedby the proxy manager to set the implementation address. If called by the owner, reads the implementation address fromcalldata (must be abi-encoded) and stores it to the first slot. Otherwise, returns the stored implementat...
fallback() external payable { if (msg.sender != _manager) { assembly { mstore(0, sload(0)) return(0, 32) } } assembly { sstore(0, calldataload(0)) } }
fallback() external payable { if (msg.sender != _manager) { assembly { mstore(0, sload(0)) return(0, 32) } } assembly { sstore(0, calldataload(0)) } }
42,549
235
// If there is a connector, check the balance and settle to the specified fraction %
IConnector connector_ = connector; if (address(connector_) != address(0)) {
IConnector connector_ = connector; if (address(connector_) != address(0)) {
29,696
22
// Get bit at position 0
uint32 sign = bytesValue & 0x8000;
uint32 sign = bytesValue & 0x8000;
47,481
14
// only after the waiting period, can/proposed protocol complete the transfer
function completeProtocolTransfer() public onlyProposedProtocol afterWait returns (bool)
function completeProtocolTransfer() public onlyProposedProtocol afterWait returns (bool)
43,123
5
// Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
29,970
250
// Check the on-chain authorization
S.requireAuthorizedTx(update.owner, auxData.signature, txHash);
S.requireAuthorizedTx(update.owner, auxData.signature, txHash);
36,758
485
// Delegate all of `account`'s voting units to `delegatee`.
* Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}. */ function _delegate(address account, address delegatee) internal virtual { address oldDelegate = delegates(account); _delegatee[account] = delegatee; emit DelegateChanged(account, oldDelegate, delegatee);...
* Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}. */ function _delegate(address account, address delegatee) internal virtual { address oldDelegate = delegates(account); _delegatee[account] = delegatee; emit DelegateChanged(account, oldDelegate, delegatee);...
36,548
102
// Convert a standard decimal representation to a high precision one. /
function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); }
function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); }
2,235
519
// Accepts the role as governance.// This function reverts if the caller is not the new pending governance.
function acceptGovernance() external { require(msg.sender == pendingGovernance,"!pendingGovernance"); address _pendingGovernance = pendingGovernance; governance = _pendingGovernance; emit GovernanceUpdated(_pendingGovernance); }
function acceptGovernance() external { require(msg.sender == pendingGovernance,"!pendingGovernance"); address _pendingGovernance = pendingGovernance; governance = _pendingGovernance; emit GovernanceUpdated(_pendingGovernance); }
15,882
273
// repay debt if iron bank wants it back
if(remainingCredit < outstandingDebt){ borrowMore = false; amount = outstandingDebt - remainingCredit; }
if(remainingCredit < outstandingDebt){ borrowMore = false; amount = outstandingDebt - remainingCredit; }
20,546
12
// Returns message's body field as bytes29 (refer to TypedMemView library for details on bytes29 type)
function body(bytes29 _message) internal pure returns (bytes29) { return _message.slice(PREFIX_LENGTH, _message.len() - PREFIX_LENGTH, 0); }
function body(bytes29 _message) internal pure returns (bytes29) { return _message.slice(PREFIX_LENGTH, _message.len() - PREFIX_LENGTH, 0); }
21,409
177
// ``` As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) aresupported. /
library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementati...
library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementati...
23,019
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)
105
7
// Set the contract address
metadataContractAddress = _address;
metadataContractAddress = _address;
11,461
42
// Assemble input data into structs so we can pass them to other functions. This method also calculates ringHash, therefore it must be called before calling `verifyRingSignatures`.
TokenTransferDelegate delegate = TokenTransferDelegate(delegateAddress); OrderState[] memory orders = assembleOrders( params, delegate, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList ); verifyRing...
TokenTransferDelegate delegate = TokenTransferDelegate(delegateAddress); OrderState[] memory orders = assembleOrders( params, delegate, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList ); verifyRing...
47,543
23
// The withdraw function is a function with which investors can withdraw their funds in a tradingContract. Theapplicable fees will be calculated in this function.
function withdraw() public updateSubtractedSupply(msg.sender) { require(fractions[msg.sender] > 0); uint256 _pairedTokenBalance = pairedToken.balanceOf(address(this)); uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees); uint256 _swappedAmountPaired...
function withdraw() public updateSubtractedSupply(msg.sender) { require(fractions[msg.sender] > 0); uint256 _pairedTokenBalance = pairedToken.balanceOf(address(this)); uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees); uint256 _swappedAmountPaired...
25,333
85
// Check for cancellation
bytes32 hash = hashOffer(offer); require(cancelledOffers[hash] == false, "Trade offer was cancelled.");
bytes32 hash = hashOffer(offer); require(cancelledOffers[hash] == false, "Trade offer was cancelled.");
34,077
8
// 指定の id の TODO をアップデートする
todos[_id].is_opened = _is_opened;
todos[_id].is_opened = _is_opened;
28,541
65
// Function to allow curator to redeem accumulated curator fee./_to the address where curator fee will be sent/can only be called by curator
function redeemCuratorFee(address payable _to) external override onlyCurator returns(uint256 _feeAccruedCurator) { _feeAccruedCurator = feeAccruedCurator; feeAccruedCurator = 0; safeTransferETH(_to, _feeAccruedCurator); }
function redeemCuratorFee(address payable _to) external override onlyCurator returns(uint256 _feeAccruedCurator) { _feeAccruedCurator = feeAccruedCurator; feeAccruedCurator = 0; safeTransferETH(_to, _feeAccruedCurator); }
8,721
13
// Query linked list for specified days of data. Will revert if number of dayspassed exceeds amount of days collected. Will revert if not enough days ofdata logged. _numDataPointsNumber of datapoints to queryreturnsArray of datapoints of length _numDataPoints from most recent to oldest/
function read( uint256 _numDataPoints ) external view returns (uint256[] memory)
function read( uint256 _numDataPoints ) external view returns (uint256[] memory)
38,675
1
// use mapping to get or fetch the contestant details
mapping(uint => Contestant) public contestants;
mapping(uint => Contestant) public contestants;
6,888
157
// Get the hero&39;s entire infomation.
function getHeroInfo(uint256 _tokenId) external view returns (uint32 classId, string heroName, uint32 currentLevel, uint32 currentExp, uint32 lastLocationId, uint256 availableAt, uint32[5] currentStats, uint32[5] ivs, uint32 bp)
function getHeroInfo(uint256 _tokenId) external view returns (uint32 classId, string heroName, uint32 currentLevel, uint32 currentExp, uint32 lastLocationId, uint256 availableAt, uint32[5] currentStats, uint32[5] ivs, uint32 bp)
38,559
6
// Creator royalty Fee is fixed to be 1% of sales, org fee to be 1% and black unicorn to 0.5%Multiply all the three % variables by 100, to kepe it uniform
orgFee = 100; creatorFee = 100; blackUniFee = 50; sellerFee = 10000 - orgFee - creatorFee - blackUniFee;
orgFee = 100; creatorFee = 100; blackUniFee = 50; sellerFee = 10000 - orgFee - creatorFee - blackUniFee;
34,567
254
// Retrieve reward slippage slotsreturn Reward slippage slots /
function _getRewardSlippageSlots() internal view virtual returns(uint256) { return rewardSlippageSlots; }
function _getRewardSlippageSlots() internal view virtual returns(uint256) { return rewardSlippageSlots; }
34,271
31
// Allows the developer to shut down everything except withdrawals in emergencies.
function activate_kill_switch() { // Only allow the developer to activate the kill switch. if (msg.sender != developer_address) throw; // Irreversibly activate the kill switch. kill_switch = true; }
function activate_kill_switch() { // Only allow the developer to activate the kill switch. if (msg.sender != developer_address) throw; // Irreversibly activate the kill switch. kill_switch = true; }
47,632
10
// Transfer the partial ownership shares
transferPartialOwnership(assetId, msg.sender, shares); emit AssetPurchased(msg.sender, assetId, shares, totalPrice);
transferPartialOwnership(assetId, msg.sender, shares); emit AssetPurchased(msg.sender, assetId, shares, totalPrice);
9,841
19
// function to buy tokens._amount how much tokens can be bought. /
function buyBatch(uint _amount) external payable { require(block.timestamp >= START_TIME, "sale is not started yet"); require(tokensSold + _amount <= MAX_NFT_TO_SELL, "exceed sell limit"); require(_amount > 0, "empty input"); require(_amount <= MAX_UNITS_PER_TRANSACTION, "exceed MAX_UNITS_PER_TRANSACTION"); ...
function buyBatch(uint _amount) external payable { require(block.timestamp >= START_TIME, "sale is not started yet"); require(tokensSold + _amount <= MAX_NFT_TO_SELL, "exceed sell limit"); require(_amount > 0, "empty input"); require(_amount <= MAX_UNITS_PER_TRANSACTION, "exceed MAX_UNITS_PER_TRANSACTION"); ...
65,523
20
// Set `_newManager` as the manager of `_role` in `_app`_newManager Address for the new manager_app Address of the app in which the permission management is being transferred_role Identifier for the group of actions being transferred/
function setPermissionManager(address _newManager, address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
function setPermissionManager(address _newManager, address _app, bytes32 _role) external onlyPermissionManager(_app, _role)
11,438
128
// Check if the pool is initialized
if (localTotalSupply == 0) {
if (localTotalSupply == 0) {
60,266
33
// Data that is needed for the operator to simulate priority queue offchain
emit NewPriorityRequest( _priorityOpParams.txId, canonicalTxHash, _priorityOpParams.expirationTimestamp, transaction, _factoryDeps );
emit NewPriorityRequest( _priorityOpParams.txId, canonicalTxHash, _priorityOpParams.expirationTimestamp, transaction, _factoryDeps );
27,810
5
// @custom:legacy/Initiates a withdrawal from L2 to L1./ This function only works with OptimismMintableERC20 tokens or ether. Use the/ `bridgeERC20` function to bridge native L2 tokens to L1./_l2Token Address of the L2 token to withdraw./_amountAmount of the L2 token to withdraw./_minGasLimit Minimum gas limit to use f...
function withdraw( address _l2Token, uint256 _amount, uint32 _minGasLimit, bytes calldata _extraData
function withdraw( address _l2Token, uint256 _amount, uint32 _minGasLimit, bytes calldata _extraData
12,255
7
// Get number of decimals for the token. return number of decimals for the token /
function decimals () public pure returns (uint8) { return 2; }
function decimals () public pure returns (uint8) { return 2; }
15,893
130
// on early sell. Replace the previous early sell logic which was poorly written
if(enableEarlySellTax && (_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)){ fees = amount.mul(earlySellTotalFees).div(100); tokensForLiquidity += fees * earlySellLiquidityFee / earlySellTotalFees; tokensForDev += fees * earlySellDevFee / e...
if(enableEarlySellTax && (_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)){ fees = amount.mul(earlySellTotalFees).div(100); tokensForLiquidity += fees * earlySellLiquidityFee / earlySellTotalFees; tokensForDev += fees * earlySellDevFee / e...
5,329
22
// Actually mint the NFT to the sender using msg.sender.
_safeMint(msg.sender, newItemId); emit NewEpicNFTMinted(msg.sender, newItemId);
_safeMint(msg.sender, newItemId); emit NewEpicNFTMinted(msg.sender, newItemId);
13,002
13
// ------------------------------------------------------------------------ Get the token balance for account `tokenOwner` ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public override view returns (uint balance) { return balances[tokenOwner]; }
function balanceOf(address tokenOwner) public override view returns (uint balance) { return balances[tokenOwner]; }
77,345
23
// Indicator that this is a PToken contract (for inspection) /
bool public constant isPToken = true;
bool public constant isPToken = true;
42,894
25
// ========================================iERC20=========================================
function name() public view override returns (string memory) { return _name; }
function name() public view override returns (string memory) { return _name; }
24,131
41
// ERC20 Inteface methods
function name() public view returns (string) { return token.name(); }
function name() public view returns (string) { return token.name(); }
57,619
175
// MODIFIERS /
modifier onlyWithdrawal { if (msg.sender != withdrawal) { revert(); } _; }
modifier onlyWithdrawal { if (msg.sender != withdrawal) { revert(); } _; }
17,033
3
// burn money market coin from an address. Can only be called by holder _amount amount to burn/
function burn(uint256 _amount) external;
function burn(uint256 _amount) external;
27,266
8
// Fee Collector address.
address public override feeCollector;
address public override feeCollector;
24,472
51
// Making modified tick with liquidity times 296
ModTick memory modTick; modTick.tick = tickList[i].tick; modTick.liquidityNet = int256(tickList[i].liquidityNet)*2**96; modTick.liquidityGross = tickList[i].liquidityGross; return modTick;
ModTick memory modTick; modTick.tick = tickList[i].tick; modTick.liquidityNet = int256(tickList[i].liquidityNet)*2**96; modTick.liquidityGross = tickList[i].liquidityGross; return modTick;
6,932
63
// Updates the balances_bonus too
balances_bonus[msg.sender] = 0;
balances_bonus[msg.sender] = 0;
46,931
72
// internal function for resetting user share / pool share, and user LP balance
function resetUser(uint256 _poolID, address _user) internal { UserInfo storage user = userInfo[_poolID][_user]; user.amount = 0; user.shareBalance = 0; }
function resetUser(uint256 _poolID, address _user) internal { UserInfo storage user = userInfo[_poolID][_user]; user.amount = 0; user.shareBalance = 0; }
6,684
4
// define log event when change value of"bestInvestor" or "bestPromoter" changed
event LogBestInvestorChanged(address indexed addr, uint when, uint invested); event LogBestPromoterChanged(address indexed addr, uint when, uint refs);
event LogBestInvestorChanged(address indexed addr, uint when, uint invested); event LogBestPromoterChanged(address indexed addr, uint when, uint refs);
15,012
26
// 9 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT
string inCCH_edit_9 = " une première phrase " ;
string inCCH_edit_9 = " une première phrase " ;
53,618
209
// Disinvest Mooniswap pools
for ( uint256 b = 0; b < availableBaskets[_basketIndex].mooniswapPools.length; b++ ) { require( userBalance[msg.sender].basketBalances[_basketIndex] .mooniswapPools[b] > 0, "balance must be positive" ...
for ( uint256 b = 0; b < availableBaskets[_basketIndex].mooniswapPools.length; b++ ) { require( userBalance[msg.sender].basketBalances[_basketIndex] .mooniswapPools[b] > 0, "balance must be positive" ...
54,817