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 |
|---|---|---|---|---|
0 | // Adapted from https:github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.sol | bytes20 targetBytes = bytes20(_logic);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
... | bytes20 targetBytes = bytes20(_logic);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
... | 22,036 |
16 | // Inflow: We can receive profits from the protocol, that could make usedAmount to underflow. We set it to zero in that case. | uint256 diff = newBalance.sub(oldBalance);
usedAmount = (diff >= usedAmount) ? 0 : usedAmount.sub(diff);
| uint256 diff = newBalance.sub(oldBalance);
usedAmount = (diff >= usedAmount) ? 0 : usedAmount.sub(diff);
| 23,435 |
8 | // source quantity is rounded up. to avoid dest quantity being too low. | uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
| uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
| 2,437 |
13 | // log when a user expands their map | event ExpandX(address sender);
event ExpandY(address sender);
| event ExpandX(address sender);
event ExpandY(address sender);
| 3,276 |
12 | // Returns a count of valid NFTs tracked by this contract, where each one of them has anassigned and queryable owner not equal to the zero address. / | function totalSupply()
external
view
returns (uint256);
| function totalSupply()
external
view
returns (uint256);
| 25,064 |
13 | // DELEGATECALL WARNING! delegatecall is a dangerous operation type! use with EXTRA CAUTION delegate allows to call another deployed contract and use its functions to update the state of the current calling contract. this can lead to unexpected behaviour on the contract storage, such as: - updating any state variables ... | if (operationType == uint256(OPERATION_4_DELEGATECALL)) {
if (value != 0) revert ERC725X_MsgValueDisallowedInDelegateCall();
return _executeDelegateCall(target, data);
}
| if (operationType == uint256(OPERATION_4_DELEGATECALL)) {
if (value != 0) revert ERC725X_MsgValueDisallowedInDelegateCall();
return _executeDelegateCall(target, data);
}
| 16,451 |
117 | // Emits an {Upgraded} event. / | function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
| function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
| 35,026 |
736 | // Rebalances funds between the pool and the asset manager to maintain target investment percentage. poolId - the poolId of the pool to be rebalanced force - a boolean representing whether a rebalance should be forced even when the pool is near balance / | function rebalance(bytes32 poolId, bool force) external;
| function rebalance(bytes32 poolId, bool force) external;
| 45,167 |
28 | // Sets the 'complete' flag value.completeSet The value to set the 'complete' flag to./ | function set_complete (bool completeSet) public onlyAuthorized {
complete = completeSet;
}
| function set_complete (bool completeSet) public onlyAuthorized {
complete = completeSet;
}
| 48,684 |
61 | // reverts if amount > the contract's balance, so I don't need to check if amount <= contract's balance | IERC20(share_new).safeTransfer(msg.sender, amount);
emit ExchangedShares(msg.sender, amount);
| IERC20(share_new).safeTransfer(msg.sender, amount);
emit ExchangedShares(msg.sender, amount);
| 54,930 |
65 | // Validate ring-mining related arguments. | for (uint i = 0; i < params.ringSize; i++) {
require(params.uintArgsList[i][5] > 0); // "order rateAmountS is zero");
}
| for (uint i = 0; i < params.ringSize; i++) {
require(params.uintArgsList[i][5] > 0); // "order rateAmountS is zero");
}
| 3,910 |
47 | // Function selector for Error(string) | assembly {
_bytes := add(_bytes, 68)
}
| assembly {
_bytes := add(_bytes, 68)
}
| 39,728 |
66 | // Emits {Transfer} event./ Returns boolean value indicating whether operation succeeded./ Requirements:/ - caller account must have at least `value` WERC10 token./ For more information on transferAndCall format, see https:github.com/ethereum/EIPs/issues/677. | function transferAndCall(address to, uint value, bytes calldata data) external override returns (bool) {
require(to != address(0) || to != address(this));
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "WERC10: transfer amount exceeds balance");
balanceO... | function transferAndCall(address to, uint value, bytes calldata data) external override returns (bool) {
require(to != address(0) || to != address(this));
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "WERC10: transfer amount exceeds balance");
balanceO... | 28,462 |
102 | // who The account address./ return The underlying token balance of the account. | function balanceOfUnderlying(address who) external view returns (uint256);
| function balanceOfUnderlying(address who) external view returns (uint256);
| 58,531 |
8 | // fetch the balance | uint balance = stakingBalance[msg.sender];
| uint balance = stakingBalance[msg.sender];
| 35,839 |
90 | // exclude from paying fees or having max transaction amount | excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
| excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
| 3,001 |
84 | // Halve the amount of liquidity tokens | uint256 liquidityTokens = (contractBalance * tokensForLiquidity) / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(th... | uint256 liquidityTokens = (contractBalance * tokensForLiquidity) / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(th... | 329 |
5 | // Allows SkaleManager contract to create an Schain. | * Emits an {SchainCreated} event.
*
* Requirements:
*
* - Schain type is valid.
* - There is sufficient deposit to create type of schain.
* - If from is a smart contract originator must be specified
*/
function addSchain(address from, uint deposit, bytes calldata data) exte... | * Emits an {SchainCreated} event.
*
* Requirements:
*
* - Schain type is valid.
* - There is sufficient deposit to create type of schain.
* - If from is a smart contract originator must be specified
*/
function addSchain(address from, uint deposit, bytes calldata data) exte... | 78,125 |
184 | // The block number when SDEX mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SdexToken _sdex,
... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SdexToken _sdex,
... | 55,767 |
13 | // External //Sets the meta evidence. Can only be called once._metaEvidence The URI of the meta evidence file. / | function setMetaEvidence(string _metaEvidence) external {
require(msg.sender == deployer, "Can only be called once by the deployer of the contract.");
deployer = address(0);
emit MetaEvidence(0, _metaEvidence);
}
| function setMetaEvidence(string _metaEvidence) external {
require(msg.sender == deployer, "Can only be called once by the deployer of the contract.");
deployer = address(0);
emit MetaEvidence(0, _metaEvidence);
}
| 37,899 |
57 | // Enforce the maximum stake time // Ensure newStakedSuns is enough for at least one stake share /// | uint256 newLockedDay = g._currentDay + 1;
| uint256 newLockedDay = g._currentDay + 1;
| 10,719 |
213 | // See {_currentPrice} / | function getCurrentPrice(uint256[4] memory pricesAndTimestamps) external view returns (uint256) {
return _currentPrice(pricesAndTimestamps);
}
| function getCurrentPrice(uint256[4] memory pricesAndTimestamps) external view returns (uint256) {
return _currentPrice(pricesAndTimestamps);
}
| 38,472 |
6 | // Item Metadata Tracker Mapping is: detailsByToken[tokenId][map below] = GM TokenID 0 - weapon 1 - chestArmor 2 - headArmor 3 - waistArmor 4 - footArmor 5 - handArmor 6 - neckArmor 7 - ring 8 - order id 9 - order count | mapping(uint256 => uint256[10]) private _detailsByToken;
string[2][17] private _suffices;
uint8[2][17] private _sufficesCount;
uint32 private _currentTokenId;
mapping(uint256 => bool) public itemUsedByGMID;
address[17] public orderDAOs;
| mapping(uint256 => uint256[10]) private _detailsByToken;
string[2][17] private _suffices;
uint8[2][17] private _sufficesCount;
uint32 private _currentTokenId;
mapping(uint256 => bool) public itemUsedByGMID;
address[17] public orderDAOs;
| 39,053 |
90 | // Set pool_address to saffron pool that created token | pool_address = msg.sender;
| pool_address = msg.sender;
| 21,703 |
31 | // Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. / | event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
| event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
| 1,264 |
216 | // Redeems by allocating an ownership percentage only of requestedAssets to the participant/This works, but with loops, so only up to a certain number of assets (right now the max is 4)/Independent of running price feed! Note: if requestedAssets != ownedAssets then participant misses out on some owned value/shareQuanti... | function emergencyRedeem(uint shareQuantity, address[] requestedAssets)
public
pre_cond(balances[msg.sender] >= shareQuantity) // sender owns enough shares
returns (bool)
| function emergencyRedeem(uint shareQuantity, address[] requestedAssets)
public
pre_cond(balances[msg.sender] >= shareQuantity) // sender owns enough shares
returns (bool)
| 74,015 |
70 | // Get the pre-ICO investor address._index the index of investor in the array. / | function getPreIcoInvestor(uint256 _index) constant public returns (address) {
return investorsPreIco[_index];
}
| function getPreIcoInvestor(uint256 _index) constant public returns (address) {
return investorsPreIco[_index];
}
| 82,048 |
34 | // Set up issuer_issuer The address of the account that will become the new issuer / | function setIssuer(address _issuer) onlyOwner {
issuer = _issuer;
}
| function setIssuer(address _issuer) onlyOwner {
issuer = _issuer;
}
| 34,635 |
123 | // Convert to WETH if any leftover ETH | WrappedEther(WETH_ADDRESS).deposit{value: address(this).balance}();
| WrappedEther(WETH_ADDRESS).deposit{value: address(this).balance}();
| 6,088 |
5 | // poke(bytes32) = 0x1504460f | (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-A")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-B")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-C")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, byte... | (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-A")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-B")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ETH-C")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, byte... | 25,929 |
45 | // Mint a Voxmon Cost is 0.07 ether | function mint(address recipient) payable public returns (uint256) {
require(_isTokenAvailable(), "max live supply reached, to get a new Voxmon you\'ll need to reroll an old one");
require(msg.value >= MINT_COST, "not enough ether, minting costs 0.07 ether");
require(block.timestamp >= starti... | function mint(address recipient) payable public returns (uint256) {
require(_isTokenAvailable(), "max live supply reached, to get a new Voxmon you\'ll need to reroll an old one");
require(msg.value >= MINT_COST, "not enough ether, minting costs 0.07 ether");
require(block.timestamp >= starti... | 17,823 |
53 | // Given that the first `_numFinalized` tokens for trait `_t` have been/ finalized, returns a mask into `featureMembers[_t][_wordIndex]` of/ memberships that are finalized and thus not permitted to be updated.// For instance, if `_numFinalized == 259`, then token indices 0 through 258/ (inclusive) have been finalized, ... | function _finalizedTokensMask(uint32 _numFinalized, uint256 _wordIndex)
internal
pure
returns (uint256)
| function _finalizedTokensMask(uint32 _numFinalized, uint256 _wordIndex)
internal
pure
returns (uint256)
| 27,802 |
286 | // if the bet amount is OVER the oraclize query limit, we must get the randomness from oraclize. This is because miners are inventivized to interfere with the block.blockhash, in an attempt to get more favorable rolls/slot spins/etc. | else {
| else {
| 27,724 |
64 | // Getter Functions | function getStakeHolders(uint256 stakeMapIndex) public view returns(address[]) {
return stakeMap[stakeMapIndex].stakeHolders;
}
| function getStakeHolders(uint256 stakeMapIndex) public view returns(address[]) {
return stakeMap[stakeMapIndex].stakeHolders;
}
| 46,959 |
6 | // some configue keys | bytes32 public constant BUILD_RATIO = "BuildRatio"; // percent, base 10e18
function getUint(bytes32 key) external view returns (uint) {
return mUintConfig[key];
}
| bytes32 public constant BUILD_RATIO = "BuildRatio"; // percent, base 10e18
function getUint(bytes32 key) external view returns (uint) {
return mUintConfig[key];
}
| 11,082 |
0 | // Typical eligibility for the payment of benefits shall not be more restrictive than requiring a deficiency in the ability to perform not more than three of theactivities of daily living. / | enum DAILY_LIVING_ACTIVITY {
BATHING, // (a) “Bathing,” which means washing oneself by sponge bath or in either a tub or shower, including the task of getting into or out of the tub or shower.
CONTINENCE, // (b) “Continence,” which means the ability to maintain control of bowel and bladde... | enum DAILY_LIVING_ACTIVITY {
BATHING, // (a) “Bathing,” which means washing oneself by sponge bath or in either a tub or shower, including the task of getting into or out of the tub or shower.
CONTINENCE, // (b) “Continence,” which means the ability to maintain control of bowel and bladde... | 19,316 |
65 | // One possible code of zero length | left = 1;
for (len = 1; len <= MAXBITS; len += 5) {
| left = 1;
for (len = 1; len <= MAXBITS; len += 5) {
| 5,316 |
28 | // multiply tonne quantity with decimals | quantity = quantity * 10**decimals();
require(
getRemaining() >= quantity,
'Error: Quantity in batch is higher than total vintages'
);
IToucanCarbonOffsetsFactory tco2Factory = IToucanCarbonOffsetsFactory(
IToucanContractRegistry(contractRegistry)
... | quantity = quantity * 10**decimals();
require(
getRemaining() >= quantity,
'Error: Quantity in batch is higher than total vintages'
);
IToucanCarbonOffsetsFactory tco2Factory = IToucanCarbonOffsetsFactory(
IToucanContractRegistry(contractRegistry)
... | 25,186 |
72 | // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive | require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
| require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
| 25,811 |
448 | // Update the position object for the user. | positionData.withdrawalRequestPassTimestamp = getCurrentTime().add(withdrawalLiveness);
positionData.withdrawalRequestAmount = collateralAmount;
emit RequestWithdrawal(msg.sender, collateralAmount.rawValue);
| positionData.withdrawalRequestPassTimestamp = getCurrentTime().add(withdrawalLiveness);
positionData.withdrawalRequestAmount = collateralAmount;
emit RequestWithdrawal(msg.sender, collateralAmount.rawValue);
| 3,823 |
15 | // Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| 7,226 |
4 | // address of greedGang entering schemeId | greedGang.push(payable(msg.sender));
if (greedGang.length == 4){
pickDoublers();
}
| greedGang.push(payable(msg.sender));
if (greedGang.length == 4){
pickDoublers();
}
| 52,839 |
40 | // Get the referrer address that referred the user. / | function getReferrer(address user) external view returns (address);
| function getReferrer(address user) external view returns (address);
| 2,813 |
1 | // Reverts if caller is not the owner. | modifier onlyOwner() {
if (msg.sender != _owner) {
revert("Not authorized");
}
_;
}
| modifier onlyOwner() {
if (msg.sender != _owner) {
revert("Not authorized");
}
_;
}
| 25,045 |
66 | // Check the voting start time | function checkCreateTime() public view returns (uint256) {
return _createTime;
}
| function checkCreateTime() public view returns (uint256) {
return _createTime;
}
| 24,799 |
8 | // Transfer all coins of a certain asset | function transferAllTokensToWallet(address token_) external onlyOwner{
IERC20 token = IERC20(token_);
uint coinPositionAtContractExecution = token.balanceOf(address(this));
token.transfer(owner, coinPositionAtContractExecution);
}
| function transferAllTokensToWallet(address token_) external onlyOwner{
IERC20 token = IERC20(token_);
uint coinPositionAtContractExecution = token.balanceOf(address(this));
token.transfer(owner, coinPositionAtContractExecution);
}
| 31,735 |
517 | // Total Amount of asset that is sent from buyer to Milton when opening swap. | uint256 totalAmount;
| uint256 totalAmount;
| 7,669 |
6 | // Public getter for retrieving protocol with tx type / | function protocols(uint256 _txType) public view returns (uint8) {
return _protocols[_txType];
}
| function protocols(uint256 _txType) public view returns (uint8) {
return _protocols[_txType];
}
| 49,536 |
104 | // Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap | function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(availableMin).div(MAX);
}
| function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(availableMin).div(MAX);
}
| 48,944 |
15 | // Emitted when the pause is lifted by `account`. / | event Unpaused(address account);
bool private _paused;
| event Unpaused(address account);
bool private _paused;
| 2,949 |
7 | // event organiser can withdraw funds from ticket sales | function withdraw() public {
payable(msg.sender).transfer(balances[msg.sender]);
}
| function withdraw() public {
payable(msg.sender).transfer(balances[msg.sender]);
}
| 17,500 |
78 | // Governance =========== keccak256("Governance"); | bytes32 internal constant KEY_GOVERNANCE =
0x9409903de1e6fd852dfc61c9dacb48196c48535b60e25abf92acc92dd689078d;
| bytes32 internal constant KEY_GOVERNANCE =
0x9409903de1e6fd852dfc61c9dacb48196c48535b60e25abf92acc92dd689078d;
| 8,159 |
1 | // PUBLIC FUNCTIONS //Set the time in the contract/ | function setTime(uint256 _time)
public
| function setTime(uint256 _time)
public
| 12,596 |
32 | // module:core The time when a queued proposal becomes executable ("ETA"). Unlike {proposalSnapshot} and{proposalDeadline}, this doesn't use the governor clock, and instead relies on the executor's clock which may bedifferent. In most cases this will be a timestamp. / | function proposalEta(uint256 proposalId) external view returns (uint256);
| function proposalEta(uint256 proposalId) external view returns (uint256);
| 1,469 |
9 | // Transfers `amount` tokens of token type `id` from `from` to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.- `from` must have a balance of tokens of type `id` of at l... | function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
| function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
| 3,062 |
12 | // Adopted from ERC721AUpgradeable to remove name(), symbol(), tokenURI() and supportsInterface() as they'll be provided by independent facets. / | contract ERC721ABase is ERC721ABaseInternal, IERC721ABase {
/**
* @inheritdoc IERC721ABase
*/
function balanceOf(address owner) external view virtual returns (uint256) {
return _balanceOf(owner);
}
/**
* @inheritdoc IERC721ABase
*/
function ownerOf(uint256 tokenId) exter... | contract ERC721ABase is ERC721ABaseInternal, IERC721ABase {
/**
* @inheritdoc IERC721ABase
*/
function balanceOf(address owner) external view virtual returns (uint256) {
return _balanceOf(owner);
}
/**
* @inheritdoc IERC721ABase
*/
function ownerOf(uint256 tokenId) exter... | 10,857 |
156 | // Sends `request` to the WitnetRequestBoard.This method will only succeed if `pending` is 0./ | function requestUpdate() public payable {
require(!pending, "Complete pending request before requesting a new one");
// Send the request to Witnet and store the ID for later retrieval of the result
// The `witnetPostRequest` method comes with `UsingWitnet`
lastRequestId = witnetPostRequest(request);
... | function requestUpdate() public payable {
require(!pending, "Complete pending request before requesting a new one");
// Send the request to Witnet and store the ID for later retrieval of the result
// The `witnetPostRequest` method comes with `UsingWitnet`
lastRequestId = witnetPostRequest(request);
... | 6,884 |
21 | // Sells BOB for one of the collaterals at a fixed rate.BOB token should be pre-approved to the vault contract.Swap will revert, if order cannot be fully filled due to the lack of particular collateral.Swapped amount of collateral will be subject to relevant outFee. _token address of the received collateral token. _amo... | function sell(address _token, uint256 _amount) external returns (uint256) {
Collateral storage token = collateral[_token];
require(token.price > 0, "BobVault: unsupported collateral");
require(token.outFee <= MAX_FEE, "BobVault: collateral withdrawal suspended");
bobToken.transferFr... | function sell(address _token, uint256 _amount) external returns (uint256) {
Collateral storage token = collateral[_token];
require(token.price > 0, "BobVault: unsupported collateral");
require(token.outFee <= MAX_FEE, "BobVault: collateral withdrawal suspended");
bobToken.transferFr... | 5,408 |
122 | // _name = "Invader 16"; _symbol = "INVST"; _decimals = 8;_totalSupply = 1000108; |
_setupContractId("INV16");
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(PREDICATE_ROLE, _msgSender());
_initializeEIP712(_name);
|
_setupContractId("INV16");
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(PREDICATE_ROLE, _msgSender());
_initializeEIP712(_name);
| 20,505 |
22 | // get the address is authorized/did did/addr address to check/ return if address is authorized | function isAddrAuthorized(string memory did, address addr) public view returns (bool) {
bytes32 didHash = keccak256(bytes(did));
return auths[didHash].contains(addr);
}
| function isAddrAuthorized(string memory did, address addr) public view returns (bool) {
bytes32 didHash = keccak256(bytes(did));
return auths[didHash].contains(addr);
}
| 19,016 |
334 | // expmods_and_points.points[45] = -(g^129z). | mstore(add(expmodsAndPoints, 0x8e0), point)
| mstore(add(expmodsAndPoints, 0x8e0), point)
| 29,018 |
1 | // mapping for checking which Nodes and which number of Nodes owned by user | mapping (address => CreatedNodes) public nodeIndexes;
| mapping (address => CreatedNodes) public nodeIndexes;
| 9,954 |
27 | // Set reward per block. Can only be called by the owner. | function setRewardPerBlock(uint256 _rewardPerBlock, bool _withUpdate) external onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
rewardPerBlock = _rewardPerBlock;
emit SetRewardPerBlock(_rewardPerBlock);
}
| function setRewardPerBlock(uint256 _rewardPerBlock, bool _withUpdate) external onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
rewardPerBlock = _rewardPerBlock;
emit SetRewardPerBlock(_rewardPerBlock);
}
| 28,633 |
2 | // emitted after each time token has been moved around / | event Transfer (address indexed from, address indexed to, uint256 value);
| event Transfer (address indexed from, address indexed to, uint256 value);
| 20,886 |
18 | // VAULT OPERATIONS // Withdraws the assets on the vault using the outstanding `DepositReceipt.amount` amount is the amount to withdraw / | function withdrawInstantly(uint256 amount) external nonReentrant {
Vault.DepositReceipt storage depositReceipt =
depositReceipts[msg.sender];
uint256 currentRound = vaultState.round;
require(amount > 0, "!amount");
require(depositReceipt.round == currentRound, "Invalid r... | function withdrawInstantly(uint256 amount) external nonReentrant {
Vault.DepositReceipt storage depositReceipt =
depositReceipts[msg.sender];
uint256 currentRound = vaultState.round;
require(amount > 0, "!amount");
require(depositReceipt.round == currentRound, "Invalid r... | 58,926 |
72 | // contructor_paraswap paraswap main address_paraswapPriceparaswap price feed address_paraswapParams helper contract for convert params from bytes32_bancorRegistryWrapperaddress of Bancor Registry Wrapper_BancorEtherToken address of Bancor ETH wrapper_permitedStable address of permitedStable contract_poolPortal address... | constructor(
address _paraswap,
address _paraswapPrice,
address _paraswapParams,
address _bancorRegistryWrapper,
address _BancorEtherToken,
address _permitedStable,
address _poolPortal,
address _oneInch,
address _cEther,
| constructor(
address _paraswap,
address _paraswapPrice,
address _paraswapParams,
address _bancorRegistryWrapper,
address _BancorEtherToken,
address _permitedStable,
address _poolPortal,
address _oneInch,
address _cEther,
| 14,990 |
50 | // Swap Proxy Address | address private swapProxy;
| address private swapProxy;
| 82,629 |
18 | // Redeem | function computeRedeem(
BassetData[] calldata _bAssets,
uint8 _i,
uint256 _mAssetQuantity,
InvariantConfig memory _config
) external view virtual returns (uint256);
function computeRedeemExact(
BassetData[] calldata _bAssets,
uint8[] calldata _indices,
| function computeRedeem(
BassetData[] calldata _bAssets,
uint8 _i,
uint256 _mAssetQuantity,
InvariantConfig memory _config
) external view virtual returns (uint256);
function computeRedeemExact(
BassetData[] calldata _bAssets,
uint8[] calldata _indices,
| 50,701 |
1 | // event to be emitted on transfer | event Transfer(address indexed _from, address indexed _to, uint256 _value);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
| 30,325 |
163 | // See {IERC721-approve}. / | function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
| function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
| 35,933 |
1 | // Whether market has been initialized or not. | bool private initialised;
| bool private initialised;
| 21,548 |
3 | // is everything okay?block.timestamp is the current date | require(campaign.deadline < block.timestamp, "The deadline should be a date int he Future"); //if the deadline is a past date then show this error
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign... | require(campaign.deadline < block.timestamp, "The deadline should be a date int he Future"); //if the deadline is a past date then show this error
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign... | 22,372 |
2 | // Check if the guard value has its original value | require(_guardValue == 0, "REENTRANCY");
| require(_guardValue == 0, "REENTRANCY");
| 44,810 |
57 | // Post two price sheets for a token and its ntoken simultaneously / Support dual-posts for TOKEN/NTOKEN, (ETH, TOKEN) + (ETH, NTOKEN)/token The address of TOKEN contract/ethNum The numbers of ethers to post sheets/tokenAmountPerEth The price of TOKEN/ntokenAmountPerEth The price of NTOKEN | function post2(
address token,
uint256 ethNum,
uint256 tokenAmountPerEth,
uint256 ntokenAmountPerEth
)
external
payable
noContract
| function post2(
address token,
uint256 ethNum,
uint256 tokenAmountPerEth,
uint256 ntokenAmountPerEth
)
external
payable
noContract
| 26,597 |
12 | // undrafted players, can be picked up through the season | uint[] public undraftedPlayerIds;
| uint[] public undraftedPlayerIds;
| 28,879 |
158 | // Supplies Ether to Compound Unwraps WETH to Ether, then invoke the special mint for cEther We ask to supply "amount", if the "amount" we asked to supply ismore than balance (what we really have), then only supply balance. If we the "amount" we want to supply is less than balance, then only supply that amount./ | function _supplyEtherInWETH(uint256 amountInWETH) internal nonReentrant {
// underlying here is WETH
uint256 balance = underlying.balanceOf(address(this)); // supply at most "balance"
if (amountInWETH < balance) {
balance = amountInWETH; // only supply the "amount" if its less than what we have
... | function _supplyEtherInWETH(uint256 amountInWETH) internal nonReentrant {
// underlying here is WETH
uint256 balance = underlying.balanceOf(address(this)); // supply at most "balance"
if (amountInWETH < balance) {
balance = amountInWETH; // only supply the "amount" if its less than what we have
... | 53,102 |
233 | // Bids | surplusAuctionHouse.increaseBidSize(auctionId, amountToSell, bidSize);
| surplusAuctionHouse.increaseBidSize(auctionId, amountToSell, bidSize);
| 38,795 |
15 | // Current SpaceOperatorRegistry implementation to be used. | ISpaceOperatorRegistry public spaceOperatorRegistry;
| ISpaceOperatorRegistry public spaceOperatorRegistry;
| 29,985 |
1 | // PhotoNFTData public photoNFTData; |
constructor(PhotoNFTData _photoNFTData) public PhotoNFTTradable(_photoNFTData) {
photoNFTData = _photoNFTData;
address payable PHOTO_NFT_MARKETPLACE = payable(address(this));
}
|
constructor(PhotoNFTData _photoNFTData) public PhotoNFTTradable(_photoNFTData) {
photoNFTData = _photoNFTData;
address payable PHOTO_NFT_MARKETPLACE = payable(address(this));
}
| 14,142 |
10 | // Discover flash loan balance after the liquidation | uint256 flashBorrowedAssetAfter = IERC20(borrowedAsset).balanceOf(address(this));
| uint256 flashBorrowedAssetAfter = IERC20(borrowedAsset).balanceOf(address(this));
| 30,538 |
62 | // Check reward + ref + king isn't above remaining troiChest | uint256 _sum = _reward.add(_reward.mul(REFERRAL_PERCENT.add(KING_PERCENT)).div(100));
if(_sum > troiChest){
_reward = troiChest.mul(100).div(REFERRAL_PERCENT.add(KING_PERCENT).add(100));
}
| uint256 _sum = _reward.add(_reward.mul(REFERRAL_PERCENT.add(KING_PERCENT)).div(100));
if(_sum > troiChest){
_reward = troiChest.mul(100).div(REFERRAL_PERCENT.add(KING_PERCENT).add(100));
}
| 27,298 |
31 | // Trading assets on Uniswap V3 and 1Inch V4 DEXs | contract Swap is BaseLogic {
address immutable public uniswapRouter;
address immutable public oneInch;
/// @notice Params for Uniswap V3 exact input trade on a single pool
/// @param subAccountIdIn subaccount id to trade from
/// @param subAccountIdOut subaccount id to trade to
/// @param under... | contract Swap is BaseLogic {
address immutable public uniswapRouter;
address immutable public oneInch;
/// @notice Params for Uniswap V3 exact input trade on a single pool
/// @param subAccountIdIn subaccount id to trade from
/// @param subAccountIdOut subaccount id to trade to
/// @param under... | 36,875 |
0 | // Initializes the manager by initializing its root role and/ granting it to them/Anyone can initialize a manager. An uninitialized manager/ attempting to initialize a role will be initialized automatically./ Once a manager is initialized, subsequent initializations have no/ effect./manager Manager address to be initia... | function initializeManager(address manager) public override {
require(manager != address(0), "Manager address zero");
bytes32 rootRole = deriveRootRole(manager);
if (!hasRole(rootRole, manager)) {
_grantRole(rootRole, manager);
emit InitializedManager(rootRole, manage... | function initializeManager(address manager) public override {
require(manager != address(0), "Manager address zero");
bytes32 rootRole = deriveRootRole(manager);
if (!hasRole(rootRole, manager)) {
_grantRole(rootRole, manager);
emit InitializedManager(rootRole, manage... | 66,248 |
37 | // placeholder values to conform to interface and disclaim mint | (mint, amountOut) = (false, amount);
emit ExtensionCalled(msg.sender, account, amount);
| (mint, amountOut) = (false, amount);
emit ExtensionCalled(msg.sender, account, amount);
| 21,257 |
20 | // Needed for address(this) to be payable in call to returnFunds.The Eth pool overrides this to not throw. / | function () external payable {
revert("this pool cannot receive ether");
}
| function () external payable {
revert("this pool cannot receive ether");
}
| 31,861 |
57 | // be too long), and then calling {toEthSignedMessageHash} on it. / | function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
| function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
| 1,689 |
31 | // Can only approve when value has not already been set or is zero | require(allowed[msg.sender][_spender] == 0 || _value == 0);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| require(allowed[msg.sender][_spender] == 0 || _value == 0);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 8,427 |
8 | // mint new BLKD using excess reserves _recipient address _amount uint256 / | function mint(address _recipient, uint256 _amount) external override {
require(permissions[STATUS.REWARDMANAGER][msg.sender], notApproved);
require(_amount <= excessReserves(), insufficientReserves);
BLKD.mint(_recipient, _amount);
emit Minted(msg.sender, _recipient, _amount);
}
| function mint(address _recipient, uint256 _amount) external override {
require(permissions[STATUS.REWARDMANAGER][msg.sender], notApproved);
require(_amount <= excessReserves(), insufficientReserves);
BLKD.mint(_recipient, _amount);
emit Minted(msg.sender, _recipient, _amount);
}
| 6,216 |
241 | // ETH bet | if (option.dir == OptionType.Call) {
require(latestPrice > option.sPrice, "price is to low");
} else {
| if (option.dir == OptionType.Call) {
require(latestPrice > option.sPrice, "price is to low");
} else {
| 27,196 |
18 | // De-Whitelist TaskSpec(s), Module(s) and withdraw funds from gelato in one tx/ | function multiUnprovide(
| function multiUnprovide(
| 19,028 |
1,597 | // stable = 1, variable = 2 | function swapBorrowRateMode(address _market, address _reserve, uint _rateMode) public {
address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool();
ILendingPoolV2(lendingPool).swapBorrowRateMode(_reserve, _rateMode);
}
| function swapBorrowRateMode(address _market, address _reserve, uint _rateMode) public {
address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool();
ILendingPoolV2(lendingPool).swapBorrowRateMode(_reserve, _rateMode);
}
| 58,165 |
199 | // If an owner transferring, then ignore whitelist restrictions | if(OwnerRole.isOwner(from)) {
return SUCCESS_CODE;
}
| if(OwnerRole.isOwner(from)) {
return SUCCESS_CODE;
}
| 4,358 |
29 | // Add 0.25% to _burnRate | burnRate += 50;
| burnRate += 50;
| 33,193 |
10 | // initialize Vzone_master node data | Vnode[Vzone_master].node_type = 0;
Vnode[Vzone_master].VZoneID = '';
| Vnode[Vzone_master].node_type = 0;
Vnode[Vzone_master].VZoneID = '';
| 29,126 |
244 | // 2. They sent some value > 0 | require(amount > 0, "Deposit must be greater than 0");
| require(amount > 0, "Deposit must be greater than 0");
| 38,852 |
1 | // Storage data | uint256[] public levelTokens; // how many tokens user needs to get the corresponding level of discount
uint16[] public levelPcts; // multiplier for standard discount 1/Y of pool for each level
uint256 public minPoolBalance; // minimum discount pool balance that enables discounts
uin... | uint256[] public levelTokens; // how many tokens user needs to get the corresponding level of discount
uint16[] public levelPcts; // multiplier for standard discount 1/Y of pool for each level
uint256 public minPoolBalance; // minimum discount pool balance that enables discounts
uin... | 31,834 |
145 | // Set new id | stakeDetails.nftId = newNftId;
| stakeDetails.nftId = newNftId;
| 26,710 |
6 | // mapping from addresses and interface hashes to their implementers. | mapping(address => mapping(bytes32 => address)) internal interfaces;
| mapping(address => mapping(bytes32 => address)) internal interfaces;
| 26,542 |
42 | // require(_msgSender() == __admin, "Not authorized"); | require(!_initialILODeployed, "xStarter ILO already deployed");
bool success = _registerILOProposal(proposalAddr_);
require(success, 'Not able to create initial ILO proposal');
| require(!_initialILODeployed, "xStarter ILO already deployed");
bool success = _registerILOProposal(proposalAddr_);
require(success, 'Not able to create initial ILO proposal');
| 1,965 |
90 | // YOU CAN SET HERE THE BUY FEES | uint256 _buyMarketingFee = 3;
uint256 _buyLiquidityFee = 1;
uint256 _buyDevFee = 0;
| uint256 _buyMarketingFee = 3;
uint256 _buyLiquidityFee = 1;
uint256 _buyDevFee = 0;
| 8,824 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.