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 |
|---|---|---|---|---|
322 | // Get the (soon to be) popped strategy. | Strategy poppedStrategy = withdrawalStack[withdrawalStack.length - 1];
| Strategy poppedStrategy = withdrawalStack[withdrawalStack.length - 1];
| 40,340 |
4 | // Owned Basic contract to define an owner. Julien Niset - <julien@argent.xyz> / | contract Owned {
// The owner
address public owner;
event OwnerChanged(address indexed _newOwner);
/**
* @dev Throws if the sender is not the owner.
*/
modifier onlyOwner {
require(msg.sender == owner, "O: Must be owner");
_;
}
constructor() public {
own... | contract Owned {
// The owner
address public owner;
event OwnerChanged(address indexed _newOwner);
/**
* @dev Throws if the sender is not the owner.
*/
modifier onlyOwner {
require(msg.sender == owner, "O: Must be owner");
_;
}
constructor() public {
own... | 4,911 |
159 | // Переходим ко второй стадии Если повторно вызвать финализатор, то еще раз токены не создадутся, условие внутри | mintTokensForSecondStage();
isFirstStageFinalized = true;
| mintTokensForSecondStage();
isFirstStageFinalized = true;
| 36,241 |
26 | // Returns the downcasted uint72 from uint256, reverting onoverflow (when the input is greater than largest uint72). Counterpart to Solidity's `uint72` operator. Requirements: - input must fit into 72 bits / | function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
| function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
| 37,574 |
5 | // Each of the variables below is saved in the mapping apiUintVars for each api requeste.g. requestDetails[_requestId].apiUintVars[keccak256("totalTip")]These are the variables saved in this mapping: uint keccak256("granularity"); multiplier for miners uint keccak256("requestQPosition"); index in requestQ uint keccak25... | mapping(uint => uint) minedBlockNum;//[apiId][minedTimestamp]=>block.number
mapping(uint => uint) finalValues;//This the time series of finalValues stored by the contract where uint UNIX timestamp is mapped to value
mapping(uint => bool) inDispute;//checks if API id is in dispute or finalized.
... | mapping(uint => uint) minedBlockNum;//[apiId][minedTimestamp]=>block.number
mapping(uint => uint) finalValues;//This the time series of finalValues stored by the contract where uint UNIX timestamp is mapped to value
mapping(uint => bool) inDispute;//checks if API id is in dispute or finalized.
... | 20,383 |
5 | // Struct for depositing and withdrawing from the BAKC (Pair) pool | struct PairNftWithAmount {
uint256 mainTokenId;
uint256 bakcTokenId;
uint256 amount;
}
| struct PairNftWithAmount {
uint256 mainTokenId;
uint256 bakcTokenId;
uint256 amount;
}
| 11,483 |
155 | // this function is called by the treasury, and informs sEXO of changes to debt. note that addresses with debt balances cannot transfer collateralized sEXO until the debt has been repaid. | function changeDebt(
uint256 amount,
address debtor,
bool add
| function changeDebt(
uint256 amount,
address debtor,
bool add
| 24,112 |
0 | // IAsset Supertype. Any token that interacts with our system must be wrapped in an asset,whether it is used as RToken backing or not. Any token that can report a price in the UoAis eligible to be an asset. / | interface IAsset {
/// @return {UoA/tok} Our best guess at the market price of 1 whole token in the UoA
function price() external view returns (uint192);
/// @return {tok} The balance of the ERC20 in whole tokens
function bal(address account) external view returns (uint192);
/// @return The ERC20 ... | interface IAsset {
/// @return {UoA/tok} Our best guess at the market price of 1 whole token in the UoA
function price() external view returns (uint192);
/// @return {tok} The balance of the ERC20 in whole tokens
function bal(address account) external view returns (uint192);
/// @return The ERC20 ... | 51,442 |
40 | // Returns the current nonce for `owner`. This value must beincluded whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. Thisprevents a signature from being used multiple times. / | function nonces(address owner) external view returns (uint256);
| function nonces(address owner) external view returns (uint256);
| 551 |
4 | // Mapping from token ID => the max number of NFTs of the token ID a wallet can claim. | mapping(uint256 => uint256) maxWalletClaimCount;
| mapping(uint256 => uint256) maxWalletClaimCount;
| 14,793 |
95 | // Only allowed to be executed after endPhase | require(!icoOnSale);
| require(!icoOnSale);
| 24,579 |
29 | // Full ticket id; Jackpot | ids[0] = (_numbers[0] << 30) + (_numbers[1] << 24) + (_numbers[2] << 18) + (_numbers[3] << 12) + (_numbers[4] << 6) + _numbers[5];
| ids[0] = (_numbers[0] << 30) + (_numbers[1] << 24) + (_numbers[2] << 18) + (_numbers[3] << 12) + (_numbers[4] << 6) + _numbers[5];
| 49,143 |
24 | // Emits a {TxWindowChanged} event indicating the updated txWindow.Requirements: - the caller must have the ``OWNER_ROLE``. / | function setTxWindow(uint256 _newTxWindow) public onlyRole(OWNER_ROLE) returns (bool) {
txWindow = _newTxWindow;
emit TxWindowChanged(_newTxWindow);
return true;
}
| function setTxWindow(uint256 _newTxWindow) public onlyRole(OWNER_ROLE) returns (bool) {
txWindow = _newTxWindow;
emit TxWindowChanged(_newTxWindow);
return true;
}
| 10,664 |
6 | // Mint/burn can be only called by minter contract | modifier onlyMinter {
require(
msg.sender == minter,
"Only minter can call this function."
);
_;
}
| modifier onlyMinter {
require(
msg.sender == minter,
"Only minter can call this function."
);
_;
}
| 44,212 |
5 | // Check if an account is blacklist admin member | function isBlacklistAdmin(address account) public view returns (bool) {
return _blacklistAdmins.has(account);
}
| function isBlacklistAdmin(address account) public view returns (bool) {
return _blacklistAdmins.has(account);
}
| 49,906 |
3 | // Mochi waits until the stability fees hit 1% and then starts calculating debt after that./E.g. If the stability fees are 10% for a year/Mochi will wait 36.5 days (the time period required for the pre-minted 1%) |
mapping(uint256 => Detail) public override details;
mapping(uint256 => uint256) public lastDeposit;
|
mapping(uint256 => Detail) public override details;
mapping(uint256 => uint256) public lastDeposit;
| 47,407 |
1 | // // Minting Rewards /// | {
uint256 reward = getPrice(index) * 400;
reward = (reward * (MAX_MINTABLE - index));
reward = reward / 1000 / MAX_MINTABLE;
return reward;
}
| {
uint256 reward = getPrice(index) * 400;
reward = (reward * (MAX_MINTABLE - index));
reward = reward / 1000 / MAX_MINTABLE;
return reward;
}
| 10,335 |
156 | // ========== ADDRESS RESOLVER CONFIGURATION ========== / | {}
/* ========== VIEWS ========== */
function dtrade() internal view returns (IdTrade) {
return
IdTrade(
requireAndGetAddress(CONTRACT_DTRADE, "Missing dTrade address")
);
}
| {}
/* ========== VIEWS ========== */
function dtrade() internal view returns (IdTrade) {
return
IdTrade(
requireAndGetAddress(CONTRACT_DTRADE, "Missing dTrade address")
);
}
| 9,641 |
45 | // Get the options contract's address based on the passed parameters optionTerms is the terms of the option contract / | function getOptionsAddress(
| function getOptionsAddress(
| 19,470 |
9 | // Event emitted when transfer KSM from relay chain to parachain called | event TransferToParachain (
bytes32 from,
address to,
uint256 amount
);
| event TransferToParachain (
bytes32 from,
address to,
uint256 amount
);
| 45,271 |
7 | // end of inline reentrancy guard | function outboundTransfer(
address _l1Token,
address _to,
uint256 _amount,
uint256 _maxGas,
uint256 _gasPriceBid,
bytes calldata _data
| function outboundTransfer(
address _l1Token,
address _to,
uint256 _amount,
uint256 _maxGas,
uint256 _gasPriceBid,
bytes calldata _data
| 33,006 |
24 | // Set token uri prefix for tokens with no extension / | function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(this)] = prefix;
}
| function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(this)] = prefix;
}
| 19,122 |
27 | // Destroys `amount` tokens tokens from `msg.sender`, reducing the total supply. Requirements - `msg.sender` must have at least `amount` tokens./ | function burn(uint256 amount) external override returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| function burn(uint256 amount) external override returns (bool) {
_burn(_msgSender(), amount);
return true;
}
| 2,226 |
185 | // This implements an optional extension of {ERC721} defined in the EIP that adds Mapping from owner to list of owned token IDs | mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
| mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
| 2,332 |
241 | // Calculates initial values for Merkle Tree Insert leaves into the current merkle treeNote: this function INTENTIONALLY causes side effects to save on gas._leafHashes and _count should never be reused. _leafHashes - array of leaf hashes to be added to the merkle tree / | function insertLeaves(uint256[] memory _leafHashes) internal {
/*
Loop through leafHashes at each level, if the leaf is on the left (index is even)
then hash with zeros value and update subtree on this level, if the leaf is on the
right (index is odd) then hash with subtree value. After calculating ea... | function insertLeaves(uint256[] memory _leafHashes) internal {
/*
Loop through leafHashes at each level, if the leaf is on the left (index is even)
then hash with zeros value and update subtree on this level, if the leaf is on the
right (index is odd) then hash with subtree value. After calculating ea... | 21,303 |
48 | // start time of this tier should be greater than previous tier | require(_startTimes[i] > _endTimes[i-1]);
phases.push(PhaseInfo({
cummulativeHardCap:_cummulativeHardCaps[i],
startTime:_startTimes[i],
endTime:_endTimes[i],
bonusPercentages:_bonusPercentages[i],
weiRai... | require(_startTimes[i] > _endTimes[i-1]);
phases.push(PhaseInfo({
cummulativeHardCap:_cummulativeHardCaps[i],
startTime:_startTimes[i],
endTime:_endTimes[i],
bonusPercentages:_bonusPercentages[i],
weiRai... | 40,354 |
328 | // Freeze `_id` role_id ID of the role to be frozen/ | function freeze(bytes32 _id) external onlyConfigGovernor {
_freeze(_id);
}
| function freeze(bytes32 _id) external onlyConfigGovernor {
_freeze(_id);
}
| 19,554 |
27 | // if a place for a dragon is found | if (_coolness > leaderboard[i].coolness && !_isIndex) {
_index = i;
_isIndex = true;
}
| if (_coolness > leaderboard[i].coolness && !_isIndex) {
_index = i;
_isIndex = true;
}
| 15,908 |
68 | // fixed window oracle that recomputes the average price for the entire period once every period note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period | contract OracleTWAP {
using SafeMath for uint;
using FixedPoint for *;
IUniswapV2Pair immutable pairRamWeth;
IUniswapV2Pair immutable pairUsdtWeth;
address public immutable token0;
address public immutable token1;
address private immutable token0USDT;
address private immutable token1USD... | contract OracleTWAP {
using SafeMath for uint;
using FixedPoint for *;
IUniswapV2Pair immutable pairRamWeth;
IUniswapV2Pair immutable pairUsdtWeth;
address public immutable token0;
address public immutable token1;
address private immutable token0USDT;
address private immutable token1USD... | 37,856 |
172 | // withdraw ether to nami multisignature wallet, only escrow can call/_amount value ether in wei to withdraw | function withdrawEther(uint _amount) public
onlyEscrow
| function withdrawEther(uint _amount) public
onlyEscrow
| 12,483 |
169 | // Given a utxo position and a unique ID, returns an exit priority. _exitId Unique exit identifier. _utxoPos Position of the exit in the blockchain.return An exit priority.Anatomy of returned value, most significant bits first42 bits - timestamp (exitable_at); unix timestamp fits into 32 bits54 bits - blknum10^9 + txin... | function getStandardExitPriority(uint192 _exitId, uint256 _utxoPos)
public
view
returns (uint256)
| function getStandardExitPriority(uint192 _exitId, uint256 _utxoPos)
public
view
returns (uint256)
| 26,777 |
3 | // events when votes are casted | event VoteCasted(string indexed _choice);
| event VoteCasted(string indexed _choice);
| 42,522 |
37 | // Checks whether primary sale recipient can be set in the given execution context. | function _canSetPrimarySaleRecipient() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| function _canSetPrimarySaleRecipient() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| 15,732 |
33 | // Processes the message coming from the bridge DEPOSIT/RECOVERFUNDS messages are the only messages that can be sent to the portfolio sub for the momentEven when the contract is paused, this method is allowed for the messages thatare in flight to complete properly.CAUTION: if Paused for upgrade, wait to make sure no me... | function processXFerPayload(
address _trader,
bytes32 _symbol,
uint256 _quantity,
Tx _transaction
| function processXFerPayload(
address _trader,
bytes32 _symbol,
uint256 _quantity,
Tx _transaction
| 34,326 |
18 | // The platform provider payment address for all primary sales revenues/ (packed) | address payable public platformProviderPrimarySalesAddress;
| address payable public platformProviderPrimarySalesAddress;
| 33,077 |
8 | // Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to. / | function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 8,414 |
33 | // Storage for Governor Delegate For future upgrades, do not change GovernorStorage. Create a newcontract which implements GovernorStorage and following the naming conventionGovernor DelegateStorageVX. / | contract GovernorStorage {
/// @notice Administrator for this contract
address public admin;
/// @notice Pending administrator for this contract
address public pendingAdmin;
/// @notice Active brains of Governor
address public implementation;
/// @notice The delay before voting on a propo... | contract GovernorStorage {
/// @notice Administrator for this contract
address public admin;
/// @notice Pending administrator for this contract
address public pendingAdmin;
/// @notice Active brains of Governor
address public implementation;
/// @notice The delay before voting on a propo... | 34,923 |
103 | // Substract withdrawing amount from investor's balance | _burn(investor, tokenAmount);
uint256 depositUSDTAmount = investorDepositUSDTAmount[investor];
| _burn(investor, tokenAmount);
uint256 depositUSDTAmount = investorDepositUSDTAmount[investor];
| 41,058 |
213 | // User redeems bTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of bTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) r... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | 39,556 |
107 | // enough DAI | if (_usdcPercent <= contractionPercent[2]) {
| if (_usdcPercent <= contractionPercent[2]) {
| 16,284 |
173 | // if(revealed == false) { return notRevealedUri; } |
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
|
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
| 55,826 |
18 | // Allows an on-chain or off-chain user to simulate/ the effects of their mint at the current block, given/ current on-chain conditions. | function previewMint(uint256 shares) external view virtual returns(uint256 assets);
| function previewMint(uint256 shares) external view virtual returns(uint256 assets);
| 7,105 |
8 | // A method to mock the downgrade call determining the amount of source tokens received from a downgrade/ as well as the amount of destination tokens that are left over as remainder/destinationAmount The amount of destination tokens that will be downgraded/ return sourceAmount A uint256 representing the amount of sourc... | function computeDowngrade(uint256 destinationAmount) external view
returns (uint256 sourceAmount, uint256 destinationRemainder);
| function computeDowngrade(uint256 destinationAmount) external view
returns (uint256 sourceAmount, uint256 destinationRemainder);
| 14,907 |
78 | // Executor(proposals[id].executor).execute(id, _for, _against, _quorum); | (bool success,) = address(vote).call(proposals[id].rebasetarget);
require(success);
| (bool success,) = address(vote).call(proposals[id].rebasetarget);
require(success);
| 14,289 |
81 | // Calls the Oraclize Query to initiate MCR calculation./time Time (in milliseconds) after which the next MCR calculation should be initiated | function mcrOraclise(uint time) external onlyInternal {
bytes32 myid = _oraclizeQuery();
_saveApiDetails(myid, "MCR", 0);
}
| function mcrOraclise(uint time) external onlyInternal {
bytes32 myid = _oraclizeQuery();
_saveApiDetails(myid, "MCR", 0);
}
| 12,745 |
52 | // fillResults values will be 0 by default if call was unsuccessful | return fillResults;
| return fillResults;
| 35,885 |
59 | // Returns hash to be signed by owners./to Destination address./value Ether value./data Data payload./operation Operation type./safeTxGas Fas that should be used for the safe transaction./baseGas Gas costs for data used to trigger the safe transaction./gasPrice Maximum gas price that should be used for this transaction... | function getTransactionHash(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
| function getTransactionHash(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
| 7,682 |
6 | // @inheritdoc IERC721 | function transferFrom(
address sender,
address recipient,
uint256 domainId
| function transferFrom(
address sender,
address recipient,
uint256 domainId
| 40,846 |
190 | // calculate hatching switch | bool hatching = (
box.hatching > 0 &&
uint256(index).mod(box.hatching) == 0
);
| bool hatching = (
box.hatching > 0 &&
uint256(index).mod(box.hatching) == 0
);
| 23,818 |
15 | // dragons enter the game directly | if (oldest == 0 || oldest == noKing)
oldest = nid;
for (uint8 i = 0; i < amount; i++) {
addCharacter(nid + i, nchars + i);
characters[nid + i] = Character(characterType, values[characterType], msg.sender, uint64(now));
}
| if (oldest == 0 || oldest == noKing)
oldest = nid;
for (uint8 i = 0; i < amount; i++) {
addCharacter(nid + i, nchars + i);
characters[nid + i] = Character(characterType, values[characterType], msg.sender, uint64(now));
}
| 3,251 |
69 | // Address for the ERC721 contract | address tokenContract;
| address tokenContract;
| 30,393 |
3 | // 0x780e9d63 ===bytes4(keccak256('totalSupply()')) ^bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^bytes4(keccak256('tokenByIndex(uint256)')) / |
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
|
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
| 3,207 |
15 | // robotsubjectattributes[totalRobots] =RobotSubjectAtribute(totalRobots,_mm,_pf,_st,_cp);robotgeneralattributes[totalRobots] =RobotGeneralAtribute(totalRobots,_prc,_type);robotobjectiveattributes[totalRobots] =RobotObjectiveAtribute(totalRobots,_pc,_pt); | robotowners[totalRobots]=msg.sender;
subjectivedata[totalRobots]=_sub;
objectivedata[totalRobots]=_obj;
roboratings[totalRobots]=RoboRating(totalRobots,0,_pscore);
| robotowners[totalRobots]=msg.sender;
subjectivedata[totalRobots]=_sub;
objectivedata[totalRobots]=_obj;
roboratings[totalRobots]=RoboRating(totalRobots,0,_pscore);
| 43,634 |
10 | // Sets the underlying implementation that fulfills the swap orders. Can only be called by the contract owner. _implementation The new implementation. / | function setImplementation(IPricer _implementation) external onlyOwner {
IPricer oldImplementation = implementation;
implementation = _implementation;
emit ImplementationChanged(oldImplementation, _implementation);
}
| function setImplementation(IPricer _implementation) external onlyOwner {
IPricer oldImplementation = implementation;
implementation = _implementation;
emit ImplementationChanged(oldImplementation, _implementation);
}
| 30,734 |
107 | // getter | function hasStarted() public view returns(bool){
return now > openingTime;
}
| function hasStarted() public view returns(bool){
return now > openingTime;
}
| 30,993 |
75 | // This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`./ | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, a... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, a... | 16,164 |
450 | // Lockup duration for a remove delegator request.The remove delegator speed bump is to prevent a service provider from maliciouslyremoving a delegator prior to the evaluation of a proposal. Must be greater than governance votingPeriod + executionDelay / | uint256 private removeDelegatorLockupDuration;
| uint256 private removeDelegatorLockupDuration;
| 38,520 |
13 | // When indicating to freeze, we need to know the rate to freeze it at - either upper or lower this is useful in situations where ExchangeRates is updated and there are existing inverted rates already frozen in the current contract that need persisting across the upgrade |
inverse.frozenAtUpperLimit = freezeAtUpperLimit;
inverse.frozenAtLowerLimit = freezeAtLowerLimit;
emit InversePriceFrozen(currencyKey, freezeAtUpperLimit ? upperLimit : lowerLimit, msg.sender);
|
inverse.frozenAtUpperLimit = freezeAtUpperLimit;
inverse.frozenAtLowerLimit = freezeAtLowerLimit;
emit InversePriceFrozen(currencyKey, freezeAtUpperLimit ? upperLimit : lowerLimit, msg.sender);
| 26,152 |
185 | // See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `ADMIN_ROLE`. / | function pause() external virtual {
require(hasRole(ADMIN_ROLE, _msgSender()), "ThroneERC20: must have admin role to pause");
_pause();
}
| function pause() external virtual {
require(hasRole(ADMIN_ROLE, _msgSender()), "ThroneERC20: must have admin role to pause");
_pause();
}
| 44,766 |
107 | // the information of the stake contract | mapping(address => LibTokenStake1.StakeInfo) public stakeInfos;
| mapping(address => LibTokenStake1.StakeInfo) public stakeInfos;
| 633 |
914 | // ===== called by user/ deposit locks user's NFT in this contract and send message to mint on dest chain _nft address of source NFT contract _id nft token ID to bridge _dstChid dest chain ID _receiver receiver address on dest chain _dstNft dest chain NFT address _dstBridge dest chain NFTBridge address, so we know what... | function deposit(
address _nft,
uint256 _id,
uint64 _dstChid,
address _receiver,
address _dstNft,
address _dstBridge
| function deposit(
address _nft,
uint256 _id,
uint64 _dstChid,
address _receiver,
address _dstNft,
address _dstBridge
| 5,424 |
310 | // Mint debt token and finalize debt agreement | issueDebtAgreement(creditor, debtOrder.issuance);
| issueDebtAgreement(creditor, debtOrder.issuance);
| 26,729 |
8 | // Transfer the requested amount of tokens | token.safeTransfer(receiver, amount);
| token.safeTransfer(receiver, amount);
| 6,503 |
45 | // Use 1 super privilege to permanently own a company | function permanentlyOwnMyCompany(bytes32 nameFromUser) public {
bytes32 nameLowercase = utils.lowerCase(nameFromUser);
Company storage c = companies[nameLowercase];
require(superPrivilegeCount[msg.sender] > 0);
require(c.owner != address(0));
require(c.owner == msg.sender);
... | function permanentlyOwnMyCompany(bytes32 nameFromUser) public {
bytes32 nameLowercase = utils.lowerCase(nameFromUser);
Company storage c = companies[nameLowercase];
require(superPrivilegeCount[msg.sender] > 0);
require(c.owner != address(0));
require(c.owner == msg.sender);
... | 12,685 |
9 | // Used by the recipient to withdraw tokens | function withdraw()
external
override
onlyIfRecipientHasRemainingTokens(msg.sender)
| function withdraw()
external
override
onlyIfRecipientHasRemainingTokens(msg.sender)
| 29,777 |
41 | // vault contract escrows ether and facilitates refunds given unsuccesful crowdsale | RefundVault public refundVault;
| RefundVault public refundVault;
| 14,565 |
7 | // Sell some amount of complete sets for a market _market The market to sell complete sets in _amount The number of complete sets to sellreturn (uint256 _creatorFee, uint256 _reportingFee) The fees taken for the market creator and reporting respectively / | function publicSellCompleteSets(address _market, uint256 _amount) external returns (uint256 _creatorFee, uint256 _reportingFee) {
(uint256 _payout, uint256 _creatorFee, uint256 _reportingFee) = burnCompleteSets(_market, msg.sender, _amount, msg.sender);
require(cash.transfer(msg.sender, _payout));
... | function publicSellCompleteSets(address _market, uint256 _amount) external returns (uint256 _creatorFee, uint256 _reportingFee) {
(uint256 _payout, uint256 _creatorFee, uint256 _reportingFee) = burnCompleteSets(_market, msg.sender, _amount, msg.sender);
require(cash.transfer(msg.sender, _payout));
... | 16,287 |
11 | // percentage of total tokens being sold in this sale | uint8 percentBeingSold;
| uint8 percentBeingSold;
| 1,110 |
44 | // Called when swap boxes | event SwapBoxes(
address _msg_sender,
address[] _box_contracts,
uint256[] _swap_boxes,
address[] _self_contracts,
uint256[] _self_boxes
);
| event SwapBoxes(
address _msg_sender,
address[] _box_contracts,
uint256[] _swap_boxes,
address[] _self_contracts,
uint256[] _self_boxes
);
| 18,253 |
8 | // Check maker ask and taker bid orders | _validateOrder(makerAsk, takerBid);
| _validateOrder(makerAsk, takerBid);
| 40,517 |
172 | // ============================= Governance ==================================== |
function setCore(address newCore) external;
function addGovernor(address _governor) external;
function removeGovernor(address _governor) external;
function setGuardian(address newGuardian, address oldGuardian) external;
function revokeGuardian(address oldGuardian) external;
|
function setCore(address newCore) external;
function addGovernor(address _governor) external;
function removeGovernor(address _governor) external;
function setGuardian(address newGuardian, address oldGuardian) external;
function revokeGuardian(address oldGuardian) external;
| 53,336 |
144 | // Function to claim NFTs and withdraw tokens staked for that NFTs tokenId is representing token class for which user has performed stake / | function claimNFTs(
uint tokenId,
uint startIndex,
uint endIndex
)
public
| function claimNFTs(
uint tokenId,
uint startIndex,
uint endIndex
)
public
| 75,615 |
30 | // site | if (_sit > 0) {
players_[offerInfo.siteOwner].balance = _sit.add(players_[offerInfo.siteOwner].balance);
players_[offerInfo.siteOwner].siteEarned = _sit.add(players_[offerInfo.siteOwner].siteEarned);
_leftAmount = _leftAmount.sub(_sit);
}
| if (_sit > 0) {
players_[offerInfo.siteOwner].balance = _sit.add(players_[offerInfo.siteOwner].balance);
players_[offerInfo.siteOwner].siteEarned = _sit.add(players_[offerInfo.siteOwner].siteEarned);
_leftAmount = _leftAmount.sub(_sit);
}
| 2,618 |
311 | // See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable, ERC721, ERC721Enumerable) returns (bool) {
return super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable, ERC721, ERC721Enumerable) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 73,530 |
3 | // See {_canSetPlatformFeeInfo}. Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}. _platformFeeRecipient Address to be set as new platformFeeRecipient._platformFeeBps Updated platformFeeBps. / | function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {
if (!_canSetPlatformFeeInfo()) {
revert("Not authorized");
}
| function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {
if (!_canSetPlatformFeeInfo()) {
revert("Not authorized");
}
| 9,383 |
8 | // Updates the weight of an existing identifier_id the identifier_weight the new weight to be assignedReturns true if the weight is updated, false if the identifier doesn't exist. / | function update(Tree storage tree, uint _id, uint _weight) internal returns (bool) {
uint node = tree.nodeMap[_id];
if (node == 0) {
return false;
}
uint oldWeight = tree.nodes[node].weight;
tree.nodes[node].weight = _weight;
tree.nodes[node].weightSum += _weight;
tree.nodes[node].weightSu... | function update(Tree storage tree, uint _id, uint _weight) internal returns (bool) {
uint node = tree.nodeMap[_id];
if (node == 0) {
return false;
}
uint oldWeight = tree.nodes[node].weight;
tree.nodes[node].weight = _weight;
tree.nodes[node].weightSum += _weight;
tree.nodes[node].weightSu... | 11,042 |
16 | // ? Check user balance of nfts from queried collection? If not yet reached limit of 4, apply 10% per nft up to the limit of 4 | uint256 ownedNfts = ICFContainer(collection).balanceOf(buyer);
if (ownedNfts < 4) {
| uint256 ownedNfts = ICFContainer(collection).balanceOf(buyer);
if (ownedNfts < 4) {
| 6,287 |
35 | // Access modifier, which restricts functions to only the "finance" role / | modifier onlyFinance() {
checkRole(msg.sender, ROLE_FINANCE);
_;
}
| modifier onlyFinance() {
checkRole(msg.sender, ROLE_FINANCE);
_;
}
| 15,689 |
22 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Require... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| 683 |
58 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0)... | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0)... | 43,587 |
2 | // Insufficient time remaining for loan / | error InsufficientTimeRemaining();
| error InsufficientTimeRemaining();
| 9,916 |
3 | // The ordered list of function signatures to be called | string[] signatures;
| string[] signatures;
| 8,793 |
33 | // check if its been over a day since the last lucky draw happened | if (now.sub(lastLuckyDrawTime) >= luckyDrawDuration && luckyDrawEnabled == true){
| if (now.sub(lastLuckyDrawTime) >= luckyDrawDuration && luckyDrawEnabled == true){
| 11,354 |
43 | // Alternative user registration with certain referrer. referrerAddress Address of user referrer. / | function start(address referrerAddress) external payable{
register(msg.sender, referrerAddress);
}
| function start(address referrerAddress) external payable{
register(msg.sender, referrerAddress);
}
| 3,377 |
4 | // Compound-style [Comp, Cream, Rari, Scream] Multiplied by 1e18 | function exchangeRateStored() external view returns (uint256);
| function exchangeRateStored() external view returns (uint256);
| 25,808 |
440 | // Approves particular token for swap contract/token ERC20 token for allowance/swapContract Swap contract address | function approveToken(address token, address swapContract) external;
| function approveToken(address token, address swapContract) external;
| 34,528 |
5 | // Get underlying token prices | uint256 p0 = token0 == WETH_ADDRESS ? 1e18 : BasePriceOracle(msg.sender).price(token0);
require(p0 > 0, "Failed to retrieve price for G-UNI underlying token0.");
uint256 p1 = token1 == WETH_ADDRESS ? 1e18 : BasePriceOracle(msg.sender).price(token1);
require(p1 > 0, "Failed to retrieve pr... | uint256 p0 = token0 == WETH_ADDRESS ? 1e18 : BasePriceOracle(msg.sender).price(token0);
require(p0 > 0, "Failed to retrieve price for G-UNI underlying token0.");
uint256 p1 = token1 == WETH_ADDRESS ? 1e18 : BasePriceOracle(msg.sender).price(token1);
require(p1 > 0, "Failed to retrieve pr... | 66,742 |
2 | // The storageFee in wei to charge per kilobyte of data store in the cloud./ | uint256 public weiPerKb;
| uint256 public weiPerKb;
| 31,742 |
26 | // Starting values for the Position being liquidated. If withdrawal request amount is > position's collateral, then set this to 0, otherwise set it to (startCollateral - withdrawal request amount). | FixedPoint.Unsigned memory startCollateral = _getFeeAdjustedCollateral(positionToLiquidate.rawCollateral);
FixedPoint.Unsigned memory startCollateralNetOfWithdrawal = FixedPoint.fromUnscaledUint(0);
if (positionToLiquidate.withdrawalRequestAmount.isLessThanOrEqual(startCollateral)) {
... | FixedPoint.Unsigned memory startCollateral = _getFeeAdjustedCollateral(positionToLiquidate.rawCollateral);
FixedPoint.Unsigned memory startCollateralNetOfWithdrawal = FixedPoint.fromUnscaledUint(0);
if (positionToLiquidate.withdrawalRequestAmount.isLessThanOrEqual(startCollateral)) {
... | 19,160 |
0 | // Interface to execute purchases in `Seller`s. This executes the final purchase. This can be anything from minting ERC721 tokens to transfering funds, etc. / | abstract contract PurchaseExecuter {
function _executePurchase(address to, uint64 num, uint256 cost, bytes memory data) internal virtual;
}
| abstract contract PurchaseExecuter {
function _executePurchase(address to, uint64 num, uint256 cost, bytes memory data) internal virtual;
}
| 7,776 |
20 | // set the max list number (e.g. 10) _address address to set the parameter _target parameter / | function setMaxList(address _address, uint256 _target)
external
override
onlyOwner
| function setMaxList(address _address, uint256 _target)
external
override
onlyOwner
| 14,930 |
50 | // Pay the thirdParty account | toSend = (thirdPartyCut * _amount) / bid_Decimals;
toDistribute -= toSend;
if(toSend != 0){
emit Payout(toSend, thirdParty, _contributor);
AuctionHouseLogicV1(payable(address(uint160(auctionHouse)))).addFundsFor{value: toSend }(thirdParty, _contributor);
| toSend = (thirdPartyCut * _amount) / bid_Decimals;
toDistribute -= toSend;
if(toSend != 0){
emit Payout(toSend, thirdParty, _contributor);
AuctionHouseLogicV1(payable(address(uint160(auctionHouse)))).addFundsFor{value: toSend }(thirdParty, _contributor);
| 32,236 |
107 | // Any ERC20 | address public tokenTo;
| address public tokenTo;
| 15,421 |
19 | // neighbor up + right | planetTile.neighbors[2].x = _xCoordinate + 1;
planetTile.neighbors[2].y = _yCoordinate - 1;
| planetTile.neighbors[2].x = _xCoordinate + 1;
planetTile.neighbors[2].y = _yCoordinate - 1;
| 11,004 |
89 | // OmnibridgeFeeManager Implements the logic to distribute fees from the Omnibridge mediator contract operations.The fees are distributed in the form of ERC20/ERC677 tokens to the list of reward addresses. / | contract OmnibridgeFeeManager is MediatorOwnableModule {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// This is not a real fee value but a relative value used to calculate the fee percentage.
// 1 ether = 100% of the value.
uint256 internal constant MAX_FEE = 1 ether;
uint256 intern... | contract OmnibridgeFeeManager is MediatorOwnableModule {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// This is not a real fee value but a relative value used to calculate the fee percentage.
// 1 ether = 100% of the value.
uint256 internal constant MAX_FEE = 1 ether;
uint256 intern... | 8,260 |
13 | // Whether the name has been registered | mapping(string => bool) private _nameRegistered;
| mapping(string => bool) private _nameRegistered;
| 41,483 |
0 | // Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually forspecific token ids via {_setTokenRoyalty}. The latter takes precedence over the first./ See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 30,373 |
41 | // The EIP-712 typehash for the delegation struct used by the contract | bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| 24,597 |
23 | // Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling therevert reason or with a default revert error. / | function verifyCallResult(bool success, bytes memory returndata) internal view returns (bytes memory) {
return verifyCallResult(success, returndata, defaultRevert);
}
| function verifyCallResult(bool success, bytes memory returndata) internal view returns (bytes memory) {
return verifyCallResult(success, returndata, defaultRevert);
}
| 32,576 |
3 | // reward rate per trillion FTG | uint256 public rewardRatePer1TFTG = 3170; // PRBMath.mulDiv(10, 10**12, 31536000 * 100); // 10% APY
| uint256 public rewardRatePer1TFTG = 3170; // PRBMath.mulDiv(10, 10**12, 31536000 * 100); // 10% APY
| 37,481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.