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 |
|---|---|---|---|---|
147 | // https:etherscan.io/address/0x853d955aCEf822Db058eb8505911ED77F175b99e | address internal constant FRAX_UNDERLYING = 0x853d955aCEf822Db058eb8505911ED77F175b99e;
uint256 internal constant FRAX_DECIMALS = 18;
| address internal constant FRAX_UNDERLYING = 0x853d955aCEf822Db058eb8505911ED77F175b99e;
uint256 internal constant FRAX_DECIMALS = 18;
| 15,838 |
3 | // address[] memory _patientAddrList = [0x0000000000000000000000000000000000000000]; | Hospital memory h;
h.hospitalAddr = msg.sender;
h.hospitalName = _hospitalName;
h.isValue = true;
hospitals[_hospitalName] = h;
| Hospital memory h;
h.hospitalAddr = msg.sender;
h.hospitalName = _hospitalName;
h.isValue = true;
hospitals[_hospitalName] = h;
| 44,527 |
62 | // Apply minimum fee | uint256 minFee = isSwap ? feeStructure.minSwapFee : feeStructure.minBaseFee;
if (fee < minFee) fee = minFee;
| uint256 minFee = isSwap ? feeStructure.minSwapFee : feeStructure.minBaseFee;
if (fee < minFee) fee = minFee;
| 41,669 |
110 | // 2. Effects | highestBidOf[_auctionId] = 0;
highestBidderOf[_auctionId] = 0x0000000000000000000000000000000000000000;
auctionEnded[_auctionId] = true;
emit AuctionEnded(highestAuctionBidder, amount, _auctionId, idOfAuctionedAss);
| highestBidOf[_auctionId] = 0;
highestBidderOf[_auctionId] = 0x0000000000000000000000000000000000000000;
auctionEnded[_auctionId] = true;
emit AuctionEnded(highestAuctionBidder, amount, _auctionId, idOfAuctionedAss);
| 78,208 |
13 | // small win percentage (prize pool) | uint256 public constant SMALL_WIN_PCT = 50; // 0.5%
| uint256 public constant SMALL_WIN_PCT = 50; // 0.5%
| 10,288 |
7 | // Product Simpler version of Product interface / | contract Product is ExtendsOwnable {
string public name;
uint256 public maxcap;
uint256 public exceed;
uint256 public minimum;
uint256 public rate;
uint256 public lockup;
constructor (
string _name,
uint256 _maxcap,
uint256 _exceed,
uint256 _minimum,
... | contract Product is ExtendsOwnable {
string public name;
uint256 public maxcap;
uint256 public exceed;
uint256 public minimum;
uint256 public rate;
uint256 public lockup;
constructor (
string _name,
uint256 _maxcap,
uint256 _exceed,
uint256 _minimum,
... | 43,499 |
5 | // Returns the amount of tokens in existence. / | function totalSupply() external view returns (uint256);
| function totalSupply() external view returns (uint256);
| 36,960 |
20 | // require(flightsuretydata.getFlightStatusCode(flightCodeDate) == STATUS_CODE_UNKNOWN, 'Flight status already changed'); | bool result = flightsuretydata.changeFlightStatusCode(flightCodeDate, statusCode);
if (result) {
if (statusCode >= STATUS_CODE_LATE_AIRLINE) {
setInsurancePayout(flightCodeDate);
}
| bool result = flightsuretydata.changeFlightStatusCode(flightCodeDate, statusCode);
if (result) {
if (statusCode >= STATUS_CODE_LATE_AIRLINE) {
setInsurancePayout(flightCodeDate);
}
| 30,732 |
152 | // Calculate SFI earnings per tranche | tranche_SFI_earned[epoch][uint256(Tranche.S)] = TRANCHE_SFI_MULTIPLIER.S.mul(amount_sfi).div(100000);
tranche_SFI_earned[epoch][uint256(Tranche.AA)] = TRANCHE_SFI_MULTIPLIER.AA.mul(amount_sfi).div(100000);
tranche_SFI_earned[epoch][uint256(Tranche.A)] = TRANCHE_SFI_MULTIPLIER.A.mul(amount_sfi).div(100000)... | tranche_SFI_earned[epoch][uint256(Tranche.S)] = TRANCHE_SFI_MULTIPLIER.S.mul(amount_sfi).div(100000);
tranche_SFI_earned[epoch][uint256(Tranche.AA)] = TRANCHE_SFI_MULTIPLIER.AA.mul(amount_sfi).div(100000);
tranche_SFI_earned[epoch][uint256(Tranche.A)] = TRANCHE_SFI_MULTIPLIER.A.mul(amount_sfi).div(100000)... | 42,756 |
19 | // Set the product contract address. This is accessible only for the owner and can only be setted once. | function setProductContractAddress(address _productContractAddress) public onlyOwner {
// Check weather the product contract address is setted or not.
require( productContractAddress == address(0), "Product contract is setted." );
// Set the address.
productContractAddress = _produc... | function setProductContractAddress(address _productContractAddress) public onlyOwner {
// Check weather the product contract address is setted or not.
require( productContractAddress == address(0), "Product contract is setted." );
// Set the address.
productContractAddress = _produc... | 49,406 |
191 | // Change the bas URI if required | function setBaseURI(string memory _URI) external onlyOwner {
baseURI = _URI;
}
| function setBaseURI(string memory _URI) external onlyOwner {
baseURI = _URI;
}
| 43,169 |
32 | // 0x31: Retrieval of at least one of the sources timed out. | RetrievalTimeout,
| RetrievalTimeout,
| 24,482 |
16 | // remove the replica from mappings | _clearReplica(_replica);
| _clearReplica(_replica);
| 38,301 |
168 | // metadata | string name;
string description;
| string name;
string description;
| 66,349 |
147 | // Getters | constructor(
address _rewards,
address _want,
address _strategist
)
public
StrategyBase(_want, _strategist)
| constructor(
address _rewards,
address _want,
address _strategist
)
public
StrategyBase(_want, _strategist)
| 8,907 |
68 | // how to split up the final pot based on which team was picked (F3D, P3D) | potSplit_[0] = F3Ddatasets.PotSplit(0,0); //100% to winner
| potSplit_[0] = F3Ddatasets.PotSplit(0,0); //100% to winner
| 50,274 |
288 | // POSITION FUNCTIONS // Requests to transfer ownership of the caller's current position to a new sponsor address.Once the request liveness is passed, the sponsor can execute the transfer and specify the new sponsor. The liveness length is the same as the withdrawal liveness. / | function requestTransferPosition() public onlyPreExpiration() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
require(positionData.transferPositionRequestPassTimestamp == 0, "Pending transfer");
// Make sure the proposed expiration of this request is not p... | function requestTransferPosition() public onlyPreExpiration() nonReentrant() {
PositionData storage positionData = _getPositionData(msg.sender);
require(positionData.transferPositionRequestPassTimestamp == 0, "Pending transfer");
// Make sure the proposed expiration of this request is not p... | 30,773 |
144 | // burn old tokens | OLD_MONETARY_SUPERVISOR.burnFromReserve(reserveTokenAmount);
| OLD_MONETARY_SUPERVISOR.burnFromReserve(reserveTokenAmount);
| 70,708 |
316 | // Calculate pay out & pay out | if (zethr.balanceOf(address(this)) >= 1e10) {
payOutAmount = zethr.balanceOf(address(this)) / payOutDivisor;
}
| if (zethr.balanceOf(address(this)) >= 1e10) {
payOutAmount = zethr.balanceOf(address(this)) / payOutDivisor;
}
| 32,499 |
95 | // Add full rewards UP TO end of LOCK epoch | uint endEpochAccumulated = epochs[user.endLockEpoch]
.finalEpochAccumulation;
userStakingPower += user.bonusAmount;
accumulatedRewards = userStakingPower * endEpochAccumulated;
claimableRewards = accumulatedRewards - user.offsetPoints;
endEpo... | uint endEpochAccumulated = epochs[user.endLockEpoch]
.finalEpochAccumulation;
userStakingPower += user.bonusAmount;
accumulatedRewards = userStakingPower * endEpochAccumulated;
claimableRewards = accumulatedRewards - user.offsetPoints;
endEpo... | 32,092 |
108 | // cards_ is encoded: 64 bit cardId 96 bit price 32 bit loyalty price 64 bit maxSupply | uint cardId = uint256(uint64(encodedCardData_));
require(cardId <= maxGameId, "cardId < 2**32");
require(cardId <= cardTokenCounts.length, "sequential cards");
if(cardId == cardTokenCounts.length) {
cardTokenCounts.push(0);
}
| uint cardId = uint256(uint64(encodedCardData_));
require(cardId <= maxGameId, "cardId < 2**32");
require(cardId <= cardTokenCounts.length, "sequential cards");
if(cardId == cardTokenCounts.length) {
cardTokenCounts.push(0);
}
| 25,709 |
32 | // Withdraw dividends | withdraw();
| withdraw();
| 34,038 |
254 | // Distribute the remaining bond into the darknode payment reward pool | require(address(darknodePayment) != address(0x0), "DarknodeRegistry: invalid payment address");
require(ren.transfer(address(darknodePayment.store()), reward), "DarknodeRegistry: reward transfer failed");
require(ren.transfer(_challenger, reward), "DarknodeRegistry: reward transfer f... | require(address(darknodePayment) != address(0x0), "DarknodeRegistry: invalid payment address");
require(ren.transfer(address(darknodePayment.store()), reward), "DarknodeRegistry: reward transfer failed");
require(ren.transfer(_challenger, reward), "DarknodeRegistry: reward transfer f... | 44,528 |
16 | // Passes arbitrary bytes of data to an external contract that implements the Callee interface.Does not change any asset amounts. This function may be useful for setting certain variableson layer-two contracts for certain accounts without having to make a separate Ethereumtransaction for doing so. Also, the second-laye... | struct CallArgs {
Account.Info account;
address callee;
bytes data;
}
| struct CallArgs {
Account.Info account;
address callee;
bytes data;
}
| 13,599 |
91 | // Get Locked and unlocked capital | uint256[] memory userDeposits = ownedDeposits[msg.sender];
require(userDeposits.length != 0, "Dont have any deposits");
_claimRecord.claimedAmount = _claimRecord.claimedAmount.add(
claimableAmount
);
_claimRecord.claimedAt = block.timestamp;
require(claimabl... | uint256[] memory userDeposits = ownedDeposits[msg.sender];
require(userDeposits.length != 0, "Dont have any deposits");
_claimRecord.claimedAmount = _claimRecord.claimedAmount.add(
claimableAmount
);
_claimRecord.claimedAt = block.timestamp;
require(claimabl... | 28,759 |
52 | // SimpleTokenVery simple ERC20 Token example, where all tokens are pre-assigned to the creator. Note they can later distribute these tokens as they wish using `transfer` and other `StandardToken` functions./ | // contract StfuTokenCrowdsale is Crowdsale {
// string public constant name = "StfuToken"; // solium-disable-line uppercase
// string public constant symbol = "STFU"; // solium-disable-line uppercase
// uint8 public constant decimals = 18; // solium-disable-line uppercase
// uint256 public constant INITIAL_S... | // contract StfuTokenCrowdsale is Crowdsale {
// string public constant name = "StfuToken"; // solium-disable-line uppercase
// string public constant symbol = "STFU"; // solium-disable-line uppercase
// uint8 public constant decimals = 18; // solium-disable-line uppercase
// uint256 public constant INITIAL_S... | 37,780 |
67 | // AllowanceCrowdsale Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale. / | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
address public tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address _t... | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
address public tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address _t... | 28,880 |
2 | // Mapping of the geoJson for each token | mapping(uint256 => string) private geoJson;
| mapping(uint256 => string) private geoJson;
| 37,962 |
27 | // /read-only interface//total number of posts | function numberOfPosts(
)external view virtual override returns(
uint256
| function numberOfPosts(
)external view virtual override returns(
uint256
| 12,594 |
219 | // Reads the int128 at `cdPtr` in calldata. | function readInt128(
CalldataPointer cdPtr
| function readInt128(
CalldataPointer cdPtr
| 12,723 |
6 | // transfers the SEANCE to the contract. | seance.transferFrom(msg.sender, address(this), amount);
emit Enchant(msg.sender, amount);
| seance.transferFrom(msg.sender, address(this), amount);
emit Enchant(msg.sender, amount);
| 51,820 |
109 | // Returns an abbreviated name for NFTokens.return _symbol Representing symbol. / | function symbol() external view override returns (string memory _symbol) {
_symbol = nftSymbol;
}
| function symbol() external view override returns (string memory _symbol) {
_symbol = nftSymbol;
}
| 15,362 |
127 | // Mines new gemstones. Puts kind you want to mine + your salt and tests your luck! | function mine(uint kind, uint salt) external nonReentrant {
uint val = luck(kind, salt);
nonce[msg.sender]++;
require(kind < gemCount, 'gem kind not exist');
uint diff = gems[kind].difficulty;
require(val <= type(uint).max / diff, 'salt not good enough');
gems[kind].difficulty = (diff * gems[k... | function mine(uint kind, uint salt) external nonReentrant {
uint val = luck(kind, salt);
nonce[msg.sender]++;
require(kind < gemCount, 'gem kind not exist');
uint diff = gems[kind].difficulty;
require(val <= type(uint).max / diff, 'salt not good enough');
gems[kind].difficulty = (diff * gems[k... | 41,240 |
8 | // Evento que notifica a aplicação cliente Etherum da aprovação de saldo de um proprietário para um "gastador" | event Approval(address indexed holder, address indexed spender, uint256 value);
| event Approval(address indexed holder, address indexed spender, uint256 value);
| 40,682 |
112 | // Exercises an active option optionID ID of your option / | function exercise(uint optionID) external {
Option storage option = options[optionID];
require(option.expiration >= block.timestamp, "Option has expired");
require(option.holder == msg.sender, "Wrong msg.sender");
require(option.state == State.Active, "Wrong state");
option... | function exercise(uint optionID) external {
Option storage option = options[optionID];
require(option.expiration >= block.timestamp, "Option has expired");
require(option.holder == msg.sender, "Wrong msg.sender");
require(option.state == State.Active, "Wrong state");
option... | 34,982 |
18 | // returns ETH & Token to the liquidity provider | (bool sent, ) = (msg.sender).call{value: ethAmount}("");
| (bool sent, ) = (msg.sender).call{value: ethAmount}("");
| 7,432 |
20 | // Set the address of ValidationManager with which validation will be done/Allowed only for Deployer (see contract Deployerable) | function setValidationManager(
address _validationAddress
| function setValidationManager(
address _validationAddress
| 24,122 |
229 | // 8. Tell the manager. | if (loan.short) {
_manager().decrementShorts(loan.currency, loan.amount);
if (shortingRewards[loan.currency] != address(0)) {
IShortingRewards(shortingRewards[loan.currency]).withdraw(borrower, loan.amount);
}
| if (loan.short) {
_manager().decrementShorts(loan.currency, loan.amount);
if (shortingRewards[loan.currency] != address(0)) {
IShortingRewards(shortingRewards[loan.currency]).withdraw(borrower, loan.amount);
}
| 18,201 |
43 | // this is a recent ethereum block hash, used to prevent pre-mining future blocks | function getChallengeNumber() public constant returns (bytes32) {
return challengeNumber;
}
| function getChallengeNumber() public constant returns (bytes32) {
return challengeNumber;
}
| 4,752 |
13 | // Contract not in expected state | revert();
_;
| revert();
_;
| 56,416 |
5 | // EVENTS |
event MarketPurchase(
address indexed _from,
address indexed _to,
uint32 _point,
uint96 _price,
address token
);
event ListingRemoved(
|
event MarketPurchase(
address indexed _from,
address indexed _to,
uint32 _point,
uint96 _price,
address token
);
event ListingRemoved(
| 3,130 |
204 | // Execute min withdrawal fee update (with time delay enforced). Needs to be called after the update was prepraed. Fails if called before time delay is met.return New withdrawal fee. / | function executeNewMinWithdrawalFee() external returns (uint256) {
uint256 newFee = _executeUInt256(_MIN_WITHDRAWAL_FEE_KEY);
_checkFeeInvariants(newFee, getMaxWithdrawalFee());
return newFee;
}
| function executeNewMinWithdrawalFee() external returns (uint256) {
uint256 newFee = _executeUInt256(_MIN_WITHDRAWAL_FEE_KEY);
_checkFeeInvariants(newFee, getMaxWithdrawalFee());
return newFee;
}
| 80,206 |
9 | // Decode a `Witnet.CBOR` structure into a native `string` value./_cborValue An instance of `Witnet.CBOR`./ return The value represented by the input, as a `string` value. | function decodeString(Witnet.CBOR memory _cborValue) public pure returns(string memory) {
_cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
if (_cborValue.len == _UINT64_MAX) {
bytes memory textData;
bool done;
while (!done) {
uint64 itemLength = readI... | function decodeString(Witnet.CBOR memory _cborValue) public pure returns(string memory) {
_cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
if (_cborValue.len == _UINT64_MAX) {
bytes memory textData;
bool done;
while (!done) {
uint64 itemLength = readI... | 12,261 |
456 | // Set the owner of a Relay Manager. Called only by the RelayManager itself./ Note that owners cannot transfer ownership - if the entry already exists, reverts./owner - owner of the relay (as configured off-chain) | function setRelayManagerOwner(address payable owner) external;
| function setRelayManagerOwner(address payable owner) external;
| 78,275 |
29 | // Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event (ERC-20) | require(_value >= 0);
| require(_value >= 0);
| 1,182 |
177 | // Freeze the amount of tokens for that resource | KingOfEthResourcesInterface(interfaceContract).exchangeFreezeTokens(
_resource
, msg.sender
, _amountTrading
);
| KingOfEthResourcesInterface(interfaceContract).exchangeFreezeTokens(
_resource
, msg.sender
, _amountTrading
);
| 47,955 |
327 | // OpenSea contract helper that defines a few things/Simon Fremaux (@dievardump)/This is a contract used to add OpenSea's/gas-less trading and contractURI support | contract BaseOpenSea {
string private _contractURI;
ProxyRegistry private _proxyRegistry;
/// @notice Returns the contract URI function. Used on OpenSea to get details
// about a contract (owner, royalties etc...)
function contractURI() public view returns (string memory) {
return ... | contract BaseOpenSea {
string private _contractURI;
ProxyRegistry private _proxyRegistry;
/// @notice Returns the contract URI function. Used on OpenSea to get details
// about a contract (owner, royalties etc...)
function contractURI() public view returns (string memory) {
return ... | 38,578 |
14 | // Helper interfaces | import { IWETH } from "../interfaces/IWETH.sol";
import "../openzeppelin-presets/token/ERC20/SafeERC20.sol";
library CurrencyTransferLib {
using SafeERC20 for IERC20;
/// @dev The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeee... | import { IWETH } from "../interfaces/IWETH.sol";
import "../openzeppelin-presets/token/ERC20/SafeERC20.sol";
library CurrencyTransferLib {
using SafeERC20 for IERC20;
/// @dev The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeee... | 2,841 |
51 | // set Broker for Investor/_target address of Investor/_broker address of Broker | function setReferral(address _target, address _broker, uint256 _amount) onlyOwner public {
require (_target != 0x0);
require (_broker != 0x0);
referrals[_target] = _broker;
emit SetReferral(_target, _broker);
if(_amount>0x0){
uint256 brokerBonus = safeDiv(safeMul(... | function setReferral(address _target, address _broker, uint256 _amount) onlyOwner public {
require (_target != 0x0);
require (_broker != 0x0);
referrals[_target] = _broker;
emit SetReferral(_target, _broker);
if(_amount>0x0){
uint256 brokerBonus = safeDiv(safeMul(... | 27,791 |
169 | // get reward | uint256 yaoReward = getPoolReward(pool.lastRewardBlock, pool.allocPoint);
| uint256 yaoReward = getPoolReward(pool.lastRewardBlock, pool.allocPoint);
| 16,375 |
1 | // validation for date of campaign | require(campaign.deadline < block.timestamp, "Wrong date for deadline");
campaign.owner = _owner;
campaign.titile = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
campai... | require(campaign.deadline < block.timestamp, "Wrong date for deadline");
campaign.owner = _owner;
campaign.titile = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollected = 0;
campai... | 17,652 |
6 | // event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); | event Add(uint _amount01In, uint reserve0, uint reserve1);
event Swap(
address indexed sender,
address token01Out,
uint amount2In,
uint amount2Out,
address indexed to
);
event Sync(uint reserve0, uint reserve1, uint reserve2);
event remove(uint amount0, uint a... | event Add(uint _amount01In, uint reserve0, uint reserve1);
event Swap(
address indexed sender,
address token01Out,
uint amount2In,
uint amount2Out,
address indexed to
);
event Sync(uint reserve0, uint reserve1, uint reserve2);
event remove(uint amount0, uint a... | 36,667 |
166 | // Emitted when an attempt to relay a call failed. This can happen due to incorrect {relayCall} arguments, or the recipient not accepting the relayed call. Theactual relayed call was not executed, and the recipient not charged. The `reason` parameter contains an error code: values 1-10 correspond to `PreconditionCheck`... | event CanRelayFailed(address indexed relay, address indexed from, address indexed to, bytes4 selector, uint256 reason);
| event CanRelayFailed(address indexed relay, address indexed from, address indexed to, bytes4 selector, uint256 reason);
| 5,459 |
215 | // Utilized during module initializations to check that the module is in pending stateand that the CKToken is valid / | modifier onlyValidAndPendingCK(ICKToken _ckToken) {
_validateOnlyValidAndPendingCK(_ckToken);
_;
}
| modifier onlyValidAndPendingCK(ICKToken _ckToken) {
_validateOnlyValidAndPendingCK(_ckToken);
_;
}
| 23,399 |
38 | // events | event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event CrowdFundClosed(uint256 _blockTimeStamp);
event ChangeFoundersWalletAddress(uint256 _blockTimeStamp, address indexed _foundersWalletAddress);
| event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event CrowdFundClosed(uint256 _blockTimeStamp);
event ChangeFoundersWalletAddress(uint256 _blockTimeStamp, address indexed _foundersWalletAddress);
| 1,161 |
22 | // Base contract for PixelCoins. Holds all common structs, events and base variables./Oliver Schneider <info@pixelcoins.io> (https:pixelcoins.io)/See the PixelCore contract documentation to understand how the various contract facets are arranged. | contract PixelBase is PixelAuthority {
/*** EVENTS ***/
/// @dev Transfer event as defined in current draft of ERC721. Emitted every time a Pixel
/// ownership is assigned.
event Transfer(address from, address to, uint256 tokenId);
/*** CONSTANTS ***/
uint32 public WIDTH = 1000;
uint32 pu... | contract PixelBase is PixelAuthority {
/*** EVENTS ***/
/// @dev Transfer event as defined in current draft of ERC721. Emitted every time a Pixel
/// ownership is assigned.
event Transfer(address from, address to, uint256 tokenId);
/*** CONSTANTS ***/
uint32 public WIDTH = 1000;
uint32 pu... | 46,809 |
19 | // Storage slot with the address of the current implementation.This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and isvalidated in the constructor. / | bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
| bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
| 5,289 |
18 | // Allows a Module to execute a Safe transaction without any further confirmations./to Destination address of module transaction./value Ether value of module transaction./data Data payload of module transaction./operation Operation type of module transaction. | function execTransactionFromModule(address to, uint256 value, bytes calldata data, Enum.Operation operation)
external
returns (bool success);
| function execTransactionFromModule(address to, uint256 value, bytes calldata data, Enum.Operation operation)
external
returns (bool success);
| 30,737 |
29 | // Maintain a maximum allowable transfer size (in Ether) for the deposit manager. | uint256 private _etherLimit; // unused
bool private _originatesFromReserveTrader; // unused, don't change storage layout
uint256 private constant _VERSION = 1016;
| uint256 private _etherLimit; // unused
bool private _originatesFromReserveTrader; // unused, don't change storage layout
uint256 private constant _VERSION = 1016;
| 29,353 |
703 | // res += valcoefficients[175]. | res := addmod(res,
mulmod(val, /*coefficients[175]*/ mload(0x19e0), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[175]*/ mload(0x19e0), PRIME),
PRIME)
| 19,767 |
11 | // 所有僵尸集合 | Zombie[] public zombies;
| Zombie[] public zombies;
| 3,538 |
30 | // A mapping from tokens IDs to the address that owns them. All tokens have some valid owner address | mapping (uint256 => address) public tokenIndexToOwner;
| mapping (uint256 => address) public tokenIndexToOwner;
| 30,766 |
143 | // total amount of tokens to be released at the end of the vesting | uint256 amountTotal;
| uint256 amountTotal;
| 25,484 |
6 | // Results a metadata URI tokenId token URI per token ID / | function uri(uint256 tokenId)
public
view
override(ERC1155URIStorage)
returns (string memory)
| function uri(uint256 tokenId)
public
view
override(ERC1155URIStorage)
returns (string memory)
| 37,542 |
21 | // | * @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| * @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| 74,382 |
1 | // pool data view functions | function getA() external view returns (uint256);
function getAPrecise() external view returns (uint256);
function getAllowlist() external view returns (IAllowlist);
function getToken(uint8 index) external view returns (IERC20);
function getTokenIndex(address tokenAddress) external view returns (... | function getA() external view returns (uint256);
function getAPrecise() external view returns (uint256);
function getAllowlist() external view returns (IAllowlist);
function getToken(uint8 index) external view returns (IERC20);
function getTokenIndex(address tokenAddress) external view returns (... | 6,568 |
39 | // Transfer INCH to Purchaser | inchWormContract.transfer(msg.sender, _inchToBuy);
emit BuyInchWithWei(_inchToBuy, msg.value);
| inchWormContract.transfer(msg.sender, _inchToBuy);
emit BuyInchWithWei(_inchToBuy, msg.value);
| 33,325 |
2 | // Adds liquidity to the pool. / | function addLiquidity(uint256 _amountCk, uint256 _amountUsdc, address to)
external
nonReentrant
returns (
uint256 calculatedAmountCk,
uint256 calculatedAmountUsdc,
uint256 liquidity
)
| function addLiquidity(uint256 _amountCk, uint256 _amountUsdc, address to)
external
nonReentrant
returns (
uint256 calculatedAmountCk,
uint256 calculatedAmountUsdc,
uint256 liquidity
)
| 14,231 |
54 | // One more bit, double codes left | left <<= 1;
if (left < h.counts[len]) {
| left <<= 1;
if (left < h.counts[len]) {
| 1,940 |
24 | // This function is only callable after the curve contract has beeninitialized._amount The amount of tokens a user wants to sellreturn uint256 The reward for selling the _amount of tokens in ETH / | function sellReward(uint256 _amount)
public
view
isCurveActive()
returns (uint256)
| function sellReward(uint256 _amount)
public
view
isCurveActive()
returns (uint256)
| 29,224 |
7 | // get required margin, denominated in collateral | FPI.FixedPointInt memory collateralRequired = _getMarginRequired(_vault, hasShort, hasLong);
FPI.FixedPointInt memory excessCollateral = collateralAmount.sub(collateralRequired);
bool isExcess = excessCollateral.isGreaterThanOrEqual(ZERO);
address otoken = hasLong ? _vault.longOtokens[... | FPI.FixedPointInt memory collateralRequired = _getMarginRequired(_vault, hasShort, hasLong);
FPI.FixedPointInt memory excessCollateral = collateralAmount.sub(collateralRequired);
bool isExcess = excessCollateral.isGreaterThanOrEqual(ZERO);
address otoken = hasLong ? _vault.longOtokens[... | 8,489 |
70 | // Emitted when quorum votes basis points is set | event QuorumVotesBPSSet(uint256 oldQuorumVotesBPS, uint256 newQuorumVotesBPS);
| event QuorumVotesBPSSet(uint256 oldQuorumVotesBPS, uint256 newQuorumVotesBPS);
| 65,117 |
19 | // Convenience method for a pairing check for three pairs. | function pairingProd3(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2
| function pairingProd3(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2
| 6,747 |
17 | // BridgeOperationsStorage Functionality for storing processed bridged operations. / | abstract contract BridgeOperationsStorage is EternalStorage {
/**
* @dev Stores the bridged token of a message sent to the AMB bridge.
* @param _messageId of the message sent to the bridge.
* @param _token bridged token address.
*/
function setMessageToken(bytes32 _messageId, address _token)... | abstract contract BridgeOperationsStorage is EternalStorage {
/**
* @dev Stores the bridged token of a message sent to the AMB bridge.
* @param _messageId of the message sent to the bridge.
* @param _token bridged token address.
*/
function setMessageToken(bytes32 _messageId, address _token)... | 39,036 |
19 | // to return the tx origin just for the testing purposes | address public txorigin;
| address public txorigin;
| 13,140 |
80 | // sUSD | _token = IERC20(address(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51));
tokenList.push(
TokenInfo({
token: _token,
decimals: _token.decimals(),
price: 1e18,
curveID: 3
})
| _token = IERC20(address(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51));
tokenList.push(
TokenInfo({
token: _token,
decimals: _token.decimals(),
price: 1e18,
curveID: 3
})
| 12,454 |
79 | // The accrued but not yet transferred rewards for each user | mapping(address => uint256) public rewardsAccrued;
| mapping(address => uint256) public rewardsAccrued;
| 17,270 |
35 | // Returns the vesting schedule information for a given identifier.return the vesting schedule structure information / | function getVestingSchedule(
bytes32 vestingScheduleId
| function getVestingSchedule(
bytes32 vestingScheduleId
| 9,022 |
10 | // Set mint price for a CryptoSea Friend. / | function setMintPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
| function setMintPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
| 62,631 |
934 | // Upper limit on how much of this token the contract can hold at any time | uint72 maxCollateralBalance;
| uint72 maxCollateralBalance;
| 3,975 |
57 | // such situation can happen when calculated limits relative to the token decimals are too low e.g. minPerTx(address(0)) == 1014, _decimals == 3. _minPerTx happens to be 0, which is not allowed. in this case, limits are raised to the default values | if (_minPerTx == 0) {
_minPerTx = 1;
if (_maxPerTx <= _minPerTx) {
_maxPerTx = 100;
_executionMaxPerTx = 100;
if (_dailyLimit <= _maxPerTx || _executionDailyLimit <= _executionMaxPerTx) {
_dai... | if (_minPerTx == 0) {
_minPerTx = 1;
if (_maxPerTx <= _minPerTx) {
_maxPerTx = 100;
_executionMaxPerTx = 100;
if (_dailyLimit <= _maxPerTx || _executionDailyLimit <= _executionMaxPerTx) {
_dai... | 2,269 |
28 | // Transfer tokens to tenderizer | steak.safeTransferFrom(_for, address(this), _amount);
_deposit(_for, _amount);
| steak.safeTransferFrom(_for, address(this), _amount);
_deposit(_for, _amount);
| 20,716 |
2 | // Provide registry information | string public constant override Name = "Withdraw";
string public constant override StateEncoding =
"tuple(bytes initiatorSignature, address initiator, address responder, bytes32 data, uint256 nonce, uint256 fee, address callTo, bytes callData)";
string public constant override ResolverEncoding =
... | string public constant override Name = "Withdraw";
string public constant override StateEncoding =
"tuple(bytes initiatorSignature, address initiator, address responder, bytes32 data, uint256 nonce, uint256 fee, address callTo, bytes callData)";
string public constant override ResolverEncoding =
... | 39,287 |
2 | // Multiplies two numbers, returns an error on overflow. / | function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {
if (a == 0) {
return (MathError.NO_ERROR, 0);
}
uint256 c = a * b;
if (c / a != b) {
return (MathError.INTEGER_OVERFLOW, 0);
} else {
return (MathError.NO_ERROR, c);
}
}
| function mulUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) {
if (a == 0) {
return (MathError.NO_ERROR, 0);
}
uint256 c = a * b;
if (c / a != b) {
return (MathError.INTEGER_OVERFLOW, 0);
} else {
return (MathError.NO_ERROR, c);
}
}
| 27,387 |
3 | // Exchange ID for converting between MATIC and WMATIC | uint256 constant WETH_ID = type(uint256).max;
| uint256 constant WETH_ID = type(uint256).max;
| 26,454 |
32 | // checking of allowance and token value is done by SafeMath | balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); ... | balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); ... | 15,655 |
19 | // Emit the Transfer/Mint event. the 0x0 source address implies a mint It will also provide the circulating supply info. | emit TransferSingle(
msg.sender,
address(0x0),
dst,
id,
quantity
);
| emit TransferSingle(
msg.sender,
address(0x0),
dst,
id,
quantity
);
| 16,366 |
72 | // vault finalization task, called when owner calls finalize() | function finalization() internal {
if (goalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
super.finalization();
}
| function finalization() internal {
if (goalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
super.finalization();
}
| 33,373 |
1 | // information about each photography request photography request by busincess acount holders | struct PhotographyRequest {
address requestMaker;
string logo;// ipfs hash to the logo
string description;
uint price;
uint id;
}
| struct PhotographyRequest {
address requestMaker;
string logo;// ipfs hash to the logo
string description;
uint price;
uint id;
}
| 33,600 |
15 | // Returns supply claimed by claimer for a given conditionId. | function getSupplyClaimedByWallet(
uint256 _conditionId,
address _claimer
| function getSupplyClaimedByWallet(
uint256 _conditionId,
address _claimer
| 11,744 |
3 | // Game |
uint countPresses;
uint256 countInvestorDividends;
uint amountPlayed;
uint32 timerEnd; // The timestamp for the end after this time stamp, the winner can withdraw its reward
uint32 timerInterval = 21600; // We set the interval of 3h... |
uint countPresses;
uint256 countInvestorDividends;
uint amountPlayed;
uint32 timerEnd; // The timestamp for the end after this time stamp, the winner can withdraw its reward
uint32 timerInterval = 21600; // We set the interval of 3h... | 24,885 |
145 | // -------------------------------------------------------------------------------------- Added due to Matic <-> Ethereum PoS transfer requiring 1PLCO2 on Matic network to be burned or minted. Eth supply can be increased if it is ever necessary.---------------------------------------------------------------------------... | function setMaxVolume(uint maxVolume) external onlyOwner {
_maxSupply = maxVolume;
}
| function setMaxVolume(uint maxVolume) external onlyOwner {
_maxSupply = maxVolume;
}
| 58,081 |
599 | // Verifies that a hash has been signed by the given signer./hash Any 32-byte hash./signature Proof that the hash has been signed by signer./ return isValid `true` if the signature is valid for the given hash and signer. | function isValidHashSignature(
bytes32 hash,
address signerAddress,
bytes memory signature
)
public
view
returns (bool isValid);
| function isValidHashSignature(
bytes32 hash,
address signerAddress,
bytes memory signature
)
public
view
returns (bool isValid);
| 12,464 |
5 | // Checks if a user has been supplying only one reserve as collateral this uses a simple trick - if a number is a power of two (only one bit set) then n & (n - 1) == 0 self The configuration objectreturn True if the user has been supplying as collateral one reserve, false otherwise / | ) internal pure returns (bool) {
uint256 collateralData = self.data & COLLATERAL_MASK;
return
collateralData != 0 && (collateralData & (collateralData - 1) == 0);
}
| ) internal pure returns (bool) {
uint256 collateralData = self.data & COLLATERAL_MASK;
return
collateralData != 0 && (collateralData & (collateralData - 1) == 0);
}
| 32,881 |
88 | // File: contracts/external/Require.sol/// Require dYdX Stringifies parameters to pretty-print revert messages. Costs more gas than regular require() / | library Require {
// ============ Constants ============
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 consta... | library Require {
// ============ Constants ============
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 consta... | 1,684 |
0 | // Interface of the ERC20 standard as defined in the EIP. / | interface IERC20withDec is IERC20 {
/**
* @dev Returns the number of decimals used for the token
*/
function decimals() external view returns (uint8);
}
| interface IERC20withDec is IERC20 {
/**
* @dev Returns the number of decimals used for the token
*/
function decimals() external view returns (uint8);
}
| 431 |
155 | // Core ERC1155 creator implementation / | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
using EnumerableSet for EnumerableSet.AddressSet;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
r... | abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
using EnumerableSet for EnumerableSet.AddressSet;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
r... | 73,058 |
70 | // Returns the current implementation. | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x36... | * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x36... | 6,634 |
28 | // Modifier to make a function callable only when the contract is not paused. / | modifier whenNotPaused() {
require(!paused);
_;
}
| modifier whenNotPaused() {
require(!paused);
_;
}
| 10,208 |
33 | // Require that the caller is the Oraclize contract. | require(msg.sender == oraclize_cbAddress(), "sender is not oraclize");
| require(msg.sender == oraclize_cbAddress(), "sender is not oraclize");
| 20,850 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.