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 |
|---|---|---|---|---|
125 | // prevent accidental sending of tokens to this token contract/_self - address of this contract | modifier notSelf(address _self) {
require(
_self != address(this),
"You are trying to send tokens to this token contract"
);
_;
}
| modifier notSelf(address _self) {
require(
_self != address(this),
"You are trying to send tokens to this token contract"
);
_;
}
| 31,548 |
43 | // Returns the collateral token with requested mask and its liquidationThreshold/tokenMask Token mask corresponding to the token | function collateralTokensByMask(uint256 tokenMask)
external
view
returns (address token, uint16 liquidationThreshold);
| function collateralTokensByMask(uint256 tokenMask)
external
view
returns (address token, uint16 liquidationThreshold);
| 26,117 |
187 | // get the total number of minted tokenIds/ | function totalSupply() public view returns (uint256) {
return idCounter.current();
}
| function totalSupply() public view returns (uint256) {
return idCounter.current();
}
| 33,270 |
71 | // Deletes the value of the `uint256` type that mapped to the given key.Only the owner can execute this function. / | function deleteUint(bytes32 _key) external onlyCurrentOwner {
delete uIntStorage[_key];
}
| function deleteUint(bytes32 _key) external onlyCurrentOwner {
delete uIntStorage[_key];
}
| 19,273 |
31 | // Update the pointer at 0x40 again to point at new free memory location so any theoretical allocation doesn't stomp our memory in this call | mstore(0x40, add(_returndataMemoryOffset, returndatasize))
returndatacopy(_returndataMemoryOffset, 0x0, returndatasize)
return(_returndataMemoryOffset, returndatasize)
| mstore(0x40, add(_returndataMemoryOffset, returndatasize))
returndatacopy(_returndataMemoryOffset, 0x0, returndatasize)
return(_returndataMemoryOffset, returndatasize)
| 36,958 |
3 | // All Transaction data, constant and variable | struct TransactionData {
address receivingChainTxManagerAddress;
address user;
address router;
address initiator; // msg.sender of sending side
address sendingAssetId;
address receivingAssetId;
address sendingChainFallback;
address receivingAddress;
... | struct TransactionData {
address receivingChainTxManagerAddress;
address user;
address router;
address initiator; // msg.sender of sending side
address sendingAssetId;
address receivingAssetId;
address sendingChainFallback;
address receivingAddress;
... | 8,511 |
74 | // Mapping owner address to token count | mapping(address => uint256) private _balances;
| mapping(address => uint256) private _balances;
| 374 |
38 | // lock metadata forever | function lockMetadata() public onlyOwner notLocked {
locked = true;
}
| function lockMetadata() public onlyOwner notLocked {
locked = true;
}
| 4,741 |
59 | // This is 1 in the fixed point units used in this library. Test fixed1() equals 10^digits()Hardcoded to 24 digits. / | function fixed1() public pure returns(int256) {
return 1000000000000000000000000;
}
| function fixed1() public pure returns(int256) {
return 1000000000000000000000000;
}
| 7,279 |
3 | // With this the door code will become permanent! | require(msg.sender == turista, "You are not the tourist!");
require(status == 3, "You first have to claim the door code!");
require(msg.value == (price*numberWeeks)-downPayment, "You have to pay exactly the remaining value!");
status = 1;
| require(msg.sender == turista, "You are not the tourist!");
require(status == 3, "You first have to claim the door code!");
require(msg.value == (price*numberWeeks)-downPayment, "You have to pay exactly the remaining value!");
status = 1;
| 11,869 |
46 | // Pool and Owner minted tokens per second | uint public poolMintRate;
uint public ownerMintRate;
| uint public poolMintRate;
uint public ownerMintRate;
| 79,076 |
0 | // Canonical FOREX token address //The vesting period in seconds at which the FOREX supply for each/Minimum delay (in seconds) between user claims. //Date from which participants can claim their immediate value, and/Mapping of (participant address => participant vesting data) //Total funds required by contract. Used fo... | struct Participant {
/* Amount initially claimable at any time from the claimStartDate */
uint256 claimable;
/* Total vested amount released in equal amounts throughout the
vesting period. */
uint256 vestedValue;
/* Date at which the participant last claimed ... | struct Participant {
/* Amount initially claimable at any time from the claimStartDate */
uint256 claimable;
/* Total vested amount released in equal amounts throughout the
vesting period. */
uint256 vestedValue;
/* Date at which the participant last claimed ... | 24,421 |
40 | // claim period | bytes32 _claim = _claimId(id,fi);
uint256 _now = block.timestamp;
require((_now - lastClaim[_claim]) >= PERIOD, "ShardAlly: wait one day to claim");
| bytes32 _claim = _claimId(id,fi);
uint256 _now = block.timestamp;
require((_now - lastClaim[_claim]) >= PERIOD, "ShardAlly: wait one day to claim");
| 28,988 |
1 | // Network: KovanOracle: 0xc57b33452b4f7bb189bb5afae9cc4aba1f7a4fd8Job ID: d5270d1c311941d0b08bead21fea7747Fee: 0.1 LINK / | constructor(
address _oracle,
bytes32 _jobId,
uint256 _fee,
uint256 _rewardUnit,
address _link
| constructor(
address _oracle,
bytes32 _jobId,
uint256 _fee,
uint256 _rewardUnit,
address _link
| 51,137 |
12 | // Casts a vote for a candidate. _candidateId The ID of the candidate being voted for. _department The department of the voter. _matriculationNumber The matriculation number of the voter. / | function castVote(uint _candidateId, string memory _department, string memory _matriculationNumber) public onlyVoter onlyDuringElection {
require(_candidateId > 0 && _candidateId <= candidateCount, "Invalid candidate ID");
require(isValidVoterDepartment(_department, _matriculationNumber), "Invalid v... | function castVote(uint _candidateId, string memory _department, string memory _matriculationNumber) public onlyVoter onlyDuringElection {
require(_candidateId > 0 && _candidateId <= candidateCount, "Invalid candidate ID");
require(isValidVoterDepartment(_department, _matriculationNumber), "Invalid v... | 8,695 |
76 | // Rounds an `epoch` timestamp to the start of the corresponding period | function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {
return (epoch / EPOCH_DURATION) * EPOCH_DURATION;
}
| function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {
return (epoch / EPOCH_DURATION) * EPOCH_DURATION;
}
| 38,435 |
0 | // Alkimiya Oracle Addresses Alkimiya Team/ | interface IOracleRegistry {
event OracleRegistered(address token, uint256 oracleType, address oracleAddr);
function getOracleAddress(address _token, uint256 _oracleType) external view returns (address);
}
| interface IOracleRegistry {
event OracleRegistered(address token, uint256 oracleType, address oracleAddr);
function getOracleAddress(address _token, uint256 _oracleType) external view returns (address);
}
| 9,916 |
117 | // 持有者的份额 | uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
| uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
| 18,676 |
43 | // Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred data ... | function checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data)
private returns (bool)
{
if (!isContract(to)) {
return true;
}
| function checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data)
private returns (bool)
{
if (!isContract(to)) {
return true;
}
| 53,487 |
7 | // Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI / | function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
| function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
| 33,171 |
265 | // Distributes the dev fund for accounts | function distributeDevFund() public override {
uint256 totalMulitplierDistributionAmount = multiplierTokenDevFund;
multiplierTokenDevFund = 0;
// Distribute multiplier dev fund according to percentages
for (uint256 i = 0; i < devCount; i++) {
uint256 devPercentage = devAl... | function distributeDevFund() public override {
uint256 totalMulitplierDistributionAmount = multiplierTokenDevFund;
multiplierTokenDevFund = 0;
// Distribute multiplier dev fund according to percentages
for (uint256 i = 0; i < devCount; i++) {
uint256 devPercentage = devAl... | 59,801 |
49 | // Opens long position for shadow asset `_ticker` of size `_volume`/ticker kek/volume kek/assetPrice kek/tokenPrice kek | function OpenLong(
string ticker,
string volume,
string assetPrice,
string tokenPrice)
public
onlyOwner {
uint volumeUint = stringToUint(volume);
| function OpenLong(
string ticker,
string volume,
string assetPrice,
string tokenPrice)
public
onlyOwner {
uint volumeUint = stringToUint(volume);
| 25,429 |
32 | // indicates if global settlement was triggered | function live() external view returns(bool);
| function live() external view returns(bool);
| 59,958 |
3 | // create Payment for Item / | function createPayment(uint256 _itemId) public payable {
uint256 _amountValue = msg.value;
if (itemPayment[_itemId].creator != address(0)) {
require(itemPayment[_itemId].creator == msg.sender, "Mintedgem: invalid-creator");
itemPayment[_itemId].amount += _amountValue;
... | function createPayment(uint256 _itemId) public payable {
uint256 _amountValue = msg.value;
if (itemPayment[_itemId].creator != address(0)) {
require(itemPayment[_itemId].creator == msg.sender, "Mintedgem: invalid-creator");
itemPayment[_itemId].amount += _amountValue;
... | 33,710 |
53 | // Public Functions //Disable default function. | function () payable public {
revert();
}
| function () payable public {
revert();
}
| 27,146 |
6 | // Emitted when the amo is set.//underlyingToken The address of the underlying token./amo The address of the amo. | event SetAmo(address underlyingToken, address amo);
| event SetAmo(address underlyingToken, address amo);
| 41,061 |
24 | // No Proxy: Polygon / Ethereum (goerli) | if (address(_proxyRegistryAddress) == operator) {
return true;
}
| if (address(_proxyRegistryAddress) == operator) {
return true;
}
| 2,781 |
125 | // Contract for Federation Coupon System./ | contract FedCoup is StandardToken, Ownable {
/*
* Name of the Federation Coupon System.
*/
string public name = "FedCoup";
/*
* FedCoup currency symbol.
*/
string public symbol = "FET";
uint public decimals = 18;
/*
* constant S,B coupon (federation coupon) division f... | contract FedCoup is StandardToken, Ownable {
/*
* Name of the Federation Coupon System.
*/
string public name = "FedCoup";
/*
* FedCoup currency symbol.
*/
string public symbol = "FET";
uint public decimals = 18;
/*
* constant S,B coupon (federation coupon) division f... | 9,475 |
374 | // Emitted when the protocol provider fees bps for a particular `ProtocolControl` is updated. | event ProtocolControlFeeBpsUpdated(address indexed control, uint256 feeBps);
| event ProtocolControlFeeBpsUpdated(address indexed control, uint256 feeBps);
| 16,232 |
557 | // A mapping of all of the user stakes mapped first by pool and then by address. | mapping(address => mapping(uint256 => Stake.Data)) private _stakes;
constructor(
IMintableERC20 _reward,
address _governance
) public {
require(_governance != address(0), "StakingPools: governance address cannot be 0x0");
reward = _reward;
governance = _governance;
| mapping(address => mapping(uint256 => Stake.Data)) private _stakes;
constructor(
IMintableERC20 _reward,
address _governance
) public {
require(_governance != address(0), "StakingPools: governance address cannot be 0x0");
reward = _reward;
governance = _governance;
| 20,345 |
13 | // Manager can upgrade auction code.code . New version of contract code. / | function upgrade(TvmCell code) external override onlyManager accept {
tvm.setcode(code);
tvm.setCurrentCode(code);
onCodeUpgrade();
}
| function upgrade(TvmCell code) external override onlyManager accept {
tvm.setcode(code);
tvm.setCurrentCode(code);
onCodeUpgrade();
}
| 22,743 |
25 | // Wrapping the ERC20 transfer function to avoid missing returns. _tokenAddress The address of bad formed ERC20 token. _to Transfer receiver. _amount Amount to be transfered.return Success of the safeTransfer. / | function _safeTransfer(
address _tokenAddress,
address _to,
uint _amount
)
internal
returns (bool result)
| function _safeTransfer(
address _tokenAddress,
address _to,
uint _amount
)
internal
returns (bool result)
| 41,606 |
9 | // Admin can give '_account' address admin privileges. _account address that should be given admin privileges. / | function addAdmin(address _account) public onlyAdminOrRelay {
_addAdmin(_account);
}
| function addAdmin(address _account) public onlyAdminOrRelay {
_addAdmin(_account);
}
| 47,843 |
39 | // returns the 0 indexed position of the most significant bit of the input x s.t. x >= 2msb and x < 2(msb+1) | function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
... | function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
... | 21,683 |
1 | // Non-transferable volleys by recipient address / | mapping(address => Volley[]) public willCallVolleys;
| mapping(address => Volley[]) public willCallVolleys;
| 222 |
177 | // Stakes in liquidity mining pool/incentives address - pool address/wad uint - amount | function stakeInMine(address incentives, uint wad) external {
DSTokenLike(GebIncentivesLike(incentives).stakingToken()).transferFrom(msg.sender, address(this), wad);
_stakeInMine(incentives);
}
| function stakeInMine(address incentives, uint wad) external {
DSTokenLike(GebIncentivesLike(incentives).stakingToken()).transferFrom(msg.sender, address(this), wad);
_stakeInMine(incentives);
}
| 13,006 |
20 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.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 {
require(owner != address(0), "ERC20: approve from the zero ad... | * 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 {
require(owner != address(0), "ERC20: approve from the zero ad... | 14,103 |
536 | // adjustments[15]/mload(0x4fa0), Constraint expression for ecdsa/signature0/exponentiate_key/bit_extraction_end: column21_row3. | let val := /*column21_row3*/ mload(0x39a0)
| let val := /*column21_row3*/ mload(0x39a0)
| 20,853 |
2 | // @custom:security-contact joe.weepa19@bk.ru | contract BETAVERSE is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("BETAVERSE", "BETA");
__Ownable_init();
__UUPSUpgradeabl... | contract BETAVERSE is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("BETAVERSE", "BETA");
__Ownable_init();
__UUPSUpgradeabl... | 16,704 |
6 | // mumbai | registry := 0xff7Ca10aF37178BdD056628eF42fD7F799fAc77c
| registry := 0xff7Ca10aF37178BdD056628eF42fD7F799fAc77c
| 33,879 |
184 | // Address of the contract responsible for post rebase syncs with AMMs | address private _deprecated_rebaseHooksAddr = address(0);
| address private _deprecated_rebaseHooksAddr = address(0);
| 48,063 |
98 | // Function to allow admin to claim other BEP20 tokens sent to this contract (by mistake) | function transferBEP20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != address(this), "Cannot transfer out native token");
IERC20(_tokenAddr).transfer(_to, _amount);
}
| function transferBEP20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != address(this), "Cannot transfer out native token");
IERC20(_tokenAddr).transfer(_to, _amount);
}
| 22,710 |
19 | // Customerrors | error Unauthorized(address caller);
error DeadlineError(uint deadline);
error CampaignStatusError(uint status);
error LockError();
error TransferError(uint campaignId, uint amount, address recipient);
error InvalidWithdrawValue(uint _request, uint _available);
error EmergencyMode();
erro... | error Unauthorized(address caller);
error DeadlineError(uint deadline);
error CampaignStatusError(uint status);
error LockError();
error TransferError(uint campaignId, uint amount, address recipient);
error InvalidWithdrawValue(uint _request, uint _available);
error EmergencyMode();
erro... | 17,614 |
5 | // IGovernedContract--------------------------------- | function _destroy(IGovernedContract _newImpl) internal {
v2storage.setOwner(_newImpl);
}
| function _destroy(IGovernedContract _newImpl) internal {
v2storage.setOwner(_newImpl);
}
| 15,432 |
16 | // allows token owner to list a token for lending. Signature for listForLending(string,uint256,uint32,uint104) : `0x3f3d3e39`tokenId id of the token being listed for lending. serialNoserial Number of the token. lendingPeriod timestamp for number of days for which auction will run. amount timestamp for number of days fo... | function listForLending(
| function listForLending(
| 13,991 |
5 | // Send money to the contract | wallet.receiveFunds.value(cost);
return bookingId;
| wallet.receiveFunds.value(cost);
return bookingId;
| 40,496 |
12 | // Query in base -> quote direction, if a pool is found then we are selling the base | address[] memory machines = IDODOV2Registry(registry).getDODOPool(takerToken, makerToken);
sellBase = true;
if (machines.length == 0) {
| address[] memory machines = IDODOV2Registry(registry).getDODOPool(takerToken, makerToken);
sellBase = true;
if (machines.length == 0) {
| 8,478 |
1 | // It takes 12 dropCount to reach at 0.2 floor price in Dutch Auction | return
dropCount < 12
? PUBLIC_SALES_START_PRICE - dropCount * priceDropAmount
: priceDropFloor;
| return
dropCount < 12
? PUBLIC_SALES_START_PRICE - dropCount * priceDropAmount
: priceDropFloor;
| 12,406 |
19 | // Method for getting price required for minting per NFT token | function pricePerToken() public view returns (uint256) {
return _pricePerToken;
}
| function pricePerToken() public view returns (uint256) {
return _pricePerToken;
}
| 7,337 |
60 | // else | bool trigger =
block.number >= priorityRequests[firstPriorityRequestId].expirationBlock &&
priorityRequests[firstPriorityRequestId].expirationBlock != 0;
| bool trigger =
block.number >= priorityRequests[firstPriorityRequestId].expirationBlock &&
priorityRequests[firstPriorityRequestId].expirationBlock != 0;
| 38,233 |
69 | // SafeERC20 Wrappers around ERC20 operations that throw on failure (when the tokencontract returns false). Tokens that return no value (and instead revert orthrow on failure) are also supported, non-reverting calls are assumed to besuccessful.To use this library you can add a `using SafeERC20 for IERC20;` statement to... | library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address fro... | library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address fro... | 224 |
149 | // exclude uniswapV2Router from receiving reward. | _excludeAccountFromReward(address(uniswapV2Router));
| _excludeAccountFromReward(address(uniswapV2Router));
| 21,728 |
3 | // https:explorer.optimism.io/address/0x6d4a64C57612841c2C6745dB2a4E4db34F002D20; | address public constant OWNER = 0x6d4a64C57612841c2C6745dB2a4E4db34F002D20;
| address public constant OWNER = 0x6d4a64C57612841c2C6745dB2a4E4db34F002D20;
| 50,579 |
158 | // set accumulatedSeigniorage to it's balance | accumulatedSeigniorage = IERC20(cash).balanceOf(address(this));
initialized = true;
emit Initialized(msg.sender, block.number);
| accumulatedSeigniorage = IERC20(cash).balanceOf(address(this));
initialized = true;
emit Initialized(msg.sender, block.number);
| 2,165 |
4 | // A helper function to check if the operator is allowed. / | modifier onlyAllowedOperator(address from) virtual {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from != msg.sender) {
_checkFilterOperator(... | modifier onlyAllowedOperator(address from) virtual {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from != msg.sender) {
_checkFilterOperator(... | 6,825 |
1 | // Returns the subtraction of two unsigned integers, reverting onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. / | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, 'SafeMath: subtraction overflow');
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, 'SafeMath: subtraction overflow');
}
| 12,649 |
4 | // Factory for deploying GeneralTransferManager module / | contract TrackedRedemptionFactory is ModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of module
* @param _usageCost Usage cost of module
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
co... | contract TrackedRedemptionFactory is ModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of module
* @param _usageCost Usage cost of module
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
co... | 46,428 |
35 | // This creates a mapping with all data storage | mapping (address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
| mapping (address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
| 26,385 |
142 | // Calculate the reward amount for the current window - Need to consider pendingForApprovalAmount for Auto Approvals | totalAmount = stakeInfo.approvedAmount.add(stakeInfo.pendingForApprovalAmount);
rewardAmount = _calculateRewardAmount(stakeMapIndex, totalAmount);
totalAmount = totalAmount.add(rewardAmount);
| totalAmount = stakeInfo.approvedAmount.add(stakeInfo.pendingForApprovalAmount);
rewardAmount = _calculateRewardAmount(stakeMapIndex, totalAmount);
totalAmount = totalAmount.add(rewardAmount);
| 51,506 |
8 | // Define an internal function '_removeVerifier' to remove this role, called by 'removeHarvester' | function _removeVerifier(address account) internal {
verifiers.remove(account);
emit VerifierRemoved(account);
}
| function _removeVerifier(address account) internal {
verifiers.remove(account);
emit VerifierRemoved(account);
}
| 30,326 |
90 | // generate the uniswap pair path of token -> weth | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
| address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
| 30,044 |
0 | // General Attributes // Global Mappings / | constructor() public {
}
| constructor() public {
}
| 9,596 |
178 | // Convert token0 to BCNT via UniswapV3 pool | token0.approve(address(converter), receivedToken0Amount);
converter.convertUniV3(address(token0), receivedToken0Amount, 100, address(BCNT), minAmountBCNTReceived, msg.sender, bcntUniV3SwapPath);
emit RewardPaid(msg.sender, compoundedLPRewardAmount);
| token0.approve(address(converter), receivedToken0Amount);
converter.convertUniV3(address(token0), receivedToken0Amount, 100, address(BCNT), minAmountBCNTReceived, msg.sender, bcntUniV3SwapPath);
emit RewardPaid(msg.sender, compoundedLPRewardAmount);
| 6,882 |
30 | // add liquidity to uniswap | addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
| addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
| 5,059 |
11 | // Replaces an existing Signature with empty string | fingerprintSignatureMapping[sha3(digitalFingerprint)] = "";
| fingerprintSignatureMapping[sha3(digitalFingerprint)] = "";
| 43,145 |
412 | // verify allowance decrease doesn't underflow | require(currentVal >= _value, "ERC20: decreased allowance below zero");
| require(currentVal >= _value, "ERC20: decreased allowance below zero");
| 7,118 |
112 | // informs generator of withdrawal (all funds) | function withdrawFunds(address policyBookAddress, uint256 nftIndex) external returns (uint256);
| function withdrawFunds(address policyBookAddress, uint256 nftIndex) external returns (uint256);
| 24,521 |
165 | // Returns `true` if latest update request posted to the Witnet Request Board / has not been solved yet by the Witnet oracle. | function pendingUpdate() external view returns (bool);
| function pendingUpdate() external view returns (bool);
| 38,115 |
8 | // Strong Holder Offering (SHO) contract used to collect funds from SHO lottery winners./DAO Maker/The flow is the following:/ 1. SHO Organizer runs the lottery off-chain./ 2. Once the winners are selected, for every winner, the SHO Organzier signs a message cointaining the SHO information./The signing, as well as the ... | contract SHO is Ownable, Pausable {
using ECDSA for bytes32;
using SafeERC20 for IERC20;
address public shoOrganizer;
address public depositReceiver;
mapping(string => mapping(address => bool)) public depositsForSho;
mapping(string => uint) public depositedAmount;
event ShoOrganizerChange... | contract SHO is Ownable, Pausable {
using ECDSA for bytes32;
using SafeERC20 for IERC20;
address public shoOrganizer;
address public depositReceiver;
mapping(string => mapping(address => bool)) public depositsForSho;
mapping(string => uint) public depositedAmount;
event ShoOrganizerChange... | 28,611 |
83 | // Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll} / | function isApprovedForAll(address owner, address operator) external view returns (bool);
| function isApprovedForAll(address owner, address operator) external view returns (bool);
| 6,986 |
18 | // Store the result | let value := mload(0xc0)
| let value := mload(0xc0)
| 34,539 |
8 | // View all aggregated stakes / | function totalStakes() public view returns(uint256) {
uint256 _totalStakes = 0;
for (uint256 s = 0; s < stakeholders.length; s += 1){
_totalStakes = _totalStakes.add(stakes[stakeholders[s]]);
}
return _totalStakes;
}
| function totalStakes() public view returns(uint256) {
uint256 _totalStakes = 0;
for (uint256 s = 0; s < stakeholders.length; s += 1){
_totalStakes = _totalStakes.add(stakes[stakeholders[s]]);
}
return _totalStakes;
}
| 44,463 |
14 | // solium-disable-next-line security/no-inline-assembly | assembly {
if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) }
| assembly {
if eq(call(gas, proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) }
| 33,296 |
3 | // funcion envia moneda existente | function send(address receiver, uint amount) public {
if (amount > balances[msg.sender])
revert InsufficentBalance({
requested: amount,
available: balances[msg.sender]
});
balances [msg.sender] -= amount;
balances[receiver] += amount;
... | function send(address receiver, uint amount) public {
if (amount > balances[msg.sender])
revert InsufficentBalance({
requested: amount,
available: balances[msg.sender]
});
balances [msg.sender] -= amount;
balances[receiver] += amount;
... | 25,140 |
6 | // naive, no-calculation swapper.- the exchange rate is fixed at construction- mints new tokens at will... | contract TestUniswap is IUniswap {
IERC20 public token;
uint256 public rateMult;
uint256 public rateDiv;
constructor(
uint256 _rateMult,
uint256 _rateDiv,
address tokenAddress
) public payable {
token = IERC20(tokenAddress);
rateMult = _rateMult;
rateDiv = _rateDiv;
require(msg.va... | contract TestUniswap is IUniswap {
IERC20 public token;
uint256 public rateMult;
uint256 public rateDiv;
constructor(
uint256 _rateMult,
uint256 _rateDiv,
address tokenAddress
) public payable {
token = IERC20(tokenAddress);
rateMult = _rateMult;
rateDiv = _rateDiv;
require(msg.va... | 264 |
283 | // Emits an {Approval} event. / | function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
}
| function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
}
| 1,882 |
46 | // Must transfer the entire block value or leave at least 5 | require(newBlockValue == 0 || newBlockValue >= 5 finney);
require(sourceTileClaimer == _msgSender);
require(destTileClaimer == _msgSender);
require(_moveAmount >= 1 finney); // Can't be less
require(_moveAmount % 1 finney == 0); // Move amount must be in multiples of 1 finney
| require(newBlockValue == 0 || newBlockValue >= 5 finney);
require(sourceTileClaimer == _msgSender);
require(destTileClaimer == _msgSender);
require(_moveAmount >= 1 finney); // Can't be less
require(_moveAmount % 1 finney == 0); // Move amount must be in multiples of 1 finney
| 18,360 |
22 | // Calculate the DOMAIN_SEPARATOR | function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_SIGNATURE_HASH,
chainId,
address(this)
)
);
}
| function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_SIGNATURE_HASH,
chainId,
address(this)
)
);
}
| 19,908 |
4 | // Create contract using a minimal proxy and call initializer | bytes memory initializer = abi.encodeWithSignature(
"initialize(address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,uint8,bool)",
_owner,
_beneficiary,
_token,
_managedAmount,
_startTime,
_endTime,
... | bytes memory initializer = abi.encodeWithSignature(
"initialize(address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,uint8,bool)",
_owner,
_beneficiary,
_token,
_managedAmount,
_startTime,
_endTime,
... | 10,913 |
58 | // gives square root of given x./ | function sqrt(uint256 x)
internal
pure
returns (uint256 y)
| function sqrt(uint256 x)
internal
pure
returns (uint256 y)
| 28,860 |
27 | // Deposit to PowerPerpetual. | amount = finalBalance.sub(initialBalance);
perpetual.deposit(transfer.account, amount);
| amount = finalBalance.sub(initialBalance);
perpetual.deposit(transfer.account, amount);
| 17,444 |
4 | // Withdraws the already delisted from marketplace asset./ Burns the asset and transfers the original metaverse asset represented by the asset to the asset owner./ Pays out any unclaimed rent to consumer if set, otherwise it is paid to the owner of the LandWorks NFT/_assetId The target _assetId | function withdraw(uint256 _assetId) external;
| function withdraw(uint256 _assetId) external;
| 568 |
17 | // Sets asset proxy address./ Can be set only once./function is final, and must not be overridden./_proxy asset proxy contract address./ return success. | function init(ChronoBankAssetProxy _proxy) public returns(bool) {
if (address(proxy) != 0x0) {
return false;
}
proxy = _proxy;
return true;
}
| function init(ChronoBankAssetProxy _proxy) public returns(bool) {
if (address(proxy) != 0x0) {
return false;
}
proxy = _proxy;
return true;
}
| 43,322 |
158 | // res += val(coefficients[14] + coefficients[15]adjustments[1]). | res := addmod(res,
mulmod(val,
add(/*coefficients[14]*/ mload(0x600),
mulmod(/*coefficients[15]*/ mload(0x620),
| res := addmod(res,
mulmod(val,
add(/*coefficients[14]*/ mload(0x600),
mulmod(/*coefficients[15]*/ mload(0x620),
| 20,693 |
84 | // Calculate collateral pool shares | uint256 shares = 0;
if (pool == 0) {
shares = _amount;
pool = _amount;
} else {
| uint256 shares = 0;
if (pool == 0) {
shares = _amount;
pool = _amount;
} else {
| 11,341 |
107 | // Instantiate DebtLocker if it doesn't exist withing this factory | if (debtLocker == address(0)) {
debtLocker = IDebtLockerFactory(dlFactory).newLocker(loan);
debtLockers[loan][dlFactory] = debtLocker;
}
| if (debtLocker == address(0)) {
debtLocker = IDebtLockerFactory(dlFactory).newLocker(loan);
debtLockers[loan][dlFactory] = debtLocker;
}
| 20,824 |
23 | // Do reverse order of fees charged in joinswap_ExternAmountIn, this way``` pAo == joinswap_ExternAmountIn(Ti, joinswap_PoolAmountOut(pAo, Ti)) ```uint tAi = tAiAfterFee / (1 - (1-weightTi)swapFee) ; | uint zar = bmul(bsub(BONE, normalizedWeight), swapFee);
tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BONE, zar));
return tokenAmountIn;
| uint zar = bmul(bsub(BONE, normalizedWeight), swapFee);
tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BONE, zar));
return tokenAmountIn;
| 49,871 |
27 | // See {IDynamicBlueprint.prepareBlueprintAndCreateSale} / | function prepareBlueprintAndCreateSale(
BlueprintPreparationConfig calldata config,
IStorefront.Sale memory sale,
address storefront
) external override onlyRole(MINTER_ROLE) {
require(blueprint.prepared == false, "already prepared");
require(hasRole(STOREFRONT_MINTER_ROL... | function prepareBlueprintAndCreateSale(
BlueprintPreparationConfig calldata config,
IStorefront.Sale memory sale,
address storefront
) external override onlyRole(MINTER_ROLE) {
require(blueprint.prepared == false, "already prepared");
require(hasRole(STOREFRONT_MINTER_ROL... | 35,862 |
5 | // 批量mint,地址不足自动创建target mint合约地址times mint的次数data mint的inputdata/ | function batch_mint(address target, uint8 times, bytes calldata data) external payable{
fooyao.batch_mint{value: msg.value}(msg.sender, target, times, data);
}
| function batch_mint(address target, uint8 times, bytes calldata data) external payable{
fooyao.batch_mint{value: msg.value}(msg.sender, target, times, data);
}
| 46,975 |
3 | // Transfers ownership of the contract to a new account (`newOwner`).Can only be called by the current owner. _newOwner address of the new owner / | function transferOwnership(address _newOwner) external virtual onlyOwner {
if (_newOwner == address(0)) {
revert Ownable__NewOwnerIsZeroAddress();
}
_transferOwnership(_newOwner);
}
| function transferOwnership(address _newOwner) external virtual onlyOwner {
if (_newOwner == address(0)) {
revert Ownable__NewOwnerIsZeroAddress();
}
_transferOwnership(_newOwner);
}
| 5,963 |
14 | // reset staking time | stakes[i].startDate = block.timestamp;
| stakes[i].startDate = block.timestamp;
| 51,774 |
1 | // Recover ETH stored in the contract to The destination address amount Amount to be sentonly callable by `owner()` / | function recoverEth(address payable to, uint256 amount) external override onlyOwner {
_recoverEth(to, amount);
}
| function recoverEth(address payable to, uint256 amount) external override onlyOwner {
_recoverEth(to, amount);
}
| 1,979 |
2 | // Returns the total amount of Pool tokens, including those that are not currently in the Vault ('managed'). / | function total(bytes32 balance) internal pure returns (uint256) {
// Since 'cash' and 'managed' are 112 bit values, we don't need checked arithmetic. Additionally, `toBalance`
// ensures that 'total' always fits in 112 bits.
return cash(balance) + managed(balance);
}
| function total(bytes32 balance) internal pure returns (uint256) {
// Since 'cash' and 'managed' are 112 bit values, we don't need checked arithmetic. Additionally, `toBalance`
// ensures that 'total' always fits in 112 bits.
return cash(balance) + managed(balance);
}
| 21,161 |
10 | // hold all details of the winner | WinningContestDetails[] private winningContests;
| WinningContestDetails[] private winningContests;
| 14,382 |
43 | // first uncom | mintRandom(13,2,2);
mintRandom(17,1,1);
if(founderpackcap1 > 0){
mintRandom(3,1,1);
sickgain = sickbonusbase * 2;
xpgain = userxpgainbase * 2;
founderpackcap1 --;
| mintRandom(13,2,2);
mintRandom(17,1,1);
if(founderpackcap1 > 0){
mintRandom(3,1,1);
sickgain = sickbonusbase * 2;
xpgain = userxpgainbase * 2;
founderpackcap1 --;
| 12,046 |
20 | // string memory tempImage = string(abi.encodePacked("https:storage.googleapis.com/opensea-prod.appspot.com/puffs/", uint2str(bagID),".png")); | string memory tempImage = unrevealed;
if (isMechRevealed[bagID])
{
tempImage = string(abi.encodePacked(baseTokenURI(), uint2str(bagID), ".png"));
}
| string memory tempImage = unrevealed;
if (isMechRevealed[bagID])
{
tempImage = string(abi.encodePacked(baseTokenURI(), uint2str(bagID), ".png"));
}
| 18,969 |
40 | // RequestHashStorage This contract is the entry point to retrieve all the hashes of the request network system./ | contract RequestHashStorage is WhitelistedRole {
// Event to declare a new hash
event NewHash(string hash, address hashSubmitter, bytes feesParameters);
/**
* @notice Declare a new hash
* @param _hash hash to store
* @param _feesParameters Parameters use to compute the fees. This is a bytes to stay gen... | contract RequestHashStorage is WhitelistedRole {
// Event to declare a new hash
event NewHash(string hash, address hashSubmitter, bytes feesParameters);
/**
* @notice Declare a new hash
* @param _hash hash to store
* @param _feesParameters Parameters use to compute the fees. This is a bytes to stay gen... | 25,801 |
24 | // we are not accepting enough data to overflow on `_tokenIds` | for (uint256 i = 0; i < _tokenIds.length; i++) {
super._mint(_account, _tokenIds[i]);
emit LogMinted(_account, _tokenIds[i]);
}
| for (uint256 i = 0; i < _tokenIds.length; i++) {
super._mint(_account, _tokenIds[i]);
emit LogMinted(_account, _tokenIds[i]);
}
| 36,609 |
20 | // First check most recent balance | if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
| if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
| 3,098 |
4 | // anyUSDC -> L1 USDC IUChildERC20 withdraw MaticBridge Bridge | IUChildERC20(address(collateral_token)).withdraw(token_amount);
| IUChildERC20(address(collateral_token)).withdraw(token_amount);
| 29,507 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.