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
5
// 推广人收益点数
uint public referrerNumFee;
uint public referrerNumFee;
71
11
// Resets subsequent calls' msg.sender to be `address(this)`
function stopPrank() external;
function stopPrank() external;
27,005
184
// Functions: Owner Mint
function ownerMint(uint256 _mintAmount) public onlyOwner { require(!paused, "MSG: The contract is paused"); _ownerMintLoop(msg.sender, _mintAmount); }
function ownerMint(uint256 _mintAmount) public onlyOwner { require(!paused, "MSG: The contract is paused"); _ownerMintLoop(msg.sender, _mintAmount); }
35,997
4
// Repays credit account in ETH/ - transfer borrowed money with interest + fee from borrower account to pool/ - transfer all assets to "to" account/creditManager Address of credit Manager. Should used WETH as underlying asset/to Address to send credit account assets
function repayCreditAccountETH(address creditManager, address to) external payable; function addCollateralETH(address creditManager, address onBehalfOf) external payable;
function repayCreditAccountETH(address creditManager, address to) external payable; function addCollateralETH(address creditManager, address onBehalfOf) external payable;
36,020
22
// 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.return A uint256 specifying the amount of tokens still available for the spender. /
function allowance( address owner, address spender ) public view returns (uint256)
function allowance( address owner, address spender ) public view returns (uint256)
6,351
44
// ERC721 token receiver interface Interface for any contract that wants to support safeTransfersfrom ERC721 asset contracts. /
interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
180
72
// together with {getRoleMember} to enumerate all bearers of a role. /
function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); }
function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); }
2,071
3
// Super happy event. Sing a song.
event Sing(string indexed song);
event Sing(string indexed song);
24,740
282
// round 1
ark(i, q, 10405129301473404666785234951972711717481302463898292859783056520670200613128); sbox_full(i, q); mix(i, q);
ark(i, q, 10405129301473404666785234951972711717481302463898292859783056520670200613128); sbox_full(i, q); mix(i, q);
19,715
94
// TODO: in same function
uint256 _swapFee = tokenAmountIn / 2000; // 0.05%
uint256 _swapFee = tokenAmountIn / 2000; // 0.05%
31,508
84
// this case is used to calculate the reward for periods that have not been initialized yet E.g. calculateClaimableRewardsByPeriodNumber & calculateClaimableRewards this step can be reached only after calculating the reward for periods that have been initialized
if (_index > againstPeriods + 1) { _expiredRewardPeriod = rewardPeriods[_index - 1 - againstPeriods];
if (_index > againstPeriods + 1) { _expiredRewardPeriod = rewardPeriods[_index - 1 - againstPeriods];
23,641
144
// Remove the credits, burning rounding errors
if ( currentCredits == creditAmount || currentCredits - 1 == creditAmount ) {
if ( currentCredits == creditAmount || currentCredits - 1 == creditAmount ) {
48,031
0
// Represents the maximum value of the locked-in profit ratio scale (where 1e18 is 100%).
uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;
uint256 public constant LOCKED_PROFIT_RELEASE_SCALE = 10**18;
15,252
10
// Start time for main drop (timestamp UTC)
uint256 public startTime = 1640995200; // 1640995200 = 2021-01-01T00:00:00Z
uint256 public startTime = 1640995200; // 1640995200 = 2021-01-01T00:00:00Z
27,067
8
// stores historical values of feeds
mapping(uint256 => mapping(uint256 => uint256)) private historicalFeeds;
mapping(uint256 => mapping(uint256 => uint256)) private historicalFeeds;
26,520
4
// Store tranches in a fixed array, so that it can be seen in a blockchain explorer Tranche 0 is always (0, 0) (TODO: change this when we confirm dynamic arrays are explorable)
Tranche[10] public tranches;
Tranche[10] public tranches;
20,140
0
// Is the property booked on a particular day, For the sake of simplicity, we assign 0 to Jan 1, 1 to Jan 2 and so on so isBooked[31] will denote whether the property is booked for Feb 1
bool[] isBooked;
bool[] isBooked;
6,122
19
// Internal function to process 'member'[1] proposal.
function processMemberProposal(Proposal memory prop) private { unchecked { for (uint i; i < prop.to.length; i++) { if (prop.data[i].length == 0) { _mintShares(prop.to[i], prop.value[i]); /*grant `to` `value` `shares`*/ } else { uint96 removedBalance = uint96(balanceOf[prop.to[i]]); /*gas-optimize variable*/ _burnShares(prop.to[i], removedBalance); /*burn all of `to` `shares` & convert into `loot`*/ _mintLoot(prop.to[i], removedBalance); /*mint equivalent `loot`*/ } } } }
function processMemberProposal(Proposal memory prop) private { unchecked { for (uint i; i < prop.to.length; i++) { if (prop.data[i].length == 0) { _mintShares(prop.to[i], prop.value[i]); /*grant `to` `value` `shares`*/ } else { uint96 removedBalance = uint96(balanceOf[prop.to[i]]); /*gas-optimize variable*/ _burnShares(prop.to[i], removedBalance); /*burn all of `to` `shares` & convert into `loot`*/ _mintLoot(prop.to[i], removedBalance); /*mint equivalent `loot`*/ } } } }
43,845
2
// Throws if called by any account other than the owner./
modifier contract_onlyOwner() { require(isOwner()); _; }
modifier contract_onlyOwner() { require(isOwner()); _; }
7,192
144
// only once
require(totalSupply() == 0, "Token has already been created");
require(totalSupply() == 0, "Token has already been created");
14,922
40
// Get the payload offset.
function _payloadOffset(Item memory self) private pure returns (uint) { if(self._unsafe_length == 0) return 0; uint b0; uint memPtr = self._unsafe_memPtr; assembly { b0 := byte(0, mload(memPtr)) } if(b0 < DATA_SHORT_START) return 0; if(b0 < DATA_LONG_START || (b0 >= LIST_SHORT_START && b0 < LIST_LONG_START)) return 1; if(b0 < LIST_SHORT_START) return b0 - DATA_LONG_OFFSET + 1; return b0 - LIST_LONG_OFFSET + 1; }
function _payloadOffset(Item memory self) private pure returns (uint) { if(self._unsafe_length == 0) return 0; uint b0; uint memPtr = self._unsafe_memPtr; assembly { b0 := byte(0, mload(memPtr)) } if(b0 < DATA_SHORT_START) return 0; if(b0 < DATA_LONG_START || (b0 >= LIST_SHORT_START && b0 < LIST_LONG_START)) return 1; if(b0 < LIST_SHORT_START) return b0 - DATA_LONG_OFFSET + 1; return b0 - LIST_LONG_OFFSET + 1; }
11,040
39
// Updates the reserve factor of a reserve. asset The address of the underlying asset of the reserve newReserveFactor The new reserve factor of the reserve /
function setReserveFactor(address asset, uint256 newReserveFactor) external;
function setReserveFactor(address asset, uint256 newReserveFactor) external;
26,655
28
// A harvest delay longer than 1 year doesn't make sense.
require(newHarvestDelay <= 365 days, "DELAY_TOO_LONG");
require(newHarvestDelay <= 365 days, "DELAY_TOO_LONG");
6,134
110
// Maps protocol to addresses containing lend and unlend logic
mapping(bytes32 => address) public protocolToLogic; event WrappedToProtocolSet(address indexed wrapped, bytes32 indexed protocol); event WrappedToUnderlyingSet(address indexed wrapped, address indexed underlying); event ProtocolToLogicSet(bytes32 indexed protocol, address indexed logic); event UnderlyingToProtocolWrappedSet(address indexed underlying, bytes32 indexed protocol, address indexed wrapped);
mapping(bytes32 => address) public protocolToLogic; event WrappedToProtocolSet(address indexed wrapped, bytes32 indexed protocol); event WrappedToUnderlyingSet(address indexed wrapped, address indexed underlying); event ProtocolToLogicSet(bytes32 indexed protocol, address indexed logic); event UnderlyingToProtocolWrappedSet(address indexed underlying, bytes32 indexed protocol, address indexed wrapped);
27,274
0
// Hold all the rigistered citizens
address[] public citizens;
address[] public citizens;
23,738
141
// Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
32,882
13
// "data:application/json;base64,..."
function setNftMetadata(string calldata base64EncodedMetaData) external onlyOwner { nftMetadata = base64EncodedMetaData; }
function setNftMetadata(string calldata base64EncodedMetaData) external onlyOwner { nftMetadata = base64EncodedMetaData; }
21,450
64
// withdraw communityFee_ /
function withdrawCommunity(uint256 _amount) public onlyAdministrator
function withdrawCommunity(uint256 _amount) public onlyAdministrator
32,621
130
// must return true if crowdsale completed successfully
function isSuccessful() public view returns(bool)
function isSuccessful() public view returns(bool)
37,118
552
// 278
entry "forasmuch" : ENG_ADVERB
entry "forasmuch" : ENG_ADVERB
21,114
108
// Percent of funds that go to development--start with 0 and can change.
uint128 public devPercent;
uint128 public devPercent;
10,258
80
// Modifier to use in the initializer function of a contract. /
modifier initializer() { uint256 revision = getRevision(); require(initializing || isConstructor() || revision > lastInitializedRevision, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; lastInitializedRevision = revision; } _; if (isTopLevelCall) { initializing = false; } }
modifier initializer() { uint256 revision = getRevision(); require(initializing || isConstructor() || revision > lastInitializedRevision, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; lastInitializedRevision = revision; } _; if (isTopLevelCall) { initializing = false; } }
51,340
121
// Version of the regstriy for simple version checking. The code is currentlycompatible with only a single version of the contracts. After any change,this number should be increased. The code compares it with a variable incontractInterfaces. /
string public version = "0.8.6";
string public version = "0.8.6";
30,357
10
// Appends a byte array to the end of the buffer. Resizes if doing sowould exceed the capacity of the buffer._buf The buffer to append to._data The data to append. return _buffer The original buffer./
function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) { if (_data.length + _buf.buf.length > _buf.capacity) { resize(_buf, max(_buf.capacity, _data.length) * 2); } uint dest; uint src; uint len = _data.length; assembly { let bufptr := mload(_buf) // Memory address of the buffer data let buflen := mload(bufptr) // Length of existing buffer data dest := add(add(bufptr, buflen), 32) // Start address = buffer address + buffer length + sizeof(buffer length) mstore(bufptr, add(buflen, mload(_data))) // Update buffer length src := add(_data, 32) } for(; len >= 32; len -= 32) { // Copy word-length chunks while possible assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } uint mask = 256 ** (32 - len) - 1; // Copy remaining bytes assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } return _buf; }
function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) { if (_data.length + _buf.buf.length > _buf.capacity) { resize(_buf, max(_buf.capacity, _data.length) * 2); } uint dest; uint src; uint len = _data.length; assembly { let bufptr := mload(_buf) // Memory address of the buffer data let buflen := mload(bufptr) // Length of existing buffer data dest := add(add(bufptr, buflen), 32) // Start address = buffer address + buffer length + sizeof(buffer length) mstore(bufptr, add(buflen, mload(_data))) // Update buffer length src := add(_data, 32) } for(; len >= 32; len -= 32) { // Copy word-length chunks while possible assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } uint mask = 256 ** (32 - len) - 1; // Copy remaining bytes assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } return _buf; }
12,987
160
// Returns whether the SetToken has an external position for a given component (ifof position modules is > 0) /
function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getExternalPositionModules(_component).length > 0; }
function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getExternalPositionModules(_component).length > 0; }
6,364
18
// Returns the amount of tokens that can be withdrawn by the owner. return the amount of tokens/
function getClaimTotal(address beneficiary) public view
function getClaimTotal(address beneficiary) public view
28,772
95
// Update the commit entry with the revealed level.
epoch.commits[sender].oracle_level = oracle_level;
epoch.commits[sender].oracle_level = oracle_level;
20,812
49
// Token Allocations
uint256 public teamReserveAllocation = 2.4 * (10 ** 8) * (10 ** 8); uint256 public lifeReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public finanReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public econReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public developReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8);
uint256 public teamReserveAllocation = 2.4 * (10 ** 8) * (10 ** 8); uint256 public lifeReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public finanReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public econReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8); uint256 public developReserveAllocation = 1.2 * (10 ** 8) * (10 ** 8);
81,853
22
// Compute the start and end of the dispute's current or next appeal period, if possible. If not known or appeal is impossible: should return (0, 0)._disputeID ID of the dispute. return The start and end of the period. /
function appealPeriod(uint _disputeID) external view returns(uint start, uint end);
function appealPeriod(uint _disputeID) external view returns(uint start, uint end);
13,725
190
// Can we run finalize properly /
function isSane() public constant returns (bool) { return (token.mintAgents(address(this)) == true) && (token.releaseAgent() == address(this)); }
function isSane() public constant returns (bool) { return (token.mintAgents(address(this)) == true) && (token.releaseAgent() == address(this)); }
23,192
17
// Date the tokens locktime finish for the beneficiary.
uint256 startTime = releaseSchedule.tokenLockTime + releaseStartTime;
uint256 startTime = releaseSchedule.tokenLockTime + releaseStartTime;
1,565
386
// for doc, see IUnlock.sol
function getAdmin() public view returns (address) { bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; }
function getAdmin() public view returns (address) { bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; }
13,573
2
// The two structs below are used in an array and mapping to keep track of prices that have been requested but are not yet available.
struct QueryIndex { bool isValid; uint256 index; }
struct QueryIndex { bool isValid; uint256 index; }
17,814
1
// Access control modifier that conditions modified function to be called by `owner` account.
modifier onlyOwner() { require(msg.sender == owner, "NOT_OWNER"); _; }
modifier onlyOwner() { require(msg.sender == owner, "NOT_OWNER"); _; }
25,391
244
// extract "v, r, s" from the signature
uint8 v = uint8(_signature[64]); v = v < 27 ? v.add(27) : v; bytes32 r = extractBytes32(_signature, 0); bytes32 s = extractBytes32(_signature, 32);
uint8 v = uint8(_signature[64]); v = v < 27 ? v.add(27) : v; bytes32 r = extractBytes32(_signature, 0); bytes32 s = extractBytes32(_signature, 32);
47,872
52
// investor Investor address/
function deposit(address investor) onlyOwner public payable { require(state == State.Active); deposited[investor] = deposited[investor].add(msg.value); }
function deposit(address investor) onlyOwner public payable { require(state == State.Active); deposited[investor] = deposited[investor].add(msg.value); }
18,061
21
// Increment the reward to transfer
rewardInYDTToTransfer += rewardForTicketId;
rewardInYDTToTransfer += rewardForTicketId;
17,698
78
// Get the approved address for a single NFT. Throws if `_tokenId` is not a valid NFT. _tokenId ID of the NFT to query the approval of. /
function getApproved( uint256 _tokenId ) public view validNFToken(_tokenId) returns (address)
function getApproved( uint256 _tokenId ) public view validNFToken(_tokenId) returns (address)
25,083
146
// Perform the repay of the debt, pulls the initiator collateral and swaps to repay the flash loan premium Fee of the flash loan initiator Address of the user collateralAsset Address of token to be swapped collateralAmount Amount of the reserve to be swapped(flash loan amount) /
function _swapAndRepay( bytes calldata params, uint256 premium, address initiator, IERC20Detailed collateralAsset, uint256 collateralAmount
function _swapAndRepay( bytes calldata params, uint256 premium, address initiator, IERC20Detailed collateralAsset, uint256 collateralAmount
21,368
21
// Creates a new deposit using the specified group id_groupId The group id for the new deposit _params Deposit params /
function depositForGroupId(uint256 _groupId, DepositParams calldata _params)
function depositForGroupId(uint256 _groupId, DepositParams calldata _params)
31,192
5
// jobAddressBytes contains 0x00 in bytes 0-12 since address has 20-byte length
uint8 curr = uint8(jobAddressBytes[i + 12]); uint8 first = curr / 16; uint8 second = curr % 16 * 2; jobAddressHexAsciiBytes[2 + (i * 2)] = conv[first][second]; jobAddressHexAsciiBytes[3 + (i * 2)] = conv[first][second + 1];
uint8 curr = uint8(jobAddressBytes[i + 12]); uint8 first = curr / 16; uint8 second = curr % 16 * 2; jobAddressHexAsciiBytes[2 + (i * 2)] = conv[first][second]; jobAddressHexAsciiBytes[3 + (i * 2)] = conv[first][second + 1];
30,060
105
// View/
function balance() public view returns (uint) { return dusd.balanceOf(address(this)); }
function balance() public view returns (uint) { return dusd.balanceOf(address(this)); }
8,656
117
// Mint new tokens (only owner) recipient recipient address _mintVal amount to mint /
function mint(address recipient, uint256 _mintVal) public onlyOwner whenNotPaused
function mint(address recipient, uint256 _mintVal) public onlyOwner whenNotPaused
37,482
21
// try to initialize an epoch. if it can't it fails if it fails either user either a Plug account will init not init epochs
if (lastInitializedEpoch < epochId) { _initEpoch(epochId); }
if (lastInitializedEpoch < epochId) { _initEpoch(epochId); }
48,070
5
// Gets the liquidation threshold of the reserve self The reserve configurationreturn The liquidation threshold /
{ return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION; }
{ return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION; }
19,951
27
// Emits a {TransferSingle} event. Requirements: - `account` cannot be the zero address.- If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. /
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender();
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender();
12,885
16
// initiates a vote in the case that all empty slots are filled and a applicant requests to challenge an incumbent _challengerAddress address of applicant seeking to replace incumbent _incumbentAddress address of list incumbent
function initiateVote(address _challengerAddress, address _incumbentAddress) private { nextStage(); // placement combats reentrance attacks! linkNameToMemberAdr[challenger] = _challengerAddress; // mapping dually identifies those with ether in contract linkAdrToMemberName[_challengerAddress] = challenger; votingContract.startPoll(_challengerAddress,_incumbentAddress); emit ChallengeInitiated(challenger,linkAdrToMemberName[_incumbentAddress]); //^this TCR contract, not msg.sender, calls startPoll because of opcode call }
function initiateVote(address _challengerAddress, address _incumbentAddress) private { nextStage(); // placement combats reentrance attacks! linkNameToMemberAdr[challenger] = _challengerAddress; // mapping dually identifies those with ether in contract linkAdrToMemberName[_challengerAddress] = challenger; votingContract.startPoll(_challengerAddress,_incumbentAddress); emit ChallengeInitiated(challenger,linkAdrToMemberName[_incumbentAddress]); //^this TCR contract, not msg.sender, calls startPoll because of opcode call }
23,101
12
// _owner Address of the owner.returnuint256 How many tokens of all types the owner has. /
function balanceOf(address _owner) external view returns (uint256)
function balanceOf(address _owner) external view returns (uint256)
15,516
58
// Returns total supply of tokens/ return Total supply
function totalSupply() public constant returns (uint)
function totalSupply() public constant returns (uint)
37,831
13
// Allow the creator to collect the 3% Fee/
function collectFee() {
function collectFee() {
28,840
52
// Is this method already being called?
require(!distributionActive); distributionActive = true;
require(!distributionActive); distributionActive = true;
43,149
52
// subtract already withdrawn amounts
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
38,624
32
// Remove 0.5% from _burnRate
burnRate -= 50;
burnRate -= 50;
13,079
553
// query the available amount of LINK for an oracle to withdraw /
function withdrawablePayment(address _oracle) external view returns (uint256)
function withdrawablePayment(address _oracle) external view returns (uint256)
13,293
51
// PUSH2
OpCodes[97].Ins = 0; OpCodes[97].Outs = 1; OpCodes[97].Gas = 3;
OpCodes[97].Ins = 0; OpCodes[97].Outs = 1; OpCodes[97].Gas = 3;
3,061
29
// read
function isGason(uint64 _objId) constant external returns(bool); function getObjBattleInfo(uint64 _objId) constant external returns(uint32 classId, uint32 exp, bool isGason, uint ancestorLength, uint xfactorsLength); function getClassPropertySize(uint32 _classId, PropertyType _type) constant external returns(uint); function getClassPropertyValue(uint32 _classId, PropertyType _type, uint index) constant external returns(uint32);
function isGason(uint64 _objId) constant external returns(bool); function getObjBattleInfo(uint64 _objId) constant external returns(uint32 classId, uint32 exp, bool isGason, uint ancestorLength, uint xfactorsLength); function getClassPropertySize(uint32 _classId, PropertyType _type) constant external returns(uint); function getClassPropertyValue(uint32 _classId, PropertyType _type, uint index) constant external returns(uint32);
12,646
21
// Close a vaultPosition partially/params The parameters necessary, encoded as `CloseVaultPositionPartiallyParams` in calldata
function closeVaultPositionPartially( CloseVaultPositionPartiallyParams calldata params ) external payable override nonReentrant checkDeadline(params.deadline) avoidUsingNativeEther
function closeVaultPositionPartially( CloseVaultPositionPartiallyParams calldata params ) external payable override nonReentrant checkDeadline(params.deadline) avoidUsingNativeEther
10,106
81
// Refund function, calculates the amount of tokens still available and issues them to the investor, then calculates the amount of etther to be sent back
else {
else {
11,156
696
// Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. /
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
5,775
739
// Returns the list of the initialized reserves /
function getReservesList() external view override returns (address[] memory) { address[] memory _activeReserves = new address[](_reservesCount); for (uint256 i = 0; i < _reservesCount; i++) { _activeReserves[i] = _reservesList[i]; } return _activeReserves; }
function getReservesList() external view override returns (address[] memory) { address[] memory _activeReserves = new address[](_reservesCount); for (uint256 i = 0; i < _reservesCount; i++) { _activeReserves[i] = _reservesList[i]; } return _activeReserves; }
19,043
200
// borrow assets from this LP, and return them within the same transaction.//_token The address of the token contract./_amount The amont of token./_data The implementation specific data for the Borrower.// return Nothing.
function borrow( address _token, uint256 _amount, bytes calldata _data
function borrow( address _token, uint256 _amount, bytes calldata _data
16,081
65
// The token sale supply
uint256 public constant TOKEN_SALE_SUPPLY = 450000000 * J8T_DECIMALS_FACTOR;
uint256 public constant TOKEN_SALE_SUPPLY = 450000000 * J8T_DECIMALS_FACTOR;
5,747
1
// will deposit to owner after staking
transferOwnership(owner);
transferOwnership(owner);
26,061
13
// When smth happened, change the wallet addres to the new one. This is owner-only, which is DAA onlyBy calling this function, all the ledger and logic in the contract are lost./
function changeWalletAddress(address _newAdr) public onlyOwner returns (bool) { selfdestruct(_newAdr); return true; }
function changeWalletAddress(address _newAdr) public onlyOwner returns (bool) { selfdestruct(_newAdr); return true; }
45,172
15
// General Description:Determine a value of precision.Calculate an integer approximation of (_baseN / _baseD) ^ (_expN / _expD)2 ^ precision.Return the result along with the precision used. Detailed Description:Instead of calculating "base ^ exp", we calculate "e ^ (log(base)exp)".The value of "log(base)" is represented with an integer slightly smaller than "log(base)2 ^ precision".The larger "precision" is, the more accurately this value represents the real value.However, the larger "precision" is, the more bits are required in order to store this value.And the exponentiation function, which takes "x" and calculates "e ^ x", is limited to a maximum exponent (maximum value of "x").This
function power( uint256 _baseN, uint256 _baseD, uint32 _expN, uint32 _expD
function power( uint256 _baseN, uint256 _baseD, uint32 _expN, uint32 _expD
1,171
137
// Withdraw all available tokens. /
function withdrawTokenPool(address token) public whenNotPaused nonReentrant returns (bool) { require(isPoolAvailable(token), "Pool is not available"); UserSp storage tokenStakingPool = users[_msgSender()].tokenPools[token]; require(tokenStakingPool.staked > 0 || tokenStakingPool.earned > 0, "Not available"); Pool storage pool = pools[token]; _vault.transferToken(address(rewardToken), _msgSender(), _getEarned(pool, tokenStakingPool)); tokenStakingPool.lastRewardTime = block.timestamp; tokenStakingPool.earned = 0; emit TokenWithdrawed(_msgSender(), token, tokenStakingPool.staked); if (tokenStakingPool.staked > 0) { _vault.transferToken(token, _msgSender(), tokenStakingPool.staked); tokenStakingPool.staked = 0; } return true; }
function withdrawTokenPool(address token) public whenNotPaused nonReentrant returns (bool) { require(isPoolAvailable(token), "Pool is not available"); UserSp storage tokenStakingPool = users[_msgSender()].tokenPools[token]; require(tokenStakingPool.staked > 0 || tokenStakingPool.earned > 0, "Not available"); Pool storage pool = pools[token]; _vault.transferToken(address(rewardToken), _msgSender(), _getEarned(pool, tokenStakingPool)); tokenStakingPool.lastRewardTime = block.timestamp; tokenStakingPool.earned = 0; emit TokenWithdrawed(_msgSender(), token, tokenStakingPool.staked); if (tokenStakingPool.staked > 0) { _vault.transferToken(token, _msgSender(), tokenStakingPool.staked); tokenStakingPool.staked = 0; } return true; }
7,729
5
// The date the offer was initialized by the token
uint256 internal nOfferStartDate;
uint256 internal nOfferStartDate;
8,596
43
// Burns token balance in "account" and decrease totalsupply of tokenCan only be called by the current owner. /
function burn(address account, uint256 value) public onlyOwner { _burn(account, value); }
function burn(address account, uint256 value) public onlyOwner { _burn(account, value); }
42,134
28
// Constructor that initializes the address of the HA token contract./_token ERC20 The address of the previously deployed HA token contract.
constructor(ERC20 _token) public { require(_token != address(0)); token = _token; }
constructor(ERC20 _token) public { require(_token != address(0)); token = _token; }
34,501
11
// Equivalent to require(x == 0 || (xy) / x == y)
if iszero(or(iszero(x), eq(div(z, x), y))) { revert(0, 0) }
if iszero(or(iszero(x), eq(div(z, x), y))) { revert(0, 0) }
75,279
11
// account address checked for token balancereturn the amount of tokens locked in the contract for the specified address/
function tokenBalanceOf(address account) public view returns (uint256) { return _tokenBalances[account]; }
function tokenBalanceOf(address account) public view returns (uint256) { return _tokenBalances[account]; }
24,138
13
// Removes account from blacklist _account The address to remove from the blacklist/
function unBlacklist(address _account) public onlyBlacklister { blacklisted[_account] = false; emit UnBlacklisted(_account); }
function unBlacklist(address _account) public onlyBlacklister { blacklisted[_account] = false; emit UnBlacklisted(_account); }
13,698
97
// Returns the threshold before swap and liquify. /
function minTokensBeforeSwap() external view virtual returns (uint256) { return _minTokensBeforeSwap; }
function minTokensBeforeSwap() external view virtual returns (uint256) { return _minTokensBeforeSwap; }
20,762
39
// only the sender or an approved spender can upgrade.
require( msg.sender == _sender || radcoinV1.allowance(_sender, msg.sender) >= _amount, "Radcoin: unauthorized upgrade" ); radcoinV1.safeTransferFrom(_sender, address(this), _amount); _mint(_receiver, _amount); emit RadcoinUpgraded(_sender, _receiver, _amount);
require( msg.sender == _sender || radcoinV1.allowance(_sender, msg.sender) >= _amount, "Radcoin: unauthorized upgrade" ); radcoinV1.safeTransferFrom(_sender, address(this), _amount); _mint(_receiver, _amount); emit RadcoinUpgraded(_sender, _receiver, _amount);
38,839
13
// Max investment limit for investor, zero(0) for unlimited (wei)
uint256 private _weiMaxInvestmentLimit;
uint256 private _weiMaxInvestmentLimit;
48,168
0
// Name your custom token
string public constant name = "VURIUS GOLD";
string public constant name = "VURIUS GOLD";
16,813
54
// Adds a card set with the input param configs. Removes an existing set if the id exists. /
function addCardSet(uint256 _setId, uint256[] memory _cardIds, uint256 _bonusTingMultiplier, uint256 _tingPerDayPerCard, uint256[] memory _poolBoosts, uint256 _bonusFullSetBoost, bool _isBooster) public onlyOwner { removeCardSet(_setId); uint256 length = _cardIds.length; for (uint256 i = 0; i < length; ++i) { uint256 cardId = _cardIds[i]; if (cardId > highestCardId) { highestCardId = cardId; } // Check all cards to assign arent already part of another set require(cardToSetMap[cardId] == 0, "Card already assigned to a set"); // Assign to set cardToSetMap[cardId] = _setId; } if (_isInArray(_setId, cardSetList) == false) { cardSetList.push(_setId); } cardSets[_setId] = CardSet({ cardIds: _cardIds, bonusTingMultiplier: _bonusTingMultiplier, tingPerDayPerCard: _tingPerDayPerCard, isBooster: _isBooster, poolBoosts: _poolBoosts, bonusFullSetBoost: _bonusFullSetBoost, isRemoved: false }); }
function addCardSet(uint256 _setId, uint256[] memory _cardIds, uint256 _bonusTingMultiplier, uint256 _tingPerDayPerCard, uint256[] memory _poolBoosts, uint256 _bonusFullSetBoost, bool _isBooster) public onlyOwner { removeCardSet(_setId); uint256 length = _cardIds.length; for (uint256 i = 0; i < length; ++i) { uint256 cardId = _cardIds[i]; if (cardId > highestCardId) { highestCardId = cardId; } // Check all cards to assign arent already part of another set require(cardToSetMap[cardId] == 0, "Card already assigned to a set"); // Assign to set cardToSetMap[cardId] = _setId; } if (_isInArray(_setId, cardSetList) == false) { cardSetList.push(_setId); } cardSets[_setId] = CardSet({ cardIds: _cardIds, bonusTingMultiplier: _bonusTingMultiplier, tingPerDayPerCard: _tingPerDayPerCard, isBooster: _isBooster, poolBoosts: _poolBoosts, bonusFullSetBoost: _bonusFullSetBoost, isRemoved: false }); }
33,806
25
// create transaction + pay the SELL order to beneficiary + event transaction
_amountLeftToBuy = 0;
_amountLeftToBuy = 0;
6,879
240
// Make sure the new lot is created successfully
require (_lotOwner == _to);
require (_lotOwner == _to);
53,048
0
// 有构造方法
constructor(uint256 initialSupply) ERC20("DamnValuableToken", "DVT") { _mint(msg.sender, initialSupply); }
constructor(uint256 initialSupply) ERC20("DamnValuableToken", "DVT") { _mint(msg.sender, initialSupply); }
22,319
23
// assign bet
_outcome == 1 ? contests[_index].total1 += msg.value : contests[_index].total2 += msg.value; emit BetPlaced(msg.sender, msg.value, _outcome); // give out confirmation
_outcome == 1 ? contests[_index].total1 += msg.value : contests[_index].total2 += msg.value; emit BetPlaced(msg.sender, msg.value, _outcome); // give out confirmation
38,100
7
// PUBLIC FUNCTIONS /
function allowlistMintedAmount(address addr) public view returns (uint256) { return _allowlistMintCntPerAddress[addr]; }
function allowlistMintedAmount(address addr) public view returns (uint256) { return _allowlistMintCntPerAddress[addr]; }
29,698
150
// Delete the slot where the moved entry was stored
map._entries.pop();
map._entries.pop();
169
44
// Can only be fund if there is already a setting
require(latestSetting.id > 0, "NO_ALLOC_SETTING");
require(latestSetting.id > 0, "NO_ALLOC_SETTING");
20,159
54
// LP token contract address
address public LPtokenAddress = 0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852;
address public LPtokenAddress = 0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852;
41,769
96
// Contract holding only data.
EthernautsStorage public ethernautsStorage;
EthernautsStorage public ethernautsStorage;
30,164
236
// Prepare update of an address key Key to update newAddress New address for `key`return `true` if successful. /
function prepareAddress(bytes32 key, address newAddress) external override onlyGovernance returns (bool)
function prepareAddress(bytes32 key, address newAddress) external override onlyGovernance returns (bool)
51,186
6
// Assess new reward./_user Address of the user.
function updateStakingReward(address _user) internal override { super.updateStakingReward(_user); executeUnstakes(_user); }
function updateStakingReward(address _user) internal override { super.updateStakingReward(_user); executeUnstakes(_user); }
29,032
72
// - Return superblock status
function getSuperblockStatus(bytes32 _superblockHash) public view returns (Status) { return superblocks[_superblockHash].status; }
function getSuperblockStatus(bytes32 _superblockHash) public view returns (Status) { return superblocks[_superblockHash].status; }
34,094
9
// Will be in 1e6 format
return eth_usd_price.mul(PRICE_PRECISION).div(price_vs_eth);
return eth_usd_price.mul(PRICE_PRECISION).div(price_vs_eth);
33,510