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 |
|---|---|---|---|---|
21 | // Mints batch of new SqwidERC1155 tokens and adds them to the marketplace. / | function mintBatch(
uint256[] memory amounts,
string[] memory tokenURIs,
string[] calldata mimeTypes,
address[] memory royaltyRecipients,
uint256[] memory royaltyValues
| function mintBatch(
uint256[] memory amounts,
string[] memory tokenURIs,
string[] calldata mimeTypes,
address[] memory royaltyRecipients,
uint256[] memory royaltyValues
| 19,685 |
14 | // Convenience function for encoding claim data | function encodeClaim(Claim calldata claim) external pure returns (bytes memory encoded, bytes32 hash) {
encoded = abi.encodePacked(claim.index, claim.account, claim.cycle, claim.claim.tokens, claim.cumulativeAmounts);
hash = keccak256(encoded);
}
| function encodeClaim(Claim calldata claim) external pure returns (bytes memory encoded, bytes32 hash) {
encoded = abi.encodePacked(claim.index, claim.account, claim.cycle, claim.claim.tokens, claim.cumulativeAmounts);
hash = keccak256(encoded);
}
| 7,176 |
38 | // depositing into, or getting info for, the created market uses this ID | id_ = markets.length;
markets.push(
Market({
quoteToken: _quoteToken,
capacityInQuote: _booleans[0],
capacity: _market[0],
totalDebt: targetDebt,
maxPayout: maxPayout,
purchased: 0,
| id_ = markets.length;
markets.push(
Market({
quoteToken: _quoteToken,
capacityInQuote: _booleans[0],
capacity: _market[0],
totalDebt: targetDebt,
maxPayout: maxPayout,
purchased: 0,
| 15,440 |
180 | // Iron Bank /simple logic. do we get more apr than iron bank charges?if so, is that still true with increased pos?if not, should be reduce?made harder because we can't assume iron bank debt curve. So need to increment | function internalCreditOfficer() public view returns (bool borrowMore, uint256 amount) {
if(emergencyExit){
return(false, ironBankOutstandingDebtStored());
}
//how much credit we have
(, uint256 liquidity, uint256 shortfall) = ironBank.getAccountLiquidity(address(this))... | function internalCreditOfficer() public view returns (bool borrowMore, uint256 amount) {
if(emergencyExit){
return(false, ironBankOutstandingDebtStored());
}
//how much credit we have
(, uint256 liquidity, uint256 shortfall) = ironBank.getAccountLiquidity(address(this))... | 4,538 |
1 | // fee schedule, can be changed by governance, in bips performance fee is on any gains, base fee is on AUM/yearly | uint256 public constant max = 10000;
uint256 public performanceToTreasury = 1000;
uint256 public performanceToFarmer = 1000;
uint256 public baseToTreasury = 100;
uint256 public baseToFarmer = 100;
| uint256 public constant max = 10000;
uint256 public performanceToTreasury = 1000;
uint256 public performanceToFarmer = 1000;
uint256 public baseToTreasury = 100;
uint256 public baseToFarmer = 100;
| 4,653 |
139 | // solhint-disable func-name-mixedcase | function NAME() external view returns (string memory);
function VERSION() external view returns (string memory);
| function NAME() external view returns (string memory);
function VERSION() external view returns (string memory);
| 40,067 |
131 | // add to imbalance | conversionRatesContract.recordImbalance(
destToken,
int256(destAmount),
0,
block.number
);
| conversionRatesContract.recordImbalance(
destToken,
int256(destAmount),
0,
block.number
);
| 24,280 |
32 | // Smallest investment is 0.00001 ether | uint256 amountOfWei = msg.value;
require(amountOfWei >= 10000000000000);
uint256 amountOfMTP = 0;
uint256 absLowTimeBonusLimit = 0;
uint256 absMidTimeBonusLimit = 0;
uint256 absHighTimeBonusLimit = 0;
uint256 totalMTPAvailable = 0;
| uint256 amountOfWei = msg.value;
require(amountOfWei >= 10000000000000);
uint256 amountOfMTP = 0;
uint256 absLowTimeBonusLimit = 0;
uint256 absMidTimeBonusLimit = 0;
uint256 absHighTimeBonusLimit = 0;
uint256 totalMTPAvailable = 0;
| 15,186 |
42 | // MANAGER ONLY. Changes manager; We allow null addresses in case the manager wishes to wind down the SetToken.Modules may rely on the manager state, so only changable when unlocked / | function setManager(address _manager) external onlyManager {
require(!isLocked, "Only when unlocked");
address oldManager = manager;
manager = _manager;
emit ManagerEdited(_manager, oldManager);
}
| function setManager(address _manager) external onlyManager {
require(!isLocked, "Only when unlocked");
address oldManager = manager;
manager = _manager;
emit ManagerEdited(_manager, oldManager);
}
| 35,005 |
23 | // accept token into timelock_for address of future tokenholder_timestamp lock timestamp return result of operation: true if success/ | function accept(address _for, uint _timestamp, uint _tvalue) public returns(bool){
require(_for != address(0));
require(_for != address(this));
require(_timestamp > getTimestamp_());
require(_tvalue > 0);
uint _contractBalance = contractBalance_();
uint _balance = balance[_for][_timestamp];
... | function accept(address _for, uint _timestamp, uint _tvalue) public returns(bool){
require(_for != address(0));
require(_for != address(this));
require(_timestamp > getTimestamp_());
require(_tvalue > 0);
uint _contractBalance = contractBalance_();
uint _balance = balance[_for][_timestamp];
... | 45,674 |
76 | // Allows to add a contract to handle fallback calls./Only fallback calls without value and with data will be forwarded./This can only be done via a Safe transaction./handler contract to handle fallback calls. | function setFallbackHandler(address handler) public authorized {
internalSetFallbackHandler(handler);
emit ChangedFallbackHandler(handler);
}
| function setFallbackHandler(address handler) public authorized {
internalSetFallbackHandler(handler);
emit ChangedFallbackHandler(handler);
}
| 51,466 |
7 | // This is an access control role for entities that may spend tokens / | abstract contract SpenderRole {
using EnumerableSet for EnumerableSet.AddressSet;
event SpenderAdded(address indexed account);
event SpenderRemoved(address indexed account);
EnumerableSet.AddressSet private _spenders;
constructor() {
_addSpender(msg.sender);
}
modifier onlySpender() {
require(... | abstract contract SpenderRole {
using EnumerableSet for EnumerableSet.AddressSet;
event SpenderAdded(address indexed account);
event SpenderRemoved(address indexed account);
EnumerableSet.AddressSet private _spenders;
constructor() {
_addSpender(msg.sender);
}
modifier onlySpender() {
require(... | 14,055 |
95 | // Manages forging | contract ItemForge is ItemMarket {
event Forge(uint256 forgedItemID);
///@notice Forge items together
function forgeItems(uint256 _parentItemID, uint256 _childItemID) external
onlyOwnerOfItem(_parentItemID)
onlyOwnerOfItem(_childItemID)
ifItemForSaleThenCancelSale(_parentItemID)
ifItemForSaleThenCancelSale... | contract ItemForge is ItemMarket {
event Forge(uint256 forgedItemID);
///@notice Forge items together
function forgeItems(uint256 _parentItemID, uint256 _childItemID) external
onlyOwnerOfItem(_parentItemID)
onlyOwnerOfItem(_childItemID)
ifItemForSaleThenCancelSale(_parentItemID)
ifItemForSaleThenCancelSale... | 65,499 |
9 | // uint256 maxIssue = 10000001018; uint256 basePrice = 20001018; 1 ETH = 2000 TCV | emit Received(msg.sender, msg.value);
require(msg.value > 0);
uint256 remainingVotes = balanceOf(owner);
require(balanceOf(owner) > 0, "All TCV already sold.");
uint256 weiSent = msg.value; // Calculate tokens to sell
uint256 votesBought = (weiSent * basePrice) / (1 ether... | emit Received(msg.sender, msg.value);
require(msg.value > 0);
uint256 remainingVotes = balanceOf(owner);
require(balanceOf(owner) > 0, "All TCV already sold.");
uint256 weiSent = msg.value; // Calculate tokens to sell
uint256 votesBought = (weiSent * basePrice) / (1 ether... | 25,758 |
4 | // restarts the contract after a shutdown | function restart() external {
require(msg.sender == owner, "Only the owner can shutdown the contract");
isShutdown = false;
}
| function restart() external {
require(msg.sender == owner, "Only the owner can shutdown the contract");
isShutdown = false;
}
| 8,300 |
35 | // Base contract for ContractRegistry clients/ | contract ContractRegistryClient is Owned, Utils {
bytes32 internal constant CONTRACT_FEATURES = "ContractFeatures";
bytes32 internal constant CONTRACT_REGISTRY = "ContractRegistry";
bytes32 internal constant NON_STANDARD_TOKEN_REGISTRY = "NonStandardTokenRegistry";
bytes32 internal constant BANCOR_NETWO... | contract ContractRegistryClient is Owned, Utils {
bytes32 internal constant CONTRACT_FEATURES = "ContractFeatures";
bytes32 internal constant CONTRACT_REGISTRY = "ContractRegistry";
bytes32 internal constant NON_STANDARD_TOKEN_REGISTRY = "NonStandardTokenRegistry";
bytes32 internal constant BANCOR_NETWO... | 14,694 |
7 | // This extension is shared, not single-creator. So we must ensurethat a claim's initializer is an admin on the creator contract creatorContractAddressthe address of the creator contract to check the admin against / | modifier creatorAdminRequired(address creatorContractAddress) {
require(IAdminControl(creatorContractAddress).isAdmin(msg.sender), "Wallet is not an administrator for contract");
_;
}
| modifier creatorAdminRequired(address creatorContractAddress) {
require(IAdminControl(creatorContractAddress).isAdmin(msg.sender), "Wallet is not an administrator for contract");
_;
}
| 12,810 |
56 | // 5. Total mAsset is the difference between values | totalmAssets = k0 - k1;
| totalmAssets = k0 - k1;
| 48,219 |
81 | // return the current total amount of tokens staked by all users / | function totalStaked() external view returns (uint256);
| function totalStaked() external view returns (uint256);
| 19,792 |
104 | // Override this function.This version is to keep track of BaseRelayRecipient you are usingin your contract. / | function versionRecipient() external pure override returns (string memory) {
return "2";
}
| function versionRecipient() external pure override returns (string memory) {
return "2";
}
| 65,390 |
18 | // Loop once to get the total count. | Entry memory _curEntry = entries[0x0];
while (_curEntry.next > 0) {
_curEntry = entries[_curEntry.next];
_size++;
}
| Entry memory _curEntry = entries[0x0];
while (_curEntry.next > 0) {
_curEntry = entries[_curEntry.next];
_size++;
}
| 21,630 |
7 | // Removes an existing extension from the router. | function removeExtension(string memory _extensionName) external {
require(_canSetExtension(), "BaseRouter: caller not authorized.");
_removeExtension(_extensionName);
}
| function removeExtension(string memory _extensionName) external {
require(_canSetExtension(), "BaseRouter: caller not authorized.");
_removeExtension(_extensionName);
}
| 10,201 |
11 | // deprecated - but useful to reset a list of addresses to be able to presale mint again./ | function initPresaleMerkleWalletList(address[] memory walletList) external onlyOwner {
for (uint i; i < walletList.length; i++) {
presaleMerkleWalletList[walletList[i]] = false;
}
}
| function initPresaleMerkleWalletList(address[] memory walletList) external onlyOwner {
for (uint i; i < walletList.length; i++) {
presaleMerkleWalletList[walletList[i]] = false;
}
}
| 68,035 |
11 | // This probably isn't necessary, but it doesn't hurt. | require(
appDataB.variable.allocationId == allocationId,
'Indexer turn: allocationId must match'
);
require(
recoverAttestationSigner(appDataB) == allocationId,
'Indexer Attestation: must be signed with the allocationId'
);
| require(
appDataB.variable.allocationId == allocationId,
'Indexer turn: allocationId must match'
);
require(
recoverAttestationSigner(appDataB) == allocationId,
'Indexer Attestation: must be signed with the allocationId'
);
| 55,494 |
9 | // Nonces for each VRF key from which randomness has been requested. Must stay in sync with VRFCoordinator[_keyHash][this] | mapping(bytes32 => uint256) /* keyHash */ /* nonce */
private nonces;
| mapping(bytes32 => uint256) /* keyHash */ /* nonce */
private nonces;
| 6,697 |
15 | // Our contract inherits from ERC721, which is the standard NFT contract! | contract TCAGame is ERC721 {
struct CharacterAttributes {
uint characterIndex;
string name;
string imageURI;
uint hp;
uint maxHp;
uint attackDamage;
}
// The tokenId is the NFTs unique identifier, it's just a number that goes
// 0, 1, 2, 3, etc.
using Counters for Counters.Co... | contract TCAGame is ERC721 {
struct CharacterAttributes {
uint characterIndex;
string name;
string imageURI;
uint hp;
uint maxHp;
uint attackDamage;
}
// The tokenId is the NFTs unique identifier, it's just a number that goes
// 0, 1, 2, 3, etc.
using Counters for Counters.Co... | 18,952 |
366 | // Initializes the BoiChillClub NFT. name_ The name of the token. symbol_ The symbol of the token. baseUri_ The base URI for token metadata. paymentToken_ The address of the payment token. amount_ The amount of payment token required for each purchase. / | constructor(
string memory name_,
string memory symbol_,
string memory baseUri_,
address paymentToken_,
uint256 amount_
) ERC721(name_, symbol_) {
address sender = _msgSender();
_setBaseURI(baseUri_);
_setupPrimarySaleRecipient(sender);
| constructor(
string memory name_,
string memory symbol_,
string memory baseUri_,
address paymentToken_,
uint256 amount_
) ERC721(name_, symbol_) {
address sender = _msgSender();
_setBaseURI(baseUri_);
_setupPrimarySaleRecipient(sender);
| 40,029 |
4 | // uniswap | uint256 public lastTradingFeeDistribution;
uint256 public sixMonthLock;
address public tokenRecipient;
| uint256 public lastTradingFeeDistribution;
uint256 public sixMonthLock;
address public tokenRecipient;
| 43,254 |
40 | // Trade start check | if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
| if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
| 33,902 |
52 | // similar to a nonce that avoids replay attacks this allows a single execution every x seconds for a given subscription subscriptionHash=> next valid block number | mapping(bytes32 => uint256) public nextValidTimestamp;
| mapping(bytes32 => uint256) public nextValidTimestamp;
| 49,959 |
4 | // YOU WON | if (racerScore[msg.sender] >= SCORE_TO_WIN) {
msg.sender.transfer(this.balance);
}
| if (racerScore[msg.sender] >= SCORE_TO_WIN) {
msg.sender.transfer(this.balance);
}
| 28,190 |
111 | // approve sender as they have paid the required amount | _approvePurchaser(msg.sender, _tokenId);
| _approvePurchaser(msg.sender, _tokenId);
| 5,178 |
72 | // Set a Trading Ruleonly callable by the owner of the contract1 senderToken = priceCoef10^(-priceExp)signerTokensenderToken address Address of an ERC-20 token the delegate would sendsignerToken address Address of an ERC-20 token the consumer would sendmaxSenderAmount uint256 Maximum amount of ERC-20 token the delegate... | function setRule(
address senderToken,
address signerToken,
uint256 maxSenderAmount,
uint256 priceCoef,
uint256 priceExp
| function setRule(
address senderToken,
address signerToken,
uint256 maxSenderAmount,
uint256 priceCoef,
uint256 priceExp
| 10,195 |
30 | // Re-insert trove in to the sorted list | uint newNICR = _getNewNominalICRFromTroveChange(vars.coll, vars.debt, vars.collChange, vars.isCollIncrease, vars.netDebtChange, _isDebtIncrease);
sortedTroves.reInsert(_borrower, newNICR, _upperHint, _lowerHint);
emit TroveUpdated(_borrower, vars.newDebt, vars.newColl, vars.stake, BorrowerOpera... | uint newNICR = _getNewNominalICRFromTroveChange(vars.coll, vars.debt, vars.collChange, vars.isCollIncrease, vars.netDebtChange, _isDebtIncrease);
sortedTroves.reInsert(_borrower, newNICR, _upperHint, _lowerHint);
emit TroveUpdated(_borrower, vars.newDebt, vars.newColl, vars.stake, BorrowerOpera... | 14,278 |
235 | // IBEP20 |
function getOwner() external view override returns (address) {
return owner();
}
|
function getOwner() external view override returns (address) {
return owner();
}
| 42,665 |
9 | // function to buy property tokens availaible for selling | function purchasePropertyTokens(address buyer,uint voucher_token_offered,address property_token_owner,uint property_id) public {
require(property_token_sell[property_token_owner][property_id] >= voucher_token_offered);
require(getVoucherBalance(buyer)>=voucher_token_offered);
ERC20 _erc20_property... | function purchasePropertyTokens(address buyer,uint voucher_token_offered,address property_token_owner,uint property_id) public {
require(property_token_sell[property_token_owner][property_id] >= voucher_token_offered);
require(getVoucherBalance(buyer)>=voucher_token_offered);
ERC20 _erc20_property... | 27,327 |
225 | // Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role | * bearer except when using {_setupRole}.
*/
event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
*... | * bearer except when using {_setupRole}.
*/
event RoleGranted(
bytes32 indexed role,
address indexed account,
address indexed sender
);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
*... | 6,472 |
64 | // Disable whitelisting / | function disableWhitelist() public onlyOwner {
whitelistEnabled = false;
}
| function disableWhitelist() public onlyOwner {
whitelistEnabled = false;
}
| 29,810 |
166 | // Stop trasfer fee payment for tokens. return true if the operation was successful./ | function finishTransferFeePayment() public onlyOwner returns(bool finished) {
require(!transferFeePaymentFinished, "transfer fee finished");
transferFeePaymentFinished = true;
emit LogTransferFeePaymentFinished(msg.sender);
return true;
}
| function finishTransferFeePayment() public onlyOwner returns(bool finished) {
require(!transferFeePaymentFinished, "transfer fee finished");
transferFeePaymentFinished = true;
emit LogTransferFeePaymentFinished(msg.sender);
return true;
}
| 25,616 |
228 | // revoke a mint request, Delete the mintOperation index of the request (visible in the RequestMint event accompanying the original request)/ | function revokeMint(uint256 _index) external onlyMintKeyOrOwner {
delete mintOperations[_index];
emit RevokeMint(_index);
}
| function revokeMint(uint256 _index) external onlyMintKeyOrOwner {
delete mintOperations[_index];
emit RevokeMint(_index);
}
| 1,109 |
179 | // We need ownership to create subnodes | require(_ens.owner(_rootNode) == address(this), ERROR_NO_NODE_OWNERSHIP);
ens = _ens;
rootNode = _rootNode;
| require(_ens.owner(_rootNode) == address(this), ERROR_NO_NODE_OWNERSHIP);
ens = _ens;
rootNode = _rootNode;
| 16,437 |
37 | // Withdraws staked tokens from the pool/amount The amount of tokens to withdraw | function withdraw(uint256 amount) external {
/// -----------------------------------------------------------------------
/// Validation
/// -----------------------------------------------------------------------
if (amount == 0) {
return;
}
/// ---------... | function withdraw(uint256 amount) external {
/// -----------------------------------------------------------------------
/// Validation
/// -----------------------------------------------------------------------
if (amount == 0) {
return;
}
/// ---------... | 14,676 |
345 | // Expiratory time now becomes the current time (emergency shutdown time). Price requested at this time stamp. `settleExpired` can now withdraw at this timestamp. | uint256 oldExpirationTimestamp = expirationTimestamp;
expirationTimestamp = getCurrentTime();
_requestOraclePrice(expirationTimestamp);
emit EmergencyShutdown(msg.sender, oldExpirationTimestamp, expirationTimestamp);
| uint256 oldExpirationTimestamp = expirationTimestamp;
expirationTimestamp = getCurrentTime();
_requestOraclePrice(expirationTimestamp);
emit EmergencyShutdown(msg.sender, oldExpirationTimestamp, expirationTimestamp);
| 34,888 |
38 | // address _token | ) public {
require(hardCap > minimalGoal);
require(openingTime < closingTime);
//token = BlockchainBikeToken(_token);
crowdsale = address(this);
forSale = 0xf6ACFDba39D8F786D0D2781A1D20C82E47adF8b7;
ecoSystemFund = 0x5A77aAE15258a2a4445C701d63dbE74016F7e629;
founders = 0xA80A449514541a... | ) public {
require(hardCap > minimalGoal);
require(openingTime < closingTime);
//token = BlockchainBikeToken(_token);
crowdsale = address(this);
forSale = 0xf6ACFDba39D8F786D0D2781A1D20C82E47adF8b7;
ecoSystemFund = 0x5A77aAE15258a2a4445C701d63dbE74016F7e629;
founders = 0xA80A449514541a... | 14,218 |
189 | // add x^16(33! / 16!) | xi = (xi * _x) >> _precision;
res += xi * 0x000000000000052b6b54569976310000;
| xi = (xi * _x) >> _precision;
res += xi * 0x000000000000052b6b54569976310000;
| 38,892 |
126 | // Prevent overflow when dividing INT256_MIN by -1 https:github.com/RequestNetwork/requestNetwork/issues/43 | require(!(a == - 2**255 && b == -1) && (b > 0));
return a / b;
| require(!(a == - 2**255 && b == -1) && (b > 0));
return a / b;
| 23,185 |
4 | // Array that stores all possible grades for the team. | uint8[] public momoGrades;
| uint8[] public momoGrades;
| 11,670 |
63 | // Group is intact after fn call/_tokenId The ID of the Token purchase group | function distributeInterest(uint256 _tokenId) external onlyCOO payable {
var group = tokenIndexToGroup[_tokenId];
var amount = msg.value;
var excess = amount;
// Safety check to make sure group exists and had purchased the token
require(group.exists);
require(group.purchasePrice > 0);
req... | function distributeInterest(uint256 _tokenId) external onlyCOO payable {
var group = tokenIndexToGroup[_tokenId];
var amount = msg.value;
var excess = amount;
// Safety check to make sure group exists and had purchased the token
require(group.exists);
require(group.purchasePrice > 0);
req... | 29,798 |
20 | // --test price = 0.00025 | uint256 price = 250000000000000;
return price;
| uint256 price = 250000000000000;
return price;
| 19,836 |
43 | // Mint HYSI token with deposited 3CRV. This function goes through all the steps necessary to mint an optimal amount of HYSI minAmountToMint_ The expected min amount of hysi to mint. If hysiAmount is lower than minAmountToMint_ the transaction will revert. This function deposits 3CRV in the underlying Metapool and depo... | function batchMint(uint256 minAmountToMint_) external keeperIncentive(0) {
Batch storage batch = batches[currentMintBatchId];
//Check if there was enough time between the last batch minting and this attempt...
//...or if enough 3CRV was deposited to make the minting worthwhile
//This is to prevent ex... | function batchMint(uint256 minAmountToMint_) external keeperIncentive(0) {
Batch storage batch = batches[currentMintBatchId];
//Check if there was enough time between the last batch minting and this attempt...
//...or if enough 3CRV was deposited to make the minting worthwhile
//This is to prevent ex... | 12,241 |
27 | // Base factory for contracts whose creation code is so large that the factory cannot hold it. This happens whenthe contract's creation code grows close to 24kB. Note that this factory cannot help with contracts that have a runtime (deployed) bytecode larger than 24kB. / | abstract contract BaseSplitCodeFactory {
// The contract's creation code is stored as code in two separate addresses, and retrieved via `extcodecopy`. This
// means this factory supports contracts with creation code of up to 48kB.
// We rely on inline-assembly to achieve this, both to make the entire operat... | abstract contract BaseSplitCodeFactory {
// The contract's creation code is stored as code in two separate addresses, and retrieved via `extcodecopy`. This
// means this factory supports contracts with creation code of up to 48kB.
// We rely on inline-assembly to achieve this, both to make the entire operat... | 26,008 |
392 | // check for existance | require(_configSet.contains(configID), "not config");
| require(_configSet.contains(configID), "not config");
| 73,150 |
117 | // private function to distribute WETH rewards | function distributeDivsEth(uint amount) private {
require(amount > 0 && totalTokens > 0, "distributeDivsEth failed!");
totalEthDivPoints = totalEthDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit EthRewardsDisbursed(amount);
}
| function distributeDivsEth(uint amount) private {
require(amount > 0 && totalTokens > 0, "distributeDivsEth failed!");
totalEthDivPoints = totalEthDivPoints.add(amount.mul(pointMultiplier).div(totalTokens));
emit EthRewardsDisbursed(amount);
}
| 37,589 |
0 | // Creates and initializes V3 Pools/Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that/ require the pool to exist. | interface IPoolInitializer {
/// @notice Creates a new pool if it does not exist, then initializes if not initialized
/// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
/// @param token0 The contract address of token0 of the pool
/// ... | interface IPoolInitializer {
/// @notice Creates a new pool if it does not exist, then initializes if not initialized
/// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
/// @param token0 The contract address of token0 of the pool
/// ... | 17,781 |
7 | // Create a pool (proxied) poolBeacon Pool beacon contract params Pool parametersreturn Pool address / | function createProxied(address poolBeacon, bytes calldata params) external returns (address);
| function createProxied(address poolBeacon, bytes calldata params) external returns (address);
| 13,616 |
64 | // Apply discount if purchasing 5 bees | if (_amount == 5) {
price -= beesParams.discountPrice;
}
| if (_amount == 5) {
price -= beesParams.discountPrice;
}
| 28,394 |
169 | // Internal function that transfer tokens from one address to another./ Update magnifiedRewardCorrections to keep rewards unchanged./from The address to transfer from./to The address to transfer to./value The amount to be transferred. | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedRewardPerShare.mul(value).toInt256Safe();
magnifiedRewardCorrections[from] = magnifiedRewardCorrections[from].add(_magCorrection);
magnifiedReward... | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedRewardPerShare.mul(value).toInt256Safe();
magnifiedRewardCorrections[from] = magnifiedRewardCorrections[from].add(_magCorrection);
magnifiedReward... | 68,426 |
18 | // Get contract balance / | function getBalance() public view returns(uint256 balance) {
return address(this).balance;
}
| function getBalance() public view returns(uint256 balance) {
return address(this).balance;
}
| 15,466 |
0 | // transferOwners: (transferData, transferID) => address owner might change state map implementation in the future mapping(struct => mapping(uint => address)) public transferOwners; | mapping(bytes => mapping(uint => address)) public transferOwners;
| mapping(bytes => mapping(uint => address)) public transferOwners;
| 45,339 |
45 | // Transfer control over deployment to the home address correspondingto a given key to the null address, which will prevent it from beingdeployed to again in the future. The caller must be designated as thecurrent controller of the corresponding home address (with the initialcontroller set to the address corresponding ... | function relinquishControl(bytes32 key)
| function relinquishControl(bytes32 key)
| 23,013 |
0 | // address of the uniswap v2 router | address private constant UNISWAP_V2_ROUTER =
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
| address private constant UNISWAP_V2_ROUTER =
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
| 17,905 |
4 | // If allowance is unlimited by `permit`, `approve`, or `increaseAllowance` function, don't adjust it. But the expiration date must be empty or in the future. Note that the expiration timestamp can have a 900-second error: https:github.com/ethereum/wiki/blob/c02254611f218f43cbb07517ca8e5d00fd6d6d75/Block-Protocol-2.0.m... | require(
| require(
| 31,515 |
39 | // AMOs should only be giving back canonical tokens | function receiveBackViaAMO(address canonical_token_address, uint256 token_amount, bool do_bridging) external validCanonicalToken(canonical_token_address) validAMO(msg.sender) {
// Pull in the tokens from the AMO
TransferHelper.safeTransferFrom(canonical_token_address, msg.sender, address(this), toke... | function receiveBackViaAMO(address canonical_token_address, uint256 token_amount, bool do_bridging) external validCanonicalToken(canonical_token_address) validAMO(msg.sender) {
// Pull in the tokens from the AMO
TransferHelper.safeTransferFrom(canonical_token_address, msg.sender, address(this), toke... | 5,607 |
24 | // For increasing or decreasing the max supply ba character type | function setMaxSupply(uint16 _characterType, uint16 _maxSupply)
public
onlyOwner
| function setMaxSupply(uint16 _characterType, uint16 _maxSupply)
public
onlyOwner
| 41,350 |
35 | // External //Lets the governor call anything on behalf of the contract._destination The destination of the call._amount The value sent with the call._data The data sent with the call. / | function executeGovernorProposal(address _destination, uint _amount, bytes _data) external onlyByGovernor {
require(_destination.call.value(_amount)(_data)); // solium-disable-line security/no-call-value
}
| function executeGovernorProposal(address _destination, uint _amount, bytes _data) external onlyByGovernor {
require(_destination.call.value(_amount)(_data)); // solium-disable-line security/no-call-value
}
| 32,254 |
13 | // See divDecimal for uint256. / | function divDecimalUint128(uint128 x, uint128 y) internal pure returns (uint128) {
return (x * UNIT_UINT128) / y;
}
| function divDecimalUint128(uint128 x, uint128 y) internal pure returns (uint128) {
return (x * UNIT_UINT128) / y;
}
| 26,214 |
243 | // Transfer tokens. | if (from == address(this)) {
LibERC20Token.transfer(
token,
to,
amount
);
} else {
| if (from == address(this)) {
LibERC20Token.transfer(
token,
to,
amount
);
} else {
| 49,090 |
122 | // isSwapify | bool public swapiFy;
| bool public swapiFy;
| 76,079 |
8 | // Emit event | emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);
| emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);
| 34,634 |
104 | // verify the pool is of the expected type | require(
_pool.POOL_UID() == 0x620bbda48b8ff3098da2f0033cbf499115c61efdd5dcd2db05346782df6218e7,
"unexpected POOL_UID"
);
| require(
_pool.POOL_UID() == 0x620bbda48b8ff3098da2f0033cbf499115c61efdd5dcd2db05346782df6218e7,
"unexpected POOL_UID"
);
| 49,713 |
7 | // 100 sb = 1 Euro There are 10 billion Euro worth in SB-coins in total 1SBC = 1 Euro | _totalSupply = 1000000000000;
balances[msg.sender] = _totalSupply;
_name = "Saarbrücken Coin";
_symbol = "SBC";
_decimals = 2;
create_products();
| _totalSupply = 1000000000000;
balances[msg.sender] = _totalSupply;
_name = "Saarbrücken Coin";
_symbol = "SBC";
_decimals = 2;
create_products();
| 6,214 |
181 | // Play. | buyout(_gameIndex, startNewGameIfIdle, x, y);
| buyout(_gameIndex, startNewGameIfIdle, x, y);
| 17,952 |
10 | // Add call to mint $CELL on other side of bridge | calls[currIndex] = abi.encodeWithSelector(this.mintCell.selector, reflection[cellToken], msg.sender, cellAmount);
| calls[currIndex] = abi.encodeWithSelector(this.mintCell.selector, reflection[cellToken], msg.sender, cellAmount);
| 33,812 |
2 | // Game Length (TODO: Change to 1 weeks) | gameLength = 1 weeks;
| gameLength = 1 weeks;
| 22,742 |
465 | // Sets a new price piggyDistribution for the comptroller Admin function to set a new piggy distributionreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _setPiggyDistribution(IPiggyDistribution newPiggyDistribution) public onlyOwner returns (uint) {
IPiggyDistribution oldPiggyDistribution = piggyDistribution;
piggyDistribution = newPiggyDistribution;
emit NewPiggyDistribution(oldPiggyDistribution, newPiggyDistribution);
... | function _setPiggyDistribution(IPiggyDistribution newPiggyDistribution) public onlyOwner returns (uint) {
IPiggyDistribution oldPiggyDistribution = piggyDistribution;
piggyDistribution = newPiggyDistribution;
emit NewPiggyDistribution(oldPiggyDistribution, newPiggyDistribution);
... | 46,109 |
57 | // Pre: Emergency situation that requires contribution period to stop./ Post: Contributing not possible anymore. | function halt() only_foundation { halted = true; }
/// Pre: Emergency situation resolved.
/// Post: Contributing becomes possible again.
function unhalt() only_foundation { halted = false; }
/// Pre: Restricted to foundation.
/// Post: New address set. To halt contribution and/or change minter... | function halt() only_foundation { halted = true; }
/// Pre: Emergency situation resolved.
/// Post: Contributing becomes possible again.
function unhalt() only_foundation { halted = false; }
/// Pre: Restricted to foundation.
/// Post: New address set. To halt contribution and/or change minter... | 20,714 |
16 | // Contract which oversees inter-cToken operations / | ComptrollerInterface public comptroller;
| ComptrollerInterface public comptroller;
| 12,446 |
251 | // Reserves the name if isReserve is set to true, de-reserves if set to false / | function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| function toggleReserveName(string memory str, bool isReserve) internal {
_nameReserved[toLower(str)] = isReserve;
}
| 67,725 |
92 | // An event thats emitted when a delegate account's vote balance changes | event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| 32,416 |
58 | // handling impermanent loss case | impermanentLossShare = (_totalBalance.mul(100)).div(netTotalGamePrincipal);
netTotalGamePrincipal = _totalBalance;
| impermanentLossShare = (_totalBalance.mul(100)).div(netTotalGamePrincipal);
netTotalGamePrincipal = _totalBalance;
| 7,002 |
160 | // Check if cumulative voting rights exceeds 50% of total voting rights | require(
netVotingRights >= _cumulativeTokenLocked.div(2),
"CerticolDAO: cumulative voting rights did not exceeds 50% of total voting rights"
);
| require(
netVotingRights >= _cumulativeTokenLocked.div(2),
"CerticolDAO: cumulative voting rights did not exceeds 50% of total voting rights"
);
| 51,514 |
10 | // In case there is no registry | if (checkpoints.length == 0) {
return (
address(parentDelegation) == address(0) ?
address(0) : parentDelegation.delegatedToAt(_who, _block)
);
}
| if (checkpoints.length == 0) {
return (
address(parentDelegation) == address(0) ?
address(0) : parentDelegation.delegatedToAt(_who, _block)
);
}
| 45,859 |
107 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow... | function name() public virtual pure returns (string memory);
| function name() public virtual pure returns (string memory);
| 18,817 |
53 | // Returns a positive number if `other` comes lexicographically after`self`, a negative number if it comes before, or zero if thecontents of the two bytes are equal. Comparison is done per-rune,on unicode codepoints.self The first bytes to compare.offset The offset of self.lenThe length of self.other The second bytes t... | function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {
uint shortest = len;
if (otherlen < len)
shortest = otherlen;
uint selfptr;
uint otherptr;
assembly {
selfptr :=... | function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {
uint shortest = len;
if (otherlen < len)
shortest = otherlen;
uint selfptr;
uint otherptr;
assembly {
selfptr :=... | 4,964 |
7 | // Creates a new token for `to`. Its token ID will be automatically | * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to) public... | * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to) public... | 6,388 |
67 | // we can stop only not started and not completed crowdsale | if (started) {
require(!isFailed());
require(!isSuccessful());
}
| if (started) {
require(!isFailed());
require(!isSuccessful());
}
| 44,566 |
185 | // term 0: | uint a = exp;
(uint x, bool xneg) = bsubSign(base, BONE);
uint term = BONE;
uint sum = term;
bool negative = false;
| uint a = exp;
(uint x, bool xneg) = bsubSign(base, BONE);
uint term = BONE;
uint sum = term;
bool negative = false;
| 10,525 |
9 | // Called by the requester to make a full request, which provides/ all of its parameters as arguments and does not refer to a template/`fulfillAddress` is not allowed to be the address of this/ contract. This is not actually needed to protect users that use the/ protocol as intended, but it is done for good measure./ai... | function makeFullRequest(
address airnode,
bytes32 endpointId,
address sponsor,
address sponsorWallet,
address fulfillAddress,
bytes4 fulfillFunctionId,
bytes calldata parameters
| function makeFullRequest(
address airnode,
bytes32 endpointId,
address sponsor,
address sponsorWallet,
address fulfillAddress,
bytes4 fulfillFunctionId,
bytes calldata parameters
| 15,071 |
161 | // Reviewer(s) / Contributor(s) Travis Moore: https:github.com/FortisFortuna Sam Kazemian: https:github.com/samkazemian Drake Evans:https:github.com/DrakeEvans Jack Corddry: https:github.com/corddry Justin Moore: https:github.com/0xJM/Fraxswap Router Multihop/Router for swapping across the majority of the FRAX liquidit... | contract FraxswapRouterMultihop is ReentrancyGuard, Ownable {
using SafeCast for uint256;
using SafeCast for int256;
IWETH WETH9;
address FRAX;
constructor(IWETH _WETH9, address _FRAX) {
WETH9 = _WETH9;
FRAX = _FRAX;
}
/// @notice modifier for checking deadline
modifie... | contract FraxswapRouterMultihop is ReentrancyGuard, Ownable {
using SafeCast for uint256;
using SafeCast for int256;
IWETH WETH9;
address FRAX;
constructor(IWETH _WETH9, address _FRAX) {
WETH9 = _WETH9;
FRAX = _FRAX;
}
/// @notice modifier for checking deadline
modifie... | 39,953 |
134 | // Sign out contract//_contract contract&39;s address | function signOut(address _contract) external onlyContractOwner returns (uint) {
require(_contract != 0x0);
delete authorized[_contract];
return OK;
}
| function signOut(address _contract) external onlyContractOwner returns (uint) {
require(_contract != 0x0);
delete authorized[_contract];
return OK;
}
| 50,302 |
6 | // owner set fallback function mode new fallback function mode. true - bet, false - add funds to contract / | function ownerSetMod(bool newMod) public
onlyOwner
| function ownerSetMod(bool newMod) public
onlyOwner
| 49,607 |
99 | // Transfer tokens into the swap | for (i = 0; i < _amounts.length; i++) {
if (_amounts[i] == 0) continue;
| for (i = 0; i < _amounts.length; i++) {
if (_amounts[i] == 0) continue;
| 65,518 |
88 | // Withdraw all claimable funds via LoanFDT. | uint256 beforeBal = liquidityAsset.balanceOf(address(this)); // Current balance of DebtLocker (accounts for direct inflows).
loan.withdrawFunds(); // Transfer funds from Loan to DebtLocker.
uint256 claimBal = liquidityAsset.... | uint256 beforeBal = liquidityAsset.balanceOf(address(this)); // Current balance of DebtLocker (accounts for direct inflows).
loan.withdrawFunds(); // Transfer funds from Loan to DebtLocker.
uint256 claimBal = liquidityAsset.... | 6,630 |
24 | // A master staking contact Will be deployed once as master contact / | contract Staking is IStaking, AccessControl, ReentrancyGuard {
using SafeERC20 for ERC20;
ITokenaFactory public immutable factory;
// Whether it is initialized and
bool private _isInitialized;
uint8 public bonusMultiplier;
// Accrued token per share
uint256[] public accTokenPerShare;
uint256 public stakers;... | contract Staking is IStaking, AccessControl, ReentrancyGuard {
using SafeERC20 for ERC20;
ITokenaFactory public immutable factory;
// Whether it is initialized and
bool private _isInitialized;
uint8 public bonusMultiplier;
// Accrued token per share
uint256[] public accTokenPerShare;
uint256 public stakers;... | 12,275 |
24 | // All functions must succeed or everything should be rolled back. | function buy(address owner, bytes32 id, uint64 qty) public payable {
// Check that seller owns the asset and it exists
Item storage asset = holdings[owner][id];
require(asset.id != 0, "Asset does not exist.");
// Check that asset is for sale
uint64 price = forsale[owner][id... | function buy(address owner, bytes32 id, uint64 qty) public payable {
// Check that seller owns the asset and it exists
Item storage asset = holdings[owner][id];
require(asset.id != 0, "Asset does not exist.");
// Check that asset is for sale
uint64 price = forsale[owner][id... | 34,774 |
368 | // Concatenates two strings `s1` and `s2`, for example, if `s1` == `foo` and `s2` == `bar`, the result `s` == `foobar` s1 first string s2 second stringreturn s concatenation result s1 + s2 / | function concat(string memory s1, string memory s2) internal pure returns (string memory s) {
| function concat(string memory s1, string memory s2) internal pure returns (string memory s) {
| 50,557 |
142 | // defines if funds have been already released or not | bool private _released = false;
constructor (
IERC20 token,
address beneficiary,
address recovery,
uint256 releaseTime,
uint256 releasePercent
| bool private _released = false;
constructor (
IERC20 token,
address beneficiary,
address recovery,
uint256 releaseTime,
uint256 releasePercent
| 24,813 |
61 | // validate inputs | require(i.t0 < q, "INVALID_INPUT");
require(i.t1 < q, "INVALID_INPUT");
require(i.t2 < q, "INVALID_INPUT");
require(i.t3 < q, "INVALID_INPUT");
require(i.t4 < q, "INVALID_INPUT");
return hash_t5f6p52_internal(i.t0, i.t1, i.t2, i.t3, i.t4, q);
| require(i.t0 < q, "INVALID_INPUT");
require(i.t1 < q, "INVALID_INPUT");
require(i.t2 < q, "INVALID_INPUT");
require(i.t3 < q, "INVALID_INPUT");
require(i.t4 < q, "INVALID_INPUT");
return hash_t5f6p52_internal(i.t0, i.t1, i.t2, i.t3, i.t4, q);
| 29,019 |
2 | // Emitted when multiple `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. / | event TraitTransfer(
| event TraitTransfer(
| 41,159 |
243 | // Returns name of the NFT at index. / | function tokenNameByIndex(uint256 index) public view returns (string memory) {
return _tokenName[index];
}
| function tokenNameByIndex(uint256 index) public view returns (string memory) {
return _tokenName[index];
}
| 30,290 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.