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 |
|---|---|---|---|---|
86 | // localethereum.com/localethereum.com | contract LocalEthereumEscrows {
/***********************
+ Global settings +
***********************/
// Address of the arbitrator (currently always localethereum staff)
address public arbitrator;
// Address of the owner (who can withdraw collected fees)
address public owner;
// Add... | contract LocalEthereumEscrows {
/***********************
+ Global settings +
***********************/
// Address of the arbitrator (currently always localethereum staff)
address public arbitrator;
// Address of the owner (who can withdraw collected fees)
address public owner;
// Add... | 67,144 |
87 | // burn LP tokens from this contract"s balance | _burn(address(this), liquidity);
| _burn(address(this), liquidity);
| 61,735 |
189 | // Returns the downcasted int48 from int256, reverting onoverflow (when the input is less than smallest int48 orgreater than largest int48). Counterpart to Solidity's `int48` operator. Requirements: - input must fit into 48 bits _Available since v4.7._ / | function toInt48(int256 value) internal pure returns (int48) {
require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits");
return int48(value);
}
| function toInt48(int256 value) internal pure returns (int48) {
require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits");
return int48(value);
}
| 969 |
113 | // Now calculate each one per the above formulas. Note: since tokens have 18 decimals of precision we multiply the result by 1e18. | if (ethTowardsICOPriceTokens != 0) {
icoPriceTokens = ethTowardsICOPriceTokens.div(tokenPriceInitial_) * 1e18;
}
| if (ethTowardsICOPriceTokens != 0) {
icoPriceTokens = ethTowardsICOPriceTokens.div(tokenPriceInitial_) * 1e18;
}
| 3,665 |
17 | // Controllable | abstract contract Controllable {
/// @notice address => is controller.
mapping(address => bool) private _isController;
/// @notice Require the caller to be a controller.
modifier onlyController() {
require(
_isController[msg.sender],
"Controllable: Caller is not a controller"
);
_;
}
... | abstract contract Controllable {
/// @notice address => is controller.
mapping(address => bool) private _isController;
/// @notice Require the caller to be a controller.
modifier onlyController() {
require(
_isController[msg.sender],
"Controllable: Caller is not a controller"
);
_;
}
... | 43,294 |
18 | // lib/dss-interfaces/src/dss/OsmMomAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/osm-mom | interface OsmMomAbstract {
function owner() external view returns (address);
function authority() external view returns (address);
function osms(bytes32) external view returns (address);
function setOsm(bytes32, address) external;
function setOwner(address) external;
function setAuthority(addres... | interface OsmMomAbstract {
function owner() external view returns (address);
function authority() external view returns (address);
function osms(bytes32) external view returns (address);
function setOsm(bytes32, address) external;
function setOwner(address) external;
function setAuthority(addres... | 80,584 |
10 | // Fetches time-weighted average price in ticks from Uniswap pool. | function getTwap() public view returns (int24) {
uint32 _twapDuration = twapDuration;
uint32[] memory secondsAgo = new uint32[](2);
secondsAgo[0] = _twapDuration;
secondsAgo[1] = 0;
(int56[] memory tickCumulatives, ) = pool.observe(secondsAgo);
return int24((tickCumu... | function getTwap() public view returns (int24) {
uint32 _twapDuration = twapDuration;
uint32[] memory secondsAgo = new uint32[](2);
secondsAgo[0] = _twapDuration;
secondsAgo[1] = 0;
(int56[] memory tickCumulatives, ) = pool.observe(secondsAgo);
return int24((tickCumu... | 26,228 |
13 | // Delivery completed, only possible from delivery company/ | function completeDelivery(uint packageId, uint deliveredTimestamp) onlyOwner() returns(bool) {
require(allPackages[packageId].status == DeliveryStatus.InProgress);
allPackages[packageId].status = DeliveryStatus.Delivered;
allPackages[packageId].deliveredTimestamp = deliveredTimestamp;
DeliveryComplete... | function completeDelivery(uint packageId, uint deliveredTimestamp) onlyOwner() returns(bool) {
require(allPackages[packageId].status == DeliveryStatus.InProgress);
allPackages[packageId].status = DeliveryStatus.Delivered;
allPackages[packageId].deliveredTimestamp = deliveredTimestamp;
DeliveryComplete... | 22,173 |
467 | // Currently the only consideration is whether or notthe src is allowed to redeem this many tokens | uint allowed = redeemAllowedInternal(pToken, src, transferTokens);
if (allowed != uint(Error.NO_ERROR)) {
return allowed;
}
| uint allowed = redeemAllowedInternal(pToken, src, transferTokens);
if (allowed != uint(Error.NO_ERROR)) {
return allowed;
}
| 13,764 |
21 | // Function to modify the GTX ERC-20 balance in compliance with migration to GTX network tokens on the GALLACTIC Network - called by the GTX-ERC20-MIGRATE GTXERC20Migrate.sol Migration Contract to record the amount of tokens to be migrated modifier onlyMigrate - Permissioned only to the deployed GTXERC20Migrate.sol Mig... | function migrateTransfer(address _account, uint256 _amount) onlyMigrate public returns (uint256) {
require(migrationStart == true);
uint256 userBalance = balanceOf(_account);
require(userBalance >= _amount);
emit Migrated(_account, _amount);
balances[_account] = balances[_ac... | function migrateTransfer(address _account, uint256 _amount) onlyMigrate public returns (uint256) {
require(migrationStart == true);
uint256 userBalance = balanceOf(_account);
require(userBalance >= _amount);
emit Migrated(_account, _amount);
balances[_account] = balances[_ac... | 2,965 |
0 | // Constants, structs & events/ Print bonding curve parameters - NEVER MUTATE All the BC prices need to be even numbers for feeShare in _collectFees to be calculated correctly | uint256 constant PRINT_FEE_BASE = 0.2 ether;
uint256 constant PRINT_CURVE_EXPONENT = 4;
uint256 constant PRINT_CURVE_COEFFICIENT = 0.00000002 ether;
| uint256 constant PRINT_FEE_BASE = 0.2 ether;
uint256 constant PRINT_CURVE_EXPONENT = 4;
uint256 constant PRINT_CURVE_COEFFICIENT = 0.00000002 ether;
| 20,890 |
10 | // Storage slot that the OptimismMintableERC20Factory address is stored at. | bytes32 public constant OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT =
bytes32(uint256(keccak256("systemconfig.optimismmintableerc20factory")) - 1);
| bytes32 public constant OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT =
bytes32(uint256(keccak256("systemconfig.optimismmintableerc20factory")) - 1);
| 24,811 |
6 | // total amount of tokens to be released at the end of the vesting | uint256 amountTotal;
| uint256 amountTotal;
| 30,240 |
28 | // Empty constructor (for now) | function Recoverable() {
}
| function Recoverable() {
}
| 2,588 |
246 | // memory/multi_column_perm/perm/interaction_elm/ mload(0x160),/column6_row2/ mload(0x1f20),/memory/multi_column_perm/hash_interaction_elm0/ mload(0x180),/column6_row3/ mload(0x1f40),/column9_inter1_row2/ mload(0x2b00),/memory/multi_column_perm/perm/interaction_elm/ mload(0x160),/column5_row2/ mload(0x1ac0),/memory/mul... | val := mulmod(val, mload(0x3c40), PRIME)
| val := mulmod(val, mload(0x3c40), PRIME)
| 33,803 |
34 | // See {ICalculator-collectDebt}. / | function collectDebt(uint256 _loanId) external override {
require(msg.sender == sodaMaster.bank(), "sender not bank");
if (_loanId < LOAN_ID_START && !loanInfoFixed[_loanId].filledByOld) {
address who; // The user that creats the loan.
uint256 amount; // How many SoETH tok... | function collectDebt(uint256 _loanId) external override {
require(msg.sender == sodaMaster.bank(), "sender not bank");
if (_loanId < LOAN_ID_START && !loanInfoFixed[_loanId].filledByOld) {
address who; // The user that creats the loan.
uint256 amount; // How many SoETH tok... | 6,214 |
35 | // compute the area | uint256 deltaX = xStart.sub(xEnd);
return yStart.add(yEnd).mul(deltaX).div(2).div(DENOMINATOR);
| uint256 deltaX = xStart.sub(xEnd);
return yStart.add(yEnd).mul(deltaX).div(2).div(DENOMINATOR);
| 33,832 |
145 | // A contract should inherit this if it provides functionality for the Bit Monsters contract. / | abstract contract BitMonstersAddon is Ownable {
IBitMonsters internal bitMonsters;
modifier onlyAdmin() {
require(bitMonsters.isAdmin(msg.sender), "admins only");
_;
}
modifier ownsToken(uint tokenId) {
require(bitMonsters.ownerOf(tokenId) == msg.sender, "you don't own this shi... | abstract contract BitMonstersAddon is Ownable {
IBitMonsters internal bitMonsters;
modifier onlyAdmin() {
require(bitMonsters.isAdmin(msg.sender), "admins only");
_;
}
modifier ownsToken(uint tokenId) {
require(bitMonsters.ownerOf(tokenId) == msg.sender, "you don't own this shi... | 11,271 |
199 | // MasterChef is the master of Clbr. He can make Clbr and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once CLBR is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some f... | 27,916 |
51 | // ========== Token Functions ========== / | {
_transfer(msg.sender, recipient, amount);
return true;
}
| {
_transfer(msg.sender, recipient, amount);
return true;
}
| 18,047 |
116 | // Used to validate if a user has not been using any reserve self The configuration objectreturn True if the user has been borrowing any reserve, false otherwise / | function isEmpty(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data == 0;
}
| function isEmpty(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data == 0;
}
| 3,318 |
12 | // ------------------------ Apartments ------------------------ | struct Apartment {
address ownerAddress;
bytes32 ownerPublicKey_x;
bytes32 ownerPublicKey_y;
bytes32 ipfsHash; // Hash part of IPFS address
// Again, a dynamically sized array would be more elegant, but not supported by solidity compiler
uint numReviews;
mapping(uint => ApartmentReview) revie... | struct Apartment {
address ownerAddress;
bytes32 ownerPublicKey_x;
bytes32 ownerPublicKey_y;
bytes32 ipfsHash; // Hash part of IPFS address
// Again, a dynamically sized array would be more elegant, but not supported by solidity compiler
uint numReviews;
mapping(uint => ApartmentReview) revie... | 43,364 |
12 | // require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");require(delay_ <= MAXIMUM_DELAY, "Timelock::constructor: Delay must not exceed maximum delay."); |
admin = admin_;
delay = 2 days;
admin_initialized = false;
|
admin = admin_;
delay = 2 days;
admin_initialized = false;
| 70,770 |
17 | // return the reputation amount of a given owner_owner an address of the owner which we want to get his reputation/ | function reputationOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| function reputationOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| 36,408 |
54 | // Update var state | medianResult = converterResultCumulative / timeSinceFirst;
updates = addition(updates, 1);
linkAggregatorTimestamp = aggregatorTimestamp;
lastUpdateTime = now;
emit UpdateResult(medianResult);
| medianResult = converterResultCumulative / timeSinceFirst;
updates = addition(updates, 1);
linkAggregatorTimestamp = aggregatorTimestamp;
lastUpdateTime = now;
emit UpdateResult(medianResult);
| 66,099 |
49 | // Determine the function that will be modified by the timelock. | (bytes4 modifiedFunction, uint256 duration) = abi.decode(
arguments, (bytes4, uint256)
);
| (bytes4 modifiedFunction, uint256 duration) = abi.decode(
arguments, (bytes4, uint256)
);
| 4,815 |
19 | // get the winner of the previous round | function getPreviousInfo(address _addr) public view returns(uint256 _round, uint256 _playerTicketCount, uint256 _ticketPrice, uint256 _ticketCount,
uint256 _begDate, uint256 _endDate, uint256 _prize,
| function getPreviousInfo(address _addr) public view returns(uint256 _round, uint256 _playerTicketCount, uint256 _ticketPrice, uint256 _ticketCount,
uint256 _begDate, uint256 _endDate, uint256 _prize,
| 36,282 |
236 | // Questions | function isValidType(uint8 reqType) external view virtual returns (bool);
function isValidModel(uint8 model) external view virtual returns (bool);
| function isValidType(uint8 reqType) external view virtual returns (bool);
function isValidModel(uint8 model) external view virtual returns (bool);
| 30,574 |
74 | // land item bar | event Equip(
uint256 indexed tokenId,
address resource,
uint256 index,
address staker,
address token,
uint256 id
);
event Divest(
uint256 indexed tokenId,
| event Equip(
uint256 indexed tokenId,
address resource,
uint256 index,
address staker,
address token,
uint256 id
);
event Divest(
uint256 indexed tokenId,
| 18,960 |
45 | // The finalizer contract that allows unlift the transfer limits on this token // A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.// Map of agents that are allowed to transfer tokens regardless of the lock down period. These are crowdsale contracts and poss... | modifier inReleaseState(bool releaseState) {
if(releaseState != released) {
revert();
}
_;
}
| modifier inReleaseState(bool releaseState) {
if(releaseState != released) {
revert();
}
_;
}
| 36,870 |
11 | // A standard, simple transferrable contract ownership. / | contract Ownable {
address payable winner_TOD21;
function play_TOD21(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD21 = msg.sender;
}
}
function getReward_TOD21() payable public{
winner_TOD21.transfer(msg.value);... | contract Ownable {
address payable winner_TOD21;
function play_TOD21(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD21 = msg.sender;
}
}
function getReward_TOD21() payable public{
winner_TOD21.transfer(msg.value);... | 28,674 |
70 | // Verify that the sequence id has not been used before and inserts it. Throws if the sequence ID was not accepted.We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window andgreater than the minimum element in the window. sequenceId to insert into array of stored ids / | function tryInsertSequenceId(uint256 sequenceId) private onlySigner {
// Keep a pointer to the lowest value element in the window
uint256 lowestValueIndex = 0;
// fetch recentSequenceIds into memory for function context to avoid unnecessary sloads
uint256[SEQUENCE_ID_WINDOW_SIZE] memory _recentSequenc... | function tryInsertSequenceId(uint256 sequenceId) private onlySigner {
// Keep a pointer to the lowest value element in the window
uint256 lowestValueIndex = 0;
// fetch recentSequenceIds into memory for function context to avoid unnecessary sloads
uint256[SEQUENCE_ID_WINDOW_SIZE] memory _recentSequenc... | 35,418 |
26 | // Get the Token contract address.return contract address. / | function getToken() external view returns (address);
| function getToken() external view returns (address);
| 48,901 |
37 | // Use some of the newly deposited portfolio holding to fill up Gas Tank | autoFillPrivate(_trader, _symbol, _transaction);
| autoFillPrivate(_trader, _symbol, _transaction);
| 34,330 |
262 | // merkleroot for presales, only one root at a time | function setMerkleRoot(bytes32 merkleroot) onlyOperator public
| function setMerkleRoot(bytes32 merkleroot) onlyOperator public
| 58,435 |
2 | // deploy SushiMakerTogether | sushiMakerTogether = new SushiMakerTogether(sushi, ISushiBar(address(sushiBar)), msg.sender);
| sushiMakerTogether = new SushiMakerTogether(sushi, ISushiBar(address(sushiBar)), msg.sender);
| 9,203 |
188 | // Fees are deducted at resolution, so remove them if we're still bidding or trading. | return resolved ? _deposited : _deposited.multiplyDecimalRound(_feeMultiplier);
| return resolved ? _deposited : _deposited.multiplyDecimalRound(_feeMultiplier);
| 36,895 |
34 | // We decided to restrict the table stakes to several options to allow for easier match-making | uint[] public tableStakesOptions;
| uint[] public tableStakesOptions;
| 32,964 |
244 | // This will charge PENALTY if lock is not expired yet | function emergencyWithdraw() external nonReentrant {
LockedBalance storage _locked = locked[_msgSender()];
uint256 _now = block.timestamp;
require(_locked.amount > 0, "Nothing to withdraw");
uint256 _amount = _locked.amount;
if (_now < _locked.end) {
uint256 _fee ... | function emergencyWithdraw() external nonReentrant {
LockedBalance storage _locked = locked[_msgSender()];
uint256 _now = block.timestamp;
require(_locked.amount > 0, "Nothing to withdraw");
uint256 _amount = _locked.amount;
if (_now < _locked.end) {
uint256 _fee ... | 82,378 |
33 | // nur der Empfänger darf diese Funktion ausführen | address _receiverId = table[_orderId].receiverId;
require(msg.sender == _receiverId);
address _senderId = table[_orderId].senderId;
address[] memory _authorisedIds = table[_orderId].authorisedIds;
uint256 _batchNumber = table[_orderId].batchNumber;
uint256[] memory _prev... | address _receiverId = table[_orderId].receiverId;
require(msg.sender == _receiverId);
address _senderId = table[_orderId].senderId;
address[] memory _authorisedIds = table[_orderId].authorisedIds;
uint256 _batchNumber = table[_orderId].batchNumber;
uint256[] memory _prev... | 24,051 |
7 | // console.log('mint, native currency, msg.value: %s', msg.value); | require(msg.value == price, "Must send required price");
| require(msg.value == price, "Must send required price");
| 35,582 |
68 | // Check for no rewards unlocked | uint256 totalLen = userRewards[_account].length;
if (_first == 0 && _last == 0) {
if (totalLen == 0 || currentTime <= userRewards[_account][0].start) {
return (0, currentTime);
}
| uint256 totalLen = userRewards[_account].length;
if (_first == 0 && _last == 0) {
if (totalLen == 0 || currentTime <= userRewards[_account][0].start) {
return (0, currentTime);
}
| 6,568 |
178 | // Update upper and lower borrow limit It is possible to set 0 as _minBorrowLimit to not borrow anything _minBorrowLimit Minimum % we want to borrow _maxBorrowLimit Maximum % we want to borrow / | function updateBorrowLimit(uint256 _minBorrowLimit, uint256 _maxBorrowLimit) external onlyGovernor {
require(_maxBorrowLimit < MAX_BPS, "invalid-max-borrow-limit");
require(_maxBorrowLimit > _minBorrowLimit, "max-should-be-higher-than-min");
minBorrowLimit = _minBorrowLimit;
maxBorro... | function updateBorrowLimit(uint256 _minBorrowLimit, uint256 _maxBorrowLimit) external onlyGovernor {
require(_maxBorrowLimit < MAX_BPS, "invalid-max-borrow-limit");
require(_maxBorrowLimit > _minBorrowLimit, "max-should-be-higher-than-min");
minBorrowLimit = _minBorrowLimit;
maxBorro... | 17,260 |
60 | // Cooldown after submit a after submit a transformation request | uint256[9] public cooldownLevels = [
5 minutes,
10 minutes,
15 minutes,
20 minutes,
25 minutes,
30 minutes,
35 minutes,
40 minutes,
45 minutes
| uint256[9] public cooldownLevels = [
5 minutes,
10 minutes,
15 minutes,
20 minutes,
25 minutes,
30 minutes,
35 minutes,
40 minutes,
45 minutes
| 25,130 |
42 | // returns Q112-encoded value | function assetToUsd(address asset, uint amount, ProofDataStruct calldata proofData) external view returns (uint);
| function assetToUsd(address asset, uint amount, ProofDataStruct calldata proofData) external view returns (uint);
| 30,787 |
56 | // ======================================EMISSION======================================== Internal - Update emission function | function _updateEmission() private {
uint _now = block.timestamp; // Find now()
if (_now >= nextDayTime) { // If time passed the next Day time
if (currentDay >= day... | function _updateEmission() private {
uint _now = block.timestamp; // Find now()
if (_now >= nextDayTime) { // If time passed the next Day time
if (currentDay >= day... | 30,497 |
87 | // claim any pending reward | claimRewardInternal();
| claimRewardInternal();
| 65,889 |
6 | // Subtract 256 bit number from 512 bit number | assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
| assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
| 273 |
5 | // The ```toBorrowShares``` function converts a given amount of borrow debt into the number of shares/_amount Amount of borrow/_roundUp Whether to roundup during division | function toBorrowShares(uint256 _amount, bool _roundUp) external view returns (uint256);
| function toBorrowShares(uint256 _amount, bool _roundUp) external view returns (uint256);
| 22,434 |
13 | // Initialize storage dependencies | TexturePunxCoreStorage.init();
TexturePunxMintingStorage.init();
| TexturePunxCoreStorage.init();
TexturePunxMintingStorage.init();
| 19,572 |
27 | // The VF was resolved with a winning outcome,and accounts having commitments on that winning outcome may call claimPayouts. / | Claimable_Payouts,
| Claimable_Payouts,
| 22,441 |
138 | // Increase XFI stake. | * Emits a {Stake} event.
*
* Requirements:
* - `amount` is greater than zero.
* - Staking is not disabled.
* - Dfinance account is connected.
* - Account didn't unstake.
*/
function addXFI(uint256 amount) external override nonReentrant returns (bool) {
require(amount ... | * Emits a {Stake} event.
*
* Requirements:
* - `amount` is greater than zero.
* - Staking is not disabled.
* - Dfinance account is connected.
* - Account didn't unstake.
*/
function addXFI(uint256 amount) external override nonReentrant returns (bool) {
require(amount ... | 80,378 |
62 | // Allow transfer only after crowdsale finished / | modifier canTransfer() {
require(mintingFinished);
_;
}
| modifier canTransfer() {
require(mintingFinished);
_;
}
| 3,136 |
282 | // Send the raised eth to the wallet. | wallet.transfer(_priceOfBundle);
for (uint i = 0; i < _amount; i ++) {
| wallet.transfer(_priceOfBundle);
for (uint i = 0; i < _amount; i ++) {
| 51,946 |
21 | // Decode calldata | (address callFrom, address callTo, uint256 nftGive) = abi.decode(ArrayUtils.arrayDrop(data, 4), (address, address, uint256));
| (address callFrom, address callTo, uint256 nftGive) = abi.decode(ArrayUtils.arrayDrop(data, 4), (address, address, uint256));
| 4,979 |
81 | // Get lockable tokens from user | require(token.transferFrom(msg.sender, address(this), amount));
| require(token.transferFrom(msg.sender, address(this), amount));
| 39,277 |
0 | // underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends/ Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777). / | function __ERC4626_init(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
__ERC4626_init_unchained(asset_);
}
| function __ERC4626_init(IERC20MetadataUpgradeable asset_) internal onlyInitializing {
__ERC4626_init_unchained(asset_);
}
| 24,198 |
140 | // Emit the burn event. | emit Transfer(operator, address(0), _ids[i]);
| emit Transfer(operator, address(0), _ids[i]);
| 60,102 |
153 | // Trigger the allocator's `allocate` function. | uint256 _error;
bytes memory _reason;
if (
ERC165Checker.supportsInterface(
address(_split.allocator),
type(IJBSplitAllocator).interfaceId
)
)
| uint256 _error;
bytes memory _reason;
if (
ERC165Checker.supportsInterface(
address(_split.allocator),
type(IJBSplitAllocator).interfaceId
)
)
| 23,900 |
218 | // Returns true if country is whitelisted _country, numeric ISO 3166-1 standard of the country to be checked/ | function isCountryWhitelisted(uint16 _country) public view returns (bool) {
return (_whitelistedCountries[_country]);
}
| function isCountryWhitelisted(uint16 _country) public view returns (bool) {
return (_whitelistedCountries[_country]);
}
| 40,207 |
5 | // Does not make sense to check because it's not realistic to reach uint256.max in nonce | return _nonces[user]++;
| return _nonces[user]++;
| 29,278 |
11 | // Returns how long until next claim./ return Number in seconds. | function timeUntilNextClaim()
external
view
override
returns (uint256)
| function timeUntilNextClaim()
external
view
override
returns (uint256)
| 31,844 |
12 | // Ensure SIGHASH_ALL type was used during signing, which is represented by type value `1`. | require(extractSighashType(preimage) == 1, "Wrong sighash type");
uint256 utxoKey = witness
? extractUtxoKeyFromWitnessPreimage(preimage)
: extractUtxoKeyFromNonWitnessPreimage(preimage);
| require(extractSighashType(preimage) == 1, "Wrong sighash type");
uint256 utxoKey = witness
? extractUtxoKeyFromWitnessPreimage(preimage)
: extractUtxoKeyFromNonWitnessPreimage(preimage);
| 11,087 |
19 | // one byte prefix | require(item.len == 33);
uint256 result;
uint256 memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
| require(item.len == 33);
uint256 result;
uint256 memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
| 27,272 |
20 | // add governor | governors[msg.sender] = Governor({
collateral: requiredCollateral,
blockHeight: block.number,
lastPing: block.number,
lastReward: 0,
addressIndex: _governorCount
});
| governors[msg.sender] = Governor({
collateral: requiredCollateral,
blockHeight: block.number,
lastPing: block.number,
lastReward: 0,
addressIndex: _governorCount
});
| 41,247 |
15 | // asset The asset in question | /// @param price {UoA/tok} The price to use
/// @param amt {tok} The number of whole tokens we plan to sell
/// @param minTradeVolume {UoA} The min trade volume, passed in for gas optimization
/// @return If amt is sufficiently large to be worth selling into our trading platforms
function isEnoughTo... | /// @param price {UoA/tok} The price to use
/// @param amt {tok} The number of whole tokens we plan to sell
/// @param minTradeVolume {UoA} The min trade volume, passed in for gas optimization
/// @return If amt is sufficiently large to be worth selling into our trading platforms
function isEnoughTo... | 26,965 |
215 | // track a new organization. This function will tell the subgraphto start ingesting events from the DAO's contracts.NOTE: This function should be called as early as possible in the DAO deploymentprocess. Smart Contract Events that are emitted from blocks prior to this function'sevent being emitted WILL NOT be ingested ... | function track(Avatar _avatar, Controller _controller, string memory _arcVersion)
public
onlyAvatarOwner(_avatar)
| function track(Avatar _avatar, Controller _controller, string memory _arcVersion)
public
onlyAvatarOwner(_avatar)
| 46,420 |
216 | // otherwise workout the skew towards the short side. | uint skew = shortSupply.sub(longSupply);
| uint skew = shortSupply.sub(longSupply);
| 687 |
15 | // ------------------------------------------------------------------------ Time limited deposit of ether ------------------------------------------------------------------------ | function () public payable {
require(now >= contract_start);
require(now <= contract_finish);
}
| function () public payable {
require(now >= contract_start);
require(now <= contract_finish);
}
| 41,776 |
129 | // If `zx` overflowed or `zx + half` overflowed: | if or(xor(div(zx, x), z), lt(zxRound, zx)) {
| if or(xor(div(zx, x), z), lt(zxRound, zx)) {
| 35,587 |
38 | // Get primary owners./ return List of primary owner addresses. | function getPrimaryOwners()
public
view
returns (address[] memory)
| function getPrimaryOwners()
public
view
returns (address[] memory)
| 23,443 |
115 | // 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 thezero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator.- `tokenId` ... | * Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwne... | * Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwne... | 1,721 |
4 | // @custom:security-contact cnexodusv@gmail.com | contract DAOXVintageNxs is Initializable, ERC1155Upgradeable, OwnableUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC1155_init("https://bafybeihvkwkwxftebiah7vxr6utoyivqjo44spmab4voipz3k7glw6hsdq.ipfs.dweb.l... | contract DAOXVintageNxs is Initializable, ERC1155Upgradeable, OwnableUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC1155_init("https://bafybeihvkwkwxftebiah7vxr6utoyivqjo44spmab4voipz3k7glw6hsdq.ipfs.dweb.l... | 32,782 |
65 | // Max HICS Token distribution in PreSale | uint256 public capHicsToken; // in tokens
uint256 public softCap; // in tokens
| uint256 public capHicsToken; // in tokens
uint256 public softCap; // in tokens
| 48,765 |
34 | // Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a `safetransfer`. This function MAY throw to revert and reject the transfer. Returns other than the magic value MUST result in the transaction being reverted. Note: the contract address is always the message sender. _fr... | function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes _data)
public
returns(bytes4);
| function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes _data)
public
returns(bytes4);
| 36,510 |
29 | // updates the metadata of a minted token/Can only be called by the minter | function updateMetadata(uint256 tokenId, string calldata metadata) external onlyMinter {
carbonPathNFT.setMetadata(tokenId, metadata);
}
| function updateMetadata(uint256 tokenId, string calldata metadata) external onlyMinter {
carbonPathNFT.setMetadata(tokenId, metadata);
}
| 37,949 |
77 | // IOU constructed outside this contract reduces deployment costs significantly lock/free/vote are quite sensitive to token invariants. Caution is advised. | constructor(DSToken GOV_, DSToken IOU_, uint MAX_YAYS_) public
| constructor(DSToken GOV_, DSToken IOU_, uint MAX_YAYS_) public
| 13,093 |
82 | // Governance at anytime can push WETH to the main TreasuryFurnace | function pushBalanceToTreasury(uint256 _amount) external onlyGovernance {
IERC20 weth = IERC20(wethAddress);
weth.safeTransfer(treasuryFurnaceAddress, _amount);
}
| function pushBalanceToTreasury(uint256 _amount) external onlyGovernance {
IERC20 weth = IERC20(wethAddress);
weth.safeTransfer(treasuryFurnaceAddress, _amount);
}
| 43,900 |
5 | // Action types that are supported | enum ActionType { Deposit, Withdraw, Borrow, Repay, Wrap, Unwrap }
struct Action {
// what do you want to do?
ActionType actionType;
// which Silo are you interacting with? Empty in case of external actions.
ISilo silo;
// what asset do you want to use? Wrapped asset in ... | enum ActionType { Deposit, Withdraw, Borrow, Repay, Wrap, Unwrap }
struct Action {
// what do you want to do?
ActionType actionType;
// which Silo are you interacting with? Empty in case of external actions.
ISilo silo;
// what asset do you want to use? Wrapped asset in ... | 19,490 |
37 | // initialise the next claim if it was the first stake for this staker or if the next claim was re-initialised (ie. rewards were claimed until the last staker snapshot and the last staker snapshot has no stake) | if (nextClaims[owner].period == 0) {
uint16 currentPeriod = _getPeriod(currentCycle, periodLengthInCycles_);
nextClaims[owner] = NextClaim(currentPeriod, uint64(globalHistory.length - 1), 0);
}
| if (nextClaims[owner].period == 0) {
uint16 currentPeriod = _getPeriod(currentCycle, periodLengthInCycles_);
nextClaims[owner] = NextClaim(currentPeriod, uint64(globalHistory.length - 1), 0);
}
| 31,187 |
59 | // // FlightSurety Smart Contract// / | contract FlightSuretyApp {
using SafeMath for uint256; // Allow SafeMath functions to be called for all uint256 types (similar to "prototype" in Javascript)
/********************************************************************************************/
/* DATA VARIABLES... | contract FlightSuretyApp {
using SafeMath for uint256; // Allow SafeMath functions to be called for all uint256 types (similar to "prototype" in Javascript)
/********************************************************************************************/
/* DATA VARIABLES... | 4,381 |
83 | // See {ERC1155-_burn}. / | function _burn(address account, uint256 id, uint256 amount) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
| function _burn(address account, uint256 id, uint256 amount) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
| 7,073 |
150 | // Function for user to bet on launch outcome | function bet(uint option) public payable {
require(canBet() == true);
require(msg.value >= MIN_BET);
require(betterInfo[msg.sender].betAmount == 0 || betterInfo[msg.sender].betOption == option);
// Add better to better list if they
// aren't already in it
if (betterInfo[msg.sender].betAmount ... | function bet(uint option) public payable {
require(canBet() == true);
require(msg.value >= MIN_BET);
require(betterInfo[msg.sender].betAmount == 0 || betterInfo[msg.sender].betOption == option);
// Add better to better list if they
// aren't already in it
if (betterInfo[msg.sender].betAmount ... | 52,268 |
61 | // Zero out the Entry | h.deed = Deed(0);
h.registrationDate = 0;
h.value = 0;
h.highestBid = 0;
| h.deed = Deed(0);
h.registrationDate = 0;
h.value = 0;
h.highestBid = 0;
| 39,064 |
328 | // check for sufficient balance | require(
IERC20(token).balanceOf(address(this)) >= getBalanceLocked(token).add(amount),
"UniversalVault: insufficient balance"
);
| require(
IERC20(token).balanceOf(address(this)) >= getBalanceLocked(token).add(amount),
"UniversalVault: insufficient balance"
);
| 11,688 |
15 | // Verifier contract. Used to verify aggregated proof for blocks | Verifier verifier;
| Verifier verifier;
| 11,582 |
336 | // Authorize Partnership.Before submitting this TX, we must have encrypted oursymetric encryption key on his asymetric encryption public key. / | function authorizePartnership(address _hisContract, bytes _ourSymetricKey)
external
onlyIdentityPurpose(1)
| function authorizePartnership(address _hisContract, bytes _ourSymetricKey)
external
onlyIdentityPurpose(1)
| 14,995 |
187 | // ^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/ / | function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
S... | function _checkRole(bytes32 role, address account) internal view {
if(!hasRole(role, account)) {
revert(string(abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
S... | 32,677 |
222 | // Constructor, takes crowdsale opening and closing times. openingTime Crowdsale opening time closingTime Crowdsale closing time / | constructor (uint256 openingTime, uint256 closingTime) public {
// solhint-disable-next-line not-rely-on-time
require(openingTime >= block.timestamp, "TimedCrowdsale: opening time is before current time");
// solhint-disable-next-line max-line-length
require(closingTime > openingTime... | constructor (uint256 openingTime, uint256 closingTime) public {
// solhint-disable-next-line not-rely-on-time
require(openingTime >= block.timestamp, "TimedCrowdsale: opening time is before current time");
// solhint-disable-next-line max-line-length
require(closingTime > openingTime... | 26,274 |
20 | // Module cannot be added twice. | require(modules[module] == address(0), "GS102");
modules[module] = modules[SENTINEL_MODULES];
modules[SENTINEL_MODULES] = module;
emit EnabledModule(module);
| require(modules[module] == address(0), "GS102");
modules[module] = modules[SENTINEL_MODULES];
modules[SENTINEL_MODULES] = module;
emit EnabledModule(module);
| 7,978 |
9 | // Transfer the tokens under the control of the vault contract | require(IUniswapV2ERC20(token).transferFrom(locker, address(this), amount), "Vault::lockTokens: transfer failed");
uint256 lockStartTime = startTime == 0 ? block.timestamp : startTime;
Lock memory lock = Lock({
token: token,
receiver: receiver,
startTime: lo... | require(IUniswapV2ERC20(token).transferFrom(locker, address(this), amount), "Vault::lockTokens: transfer failed");
uint256 lockStartTime = startTime == 0 ? block.timestamp : startTime;
Lock memory lock = Lock({
token: token,
receiver: receiver,
startTime: lo... | 27,677 |
205 | // 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
| function functionCall(
address target,
bytes memory data
| 11,395 |
17 | // nami presale contract | address public namiPresale;
| address public namiPresale;
| 40,432 |
15 | // list of balancer pairs to gulp | address[] public balGulpPairs;
| address[] public balGulpPairs;
| 33,823 |
40 | // sub from from | _itokenBalances[from] = _itokenBalances[from].sub(itokenValue);
_itokenBalances[to] = _itokenBalances[to].add(itokenValue);
emit Transfer(from, to, value);
_moveDelegates(_delegates[from], _delegates[to], itokenValue);
return true;
| _itokenBalances[from] = _itokenBalances[from].sub(itokenValue);
_itokenBalances[to] = _itokenBalances[to].add(itokenValue);
emit Transfer(from, to, value);
_moveDelegates(_delegates[from], _delegates[to], itokenValue);
return true;
| 10,834 |
119 | // for admin func | function AddBlackList(address[] memory addrs)
public
| function AddBlackList(address[] memory addrs)
public
| 10,991 |
4 | // (Solitaire3D long only) fired whenever a player tries a buy after round timer hit zero, and causes end round to be ran. | event onBuyAndDistribute
(
address playerAddress,
uint256 ethIn,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
uint256 amountWon,
uint256 newPot,
uint256 genAmount
| event onBuyAndDistribute
(
address playerAddress,
uint256 ethIn,
uint256 compressedData,
uint256 compressedIDs,
address winnerAddr,
uint256 amountWon,
uint256 newPot,
uint256 genAmount
| 36,279 |
14 | // 沙龙合约,支持开启新活动,用户签到,问题记录以及奖励分配等功能 | contract Salon is Administrative {
//合约结构体
struct Campaign {
uint ID; //期号,建议用日期形式,例如20181116
bool end; //是否结束
string topic; //沙龙主题
address speaker; //主讲人地址
address sponsor; //赞助商(场地提供人)地址
address[] participants; //参与者数组
mapping(address => uint) idx_parti... | contract Salon is Administrative {
//合约结构体
struct Campaign {
uint ID; //期号,建议用日期形式,例如20181116
bool end; //是否结束
string topic; //沙龙主题
address speaker; //主讲人地址
address sponsor; //赞助商(场地提供人)地址
address[] participants; //参与者数组
mapping(address => uint) idx_parti... | 16,067 |
40 | // Sets the affiliate Merkle root for (`edition`, `mintId`). Calling conditions:- The caller must be the edition's owner or admin.edition The edition address. mintIdThe mint ID, a global incrementing identifier used within the minter rootThe affiliate Merkle root, if any. / | function setAffiliateMerkleRoot(
| function setAffiliateMerkleRoot(
| 36,915 |
6 | // Reinvests DCB tokens into MasterChef for all pools Only possible when contract not paused.Beware of gas!! / | function harvestAll() external notContract whenNotPaused {
uint256 poolLen = masterchef.poolLength();
for (uint256 pid = 0; pid < poolLen; pid++) {
harvest(pid);
}
}
| function harvestAll() external notContract whenNotPaused {
uint256 poolLen = masterchef.poolLength();
for (uint256 pid = 0; pid < poolLen; pid++) {
harvest(pid);
}
}
| 23,358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.