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 |
|---|---|---|---|---|
205 | // If this account has bitmaps set, this is the corresponding currency id | uint16 bitmapCurrencyId;
| uint16 bitmapCurrencyId;
| 29,162 |
153 | // When a new asset is create it emits build event/owner The address of asset owner/tokenId Asset UniqueID/assetId ID that defines asset look and feel/price asset price | event Build(address owner, uint256 tokenId, uint16 assetId, uint256 price);
| event Build(address owner, uint256 tokenId, uint16 assetId, uint256 price);
| 1,779 |
8 | // reference to $BONE for burning on mint | BONE public bone;
| BONE public bone;
| 65,585 |
142 | // reward token address | address internal _want;
| address internal _want;
| 65,546 |
25 | // withdraws(super -> normal) tokens from contract | require(balance >= _amount, "Insufficient balance");
balance -= _amount;
token.downgradeTo(msg.sender, _amount);
| require(balance >= _amount, "Insufficient balance");
balance -= _amount;
token.downgradeTo(msg.sender, _amount);
| 31,823 |
0 | // <no suffix> 0 | "of Power", // 1
"of Giants", // 2
"of Titans", // 3
"of Skill", // 4
"of Perfection", // 5
"of Brilliance", // 6
"of Enlightenment", // 7
"of Protection", // 8
"of Anger", // 9
"of Rage", // 10
| "of Power", // 1
"of Giants", // 2
"of Titans", // 3
"of Skill", // 4
"of Perfection", // 5
"of Brilliance", // 6
"of Enlightenment", // 7
"of Protection", // 8
"of Anger", // 9
"of Rage", // 10
| 5,942 |
28 | // Scales the amount of tokens in a purchase, to ensure it will be less or equal to the amount of unsold tokensIf there are no tokens left, it will return 0 _amount uint256 the amount of tokens in the purchase attemptreturn _exactAmount uint256 / | function scalePurchaseTokenAmountToMatchRemainingTokens(uint256 _amount) internal view returns (uint256 _exactAmount) {
if (nextTokenId + _amount - 1 > totalTokenSupply) {
_amount = totalTokenSupply - nextTokenId + 1;
}
return _amount;
}
| function scalePurchaseTokenAmountToMatchRemainingTokens(uint256 _amount) internal view returns (uint256 _exactAmount) {
if (nextTokenId + _amount - 1 > totalTokenSupply) {
_amount = totalTokenSupply - nextTokenId + 1;
}
return _amount;
}
| 31,276 |
11 | // Triggered when rental fee accumulated in the contract _tokenIdToken id that was rented _from Frame owner _valueRental fee collected / | event RentalFeeCollectedFrom(uint256 indexed _tokenId, address indexed _from, uint256 _value);
| event RentalFeeCollectedFrom(uint256 indexed _tokenId, address indexed _from, uint256 _value);
| 39,956 |
17 | // Confirm and execute a proposed mint or burn, if enough time has passed since the proposal. | function confirm(uint256 index, address addr, uint256 value, bool isMint) external onlyAdmin {
// Check authorization.
requireMatchingOpenProposal(index, addr, value, isMint);
// See commentary above about using `now`.
// solium-disable-next-line security/no-block-members
re... | function confirm(uint256 index, address addr, uint256 value, bool isMint) external onlyAdmin {
// Check authorization.
requireMatchingOpenProposal(index, addr, value, isMint);
// See commentary above about using `now`.
// solium-disable-next-line security/no-block-members
re... | 9,348 |
6 | // 记录所有账户的代币的余额 | mapping(address => uint) public balanceOf;
| mapping(address => uint) public balanceOf;
| 11,723 |
373 | // set started poll state | _poll.start = block.timestamp;
delete _poll.voted;
_poll.yesVotes = 0;
_poll.noVotes = 0;
_poll.duration = pollDuration;
_poll.cooldown = pollCooldown;
| _poll.start = block.timestamp;
delete _poll.voted;
_poll.yesVotes = 0;
_poll.noVotes = 0;
_poll.duration = pollDuration;
_poll.cooldown = pollCooldown;
| 51,991 |
164 | // Executes a swap from `token0` to the `toToken` and sends them to the recipient`. | uint256 token0bal = fromInfo.token0.balanceOf(address(this));
if (fromInfo.token0 == toToken) {
toToken.safeTransfer(recipient, token0bal);
} else {
| uint256 token0bal = fromInfo.token0.balanceOf(address(this));
if (fromInfo.token0 == toToken) {
toToken.safeTransfer(recipient, token0bal);
} else {
| 48,726 |
32 | // A simple recipient registry managed by a trusted entity. / | contract SimpleRecipientRegistry is Ownable, IRecipientRegistry {
// Structs
struct Recipient {
uint256 index;
uint256 addedAt;
uint256 removedAt;
uint256 prevRemovedAt;
}
// State
address public controller;
uint256 public maxRecipients;
uint256 private nextRecipientIndex = 1;
mapping(... | contract SimpleRecipientRegistry is Ownable, IRecipientRegistry {
// Structs
struct Recipient {
uint256 index;
uint256 addedAt;
uint256 removedAt;
uint256 prevRemovedAt;
}
// State
address public controller;
uint256 public maxRecipients;
uint256 private nextRecipientIndex = 1;
mapping(... | 8,914 |
454 | // Returns x + y, reverts if overflows or underflows/x The augend/y The addend/ return z The sum of x and y | function add(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x + y) >= x == (y >= 0));
}
| function add(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x + y) >= x == (y >= 0));
}
| 39,958 |
55 | // execute only if caller is an owner | modifier onlyOwner {
require(msg.sender == owner);
_;
}
| modifier onlyOwner {
require(msg.sender == owner);
_;
}
| 26,442 |
123 | // rc_builtin/value0_0 = column19_row12. | let val := /*column19_row12*/ mload(0x38e0)
mstore(0x4280, val)
| let val := /*column19_row12*/ mload(0x38e0)
mstore(0x4280, val)
| 56,619 |
34 | // This function is to deliver tokens to account holders./ | function deliver(uint256 tAmount) external {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmou... | function deliver(uint256 tAmount) external {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmou... | 43,006 |
31 | // Register a vote for `proposalId` by `account` with a given `support`, voting `weight` and voting `params`. Note: Support is generic and can represent various things depending on the voting system used. / | function _countVote(uint256 proposalId, address account, uint8 support, uint256 weight, bytes memory params) internal virtual;
| function _countVote(uint256 proposalId, address account, uint8 support, uint256 weight, bytes memory params) internal virtual;
| 39,914 |
13 | // Take the payment for crafting | paymentContract.safeTransferFrom(_msgSender(), address(this), priceToPay);
| paymentContract.safeTransferFrom(_msgSender(), address(this), priceToPay);
| 21,279 |
251 | // extract an address in a bytes data bytes from where the address will be extract offset position of the first byte of the addressreturn address / | function extractAddress(bytes _data, uint offset)
internal
pure
returns (address m)
| function extractAddress(bytes _data, uint offset)
internal
pure
returns (address m)
| 37,785 |
1 | // Adds b to a in a manner that throws an exception when overflow conditions are met./ | // function safeAdd(uint a, uint b) returns (uint) {
// if (a + b >= a) {
// return a + b;
// } else {
// throw;
// }
// }
| // function safeAdd(uint a, uint b) returns (uint) {
// if (a + b >= a) {
// return a + b;
// } else {
// throw;
// }
// }
| 30,668 |
9 | // Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One poss... | function approve(address spender, uint256 amount) external returns (bool);
| function approve(address spender, uint256 amount) external returns (bool);
| 350 |
36 | // An event emitted when a proposal has been executed in the Timelock | event ProposalExecuted(uint id);
| event ProposalExecuted(uint id);
| 6,422 |
16 | // These events are defined in IERC20Token.sol event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens); event Transfer(address indexed from, address indexed to, uint256 tokens); | 39,622 | ||
15 | // update aggregated values | totalTokensUsedInProcesses += _businessProcesses[_businessProcessId]
.tokensAllocated;
AUMProc += _businessProcesses[_businessProcessId].AUM;
| totalTokensUsedInProcesses += _businessProcesses[_businessProcessId]
.tokensAllocated;
AUMProc += _businessProcesses[_businessProcessId].AUM;
| 30,820 |
30 | // List of all tokens | string[] memory tokenURIs = new string[](tokenCount);
| string[] memory tokenURIs = new string[](tokenCount);
| 43,926 |
121 | // Set the parameters of the market_marketParams Set the new market params / | function setMarketParams(
TypesV1.MarketParams memory _marketParams
)
public
onlyAdmin
| function setMarketParams(
TypesV1.MarketParams memory _marketParams
)
public
onlyAdmin
| 44,076 |
0 | // Variables/ slither-disable-next-line constable-states | bool public isUpgrading = true;
L1ChugSplashProxy public target;
address public finalOwner;
bytes32 public codeHash;
bytes32 public messengerSlotKey;
bytes32 public messengerSlotVal;
bytes32 public bridgeSlotKey;
bytes32 public bridgeSlotVal;
| bool public isUpgrading = true;
L1ChugSplashProxy public target;
address public finalOwner;
bytes32 public codeHash;
bytes32 public messengerSlotKey;
bytes32 public messengerSlotVal;
bytes32 public bridgeSlotKey;
bytes32 public bridgeSlotVal;
| 23,677 |
160 | // Implemented by jobs to show that a keeper performed work keeper address of the keeper that performed the work amount the amount of ETH sent to the keeper / | function receiptETH(address keeper, uint amount) external {
require(jobs[msg.sender], "receipt: !job");
credits[msg.sender][ETH] = credits[msg.sender][ETH].sub(amount, "workReceipt: insuffient funds");
lastJob[keeper] = now;
payable(keeper).transfer(amount);
emit KeeperWorked... | function receiptETH(address keeper, uint amount) external {
require(jobs[msg.sender], "receipt: !job");
credits[msg.sender][ETH] = credits[msg.sender][ETH].sub(amount, "workReceipt: insuffient funds");
lastJob[keeper] = now;
payable(keeper).transfer(amount);
emit KeeperWorked... | 16,828 |
61 | // A helper function to create the publicSignals array from meaningfulparameters. _newStateRoot The new state root after all messages are processed _stateTreeRoots The intermediate state roots _ecdhPubKeys The public key used to generated the ECDH shared keyto decrypt the message / | function genBatchUstPublicSignals(
uint256 _newStateRoot,
uint256[] memory _stateTreeRoots,
PubKey[] memory _ecdhPubKeys
| function genBatchUstPublicSignals(
uint256 _newStateRoot,
uint256[] memory _stateTreeRoots,
PubKey[] memory _ecdhPubKeys
| 5,994 |
63 | // Returns to normal state. Requirements: - The contract must be paused. / | function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
| function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
| 2,267 |
173 | // Check if accountCollateralTokens have been initialized. / | mapping (address => bool) public isCollateralTokenInit;
| mapping (address => bool) public isCollateralTokenInit;
| 22,918 |
7 | // final byte (first byte of the next 32 bytes) | v := byte(0, mload(add(sig, 96)))
| v := byte(0, mload(add(sig, 96)))
| 6,572 |
3 | // @inheritdoc IL2Pool | function supply(bytes32 args) external override {
(address asset, uint256 amount, uint16 referralCode) = CalldataLogic.decodeSupplyParams(
_reservesList,
args
);
supply(asset, amount, msg.sender, referralCode);
}
| function supply(bytes32 args) external override {
(address asset, uint256 amount, uint16 referralCode) = CalldataLogic.decodeSupplyParams(
_reservesList,
args
);
supply(asset, amount, msg.sender, referralCode);
}
| 17,062 |
73 | // After trading is started it cannot be paused again Transfers are initially is to enable the presale contract to be the first to add liquidity | function enableTrading() external onlyOwner {
isTradingStarted = true;
}
| function enableTrading() external onlyOwner {
isTradingStarted = true;
}
| 16,849 |
248 | // Replace the current mintkey with new mintkey _newMintKey address of the new mintKey / | function transferMintKey(address _newMintKey) external onlyOwner {
require(_newMintKey != address(0), "new mint key cannot be 0x0");
emit TransferMintKey(mintKey, _newMintKey);
mintKey = _newMintKey;
}
| function transferMintKey(address _newMintKey) external onlyOwner {
require(_newMintKey != address(0), "new mint key cannot be 0x0");
emit TransferMintKey(mintKey, _newMintKey);
mintKey = _newMintKey;
}
| 18,895 |
0 | // TYPES/ The `Request` struct stores a pending unlocking. `callbackAddress` and `callbackSelector` are the data required to make a callback. The custodian completes the process by calling `callbackAddress.call(callbackSelector, lockId)`, which signals to the contract co-operating with the Custodian that the 2-of-N sig... | struct Request {
bytes32 lockId;
bytes4 callbackSelector; // bytes4 and address can be packed into 1 word
address callbackAddress;
uint256 idx;
uint256 timestamp;
bool extended;
}
| struct Request {
bytes32 lockId;
bytes4 callbackSelector; // bytes4 and address can be packed into 1 word
address callbackAddress;
uint256 idx;
uint256 timestamp;
bool extended;
}
| 16,086 |
23 | // amount {uint256} - AXN amount to be stakedstakingDays {uint256} - number of days to be stakedstaker {address} - account address to create the stake for | function externalStake(
uint256 amount,
uint256 stakingDays,
address staker
) external override onlyExternalStaker pausable {
require(stakingDays != 0, 'Staking: Staking days < 1');
require(stakingDays <= 5555, 'Staking: Staking days > 5555');
stakeInternal(amoun... | function externalStake(
uint256 amount,
uint256 stakingDays,
address staker
) external override onlyExternalStaker pausable {
require(stakingDays != 0, 'Staking: Staking days < 1');
require(stakingDays <= 5555, 'Staking: Staking days > 5555');
stakeInternal(amoun... | 24,237 |
13 | // encodeEncodes an account struct with packed ABI encoding. account Account struct to encode. / | function encode(
Account memory account
| function encode(
Account memory account
| 44,096 |
19 | // the total amount of gas the tx is DataFee + TxFee + ExecutionGas ExecutionGas | gas = gasleft();
| gas = gasleft();
| 35,159 |
69 | // Updates token fee for approving a transferfee New token fee/ | function setFee(uint256 fee)
public
onlyValidator
| function setFee(uint256 fee)
public
onlyValidator
| 22,851 |
62 | // ROUND DATA | mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data
mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id
| mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data
mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id
| 20,547 |
4 | // address payable org, string memory _category | ERC721(_name, _symbol)
| ERC721(_name, _symbol)
| 14,443 |
153 | // For IDLE, the distribution is done only to IdleTokens, so `holders` and `tokens` parameters are the same and equal to address(this) | IdleController(idleController).claimIdle(holders, holders);
return;
| IdleController(idleController).claimIdle(holders, holders);
return;
| 66,044 |
17 | // Determines if the given "_mediatedSalesTransactionIpfsHash" Mediated Sales Transaction is in the Approved State. It is in the Approved Stateif 2-out-of-3 Buyer, Seller, and/or Mediator Approve it. | function mediatedSalesTransactionHasBeenApproved(string memory _mediatedSalesTransactionIpfsHash) public view returns (bool) {
require(mediatedSalesTransactionExists[_mediatedSalesTransactionIpfsHash], "Given Mediated Sales Transaction IPFS Hash does not exist!");
uint numberOfApprovals = 0... | function mediatedSalesTransactionHasBeenApproved(string memory _mediatedSalesTransactionIpfsHash) public view returns (bool) {
require(mediatedSalesTransactionExists[_mediatedSalesTransactionIpfsHash], "Given Mediated Sales Transaction IPFS Hash does not exist!");
uint numberOfApprovals = 0... | 33,553 |
3,492 | // 1747 | entry "painfilled" : ENG_ADJECTIVE
| entry "painfilled" : ENG_ADJECTIVE
| 18,359 |
27 | // Returns current game players. / | function getPlayedGamePlayers() public view returns (uint) {
return getPlayersInGame(game);
}
| function getPlayedGamePlayers() public view returns (uint) {
return getPlayersInGame(game);
}
| 32,365 |
54 | // The fyToken cache includes the virtual fyToken, equal to the supply. | uint256 realFYTokenCached_ = cache.fyTokenCached - supply;
| uint256 realFYTokenCached_ = cache.fyTokenCached - supply;
| 25,394 |
128 | // Withdraw tokens from ABlockFarmTest | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending =
user
.a... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending =
user
.a... | 11,552 |
16 | // Decimals to use | uint8 public decimal = 18;
| uint8 public decimal = 18;
| 17,775 |
72 | // update the lastClaim date for tokenId and contractAddress | bytes32 lastClaimKey = keccak256(abi.encode(_contractAddress, _tokenId));
lastClaim[lastClaimKey] = block.timestamp;
| bytes32 lastClaimKey = keccak256(abi.encode(_contractAddress, _tokenId));
lastClaim[lastClaimKey] = block.timestamp;
| 28,530 |
99 | // Log that the item is not transferable. | emit SetNotTransferable(itemId, state.owner);
| emit SetNotTransferable(itemId, state.owner);
| 2,247 |
3 | // See {TokenMintingPool._removeTokens}. / | function removeTokens(bytes32[] memory tokenHashes) public onlyOwner {
_removeTokens(tokenHashes);
}
| function removeTokens(bytes32[] memory tokenHashes) public onlyOwner {
_removeTokens(tokenHashes);
}
| 3,310 |
7 | // Proxy coins/_to addressCalldata address/_data bytesCalldata | function proxyCoins(address _to, bytes calldata _data) internal {
uint amount = msg.value;
require(amount > 0, "ChainspotProxy: amount is too small");
uint feeAmount = calcFee(amount);
if (feeAmount > 0) {
(bool successFee, ) = owner().call{value: feeAmount}("");
... | function proxyCoins(address _to, bytes calldata _data) internal {
uint amount = msg.value;
require(amount > 0, "ChainspotProxy: amount is too small");
uint feeAmount = calcFee(amount);
if (feeAmount > 0) {
(bool successFee, ) = owner().call{value: feeAmount}("");
... | 25,811 |
82 | // Moves a proposal from the Created to Accepted state. | function accept(uint256 _time) external onlyOwner {
require(state == State.Created, "proposal not created");
time = _time;
state = State.Accepted;
emit ProposalAccepted(proposer, _time);
}
| function accept(uint256 _time) external onlyOwner {
require(state == State.Created, "proposal not created");
time = _time;
state = State.Accepted;
emit ProposalAccepted(proposer, _time);
}
| 30,442 |
14 | // (a + b - 1) / b can overflow on addition, so we distribute. | return a / b + (a % b == 0 ? 0 : 1);
| return a / b + (a % b == 0 ? 0 : 1);
| 29,958 |
274 | // Listings | mapping(uint256 => Listing) private listings;
uint256 public constant MAX_SUPPLY = 7777;
uint256 public guitarsRemainingToAssign = 7777;
uint256 public reserved = 0;
uint256 public _saleStarted = 0;
address payable private artist_;
uint256 private _devRoyalty;
uint256 private _minterRoy... | mapping(uint256 => Listing) private listings;
uint256 public constant MAX_SUPPLY = 7777;
uint256 public guitarsRemainingToAssign = 7777;
uint256 public reserved = 0;
uint256 public _saleStarted = 0;
address payable private artist_;
uint256 private _devRoyalty;
uint256 private _minterRoy... | 2,772 |
25 | // 진행중인 대출 계약서 조회하기/_loanId 계약 번호/ return The contract of given loanId | function getContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint16 productId,
bytes8 coinName,
uint256 coinAmount,
uint32 coinUnitPrice,
string collateralAddress,
| function getContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint16 productId,
bytes8 coinName,
uint256 coinAmount,
uint32 coinUnitPrice,
string collateralAddress,
| 40,123 |
30 | // =======================================/ -- APPLICATION ENTRY POINTS --/ | constructor(address _Share1,address _Share2,address _token)
public
| constructor(address _Share1,address _Share2,address _token)
public
| 19,412 |
980 | // Allows "hooking into" specific moments in the migration pipeline/ to execute arbitrary logic during a migration out of this release/_vaultProxy The VaultProxy being migrated | function invokeMigrationOutHook(
MigrationOutHook _hook,
address _vaultProxy,
address,
address,
address
) external override {
if (_hook != MigrationOutHook.PreMigrate) {
return;
}
| function invokeMigrationOutHook(
MigrationOutHook _hook,
address _vaultProxy,
address,
address,
address
) external override {
if (_hook != MigrationOutHook.PreMigrate) {
return;
}
| 44,437 |
48 | // Utility function to check if a value is inside an array | function _isInArray(uint256 _value, uint256[] memory _array) internal pure returns(bool) {
uint256 length = _array.length;
for (uint256 i = 0; i < length; ++i) {
if (_array[i] == _value) {
return true;
}
}
return false;
}
| function _isInArray(uint256 _value, uint256[] memory _array) internal pure returns(bool) {
uint256 length = _array.length;
for (uint256 i = 0; i < length; ++i) {
if (_array[i] == _value) {
return true;
}
}
return false;
}
| 289 |
46 | // How many investors we have now // Sum from the spreadsheet how much tokens we should get on the contract. If the sum does not match at the time of the lock the vault is faulty and must be recreated.// How many tokens investors have claimed so far // How many tokens our internal book keeping tells us to have at the t... | enum State{Unknown, Loading, Holding, Distributing}
/** We allocated tokens for investor */
event Allocated(address investor, uint value);
/** We distributed tokens to an investor */
event Distributed(address investors, uint count);
event Locked();
/**
* Create presale contract where lock up period... | enum State{Unknown, Loading, Holding, Distributing}
/** We allocated tokens for investor */
event Allocated(address investor, uint value);
/** We distributed tokens to an investor */
event Distributed(address investors, uint count);
event Locked();
/**
* Create presale contract where lock up period... | 3,626 |
62 | // Gets tokens for specified ether provided that they are still under the cap/ | function getTokensAmountUnderCap(uint etherAmount) private constant returns (uint){
uint tokens = getTokensAmount(etherAmount);
require(tokens > 0);
require(tokens.add(token.totalSupply()) <= SALE_CAP);
return tokens;
}
| function getTokensAmountUnderCap(uint etherAmount) private constant returns (uint){
uint tokens = getTokensAmount(etherAmount);
require(tokens > 0);
require(tokens.add(token.totalSupply()) <= SALE_CAP);
return tokens;
}
| 7,428 |
81 | // Calculates the square root of x, rounding down./Uses the Babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method.// Requirements:/ - x must be less than `MAX_UD60x18` divided by `UNIT`.//x The UD60x18 number for which to calculate the square root./ return result The result as... | function sqrt(UD60x18 x) pure returns (UD60x18 result) {
uint256 xUint = unwrap(x);
unchecked {
if (xUint > uMAX_UD60x18 / uUNIT) {
revert PRBMath_UD60x18_Sqrt_Overflow(x);
}
// Multiply x by `UNIT` to account for the factor of `UNIT` that is picked up when multiplying two U... | function sqrt(UD60x18 x) pure returns (UD60x18 result) {
uint256 xUint = unwrap(x);
unchecked {
if (xUint > uMAX_UD60x18 / uUNIT) {
revert PRBMath_UD60x18_Sqrt_Overflow(x);
}
// Multiply x by `UNIT` to account for the factor of `UNIT` that is picked up when multiplying two U... | 16,849 |
33 | // set erc price to total royalties to be collected | tokenPrice=royaltyPrice;
AinsophContract.setTokenPrice(tokenPrice, asset);
| tokenPrice=royaltyPrice;
AinsophContract.setTokenPrice(tokenPrice, asset);
| 16,750 |
24 | // will now burn 3% of the transfer |
emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
|
emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
| 11,131 |
37 | // 配置上链文本 购得时段后(包含拍卖和私募),可以设置时段文本每时段文字接受中文30字以内(含标点和空格),多出字符不显示。审核截止时间是,每个时段播出前30分钟 / | function setText(string _text) public {
require(INITIAL_SUPPLY == balances[msg.sender]); // 拥有时段币的人可以设置文本
require(bytes(_text).length > 0 && bytes(_text).length <= 90); // 汉字使用UTF8编码,1个汉字最多占用3个字节,所以最多写90个字节的字
require(now < tvUseStartTime - 30 minutes); // 开播前30分钟不能再设置文本
text = _text... | function setText(string _text) public {
require(INITIAL_SUPPLY == balances[msg.sender]); // 拥有时段币的人可以设置文本
require(bytes(_text).length > 0 && bytes(_text).length <= 90); // 汉字使用UTF8编码,1个汉字最多占用3个字节,所以最多写90个字节的字
require(now < tvUseStartTime - 30 minutes); // 开播前30分钟不能再设置文本
text = _text... | 43,160 |
49 | // Update the total percentage. | totalRoyaltyPercentage += primaryRoyaltySplits[i].royaltyPercentage;
| totalRoyaltyPercentage += primaryRoyaltySplits[i].royaltyPercentage;
| 36,524 |
11 | // Event emitted when point list factory is initialised. | event MisoInitPointListFactory();
| event MisoInitPointListFactory();
| 48,852 |
161 | // 試行回数は有効か? | require( num > 0 && num <= PUBLIC_SALE_MAX_SHOT, "sale: invalid num" );
| require( num > 0 && num <= PUBLIC_SALE_MAX_SHOT, "sale: invalid num" );
| 28,803 |
33 | // Emitted when a module inheriting from the `ModuleBase` is constructed.hub The LensHub contract address used. timestamp The current block timestamp. / | event ModuleBaseConstructed(address indexed hub, uint256 timestamp);
| event ModuleBaseConstructed(address indexed hub, uint256 timestamp);
| 3,720 |
40 | // Lp Whitelist Feature | function setBrnLpAddress(address _brnLp) public onlyOwner {
brnLp = _brnLp;
}
| function setBrnLpAddress(address _brnLp) public onlyOwner {
brnLp = _brnLp;
}
| 22,137 |
1,030 | // Track the conduit key, current owner, new potential owner, and open channels for each deployed conduit. / | struct ConduitProperties {
bytes32 key;
address owner;
address potentialOwner;
address[] channels;
mapping(address => uint256) channelIndexesPlusOne;
}
| struct ConduitProperties {
bytes32 key;
address owner;
address potentialOwner;
address[] channels;
mapping(address => uint256) channelIndexesPlusOne;
}
| 40,604 |
48 | // Returns the T value permit result./ | function permitTValue(bool should, uint256 xValue, uint256 yValue) private pure returns (uint256) {
return should? xValue: yValue;
}
| function permitTValue(bool should, uint256 xValue, uint256 yValue) private pure returns (uint256) {
return should? xValue: yValue;
}
| 16,243 |
7 | // A mapping from NFT ID to the address that owns it. / | mapping (uint256 => address) internal idToOwner;
| mapping (uint256 => address) internal idToOwner;
| 50,579 |
4 | // Allows the governance to set the campaign end timestamp | function setEndTimestamp(uint256 _endTimestamp) external;
| function setEndTimestamp(uint256 _endTimestamp) external;
| 4,345 |
35 | // The default is 3, but you can set this higher. | uint16 requestConfirmations = 3;
| uint16 requestConfirmations = 3;
| 36,882 |
25 | // Update the status for the inbox for a given message hash to`Progressed`. Merkle proof is used to verify status of outbox insource chain. This is an alternative approach to hashlocks.The messsage status for the message hash in the outbox should be either `Declared` or `Progresses`. Either of this status will be verif... | function progressInboxWithProof(
MessageBox storage _messageBox,
Message storage _message,
bytes calldata _rlpParentNodes,
uint8 _messageBoxOffset,
bytes32 _storageRoot,
MessageStatus _outboxMessageStatus
)
external
returns (bytes32 messageHash_)
| function progressInboxWithProof(
MessageBox storage _messageBox,
Message storage _message,
bytes calldata _rlpParentNodes,
uint8 _messageBoxOffset,
bytes32 _storageRoot,
MessageStatus _outboxMessageStatus
)
external
returns (bytes32 messageHash_)
| 34,984 |
29 | // Safe xrune transfer function, just in case if rounding error causes pool to not have enough xrunes. | function safexruneTransfer(address _to, uint256 _amount) internal {
uint256 xruneBal = xrune.balanceOf(address(this));
if (_amount > xruneBal) {
xrune.transfer(_to, xruneBal);
} else {
xrune.transfer(_to, _amount);
}
}
| function safexruneTransfer(address _to, uint256 _amount) internal {
uint256 xruneBal = xrune.balanceOf(address(this));
if (_amount > xruneBal) {
xrune.transfer(_to, xruneBal);
} else {
xrune.transfer(_to, _amount);
}
}
| 31,641 |
53 | // yfilend token contract address | address public tokenAddress;
| address public tokenAddress;
| 12,202 |
10 | // 2 random numbers | 2
);
| 2
);
| 79,913 |
5 | // Minter filter address this minter interacts with | address public immutable minterFilterAddress;
| address public immutable minterFilterAddress;
| 43,045 |
11 | // Account address is the safe address. | function _getAccountAddress() internal view override returns (address account) {
account = safe();
}
| function _getAccountAddress() internal view override returns (address account) {
account = safe();
}
| 22,333 |
7 | // Create new timelock. | EPANTokenTimelock tlContract = new EPANTokenTimelock(token, _owner, _unlockDate);
address timelock = address(tlContract);
uint _contractBalance = contractBalance_();
require(token.transferFrom(msg.sender, address(this), _tvalue));
uint _value = contractBalance_().sub(_co... | EPANTokenTimelock tlContract = new EPANTokenTimelock(token, _owner, _unlockDate);
address timelock = address(tlContract);
uint _contractBalance = contractBalance_();
require(token.transferFrom(msg.sender, address(this), _tvalue));
uint _value = contractBalance_().sub(_co... | 17,150 |
6 | // only calls from the set router are accepted. | modifier onlyRouter() {
if (msg.sender != address(i_router)) revert InvalidRouter(msg.sender);
_;
}
| modifier onlyRouter() {
if (msg.sender != address(i_router)) revert InvalidRouter(msg.sender);
_;
}
| 953 |
50 | // list of investor | address[] public investorlist;
| address[] public investorlist;
| 51,077 |
13 | // 0 | bool initialized;
| bool initialized;
| 12,348 |
698 | // No need to transfer from msg.sender since is ETH was converted to WETH | if (!(token == WETH && msg.value > 0)) {
IERC20(token).safeTransferFrom(msg.sender, address(this), tokenAmount);
}
| if (!(token == WETH && msg.value > 0)) {
IERC20(token).safeTransferFrom(msg.sender, address(this), tokenAmount);
}
| 70,944 |
13 | // only owner / | modifier onlyOwner()
| modifier onlyOwner()
| 28,279 |
0 | // VRF | event VRFRequestSent(uint256 requestId, uint32 numWords);
event VRFRequestFulfilled(uint256 requestId, uint256[] randomWords);
| event VRFRequestSent(uint256 requestId, uint32 numWords);
event VRFRequestFulfilled(uint256 requestId, uint256[] randomWords);
| 5,988 |
15 | // The event emitted when a factory is approved (whitelisted) or has it's approval removed. | event FactoryApprovalSet(address indexed factory, bool isApproved);
| event FactoryApprovalSet(address indexed factory, bool isApproved);
| 20,651 |
48 | // pays out the players and kills the game./ | function stop() public onlyOwner {
withdraw();
payOut();
destroy();
}
| function stop() public onlyOwner {
withdraw();
payOut();
destroy();
}
| 37,281 |
828 | // Sets Maximum vote threshold required / | function _setMaxVoteThreshold(uint val) internal {
maxVoteThreshold = val;
}
| function _setMaxVoteThreshold(uint val) internal {
maxVoteThreshold = val;
}
| 28,900 |
108 | // do not execute main function if `userTerm` is not the same with `_currentTerm`. | if (accountInfo.userTerm < _currentTerm) {
return;
}
| if (accountInfo.userTerm < _currentTerm) {
return;
}
| 23,739 |
12 | // Connector Details. / | function connectorID() public pure returns(uint model, uint id) {
(model, id) = (1, 30);
}
| function connectorID() public pure returns(uint model, uint id) {
(model, id) = (1, 30);
}
| 25,292 |
24 | // The daily amount of ETH in the ETH pool | uint256 public m_nTotalEthStaked = 0;
| uint256 public m_nTotalEthStaked = 0;
| 41,111 |
92 | // This will suffice for checking _exists(nextTokenId), | if (nextTokenId != _currentIndex+1) {
nextSlot.addr = from;
nextSlot.quantity = qtyLeft;
}
| if (nextTokenId != _currentIndex+1) {
nextSlot.addr = from;
nextSlot.quantity = qtyLeft;
}
| 39,732 |
3 | // taxableThresholds[0] = [3000, 0];taxableThresholds[1] = [5000, 200];taxableThresholds[2] = [6000, 300]; | uint256[] memory result = MyMoon.determineTax(5);
Assert.equal(result[0], uint256(5), "threshold 1 - full amount - does not equal 5");
Assert.equal(result[1], uint256(0), "threshold 1 - tax amount - does not equal 0");
uint256[] memory result2 = MyMoon.determineTax(3500);
A... | uint256[] memory result = MyMoon.determineTax(5);
Assert.equal(result[0], uint256(5), "threshold 1 - full amount - does not equal 5");
Assert.equal(result[1], uint256(0), "threshold 1 - tax amount - does not equal 0");
uint256[] memory result2 = MyMoon.determineTax(3500);
A... | 1,910 |
2 | // Make sure we don't accidentally burn funds. | require(recipient != address(0x0), "INVALID_RECIPIENT");
require(address(this).balance - amount <= address(this).balance, "UNDERFLOW");
recipient.performEthTransfer(amount);
| require(recipient != address(0x0), "INVALID_RECIPIENT");
require(address(this).balance - amount <= address(this).balance, "UNDERFLOW");
recipient.performEthTransfer(amount);
| 34,470 |
346 | // finishPVEBatch same as finishPVE but for multiple warrior ids.NB anyone can call this method, if they willing to pay the gas price / | function finishPVEBatch(uint256[] _warriorIds) external whenNotPaused {
uint256 length = _warriorIds.length;
//check max number of bach finish pve
require(length <= 20);
uint256 blockNumber = block.number;
uint256 index;
//all warrior ids must be unique
requir... | function finishPVEBatch(uint256[] _warriorIds) external whenNotPaused {
uint256 length = _warriorIds.length;
//check max number of bach finish pve
require(length <= 20);
uint256 blockNumber = block.number;
uint256 index;
//all warrior ids must be unique
requir... | 40,908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.