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
22
// amount is in amountBuy terms // X /
require(invalidOrder[Y[2]] < X[3]); if (X[6] > 100 finney) X[6] = 100 finney; if (X[7] > 100 finney) X[7] = 100 finney; require(tokens[Y[0]][Y[3]] > X[4]); require(tokens[Y[1]][Y[2]] > (safeMul(X[1], X[4]) / X[0])); tokens[Y[0]][Y[3]] = safeSub(tokens[Y[0]][Y[3]], X[4]); tokens[Y[0]][Y[2]] =...
require(invalidOrder[Y[2]] < X[3]); if (X[6] > 100 finney) X[6] = 100 finney; if (X[7] > 100 finney) X[7] = 100 finney; require(tokens[Y[0]][Y[3]] > X[4]); require(tokens[Y[1]][Y[2]] > (safeMul(X[1], X[4]) / X[0])); tokens[Y[0]][Y[3]] = safeSub(tokens[Y[0]][Y[3]], X[4]); tokens[Y[0]][Y[2]] =...
46,988
21
// Settle balance from an account by the agreement. The agreement needs to make sure that the balance delta is balanced afterwards account Account to query. delta Amount of balance delta to be settled Modifiers: - onlyAgreement /
function settleBalance(
function settleBalance(
13,503
21
// transfer batch of tokens between given addresses operator executor of transfer sender sender of tokens recipient receiver of tokens ids token IDs amounts quantities of tokens to transfer data data payload /
function _safeTransferBatch( address operator, address sender, address recipient, uint256[] memory ids, uint256[] memory amounts, bytes memory data
function _safeTransferBatch( address operator, address sender, address recipient, uint256[] memory ids, uint256[] memory amounts, bytes memory data
13,200
161
// Helper to shorten royalties arrays if it is too long /
function _shortenRoyalties(address payable[] storage receivers, uint256[] storage basisPoints, uint256 targetLength) internal { require(receivers.length == basisPoints.length, "CreatorCore: Invalid input"); if (targetLength < receivers.length) { for (uint i = receivers.length; i > target...
function _shortenRoyalties(address payable[] storage receivers, uint256[] storage basisPoints, uint256 targetLength) internal { require(receivers.length == basisPoints.length, "CreatorCore: Invalid input"); if (targetLength < receivers.length) { for (uint i = receivers.length; i > target...
37,039
51
// SuperRare bytes4(keccak256('calculateRoyaltyFee(address,uint256,uint256)')) == 0x860110f5
interfaceId == 0x860110f5 ||
interfaceId == 0x860110f5 ||
17,594
124
// solium-enable arg-overflow
function approve( address _approved, uint256 _tokenId ) external payable mustBeValidToken(_tokenId) onlyTokenOwnerOrOperator(_tokenId) whenNotPaused
function approve( address _approved, uint256 _tokenId ) external payable mustBeValidToken(_tokenId) onlyTokenOwnerOrOperator(_tokenId) whenNotPaused
47,548
2
// Total Supply.
uint256 private constant _tTotal = 5000000000*10**9; uint256 private constant MAX = ~uint256(0); uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private constant _tTotal = 5000000000*10**9; uint256 private constant MAX = ~uint256(0); uint256 private _rTotal = (MAX - (MAX % _tTotal));
42,242
101
// Increase the offset to ids by 32.
mstore( BatchTransfer1155Params_ids_head_ptr, ERC1155BatchTransferGenericFailure_ids_offset )
mstore( BatchTransfer1155Params_ids_head_ptr, ERC1155BatchTransferGenericFailure_ids_offset )
33,116
64
// save the block for a timeout
lastBlock[_stack]=uint32(block.number); lastActor[_stack]=stacks[_counterStack].owner; mode[_stack]=1; counterOfStack[_stack]=_counterStack;
lastBlock[_stack]=uint32(block.number); lastActor[_stack]=stacks[_counterStack].owner; mode[_stack]=1; counterOfStack[_stack]=_counterStack;
65,301
605
// Accrue COMP to the market by updating the borrow index cToken The market whose borrow index to update Index is a cumulative sum of the COMP per cToken accrued. /
function updateCompBorrowIndex(address cToken, Exp memory marketBorrowIndex) internal
function updateCompBorrowIndex(address cToken, Exp memory marketBorrowIndex) internal
21,227
2
// Destroys a book/removes the books id from the list and sends to a zero address/_tokenId the id of the book to be burnt
function burn(uint _tokenId) external{ _burn(_tokenId); }
function burn(uint _tokenId) external{ _burn(_tokenId); }
27,795
44
// triggered when liquidity protection is updated_providerliquidity provider_prevPoolAmountprevious amount of pool tokens_prevReserveAmount previous amount of reserve tokens_newPoolAmount new amount of pool tokens_newReserveAmountnew amount of reserve tokens/
event ProtectionUpdated(
event ProtectionUpdated(
23,130
46
// Get this balance of CA
function getBalance() external view returns(uint){ return address(this).balance; }
function getBalance() external view returns(uint){ return address(this).balance; }
11,802
21
// Get and distribute any pending rewards
_getAndDistributeRewardsWithMassUpdate();
_getAndDistributeRewardsWithMassUpdate();
46,480
56
// No `prevId` for hint - ascend list starting from `nextId`
return _ascendList(_troveManager, _NICR, nextId);
return _ascendList(_troveManager, _NICR, nextId);
16,123
4
// Common math tools
library Math { /** * @notice Get non-negative difference of `minuend` and `subtracted`. * @return `minuend - subtracted`if it is non-negative or 0 */ function diffOrZero(uint256 minuend, uint256 subtracted) internal pure returns (uint256) { return minuend > sub...
library Math { /** * @notice Get non-negative difference of `minuend` and `subtracted`. * @return `minuend - subtracted`if it is non-negative or 0 */ function diffOrZero(uint256 minuend, uint256 subtracted) internal pure returns (uint256) { return minuend > sub...
20,486
42
// Stake the tokens into stkWAR
IWarlordStaker(stkWar).stake(amount, address(this));
IWarlordStaker(stkWar).stake(amount, address(this));
261
68
// get current active loans in the system/start of the index/count number of loans to return/unsafeOnly boolean if true return unsafe loan only (open for liquidation)
function getActiveLoans( uint256 start, uint256 count, bool unsafeOnly ) external view returns (LoanReturnData[] memory loansData); function getActiveLoansCount() external view returns (uint256);
function getActiveLoans( uint256 start, uint256 count, bool unsafeOnly ) external view returns (LoanReturnData[] memory loansData); function getActiveLoansCount() external view returns (uint256);
718
74
// 用户还款
function repay(address token, uint256 repayAmount) public payable whenUnpaused rewardFor(msg.sender, RewardType.Repay) returns (uint256)
function repay(address token, uint256 repayAmount) public payable whenUnpaused rewardFor(msg.sender, RewardType.Repay) returns (uint256)
23,516
71
// uint256 amountETHMarketing = amountETH__sellFee.marketing / totalSwapFee;
uint256 amountETHLP = amountETH * __sellFee.lp / totalSwapFee; uint256 amountETHBuyback = amountETH * __sellFee.buyback / totalSwapFee;
uint256 amountETHLP = amountETH * __sellFee.lp / totalSwapFee; uint256 amountETHBuyback = amountETH * __sellFee.buyback / totalSwapFee;
43,522
1
// 자원 판매 정보
struct ResourceSale { address seller; address resourceAddress; uint resourceAmount; uint price; string description; uint createTime; }
struct ResourceSale { address seller; address resourceAddress; uint resourceAmount; uint price; string description; uint createTime; }
2,727
133
// subtract voter's information to preserve the participation ratios of other voters compared to the remaining pool of rewards
challenges[_challengeID].winningTokens = challenges[_challengeID].winningTokens.sub(voterTokens); challenges[_challengeID].rewardPool = challenges[_challengeID].rewardPool.sub(reward);
challenges[_challengeID].winningTokens = challenges[_challengeID].winningTokens.sub(voterTokens); challenges[_challengeID].rewardPool = challenges[_challengeID].rewardPool.sub(reward);
11,818
289
// contains a helper function that creates new FarmingRewards contracts in the ElkFarmFactory this is a separate contract so that the FarmFactory contract is not too large /
library ElkV2FactoryHelper { /** * @notice creates a new FarmingRewards contract and transfers ownership to the provided farm manager * @param _abi the abi of the FarmingRewards contract * @param _salt the salt used to create the contract * @param _farmManager the address of the farm manager ...
library ElkV2FactoryHelper { /** * @notice creates a new FarmingRewards contract and transfers ownership to the provided farm manager * @param _abi the abi of the FarmingRewards contract * @param _salt the salt used to create the contract * @param _farmManager the address of the farm manager ...
26,310
26
// difference in ETH
uint256 difference = (higherPrice - lowerPrice) / higherPrice; uint256 payed_fee = (2 * (amountIn * 3)) / 1000; if (difference > payed_fee) { return true; } else {
uint256 difference = (higherPrice - lowerPrice) / higherPrice; uint256 payed_fee = (2 * (amountIn * 3)) / 1000; if (difference > payed_fee) { return true; } else {
32,507
44
// Interest-bearing ERC20-like token for Lybra protocol. This contract is abstract. To make the contract deployable override the`_getTotalMintedEUSD` function. `Lybra.sol` contract inherits EUSD and definesthe `_getTotalMintedEUSD` function. EUSD balances are dynamic and represent the holder's share in the total amount...
abstract contract EUSD is IERC20 { using SafeMath for uint256; uint256 private totalShares; /** * @dev EUSD balances are dynamic and are calculated based on the accounts' shares * and the total supply by the protocol. Account shares aren't * normalized, so the contract also stores the sum of...
abstract contract EUSD is IERC20 { using SafeMath for uint256; uint256 private totalShares; /** * @dev EUSD balances are dynamic and are calculated based on the accounts' shares * and the total supply by the protocol. Account shares aren't * normalized, so the contract also stores the sum of...
21,644
5
// Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
7,886
126
// Implementation of IERC777Recipient. /
function tokensReceived( address /*operator*/, address from, address to, uint256 amount, bytes calldata userData, bytes calldata /*operatorData*/
function tokensReceived( address /*operator*/, address from, address to, uint256 amount, bytes calldata userData, bytes calldata /*operatorData*/
9,506
15
// 用户空投数据/
struct Airdrop { address userAddress; }
struct Airdrop { address userAddress; }
12,317
109
// A mapping from owner address to a boolean flag of whether the player recruited the first hero. Note that transferring a hero from other address do not count, the value can get by getPlayerDetails. /
mapping(address => bool) playerToFirstHeroRecruited;
mapping(address => bool) playerToFirstHeroRecruited;
56,679
79
// There must be no confiscation motion already running for this account.
require(targetMotionID[target] == 0);
require(targetMotionID[target] == 0);
584
4
// New curve
Curve curve = new Curve(_name, _symbol, _assets, _assetWeights, address(this)); curve.transferOwnership(msg.sender); curves[curveId] = address(curve); emit NewCurve(msg.sender, curveId, address(curve)); return curve;
Curve curve = new Curve(_name, _symbol, _assets, _assetWeights, address(this)); curve.transferOwnership(msg.sender); curves[curveId] = address(curve); emit NewCurve(msg.sender, curveId, address(curve)); return curve;
41,186
117
// success determines whether the staticcall succeeded and result determines whether the contract at account indicates support of _interfaceId
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId); return (success && result);
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId); return (success && result);
2,045
41
// generates a pseudorandom number seed a value ensure different outcomes for different sources in the same blockreturn a pseudorandom value /
function random(uint256 seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ) ) ); }
function random(uint256 seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ) ) ); }
14,030
7
// For rate limiting
mapping(address=>uint256) nextRequestAt;
mapping(address=>uint256) nextRequestAt;
7,348
9
// Check whether participating in the votinguser Address to check return bool Whether voting/
function checkVoteNow(address user) public view returns (bool) { if (_myVote[user] == address(0x0)) { return false; } else { Nest_3_VoteContract vote = Nest_3_VoteContract(_myVote[user]); if (vote.checkContractEffective() || vote.checkPersonalAmount(user) == 0) { ...
function checkVoteNow(address user) public view returns (bool) { if (_myVote[user] == address(0x0)) { return false; } else { Nest_3_VoteContract vote = Nest_3_VoteContract(_myVote[user]); if (vote.checkContractEffective() || vote.checkPersonalAmount(user) == 0) { ...
13,300
316
// Because too many variables need to be returned, too many variables will be defined, so the structure of tunple is defined
(uint minerIndex, Tunple memory value) = _close(config, sheets, indices[--i], ntokenAddress);
(uint minerIndex, Tunple memory value) = _close(config, sheets, indices[--i], ntokenAddress);
12,680
213
// Set the share of CRV to send to the Community Reserve. crvCommunityReserveShare_ New fee charged on CRV rewards for governance.return True if successfully set. /
function setCrvCommunityReserveShare(uint256 crvCommunityReserveShare_) external onlyGovernance returns (bool)
function setCrvCommunityReserveShare(uint256 crvCommunityReserveShare_) external onlyGovernance returns (bool)
34,350
13
// Use a different function regarding if the bank is using an oracle or not
if (Banks[_bankAddr].usingOracle == true){ _oracleRandom(_bankAddr); } else {
if (Banks[_bankAddr].usingOracle == true){ _oracleRandom(_bankAddr); } else {
28,791
18
// PUBLIC FUNCTIONS //Grant another address the right to transfer token via takeOwnership() and transferFrom()./_to The address to be granted transfer approval. Pass address(0) to/clear all approvals./_tokenId The ID of the Token that can be transferred if this call succeeds./Required for ERC-721 compliance.
function approve( address _to, uint256 _tokenId
function approve( address _to, uint256 _tokenId
894
2
// Get contract service status.return contract service status. /
function getStatus() external view returns (uint8);
function getStatus() external view returns (uint8);
33,195
1
// Struct for info about voting in testament
struct Voting { uint256 approvedVotes; uint256 neededVotes; uint256 confirmationTime; address[] guardians; }
struct Voting { uint256 approvedVotes; uint256 neededVotes; uint256 confirmationTime; address[] guardians; }
24,362
28
// NOTE to integratorsThe `beneficiary_`, of a `_crossTransferWithCalldata(...)` must meet these requirement:- Must be an externally owned account (EOA) or- Must be a contract that implements or is capable of calling:- connext.forceUpdateSlippage(TransferInfo, _slippage) add the destination chain.Refer to 'delegate' ar...
function _crossTransferWithCalldata( bytes memory params, address beneficiary ) internal override returns (address beneficiary_)
function _crossTransferWithCalldata( bytes memory params, address beneficiary ) internal override returns (address beneficiary_)
40,910
14
// Marks a flag on a speciic position that indicates that it's liquidityis atomic. I.e. the position size cannot be partially reduced, onlyremoved entirely. /
int24 lowTick, int24 highTick) internal { RangePosition storage pos = lookupPosition(owner, poolIdx, lowTick, highTick); pos.atomicLiq_ = true; }
int24 lowTick, int24 highTick) internal { RangePosition storage pos = lookupPosition(owner, poolIdx, lowTick, highTick); pos.atomicLiq_ = true; }
9,282
0
// _vaultId Id of the vault/_amount Amount of dai to be payed back/_from Where the Dai is pulled from/_mcdManager The manager address we are using
struct Params { uint256 vaultId; uint256 amount; address from; address mcdManager; }
struct Params { uint256 vaultId; uint256 amount; address from; address mcdManager; }
48,709
32
// User accounting state Represents a single stake for a user. A user may have multiple.
struct Stake { uint256 stakingTokens; uint256 timestampSec; }
struct Stake { uint256 stakingTokens; uint256 timestampSec; }
17,839
4
// The bit mask selecting 8th bit from every byte of 32 byte integer - used to check whether a string contains any characters > 128
uint constant internal MSB_BYTES = 0x8080808080808080808080808080808080808080808080808080808080808080;
uint constant internal MSB_BYTES = 0x8080808080808080808080808080808080808080808080808080808080808080;
37,577
350
// Block number that DFL was last accrued at
uint public dflAccrualBlock;
uint public dflAccrualBlock;
6,255
1,296
// Compute the formula!
uint256 amountToMint = ( percentage * totalSupply() ) / ( (_100PERCENT) - percentage );
uint256 amountToMint = ( percentage * totalSupply() ) / ( (_100PERCENT) - percentage );
6,105
137
// We keep a record of how much wei contributed has already been used for allocations
weiAllocated = weiAllocated.add(presaleContributions[contributor]).add(contributions[contributor]);
weiAllocated = weiAllocated.add(presaleContributions[contributor]).add(contributions[contributor]);
54,207
1
// CONSTRUCTOR
constructor() public { lockRequestCount = 0; }
constructor() public { lockRequestCount = 0; }
10,935
94
// update accounting, unlock tokens, etc. /
function update() external virtual;
function update() external virtual;
11,813
15
// Removes implementation and the mappings corresponding to it. /
function _removeImplementationSigs(address implementation_) internal { bytes32 slot_ = _getImplSigsSlot(implementation_); bytes4[] memory sigs_ = getSigsSlot(slot_).value; require(sigs_.length != 0, "implementation-not-exist"); for (uint256 i = 0; i < sigs_.length; i++) { ...
function _removeImplementationSigs(address implementation_) internal { bytes32 slot_ = _getImplSigsSlot(implementation_); bytes4[] memory sigs_ = getSigsSlot(slot_).value; require(sigs_.length != 0, "implementation-not-exist"); for (uint256 i = 0; i < sigs_.length; i++) { ...
74,189
303
// Encodes the argument json bytes into base64-data uri format json raw json to base64 and turn into a data-uri /
function encodeMetadata(bytes memory json) public pure returns (string memory) {
function encodeMetadata(bytes memory json) public pure returns (string memory) {
41,449
44
// Total Token Allocations
uint256 public totalAllocation = 2 * (10 ** 8) * (10 ** 8); uint256 public teamVestingStages = 8;
uint256 public totalAllocation = 2 * (10 ** 8) * (10 ** 8); uint256 public teamVestingStages = 8;
22,741
13
// create fourth listing and check total listings is 4
market.createListingInStore(200, "Leather Coat", "Mint condition", "", address(this)); uint totalListings = market.totalListings(); Assert.equal(totalListings, 4, "There should be 4 listings stored");
market.createListingInStore(200, "Leather Coat", "Mint condition", "", address(this)); uint totalListings = market.totalListings(); Assert.equal(totalListings, 4, "There should be 4 listings stored");
49,506
43
// Remove sold tokens from total supply count
balances[owner] = safeSub(balances[owner], tokens);
balances[owner] = safeSub(balances[owner], tokens);
18,934
95
// interate until we have some value left for buying
while(value > 0) {
while(value > 0) {
21,174
188
// will receive the remaining tokens to distribute them between CommonSale contract and existing users who participated in the first phase of the sale.
addresses[5] = address(tokenDistributor); token = new TenSetToken(addresses, amounts); companyReserveWallet.setToken(address(token)); companyReserveWallet.setStartDate(STAGE1_START_DATE); companyReserveWallet.setDuration(1440); // 4 years = 48 months = 1440 days ...
addresses[5] = address(tokenDistributor); token = new TenSetToken(addresses, amounts); companyReserveWallet.setToken(address(token)); companyReserveWallet.setStartDate(STAGE1_START_DATE); companyReserveWallet.setDuration(1440); // 4 years = 48 months = 1440 days ...
41,638
45
// Equivalent Solidity code for emitting the event: emit ProxyDeposit(msg.sender, msg.value);
let logData := mload(0x40) // free memory pointer mstore(logData, caller) // add 'msg.sender' to the log data (first event param) mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)
let logData := mload(0x40) // free memory pointer mstore(logData, caller) // add 'msg.sender' to the log data (first event param) mstore(add(logData, 0x20), callvalue) // add 'msg.value' to the log data (second event param)
16,838
43
// The address which sets partners and manages the funding (not mandatory)
address moderator;
address moderator;
7,440
45
// --- Getters ---/Get the market price from the system coin oracle/
function getMarketPrice() external view returns (uint256) { (uint256 marketPrice, ) = orcl.getResultWithValidity(); return marketPrice; }
function getMarketPrice() external view returns (uint256) { (uint256 marketPrice, ) = orcl.getResultWithValidity(); return marketPrice; }
55,358
29
// Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`._from the address of the sender_value the amount of money to burn /
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; ...
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; ...
1,586
2
// Validates a resolved order, reverting if invalid/filler The filler of the order
function validate(ResolvedOrder memory resolvedOrder, address filler) internal view { if (address(this) != address(resolvedOrder.info.reactor)) { revert InvalidReactor(); }
function validate(ResolvedOrder memory resolvedOrder, address filler) internal view { if (address(this) != address(resolvedOrder.info.reactor)) { revert InvalidReactor(); }
16,524
3
// toAddress1 대상 주소toAddress2 대상 주소value1 전송할 웨이의 양value2 전송할 웨이의 양tokenContractAddress erc20 토큰 계약의 주소/
function multiTransferToken( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2, address tokenContractAddress
function multiTransferToken( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2, address tokenContractAddress
15,035
61
// syntheticId of derivative
address syntheticId;
address syntheticId;
29,295
38
// Opens credit account, borrows funds from the pool and pulls collateral/ without any additional action./ - Performs sanity checks to determine whether opening an account is allowed/ - Wraps ETH to WETH and sends it msg. sender is value > 0/ - Requests CreditManager to open a Credit Account with a specified borrowed a...
function openCreditAccount( uint256 amount, address onBehalfOf, uint16 leverageFactor, uint16 referralCode
function openCreditAccount( uint256 amount, address onBehalfOf, uint16 leverageFactor, uint16 referralCode
20,619
111
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
1,720
67
// add y^03(20! / 03!)
z = (z * y) / FIXED_1; res += z * 0x0168244fdac78000;
z = (z * y) / FIXED_1; res += z * 0x0168244fdac78000;
2,500
40
// Sets the address and basis points for royalties.newInfo The struct to configure royalties. /
function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if the new royalty address is the zero address. if (newInfo.royaltyAddress == address(0)) { revert RoyaltyAddressCann...
function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if the new royalty address is the zero address. if (newInfo.royaltyAddress == address(0)) { revert RoyaltyAddressCann...
2,369
16
// profit is [(smaller supply)(change in price) / (last price)]multiplier
uint256 profit = refSupply.mul(delta).div(_lastPrice).mul(multiplier);
uint256 profit = refSupply.mul(delta).div(_lastPrice).mul(multiplier);
13,306
3
// Emitted when `operator` is made operator for `tokenHolder`. /
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
959
6
// Initializes contract with initial supply tokens to the creator of the contract /
constructor() public{ balanceOf[msg.sender] = totalSupply; owner = msg.sender; }
constructor() public{ balanceOf[msg.sender] = totalSupply; owner = msg.sender; }
2,675
295
// no need to check allowance bc the contract == token
uint256 balancePrior = balanceOfInvestmentToken(); uint256 sharesToWithdraw = Math.min( _investmentTokenToYShares(_amountIT), yVault.balanceOf(address(this)) ); if (sharesToWithdraw == 0) { return 0; }
uint256 balancePrior = balanceOfInvestmentToken(); uint256 sharesToWithdraw = Math.min( _investmentTokenToYShares(_amountIT), yVault.balanceOf(address(this)) ); if (sharesToWithdraw == 0) { return 0; }
26,537
74
// Returns the lower bound for the maximum tokens that can be minted for this edition.return The configured value. /
function editionMaxMintableLower() external view returns (uint32);
function editionMaxMintableLower() external view returns (uint32);
33,518
176
// Returns the forwarder address stored on the contract.
function getForwarder() public view returns (address) { if (_forwarder == address(0)) { return Registry(registry).forwarder(); } return _forwarder; }
function getForwarder() public view returns (address) { if (_forwarder == address(0)) { return Registry(registry).forwarder(); } return _forwarder; }
19,221
22
// Returns the ClaimTopicsRegistry linked to the current IdentityRegistry. /
function topicsRegistry() external view returns (IClaimTopicsRegistry);
function topicsRegistry() external view returns (IClaimTopicsRegistry);
34,942
190
// constructor=========================================
constructor(address delegate) ERC721("RainCheck", "RC") { _delegate = delegate; }
constructor(address delegate) ERC721("RainCheck", "RC") { _delegate = delegate; }
50,022
9
// delete from project array
uint lastIndex = projects.length - 1; string memory lastProject = projects[lastIndex].project; uint lastAmount = projects[lastIndex].tokens;
uint lastIndex = projects.length - 1; string memory lastProject = projects[lastIndex].project; uint lastAmount = projects[lastIndex].tokens;
41,167
10
// // Emitted when hashed metadata config is set contractAddress Initial contract that emitted event hashedURIData Hashed uri data hashedRotationData Hashed rotation key _supply Supply of tokens to mint w/ reveal /
event HashedMetadataConfigSet(
event HashedMetadataConfigSet(
42,239
113
// Represents 100% base for commissions calculation
uint256 constant public COMMISSION_BASE = 10000;
uint256 constant public COMMISSION_BASE = 10000;
82,909
99
// In the weird case a player wins two jackpots, we of course pay them twice
ZlotsJackpotHoldingContract(zlotsJackpot).payOutWinner(target);
ZlotsJackpotHoldingContract(zlotsJackpot).payOutWinner(target);
82,343
23
// delete the last element
delete operators[operators.length - 1]; emit RemoveOperator(operator);
delete operators[operators.length - 1]; emit RemoveOperator(operator);
33,515
252
// Verify if sessionPubkeyHash was verified already, if not.. let's do it!
if (!provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) { provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset); }
if (!provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) { provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset); }
6,318
41
// invoke super function with requires
bool isTransferred = super.transfer(_to, _value); uint256 transferredClaims = dividendPayments[msg.sender].mul(_value).div(oldBalanceFrom); dividendPayments[msg.sender] = dividendPayments[msg.sender].sub(transferredClaims); dividendPayments[_to] = dividendPayments[_to].add(transferredCl...
bool isTransferred = super.transfer(_to, _value); uint256 transferredClaims = dividendPayments[msg.sender].mul(_value).div(oldBalanceFrom); dividendPayments[msg.sender] = dividendPayments[msg.sender].sub(transferredClaims); dividendPayments[_to] = dividendPayments[_to].add(transferredCl...
17,599
61
// 2-hours update
uint256 public lastUpdateHour; uint256 public updatePeriod; mapping(uint256 => uint112) public epochPrice;
uint256 public lastUpdateHour; uint256 public updatePeriod; mapping(uint256 => uint112) public epochPrice;
29,466
0
// Create a new ballot to choose one of 'candidateNames' startTime_ When the voting process will start endTime_ When the voting process will end /
constructor(uint256 startTime_, uint256 endTime_) { initializeCandidateDatabase_(); initializeVoterDatabase_(); votingStartTime = startTime_; votingEndTime = endTime_; electionChief = msg.sender; }
constructor(uint256 startTime_, uint256 endTime_) { initializeCandidateDatabase_(); initializeVoterDatabase_(); votingStartTime = startTime_; votingEndTime = endTime_; electionChief = msg.sender; }
18,147
76
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
uint64 numberMinted;
742
3
// Markets Features
struct MarketSettings { bool isExist; // Market is exist or not bool isActive; // Market is open for deposit or not uint256 borrowRate; uint256 borrowRateUpdateTime; uint256 suppliersShareRate; uint256 suppliersShareRateUpdateTime; uint256 promotionRate; }
struct MarketSettings { bool isExist; // Market is exist or not bool isActive; // Market is open for deposit or not uint256 borrowRate; uint256 borrowRateUpdateTime; uint256 suppliersShareRate; uint256 suppliersShareRateUpdateTime; uint256 promotionRate; }
8,858
104
// How many tokens one gets from a certain amount of ethereum.
function ethereumToTokens_(uint _ethereumAmount) public view returns(uint) { require(_ethereumAmount > MIN_ETH_BUYIN, "Tried to buy tokens with too little eth."); if (icoPhase) { return _ethereumAmount.div(tokenPriceInitial_) * 1e18; }
function ethereumToTokens_(uint _ethereumAmount) public view returns(uint) { require(_ethereumAmount > MIN_ETH_BUYIN, "Tried to buy tokens with too little eth."); if (icoPhase) { return _ethereumAmount.div(tokenPriceInitial_) * 1e18; }
3,657
45
// Then we update the payouts array for the buyer with this amount...
payouts[sender] += payoutDiff;
payouts[sender] += payoutDiff;
15,787
363
// Calculates how much token is provided per LP token
function _tokenPerShare(uint256 collected, uint256 tokenPerShareStored) internal view returns (uint256) { uint _totalSupply = totalSupply(); if (_totalSupply > 0) { return tokenPerShareStored .add( collected .mul(1e18) .unsafeDi...
function _tokenPerShare(uint256 collected, uint256 tokenPerShareStored) internal view returns (uint256) { uint _totalSupply = totalSupply(); if (_totalSupply > 0) { return tokenPerShareStored .add( collected .mul(1e18) .unsafeDi...
17,515
7
// Credits `account` with `amount` collateral Funds come from inside the product, not totals are updated Shortfall is created if more funds are debited from an account than exist self The struct to operate on account Account to credit collateral to amount Amount of collateral to creditreturn newShortfall Any new shortf...
function settleAccount(OptimisticLedger storage self, address account, Fixed18 amount)
function settleAccount(OptimisticLedger storage self, address account, Fixed18 amount)
21,493
1
// Prefix the bytecode with a STOP opcode to ensure it cannot be called.
bytes memory runtimeCode = abi.encodePacked(hex"00", data); bytes memory creationCode = abi.encodePacked(
bytes memory runtimeCode = abi.encodePacked(hex"00", data); bytes memory creationCode = abi.encodePacked(
22,344
31
// Store withdrawal, which should be called when partial exit or full exit is verified
function addWithdraw(Operations.WithdrawNFTData calldata wd) external onlyZksCore { if (!wd.valid) { return; } L1Info memory info1 = infoMapL1[wd.globalId]; // Save L1 L2 mapping data if (info1.tokenContract == address(0x0)) { // first time withdraw ...
function addWithdraw(Operations.WithdrawNFTData calldata wd) external onlyZksCore { if (!wd.valid) { return; } L1Info memory info1 = infoMapL1[wd.globalId]; // Save L1 L2 mapping data if (info1.tokenContract == address(0x0)) { // first time withdraw ...
29,998
83
// === CONTROL FUNCTIONS === /
function addBurnAddress(address _address) external onlyOwner { uint8 _idx = _burnAddressExists(_address); require(_idx == 255, "ALREADY_EXISTS"); burnAddresses[_burnIdx] = _address; _burnIdx++; burnAddressCount++; }
function addBurnAddress(address _address) external onlyOwner { uint8 _idx = _burnAddressExists(_address); require(_idx == 255, "ALREADY_EXISTS"); burnAddresses[_burnIdx] = _address; _burnIdx++; burnAddressCount++; }
77,861
20
// ENS resolvers expect that the `key` for text queries is passed in via calldata. Until this is implemented in Solidity, we have to hand-pick the string out of the calldata ourself: https:github.com/ethereum/solidity/issues/13518 Here's the cleaner version once the above is implemented:(, string calldata key) = abi.de...
uint256 keyLengthOffset = 4 + 32 + 32; uint256 keyOffset = keyLengthOffset + 32; uint256 keyLength = abi.decode(resolverCalldata[keyLengthOffset:], (uint256)); key = string(resolverCalldata[keyOffset:keyOffset + keyLength]);
uint256 keyLengthOffset = 4 + 32 + 32; uint256 keyOffset = keyLengthOffset + 32; uint256 keyLength = abi.decode(resolverCalldata[keyLengthOffset:], (uint256)); key = string(resolverCalldata[keyOffset:keyOffset + keyLength]);
24,246
71
// Current additionally assignable reward (RNB) of the user (depositor), meaning what wasn't added to UserInfo, but will be upon the next addToTheUsersAssignedReward() call (read only, does not save/alter state)
function calculateUsersAssignableReward() public view returns(uint256) { // --- // --- similar to addToTheUsersAssignedReward(), but without the writes, plus few other modifications // --- uint256 currentStakingDayNumber = getCurrentStakingDayNumber(); uint256 currentStakin...
function calculateUsersAssignableReward() public view returns(uint256) { // --- // --- similar to addToTheUsersAssignedReward(), but without the writes, plus few other modifications // --- uint256 currentStakingDayNumber = getCurrentStakingDayNumber(); uint256 currentStakin...
21,147
5
// DB for VoterRegistered & Proposals
mapping(address=>Voter) _Voters; // Mapping of voter's addresses Proposal[] _Proposals; // List of Proposals
mapping(address=>Voter) _Voters; // Mapping of voter's addresses Proposal[] _Proposals; // List of Proposals
48,421
328
// Transfer token to the beneficiary
else { TransferController controller = transferController(currency.ct, ""); (bool success,) = address(controller).delegatecall( abi.encodeWithSelector( controller.getApprov...
else { TransferController controller = transferController(currency.ct, ""); (bool success,) = address(controller).delegatecall( abi.encodeWithSelector( controller.getApprov...
11,492
307
// chance of burning the donor trait is a flat 1/3
if (rn.generate(1, 3) == 1) { donorBurnt = true; donor.genesis = false;
if (rn.generate(1, 3) == 1) { donorBurnt = true; donor.genesis = false;
3,269