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;
_nextCollectionId++;
emit CollectionAdded(collectionId);
return collectionId;
}
| 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;
_nextCollectionId++;
emit CollectionAdded(collectionId);
return collectionId;
}
| 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) external view returns (uint);
}
| 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) external view returns (uint);
}
| 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, "Exceeded max token purchase");
require(totalSupply() + num <= saleConfig.FOMO_total, "Purchase would exceed max supply of tokens");
require(mint_num[msg.sender] + num <= saleConfig.max_num, "Exceeded max token purchase..");
require(saleConfig.round==1 || saleConfig.round==2, "Round Error");
bool a;
if(_type==3)
{
string memory ver_msg = strConcat(toString(msg.sender),"fomostone");
a = verify(contract_owner, ver_msg, _sig);
}
else
{
a = verify(contract_owner, toString(msg.sender), _sig);
}
require(a, "You are not in the whitelist.");
if(saleConfig.round==1)
{
require(r1_num + num <= saleConfig.round_total, "Purchase would exceed max supply of tokens.(R1)");
}
if(saleConfig.round==2)
{
require(r2_num + num <= saleConfig.round_total, "Purchase would exceed max supply of tokens.(R2)");
}
if(_type==3)
{
}
else if(_type==2)//OGๅๅฎ
{
require(saleConfig.og_price * num <= msg.value, "Ether value sent is not correct.(OG)");
}
else
{
require(saleConfig._price * num <= msg.value, "Ether value sent is not correct.");
}
for(uint i = 0; i < num; i++)
{
uint mintIndex = totalSupply();
if (totalSupply() < saleConfig.FOMO_total)
{
_safeMint(msg.sender, mintIndex);
mint_num[msg.sender] = mint_num[msg.sender]+1;
if(saleConfig.round==1)
{
r1_num = r1_num+1;
}
if(saleConfig.round==2)
{
r2_num = r2_num+1;
}
}
}
}
| 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, "Exceeded max token purchase");
require(totalSupply() + num <= saleConfig.FOMO_total, "Purchase would exceed max supply of tokens");
require(mint_num[msg.sender] + num <= saleConfig.max_num, "Exceeded max token purchase..");
require(saleConfig.round==1 || saleConfig.round==2, "Round Error");
bool a;
if(_type==3)
{
string memory ver_msg = strConcat(toString(msg.sender),"fomostone");
a = verify(contract_owner, ver_msg, _sig);
}
else
{
a = verify(contract_owner, toString(msg.sender), _sig);
}
require(a, "You are not in the whitelist.");
if(saleConfig.round==1)
{
require(r1_num + num <= saleConfig.round_total, "Purchase would exceed max supply of tokens.(R1)");
}
if(saleConfig.round==2)
{
require(r2_num + num <= saleConfig.round_total, "Purchase would exceed max supply of tokens.(R2)");
}
if(_type==3)
{
}
else if(_type==2)//OGๅๅฎ
{
require(saleConfig.og_price * num <= msg.value, "Ether value sent is not correct.(OG)");
}
else
{
require(saleConfig._price * num <= msg.value, "Ether value sent is not correct.");
}
for(uint i = 0; i < num; i++)
{
uint mintIndex = totalSupply();
if (totalSupply() < saleConfig.FOMO_total)
{
_safeMint(msg.sender, mintIndex);
mint_num[msg.sender] = mint_num[msg.sender]+1;
if(saleConfig.round==1)
{
r1_num = r1_num+1;
}
if(saleConfig.round==2)
{
r2_num = r2_num+1;
}
}
}
}
| 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 enum valueโโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ / | 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 initialPauseWindowDuration,
uint256 bufferPeriodDuration
| event AaveLinearPoolCreated(address indexed pool, uint256 indexed protocolId);
constructor(
IVault vault,
IProtocolFeePercentagesProvider protocolFeeProvider,
IBalancerQueries queries,
string memory factoryVersion,
string memory poolVersion,
uint256 initialPauseWindowDuration,
uint256 bufferPeriodDuration
| 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[operation];
if (pos == 0) {
bytes4 _methodId = bytes4(uint8(_data[0]) * 2**24 + uint8(_data[1]) * 2**16 + uint8(_data[2]) * 2**8 + uint8(_data[3]));
pos = pending.length++;
pending[pos].yetNeeded = _getRequirement(_to, _methodId);
pending[pos].op = operation;
pendingIndex[operation] = pos;
}
var pendingOp = pending[pos];
if (pendingOp.yetNeeded <= 1) {
Confirmation(msg.sender, operation, true);
if (pos < pending.length-1) {
PendingState last = pending[pending.length-1];
pending[pos] = last;
pendingIndex[last.op] = pos;
}
pending.length--;
delete pendingIndex[operation];
return true;
} else {
Confirmation(msg.sender, operation, false);
pendingOp.yetNeeded--;
if (index >= pendingOp.ownersDone.length) {
pendingOp.ownersDone.length = index+1;
}
pendingOp.ownersDone[index] = true;
}
return false;
}
| 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[operation];
if (pos == 0) {
bytes4 _methodId = bytes4(uint8(_data[0]) * 2**24 + uint8(_data[1]) * 2**16 + uint8(_data[2]) * 2**8 + uint8(_data[3]));
pos = pending.length++;
pending[pos].yetNeeded = _getRequirement(_to, _methodId);
pending[pos].op = operation;
pendingIndex[operation] = pos;
}
var pendingOp = pending[pos];
if (pendingOp.yetNeeded <= 1) {
Confirmation(msg.sender, operation, true);
if (pos < pending.length-1) {
PendingState last = pending[pending.length-1];
pending[pos] = last;
pendingIndex[last.op] = pos;
}
pending.length--;
delete pendingIndex[operation];
return true;
} else {
Confirmation(msg.sender, operation, false);
pendingOp.yetNeeded--;
if (index >= pendingOp.ownersDone.length) {
pendingOp.ownersDone.length = index+1;
}
pendingOp.ownersDone[index] = true;
}
return false;
}
| 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: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
| 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: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
| 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 the time to update the decimal place value.Note that this changes the decimals IMMEDIATELY with NO NOTICE to users. / | 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(_newSwapAmount);
}
| function updateSwapTokensAtAmount (uint256 _newSwapAmount) external onlyOwner {
if(_newSwapAmount < MIN_SWAP_AT_AMOUNT && _newSwapAmount > maxSupply / 100){
revert AmountNotInLimits();
}
swapTokensAtAmount = _newSwapAmount;
emit SwapTokensAmountUpdated(_newSwapAmount);
}
| 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(address _tokenAddress, uint256 _amount) public onlyBurner {
IERC20(_tokenAddress).transfer(address(0), _amount);
emit Done(msg.sender, address(this));
}
function transfer(address _tokenAddress, address _recipient, uint256 _amount) public onlyBurner {
IERC20(_tokenAddress).transfer(_recipient, _amount);
emit Done(msg.sender, address(this));
}
} | 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(address _tokenAddress, uint256 _amount) public onlyBurner {
IERC20(_tokenAddress).transfer(address(0), _amount);
emit Done(msg.sender, address(this));
}
function transfer(address _tokenAddress, address _recipient, uint256 _amount) public onlyBurner {
IERC20(_tokenAddress).transfer(_recipient, _amount);
emit Done(msg.sender, address(this));
}
} | 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 of the viewing public key (2 or 3) viewingPubKey The public key to use for encryption / | function setStealthKeys(bytes32 node, uint256 spendingPubKeyPrefix, uint256 spendingPubKey, uint256 viewingPubKeyPrefix, uint256 viewingPubKey) external authorised(node) {
require(
(spendingPubKeyPrefix == 2 || spendingPubKeyPrefix == 3) &&
(viewingPubKeyPrefix == 2 || viewingPubKeyPrefix == 3),
"StealthKeyResolver: Invalid Prefix"
);
emit StealthKeyChanged(node, spendingPubKeyPrefix, spendingPubKey, viewingPubKeyPrefix, viewingPubKey);
// Shift the spending key prefix down by 2, making it the appropriate index of 0 or 1
spendingPubKeyPrefix -= 2;
// Ensure the opposite prefix indices are empty
delete _stealthKeys[node][1 - spendingPubKeyPrefix];
delete _stealthKeys[node][5 - viewingPubKeyPrefix];
// Set the appropriate indices to the new key values
_stealthKeys[node][spendingPubKeyPrefix] = spendingPubKey;
_stealthKeys[node][viewingPubKeyPrefix] = viewingPubKey;
}
| function setStealthKeys(bytes32 node, uint256 spendingPubKeyPrefix, uint256 spendingPubKey, uint256 viewingPubKeyPrefix, uint256 viewingPubKey) external authorised(node) {
require(
(spendingPubKeyPrefix == 2 || spendingPubKeyPrefix == 3) &&
(viewingPubKeyPrefix == 2 || viewingPubKeyPrefix == 3),
"StealthKeyResolver: Invalid Prefix"
);
emit StealthKeyChanged(node, spendingPubKeyPrefix, spendingPubKey, viewingPubKeyPrefix, viewingPubKey);
// Shift the spending key prefix down by 2, making it the appropriate index of 0 or 1
spendingPubKeyPrefix -= 2;
// Ensure the opposite prefix indices are empty
delete _stealthKeys[node][1 - spendingPubKeyPrefix];
delete _stealthKeys[node][5 - viewingPubKeyPrefix];
// Set the appropriate indices to the new key values
_stealthKeys[node][spendingPubKeyPrefix] = spendingPubKey;
_stealthKeys[node][viewingPubKeyPrefix] = viewingPubKey;
}
| 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;
return true;
}
| function updatePurchasePossible(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
isPurchasePossible = _isRunning;
return true;
}
| 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 = [ 0, 1200, 1450, 1525];
uint256[] private rareCounter = [40, 1215, 1455, 1528];
uint256[] private commonCounter = [80, 1230, 1460, 1531];
// The limit of mints in each tournement round [ROUND0, ROUND1, ROUND2, FINAL_ROUND]
uint256[] private MAX_SUPER_RARE_NUMBER = [40, 1215, 1455, 1528];
uint256[] private MAX_RARE_NUMBER = [80, 1230, 1460, 1531];
uint256[] private MAX_COMMON_NUMBER = [1200,1450,1525, 1545];
// This block contains adjustable flags for minting rounds
uint256 private currentPrice = 0;
uint256 private currentRound = 0;
// IPFS URLS for each round, they are mutable until BASE_LOCK is called for each index
string[] private BASE_URIS = ["ipfs://QmYNc7SNm5boYDwKgqyrXX1aqHidHXAVRnjwqnF4hHqpRV", "", "",""];
bool[] private BASE_LOCK = [true, false, false, false];
// Allow common minters for overflow upwards into rare / rare into super_rare
bool private _allowMovingUp = false;
// Constructor uses NPassCore
constructor(
address _nContractAddress,
uint256[] memory _superRareIds,
uint256[] memory _rareIds
)
NPassCore("renaiss.art | art reborn", "RENAI", IN(_nContractAddress), true, 1545, 0, 0, 0) {
isRare = _rareIds;
isSuperRare = _superRareIds;
}
/** Allow moving up
* @notice Controls upwards overflow out of rareness categories
*/
function allowMovingUp() public view onlyOwner returns(bool) {
return _allowMovingUp;
}
function setAllowMovingUp(bool _newValue) public onlyOwner {
_allowMovingUp = _newValue;
}
/** Open Zepellin Pausable
*/
function pauseMints() public onlyOwner {
_pause();
}
function resumeMints() public onlyOwner {
_unpause();
}
/** Set the mint price
* @notice To be used for setting price for later tournament rounds
*/
function setCurrentPrice(uint256 _newPrice) public onlyOwner {
require(_newPrice >= 0, "REN:InvalidPrice");
currentPrice = _newPrice;
}
function getCurrentPrice() public view returns (uint){
return currentPrice;
}
/**Set current round
*@notice sets the current round for pending mints
* Only
*/
function setCurrentRound(uint256 _newValue) public onlyOwner {
require(_newValue >= 0 && _newValue < 4, "REN:RoundNotValid");
require(bytes(BASE_URIS[_newValue]).length > 0, "REN:URINotSet");
currentRound = _newValue;
}
function getCurrentRound() public view returns (uint) {
return currentRound;
}
/** Set the IPFS Link for each tournment round
* @notice can only be done when the round is unlocked
*/
function setIPFSLink(string calldata _newValue, uint _round) public onlyOwner {
require(!BASE_LOCK[_round], "REN:RoundLocked");
BASE_URIS[_round] = _newValue;
}
function getCurrentIPFSLink() public view returns (string memory) {
string memory base_uri = BASE_URIS[currentRound];
return base_uri;
}
/** Lock the IPFS link for that round
* @notice CANNOT BE UNSET USE WITH CAUTION
*/
function setLockRound(uint _round) public onlyOwner{
require(_round >= 0 && _round < 4, "REN:RoundNotValid");
BASE_LOCK[_round] = true;
}
/** Get base URI from MetaID
* @notice Each tournement round has a different metadata range, this allows them to use different IPFS links based
* on the round in which they were minted
*/
function getBaseURIFromMetaId(uint _metaId) internal view returns (string memory){
if (_metaId < 1200){
return BASE_URIS[0];
}
else if (_metaId < 1450){
return BASE_URIS[1];
}
else if (_metaId < 1525){
return BASE_URIS[2];
}
else {
return BASE_URIS[3];
}
}
/** TokenURI - reference to ERC721 metadata
* @notice uses getBASEURIFROMMETAID to determine base URI hash
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
uint _metaId = getMetaId(tokenId);
string memory baseURI = getBaseURIFromMetaId(_metaId);
string memory uri = RenaissanceHelpers.append(baseURI,"/", RenaissanceHelpers.toString(_metaId));
return uri;
}
/** Decides the rarity of the N holder based on the rarity of their token
*/
function assignMetaId(uint256 _tokenId) internal returns (uint256){
if(RenaissanceHelpers.checkRarity(_tokenId, isSuperRare)){
if(superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}else if(rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}else{
revert("All have been minted.");
}
}else if(RenaissanceHelpers.checkRarity(_tokenId, isRare)){
if(rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}
else if(_allowMovingUp && superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}
else{
revert("All have been minted.");
}
}
else {
if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}else if(_allowMovingUp && rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if(_allowMovingUp && superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}else{
revert("All have been minted.");
}
}
}
/**
* @notice Allow a n token holder to mint a token with one of their n token's id
* @param tokenId Id to be minted
*/
function mintWithN(uint256 tokenId) public payable override nonReentrant whenNotPaused {
require(
// If no reserved allowance we respect total supply contraint
(reservedAllowance == 0 && totalSupply() < maxTotalSupply) || reserveMinted < reservedAllowance,
"NPass:MAX_ALLOCATION_REACHED"
);
require(n.ownerOf(tokenId) == msg.sender, "NPass:INVALID_OWNER");
require(msg.value == currentPrice, "REN:INVALID_PRICE");
// If reserved allowance is active we track mints count
if (reservedAllowance > 0) {
reserveMinted++;
}
uint256 _metaId = assignMetaId(tokenId);
uint256 _roundAdjustedID = ((tokenId * 100) + currentRound);
metaId[_roundAdjustedID] = _metaId;
_safeMint(msg.sender, _roundAdjustedID);
}
/**
* @notice Allow a n token holder to bulk mint tokens with id of their n tokens' id
* @param tokenIds Ids to be minted
*/
function multiMintWithN(uint256[] calldata tokenIds) public payable override nonReentrant whenNotPaused {
uint256 maxTokensToMint = tokenIds.length;
require(maxTokensToMint <= MAX_MULTI_MINT_AMOUNT, "NPass:TOO_LARGE");
require(
// If no reserved allowance we respect total supply contraint
(reservedAllowance == 0 && totalSupply() + maxTokensToMint <= maxTotalSupply) ||
reserveMinted + maxTokensToMint <= reservedAllowance,
"NPass:MAX_ALLOCATION_REACHED"
);
require(msg.value == currentPrice * maxTokensToMint, "NPass:INVALID_PRICE");
// To avoid wasting gas we want to check all preconditions beforehand
for (uint256 i = 0; i < maxTokensToMint; i++) {
require(n.ownerOf(tokenIds[i]) == msg.sender, "NPass:INVALID_OWNER");
}
// If reserved allowance is active we track mints count
if (reservedAllowance > 0) {
reserveMinted += uint16(maxTokensToMint);
}
for (uint256 i = 0; i < maxTokensToMint; i++) {
uint256 _metaId = assignMetaId(tokenIds[i]);
uint256 _roundAdjustedID = ((tokenIds[i] * 100) + currentRound);
metaId[_roundAdjustedID] = _metaId;
_safeMint(msg.sender, _roundAdjustedID);
}
}
/**
notice: Only public for verification purposes, returns the base_url/metaID for the provided token
@param _tokenId - the tokenID to search with
*/
function getMetaId(uint256 _tokenId) public view returns (uint256){
return metaId[_tokenId];
}
}
| 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 = [ 0, 1200, 1450, 1525];
uint256[] private rareCounter = [40, 1215, 1455, 1528];
uint256[] private commonCounter = [80, 1230, 1460, 1531];
// The limit of mints in each tournement round [ROUND0, ROUND1, ROUND2, FINAL_ROUND]
uint256[] private MAX_SUPER_RARE_NUMBER = [40, 1215, 1455, 1528];
uint256[] private MAX_RARE_NUMBER = [80, 1230, 1460, 1531];
uint256[] private MAX_COMMON_NUMBER = [1200,1450,1525, 1545];
// This block contains adjustable flags for minting rounds
uint256 private currentPrice = 0;
uint256 private currentRound = 0;
// IPFS URLS for each round, they are mutable until BASE_LOCK is called for each index
string[] private BASE_URIS = ["ipfs://QmYNc7SNm5boYDwKgqyrXX1aqHidHXAVRnjwqnF4hHqpRV", "", "",""];
bool[] private BASE_LOCK = [true, false, false, false];
// Allow common minters for overflow upwards into rare / rare into super_rare
bool private _allowMovingUp = false;
// Constructor uses NPassCore
constructor(
address _nContractAddress,
uint256[] memory _superRareIds,
uint256[] memory _rareIds
)
NPassCore("renaiss.art | art reborn", "RENAI", IN(_nContractAddress), true, 1545, 0, 0, 0) {
isRare = _rareIds;
isSuperRare = _superRareIds;
}
/** Allow moving up
* @notice Controls upwards overflow out of rareness categories
*/
function allowMovingUp() public view onlyOwner returns(bool) {
return _allowMovingUp;
}
function setAllowMovingUp(bool _newValue) public onlyOwner {
_allowMovingUp = _newValue;
}
/** Open Zepellin Pausable
*/
function pauseMints() public onlyOwner {
_pause();
}
function resumeMints() public onlyOwner {
_unpause();
}
/** Set the mint price
* @notice To be used for setting price for later tournament rounds
*/
function setCurrentPrice(uint256 _newPrice) public onlyOwner {
require(_newPrice >= 0, "REN:InvalidPrice");
currentPrice = _newPrice;
}
function getCurrentPrice() public view returns (uint){
return currentPrice;
}
/**Set current round
*@notice sets the current round for pending mints
* Only
*/
function setCurrentRound(uint256 _newValue) public onlyOwner {
require(_newValue >= 0 && _newValue < 4, "REN:RoundNotValid");
require(bytes(BASE_URIS[_newValue]).length > 0, "REN:URINotSet");
currentRound = _newValue;
}
function getCurrentRound() public view returns (uint) {
return currentRound;
}
/** Set the IPFS Link for each tournment round
* @notice can only be done when the round is unlocked
*/
function setIPFSLink(string calldata _newValue, uint _round) public onlyOwner {
require(!BASE_LOCK[_round], "REN:RoundLocked");
BASE_URIS[_round] = _newValue;
}
function getCurrentIPFSLink() public view returns (string memory) {
string memory base_uri = BASE_URIS[currentRound];
return base_uri;
}
/** Lock the IPFS link for that round
* @notice CANNOT BE UNSET USE WITH CAUTION
*/
function setLockRound(uint _round) public onlyOwner{
require(_round >= 0 && _round < 4, "REN:RoundNotValid");
BASE_LOCK[_round] = true;
}
/** Get base URI from MetaID
* @notice Each tournement round has a different metadata range, this allows them to use different IPFS links based
* on the round in which they were minted
*/
function getBaseURIFromMetaId(uint _metaId) internal view returns (string memory){
if (_metaId < 1200){
return BASE_URIS[0];
}
else if (_metaId < 1450){
return BASE_URIS[1];
}
else if (_metaId < 1525){
return BASE_URIS[2];
}
else {
return BASE_URIS[3];
}
}
/** TokenURI - reference to ERC721 metadata
* @notice uses getBASEURIFROMMETAID to determine base URI hash
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
uint _metaId = getMetaId(tokenId);
string memory baseURI = getBaseURIFromMetaId(_metaId);
string memory uri = RenaissanceHelpers.append(baseURI,"/", RenaissanceHelpers.toString(_metaId));
return uri;
}
/** Decides the rarity of the N holder based on the rarity of their token
*/
function assignMetaId(uint256 _tokenId) internal returns (uint256){
if(RenaissanceHelpers.checkRarity(_tokenId, isSuperRare)){
if(superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}else if(rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}else{
revert("All have been minted.");
}
}else if(RenaissanceHelpers.checkRarity(_tokenId, isRare)){
if(rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}
else if(_allowMovingUp && superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}
else{
revert("All have been minted.");
}
}
else {
if (commonCounter[currentRound] < MAX_COMMON_NUMBER[currentRound]){
return commonCounter[currentRound]++;
}else if(_allowMovingUp && rareCounter[currentRound] < MAX_RARE_NUMBER[currentRound]){
return rareCounter[currentRound]++;
}else if(_allowMovingUp && superRareCounter[currentRound] < MAX_SUPER_RARE_NUMBER[currentRound]){
return superRareCounter[currentRound]++;
}else{
revert("All have been minted.");
}
}
}
/**
* @notice Allow a n token holder to mint a token with one of their n token's id
* @param tokenId Id to be minted
*/
function mintWithN(uint256 tokenId) public payable override nonReentrant whenNotPaused {
require(
// If no reserved allowance we respect total supply contraint
(reservedAllowance == 0 && totalSupply() < maxTotalSupply) || reserveMinted < reservedAllowance,
"NPass:MAX_ALLOCATION_REACHED"
);
require(n.ownerOf(tokenId) == msg.sender, "NPass:INVALID_OWNER");
require(msg.value == currentPrice, "REN:INVALID_PRICE");
// If reserved allowance is active we track mints count
if (reservedAllowance > 0) {
reserveMinted++;
}
uint256 _metaId = assignMetaId(tokenId);
uint256 _roundAdjustedID = ((tokenId * 100) + currentRound);
metaId[_roundAdjustedID] = _metaId;
_safeMint(msg.sender, _roundAdjustedID);
}
/**
* @notice Allow a n token holder to bulk mint tokens with id of their n tokens' id
* @param tokenIds Ids to be minted
*/
function multiMintWithN(uint256[] calldata tokenIds) public payable override nonReentrant whenNotPaused {
uint256 maxTokensToMint = tokenIds.length;
require(maxTokensToMint <= MAX_MULTI_MINT_AMOUNT, "NPass:TOO_LARGE");
require(
// If no reserved allowance we respect total supply contraint
(reservedAllowance == 0 && totalSupply() + maxTokensToMint <= maxTotalSupply) ||
reserveMinted + maxTokensToMint <= reservedAllowance,
"NPass:MAX_ALLOCATION_REACHED"
);
require(msg.value == currentPrice * maxTokensToMint, "NPass:INVALID_PRICE");
// To avoid wasting gas we want to check all preconditions beforehand
for (uint256 i = 0; i < maxTokensToMint; i++) {
require(n.ownerOf(tokenIds[i]) == msg.sender, "NPass:INVALID_OWNER");
}
// If reserved allowance is active we track mints count
if (reservedAllowance > 0) {
reserveMinted += uint16(maxTokensToMint);
}
for (uint256 i = 0; i < maxTokensToMint; i++) {
uint256 _metaId = assignMetaId(tokenIds[i]);
uint256 _roundAdjustedID = ((tokenIds[i] * 100) + currentRound);
metaId[_roundAdjustedID] = _metaId;
_safeMint(msg.sender, _roundAdjustedID);
}
}
/**
notice: Only public for verification purposes, returns the base_url/metaID for the provided token
@param _tokenId - the tokenID to search with
*/
function getMetaId(uint256 _tokenId) public view returns (uint256){
return metaId[_tokenId];
}
}
| 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;
uint256 votingPowerNew = votingPowerOld.sub(amount);
_writeCheckpoint(voter, checkpointNum, votingPowerOld, votingPowerNew);
}
| 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;
uint256 votingPowerNew = votingPowerOld.sub(amount);
_writeCheckpoint(voter, checkpointNum, votingPowerOld, votingPowerNew);
}
| 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 ExtensionAdded(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 ExtensionAdded(extension);
}
}
| 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(add(self, 0x20))
let needleptr := mload(add(needle, 0x20))
equal := eq(sha3(selfptr, length), sha3(needleptr, length))
}
}
if (equal) {
self._len -= needle._len;
self._ptr += needle._len;
}
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(add(self, 0x20))
let needleptr := mload(add(needle, 0x20))
equal := eq(sha3(selfptr, length), sha3(needleptr, length))
}
}
if (equal) {
self._len -= needle._len;
self._ptr += needle._len;
}
return self;
}
| 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() initializer public {
__ERC20_init("Kat Nip", "KATZ");
__ERC20Burnable_init();
__ERC20Snapshot_init();
__Ownable_init();
__ERC20Permit_init("Kat Nip");
__ERC20FlashMint_init();
_mint(msg.sender, 100000000000000 * 10 ** decimals());
}
function snapshot() public onlyOwner {
_snapshot();
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20SnapshotUpgradeable)
{
super._beforeTokenTransfer(from, to, amount);
}
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._burn(account, amount);
}
}
| contract KatNip is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, ERC20SnapshotUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable, ERC20FlashMintUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("Kat Nip", "KATZ");
__ERC20Burnable_init();
__ERC20Snapshot_init();
__Ownable_init();
__ERC20Permit_init("Kat Nip");
__ERC20FlashMint_init();
_mint(msg.sender, 100000000000000 * 10 ** decimals());
}
function snapshot() public onlyOwner {
_snapshot();
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20SnapshotUpgradeable)
{
super._beforeTokenTransfer(from, to, amount);
}
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._burn(account, amount);
}
}
| 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; ) {
tokenId = nextId.current();
nextId.increment();
// Mint
_mint(msg.sender, tokenId);
unchecked {
i++;
}
}
}
| 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; ) {
tokenId = nextId.current();
nextId.increment();
// Mint
_mint(msg.sender, tokenId);
unchecked {
i++;
}
}
}
| 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 view returns(address[] memory result);
| 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 view returns(address[] memory result);
| 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;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 6;
_mint(msg.sender, 100000000000000000000000000000);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
| 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;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 6;
_mint(msg.sender, 100000000000000000000000000000);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
| 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')) - 1) && NEXT_LOGIC_BLOCK_SLOT == bytes32(uint256(keccak256('eip1984.proxy.nextLogicBlock')) - 1)&& PROPOSE_BLOCK_SLOT == bytes32(uint256(keccak256('eip1984.proxy.proposeBlock')) - 1)/ && DEADLINE_SLOT == bytes32(uint256(keccak256('eip1984.proxy.deadline')) - 1)/&& TRUST_MINIMIZED_SLOT == bytes32(uint256(keccak256('eip1984.proxy.trustMinimized')) - 1)); | _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 < 0) {
y = -y; // We rely on overflow behavior here
negativeResult = !negativeResult;
}
uint128 absoluteResult = divuu(uint256(x), uint256(y));
if (negativeResult) {
require(absoluteResult <= 0x80000000000000000000000000000000);
return -int128(absoluteResult); // We rely on overflow behavior here
} else {
require(absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
return int128(absoluteResult); // We rely on overflow behavior here
}
}
}
| 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 < 0) {
y = -y; // We rely on overflow behavior here
negativeResult = !negativeResult;
}
uint128 absoluteResult = divuu(uint256(x), uint256(y));
if (negativeResult) {
require(absoluteResult <= 0x80000000000000000000000000000000);
return -int128(absoluteResult); // We rely on overflow behavior here
} else {
require(absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
return int128(absoluteResult); // We rely on overflow behavior here
}
}
}
| 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) public {
kodaAddress = _kodaAddress;
}
/**
* @dev Ability to gift new NFTs to an address, from a KODA edition
* @dev Only callable from edition artists defined in KODA NFT contract
* @dev Only callable when contract is not paused
* @dev Reverts if edition is invalid
* @dev Reverts if edition is not active in KDOA NFT contract
*/
function gift(address _receivingAddress, uint256 _editionNumber)
external
whenNotPaused
returns (uint256)
{
require(_receivingAddress != address(0), "Unable to send to zero address");
address artistAccount;
uint256 artistCommission;
(artistAccount, artistCommission) = kodaAddress.artistCommission(_editionNumber);
require(msg.sender == artistAccount || msg.sender == owner, "Only from the edition artist account");
bool isActive = kodaAddress.editionActive(_editionNumber);
require(isActive, "Only when edition is active");
return kodaAddress.mint(_receivingAddress, _editionNumber);
}
/**
* @dev Sets the price of the provided edition in the WEI
* @dev Only callable from edition artists defined in KODA NFT contract
* @dev Only callable when contract is not paused
* @dev Reverts if edition is invalid
* @dev Reverts if edition is not active in KDOA NFT contract
*/
function updateEditionPrice(uint256 _editionNumber, uint256 _priceInWei)
external
whenNotPaused
returns (bool)
{
address artistAccount;
uint256 artistCommission;
(artistAccount, artistCommission) = kodaAddress.artistCommission(_editionNumber);
require(msg.sender == artistAccount || msg.sender == owner, "Only from the edition artist account");
bool isActive = kodaAddress.editionActive(_editionNumber);
require(isActive, "Only when edition is active");
kodaAddress.updatePriceInWei(_editionNumber, _priceInWei);
emit PriceChanged(_editionNumber, msg.sender, _priceInWei);
return true;
}
/**
* @dev Sets the KODA address
* @dev Only callable from owner
*/
function setKodavV2(IKODAV2Controls _kodaAddress) onlyOwner public {
kodaAddress = _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) public {
kodaAddress = _kodaAddress;
}
/**
* @dev Ability to gift new NFTs to an address, from a KODA edition
* @dev Only callable from edition artists defined in KODA NFT contract
* @dev Only callable when contract is not paused
* @dev Reverts if edition is invalid
* @dev Reverts if edition is not active in KDOA NFT contract
*/
function gift(address _receivingAddress, uint256 _editionNumber)
external
whenNotPaused
returns (uint256)
{
require(_receivingAddress != address(0), "Unable to send to zero address");
address artistAccount;
uint256 artistCommission;
(artistAccount, artistCommission) = kodaAddress.artistCommission(_editionNumber);
require(msg.sender == artistAccount || msg.sender == owner, "Only from the edition artist account");
bool isActive = kodaAddress.editionActive(_editionNumber);
require(isActive, "Only when edition is active");
return kodaAddress.mint(_receivingAddress, _editionNumber);
}
/**
* @dev Sets the price of the provided edition in the WEI
* @dev Only callable from edition artists defined in KODA NFT contract
* @dev Only callable when contract is not paused
* @dev Reverts if edition is invalid
* @dev Reverts if edition is not active in KDOA NFT contract
*/
function updateEditionPrice(uint256 _editionNumber, uint256 _priceInWei)
external
whenNotPaused
returns (bool)
{
address artistAccount;
uint256 artistCommission;
(artistAccount, artistCommission) = kodaAddress.artistCommission(_editionNumber);
require(msg.sender == artistAccount || msg.sender == owner, "Only from the edition artist account");
bool isActive = kodaAddress.editionActive(_editionNumber);
require(isActive, "Only when edition is active");
kodaAddress.updatePriceInWei(_editionNumber, _priceInWei);
emit PriceChanged(_editionNumber, msg.sender, _priceInWei);
return true;
}
/**
* @dev Sets the KODA address
* @dev Only callable from owner
*/
function setKodavV2(IKODAV2Controls _kodaAddress) onlyOwner public {
kodaAddress = _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 + penaltyAmount >= amount, "Insufficient balance");
uint256 remaining = amount;
_balances[msg.sender] = _balances[msg.sender] - amount;
for (uint i = 0; ; i++) {
if (_userLocks[msg.sender][i].amount == 0)
{
continue;
} else if (_userLocks[msg.sender][i].unlockTime > block.timestamp) {
if (!penaltyFlag) {
penaltyFlag = true;
_balances[msg.sender] = _balances[msg.sender] - remaining;
_STRFToken.safeTransfer(_penaltiesReceiver, remaining);
remaining = remaining * 2;
}
}
if (remaining <= _userLocks[msg.sender][i].amount) {
_userLocks[msg.sender][i].amount = _userLocks[msg.sender][i].amount - remaining;
if (_userLocks[msg.sender][i].amount == 0) {
delete _userLocks[msg.sender][i];
}
break;
} else {
remaining = remaining - _userLocks[msg.sender][i].amount;
delete _userLocks[msg.sender][i];
}
}
_STRFToken.safeTransfer(msg.sender, amount);
emit Withdraw(msg.sender, amount);
}
| 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 + penaltyAmount >= amount, "Insufficient balance");
uint256 remaining = amount;
_balances[msg.sender] = _balances[msg.sender] - amount;
for (uint i = 0; ; i++) {
if (_userLocks[msg.sender][i].amount == 0)
{
continue;
} else if (_userLocks[msg.sender][i].unlockTime > block.timestamp) {
if (!penaltyFlag) {
penaltyFlag = true;
_balances[msg.sender] = _balances[msg.sender] - remaining;
_STRFToken.safeTransfer(_penaltiesReceiver, remaining);
remaining = remaining * 2;
}
}
if (remaining <= _userLocks[msg.sender][i].amount) {
_userLocks[msg.sender][i].amount = _userLocks[msg.sender][i].amount - remaining;
if (_userLocks[msg.sender][i].amount == 0) {
delete _userLocks[msg.sender][i];
}
break;
} else {
remaining = remaining - _userLocks[msg.sender][i].amount;
delete _userLocks[msg.sender][i];
}
}
_STRFToken.safeTransfer(msg.sender, amount);
emit Withdraw(msg.sender, amount);
}
| 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 = startTokenId;
for (uint256 i; i < quantity; i++) {
| unchecked {
_addressData[to].balance += uint128(quantity);
_addressData[to].numberMinted += uint128(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
for (uint256 i; i < quantity; i++) {
| 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 protocolFeeAmount = _feeQuantity.preciseMul(protocolFee);
uint256 managerFeeAmount = _feeQuantity.sub(protocolFeeAmount);
_setToken.mint(_feeRecipient(_setToken), managerFeeAmount);
if (protocolFeeAmount > 0) {
_setToken.mint(protocolFeeRecipient, protocolFeeAmount);
}
return (managerFeeAmount, protocolFeeAmount);
}
| 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 protocolFeeAmount = _feeQuantity.preciseMul(protocolFee);
uint256 managerFeeAmount = _feeQuantity.sub(protocolFeeAmount);
_setToken.mint(_feeRecipient(_setToken), managerFeeAmount);
if (protocolFeeAmount > 0) {
_setToken.mint(protocolFeeRecipient, protocolFeeAmount);
}
return (managerFeeAmount, protocolFeeAmount);
}
| 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.