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 |
|---|---|---|---|---|
12 | // Adds a new collection and returns the collection ID./ | function _addCollection(uint256 collectionSize) internal returns (uint256){
require(!_newCollectionsForbidden, "New collections forbidden");
require(_validCollectionSize(collectionSize), "Number of particles must be > 0 && <= MAX_COLLECTION_SIZE");
uint256 collectionId = _nextCollectionId;
... | function _addCollection(uint256 collectionSize) internal returns (uint256){
require(!_newCollectionsForbidden, "New collections forbidden");
require(_validCollectionSize(collectionSize), "Number of particles must be > 0 && <= MAX_COLLECTION_SIZE");
uint256 collectionId = _nextCollectionId;
... | 26,853 |
145 | // ============================ Constructor ==================================== |
function deployCollateral(
address[] memory governorList,
address guardian,
IPerpetualManager _perpetualManager,
IFeeManager feeManager,
IOracle oracle
) external;
|
function deployCollateral(
address[] memory governorList,
address guardian,
IPerpetualManager _perpetualManager,
IFeeManager feeManager,
IOracle oracle
) external;
| 34,209 |
17 | // Require function call by counterparty, mainly for calling execute contract | modifier onlyCounterparty(bytes32 _contractHash) {
require(contracts[_contractHash].counterparty == msg.sender, "Not contract counterparty");
_;
}
| modifier onlyCounterparty(bytes32 _contractHash) {
require(contracts[_contractHash].counterparty == msg.sender, "Not contract counterparty");
_;
}
| 13,975 |
0 | // Distribution Interface - Allows to interact with the distribution./Gabriele Rigo - <gab@rigoblock.com> | interface DistributionFace {
event Subscription(address indexed buyer, address indexed distributor, uint amount);
function subscribe(address _pool, address _distributor, address _buyer) external payable;
function setFee(uint _fee, address _distributor) external;
function getFee(address _distributor) e... | interface DistributionFace {
event Subscription(address indexed buyer, address indexed distributor, uint amount);
function subscribe(address _pool, address _distributor, address _buyer) external payable;
function setFee(uint _fee, address _distributor) external;
function getFee(address _distributor) e... | 45,793 |
61 | // TOKEN drain | function coinDrain() onlyOwner {
uint remains = coin.balanceOf(this);
coin.transfer(owner, remains); // Transfer to owner wallet
}
| function coinDrain() onlyOwner {
uint remains = coin.balanceOf(this);
coin.transfer(owner, remains); // Transfer to owner wallet
}
| 30,253 |
179 | // ็ฌฌไธ้ๆฎต & ็ฌฌไบ้ๆฎต mint | function mint(uint num, uint8 _type, bytes memory _sig) public payable {
require(IsActive, "Sale must be active to mint Tokens");
require(saleConfig.startTime <= block.timestamp && block.timestamp <= saleConfig.endTime, "Sale has not started yet.");
require(num <= saleConfig.max_num, "Exceed... | function mint(uint num, uint8 _type, bytes memory _sig) public payable {
require(IsActive, "Sale must be active to mint Tokens");
require(saleConfig.startTime <= block.timestamp && block.timestamp <= saleConfig.endTime, "Sale has not started yet.");
require(num <= saleConfig.max_num, "Exceed... | 62,150 |
47 | // ๆ นๆฎๅ็amount๏ผ็ฎๅบ่ฝๅ
ๆขๅคๅฐ | uint256 swapAmount = DexLibrary.getAmountOut(data[0], data[5], data[6], 9970);
| uint256 swapAmount = DexLibrary.getAmountOut(data[0], data[5], data[6], 9970);
| 11,762 |
563 | // owner: owner of _point | address owner = azimuth.getOwner(_point);
| address owner = azimuth.getOwner(_point);
| 43,642 |
21 | // Config contains the following values packed into 32 bytesโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ length(bytes) descโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโขโ vโ 1 the v parameter of a signatureโโ signatureMethodโ 1 SignatureMethod... | bytes32 config;
bytes32 r;
bytes32 s;
| bytes32 config;
bytes32 r;
bytes32 s;
| 13,636 |
7 | // we ensure that we withdraw stablecoin from investment (not yield), which is represented by totalDeposit | if (totalDeposit >= amountInUnderlying) {
| if (totalDeposit >= amountInUnderlying) {
| 2,968 |
251 | // Pure profits | else {
borrowed_balance = 0;
}
| else {
borrowed_balance = 0;
}
| 22,184 |
21 | // Delegates request for refund of soft cap to payment module/ | function refundSoftCap() public {
DAOProxy.delegatedRefundSoftCap(paymentModule);
}
| function refundSoftCap() public {
DAOProxy.delegatedRefundSoftCap(paymentModule);
}
| 35,958 |
6 | // If not enough ETH to cover the price, use WETH | if (takerBid.price > msg.value) {
IERC20(WETH).safeTransferFrom(msg.sender, address(this), (takerBid.price - msg.value));
} else {
| if (takerBid.price > msg.value) {
IERC20(WETH).safeTransferFrom(msg.sender, address(this), (takerBid.price - msg.value));
} else {
| 40,515 |
1 | // This event allows off-chain tools to differentiate between different protocols that use this factory to deploy Aave Linear Pools. | event AaveLinearPoolCreated(address indexed pool, uint256 indexed protocolId);
constructor(
IVault vault,
IProtocolFeePercentagesProvider protocolFeeProvider,
IBalancerQueries queries,
string memory factoryVersion,
string memory poolVersion,
uint256 initialPauseW... | event AaveLinearPoolCreated(address indexed pool, uint256 indexed protocolId);
constructor(
IVault vault,
IProtocolFeePercentagesProvider protocolFeeProvider,
IBalancerQueries queries,
string memory factoryVersion,
string memory poolVersion,
uint256 initialPauseW... | 12,084 |
64 | // Get the total bonus | getTotalRewards(issueIndex);
| getTotalRewards(issueIndex);
| 56,303 |
71 | // Iterate over each batch transfer. | for {
let i := 0
} lt(i, len) {
| for {
let i := 0
} lt(i, len) {
| 33,086 |
23 | // Confirm an operation. internalfunction_to - tx destination address_data - raw data to be sent for execution onto destination contract/ | function _confirmAndCheck(address _to, bytes _data) onlyowner() internal returns (bool) {
bytes32 operation = sha3(_to, _data);
uint index = ownerIndex[msg.sender];
if (multiAccessHasConfirmed(operation, msg.sender)) {
return false;
}
var pos = pendingIndex[opera... | function _confirmAndCheck(address _to, bytes _data) onlyowner() internal returns (bool) {
bytes32 operation = sha3(_to, _data);
uint index = ownerIndex[msg.sender];
if (multiAccessHasConfirmed(operation, msg.sender)) {
return false;
}
var pos = pendingIndex[opera... | 37,036 |
3 | // Any calls to nonReentrant after this point will fail | _reentrancyStatus = _ENTERED;
| _reentrancyStatus = _ENTERED;
| 48,087 |
1 | // amount of fees sent to the pool, not in percent but in FEES_BASE. if feeTo is null, sent to the LP | uint256 public constant FEES_POOL = 2;
| uint256 public constant FEES_POOL = 2;
| 26,950 |
31 | // Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors. / | function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value:... | function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value:... | 2,742 |
102 | // When the crowdsale is finished, the contract owner may adjust the decimal places for display purposes.This should work like a 10-to-1 split or reverse-split.The point of this mechanism is to keep the individual MRV tokens from getting inconveniently valuable or cheap.However, it relies on the contract owner taking t... | function setDecimals(uint8 newDecimals) public onlyOwner onlyAfterClosed {
decimals = newDecimals;
// Announce the change
emit DecimalChange(decimals);
}
| function setDecimals(uint8 newDecimals) public onlyOwner onlyAfterClosed {
decimals = newDecimals;
// Announce the change
emit DecimalChange(decimals);
}
| 43,048 |
56 | // Returns whether the SetToken has an external position for a given component (ifof position modules is > 0) / | function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) {
return _setToken.getExternalPositionModules(_component).length > 0;
}
| function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) {
return _setToken.getExternalPositionModules(_component).length > 0;
}
| 44,292 |
36 | // find all value in excess of what is needed in pool | uint256 excess = address(this).balance - poolBalance;
| uint256 excess = address(this).balance - poolBalance;
| 326 |
70 | // make the swap | dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
| dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
| 4,378 |
69 | // Mapping from owner to number of owned token | mapping (address => Counters.Counter) private _ownedTokensCount;
| mapping (address => Counters.Counter) private _ownedTokensCount;
| 8,317 |
116 | // View function to see deposited ERC20 token for a user. | function deposited(address _user, uint256 stakeId) public view validateStakeByStakeId(_user, stakeId) returns (uint256) {
StakeInfo storage stake = stakeInfo[_user][stakeId];
return stake.amount;
}
| function deposited(address _user, uint256 stakeId) public view validateStakeByStakeId(_user, stakeId) returns (uint256) {
StakeInfo storage stake = stakeInfo[_user][stakeId];
return stake.amount;
}
| 7,057 |
17 | // number of celestials staked at a give time | uint256 public cCounter;
| uint256 public cCounter;
| 33,762 |
16 | // retrieve contract address for a Wallet_userId user identifierreturn address of user's contract / | function getWalletAddress(bytes32 _userId) public view userExist(_userId) returns (address) {
return wallets.get(uint256(_userId));
}
| function getWalletAddress(bytes32 _userId) public view userExist(_userId) returns (address) {
return wallets.get(uint256(_userId));
}
| 20,409 |
41 | // update the swap token amount/ _newSwapAmount: new token amount to swap threshold/Requirements--/ amount must greator than equal to MIN_SWAP_AT_AMOUNT | function updateSwapTokensAtAmount (uint256 _newSwapAmount) external onlyOwner {
if(_newSwapAmount < MIN_SWAP_AT_AMOUNT && _newSwapAmount > maxSupply / 100){
revert AmountNotInLimits();
}
swapTokensAtAmount = _newSwapAmount;
emit SwapTokensAmountUpdated(_newSwapAmo... | function updateSwapTokensAtAmount (uint256 _newSwapAmount) external onlyOwner {
if(_newSwapAmount < MIN_SWAP_AT_AMOUNT && _newSwapAmount > maxSupply / 100){
revert AmountNotInLimits();
}
swapTokensAtAmount = _newSwapAmount;
emit SwapTokensAmountUpdated(_newSwapAmo... | 7,068 |
91 | // Allows the current superuser to transfer his role to a newSuperuser. _newSuperuser The address to transfer ownership to. / | function transferSuperuser(address _newSuperuser) public onlySuperuser {
require(_newSuperuser != address(0));
removeRole(msg.sender, ROLE_SUPERUSER);
addRole(_newSuperuser, ROLE_SUPERUSER);
}
| function transferSuperuser(address _newSuperuser) public onlySuperuser {
require(_newSuperuser != address(0));
removeRole(msg.sender, ROLE_SUPERUSER);
addRole(_newSuperuser, ROLE_SUPERUSER);
}
| 2,407 |
13 | // _validatorRegistry Requires ValidatorRegistry to be deployed before this./_dataConsumerRegistry Requires DataConsumerRegistry to be deployed before this./_attributeRegistry Requires AttributeRegistry to be deployed before this./_clientRegistry Requires ClientRegistry to be deployed before this. | constructor(
address _validatorRegistry,
address _dataConsumerRegistry,
address _attributeRegistry,
address _clientRegistry,
address payable _taxRegistryAddress
| constructor(
address _validatorRegistry,
address _dataConsumerRegistry,
address _attributeRegistry,
address _clientRegistry,
address payable _taxRegistryAddress
| 21,385 |
4 | // Burning is the contract for management of ZUSD/GYEN. / | contract Burning {
address public factory;
event Done(address sender, address this);
constructor() public {
factory = msg.sender;
}
modifier onlyBurner {
require(msg.sender == BurningFactory(factory).burner(), "the sender is not the burner");
_;
}
function burn(ad... | contract Burning {
address public factory;
event Done(address sender, address this);
constructor() public {
factory = msg.sender;
}
modifier onlyBurner {
require(msg.sender == BurningFactory(factory).burner(), "the sender is not the burner");
_;
}
function burn(ad... | 15,418 |
8 | // Contribute tokens to this funding round.pubKey Contributor's public key.amount Contribution amount./ | function contribute(
PubKey calldata pubKey,
uint256 amount
)
external
| function contribute(
PubKey calldata pubKey,
uint256 amount
)
external
| 20,927 |
21 | // Sets the stealth keys associated with an ENS name, for anonymous sends.May only be called by the owner of that node in the ENS registry. node The node to update. spendingPubKeyPrefix Prefix of the spending public key (2 or 3) spendingPubKey The public key for generating a stealth address viewingPubKeyPrefix Prefix o... | function setStealthKeys(bytes32 node, uint256 spendingPubKeyPrefix, uint256 spendingPubKey, uint256 viewingPubKeyPrefix, uint256 viewingPubKey) external authorised(node) {
require(
(spendingPubKeyPrefix == 2 || spendingPubKeyPrefix == 3) &&
(viewingPubKeyPrefix == 2 || viewingPubKeyP... | function setStealthKeys(bytes32 node, uint256 spendingPubKeyPrefix, uint256 spendingPubKey, uint256 viewingPubKeyPrefix, uint256 viewingPubKey) external authorised(node) {
require(
(spendingPubKeyPrefix == 2 || spendingPubKeyPrefix == 3) &&
(viewingPubKeyPrefix == 2 || viewingPubKeyP... | 78,949 |
24 | // allOperations.length = 0; | allOperations.push(allOperations[0]);
ownersGeneration++;
| allOperations.push(allOperations[0]);
ownersGeneration++;
| 23,272 |
46 | // _isRunning return successupdating isPurchasePossible -- only Wolk Inc can set this | function updatePurchasePossible(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
isPurchasePossible = _isRunning;
... | function updatePurchasePossible(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
isPurchasePossible = _isRunning;
... | 2,383 |
3 | // ็จๆฅ่ฎฐๅฝไผ็ญน่ต้ๅๅจ็้็ฅ๏ผ_isContribution่กจ็คบๆฏๅฆๆฏๆ่ต ๏ผๅ ไธบๆๅฏ่ฝๆฏๆ่ต ่
้ๅบๆๅ่ตท่
่ฝฌ็งปไผ็ญน่ต้ | event FundTransfer(address _backer, uint _amount, bool _isContribution);
| event FundTransfer(address _backer, uint _amount, bool _isContribution);
| 13,436 |
298 | // decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered | if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
| if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
| 20,668 |
5 | // Locks a specified amount of tokens against an address,for a specified reason and time _reason The reason to lock tokens _amount Number of tokens to be locked _time Lock time in seconds / | function lock(bytes32 _reason, uint256 _amount, uint256 _time)
public
override
returns (bool)
| function lock(bytes32 _reason, uint256 _amount, uint256 _time)
public
override
returns (bool)
| 38,442 |
30 | // RenAIssaNce -> forked from NDerivative Inspired by @KnavETH @0xBlossom / | contract Renaissance is NPassCore, Pausable{
mapping(uint => uint) public metaId;
// Rarity checkers
uint256[] private isRare;
uint256[] private isSuperRare;
// The starting metaID indexes for each tournament round [ROUND0, ROUND1, ROUND2, FINAL_ROUND]
uint256[] private superRareCounter = ... | contract Renaissance is NPassCore, Pausable{
mapping(uint => uint) public metaId;
// Rarity checkers
uint256[] private isRare;
uint256[] private isSuperRare;
// The starting metaID indexes for each tournament round [ROUND0, ROUND1, ROUND2, FINAL_ROUND]
uint256[] private superRareCounter = ... | 17,943 |
23 | // Decrease voting power of voter voter The voter whose voting power is decreasingamount The amount of voting power to decrease by / | function _decreaseVotingPower(address voter, uint256 amount) internal {
CheckpointStorage storage cs = VotingPowerStorage.checkpointStorage();
uint32 checkpointNum = cs.numCheckpoints[voter];
uint256 votingPowerOld = checkpointNum > 0 ? cs.checkpoints[voter][checkpointNum - 1].votes : 0;
... | function _decreaseVotingPower(address voter, uint256 amount) internal {
CheckpointStorage storage cs = VotingPowerStorage.checkpointStorage();
uint32 checkpointNum = cs.numCheckpoints[voter];
uint256 votingPowerOld = checkpointNum > 0 ? cs.checkpoints[voter][checkpointNum - 1].votes : 0;
... | 10,274 |
188 | // distribute eth to drsCoin holders | drsCoin.profitEth.value(_drsCoinDividend)();
| drsCoin.profitEth.value(_drsCoinDividend)();
| 16,152 |
58 | // Account recovery uses a hard-coded staging version of the recovery manager. | address internal constant _account_recovery_manager816 = address( //inject NONSTANDARD NAMING
0x2a7E7718b755F9868E6B64DD18C6886707DD9c10
);
| address internal constant _account_recovery_manager816 = address( //inject NONSTANDARD NAMING
0x2a7E7718b755F9868E6B64DD18C6886707DD9c10
);
| 27,242 |
56 | // add a extension | function addExtension(address extension) external onlyOwner {addExtension_(extension);}
function addExtension_(address extension) private validAddress(extension) {
if (!isExtension[extension]) {
isExtension[extension] = true;
extensions.push(extension);
emit Extensio... | function addExtension(address extension) external onlyOwner {addExtension_(extension);}
function addExtension_(address extension) private validAddress(extension) {
if (!isExtension[extension]) {
isExtension[extension] = true;
extensions.push(extension);
emit Extensio... | 819 |
217 | // dont withdraw dust | if (_amount < withdrawalThreshold) {
return 0;
}
| if (_amount < withdrawalThreshold) {
return 0;
}
| 21,138 |
26 | // If `self` starts with `needle`, `needle` is removed from the beginning of `self`. Otherwise, `self` is unmodified. self The slice to operate on. needle The slice to search for.return `self` / | function beyond(slice self, slice needle) internal returns (slice) {
if (self._len < needle._len) {
return self;
}
bool equal = true;
if (self._ptr != needle._ptr) {
assembly {
let length := mload(needle)
let selfptr := mload(a... | function beyond(slice self, slice needle) internal returns (slice) {
if (self._len < needle._len) {
return self;
}
bool equal = true;
if (self._ptr != needle._ptr) {
assembly {
let length := mload(needle)
let selfptr := mload(a... | 2,827 |
62 | // Deploy the proxy / | function DcorpCrowdsaleProxy() public {
stage = Stages.Deploying;
}
| function DcorpCrowdsaleProxy() public {
stage = Stages.Deploying;
}
| 54,447 |
129 | // if selling | if(takeFee && to == pancakeV2Pair){
if(amount <= getTokenPrice(1) ){
temp_tax_fee = _taxFee;
}else if(amount > getTokenPrice(1) && amount <= getTokenPrice(3)){
| if(takeFee && to == pancakeV2Pair){
if(amount <= getTokenPrice(1) ){
temp_tax_fee = _taxFee;
}else if(amount > getTokenPrice(1) && amount <= getTokenPrice(3)){
| 20,543 |
7 | // @custom:security-contact dustin.turska@kronickatz.com | contract KatNip is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, ERC20SnapshotUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable, ERC20FlashMintUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initiali... | contract KatNip is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, ERC20SnapshotUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable, ERC20FlashMintUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initiali... | 20,289 |
155 | // offers[id] is not the lowest offer | require(_rank[_rank[id].prev].next == id);
_rank[_rank[id].prev].next = _rank[id].next;
| require(_rank[_rank[id].prev].next == id);
_rank[_rank[id].prev].next = _rank[id].next;
| 14,310 |
9 | // Emits a {VotingDelaySet} event. / | function setVotingDelay(uint256 newVotingDelay) public virtual onlyGovernance {
_setVotingDelay(newVotingDelay);
}
| function setVotingDelay(uint256 newVotingDelay) public virtual onlyGovernance {
_setVotingDelay(newVotingDelay);
}
| 21,159 |
26 | // ------ READING METHODS FOR USERS ITEMS ------ / | function getNumberOfShipsByOwner() public view returns(uint256) {
return eternalStorageContract.getNumberOfItemsByTypeAndOwner("ship", msg.sender);
}
| function getNumberOfShipsByOwner() public view returns(uint256) {
return eternalStorageContract.getNumberOfItemsByTypeAndOwner("ship", msg.sender);
}
| 10,331 |
41 | // Check in during the bonus period. | if (bought_tokens && (now < time_bought + 1 days)) {
| if (bought_tokens && (now < time_bought + 1 days)) {
| 53,390 |
2 | // the receiving address of the beneficiary | address account;
| address account;
| 3,234 |
138 | // Update user information | if(share <= userInfo[_msgSender()].shareEstimate){
userInfo[_msgSender()].shareEstimate = userInfo[_msgSender()].shareEstimate.sub(share);
}else{
| if(share <= userInfo[_msgSender()].shareEstimate){
userInfo[_msgSender()].shareEstimate = userInfo[_msgSender()].shareEstimate.sub(share);
}else{
| 12,253 |
6 | // Mint an NFT Maximum per wallet enforced _qty Number of NFTs to mint / | function mint(uint256 _qty) external {
require(publicMintActive, "!phase");
require((_qty > 0) && (claimed[msg.sender] + _qty <= maxPerWallet), "!qty");
require(nextId.current() + _qty < maxSupply, "!supply");
claimed[msg.sender] += _qty;
uint256 tokenId;
for (uint256 i; i < _qty; ) {
... | function mint(uint256 _qty) external {
require(publicMintActive, "!phase");
require((_qty > 0) && (claimed[msg.sender] + _qty <= maxPerWallet), "!qty");
require(nextId.current() + _qty < maxSupply, "!supply");
claimed[msg.sender] += _qty;
uint256 tokenId;
for (uint256 i; i < _qty; ) {
... | 36,521 |
39 | // Determine the actual receiver and send funds | address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
| address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
| 4,265 |
170 | // Pools | function checkAddedPools(address pool)
external view returns(bool);
function getAddedPoolsLength()
external view returns(uint256);
function getAddedPools()
external view returns(address[] memory);
function getAddedPoolsWithLimit(uint256 offset, uint256 limit)
external vie... | function checkAddedPools(address pool)
external view returns(bool);
function getAddedPoolsLength()
external view returns(uint256);
function getAddedPools()
external view returns(address[] memory);
function getAddedPoolsWithLimit(uint256 offset, uint256 limit)
external vie... | 40,952 |
12 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 1,037 |
10 | // total mint trackers | uint256 public publicMinted;
| uint256 public publicMinted;
| 22,591 |
75 | // Set fee converter proxy./_feeProxy Fee proxy address. | function setFeeProxy(address _feeProxy) external onlyAdmin {
feeProxy = _feeProxy;
}
| function setFeeProxy(address _feeProxy) external onlyAdmin {
feeProxy = _feeProxy;
}
| 71,831 |
52 | // Time period of sale (UNIX timestamps) | uint public startTime = 1547031675; // Wednesday, 09-Jan-19 @ 11:01:15 am (UTC)
uint public endTime = 1552129275; // Saturday, 09-Mar-19 @ 11:01:15 am (UTC)
| uint public startTime = 1547031675; // Wednesday, 09-Jan-19 @ 11:01:15 am (UTC)
uint public endTime = 1552129275; // Saturday, 09-Mar-19 @ 11:01:15 am (UTC)
| 37,414 |
10 | // Random number generation | uint256 public randomSeed;
bytes32 internal keyHash;
uint256 internal chainLinkFee;
bytes32 public requestId;
| uint256 public randomSeed;
bytes32 internal keyHash;
uint256 internal chainLinkFee;
bytes32 public requestId;
| 30,330 |
107 | // TEST token | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
... | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
... | 15,289 |
1 | // require(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) && LOGIC_SLOT==bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)this require is simply against human error, can be removed if you know what you are doing&& NEXT_LOGIC_SLOT == bytes32(uint256(keccak256('eip1984.proxy.nextLogic'... | _setAdmin(msg.sender);
| _setAdmin(msg.sender);
| 6,412 |
26 | // Write takerAssetFillAmount / | mstore(paramsAreaOffset, takerAssetFillAmount)
paramsAreaOffset := add(paramsAreaOffset, 0x20)
| mstore(paramsAreaOffset, takerAssetFillAmount)
paramsAreaOffset := add(paramsAreaOffset, 0x20)
| 28,443 |
18 | // sell all tokens and withdraw | P3C(p3cAddress).exit();
| P3C(p3cAddress).exit();
| 5,297 |
138 | // Returns the protocolFeeCollector address | function protocolFeeCollector()
external
view
returns (address);
| function protocolFeeCollector()
external
view
returns (address);
| 44,353 |
16 | // explicitly override multiple inheritance | function totalSupply() public view override(VeERC20,IVeBids) returns (uint256) {
return super.totalSupply();
}
| function totalSupply() public view override(VeERC20,IVeBids) returns (uint256) {
return super.totalSupply();
}
| 12,556 |
0 | // Prevents getting inlined | if calldataload(0) { revert(0, 0) }
| if calldataload(0) { revert(0, 0) }
| 13,926 |
58 | // Get all locked amount account The address want to know the all locked amountreturn all locked amount / | function getAllLockedAmount(address account) public view returns (uint256) {
return getTimeLockedAmount(account) + getVestingLockedAmount(account);
}
| function getAllLockedAmount(address account) public view returns (uint256) {
return getTimeLockedAmount(account) + getVestingLockedAmount(account);
}
| 15,595 |
26 | // define total balance as sum of raw balances | totalBalance = rawBalances[daiConnectorAddress] + rawBalances[wethConnectorAddress] + rawBalances[usdcConnectorAddress] + rawBalances[usdtConnectorAddress] + rawBalances[wbtcConnectorAddress];
| totalBalance = rawBalances[daiConnectorAddress] + rawBalances[wethConnectorAddress] + rawBalances[usdcConnectorAddress] + rawBalances[usdtConnectorAddress] + rawBalances[wbtcConnectorAddress];
| 34,733 |
14 | // Calculate x / y rounding towards zero, where x and y are signed 256-bitinteger numbers.Revert on overflow or when y is zero.x signed 256-bit integer number y signed 256-bit integer numberreturn signed 64.64-bit fixed point number / | function divi(int256 x, int256 y) internal pure returns (int128) {
unchecked {
require(y != 0);
bool negativeResult = false;
if (x < 0) {
x = -x; // We rely on overflow behavior here
negativeResult = true;
}
if (y <... | function divi(int256 x, int256 y) internal pure returns (int128) {
unchecked {
require(y != 0);
bool negativeResult = false;
if (x < 0) {
x = -x; // We rely on overflow behavior here
negativeResult = true;
}
if (y <... | 18,998 |
30 | // Artists self minting for KnownOrigin (KODA) Allows for the edition artists to mint there own assets and control the price of an edition BE ORIGINAL. BUY ORIGINAL./ | contract ArtistEditionControls is Ownable, Pausable {
using SafeMath for uint256;
// Interface into the KODA world
IKODAV2Controls public kodaAddress;
event PriceChanged(
uint256 indexed _editionNumber,
address indexed _artist,
uint256 _priceInWei
);
constructor(IKODAV2Controls _kodaAddress) ... | contract ArtistEditionControls is Ownable, Pausable {
using SafeMath for uint256;
// Interface into the KODA world
IKODAV2Controls public kodaAddress;
event PriceChanged(
uint256 indexed _editionNumber,
address indexed _artist,
uint256 _priceInWei
);
constructor(IKODAV2Controls _kodaAddress) ... | 22,148 |
284 | // sold AND resolved | uint256 public oSold;
uint256 public aSold;
uint256 public cSold;
| uint256 public oSold;
uint256 public aSold;
uint256 public cSold;
| 59,327 |
18 | // see calculateUserClaimableReward() docs requires that reward token has the same decimals as stake token _stakeRewardFactor time in secondsamount of staked token to receive 1 reward token / | function setStakeRewardFactor(uint256 _stakeRewardFactor) external onlyRole(DEFAULT_ADMIN_ROLE) {
stakeRewardFactor = _stakeRewardFactor;
emit StakeRewardFactorChanged(_stakeRewardFactor);
}
| function setStakeRewardFactor(uint256 _stakeRewardFactor) external onlyRole(DEFAULT_ADMIN_ROLE) {
stakeRewardFactor = _stakeRewardFactor;
emit StakeRewardFactorChanged(_stakeRewardFactor);
}
| 50,992 |
17 | // ========== MUTATIVE FUNCTIONS ========== / Withdraw locked tokens First withdraws unlocked tokens, then locked tokens. Withdrawing locked tokens incurs a 50% penalty. | function withdraw(uint256 amount) public nonReentrant {
require(amount > 0, "Cannot withdraw 0");
uint256 unlockedAmount;
uint256 penaltyAmount;
(unlockedAmount, penaltyAmount) = getWithdrawableBalance(msg.sender);
bool penaltyFlag = false;
require(unlockedAmount + p... | function withdraw(uint256 amount) public nonReentrant {
require(amount > 0, "Cannot withdraw 0");
uint256 unlockedAmount;
uint256 penaltyAmount;
(unlockedAmount, penaltyAmount) = getWithdrawableBalance(msg.sender);
bool penaltyFlag = false;
require(unlockedAmount + p... | 35,028 |
141 | // Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if currentIndex + quantity > 1.56e77 (2256) - 1 | unchecked {
_addressData[to].balance += uint128(quantity);
_addressData[to].numberMinted += uint128(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenI... | unchecked {
_addressData[to].balance += uint128(quantity);
_addressData[to].numberMinted += uint128(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenI... | 7,143 |
6 | // 0x06 id of the isOnCurve precompile 0number of ether to transfer 128size of call parameters, i.e. 128 bytes total 64 size of call return value, i.e. 64 bytes / 512 bit for a BN256 curve point | valid := call(not(0), 0x06, 0, input, 128, input, 64)
| valid := call(not(0), 0x06, 0, input, 128, input, 64)
| 8,181 |
52 | // deprecate current contract in favour of a new one | function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
| function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
| 6,724 |
11 | // Set staking statistics. | function setNumStakers(uint256 _value) external onlyOwner {
numStakers = _value;
}
| function setNumStakers(uint256 _value) external onlyOwner {
numStakers = _value;
}
| 29,502 |
245 | // Mints sets to both the manager and the protocol. Protocol takes a percentage fee of the total amount of Setsminted to manager._setToken SetToken instance _feeQuantityAmount of Sets to be minted as feesreturnuint256 Amount of Sets accrued to manager as feereturnuint256 Amount of Sets accrued to protocol as fee / | function _mintManagerAndProtocolFee(ISetToken _setToken, uint256 _feeQuantity) internal returns (uint256, uint256) {
address protocolFeeRecipient = controller.feeRecipient();
uint256 protocolFee = controller.getModuleFee(address(this), PROTOCOL_STREAMING_FEE_INDEX);
uint256 protocolFeeAmoun... | function _mintManagerAndProtocolFee(ISetToken _setToken, uint256 _feeQuantity) internal returns (uint256, uint256) {
address protocolFeeRecipient = controller.feeRecipient();
uint256 protocolFee = controller.getModuleFee(address(this), PROTOCOL_STREAMING_FEE_INDEX);
uint256 protocolFeeAmoun... | 35,160 |
31 | // Same functionality as above function, just with different bounds for platinum. / | function issuePlatinumKard(address to, uint256 randomIndex)
internal
returns (uint256)
| function issuePlatinumKard(address to, uint256 randomIndex)
internal
returns (uint256)
| 1,819 |
134 | // Note: while the call succeeded, the action may still have "failed" (for example, successful calls to Compound can still return an error). | emit CALLSUCCESS383(actionID, false, nonce, to, data, returnData);
| emit CALLSUCCESS383(actionID, false, nonce, to, data, returnData);
| 27,296 |
7 | // run over the input, 3 bytes at a time | for {} lt(dataPtr, endPtr) {}
| for {} lt(dataPtr, endPtr) {}
| 8,419 |
20 | // SPDX-License-Identifier: MIT// Publius Bean Interface/ | abstract contract IBean is IERC20 {
function burn(uint256 amount) public virtual;
function burnFrom(address account, uint256 amount) public virtual;
function mint(address account, uint256 amount) public virtual returns (bool);
}
| abstract contract IBean is IERC20 {
function burn(uint256 amount) public virtual;
function burnFrom(address account, uint256 amount) public virtual;
function mint(address account, uint256 amount) public virtual returns (bool);
}
| 14,413 |
263 | // Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none. / | function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {
uint256 len = self._checkpoints.length;
uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
| function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {
uint256 len = self._checkpoints.length;
uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
| 27,935 |
79 | // ---------- PUBLIC FUNCTIONS ---------- / | receive() external payable {
buyWithETH();
}
| receive() external payable {
buyWithETH();
}
| 48,244 |
274 | // Saves variables that should change due to the addition of staking. / | updateValues(true, _from, _property, _value, prices);
| updateValues(true, _from, _property, _value, prices);
| 30,121 |
1 | // lockProxy is the primary minter - so mint whenever required. | uint256 balance = balanceOf(lockProxyAddress);
if (balance < amount) {
_mint(lockProxyAddress, amount.sub(balance));
}
| uint256 balance = balanceOf(lockProxyAddress);
if (balance < amount) {
_mint(lockProxyAddress, amount.sub(balance));
}
| 52,743 |
31 | // Crowdsale parameters/ | bool public isFinalized;
| bool public isFinalized;
| 10,250 |
14 | // keccak256(_id,_destination,nonce,address(this)) is a unique key remains unique if the id gets reused after fund deletion | bytes32 claimHash1 = keccak256(abi.encodePacked(_id,_destination,nonce,address(this)));
if(_claimHash == claimHash1){
signer = ECDSA.recover(_claimHash.toEthSignedMessageHash(),_signature);
} else{
| bytes32 claimHash1 = keccak256(abi.encodePacked(_id,_destination,nonce,address(this)));
if(_claimHash == claimHash1){
signer = ECDSA.recover(_claimHash.toEthSignedMessageHash(),_signature);
} else{
| 11,446 |
33 | // Change the state of the open sale.open. The new state. / | function setStartOpen(bool open) external onlyOwner {
startOpen = open;
emit setStartOpenEvent(open);
}
| function setStartOpen(bool open) external onlyOwner {
startOpen = open;
emit setStartOpenEvent(open);
}
| 32,277 |
6 | // Allows any of the WRITE Race candidates to claim. | function claim(
address account,
uint256 index,
bytes32[] calldata merkleProof
| function claim(
address account,
uint256 index,
bytes32[] calldata merkleProof
| 38,267 |
3 | // funtion that always increments by 1 | function increment(Counter storage counter) internal {
counter._value += 1;
}
| function increment(Counter storage counter) internal {
counter._value += 1;
}
| 50,934 |
31 | // ะกะฟะตัะธัะธัะตัะบะธะต ัะฟะพะฝัะบะธะต ัะฐะทะดะตะปะธัะตะปะธ ัะธะฟะฐ ใ | class JAP_DELIMITER
| class JAP_DELIMITER
| 12,023 |
227 | // get the number of vaults for a specified account owner _accountOwner account owner addressreturn number of vaults / | function getAccountVaultCounter(address _accountOwner) external view returns (uint256) {
return accountVaultCounter[_accountOwner];
}
| function getAccountVaultCounter(address _accountOwner) external view returns (uint256) {
return accountVaultCounter[_accountOwner];
}
| 34,521 |
51 | // Gets total amount of bmc-day accumulated due provided date/_date date where period ends/ return an amount of bmc-days | function getTotalBmcDaysAmount(uint _date) public view returns (uint) {
return _getTotalBmcDaysAmount(_date, periodsCount);
}
| function getTotalBmcDaysAmount(uint _date) public view returns (uint) {
return _getTotalBmcDaysAmount(_date, periodsCount);
}
| 41,306 |
71 | // Calculation of reward!! | uint256 _reward = amountOut.mul(allocPoint).div(allocPointDecimals);
return IUniswapV2Router02(routerAddr).getAmountsOut(amountOut.sub(_reward),path);
| uint256 _reward = amountOut.mul(allocPoint).div(allocPointDecimals);
return IUniswapV2Router02(routerAddr).getAmountsOut(amountOut.sub(_reward),path);
| 10,870 |
21 | // Function to mint tokens _to The address that will receive the minted tokens. _tokenId the token to mint. approvalData The sign data by owner. / | function relayMint(
address _to,
uint256 _tokenId,
bytes memory approvalData
| function relayMint(
address _to,
uint256 _tokenId,
bytes memory approvalData
| 33,144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.