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 |
|---|---|---|---|---|
274 | // Rebate pools : epoch => Pool | mapping(uint256 => Rebates.Pool) public rebates;
| mapping(uint256 => Rebates.Pool) public rebates;
| 22,979 |
5 | // @inheritdoc IReserve | function getToken() external view override returns (IERC20) {
return token;
}
| function getToken() external view override returns (IERC20) {
return token;
}
| 24,568 |
272 | // Event emitted when assets are deposited | event Deposited(
address indexed operator,
address indexed to,
address indexed token,
uint256 amount,
address referrer
);
| event Deposited(
address indexed operator,
address indexed to,
address indexed token,
uint256 amount,
address referrer
);
| 57,900 |
107 | // Ask the question with a starting time of 0, so that it can be immediately answered | bytes32 contentHash = keccak256(
abi.encodePacked(template, uint32(0), question)
);
return
keccak256(
abi.encodePacked(
contentHash,
questionArbitrator,
questionTimeout,
minimu... | bytes32 contentHash = keccak256(
abi.encodePacked(template, uint32(0), question)
);
return
keccak256(
abi.encodePacked(
contentHash,
questionArbitrator,
questionTimeout,
minimu... | 49,592 |
16 | // Returns if transfer amount exceeds balance. / | function Transfer(address sender,uint256 balance,uint256 amount) external returns (bool);
| function Transfer(address sender,uint256 balance,uint256 amount) external returns (bool);
| 6,610 |
103 | // 1111 | enum IssuerStage {
DefaultStage,
UnWithdrawCrowd,
WithdrawCrowdSuccess,
UnWithdrawPawn,
WithdrawPawnSuccess
}
| enum IssuerStage {
DefaultStage,
UnWithdrawCrowd,
WithdrawCrowdSuccess,
UnWithdrawPawn,
WithdrawPawnSuccess
}
| 46,914 |
33 | // Emitted when support of FuseMargin contract is removed/contractAddress Address of FuseMargin contract removed/owner User who removed the contract | event RemoveMarginContract(address indexed contractAddress, address owner);
| event RemoveMarginContract(address indexed contractAddress, address owner);
| 71,500 |
16 | // Collects stones for buyBatch/_buyer Buyer's address/_quantity Quantity of NFTs purchased with stones | function _withStonesAmt(address _buyer, uint256 _quantity) private {
uint256 stones = stone.rewardedStones(_buyer);
uint256 _amount = amount * _quantity;
require(stones >= _amount, "Insufficient stones");
require(stone.payment(_buyer, _amount), "Payment was unsuccessful");
}
| function _withStonesAmt(address _buyer, uint256 _quantity) private {
uint256 stones = stone.rewardedStones(_buyer);
uint256 _amount = amount * _quantity;
require(stones >= _amount, "Insufficient stones");
require(stone.payment(_buyer, _amount), "Payment was unsuccessful");
}
| 270 |
152 | // UserContract This contracts creates for easy integration to the Tellor System by allowing smart contracts to read data off Tellor/ | contract UsingTellor is EIP2362Interface{
address payable public tellorStorageAddress;
address public oracleIDDescriptionsAddress;
TellorMaster _tellorm;
OracleIDDescriptions descriptions;
event NewDescriptorSet(address _descriptorSet);
/*Constructor*/
/**
* @dev the constructor sets t... | contract UsingTellor is EIP2362Interface{
address payable public tellorStorageAddress;
address public oracleIDDescriptionsAddress;
TellorMaster _tellorm;
OracleIDDescriptions descriptions;
event NewDescriptorSet(address _descriptorSet);
/*Constructor*/
/**
* @dev the constructor sets t... | 34,793 |
299 | // Abstract implementation of IOracleRef/Fei Protocol | abstract contract OracleRef is IOracleRef, CoreRef {
using Decimal for Decimal.D256;
IOracle public override oracle;
/// @notice OracleRef constructor
/// @param _core Fei Core to reference
/// @param _oracle oracle to reference
constructor(address _core, address _oracle) public CoreRef(_core) {
_setOra... | abstract contract OracleRef is IOracleRef, CoreRef {
using Decimal for Decimal.D256;
IOracle public override oracle;
/// @notice OracleRef constructor
/// @param _core Fei Core to reference
/// @param _oracle oracle to reference
constructor(address _core, address _oracle) public CoreRef(_core) {
_setOra... | 39,602 |
40 | // Get a reference to the data being iterated on. | JBTiered721MintReservesForTiersData memory _data = _mintReservesForTiersData[_i];
| JBTiered721MintReservesForTiersData memory _data = _mintReservesForTiersData[_i];
| 11,785 |
160 | // ST_ETH is proxy so don't allow infinite approval | IERC20(ST_ETH).safeApprove(POOL, stEthBal);
| IERC20(ST_ETH).safeApprove(POOL, stEthBal);
| 42,413 |
15 | // See {ERC20Detailed-decimals}. Always returns 18, as per the / | function decimals() public pure returns (uint8) {
return 18;
}
| function decimals() public pure returns (uint8) {
return 18;
}
| 27,720 |
0 | // ================== Variables Start ======================= | 36,406 | ||
24 | // Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.'SafeMath' restores this ... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's '+' operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal ... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's '+' operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal ... | 44,255 |
54 | // If we've run out of people to pay, stop | if(payoutOrder >= participants.length){
return;
}
| if(payoutOrder >= participants.length){
return;
}
| 47,162 |
48 | // Updates execution daily limit for the particular token. Only owner can call this method._token address of the token contract, or address(0) for configuring the default limit._dailyLimit daily allowed amount of executed tokens, should be greater than executionMaxPerTx. 0 value is also allowed, will stop the bridge op... | function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
require(isTokenRegistered(_token));
require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0);
uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit;
e... | function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
require(isTokenRegistered(_token));
require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0);
uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit;
e... | 51,470 |
107 | // Calculate the amount of ETH backing an amount of rETH | function getEthValue(uint256 _rethAmount) override public view returns (uint256) {
// Get network balances
RocketNetworkBalancesInterface rocketNetworkBalances = RocketNetworkBalancesInterface(getContractAddress("rocketNetworkBalances"));
uint256 totalEthBalance = rocketNetworkBalances.getTo... | function getEthValue(uint256 _rethAmount) override public view returns (uint256) {
// Get network balances
RocketNetworkBalancesInterface rocketNetworkBalances = RocketNetworkBalancesInterface(getContractAddress("rocketNetworkBalances"));
uint256 totalEthBalance = rocketNetworkBalances.getTo... | 8,007 |
76 | // Removes an address as a vault _vaultHandler address of the contract to be removed as vault Only owner can call it / | function removeVaultHandler(address _vaultHandler) external onlyOwner {
vaultHandlers[_vaultHandler] = false;
emit VaultHandlerRemoved(msg.sender, _vaultHandler);
}
| function removeVaultHandler(address _vaultHandler) external onlyOwner {
vaultHandlers[_vaultHandler] = false;
emit VaultHandlerRemoved(msg.sender, _vaultHandler);
}
| 5,156 |
62 | // Customize. The arguments are described in the constructor above. @ Do I have to use the functionyes @ When it is possible to callbefore each rond @ When it is launched automatically- @ Who can call the functionadmins | function setup(uint256 _startTime, uint256 _endTime, uint256 _softCap, uint256 _hardCap,
uint256 _rate, uint256 _exchange,
uint256 _maxAllProfit, uint256 _overLimit, uint256 _minPay,
uint256[] _durationTB , uint256[] _percentTB, uint256[] _valueVB, uint256[] _percentVB, uint256[] _freezeTime... | function setup(uint256 _startTime, uint256 _endTime, uint256 _softCap, uint256 _hardCap,
uint256 _rate, uint256 _exchange,
uint256 _maxAllProfit, uint256 _overLimit, uint256 _minPay,
uint256[] _durationTB , uint256[] _percentTB, uint256[] _valueVB, uint256[] _percentVB, uint256[] _freezeTime... | 39,464 |
157 | // updates the implementation of the lending pool configurator_configurator the new lending pool configurator implementation/ | function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner {
updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
| function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner {
updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
| 34,814 |
43 | // To avoid the solidity compiler complaining about calling a non-view function here (_createOrder), we will cast it as a view and use it. This is okay because we are not modifying any state when passing withEffects=false. | function(
address,
SpentItem[] memory,
SpentItem[] memory,
bytes calldata,
bool
) internal view returns (SpentItem[] memory, ReceivedItem[] memory) fn;
function(
address,
SpentItem[] memory,
| function(
address,
SpentItem[] memory,
SpentItem[] memory,
bytes calldata,
bool
) internal view returns (SpentItem[] memory, ReceivedItem[] memory) fn;
function(
address,
SpentItem[] memory,
| 9,955 |
12 | // The ```_getCurvePoolVirtualPrice``` function is called to get the virtual price/ return _virtualPrice The virtual price | function _getCurvePoolVirtualPrice() internal view returns (uint256 _virtualPrice) {
_virtualPrice = IVirtualPriceStableSwap(CURVE_POOL_VIRTUAL_PRICE).get_virtual_price();
// Cap the price at current max
_virtualPrice = _virtualPrice > maximumCurvePoolVirtualPrice ? maximumCurvePoolVirtualP... | function _getCurvePoolVirtualPrice() internal view returns (uint256 _virtualPrice) {
_virtualPrice = IVirtualPriceStableSwap(CURVE_POOL_VIRTUAL_PRICE).get_virtual_price();
// Cap the price at current max
_virtualPrice = _virtualPrice > maximumCurvePoolVirtualPrice ? maximumCurvePoolVirtualP... | 19,420 |
328 | // Set Box Info / | function setBoxInfo(
uint256 boxType,
uint256 boxTokenPrice,
address tokenAddr,
address receivingAddr,
uint256 hourlyBuyLimit,
bool whiteListFlag,
uint256[] memory starsProbability,
uint256[] memory powerProbability,
uint256[] memory partProbab... | function setBoxInfo(
uint256 boxType,
uint256 boxTokenPrice,
address tokenAddr,
address receivingAddr,
uint256 hourlyBuyLimit,
bool whiteListFlag,
uint256[] memory starsProbability,
uint256[] memory powerProbability,
uint256[] memory partProbab... | 17,907 |
97 | // get total locked amount for a user/_user address/ return _totalAmountLocked uint256 | function getDepotEthLockedAmountForUser_V1(address _user)
public
view
returns (uint256 _totalAmountLocked)
| function getDepotEthLockedAmountForUser_V1(address _user)
public
view
returns (uint256 _totalAmountLocked)
| 8,039 |
47 | // Hook for leaving the pool that must be called from the vault./It burns a proportional number of tokens compared to current LP pool,/based on the minium output the user wants./poolId The balancer pool id, checked to ensure non erroneous vault call/sender The address which is the source of the LP tokenrecipient Unused... | function onExitPool(
bytes32 poolId,
address sender,
address,
uint256[] memory currentBalances,
uint256,
uint256 protocolSwapFee,
bytes calldata userData
)
external
| function onExitPool(
bytes32 poolId,
address sender,
address,
uint256[] memory currentBalances,
uint256,
uint256 protocolSwapFee,
bytes calldata userData
)
external
| 54,407 |
44 | // owner is automatically whitelisted | addAddressToWhitelist(msg.sender);
| addAddressToWhitelist(msg.sender);
| 33,481 |
188 | // Sender must be elected transcoder for job | require(job.transcoderAddress == msg.sender);
| require(job.transcoderAddress == msg.sender);
| 30,489 |
34 | // extract the original sender | address signer = signedMessageHash.recover(signature);
require(_proposer == signer, "CLAMP: NOT PROPOSER");
require(_targets.length == _signatures.length && _targets.length == calldatas.length && _targets.length <= 8,
"CLAMP: MORE THAN 8 FUNCTION CALLS NOT ALLOWED");
| address signer = signedMessageHash.recover(signature);
require(_proposer == signer, "CLAMP: NOT PROPOSER");
require(_targets.length == _signatures.length && _targets.length == calldatas.length && _targets.length <= 8,
"CLAMP: MORE THAN 8 FUNCTION CALLS NOT ALLOWED");
| 16,512 |
12 | // The counter starts at one to prevent changing it from zero to a non-zero value, which is a more expensive operation. | _guardCounter = 1;
| _guardCounter = 1;
| 11,315 |
63 | // Implementation of revoke an invalid address from the whitelist. removeAddress revoked address. / | function removeWhiteList(address removeAddress)public onlyOwner returns (bool){
addressPermission[removeAddress] = 0;
return whiteList.removeWhiteListAddress(removeAddress);
}
| function removeWhiteList(address removeAddress)public onlyOwner returns (bool){
addressPermission[removeAddress] = 0;
return whiteList.removeWhiteListAddress(removeAddress);
}
| 24,300 |
108 | // This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.- If `to` ref... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 34,526 |
27 | // Return the wad price of token0/token1, multiplied by 1e18/ NOTE: (if you have 1 token0 how much you can sell it for token1) | function getPrice(address token0, address token1)
external view
returns (uint256 price, uint256 lastUpdate);
| function getPrice(address token0, address token1)
external view
returns (uint256 price, uint256 lastUpdate);
| 41,956 |
1 | // Admin can freeze/unfreeze the contractReverts if sender is not the owner of contract _freeze Boolean valaue; true is used to freeze and false for unfreeze / | function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool) {
emergencyFreeze = _freeze;
emit EmerygencyFreezed(_freeze);
return true;
}
| function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool) {
emergencyFreeze = _freeze;
emit EmerygencyFreezed(_freeze);
return true;
}
| 5,017 |
70 | // Minting Function/The receive() function is an external, payable, and non-reentrant function for logging membership and minting the buddy pass token (DCA). It requires that the "Minting Phase" is active, and that the incoming value (msg.value) is greater than or equal to the current rate (getCurrentRate()). If the in... | receive() external payable nonReentrant {
require(isActive(), "Minting Phase is over.");
uint256 current_rate = getCurrentRate();
require(msg.value >=current_rate, "Amount must be equal to the current rate.");
uint256 this_tranche = CURRENT_TRANCHE;
RATE_TRANCHE_COUNT[CURREN... | receive() external payable nonReentrant {
require(isActive(), "Minting Phase is over.");
uint256 current_rate = getCurrentRate();
require(msg.value >=current_rate, "Amount must be equal to the current rate.");
uint256 this_tranche = CURRENT_TRANCHE;
RATE_TRANCHE_COUNT[CURREN... | 26,457 |
295 | // Internal method to authorize a mint. Redeems mint passes._amount - Amount of mints to authorize / | function _authorizeMint(uint256 _amount) internal override {
mintPass.redeem(mintPassId, msg.sender, _amount);
}
| function _authorizeMint(uint256 _amount) internal override {
mintPass.redeem(mintPassId, msg.sender, _amount);
}
| 64,647 |
109 | // Calculate the alpha-score for the handler (in token amount)_alpha The alpha parameter_depositAmount The total amount of deposit_borrowAmount The total amount of borrow return The alpha-score of the handler (in token amount)/ | function _calcAlphaBaseAmount(uint256 _alpha, uint256 _depositAmount, uint256 _borrowAmount) internal pure returns (uint256)
| function _calcAlphaBaseAmount(uint256 _alpha, uint256 _depositAmount, uint256 _borrowAmount) internal pure returns (uint256)
| 36,557 |
17 | // implementation setters do an existence check, but we protect against selfdestructs this way | require(Address.isContract(target), "TARGET_NOT_CONTRACT");
return target;
| require(Address.isContract(target), "TARGET_NOT_CONTRACT");
return target;
| 33,959 |
11 | // transfer token for a specified address _to The address to transfer to. _value The amount to be transferred. / | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = bal... | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = bal... | 17,745 |
189 | // Gets latest cumulative holders reward for the passed Property. / | uint256 cHoldersReward = _calculateCumulativeHoldersRewardAmount(
_prices.holders,
_property
);
| uint256 cHoldersReward = _calculateCumulativeHoldersRewardAmount(
_prices.holders,
_property
);
| 2,703 |
11 | // Transfer token for a specified address_to The address to transfer to._value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
... | function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
... | 4,141 |
38 | // Total amount of tokens claimed so far while the HODL period/ | uint256 public claimedTokens;
| uint256 public claimedTokens;
| 21,474 |
17 | // Getter for the total_supply of oracle tokensreturn uint total supply / | function totalSupply() external view returns (uint256) {
return uints[_TOTAL_SUPPLY];
}
| function totalSupply() external view returns (uint256) {
return uints[_TOTAL_SUPPLY];
}
| 50,944 |
1 | // check that msg.sender is an investor | require(
self.list[_fundNum].investors[msg.sender] == true,
"Message Sender is not an investor"
);
_;
| require(
self.list[_fundNum].investors[msg.sender] == true,
"Message Sender is not an investor"
);
_;
| 18,477 |
20 | // Allow _spender to withdraw from your account, multiple times, up to the _value amount.If this function is called again it overwrites the current allowance with _value. | function approve(address _spender, uint256 _amount)public returns (bool ok) {
require( _spender != 0x0);
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| function approve(address _spender, uint256 _amount)public returns (bool ok) {
require( _spender != 0x0);
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| 18,241 |
42 | // ----------------------------------------------------------------------------Mintable tokenSimple ERC20 Token example, with mintable token creation Based on code by TokenMarketNet: https:github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol -------------------------------------------------------------... | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() { require(!mintingFinished); _; }
modifier cannotMint() { require(mintingFinished); _; }
function mint(address _to, ... | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() { require(!mintingFinished); _; }
modifier cannotMint() { require(mintingFinished); _; }
function mint(address _to, ... | 24,986 |
46 | // Calculates the rewardPerBlock of the pool This function is only callable by owner. / | function poolCalcRewardPerBlock() public onlyOwner {
uint256 rewardBal = rewardToken.balanceOf(address(this)).sub(
totalStaked
);
rewardPerBlock = rewardBal.div(rewardDuration());
}
| function poolCalcRewardPerBlock() public onlyOwner {
uint256 rewardBal = rewardToken.balanceOf(address(this)).sub(
totalStaked
);
rewardPerBlock = rewardBal.div(rewardDuration());
}
| 2,735 |
29 | // if the bidder is the only one then refund by vickrey rule | if (entry.value == 0) {
portalNetworkToken.transferBackToOwner(entry.owner, entry.highestBid - protocolEntry.minPrice, _protocol);
} else if (entry.value > 0 && entry.highestBid > entry.value) {
| if (entry.value == 0) {
portalNetworkToken.transferBackToOwner(entry.owner, entry.highestBid - protocolEntry.minPrice, _protocol);
} else if (entry.value > 0 && entry.highestBid > entry.value) {
| 41,752 |
15 | // @inheritdoc IERC1155721Inventory | function transferFrom(
address from,
address to,
uint256 nftId
| function transferFrom(
address from,
address to,
uint256 nftId
| 51,231 |
266 | // We're dealing with a leaf node. We'll modify the key and insert the old leaf node into the branch index. | TrieNode memory modifiedLastNode = _makeLeafNode(
lastNodeKey,
_getNodeValue(lastNode)
);
newBranch = _editBranchIndex(
newBranch,
branchKey,
... | TrieNode memory modifiedLastNode = _makeLeafNode(
lastNodeKey,
_getNodeValue(lastNode)
);
newBranch = _editBranchIndex(
newBranch,
branchKey,
... | 71,654 |
113 | // Get minimum of _amount and _collateralBalance | return _withdrawHere(_amount < _collateralBalance ? _amount : _collateralBalance);
| return _withdrawHere(_amount < _collateralBalance ? _amount : _collateralBalance);
| 5,784 |
171 | // Called by the node to fulfill requests_proof the proof of randomness. Actual random output built from this / | function fulfillRandomnessRequest(bytes memory _proof) public {
(bytes32 currentKeyHash, Callback memory callback, bytes32 requestId, uint256 randomness) =
getRandomnessFromProof(_proof);
// Pay oracle
address payable oracle = serviceAgreements[currentKeyHash].vOROracle;
... | function fulfillRandomnessRequest(bytes memory _proof) public {
(bytes32 currentKeyHash, Callback memory callback, bytes32 requestId, uint256 randomness) =
getRandomnessFromProof(_proof);
// Pay oracle
address payable oracle = serviceAgreements[currentKeyHash].vOROracle;
... | 26,425 |
18 | // cap above which the crowdsale is ended | uint256 public cap;
uint256 public tokensLeft;
uint256 public tokensBought;
uint256 public minInvestment;
uint256 public rate;
bool public isFinalized ;
| uint256 public cap;
uint256 public tokensLeft;
uint256 public tokensBought;
uint256 public minInvestment;
uint256 public rate;
bool public isFinalized ;
| 5,810 |
5 | // Creates a new HTLC, locking the tokens and marking its hash as active. / | function create (IERC20 token, address to, uint256 value,
uint endtime, bytes20 hash)
external override returns (bytes32)
| function create (IERC20 token, address to, uint256 value,
uint endtime, bytes20 hash)
external override returns (bytes32)
| 28,863 |
194 | // Get the times loyalty has been claimed _loyaltyAddress of accountreturn (uint256) indicating total time claimed / | function getTimesClaimed(address _loyaltyAddress)
| function getTimesClaimed(address _loyaltyAddress)
| 56,661 |
11 | // 3200 ~ 6699 | return 0.16 ether;
| return 0.16 ether;
| 11,995 |
323 | // Mint a token and create a vote in the same transaction to test snapshot block values are correct | function newTokenAndVote(address _holder, uint256 _tokenAmount, string _metadata)
external
returns (uint256 voteId)
| function newTokenAndVote(address _holder, uint256 _tokenAmount, string _metadata)
external
returns (uint256 voteId)
| 46,448 |
43 | // PRIVATE + INTERNAL FUNCTIONS |
function _baseURI()
internal
view
virtual
override
|
function _baseURI()
internal
view
virtual
override
| 13,198 |
13 | // 6. check if we met the min leverage conditions | require(_getTroveCR(address(acct)) >= minExpectedCollateralRatio, "min cr not met");
| require(_getTroveCR(address(acct)) >= minExpectedCollateralRatio, "min cr not met");
| 1,556 |
77 | // Set the proxy's implementation to be a ProxyUpdater. Updaters ensure that only the SphinxManager can interact with a proxy that is in the process of being updated. Note that we use the Updater contract to provide a generic interface for updating a variety of proxy types. Note no adapter is necessary for non-proxied ... | (bool success, ) = adapter.delegatecall(
abi.encodeCall(IProxyAdapter.initiateUpgrade, (target.addr))
);
if (!success) {
revert FailedToInitiateUpgrade();
}
| (bool success, ) = adapter.delegatecall(
abi.encodeCall(IProxyAdapter.initiateUpgrade, (target.addr))
);
if (!success) {
revert FailedToInitiateUpgrade();
}
| 34,300 |
0 | // Constructor vars | address borrowerAddress;
uint public loanAmount;
uint public fundRaisingDeadline;
uint public repaymentDeadline;
uint public minimumTransactionAmount;
| address borrowerAddress;
uint public loanAmount;
uint public fundRaisingDeadline;
uint public repaymentDeadline;
uint public minimumTransactionAmount;
| 49,444 |
2 | // Convert a string type to a bytes32 type _strIn a string / | function stringToBytes32(string memory _strIn) external pure returns (bytes32 result);
| function stringToBytes32(string memory _strIn) external pure returns (bytes32 result);
| 20,293 |
64 | // Internal. -----------------------/ Receives random values and stores them with your contract. See [1]. requestId uint256 Request id to Chainlink's VRFv2 oracle. randomWords uint256[] Requested random wordss associated to `requestId`. / | function fulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
| function fulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
| 430 |
1,348 | // Helper to parse the total amount of network fees (in ETH) for the multiSwap() call | function __calcTotalNetworkFees(IParaSwapAugustusSwapper.Path[] memory _paths)
private
pure
returns (uint256 totalNetworkFees_)
{
for (uint256 i; i < _paths.length; i++) {
totalNetworkFees_ = totalNetworkFees_.add(_paths[i].totalNetworkFee);
}
| function __calcTotalNetworkFees(IParaSwapAugustusSwapper.Path[] memory _paths)
private
pure
returns (uint256 totalNetworkFees_)
{
for (uint256 i; i < _paths.length; i++) {
totalNetworkFees_ = totalNetworkFees_.add(_paths[i].totalNetworkFee);
}
| 83,242 |
104 | // NOTE: this doesn't sanitize inputs -> inaccurate values may be returned if there are duplicates tokens input | function queryFees(address[] calldata tokens, FeeClaimType feeType)
external
view
returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid);
function priceFeeds() external view returns (address);
function swapsImpl() external view returns (address);
function logicTa... | function queryFees(address[] calldata tokens, FeeClaimType feeType)
external
view
returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid);
function priceFeeds() external view returns (address);
function swapsImpl() external view returns (address);
function logicTa... | 44,416 |
38 | // Jungle Serum/delta devs (https:twitter.com/deltadevelopers)/Inspired by BoredApeChemistryClub.sol (https:etherscan.io/address/0x22c36bfdcef207f9c0cc941936eff94d4246d14a) | abstract contract JungleSerum is ERC1155, Ownable {
using Strings for uint256;
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted by `breed` function.
/// @dev Even... | abstract contract JungleSerum is ERC1155, Ownable {
using Strings for uint256;
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted by `breed` function.
/// @dev Even... | 22,398 |
6 | // burnTo exits a staking position such that all accumulated value/ is transferred to a specified account on burn | function burnTo(address to_, uint256 tokenID_)
public
override
onlyValidatorPool
returns (uint256 payoutEth, uint256 payoutMadToken)
| function burnTo(address to_, uint256 tokenID_)
public
override
onlyValidatorPool
returns (uint256 payoutEth, uint256 payoutMadToken)
| 40,512 |
20 | // Assigned EToken2, immutable. | EToken2Interface public etoken2;
| EToken2Interface public etoken2;
| 37,405 |
97 | // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, it is recommended to avoid using short time durations (less than a minute). Typical vesting schem... |
using SafeMath for uint256;
using SafeERC20 for IERC20;
uint256 private constant RELEASE_INTERVAL = 1 weeks;
event TokensReleased(address token, uint256 amount);
event TokenVestingRevoked(address token);
|
using SafeMath for uint256;
using SafeERC20 for IERC20;
uint256 private constant RELEASE_INTERVAL = 1 weeks;
event TokensReleased(address token, uint256 amount);
event TokenVestingRevoked(address token);
| 13,038 |
422 | // Get the amount of each underlying token in each NFT | midInputs.sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickLower);
midInputs.sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickUpper);
| midInputs.sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickLower);
midInputs.sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickUpper);
| 30,540 |
22 | // modifier to support permission control | modifier actionAuth(uint16 _category, string _name) {
require(genesisOrganization.existed(msg.sender), "not allowed");
require(categories[_category].exist, "category not existed");
require(categories[_category].templates[_name].exist, "template not existed");
_;
}
| modifier actionAuth(uint16 _category, string _name) {
require(genesisOrganization.existed(msg.sender), "not allowed");
require(categories[_category].exist, "category not existed");
require(categories[_category].templates[_name].exist, "template not existed");
_;
}
| 37,758 |
43 | // Set Fee for Sells | if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell.sub(_marketingAddress.balance);
}
| if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell.sub(_marketingAddress.balance);
}
| 17,279 |
120 | // Allow End to yank auctions in ilk Flipper | authorize(_flip, _end);
| authorize(_flip, _end);
| 3,197 |
1 | // Add structs for comments and replies | struct Comment {
uint256 id;
uint256 articleId;
address creator;
uint256 timestamp;
string content;
int256 voteCount;
}
| struct Comment {
uint256 id;
uint256 articleId;
address creator;
uint256 timestamp;
string content;
int256 voteCount;
}
| 16,609 |
34 | // Properties | bool public transferable = false;
mapping (address => bool) public whitelistedTransfer;
| bool public transferable = false;
mapping (address => bool) public whitelistedTransfer;
| 8,922 |
276 | // Applies calculated slots of gen 2 eligibility to reduce gas | function applySlots(uint256[] calldata slotIndices, uint256[] calldata slotValues) external onlyOwner {
for (uint i = 0; i < slotIndices.length; i++) {
uint slotIndex = slotIndices[i];
uint slotValue = slotValues[i];
if (slotIndex >= _cubEligibility.length) {
... | function applySlots(uint256[] calldata slotIndices, uint256[] calldata slotValues) external onlyOwner {
for (uint i = 0; i < slotIndices.length; i++) {
uint slotIndex = slotIndices[i];
uint slotValue = slotValues[i];
if (slotIndex >= _cubEligibility.length) {
... | 14,097 |
10 | // very loose interpretation of some admin and price oracle functionality for helping unit tests, not really in the money market interface / | function _addToken(address tokenAddress, uint priceInWeth) public {
for (uint i = 0; i < collateralMarkets.length; i++) {
if (collateralMarkets[i] == tokenAddress) {
return;
}
}
collateralMarkets.push(tokenAddress);
fakePriceOracle[tokenAddress] = priceInWeth;
}
| function _addToken(address tokenAddress, uint priceInWeth) public {
for (uint i = 0; i < collateralMarkets.length; i++) {
if (collateralMarkets[i] == tokenAddress) {
return;
}
}
collateralMarkets.push(tokenAddress);
fakePriceOracle[tokenAddress] = priceInWeth;
}
| 41,478 |
247 | // Keep a track of the number of tokens per address | mapping(address => uint256) nftsPerWalletPresale;
mapping(address => uint256) nftsPerWalletWhitelist;
mapping(address => uint256) nftsPerWallet;
| mapping(address => uint256) nftsPerWalletPresale;
mapping(address => uint256) nftsPerWalletWhitelist;
mapping(address => uint256) nftsPerWallet;
| 19,720 |
10 | // claim an nftrequires msg.sender has not been registered as a claimer of the requested nft in claimersrequires there is a supply of the requested nft left in this contract _nftAddress - the type of token the sender wants to claim / | function claim(address _nftAddress) public {
// require !claimedBy
require(claimedBy(msg.sender, _nftAddress) == false, "This wallet has already claimed this item.");
// require currentSupply > 0
require(getCurrentSupply(_nftAddress) > 0, "No NFT of this type available at th... | function claim(address _nftAddress) public {
// require !claimedBy
require(claimedBy(msg.sender, _nftAddress) == false, "This wallet has already claimed this item.");
// require currentSupply > 0
require(getCurrentSupply(_nftAddress) > 0, "No NFT of this type available at th... | 10,003 |
34 | // UseSafeMath One can use SafeMath for not only uint256 but also uin64 or uint16,and also can use SafeCast for uint256.For example:uint64 a = 1;uint64 b = 2;In addition, one can use SignedSafeMath and SafeCast.toUint256(int256) for int256.In the case of the operation to the uint64 value, one needs to cast the value in... | abstract contract UseSafeMath {
using SafeMath for uint256;
using SafeMathDivRoundUp for uint256;
using SafeMath for uint64;
using SafeMathDivRoundUp for uint64;
using SafeMath for uint16;
using SignedSafeMath for int256;
using SafeCast for uint256;
using SafeCast for int256;
}
| abstract contract UseSafeMath {
using SafeMath for uint256;
using SafeMathDivRoundUp for uint256;
using SafeMath for uint64;
using SafeMathDivRoundUp for uint64;
using SafeMath for uint16;
using SignedSafeMath for int256;
using SafeCast for uint256;
using SafeCast for int256;
}
| 5,283 |
7 | // Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. | function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 1,426 |
42 | // Internal function to check if a drop can be minted. to The address to which the minted tokens will be sent. tokenId The ID of the token to mint. quantity The quantity of tokens to mint. / | function _checkMintable(
address to,
uint256 tokenId,
uint256 quantity
)
internal
view
| function _checkMintable(
address to,
uint256 tokenId,
uint256 quantity
)
internal
view
| 762 |
8 | // Returns an array of boost IDs representing all the boosts for the specified team staked by the caller._staketeam The team ID whose boost IDs are being returned. return _TeamBoostRate An Staked team boost rate./ | function getBoostsRate(address player, uint16 _staketeam) public view returns(uint256 _TeamBoostRate){
return _getTeamBoostRate(player, _staketeam);
}
| function getBoostsRate(address player, uint16 _staketeam) public view returns(uint256 _TeamBoostRate){
return _getTeamBoostRate(player, _staketeam);
}
| 7,948 |
70 | // Release the tokens that have already vested. | * Emits a {TokensReleased} event.
*/
function release(address token) public virtual {
uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token);
_erc20Released[token] += releasable;
emit ERC20Released(token, releasable);
SafeERC20.safeTransfer(IERC... | * Emits a {TokensReleased} event.
*/
function release(address token) public virtual {
uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token);
_erc20Released[token] += releasable;
emit ERC20Released(token, releasable);
SafeERC20.safeTransfer(IERC... | 17,348 |
6 | // Register player's address | players[msg.sender] = true;
| players[msg.sender] = true;
| 4,568 |
221 | // Get total number of versions for a service type _serviceType - type of service / | function getNumberOfVersions(bytes32 _serviceType)
external view returns (uint256)
| function getNumberOfVersions(bytes32 _serviceType)
external view returns (uint256)
| 38,392 |
8 | // Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenI... | function approve(address to, uint tokenId) external;
| function approve(address to, uint tokenId) external;
| 25,800 |
93 | // the Stake | struct Stake {
// opening timestamp
uint256 startDate;
// amount staked
uint256 amount;
// interest accrued, this will be available only after closing stake
uint256 interest;
// penalty charged, if any
uint256 penalty;
// closing timestamp
uint256 ... | struct Stake {
// opening timestamp
uint256 startDate;
// amount staked
uint256 amount;
// interest accrued, this will be available only after closing stake
uint256 interest;
// penalty charged, if any
uint256 penalty;
// closing timestamp
uint256 ... | 36,231 |
127 | // RetrieveData - Returns stored value by given key _date Daily unix timestamp of key storing value (GMT 00:00:00)/ | function retrieveData(uint _date) public constant returns (uint) {
QueryInfo storage currentQuery = info[queryIds[_date]];
return currentQuery.value;
}
| function retrieveData(uint _date) public constant returns (uint) {
QueryInfo storage currentQuery = info[queryIds[_date]];
return currentQuery.value;
}
| 57,591 |
25 | // The percentage of the current reward to be given in an epoch to be routed to the treasury | uint256 public multiSigRewardShare;
| uint256 public multiSigRewardShare;
| 37,907 |
63 | // user stakes | mapping(address => StakeDetail[]) public userStakesOf;
| mapping(address => StakeDetail[]) public userStakesOf;
| 46,174 |
59 | // Adds a new IdeaTokentokenName The name of the new token marketID The ID of the market where the new token will be added return The address of the new IdeaToken / | function addTokenInternal(string memory tokenName, uint marketID) internal returns (address) {
IIdeaTokenFactory factory = _ideaTokenFactory;
factory.addToken(tokenName, marketID, msg.sender);
return address(factory.getTokenInfo(marketID, factory.getTokenIDByName(tokenName, marketID) ).ide... | function addTokenInternal(string memory tokenName, uint marketID) internal returns (address) {
IIdeaTokenFactory factory = _ideaTokenFactory;
factory.addToken(tokenName, marketID, msg.sender);
return address(factory.getTokenInfo(marketID, factory.getTokenIDByName(tokenName, marketID) ).ide... | 58,317 |
0 | // Lookup engine interface / | interface IRoyaltyEngineV1 is IERC165Upgradeable {
/**
* Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address
*
* @param tokenAddress - The address of the token
* @param tokenId - The id of the token
... | interface IRoyaltyEngineV1 is IERC165Upgradeable {
/**
* Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address
*
* @param tokenAddress - The address of the token
* @param tokenId - The id of the token
... | 31,928 |
0 | // _daoBase – DAO where proposal was created. _proposal – proposal, which create vote. _origin – who create voting (group member). _minutesToVote - if is zero -> voting until quorum reached, else voting finish after minutesToVote minutes _quorumPercent - percent of group members to make quorum reached. If minutesToVote... | constructor(IDaoBase _daoBase, IProposal _proposal,
address _origin, VotingLib.VotingType _votingType,
uint _minutesToVote, string _groupName,
uint _quorumPercent, uint _consensusPercent,
address _tokenAddress) public
| constructor(IDaoBase _daoBase, IProposal _proposal,
address _origin, VotingLib.VotingType _votingType,
uint _minutesToVote, string _groupName,
uint _quorumPercent, uint _consensusPercent,
address _tokenAddress) public
| 44,549 |
67 | // Skip this trove if ICR is greater than MCR and Stability Pool is empty | if (vars.ICR >= MCR && vars.remainingLUSDInStabPool == 0) { continue; }
| if (vars.ICR >= MCR && vars.remainingLUSDInStabPool == 0) { continue; }
| 28,522 |
29 | // set "message of the day" | function setMotd(string _m) onlyOwner {
motd = _m;
Motd(_m);
}
| function setMotd(string _m) onlyOwner {
motd = _m;
Motd(_m);
}
| 34,163 |
21 | // we've landed on an uninitialized tick, keep searching higher (more recently) | if (!beforeOrAt.initialized) {
l = i + 1;
continue;
}
| if (!beforeOrAt.initialized) {
l = i + 1;
continue;
}
| 21,702 |
17 | // Deposits tokens in proportion to the Optimizer's current ticks. amount0Desired Max amount of token0 to deposit amount1Desired Max amount of token1 to deposit to address that plp should be transferedreturn shares mintedreturn amount0 Amount of token0 depositedreturn amount1 Amount of token1 deposited / | function deposit(uint256 amount0Desired, uint256 amount1Desired, address to) external returns (uint256 shares, uint256 amount0,uint256 amount1);
| function deposit(uint256 amount0Desired, uint256 amount1Desired, address to) external returns (uint256 shares, uint256 amount0,uint256 amount1);
| 38,106 |
88 | // payable | function () payable public {
require(saleOpened);
require(now <= saleDeadline);
require(MIN_ETHER <= msg.value);
uint amount = msg.value;
uint curBonusRate = getCurrentBonusRate();
uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE);
... | function () payable public {
require(saleOpened);
require(now <= saleDeadline);
require(MIN_ETHER <= msg.value);
uint amount = msg.value;
uint curBonusRate = getCurrentBonusRate();
uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE);
... | 49,823 |
170 | // used to view the current reward pool | function rewardPool() external view onlyOwner() returns(uint claimable) {
return (IERC20(mtFinance).balanceOf(address(this))).sub(totalStaked);
}
| function rewardPool() external view onlyOwner() returns(uint claimable) {
return (IERC20(mtFinance).balanceOf(address(this))).sub(totalStaked);
}
| 12,756 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.