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 |
|---|---|---|---|---|
1 | // require(_to.call(_data)); | (bool success, ) = _to.call(_data);
require(success);
return true;
| (bool success, ) = _to.call(_data);
require(success);
return true;
| 25,616 |
362 | // Returns the absolute value of a signed integer. / | function abs(int256 a) internal pure returns (uint256) {
return a > 0 ? uint256(a) : uint256(-a);
}
| function abs(int256 a) internal pure returns (uint256) {
return a > 0 ? uint256(a) : uint256(-a);
}
| 62,524 |
112 | // Handle the approval of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter an `approve`. This function MAY throw to revert and reject theapproval. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message s... | function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
| function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
| 5,410 |
42 | // this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
uint amount0 = ba... | function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
uint amount0 = ba... | 2,389 |
32 | // 删除帐户的余额(含其他帐户)删除以后是不可逆的 _from 要操作的帐户地址 _value 要减去的数量 / | function burnFrom(address _from, uint256 _value) public returns (bool success) {
//检查帐户余额是否大于要减去的值
require(balanceOf[_from] >= _value);
//检查 其他帐户 的余额是否够使用
require(_value <= allowance[_from][msg.sender]);
//减掉代币
balanceOf[_from] -= _value;
allowance[_from][msg.... | function burnFrom(address _from, uint256 _value) public returns (bool success) {
//检查帐户余额是否大于要减去的值
require(balanceOf[_from] >= _value);
//检查 其他帐户 的余额是否够使用
require(_value <= allowance[_from][msg.sender]);
//减掉代币
balanceOf[_from] -= _value;
allowance[_from][msg.... | 31,722 |
50 | // Owner can transfer out any accidentally sent ERC20 tokens excluding the token intended for this contract | function transferAnyERC20Token(address _address, uint _tokens) external onlyOwner {
require(_address != address(erc20Contract));
ERC20(_address).safeTransfer(owner, _tokens);
}
| function transferAnyERC20Token(address _address, uint _tokens) external onlyOwner {
require(_address != address(erc20Contract));
ERC20(_address).safeTransfer(owner, _tokens);
}
| 16,726 |
2 | // 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)));
}
| 9,185 |
6 | // Called by a pauser to pause, triggers stopped state. / | function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| 6,431 |
27 | // Configure fee of the L1LP contract Each fee rate is scaled by 10^3 for precision, eg- a fee rate of 50 would mean 5% _userRewardMinFeeRate minimum fee rate that users get _userRewardMaxFeeRate maximum fee rate that users get _ownerRewardFeeRate fee rate that contract owner gets / | function configureFeeExits(
uint256 _userRewardMinFeeRate,
uint256 _userRewardMaxFeeRate,
uint256 _ownerRewardFeeRate
)
external
onlyDAO()
onlyInitialized()
| function configureFeeExits(
uint256 _userRewardMinFeeRate,
uint256 _userRewardMaxFeeRate,
uint256 _ownerRewardFeeRate
)
external
onlyDAO()
onlyInitialized()
| 31,485 |
24 | // Initializes enabled tokens for the account. Enabled tokens is a bit mask which holds information which tokens were used by user | creditFilter.initEnabledTokens(creditAccount); // T:[CM-5]
| creditFilter.initEnabledTokens(creditAccount); // T:[CM-5]
| 36,068 |
37 | // Get the numbers of beneficiaries in the vesting contract. / | function beneficiariesLength() view public returns (uint256) {
return addresses.length;
}
| function beneficiariesLength() view public returns (uint256) {
return addresses.length;
}
| 33,996 |
298 | // Convex stkcvxFPIFRAX, stkcvxFRAXBP, etc | IConvexStakingWrapperFrax public stakingToken;
I2poolToken public curveToken;
| IConvexStakingWrapperFrax public stakingToken;
I2poolToken public curveToken;
| 9,745 |
3 | // MARKET + MARKET MATH CORE | error MarketExpired();
error MarketZeroAmountsInput();
error MarketZeroAmountsOutput();
error MarketZeroLnImpliedRate();
error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount);
error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance);
error ... | error MarketExpired();
error MarketZeroAmountsInput();
error MarketZeroAmountsOutput();
error MarketZeroLnImpliedRate();
error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount);
error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance);
error ... | 22,473 |
10 | // Get the ID of the output product of the tranformation | function getOutputID() public view returns (uint) {
return materialID.outputID;
}
| function getOutputID() public view returns (uint) {
return materialID.outputID;
}
| 17,743 |
49 | // use ETH solhint-disable-next-line avoid-low-level-calls | (success, ) = marketplace.call{value: amount}(tradeData);
| (success, ) = marketplace.call{value: amount}(tradeData);
| 30,130 |
65 | // check if presale is still running | require(presaleIsRunning == false);
address oldOwner = PlayerIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = PlayerIndexToPrice[_tokenId];
uint256 payment = SafeMath.mul(99,(SafeMath.div(PlayerIndexToPrice[_tokenId],100)));
uint256 networkFee = calcNetworkFee(_to... | require(presaleIsRunning == false);
address oldOwner = PlayerIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = PlayerIndexToPrice[_tokenId];
uint256 payment = SafeMath.mul(99,(SafeMath.div(PlayerIndexToPrice[_tokenId],100)));
uint256 networkFee = calcNetworkFee(_to... | 10,041 |
28 | // Function burns a specific amount of tokens._value The amount of token to be burned./ | function burn(uint _value) public onlyOwner {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| function burn(uint _value) public onlyOwner {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| 54,987 |
317 | // the minimum we are willing to sell all the oTokens for. A discount is applied on black-scholes price | uint96(minBidAmount),
| uint96(minBidAmount),
| 48,150 |
75 | // safeDiv computes `floor(a / b)`. We use the identity (a, b integer): ceil(a / b) = floor((a + b - 1) / b) To implement `ceil(a / b)` using safeDiv. | partialAmount = numerator.safeMul(target)
.safeAdd(denominator.safeSub(1))
.safeDiv(denominator);
return partialAmount;
| partialAmount = numerator.safeMul(target)
.safeAdd(denominator.safeSub(1))
.safeDiv(denominator);
return partialAmount;
| 9,207 |
68 | // When the Land to delete is the last Land the swap operation is unnecesary | if (landIndex != lastLandIndex) {
uint256 lastLandId = stakedLands[landOwner][lastLandIndex];
stakedLands[landOwner][landIndex] = lastLandId; // Move the last Land to the slot of the to-delete Land
stakedLandsIndex[lastLandId] = landIndex; // Update the moved Land's index
... | if (landIndex != lastLandIndex) {
uint256 lastLandId = stakedLands[landOwner][lastLandIndex];
stakedLands[landOwner][landIndex] = lastLandId; // Move the last Land to the slot of the to-delete Land
stakedLandsIndex[lastLandId] = landIndex; // Update the moved Land's index
... | 19,695 |
14 | // Immutable Randomness Beacon A commit/reveal based randomness beacon. Use for low-security randomness. Immutable / | contract Beacon {
using SafeMath for uint256;
// Emitted after a commitment is made
event Commit(uint256 indexed commitBlock);
// Emitted after a block is 'recommitted'
event Recommit(uint256 indexed original, uint256 indexed forwardTo);
// Emitted once a successful callback is made
event ... | contract Beacon {
using SafeMath for uint256;
// Emitted after a commitment is made
event Commit(uint256 indexed commitBlock);
// Emitted after a block is 'recommitted'
event Recommit(uint256 indexed original, uint256 indexed forwardTo);
// Emitted once a successful callback is made
event ... | 10,697 |
2 | // Implements methods defined in IEscrow. // Get the current ETH balance of an account in the escrow. account The account to check ETH balance.return Current ETH balance of the account. / | function getBalance(address account) public override view returns (uint256) {
return _accountBalances[account][address(_weth)];
}
| function getBalance(address account) public override view returns (uint256) {
return _accountBalances[account][address(_weth)];
}
| 50,382 |
32 | // Internal function that transfers the external tokento the contract and mints corresponding assets to the userEmits an Transfer event . token The external token address value The amount that will be transferred to contract asset The amount mints for the user. / | function _exchange(IERC20 token, uint256 value, uint256 asset) internal {
require(IERC20(token).balanceOf(msg.sender) >= value, "Insufficient Balance");
require(IERC20(token).transferFrom(msg.sender, address(this), value), "Transfer failed");
_mint(msg.sender, asset);
deposists[token... | function _exchange(IERC20 token, uint256 value, uint256 asset) internal {
require(IERC20(token).balanceOf(msg.sender) >= value, "Insufficient Balance");
require(IERC20(token).transferFrom(msg.sender, address(this), value), "Transfer failed");
_mint(msg.sender, asset);
deposists[token... | 14,415 |
2 | // timestamp when token release is enabled | uint256 private _releaseTime;
| uint256 private _releaseTime;
| 26,838 |
40 | // Function to mint tokens/_to The address that will receive the minted tokens./_amount The amount of tokens to mint./ return A boolean that indicates if the operation was successful. | function mint(address _to, uint256 _amount) public onlyMinter returns (bool) {
uint256 available = availableTokens();
require(_amount <= available);
leftOnLastMint = available.sub(_amount);
lastMintTime = now; // solium-disable-line security/no-block-members
require(token.mint(_to, _amount));
... | function mint(address _to, uint256 _amount) public onlyMinter returns (bool) {
uint256 available = availableTokens();
require(_amount <= available);
leftOnLastMint = available.sub(_amount);
lastMintTime = now; // solium-disable-line security/no-block-members
require(token.mint(_to, _amount));
... | 57,697 |
8 | // Main counters |
uint public totalReceived;
uint public totalSent;
|
uint public totalReceived;
uint public totalSent;
| 31,904 |
97 | // Tier 3 | tokens = amountPaid.mul(rateTier3);
| tokens = amountPaid.mul(rateTier3);
| 27,218 |
53 | // TokenTimelockEscrow Token escrow to only allow withdrawal only if the lock periodhas expired. As only the owner can make deposits and withdrawalsthis contract should be owned by the crowdsale, which can thenperform deposits and withdrawals for individual users. / | contract TokenTimelockEscrow is TokenConditionalEscrow {
// timestamp when token release is enabled
uint256 public releaseTime;
constructor(uint256 _releaseTime) public {
// solium-disable-next-line security/no-block-members
require(_releaseTime > block.timestamp, "Release time should be in the future."... | contract TokenTimelockEscrow is TokenConditionalEscrow {
// timestamp when token release is enabled
uint256 public releaseTime;
constructor(uint256 _releaseTime) public {
// solium-disable-next-line security/no-block-members
require(_releaseTime > block.timestamp, "Release time should be in the future."... | 9,821 |
7 | // Create a 4 byte shortId for a 32 byte itemId. itemId itemId of the item.return shortId New 4 byte shortId. / | function createShortId(bytes32 itemId) external noShortId(itemId) returns (bytes4 shortId) {
// Find a shortId that hasn't been used before.
bytes32 hash = keccak256(abi.encodePacked(itemId));
shortId = bytes4(hash);
while (shortIdItemId[shortId] != 0) {
hash = keccak256(... | function createShortId(bytes32 itemId) external noShortId(itemId) returns (bytes4 shortId) {
// Find a shortId that hasn't been used before.
bytes32 hash = keccak256(abi.encodePacked(itemId));
shortId = bytes4(hash);
while (shortIdItemId[shortId] != 0) {
hash = keccak256(... | 30,714 |
163 | // distribution of per second | uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| uint256 public rewardRate = 0;
uint256 public rewardPerLPToken = 0;
mapping(address => uint256) private rewards;
mapping(address => uint256) private userRewardPerTokenPaid;
| 47,786 |
115 | // Price per single share expressed in Backing Tokens of the underlying pool./This is for the purpose of TempusAMM api support./Example: exchanging Tempus Yield Share to DAI/ return 1e18 decimal conversion rate per share | function getPricePerFullShare() external returns (uint256);
| function getPricePerFullShare() external returns (uint256);
| 7,295 |
201 | // OToken/Rentable Team <hello@rentable.world>/ @custom:security Rentable Security Team <security@rentable.world>/Represents a transferrable tokenized deposit and mimics the wrapped token | contract ORentable is BaseTokenInitializable {
/* ========== CONSTRUCTOR ========== */
/// @notice Instantiate a token
/// @param wrapped wrapped token address
/// @param owner admin for the contract
/// @param rentable rentable address
constructor(
address wrapped,
address owne... | contract ORentable is BaseTokenInitializable {
/* ========== CONSTRUCTOR ========== */
/// @notice Instantiate a token
/// @param wrapped wrapped token address
/// @param owner admin for the contract
/// @param rentable rentable address
constructor(
address wrapped,
address owne... | 44,593 |
10 | // An example smart contract that uses BCDB / | contract use_BCDB {
BCDB database;
address constant BCDB_address = 0x448e75d45d9cfd0a9c1f5564d27f1b411a2d8c8e;
uint256 database_id;
bytes32[2] data_item;
function set_BCDB_contract() {
database = BCDB(BCDB_address);
}
function create_all() external {
database_id = database.create("Trisk", "Coin", "Future... | contract use_BCDB {
BCDB database;
address constant BCDB_address = 0x448e75d45d9cfd0a9c1f5564d27f1b411a2d8c8e;
uint256 database_id;
bytes32[2] data_item;
function set_BCDB_contract() {
database = BCDB(BCDB_address);
}
function create_all() external {
database_id = database.create("Trisk", "Coin", "Future... | 29,603 |
152 | // check that price timestamp is after latest timestamp the vault was updated at | require(
timestamp > _vaultLatestUpdate,
"MarginCalculator: auction timestamp should be post vault latest update"
);
| require(
timestamp > _vaultLatestUpdate,
"MarginCalculator: auction timestamp should be post vault latest update"
);
| 18,377 |
345 | // derive entropy from the revealed secret | bytes32 entropy = keccak256(abi.encodePacked(_secret));
_reward(drawId, draw, entropy);
| bytes32 entropy = keccak256(abi.encodePacked(_secret));
_reward(drawId, draw, entropy);
| 55,260 |
4 | // require less Than (<) operator, preventing transactions being performed after a certain block height is reached | function requireBlockNumberLessThan(
uint rhs
)public pure
| function requireBlockNumberLessThan(
uint rhs
)public pure
| 10,092 |
22 | // Unstakes either BTRFLY or LOBI from treasury/_redactedBool if unstakiung to redacted or lobi/_amountAmount of token that will be withdrawn from treasury and unstaked | function unstake(bool _redacted, uint256 _amount) external onlyGuardian {
(address staking, address token, address stakedToken) = _redactedOrLobi(_redacted);
// retrieve amount of staked token from treasury
treasury.manage(stakedToken, _amount);
// approve staked token to be spent ... | function unstake(bool _redacted, uint256 _amount) external onlyGuardian {
(address staking, address token, address stakedToken) = _redactedOrLobi(_redacted);
// retrieve amount of staked token from treasury
treasury.manage(stakedToken, _amount);
// approve staked token to be spent ... | 30,537 |
53 | // Whitelist Mint Functions | function whitelistMint(uint256 amount_) external payable onlySender whitelistMinting {
require(isWhitelisted[msg.sender],
"You are not whitelisted!");
require(mintsPerWhitelist >= amount_,
"Amount exceeds max mints per whitelist!");
require(mintsPerWhitelist >= addre... | function whitelistMint(uint256 amount_) external payable onlySender whitelistMinting {
require(isWhitelisted[msg.sender],
"You are not whitelisted!");
require(mintsPerWhitelist >= amount_,
"Amount exceeds max mints per whitelist!");
require(mintsPerWhitelist >= addre... | 39,438 |
11 | // now first round | uint256 sum=div(mul(amount,100),_price1);
uint256 result=sum;
require(result+_total1 <= _maxtotal1, "ICO: First round limit sales");
require(result+_balancesR1[msg.sender] <= 16129000000, "ICO: Limit per wallet(max 10000)");//16129000000 T... | uint256 sum=div(mul(amount,100),_price1);
uint256 result=sum;
require(result+_total1 <= _maxtotal1, "ICO: First round limit sales");
require(result+_balancesR1[msg.sender] <= 16129000000, "ICO: Limit per wallet(max 10000)");//16129000000 T... | 27,587 |
221 | // Retrieve the last update time for a specific currency / | function lastRateUpdateTimesForCurrencies(bytes4[] currencyKeys)
public
view
returns (uint[])
| function lastRateUpdateTimesForCurrencies(bytes4[] currencyKeys)
public
view
returns (uint[])
| 25,462 |
6 | // Storage position of the address of the current implementation | bytes32 private constant implementationPosition = keccak256("bulksender.app.proxy.implementation");
| bytes32 private constant implementationPosition = keccak256("bulksender.app.proxy.implementation");
| 23,253 |
8 | // Accumulator is a struct that allows values to be collected such that the remainders of floor division may be cleaned up | struct Accumulator {
// accumulator is a sum of all changes always increasing
uint256 accumulator;
// slush stores division remainders until they may be distributed evenly
uint256 slush;
}
| struct Accumulator {
// accumulator is a sum of all changes always increasing
uint256 accumulator;
// slush stores division remainders until they may be distributed evenly
uint256 slush;
}
| 7,575 |
9 | // balanceOf returns the current FDT balance of a user (bonus not included) | function balanceOf(address user) public view returns (uint256) {
return balanceAtTs(user, block.timestamp);
}
| function balanceOf(address user) public view returns (uint256) {
return balanceAtTs(user, block.timestamp);
}
| 49,214 |
182 | // event | emit WhitelistUpdated(toCreate.length, toUpdate.length, toDelete.length);
| emit WhitelistUpdated(toCreate.length, toUpdate.length, toDelete.length);
| 1,183 |
1 | // The ZORA ERC-721 Transfer Helper | ERC721TransferHelper public immutable erc721TransferHelper;
| ERC721TransferHelper public immutable erc721TransferHelper;
| 5,640 |
640 | // 322 | entry "head-to-head" : ENG_ADVERB
| entry "head-to-head" : ENG_ADVERB
| 21,158 |
4 | // library | using Bytes for *;
| using Bytes for *;
| 24,506 |
115 | // Creates the main CryptoKitties smart contract instance. | function ArtCore() public {
// Starts paused.
paused = true;
// the creator of the contract is the initial CEO
ceoAddress = msg.sender;
// the creator of the contract is also the initial COO
cooAddress = msg.sender;
// start with the mythical kitten 0 - so ... | function ArtCore() public {
// Starts paused.
paused = true;
// the creator of the contract is the initial CEO
ceoAddress = msg.sender;
// the creator of the contract is also the initial COO
cooAddress = msg.sender;
// start with the mythical kitten 0 - so ... | 83,823 |
106 | // Allows admin to pause and unpause the contract / | function togglePause() public onlyAdmin {
if (paused) {
paused = false;
emit contractPausedOrUnpaused(false);
} else {
paused = true;
emit contractPausedOrUnpaused(true);
}
}
| function togglePause() public onlyAdmin {
if (paused) {
paused = false;
emit contractPausedOrUnpaused(false);
} else {
paused = true;
emit contractPausedOrUnpaused(true);
}
}
| 73,985 |
48 | // Transfer tokens from the caller to a new holder. / | function transfer(address _toAddress, uint256 _amountOfTokens)
onlybelievers ()
transferingLockedToken(msg.sender,_toAddress,_amountOfTokens)
public
override
returns(bool)
| function transfer(address _toAddress, uint256 _amountOfTokens)
onlybelievers ()
transferingLockedToken(msg.sender,_toAddress,_amountOfTokens)
public
override
returns(bool)
| 19,236 |
125 | // early sell logic | bool isBuy = from == uniswapV2Pair;
if (!isBuy && enableEarlySellTax) {
if (_holderFirstBuyTimestamp[from] != 0 &&
(_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)) {
sellLiquidityFee = earlySellLiquidityFee;
sellMarketingFee =... | bool isBuy = from == uniswapV2Pair;
if (!isBuy && enableEarlySellTax) {
if (_holderFirstBuyTimestamp[from] != 0 &&
(_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)) {
sellLiquidityFee = earlySellLiquidityFee;
sellMarketingFee =... | 3,947 |
0 | // State Variables mapping(address => bool) private _whitelist; bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); | bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant ATTENDEE_ROLE = keccak256("ATTENDEE_ROLE");
address public immutable i_admin;
| bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant ATTENDEE_ROLE = keccak256("ATTENDEE_ROLE");
address public immutable i_admin;
| 1,141 |
128 | // maximum amount time can be sold back at the momentif this value is small, time service will refill liquidity with base currency / | function maxTimeSellAmount() view public returns (uint256) {
return SafeMath.div(SafeMath.mul(_baseLiquidityAmount(), 1 ether), currentPrice());
}
| function maxTimeSellAmount() view public returns (uint256) {
return SafeMath.div(SafeMath.mul(_baseLiquidityAmount(), 1 ether), currentPrice());
}
| 4,555 |
88 | // -- -- |
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
mapping (address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
|
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
mapping (address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
| 44,525 |
30 | // Returns the nft collection that this pool trades return nft_ the address of the underlying nft collection contract / | function nft() external view returns (IERC721 nft_);
| function nft() external view returns (IERC721 nft_);
| 30,426 |
184 | // Compute keccak256 hash of 2 4-byte variables (circuit_size, num_public_inputs) / | function generate_initial_challenge(
TranscriptData memory self,
uint256 circuit_size,
uint256 num_public_inputs
| function generate_initial_challenge(
TranscriptData memory self,
uint256 circuit_size,
uint256 num_public_inputs
| 59,090 |
73 | // 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 {
require(sender != address(0), 'BEP20: transfer from the zero address');
require(recipient != address(0), 'BEP20: transfer to the zero address');
_balances[sender] = _balances[sender].sub(amount, 'BEP20... | function _transfer (address sender, address recipient, uint256 amount) internal {
require(sender != address(0), 'BEP20: transfer from the zero address');
require(recipient != address(0), 'BEP20: transfer to the zero address');
_balances[sender] = _balances[sender].sub(amount, 'BEP20... | 15,136 |
5 | // ... and give it to message sender | balanceOf [msg.sender] = 1;
| balanceOf [msg.sender] = 1;
| 3,417 |
23 | // Events | event ClaimedTokens(address indexed _token, address indexed _owner, uint _amount);
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
| event ClaimedTokens(address indexed _token, address indexed _owner, uint _amount);
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
| 21,336 |
1 | // deposit into convex, receive a tokenized deposit.parameter to stake immediately | function deposit(
uint256 _pid,
uint256 _amount,
bool _stake
) external returns (bool);
| function deposit(
uint256 _pid,
uint256 _amount,
bool _stake
) external returns (bool);
| 34,195 |
6 | // ICore implementation/Fei Protocol | contract Core is ICore, Permissions {
IFei public override fei;
IERC20 public override tribe;
address public override genesisGroup;
bool public override hasGenesisGroupCompleted;
constructor() public {
_setupGovernor(msg.sender);
Fei _fei = new Fei(address(this));
fei = IFei(address(_fei));
Tribe _trib... | contract Core is ICore, Permissions {
IFei public override fei;
IERC20 public override tribe;
address public override genesisGroup;
bool public override hasGenesisGroupCompleted;
constructor() public {
_setupGovernor(msg.sender);
Fei _fei = new Fei(address(this));
fei = IFei(address(_fei));
Tribe _trib... | 50,485 |
17 | // View payout based on bets in finished or cancelled conditions.tokenIds array of bet tokens ids view payout toreturn payout unclaimed winnings of the owner of the token / | function viewPayout(uint256[] calldata tokenIds) public returns (uint128) {
uint256 payout;
uint256 refunds;
uint256 conditionId;
uint256 tokenId;
uint256 balance;
uint256 outcomeWinIndex;
for (uint256 i = 0; i < tokenIds.length; ++i) {
tokenId = t... | function viewPayout(uint256[] calldata tokenIds) public returns (uint128) {
uint256 payout;
uint256 refunds;
uint256 conditionId;
uint256 tokenId;
uint256 balance;
uint256 outcomeWinIndex;
for (uint256 i = 0; i < tokenIds.length; ++i) {
tokenId = t... | 17,038 |
1 | // Delegate your vote to the voter $(to). | function logit() public {
logite("LOGIT_TestHello");
}
| function logit() public {
logite("LOGIT_TestHello");
}
| 8,302 |
10 | // function getAmountOutMin( | ) external view returns (uint256) {
address[] memory path;
if (_tokenIn == WETH || _tokenOut == WETH) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
path = new address[](3);
path[0] = _tokenIn;
path[1] = WETH;
path[2] = _tokenOut;
... | ) external view returns (uint256) {
address[] memory path;
if (_tokenIn == WETH || _tokenOut == WETH) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
path = new address[](3);
path[0] = _tokenIn;
path[1] = WETH;
path[2] = _tokenOut;
... | 14,567 |
17 | // caculate amount of token in crowdsale stage | function calculateTokenCrowsale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(CROWDSALE_TOKEN_IN_WEI);
}
| function calculateTokenCrowsale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(CROWDSALE_TOKEN_IN_WEI);
}
| 49,715 |
43 | // Revert with a standard message if `_msgSender()` is missing `role`. | * Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
| * Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
| 21,504 |
38 | // Calculate rewards for param _staker by calculating the time passed since last update in hours and mulitplying it to ERC721 Tokens Staked and rewardsPerHour. | function calculateRewards(address _staker)
internal
view
returns (uint256 _rewards)
| function calculateRewards(address _staker)
internal
view
returns (uint256 _rewards)
| 16,719 |
46 | // Mint multiple Voxmon Cost is 0.07 ether per Voxmon | function mint(address recipient, uint256 numberToMint) payable public returns (uint256[] memory) {
require(numberToMint > 0);
require(numberToMint <= 10, "max 10 voxmons per transaction");
require(msg.value >= MINT_COST * numberToMint);
uint256[] memory tokenIdsMinted = new uint256[... | function mint(address recipient, uint256 numberToMint) payable public returns (uint256[] memory) {
require(numberToMint > 0);
require(numberToMint <= 10, "max 10 voxmons per transaction");
require(msg.value >= MINT_COST * numberToMint);
uint256[] memory tokenIdsMinted = new uint256[... | 64,883 |
237 | // Allows anyone to withdraw funds for a specified user using the balances stored/in the Merkle tree. The funds will be sent to the owner of the acount.//Can only be used in withdrawal mode (i.e. when the owner has stopped/committing blocks and is not able to commit any more blocks).//This will NOT modify the onchain m... | function withdrawFromMerkleTree(
ExchangeData.MerkleProof calldata merkleProof
)
external
virtual;
| function withdrawFromMerkleTree(
ExchangeData.MerkleProof calldata merkleProof
)
external
virtual;
| 19,687 |
207 | // generate the new gene | uint256 _oldPartBonus = cryptantCrabStorage.readUint256(keccak256(abi.encodePacked(_tokenId, _partIndex, "partBonus")));
uint256 _partGene; // this variable will be reused by oldGene
uint256 _newGene;
for(i = 1 ; i <= 4 ; i++) {
_partGene = _partsGene[i];
if(i == _partIndex) {
_par... | uint256 _oldPartBonus = cryptantCrabStorage.readUint256(keccak256(abi.encodePacked(_tokenId, _partIndex, "partBonus")));
uint256 _partGene; // this variable will be reused by oldGene
uint256 _newGene;
for(i = 1 ; i <= 4 ; i++) {
_partGene = _partsGene[i];
if(i == _partIndex) {
_par... | 43,819 |
0 | // This mmaps tokens to signatures. The nested mapping is a mapping of Signature states, i.e. if address => mapping(uint256 => mapping(address => bool)) public documentSignings; | mapping(uint256 => mapping(address => SignatureStatus))
public documentSignings;
mapping(uint256 => uint256) public documentSigningDeadline;
mapping(address => uint32) public signatureNonces;
mapping(uint256 => bytes32) public tokenToDocHash;
| mapping(uint256 => mapping(address => SignatureStatus))
public documentSignings;
mapping(uint256 => uint256) public documentSigningDeadline;
mapping(address => uint32) public signatureNonces;
mapping(uint256 => bytes32) public tokenToDocHash;
| 26,233 |
18 | // pay taxes for buyer so that balance is up to date | payTax(buyerAddress);
Account memory buyer = _accounts[buyerAddress];
| payTax(buyerAddress);
Account memory buyer = _accounts[buyerAddress];
| 19,188 |
38 | // Removes a directory at the provided path. This cheatcode will revert in the following situations, but is not limited to just these cases: - `path` doesn't exist. - `path` isn't a directory. - User lacks permissions to modify `path`. - The directory is not empty and `recursive` is false. `path` is relative to the pro... | function removeDir(string calldata path, bool recursive) external;
| function removeDir(string calldata path, bool recursive) external;
| 12,865 |
79 | // Get the maximum amount that users can withdrawuserAddr The address of user return the maximum amount that users can withdraw/ | function getUserMaxWithdrawAmount(address payable userAddr) external view override returns (uint256)
| function getUserMaxWithdrawAmount(address payable userAddr) external view override returns (uint256)
| 20,651 |
84 | // See the constructor of the Goald contract for details on the parameters. There is no concern for reentrancy since this is theonly function, and multiple calls will probably hit the block gas limit very quickly. / | function deploy(
address collateralToken,
address paymentToken,
uint96 fee,
uint8 feeIntervalDays,
uint16 totalIntervals,
string memory name
| function deploy(
address collateralToken,
address paymentToken,
uint96 fee,
uint8 feeIntervalDays,
uint16 totalIntervals,
string memory name
| 58,432 |
195 | // if(currentYearCounter>calenderYearCounter){ | if(now>calenderYearEnd && currentYearCounter>=1){
| if(now>calenderYearEnd && currentYearCounter>=1){
| 25,596 |
11 | // dynamic -> static array data copy | for (uint index = 0; index < dataLength; index++) {
fellow[index] = issuerTypeMap[typeName].fellow[index + startPos];
}
| for (uint index = 0; index < dataLength; index++) {
fellow[index] = issuerTypeMap[typeName].fellow[index + startPos];
}
| 32,927 |
2 | // User Item userAddress => nftId => UserItem | mapping(address => mapping(uint256 => UserItem)) public userItems_;
address public currencyPayment;
| mapping(address => mapping(uint256 => UserItem)) public userItems_;
address public currencyPayment;
| 23,598 |
40 | // Maximum tokens to be allocated. | uint256 public constant TOKENS_HARD_CAP = 2 * 50000 * 5000 * 10**decimals;
| uint256 public constant TOKENS_HARD_CAP = 2 * 50000 * 5000 * 10**decimals;
| 12,920 |
49 | // Mint the specified amount to the address, given we are not minting more than the fixed max supply to The address where the new stix are being minted to rawAmount The amount of new stix being minted / | function mint(address to, uint256 rawAmount) external {
require(isMinter[msg.sender], "Stix::Mint: Only whitelisted minter addresses can mint");
require(totalSupply < maxSupply, "Stix::Mint: cannot mint more than max supply");
require(to != address(0), "Stix::Mint: cannot mint to 0 address")... | function mint(address to, uint256 rawAmount) external {
require(isMinter[msg.sender], "Stix::Mint: Only whitelisted minter addresses can mint");
require(totalSupply < maxSupply, "Stix::Mint: cannot mint more than max supply");
require(to != address(0), "Stix::Mint: cannot mint to 0 address")... | 3,013 |
39 | // Get wallet role by the indexwallet Wallet addressindex Index of the role/ | function getWalletRoleFromTheList(address wallet, uint8 index) public view returns (bytes32) {
return listOfTheWalletRoles[wallet][index];
}
| function getWalletRoleFromTheList(address wallet, uint8 index) public view returns (bytes32) {
return listOfTheWalletRoles[wallet][index];
}
| 18,215 |
125 | // Return an array of canceled hashes | function allCanceledHashes(uint256 page, uint256 limit) public view returns (bytes32[] memory) {
return _allCanceledHashes.paginate(page, limit);
}
| function allCanceledHashes(uint256 page, uint256 limit) public view returns (bytes32[] memory) {
return _allCanceledHashes.paginate(page, limit);
}
| 45,099 |
150 | // ??1000(1018) | bondDepletionFloor = uint256(1000).mul(cashPriceOne);
| bondDepletionFloor = uint256(1000).mul(cashPriceOne);
| 15,489 |
59 | // Revokes `role` from `account`. | * If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl:... | * If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl:... | 2,524 |
67 | // Function to get active Staking tokens by id id stake id for the stake / | function getStakingTokenById(uint256 id)public view returns(uint256){
require(id <= _stakingCount,"Unable to reterive data on specified id, Please try again!!");
return _usersTokens[id];
}
| function getStakingTokenById(uint256 id)public view returns(uint256){
require(id <= _stakingCount,"Unable to reterive data on specified id, Please try again!!");
return _usersTokens[id];
}
| 18,326 |
280 | // Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`/params tokenId The ID of the token for which liquidity is being increased,/ amount0Desired The desired amount of token0 to be spent,/ amount1Desired The desired amount of token1 to be spent,/ amount0Min The minimum amount of token0... | function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
| function increaseLiquidity(IncreaseLiquidityParams calldata params)
external
payable
returns (
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
| 3,883 |
7 | // Produce a block/_index the index of the instance of pos you want to interact with/this function can only be called by a worker, user never calls it directly | function produceBlock(uint256 _index) public returns (bool) {
PoSCtx storage pos = instance[_index];
require(
pos.workerAuth.isAuthorized(msg.sender, address(this)),
"msg.sender is not authorized to make this call"
);
address user = pos.workerAuth.getOwner(m... | function produceBlock(uint256 _index) public returns (bool) {
PoSCtx storage pos = instance[_index];
require(
pos.workerAuth.isAuthorized(msg.sender, address(this)),
"msg.sender is not authorized to make this call"
);
address user = pos.workerAuth.getOwner(m... | 36,057 |
6 | // Override for post mint actions / | function _postMintExtension(address, uint256) internal virtual {}
| function _postMintExtension(address, uint256) internal virtual {}
| 32,880 |
11 | // Sets a new minterest deadDrop RESTRICTION: Admin only / | function setDeadDrop(IDeadDrop newDeadDrop_) external;
| function setDeadDrop(IDeadDrop newDeadDrop_) external;
| 37,352 |
0 | // Sets the values for `name`, `symbol`, and `decimals`. All three ofthese values are immutable: they can only be set once duringconstruction. _initialTotalSupply Total supply of STUD Token. _owner Owner of the STUD Token. / | constructor (uint256 _initialTotalSupply, address payable _owner) public {
_name = "Studyum Token";
_symbol = "STUD";
_decimals = 18;
_totalSupply = _initialTotalSupply;
_balances[_owner] = _totalSupply;
transferOwnership(_owner);
emit Transfer(address(0), _ow... | constructor (uint256 _initialTotalSupply, address payable _owner) public {
_name = "Studyum Token";
_symbol = "STUD";
_decimals = 18;
_totalSupply = _initialTotalSupply;
_balances[_owner] = _totalSupply;
transferOwnership(_owner);
emit Transfer(address(0), _ow... | 51,502 |
14 | // each tile has a different inventory of copper, decrement it | _decrementTokenBalance(_x,_y,_tile,copperContractAddress,fishPrice*_amount);
StandardToken copperContract = StandardToken(copperContractAddress);
require( copperContract.transfer(msg.sender,fishPrice*_amount) );
_updateExperience(msg.sender);
return true;
| _decrementTokenBalance(_x,_y,_tile,copperContractAddress,fishPrice*_amount);
StandardToken copperContract = StandardToken(copperContractAddress);
require( copperContract.transfer(msg.sender,fishPrice*_amount) );
_updateExperience(msg.sender);
return true;
| 22,840 |
48 | // Emitted when the pause is lifted. / | event Unpaused();
| event Unpaused();
| 3,270 |
101 | // Internal function that transfer tokens from one address to another./ Update magnifiedDividendCorrections to keep dividends unchanged./from The address to transfer from./to The address to transfer to./value The amount to be transferred. | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrection... | function _transfer(address from, address to, uint256 value) internal virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrection... | 5,211 |
76 | // Store the new encoded IPFS URI. | store.recordSetEncodedIPFSUriOf(_encodedIPFSUriTierId, _encodedIPFSUri);
emit SetEncodedIPFSUri(_encodedIPFSUriTierId, _encodedIPFSUri, msg.sender);
| store.recordSetEncodedIPFSUriOf(_encodedIPFSUriTierId, _encodedIPFSUri);
emit SetEncodedIPFSUri(_encodedIPFSUriTierId, _encodedIPFSUri, msg.sender);
| 18,900 |
62 | // Issue tokens to beneficiary | require(token.transfer(_beneficiary, amount), "VestingContract::_drawDown: Unable to transfer tokens");
emit DrawDown(_beneficiary, amount);
return true;
| require(token.transfer(_beneficiary, amount), "VestingContract::_drawDown: Unable to transfer tokens");
emit DrawDown(_beneficiary, amount);
return true;
| 25,258 |
40 | // check if cliff is passed | require(vestingSchedule.cliff <= totalSteps);
uint256 tokensPerStep = vestingSchedule.amount / vestingSchedule.duration;
| require(vestingSchedule.cliff <= totalSteps);
uint256 tokensPerStep = vestingSchedule.amount / vestingSchedule.duration;
| 39,818 |
89 | // Make the swap | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH
path,
address(this), // The contract
block.timestamp
);
emit SwapTokensForETH(tokenAmount, path);
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH
path,
address(this), // The contract
block.timestamp
);
emit SwapTokensForETH(tokenAmount, path);
| 22,917 |
77 | // Returns a set of mint stats for the address.This assists SeaDrop in enforcing maxSupply,maxTotalMintableByWallet, and maxTokenSupplyForStage checks. NOTE: Implementing contracts should always update these numbersbefore transferring any tokens with _safeMint() to mitigateconsequences of malicious onERC721Received() h... | function getMintStats(address minter)
external
view
override
returns (
uint256 minterNumMinted,
uint256 currentTotalSupply,
uint256 maxSupply
)
| function getMintStats(address minter)
external
view
override
returns (
uint256 minterNumMinted,
uint256 currentTotalSupply,
uint256 maxSupply
)
| 14,608 |
7 | // Penalties if staked tokens are rageQuit early. Example: If 100 tokens are staked for twelve months but rageQuit right away,/ the user will get back 100/4 tokens. | uint32 public threeMonthPenalty = 2;
uint32 public sixMonthPenalty = 3;
uint32 public twelveMonthPenalty = 4;
event Staked(address indexed user, uint256 amount, Duration duration);
event DurationChanged(address indexed user, uint256 amount, Duration oldDuration, Duration newDuration);
event UnStaked(addres... | uint32 public threeMonthPenalty = 2;
uint32 public sixMonthPenalty = 3;
uint32 public twelveMonthPenalty = 4;
event Staked(address indexed user, uint256 amount, Duration duration);
event DurationChanged(address indexed user, uint256 amount, Duration oldDuration, Duration newDuration);
event UnStaked(addres... | 30,951 |
8 | // keccak256("MultiSigTransaction(address destination,uint256 value,bytes data,uint256 nonce,address txOrigin)") | bytes32 constant TXTYPE_HASH = 0x81336c6b66e18c614f29c0c96edcbcbc5f8e9221f35377412f0ea5d6f428918e;
| bytes32 constant TXTYPE_HASH = 0x81336c6b66e18c614f29c0c96edcbcbc5f8e9221f35377412f0ea5d6f428918e;
| 40,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.