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 |
|---|---|---|---|---|
4 | // The JOY Token | IERC20Upgradeable public govToken;
| IERC20Upgradeable public govToken;
| 65,681 |
683 | // Get numerator | uint256 numerator = block.timestamp <= numeratorSwapTime ? 4 : 6;
| uint256 numerator = block.timestamp <= numeratorSwapTime ? 4 : 6;
| 49,467 |
20 | // approved beneficiary flag defines whether someone can recieve | if (_value > 0) {
attributes[_account] |= LIQUIDATOR_CAN_RECEIVE;
} else {
| if (_value > 0) {
attributes[_account] |= LIQUIDATOR_CAN_RECEIVE;
} else {
| 34,866 |
132 | // USDC/Compound | pool = ISaffronPool(pools[12]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[12]) > 0) pool.hourly_strategy(adapters[4]);
| pool = ISaffronPool(pools[12]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[12]) > 0) pool.hourly_strategy(adapters[4]);
| 19,423 |
100 | // Throws if called by any account other than the Admin. / | modifier onlyAdmin() {
require(
_admins[_msgSender()] || _msgSender() == owner(),
"Caller does not have Admin Access"
);
_;
}
| modifier onlyAdmin() {
require(
_admins[_msgSender()] || _msgSender() == owner(),
"Caller does not have Admin Access"
);
_;
}
| 24,561 |
210 | // oldDescriptionURI | _getBaseDescriptionURI(),
| _getBaseDescriptionURI(),
| 19,919 |
64 | // Calculate and mint the amount of xRigel the Rigel is worth. The ratio will change overtime, as xRigel is burned/minted and Rigel deposited + gained from fees / withdrawn. | else {
uint256 what = _amount.mul(totalShares).div(totalRigel);
_mint(msg.sender, what);
}
| else {
uint256 what = _amount.mul(totalShares).div(totalRigel);
_mint(msg.sender, what);
}
| 25,277 |
38 | // Transfers the LP tokens out | IERC20Upgradeable(_lps[i]).safeTransfer(msg.sender, _lpAmounts[i]);
| IERC20Upgradeable(_lps[i]).safeTransfer(msg.sender, _lpAmounts[i]);
| 5,515 |
187 | // Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 144 |
6 | // Mapping of messageId to gas limit | mapping(bytes32 => uint256) public messageGasLimit;
| mapping(bytes32 => uint256) public messageGasLimit;
| 32,537 |
233 | // Interface for REWARDS_VAULTINHERITANCE: / | interface REWARDS_VAULT_Interface {
function payRewards(uint256 _tokenId, uint256 _amount) external;
}
| interface REWARDS_VAULT_Interface {
function payRewards(uint256 _tokenId, uint256 _amount) external;
}
| 32,850 |
213 | // See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least`amount`. / | function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
| function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
| 52,596 |
121 | // Update pool infos with old reward rate before setting new one first | for (uint i = 0; i < poolInfo.length; i++) {
PoolInfo storage pool = poolInfo[i];
if (block.number <= pool.lastRewardBlock) {
continue;
}
| for (uint i = 0; i < poolInfo.length; i++) {
PoolInfo storage pool = poolInfo[i];
if (block.number <= pool.lastRewardBlock) {
continue;
}
| 34,747 |
242 | // Pull the Collateral Asset from the CollateralLocker, swap to the Liquidity Asset, and hold custody of the resulting Liquidity Asset in the Loan. | (amountLiquidated, amountRecovered) = LoanLib.liquidateCollateral(collateralAsset, address(liquidityAsset), superFactory, collateralLocker);
_emitBalanceUpdateEventForCollateralLocker();
| (amountLiquidated, amountRecovered) = LoanLib.liquidateCollateral(collateralAsset, address(liquidityAsset), superFactory, collateralLocker);
_emitBalanceUpdateEventForCollateralLocker();
| 6,419 |
393 | // Emitted when ARTT is distributed to a supplier | event DistributedSupplierArtem(AToken indexed aToken, address indexed supplier, uint artemDelta, uint artemSupplyIndex);
| event DistributedSupplierArtem(AToken indexed aToken, address indexed supplier, uint artemDelta, uint artemSupplyIndex);
| 17,047 |
0 | // Possible states for an operation in this timelock contract | enum OperationState {
Unknown,
Scheduled,
ReadyForExecution,
Executed
}
| enum OperationState {
Unknown,
Scheduled,
ReadyForExecution,
Executed
}
| 1,696 |
0 | // constructor(<other arguments>, address _vrfCoordinator, address _link) | * @dev VRFConsumerBase(_vrfCoordinator) public {
* @dev <initialization with other arguments goes here>
* @dev }
| * @dev VRFConsumerBase(_vrfCoordinator) public {
* @dev <initialization with other arguments goes here>
* @dev }
| 34,542 |
9 | // Panic strategy | function panic() external;
| function panic() external;
| 36,448 |
380 | // Allows the sender to purchase tokens by providing payment tokens. paymentToken_ The address of the payment token. quantity_ The quantity of tokens to purchase. / | function buy(address paymentToken_, uint256 quantity_) external payable override nonReentrant {
address sender = _msgSender();
uint256 amount = _paymentAmount[paymentToken_];
uint256 tokenId = _idCounter;
unchecked {
if (tokenId + quantity_ - 1 > MAX_SUPLLY) revert BoiCh... | function buy(address paymentToken_, uint256 quantity_) external payable override nonReentrant {
address sender = _msgSender();
uint256 amount = _paymentAmount[paymentToken_];
uint256 tokenId = _idCounter;
unchecked {
if (tokenId + quantity_ - 1 > MAX_SUPLLY) revert BoiCh... | 40,035 |
25 | // Approve a new miner split minerAddress Address of miner splitTo Address that receives split splitPct % of tip that splitTo receives salt salt / | function approveNewMinerSplit(
address minerAddress,
address splitTo,
uint32 splitPct,
bytes32 salt
| function approveNewMinerSplit(
address minerAddress,
address splitTo,
uint32 splitPct,
bytes32 salt
| 43,711 |
4 | // Sends multiple tokens to a single address _tokenID The address to receive the tokens _address The address to receive the tokens _quantity How many to send she receiver / | function batchMint(
uint256 _tokenID,
address _address,
uint256 _quantity
| function batchMint(
uint256 _tokenID,
address _address,
uint256 _quantity
| 23,337 |
16 | // calculate the original amount of tokens this account got | uint256 userOriginalBalance = _securityToken
.balanceOfByPartition(partition, from)
| uint256 userOriginalBalance = _securityToken
.balanceOfByPartition(partition, from)
| 33,172 |
6 | // Updates the liquidity cumulative index and the variable borrow index. reserve the reserve object / | function updateState(DataTypes.ReserveData storage reserve) internal {
uint256 scaledVariableDebt =
IVariableDebtToken(reserve.variableDebtTokenAddress).scaledTotalSupply();
uint256 previousVariableBorrowIndex = reserve.variableBorrowIndex;
uint256 previousLiquidityIndex = reserve.liquidityIndex;
... | function updateState(DataTypes.ReserveData storage reserve) internal {
uint256 scaledVariableDebt =
IVariableDebtToken(reserve.variableDebtTokenAddress).scaledTotalSupply();
uint256 previousVariableBorrowIndex = reserve.variableBorrowIndex;
uint256 previousLiquidityIndex = reserve.liquidityIndex;
... | 33,949 |
22 | // according to AssetToken's total supply, never overflow here | if (balanceOf[msg.sender] >= _amount
&& _amount > 0) {
balanceOf[msg.sender] -= uint112(_amount);
balanceOf[_to] = _amount.add(balanceOf[_to]).toUINT112();
soldToken = _amount.add(soldToken).toUINT112();
Transfer(msg.sender, _to, _amount);
... | if (balanceOf[msg.sender] >= _amount
&& _amount > 0) {
balanceOf[msg.sender] -= uint112(_amount);
balanceOf[_to] = _amount.add(balanceOf[_to]).toUINT112();
soldToken = _amount.add(soldToken).toUINT112();
Transfer(msg.sender, _to, _amount);
... | 26,450 |
2 | // Struct for storing cached currency whitelist. | struct WhitelistedCurrency {
bool isWhitelisted; // True if the currency is whitelisted.
uint256 finalFee; // Final fee of the currency.
}
| struct WhitelistedCurrency {
bool isWhitelisted; // True if the currency is whitelisted.
uint256 finalFee; // Final fee of the currency.
}
| 30,340 |
41 | // calculate reward | uint256 reward = PRBMathUD60x18.mul(percentOfTotal, _lastTaxPool);
| uint256 reward = PRBMathUD60x18.mul(percentOfTotal, _lastTaxPool);
| 12,764 |
25 | // 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));
checkUsers(msg.sender, _to);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
... | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
checkUsers(msg.sender, _to);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 9,474 |
0 | // Define the Turk token contract | constructor(IERC20 _turk) public {
turk = _turk;
}
| constructor(IERC20 _turk) public {
turk = _turk;
}
| 42,222 |
51 | // constants defining roles for access control | string public constant ROLE_ADMIN = "admin";
string public constant ROLE_BACKEND = "backend";
string public constant ROLE_KYC_VERIFIED_INVESTOR = "kycVerified";
| string public constant ROLE_ADMIN = "admin";
string public constant ROLE_BACKEND = "backend";
string public constant ROLE_KYC_VERIFIED_INVESTOR = "kycVerified";
| 57,868 |
55 | // If execution failed, | require(success, 'Execution failed');
| require(success, 'Execution failed');
| 72,177 |
113 | // return the amount of wei raised. / | function weiRaised() public view returns (uint256) {
return _weiRaised;
}
| function weiRaised() public view returns (uint256) {
return _weiRaised;
}
| 12,288 |
34 | // sets crowdsale address | function setFront ( address _front ) onlyOwner {
front = _front;
}
| function setFront ( address _front ) onlyOwner {
front = _front;
}
| 39,847 |
17 | // address => boolean to check if the address is a minter | mapping(address => bool) public isMinter;
mapping(address => bool) public isRouter;
event Minted(address to, uint256 amount);
event TaxFeeChanged(uint96 taxFee);
event CooldownTimeChanged(uint256 cooldownTime);
event StageChanged(Stages stage);
event CooldownSet(address addr, uint256 cooldown);
event T... | mapping(address => bool) public isMinter;
mapping(address => bool) public isRouter;
event Minted(address to, uint256 amount);
event TaxFeeChanged(uint96 taxFee);
event CooldownTimeChanged(uint256 cooldownTime);
event StageChanged(Stages stage);
event CooldownSet(address addr, uint256 cooldown);
event T... | 26,547 |
6 | // Check _pooledTokens and precisions parameter | require(numPooledTokens > Constants.MINIMUM_POOLED_TOKENS - 1, "_pooledTokens.length insufficient");
require(numPooledTokens < Constants.MAXIMUM_POOLED_TOKENS + 1, "_pooledTokens.length too large");
require(numPooledTokens == decimals.length, "_pooledTokens decimals mismatch");
uint256[] memory precisi... | require(numPooledTokens > Constants.MINIMUM_POOLED_TOKENS - 1, "_pooledTokens.length insufficient");
require(numPooledTokens < Constants.MAXIMUM_POOLED_TOKENS + 1, "_pooledTokens.length too large");
require(numPooledTokens == decimals.length, "_pooledTokens decimals mismatch");
uint256[] memory precisi... | 20,939 |
124 | // Check for zero transfer, and make sure it returns true to returnValue | function verifyTokenComplianceInternal(address token) internal {
bool returnValue = IERC20(token).transfer(msg.sender, 0);
require(returnValue, "ERR_NONCONFORMING_TOKEN");
}
| function verifyTokenComplianceInternal(address token) internal {
bool returnValue = IERC20(token).transfer(msg.sender, 0);
require(returnValue, "ERR_NONCONFORMING_TOKEN");
}
| 9,219 |
65 | // prelim. parameter checks | require(amount != 0, "Invalid amount");
| require(amount != 0, "Invalid amount");
| 41,225 |
15 | // Prevent the user from submitting the same bet again Send `_commission` to `owner` from the winner's prize_better The address of the sender _matchId The matchId to find the msg.sender's betting info _bettingPrice The betting price to find the msg.sender's betting info / | function checkDuplicateMatchId(address _better, uint256 _matchId, uint _bettingPrice) public view returns (bool) {
uint numOfBetterBettingInfo = betterBettingInfo[_better].length;
for (uint i = 0; i < numOfBetterBettingInfo; i++) {
if (betterBettingInfo[_better][i].matchId == _mat... | function checkDuplicateMatchId(address _better, uint256 _matchId, uint _bettingPrice) public view returns (bool) {
uint numOfBetterBettingInfo = betterBettingInfo[_better].length;
for (uint i = 0; i < numOfBetterBettingInfo; i++) {
if (betterBettingInfo[_better][i].matchId == _mat... | 24,463 |
0 | // ================================= only people with tokens | modifier onlybelievers () {
require(myTokens() > 0);
_;
}
| modifier onlybelievers () {
require(myTokens() > 0);
_;
}
| 38,182 |
131 | // Chances out of 1000 to mint a particular map piece. | uint[] public PIECES_CHANCES = [1, 5, 25, 40, 60, 80, 100, 150, 160, 180, 200];
uint constant public MAX_PIECES_PER_MINT = 20;
uint constant public MAX_TOTAL_SUPPLY = 10000;
uint constant public MAX_REDEEMS = 40;
uint constant public PRICE_PER_PIECE = 0.05 ether;
uint constant public TREASURE = 10 ether;
... | uint[] public PIECES_CHANCES = [1, 5, 25, 40, 60, 80, 100, 150, 160, 180, 200];
uint constant public MAX_PIECES_PER_MINT = 20;
uint constant public MAX_TOTAL_SUPPLY = 10000;
uint constant public MAX_REDEEMS = 40;
uint constant public PRICE_PER_PIECE = 0.05 ether;
uint constant public TREASURE = 10 ether;
... | 56,062 |
35 | // Token decimals | uint8 public constant DECIMALS = 18;
| uint8 public constant DECIMALS = 18;
| 22,664 |
3 | // 出于安全考虑,当调用到本合约中没有出现的 ACL Method 都会被拒绝 | revert("Unauthorized access");
| revert("Unauthorized access");
| 39,968 |
5 | // Set the allowance to the exact amount the user wants to transfer | require(token.approve(address(this), amount), "Token approval failed");
| require(token.approve(address(this), amount), "Token approval failed");
| 12,464 |
2 | // Rating supplied by the buyer (Step 3, optional). | uint ratingValue; // Seller rating supplied by buyer.
string ratingComment; // Comment on this transaction supplied by the buyer.
bool rated; // Flag that states this transaction has already been rated.
| uint ratingValue; // Seller rating supplied by buyer.
string ratingComment; // Comment on this transaction supplied by the buyer.
bool rated; // Flag that states this transaction has already been rated.
| 17,252 |
8 | // distribute 20% on TGE | amount = amount.add(vestingAmount.div(5));
| amount = amount.add(vestingAmount.div(5));
| 30,989 |
11 | // --- CALLER CONTRACT --- Contract stores the functions that interact with the protocols of MakerDao and Uniswap | contract CallerContract is HelperContract {
// Build DS Proxy for the CallerContract
function buildProxy() public NoExistingProxy {
prl.build();
proxy = prl.proxies(address(this)); // Safe proxy address to state variable
}
// Open CDP, lock some Eth and draw Dai
function openLockETH... | contract CallerContract is HelperContract {
// Build DS Proxy for the CallerContract
function buildProxy() public NoExistingProxy {
prl.build();
proxy = prl.proxies(address(this)); // Safe proxy address to state variable
}
// Open CDP, lock some Eth and draw Dai
function openLockETH... | 18,263 |
8 | // collaboration of update / consult | function expectedPrice(address token, uint256 amountIn)
external
view
returns (uint224 amountOut)
| function expectedPrice(address token, uint256 amountIn)
external
view
returns (uint224 amountOut)
| 27,837 |
43 | // A simple holder of tokens.This is a simple contract to hold tokens. It's useful in the case where a separate contractneeds to hold multiple distinct pools of the same token. / | contract TokenPool is Ownable {
IERC20 public token;
constructor(IERC20 _token) public {
token = _token;
}
function balance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function transfer(address to, uint256 value) external onlyOwner returns (bool)... | contract TokenPool is Ownable {
IERC20 public token;
constructor(IERC20 _token) public {
token = _token;
}
function balance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function transfer(address to, uint256 value) external onlyOwner returns (bool)... | 30,376 |
32 | // Stores STAKE ACCOUNT details of the USER | struct StakeAccount {
uint256 stakedAmount;
uint256 time;
uint256 interestRate;
bool unstaked;
}
| struct StakeAccount {
uint256 stakedAmount;
uint256 time;
uint256 interestRate;
bool unstaked;
}
| 11,122 |
50 | // WARNING //THIS CONTRACT IS UPGRADEABLE!//---------------------------------------------------------------------------------------------//Do NOT change the order of or PREPEND any storage variables to this or new versions of this//contract as this will cause the the storage slots to be overwritten on the proxy contrac... | contract Settings is SettingsInterface, TInitializable, Pausable, BaseUpgradeable {
using AddressLib for address;
using Address for address;
using AssetSettingsLib for AssetSettingsLib.AssetSettings;
using AddressArrayLib for address[];
using PlatformSettingsLib for PlatformSettingsLib.PlatformSetti... | contract Settings is SettingsInterface, TInitializable, Pausable, BaseUpgradeable {
using AddressLib for address;
using Address for address;
using AssetSettingsLib for AssetSettingsLib.AssetSettings;
using AddressArrayLib for address[];
using PlatformSettingsLib for PlatformSettingsLib.PlatformSetti... | 11,664 |
148 | // Adds a key-value pair to a map, or updates the value for an existingkey. O(1). Returns true if the key was added to the map, that is if it was notalready present. / | function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entr... | function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entr... | 6,973 |
85 | // So indexers can keep track of this | event Harvested(
uint256 profit,
uint256 loss,
uint256 debtPayment,
uint256 debtOutstanding
);
event UpdatedStrategist(address newStrategist);
event UpdatedKeeper(address newKeeper);
| event Harvested(
uint256 profit,
uint256 loss,
uint256 debtPayment,
uint256 debtOutstanding
);
event UpdatedStrategist(address newStrategist);
event UpdatedKeeper(address newKeeper);
| 13,541 |
30 | // EternalStorageProxy This proxy holds the storage of the token contract and delegates every call to the current implementation set.Besides, it allows to upgrade the token's behaviour towards further implementations, and provides basicauthorization control functionalities / | contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}
// File: contracts/DetailedToken.sol
contract DetailedToken{
string public name;
string public symbol;
uint8 public decimals;
}
| contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}
// File: contracts/DetailedToken.sol
contract DetailedToken{
string public name;
string public symbol;
uint8 public decimals;
}
| 66,458 |
5 | // Create a new instance of an app linked to this kernelCreate a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`_appId Identifier for app_appBase Address of the app's base implementation return AppProxy instance/ | function newAppInstance(bytes32 _appId, address _appBase)
public
auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
returns (ERCProxy appProxy)
| function newAppInstance(bytes32 _appId, address _appBase)
public
auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId))
returns (ERCProxy appProxy)
| 23,308 |
50 | // Fiefdoms/steviep.eth, julien.eth/ERC721 collection contract where ownership of a token grants the tooken holder ownership over a Fiefdom contract | contract Fiefdoms is ERC721, Ownable {
/// @notice License of Fiefdoms parent project - Does not pertain to the license of any tokens minted by Fiefdom contracts
string public license = 'CC0';
/// @notice Address that is permissioned to mint new tokens
address public minter;
/// @notice Address of the defau... | contract Fiefdoms is ERC721, Ownable {
/// @notice License of Fiefdoms parent project - Does not pertain to the license of any tokens minted by Fiefdom contracts
string public license = 'CC0';
/// @notice Address that is permissioned to mint new tokens
address public minter;
/// @notice Address of the defau... | 7,869 |
23 | // Changes Oracle variables. Admin role only. chainlinkToken_Address of Chainlink Token. oracle_Address of Oracle. jobId_Bytes32 representing Job ID. oraclePayment_Amount of LINK to be paid per request. / | function setupOracle(
address chainlinkToken_,
address oracle_,
bytes32 jobId_,
uint256 oraclePayment_
| function setupOracle(
address chainlinkToken_,
address oracle_,
bytes32 jobId_,
uint256 oraclePayment_
| 3,087 |
53 | // this function makes it so one can easily identify whether this contract has been deployed or not.deployment of this factory is done deterministically, so it will live at a well known address on every chain but the user may need to check whether or not this contract has been deployed yet on a given chain | function exists() public pure returns (bytes32) { //inject PUBLIC FUNC TO EXTERNAL
return 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef;
}
| function exists() public pure returns (bytes32) { //inject PUBLIC FUNC TO EXTERNAL
return 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef;
}
| 32,992 |
6 | // Claim rewards on behalf of a user and send them to a receiver Only callable by if sender is onBehalfOf or sender is approved claimer onBehalfOf The address to claim on behalf of receiver The address to receive the rewards forceUpdate Flag to retrieve latest rewards from `INCENTIVES_CONTROLLER` / | function claimRewardsOnBehalf(
| function claimRewardsOnBehalf(
| 9,171 |
20 | // Serializes a Token ID struct _tokenId The token id structreturn The formatted Token ID / | function formatTokenId(TokenId memory _tokenId)
internal
pure
returns (bytes29)
| function formatTokenId(TokenId memory _tokenId)
internal
pure
returns (bytes29)
| 33,509 |
52 | // Check that the target is a valid contract. | if (target.code.length == 0) {
revert PRBProxy__TargetInvalid(target);
}
| if (target.code.length == 0) {
revert PRBProxy__TargetInvalid(target);
}
| 21,697 |
16 | // Constant for locked guard state | uint private constant REENTRANCY_GUARD_LOCKED = 2;
| uint private constant REENTRANCY_GUARD_LOCKED = 2;
| 50,647 |
18 | // init | Bid storage bid = _bids[auctionId];
bid.auction.id = auctionId;
bid.auction.auctioneer = auctioneer;
bid.auction.startTime = startTime;
bid.auction.endTime = endTime;
bid.auction.reservePrice = reservePrice;
bid.symmetricKey = symmetricKey;
| Bid storage bid = _bids[auctionId];
bid.auction.id = auctionId;
bid.auction.auctioneer = auctioneer;
bid.auction.startTime = startTime;
bid.auction.endTime = endTime;
bid.auction.reservePrice = reservePrice;
bid.symmetricKey = symmetricKey;
| 25,058 |
63 | // Returns an array of currency codes currently accepted for deposits. / | function getAcceptedCurrencies() external view returns (string[] memory) {
uint256 arrayLength = 0;
for (uint256 i = 0; i < _supportedCurrencies.length; i++) if (_acceptedCurrencies[_supportedCurrencies[i]]) arrayLength++;
string[] memory acceptedCurrencies = new string[](arrayLength);
... | function getAcceptedCurrencies() external view returns (string[] memory) {
uint256 arrayLength = 0;
for (uint256 i = 0; i < _supportedCurrencies.length; i++) if (_acceptedCurrencies[_supportedCurrencies[i]]) arrayLength++;
string[] memory acceptedCurrencies = new string[](arrayLength);
... | 12,089 |
4 | // Minimum lock for each sponsor | uint64 public constant MIN_SPONSOR_LOCK_DURATION = 2 weeks;
| uint64 public constant MIN_SPONSOR_LOCK_DURATION = 2 weeks;
| 37,352 |
199 | // This event is emitted when overnight fee payed/blockNumber the block number when overnight Fee payed/longPositionsSize the long Position size when overnight Fee payed/shortPositionSize the short Position size when overnight Fee payed/overnightFee the total overinight fee this time | event OvernightFeePayed(
uint256 blockNumber,
uint256 longPositionsSize,
uint256 shortPositionSize,
uint256 overnightFee
);
| event OvernightFeePayed(
uint256 blockNumber,
uint256 longPositionsSize,
uint256 shortPositionSize,
uint256 overnightFee
);
| 36,009 |
67 | // Internal call to process wearer status from the eligibility module/Burns the wearer's Hat token if _eligible is false, and updates badStandings/ state if necessary/_hatId The id of the Hat to revoke/_wearer The address of the wearer in question/_eligible Whether _wearer is eligible for the Hat (if false, this functi... | function _processHatWearerStatus(uint256 _hatId, address _wearer, bool _eligible, bool _standing)
internal
returns (bool updated)
| function _processHatWearerStatus(uint256 _hatId, address _wearer, bool _eligible, bool _standing)
internal
returns (bool updated)
| 21,969 |
191 | // Recoverable feature should _only_ be used with contracts that should not store assets,but instead interacted with value so there is potential to lose assets. / | abstract contract Recoverable is AccessControl {
using SafeERC20 for IERC20;
using Address for address payable;
/* ========== CONSTANTS ========== */
bytes32 public constant RECOVER_ROLE = keccak256("RECOVER_ROLE");
/* ============ Events ============ */
event Recovered(address onBehalfOf, address tokenA... | abstract contract Recoverable is AccessControl {
using SafeERC20 for IERC20;
using Address for address payable;
/* ========== CONSTANTS ========== */
bytes32 public constant RECOVER_ROLE = keccak256("RECOVER_ROLE");
/* ============ Events ============ */
event Recovered(address onBehalfOf, address tokenA... | 30,083 |
303 | // Lockup dates are the same end time, slope delta is the same | newSlopeDelta = oldSlopeDelta;
| newSlopeDelta = oldSlopeDelta;
| 16,765 |
21 | // Function called by `mintWhitelist` and `mint`./ Performs common checks and mints `amount` of NFTs./account The account to mint the NFTs to./amount The amount of NFTs to mint. | function _mintInternal(address account, uint256 amount) internal {
require(amount != 0, "INVALID_AMOUNT");
uint256 mintedWallet = mintedAmount[account] + amount;
require(mintedWallet <= MAX_PER_WALLET, "WALLET_LIMIT_EXCEEDED");
uint256 currentPointer = publicPointer;
uint256 ... | function _mintInternal(address account, uint256 amount) internal {
require(amount != 0, "INVALID_AMOUNT");
uint256 mintedWallet = mintedAmount[account] + amount;
require(mintedWallet <= MAX_PER_WALLET, "WALLET_LIMIT_EXCEEDED");
uint256 currentPointer = publicPointer;
uint256 ... | 53,887 |
538 | // Updates RGT distribution speeds for each pool given one `pool` whose balance should be refreshed. pool The pool whose balance should be refreshed. / | function refreshDistributionSpeeds(RariPool pool) external;
| function refreshDistributionSpeeds(RariPool pool) external;
| 28,845 |
1,036 | // 520 | entry "coercibly" : ENG_ADVERB
| entry "coercibly" : ENG_ADVERB
| 21,356 |
182 | // @custom:error (NX4) - Non-existent role to CA | require(roles[_CAs[i]][_role], 'NX4');
roles[_CAs[i]][_role] = false;
emit RoleRemoved(_CAs[i], _role);
| require(roles[_CAs[i]][_role], 'NX4');
roles[_CAs[i]][_role] = false;
emit RoleRemoved(_CAs[i], _role);
| 67,013 |
134 | // Determine whether the address is an already added address / | modifier onlyJoined(address addr) {
require(accounts[addr].id > 0, "ANR");
_;
}
| modifier onlyJoined(address addr) {
require(accounts[addr].id > 0, "ANR");
_;
}
| 61,092 |
358 | // CurrentCollateralizationRatio = deposited ETH in USD / debt in USD | uint256 collateralizationRatio = _collateralValue.wadDiv(_vaultDebt);
| uint256 collateralizationRatio = _collateralValue.wadDiv(_vaultDebt);
| 30,691 |
59 | // Rebased ERC20 token Rebased is based on the uFragments Ideal Money protocol. uFragments is a normal ERC20 token, but its supply can be adjusted by splitting and combining tokens proportionally across all wallets.uFragment balances are internally represented with a hidden denomination, 'gons'. We support splitting th... | contract Rebased is ERC20Detailed {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
// Used for authentication
address public monetaryPolicy;
modifier onlyMonetaryPolicy() {
require(msg.sender == monetaryPolicy);
... | contract Rebased is ERC20Detailed {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
// Used for authentication
address public monetaryPolicy;
modifier onlyMonetaryPolicy() {
require(msg.sender == monetaryPolicy);
... | 50,136 |
5 | // Check the proper ether is sent | require(msg.value == BET_AMOUNT, "Not enough ETH");
| require(msg.value == BET_AMOUNT, "Not enough ETH");
| 11,238 |
28 | // Increase the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol spender The address which will spend the funds. ad... | function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
| function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
| 1,515 |
59 | // Tellor TransferContais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol reference this library for function's logic./ | library TellorTransfer {
| library TellorTransfer {
| 8,723 |
308 | // Auction contract checks input sizes If Dog is already on any auction, this will throw because it will be owned by the auction contract. | require(_owns(msg.sender, _dogId) || _approvedFor(msg.sender, _dogId));
| require(_owns(msg.sender, _dogId) || _approvedFor(msg.sender, _dogId));
| 15,250 |
27 | // change status of Request | accessControlRequests[id].status = AccessStatus.Verified;
| accessControlRequests[id].status = AccessStatus.Verified;
| 20,625 |
8 | // Bigger length than default | model.modelSetOutputLength(0xec5b4d3b, 96);
Assert.equal(int(model.modelGetOutputLength(0xec5b4d3b)), 96, "Length is now 44");
(mr0, mr1, mr2) = rawInput.solidityReturnBytes32(0x1111111111111111111111111111111111111111111111111111111111111111, 0x22222222222222222222222222222222222222222222222222222222222222... | model.modelSetOutputLength(0xec5b4d3b, 96);
Assert.equal(int(model.modelGetOutputLength(0xec5b4d3b)), 96, "Length is now 44");
(mr0, mr1, mr2) = rawInput.solidityReturnBytes32(0x1111111111111111111111111111111111111111111111111111111111111111, 0x22222222222222222222222222222222222222222222222222222222222222... | 2,052 |
55 | // 觸發事件:符合租客資格 | emit TenantQualified(
block.timestamp,
_tenantAddress,
_rentAmount,
_depositAmount
);
| emit TenantQualified(
block.timestamp,
_tenantAddress,
_rentAmount,
_depositAmount
);
| 20,070 |
120 | // Unrevelead URI. | string public unrevealedURI;
| string public unrevealedURI;
| 24,694 |
50 | // essentially the same as buy, but instead of you sending ether from your wallet, it uses your unwithdrawn earnings.-functionhash- 0x349cdcac (using ID for affiliate)-functionhash- 0x82bfc739 (using address for affiliate)-functionhash- 0x079ce327 (using name for affiliate) _affCode the ID/address/name of the player wh... | function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public
| function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public
| 7,631 |
9 | // Set [addresses] to be enabled on the precompile contract. | function setEnabled(address precompileContract, address[] calldata addresses) external onlyOwner {
validate(addresses);
uint index = 0;
for (index = 0; index < addresses.length; index++) {
IAllowList(precompileContract).setEnabled(addresses[index]);
}
}
| function setEnabled(address precompileContract, address[] calldata addresses) external onlyOwner {
validate(addresses);
uint index = 0;
for (index = 0; index < addresses.length; index++) {
IAllowList(precompileContract).setEnabled(addresses[index]);
}
}
| 16,343 |
38 | // 13 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT |
string inPI_edit_13 = " une première phrase " ;
|
string inPI_edit_13 = " une première phrase " ;
| 35,653 |
0 | // Guillaume Gonnaud 2019/Auction House Header/Contain all the events emitted by the Auction House | contract AuctionHouseHeaderV1 {
// Deposit: Event emitted whenever money is made available for withdrawal in the Auction House
// amount: Amount of money being deposited
// beneficiary: Account that will be able to withdraw the money
// contributor: Which user wallet initially contributed the received ... | contract AuctionHouseHeaderV1 {
// Deposit: Event emitted whenever money is made available for withdrawal in the Auction House
// amount: Amount of money being deposited
// beneficiary: Account that will be able to withdraw the money
// contributor: Which user wallet initially contributed the received ... | 11,497 |
19 | // Try to deal a new market order. 'sender' pays 'inAmount' of 'inputToken', in exchange of the other token kept by this pair | function addMarketOrder(address inputToken, address sender, uint112 inAmount) external payable returns (uint);
| function addMarketOrder(address inputToken, address sender, uint112 inAmount) external payable returns (uint);
| 940 |
44 | // Transfer tokens from the caller to a new holder. Remember, there&39;s a 1% fee here as well. / | function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all... | function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all... | 19,832 |
54 | // Internal function to invoke `onERC721Received` on a target address The call is not executed if the target address is not a contract _from address representing the previous owner of the given token ID _to target address that will receive the tokens _tokenId uint256 ID of the token to be transferred _data bytes option... | function checkAndCallSafeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
internal
returns (bool)
| function checkAndCallSafeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
internal
returns (bool)
| 14,342 |
2 | // Map containing the token Holder adresses and their balances of issued tokens // Map containing users and their approval addresses and amounts // symbol for the contract // Constructor to create the token/ | function Token() public {
totalSupplyInt = 1000;
balances[msg.sender] = 1000;
symbol = "SAT";
}
| function Token() public {
totalSupplyInt = 1000;
balances[msg.sender] = 1000;
symbol = "SAT";
}
| 30,223 |
7 | // See {IERC_N-barter} | function barter(
BarterTerms memory data,
bytes memory signature
) external onlyExchangeable(data.bid.tokenAddr) {
IERC_N(data.bid.tokenAddr).transferFor(data, msg.sender, signature);
| function barter(
BarterTerms memory data,
bytes memory signature
) external onlyExchangeable(data.bid.tokenAddr) {
IERC_N(data.bid.tokenAddr).transferFor(data, msg.sender, signature);
| 12,403 |
193 | // Rescue tokens | function rescueTokens(
address token,
address to,
uint256 amount
)
external
onlyGov
returns (bool)
| function rescueTokens(
address token,
address to,
uint256 amount
)
external
onlyGov
returns (bool)
| 20,679 |
46 | // Set the amount of nfts per address is allowed./_newMax The new maximum pr address. | function setMaxPerAddress(uint8 _newMax) external onlyOwner {
maxMintPerAddress = _newMax;
}
| function setMaxPerAddress(uint8 _newMax) external onlyOwner {
maxMintPerAddress = _newMax;
}
| 78,085 |
26 | // resetting the bids of the recipient to avoid multiple transfers to the same recipient | bids[recipient] = 0;
| bids[recipient] = 0;
| 34,795 |
11 | // Rewarding contracts are allowed to update rewards for addresses | modifier onlyRewarding {
bool authorised = false;
address sender = _msgSender();
for (uint256 i = 0;i < _rewardingContracts.length;i++) {
if (_rewardingContracts[i] == sender) {
authorised = true;
break;
}
}
require(auth... | modifier onlyRewarding {
bool authorised = false;
address sender = _msgSender();
for (uint256 i = 0;i < _rewardingContracts.length;i++) {
if (_rewardingContracts[i] == sender) {
authorised = true;
break;
}
}
require(auth... | 78,882 |
8 | // getter when rewards yearned till now should be returned | function UpdateRewards() public {
require(total_staked != 0,"no tokens staked yet");
rewardpertoken_staked = rewardRATE * (_min(block.timestamp,expiresAt) - last_rewardupdate)/ total_staked;
rewards[msg.sender] += usertokens_staked[msg.sender] * rewardpertoken_staked;
}
| function UpdateRewards() public {
require(total_staked != 0,"no tokens staked yet");
rewardpertoken_staked = rewardRATE * (_min(block.timestamp,expiresAt) - last_rewardupdate)/ total_staked;
rewards[msg.sender] += usertokens_staked[msg.sender] * rewardpertoken_staked;
}
| 19,152 |
34 | // Getter for program details of a coffee maker./Does not perform any kind of access control. But does only work for known coffee makers./wallet The coffee maker to check for a program./program The program to get additional information for. | /// @return {
/// "name": "The name of the coffee program (e.g. Espresso).",
/// "price": "The price of the coffee program."
/// }
| /// @return {
/// "name": "The name of the coffee program (e.g. Espresso).",
/// "price": "The price of the coffee program."
/// }
| 27,084 |
144 | // Add a new wearable to the collection. that this method allows wearableIds of any size. It should be usedif a wearableId is greater than 32 bytes _wearableId - wearable id _maxIssuance - total supply for the wearable / | function addWearable(string memory _wearableId, uint256 _maxIssuance) public onlyOwner {
require(!isComplete, "The collection is complete");
bytes32 key = getWearableKey(_wearableId);
require(maxIssuance[key] == 0, "Can not modify an existing wearable");
require(_maxIssuance > 0, "M... | function addWearable(string memory _wearableId, uint256 _maxIssuance) public onlyOwner {
require(!isComplete, "The collection is complete");
bytes32 key = getWearableKey(_wearableId);
require(maxIssuance[key] == 0, "Can not modify an existing wearable");
require(_maxIssuance > 0, "M... | 18,122 |
19 | // Roles are referred to by their `bytes32` identifier. These should be exposedin the external API and be unique. The best way to achieve this is byusing `public constant` hash digests: | * Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Only account that have a role's consensus role
* can call {grantRole} and {revokeRole}.
*
* By default, the admin role is `CONSENSUS_ROLE`, which means
* that only account with this role will be able to grant or revo... | * Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Only account that have a role's consensus role
* can call {grantRole} and {revokeRole}.
*
* By default, the admin role is `CONSENSUS_ROLE`, which means
* that only account with this role will be able to grant or revo... | 23,627 |
16 | // Killable contract - base contract that can be killed by owner. All funds in contract will be sent to the owner. | contract Killable is Ownable {
function kill() public onlyOwner {
selfdestruct(owner);
}
}
| contract Killable is Ownable {
function kill() public onlyOwner {
selfdestruct(owner);
}
}
| 32,926 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.