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 |
|---|---|---|---|---|
450 | // ========== Minter Only ========== / | function mint(address account, uint256 amount) external onlyMinter {
_mint(account, amount);
}
| function mint(address account, uint256 amount) external onlyMinter {
_mint(account, amount);
}
| 42,772 |
55 | // Definition of Wallets for Marketing or team. | address payable public marketingWallet =
payable(0x21d3be3fb3F25d4E0B867958D8A91dA84879c417);
address payable public ecosystemWallet =
payable(0x0cb72c337a1171C8ef074858FfCE10b81A6Ce01C);
| address payable public marketingWallet =
payable(0x21d3be3fb3F25d4E0B867958D8A91dA84879c417);
address payable public ecosystemWallet =
payable(0x0cb72c337a1171C8ef074858FfCE10b81A6Ce01C);
| 7,339 |
55 | // transfer erc20 token to this contract | IERC20(_erc20Contract).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(_erc20Contract).safeIncreaseAllowance(_yErc20Contract, _amount);
| IERC20(_erc20Contract).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(_erc20Contract).safeIncreaseAllowance(_yErc20Contract, _amount);
| 49,677 |
162 | // market fee to cut | uint256 saleShareAmount = 0;
| uint256 saleShareAmount = 0;
| 17,207 |
39 | // blockNumber => blockHash all block commitment hash headers Mapping actually better than array IMO, use tip as len | mapping(uint256 => bytes32) public blockCommitments; // STORAGE 3
| mapping(uint256 => bytes32) public blockCommitments; // STORAGE 3
| 21,387 |
492 | // Update the base token URI / | function setBaseURI(string calldata _newBaseURI) external onlyOwner {
require(!metadataFrozen, "METADATA_HAS_BEEN_FROZEN");
baseTokenURI = _newBaseURI;
}
| function setBaseURI(string calldata _newBaseURI) external onlyOwner {
require(!metadataFrozen, "METADATA_HAS_BEEN_FROZEN");
baseTokenURI = _newBaseURI;
}
| 1,181 |
96 | // The minimum amount of shares to be minted in the contructor. / | uint256 internal constant MINIMUM_CONSTRUCTOR_MINT = 1e4;
| uint256 internal constant MINIMUM_CONSTRUCTOR_MINT = 1e4;
| 42,259 |
234 | // Decode a CBOR value into a Witnet.Result instance./_cborValue An instance of `Witnet.Value`./ return A `Witnet.Result` instance. | function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| 22,450 |
89 | // Set the output so it can be exited later. | inFlightExit.outputs[_outputIndex - MAX_INPUTS] = output;
| inFlightExit.outputs[_outputIndex - MAX_INPUTS] = output;
| 26,732 |
75 | // do not allow to drain lpToken if less than 3 months after farming | require(_token != bsd, "!bsd");
for (uint256 pid = 0; pid < poolLength; ++pid) {
PoolInfo storage pool = poolInfo[pid];
require(_token != pool.lpToken, "!pool.lpToken");
}
| require(_token != bsd, "!bsd");
for (uint256 pid = 0; pid < poolLength; ++pid) {
PoolInfo storage pool = poolInfo[pid];
require(_token != pool.lpToken, "!pool.lpToken");
}
| 33,306 |
0 | // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, it is recommended to avoid using short time durations (less than a minute). Typical vesting schem... | using SafeMath for uint256;
using SafeERC20 for IERC20;
event Registered(address account, uint256 amount);
event Revoked(address account);
event Claimed(address account, uint256 amount);
address public vestingToken;
uint256 public totalReleased;
uint256 public totalAllocated;
| using SafeMath for uint256;
using SafeERC20 for IERC20;
event Registered(address account, uint256 amount);
event Revoked(address account);
event Claimed(address account, uint256 amount);
address public vestingToken;
uint256 public totalReleased;
uint256 public totalAllocated;
| 13,803 |
189 | // charge exit fee | uint256 exitFee=_chargeJoinAndExitFee(SmartPoolStorage.FeeType.EXIT_FEE,amount);
uint256 exitAmount=amount.sub(exitFee);
| uint256 exitFee=_chargeJoinAndExitFee(SmartPoolStorage.FeeType.EXIT_FEE,amount);
uint256 exitAmount=amount.sub(exitFee);
| 11,009 |
79 | // return The EIP-1967 proxy admin / | function getAdmin()
public
view
returns (address)
| function getAdmin()
public
view
returns (address)
| 42,971 |
8 | // pay to first investors in line | pay();
| pay();
| 766 |
1 | // Combines account details with their twab history. details The account details. twabs The history of twabs for this account. / | struct Account {
AccountDetails details;
ObservationLib.Observation[65535] twabs;
}
| struct Account {
AccountDetails details;
ObservationLib.Observation[65535] twabs;
}
| 24,622 |
6 | // The total number of proposals | uint public proposalCount;
| uint public proposalCount;
| 48,930 |
6 | // You can create temporary structs in memory with keyword "memory" | struct Person {
bytes32 name;
uint8 age;
}
| struct Person {
bytes32 name;
uint8 age;
}
| 48,884 |
33 | // sequentially call contacts, abort on failed calls | invokeContracts(script);
| invokeContracts(script);
| 36,901 |
529 | // Ensure the Safe is registered with the Master. | require(master.getSafeId(safe) != 0);
emit ImpoundExecuted(msg.sender, safe, feiAmount, assetAmount);
| require(master.getSafeId(safe) != 0);
emit ImpoundExecuted(msg.sender, safe, feiAmount, assetAmount);
| 61,710 |
5 | // Approve transfer _spender holder address _value tokens amountreturn result / | function approve(address _spender, uint256 _value) public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 9,083 |
90 | // Protected storage | function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address);
function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address);
function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external;
function co... | function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address);
function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address);
function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external;
function co... | 47,214 |
194 | // Token with Governance. | contract NFTGAMETOKEN is BEP20 {
// Transfer tax rate in basis points. (default 5%)
uint16 public transferTaxRate = 500;
// Burn rate % of transfer tax. (default 20% x 5% = 1% of total amount).
uint16 public burnRate = 20;
// Max transfer tax rate: 10%.
uint16 public constant MAXIMUM_TRANSFER_TA... | contract NFTGAMETOKEN is BEP20 {
// Transfer tax rate in basis points. (default 5%)
uint16 public transferTaxRate = 500;
// Burn rate % of transfer tax. (default 20% x 5% = 1% of total amount).
uint16 public burnRate = 20;
// Max transfer tax rate: 10%.
uint16 public constant MAXIMUM_TRANSFER_TA... | 17,755 |
682 | // Swaps all collected ERC20 tokens (of the specified type) into burn tokens using an external DEX and burns themcollectedToken token contract address of the collected ERC20 tokens that should be burned (must be an IERC20 contract) emits event BoughtBackAndBurned() / | function buyBackAndBurnERC20(address collectedToken) external whenNotPaused nonReentrant {
// check input parameter
require(collectedToken != address(0), 'BuyBackAndBurnV1: invalid token address');
// check how much of the given token is ready for burn
uint256 amount = collectedERC20ToBurn[collectedT... | function buyBackAndBurnERC20(address collectedToken) external whenNotPaused nonReentrant {
// check input parameter
require(collectedToken != address(0), 'BuyBackAndBurnV1: invalid token address');
// check how much of the given token is ready for burn
uint256 amount = collectedERC20ToBurn[collectedT... | 20,292 |
62 | // StakeStart/ | event StakeStart(
| event StakeStart(
| 75,922 |
121 | // validates reserve ratio | modifier validReserveRatio(uint32 _ratio) {
require(_ratio > 0 && _ratio <= RATIO_RESOLUTION);
_;
}
| modifier validReserveRatio(uint32 _ratio) {
require(_ratio > 0 && _ratio <= RATIO_RESOLUTION);
_;
}
| 6,985 |
34 | // Refunds tokens for all voters / | function refundTokens(address to) public onlyOwner returns (bool) {
if(to != address(0)) {
return _refundTokens(to);
}
for(uint256 i = 0; i < voters.length; i++) {
_refundTokens(voters[i]);
}
return true;
}
| function refundTokens(address to) public onlyOwner returns (bool) {
if(to != address(0)) {
return _refundTokens(to);
}
for(uint256 i = 0; i < voters.length; i++) {
_refundTokens(voters[i]);
}
return true;
}
| 53,901 |
218 | // Modify vendor's name _vendorId The vendor id _name Then vendor name / | function updateVendorName(uint256 _vendorId, string _name)
public
| function updateVendorName(uint256 _vendorId, string _name)
public
| 48,068 |
406 | // TODO: grab LP Token decimals explicitly? | uint256 normalizedUnderlyerAmount =
lpTokenAmount.mul(virtualPrice).div(1e18);
uint256 underlyerAmount =
normalizedUnderlyerAmount.mul(10**uint256(decimals)).div(
10**uint256(18)
);
| uint256 normalizedUnderlyerAmount =
lpTokenAmount.mul(virtualPrice).div(1e18);
uint256 underlyerAmount =
normalizedUnderlyerAmount.mul(10**uint256(decimals)).div(
10**uint256(18)
);
| 8,600 |
14 | // pair.pairBase => tokenIn[] | mapping(address => address[]) pairMarginTokens;
| mapping(address => address[]) pairMarginTokens;
| 2,364 |
221 | // See {IERC721-getApproved}. / | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| 16,312 |
95 | // Given a tick and a token amount, calculates the amount of token received in exchange/tick Tick value used to calculate the quote/baseAmount Amount of token to be converted/baseToken Address of an ERC20 token contract used as the baseAmount denomination/quoteToken Address of an ERC20 token contract used as the quoteA... | function getQuoteAtTick(
int24 tick,
uint128 baseAmount,
address baseToken,
address quoteToken
| function getQuoteAtTick(
int24 tick,
uint128 baseAmount,
address baseToken,
address quoteToken
| 25,721 |
4 | // else the caller must have approved the token for the fill | ERC20(currency).safeTransferFrom(msg.sender, recipient, amount);
| ERC20(currency).safeTransferFrom(msg.sender, recipient, amount);
| 11,123 |
111 | // The currently in range liquidity available to the pool/This value has no relationship to the total liquidity across all ticks | function liquidity() external view returns (uint128);
| function liquidity() external view returns (uint128);
| 16,175 |
37 | // END FUNCTIONS RELATED TO EXTERNAL CONTRACT INTERACTIONS / | function implementsERC721() public pure returns (bool) {
return true;
}
| function implementsERC721() public pure returns (bool) {
return true;
}
| 27,833 |
34 | // To exclude division by zero There is a check for a non zero eend.allWhiteCollateral above Cell 26 | eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
| eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
| 9,321 |
54 | // ========== RESTRICTED FUNCTIONS ========== / | function addOwner(address _newOwner) external isAnOwner {
addOwnerShip(_newOwner);
}
| function addOwner(address _newOwner) external isAnOwner {
addOwnerShip(_newOwner);
}
| 22,038 |
11 | // Returns the current dynasty in the block store. return dynasty_ The current dynasty. / | function getCurrentDynasty() external view returns (uint256 dynasty_) {
dynasty_ = currentDynasty;
}
| function getCurrentDynasty() external view returns (uint256 dynasty_) {
dynasty_ = currentDynasty;
}
| 31,889 |
111 | // Internal func to get estimated Uniswap output from WETH to token trade / | ) internal view returns (uint256) {
uint256[] memory amountsOut = IUniswapV2Router02(_uniswap).getAmountsOut(_amountIn, _path);
return amountsOut[amountsOut.length - 1];
}
| ) internal view returns (uint256) {
uint256[] memory amountsOut = IUniswapV2Router02(_uniswap).getAmountsOut(_amountIn, _path);
return amountsOut[amountsOut.length - 1];
}
| 36,528 |
2 | // SwapFlashLoan | function MAX_BPS() external view returns (uint256);
function addLiquidity(uint256[] memory amounts, uint256 minToMint, uint256 deadline) external returns (uint256);
function calculateRemoveLiquidity(uint256 amount) external view returns (uint256[] memory);
function calculateRemoveLiquidityOneToken(uint2... | function MAX_BPS() external view returns (uint256);
function addLiquidity(uint256[] memory amounts, uint256 minToMint, uint256 deadline) external returns (uint256);
function calculateRemoveLiquidity(uint256 amount) external view returns (uint256[] memory);
function calculateRemoveLiquidityOneToken(uint2... | 26,914 |
16 | // Internal Functions for ERC20 standard logics / |
function _transfer(address from, address to, uint256 amount)
internal
returns (bool success)
|
function _transfer(address from, address to, uint256 amount)
internal
returns (bool success)
| 23,151 |
5 | // Check if a key exists in the registry _k The key to check / | function exists(uint16 _k) public view returns (bool) {
if (_k == 0) return false;
uint8 hIndex = uint8(_k >> 8);
uint8 lIndex = uint8(_k & 255);
uint8 hByte = hBytes[hIndex];
if (hByte == 0) {
return false;
}
if (lBytes.length <= hByte... | function exists(uint16 _k) public view returns (bool) {
if (_k == 0) return false;
uint8 hIndex = uint8(_k >> 8);
uint8 lIndex = uint8(_k & 255);
uint8 hByte = hBytes[hIndex];
if (hByte == 0) {
return false;
}
if (lBytes.length <= hByte... | 5,991 |
397 | // Gets the average rate of a CA currency./curr Currency Name./ return rate Average rate X 100(of last 3 days). | function _getAvgRate(bytes4 curr, bool isIA) internal view returns(uint rate) {
if (curr == "DAI") {
DSValue ds = DSValue(daiFeedAddress);
rate = uint(ds.read()).div(uint(10) ** 16);
} else if (isIA) {
| function _getAvgRate(bytes4 curr, bool isIA) internal view returns(uint rate) {
if (curr == "DAI") {
DSValue ds = DSValue(daiFeedAddress);
rate = uint(ds.read()).div(uint(10) ** 16);
} else if (isIA) {
| 33,450 |
60 | // CREDIT ACCOUNT |
string public constant CA_CONNECTED_CREDIT_MANAGER_ONLY = "CA1";
string public constant CA_FACTORY_ONLY = "CA2";
|
string public constant CA_CONNECTED_CREDIT_MANAGER_ONLY = "CA1";
string public constant CA_FACTORY_ONLY = "CA2";
| 30,382 |
65 | // use to save miner info | struct Miner{
uint256 time;
uint256 etherAmount;
bool isExist;
}
| struct Miner{
uint256 time;
uint256 etherAmount;
bool isExist;
}
| 48,304 |
123 | // Total debt issued for this specific collateral type | uint256 debtAmount; // [wad]
| uint256 debtAmount; // [wad]
| 40,580 |
89 | // How many active milestones have been created | uint256 public milestoneCount = 0;
bool public milestoningFinished = false;
constructor(
uint256 _openingTime,
uint256 _closingTime
)
TimedCrowdsale(_openingTime, _closingTime)
| uint256 public milestoneCount = 0;
bool public milestoningFinished = false;
constructor(
uint256 _openingTime,
uint256 _closingTime
)
TimedCrowdsale(_openingTime, _closingTime)
| 11,209 |
15 | // Read and write to persistent storage at a fraction of the cost./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/utils/SSTORE2.sol)/Modified from 0xSequence (https:github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol) | library SSTORE2 {
uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called.
/*///////////////////////////////////////////////////////////////
WRITE LOGIC
/////////////////////////////////////////////////... | library SSTORE2 {
uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called.
/*///////////////////////////////////////////////////////////////
WRITE LOGIC
/////////////////////////////////////////////////... | 8,637 |
35 | // Add to payee balance _payee The address of the payee to add. _shares The number of shares to add to the payee. / | function addToPayeeBalance(address token, address _payee, uint256 _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[token][_payee] > 0);
shares[token][_payee] += _shares;
totalShares[token] += _shares;
}
| function addToPayeeBalance(address token, address _payee, uint256 _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[token][_payee] > 0);
shares[token][_payee] += _shares;
totalShares[token] += _shares;
}
| 44,656 |
53 | // Set the current sell price in wei for one metadollar/priceInWei - is the amount in wei for one metadollar | function setSellPrice(uint256 priceInWei) isOwner {
require(priceInWei >= 0);
sellPrice = priceInWei;
}
| function setSellPrice(uint256 priceInWei) isOwner {
require(priceInWei >= 0);
sellPrice = priceInWei;
}
| 35,034 |
42 | // Select the second bit Solidity does not allow conversion of ints to bools, so we do it explicitly. | bool sendValue;
if ((flagByte & 0x40) > 0) { // 0x40 == 0b010000000;
sendValue = true;
}
| bool sendValue;
if ((flagByte & 0x40) > 0) { // 0x40 == 0b010000000;
sendValue = true;
}
| 15,493 |
29 | // external / | {
rewardDistribution = _rewardDistribution;
}
| {
rewardDistribution = _rewardDistribution;
}
| 25,535 |
0 | // Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex` times. | unchecked {
return ERC721SupplyStorage.layout().currentIndex - ERC721SupplyStorage.layout().burnCounter;
}
| unchecked {
return ERC721SupplyStorage.layout().currentIndex - ERC721SupplyStorage.layout().burnCounter;
}
| 10,845 |
11 | // The next free block on which a user can commence their unstake | uint256 public nextUnallocatedEpoch;
event JoinQueue(address exiter, uint256 amount);
event Withdrawal(address exiter, uint256 amount);
constructor(
address _TEMPLE,
uint256 _maxPerEpoch,
uint256 _maxPerAddress,
| uint256 public nextUnallocatedEpoch;
event JoinQueue(address exiter, uint256 amount);
event Withdrawal(address exiter, uint256 amount);
constructor(
address _TEMPLE,
uint256 _maxPerEpoch,
uint256 _maxPerAddress,
| 33,351 |
116 | // allows a keeper to activate/register themselves after bonding / | function activate() external {
require(bondings[msg.sender] != 0, "Keep3r::activate: bond first");
require(bondings[msg.sender] < now, "Keep3r::activate: still bonding");
if (!keepers[msg.sender]) {
firstSeen[msg.sender] = now;
}
keepers[msg.sender] = true;
... | function activate() external {
require(bondings[msg.sender] != 0, "Keep3r::activate: bond first");
require(bondings[msg.sender] < now, "Keep3r::activate: still bonding");
if (!keepers[msg.sender]) {
firstSeen[msg.sender] = now;
}
keepers[msg.sender] = true;
... | 57,132 |
23 | // address _addr = ECDSA.recover(hash, v, r, s); | address _addr = ecrecover(hash, v, r, s);
require(
ipfsSigners[_addr] == true,
string(
abi.encodePacked(
"Not an IPFS signer",
toAsciiString(_addr),
" ",
uriHash
| address _addr = ecrecover(hash, v, r, s);
require(
ipfsSigners[_addr] == true,
string(
abi.encodePacked(
"Not an IPFS signer",
toAsciiString(_addr),
" ",
uriHash
| 64,183 |
172 | // Minting Function | function batchSpawnAsset(address _to, uint256[] _assetTypes, uint256[] _assetIds, uint256 _isAttached) public anyOperator {
uint256 _id;
uint256 _assetType;
for(uint i = 0; i < _assetIds.length; i++) {
_id = _assetIds[i];
_assetType = _assetTypes[i];
_crea... | function batchSpawnAsset(address _to, uint256[] _assetTypes, uint256[] _assetIds, uint256 _isAttached) public anyOperator {
uint256 _id;
uint256 _assetType;
for(uint i = 0; i < _assetIds.length; i++) {
_id = _assetIds[i];
_assetType = _assetTypes[i];
_crea... | 52,107 |
11 | // 0x1e0 = offset to 2nd proof length of proofOutput is at s + 0x60 | mstore(0x220, 0xc0) // location of inputNotes
mstore(0x260, 0x00) // publicOwner is 0
mstore(0x280, 0x00) // publicValue is 0
mstore(0x2a0, calldataload(0x124))
| mstore(0x220, 0xc0) // location of inputNotes
mstore(0x260, 0x00) // publicOwner is 0
mstore(0x280, 0x00) // publicValue is 0
mstore(0x2a0, calldataload(0x124))
| 43,020 |
2 | // 配对合约set | EnumerableSet.AddressSet private _pairs;
| EnumerableSet.AddressSet private _pairs;
| 39,998 |
51 | // Insert before `prevId` as the head | self.nodes[_id].nextId = self.head;
self.nodes[self.head].prevId = _id;
self.head = _id;
| self.nodes[_id].nextId = self.head;
self.nodes[self.head].prevId = _id;
self.head = _id;
| 35,124 |
2 | // Tells the address of the implementation where every call will be delegated. return address of the implementation to which it will be delegated/ | function implementation() public view virtual returns (address);
| function implementation() public view virtual returns (address);
| 23,277 |
1 | // Destroys `amount` tokens from the caller, reducing the total supply. Claims RGT earned by `account` beforehand (so RariGovernanceTokenDistributor can continue distributing RGT considering the new RSPT balance of the caller). / | function burn(uint256 amount) external;
| function burn(uint256 amount) external;
| 8,988 |
4 | // getArtworkIDByTokenID use for getting artwork ID from token ID/_tokenId - the id of edition | function getArtworkIDByTokenID(
uint256 _tokenId
| function getArtworkIDByTokenID(
uint256 _tokenId
| 20,850 |
42 | // sha3("setFreezing(address,uint256,uint256,uint8)").slice(0,10) | bytes4 constant setFreezingSig = bytes4(0x51c3b8a6);
| bytes4 constant setFreezingSig = bytes4(0x51c3b8a6);
| 8,181 |
62 | // Reduce burn amount further by the mm burn rate, as insurance for cases when not liquidated in time | marginToBurn = marginRemaining.mulDown(
params.get(Risk.Parameters.MaintenanceMarginBurnRate)
);
marginRemaining -= marginToBurn;
| marginToBurn = marginRemaining.mulDown(
params.get(Risk.Parameters.MaintenanceMarginBurnRate)
);
marginRemaining -= marginToBurn;
| 26,319 |
73 | // ``` | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceI... | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceI... | 68 |
32 | // Internal functions //Adds a new transaction to the transaction mapping, if transaction does not exist yet./destination Transaction target address./value Transaction ether value./data Transaction data payload./ return Returns transaction ID. | function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
| function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
| 14,641 |
3 | // Modulo is a number of equiprobable outcomes in a game:- 2 for coin flip- 6 for dice- 66 = 36 for double dice- 100 for etheroll- 37 for rouletteetc. It's called so because 256-bit entropy is treated like a huge integer and the remainder of its division by modulo is considered bet outcome. | uint constant MAX_MODULO = 100;
| uint constant MAX_MODULO = 100;
| 37,595 |
50 | // Returns the confirmation status of a transaction./transactionId Transaction ID./ return Confirmation status. | function isConfirmed(uint transactionId)
public
constant
returns (bool)
| function isConfirmed(uint transactionId)
public
constant
returns (bool)
| 48,892 |
116 | // check if we're buy side or sell side in a swap; if buy side apply buy side taxes; if sell side then apply those taxes; duh | bool buySide = false;
if (sender == address(uniswapV2Pair)) {
buySide = true;
}
| bool buySide = false;
if (sender == address(uniswapV2Pair)) {
buySide = true;
}
| 34,074 |
81 | // Reward token to current reward rate mapping | mapping(address => uint256) public rewardRates;
| mapping(address => uint256) public rewardRates;
| 28,863 |
3 | // Verifies the signature for a given ForwardRequest./req The ForwardRequest structure./signature The signature provided by the signer./ return A boolean indicating whether the signature is valid. | function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {
address signer = _hashTypedDataV4(
keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))
).recover(signature);
return _nonces[req.f... | function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {
address signer = _hashTypedDataV4(
keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))
).recover(signature);
return _nonces[req.f... | 20,855 |
891 | // Decrease the sponsors position tokens size. Ensure it is above the min sponsor size. | FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(numTokens);
require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position");
positionData.tokensOutstanding = newTokenCount;
| FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(numTokens);
require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position");
positionData.tokensOutstanding = newTokenCount;
| 17,629 |
498 | // Set of predictions | function startPredictions(uint256[][] memory info, string[][] memory name) public onlyOwner {
//Info list of [Id, time, bonus time], name list of [event name, option names(3)]
require(info.length == name.length, "Not same length");
for (uint i = 0; i < info.length; i++){
startPr... | function startPredictions(uint256[][] memory info, string[][] memory name) public onlyOwner {
//Info list of [Id, time, bonus time], name list of [event name, option names(3)]
require(info.length == name.length, "Not same length");
for (uint i = 0; i < info.length; i++){
startPr... | 23,944 |
59 | // TODO Delete the hash(es) being invalidated? | nInvalidatedHashes += 1;
| nInvalidatedHashes += 1;
| 4,492 |
52 | // An address authorized to call the creditCardMint function. | address creditCardMintAddress;
| address creditCardMintAddress;
| 21,238 |
72 | // Use this when reporting a known error from the price oracle or a non-upgradeable collaborator Using Oracle in name because we already inherit a `fail` function from ErrorReporter.sol via Exponential.sol / | function failOracle(
address asset,
| function failOracle(
address asset,
| 10,418 |
17 | // Allows GeoJam Dev Team to change the Project ID this contract is linked with. _projectId New Project ID to link with. Meant to be used in case an error is made when initializing contract. / | function updateProjectId(uint256 _projectId) external onlyOwner {
projectId = _projectId;
}
| function updateProjectId(uint256 _projectId) external onlyOwner {
projectId = _projectId;
}
| 13,709 |
0 | // PROOF UTILITY TOKEN (PRF)TOKEN INFOPRF TOKEN MARKETINGPRF TOKEN MECHANICS / | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 46,164 |
601 | // Skips on-going collateral auction. See 2./Has to be performed before global debt is fixed/vault Address of the Vault/auctionId Id of the collateral auction the skip | function skipAuction(address vault, uint256 auctionId) external override {
if (debt != 0) revert Tenebrae__skipAuction_debtNotZero();
(address _collateralAuction, , , ) = limes.vaults(vault);
ICollateralAuction collateralAuction = ICollateralAuction(_collateralAuction);
(, uint256 ra... | function skipAuction(address vault, uint256 auctionId) external override {
if (debt != 0) revert Tenebrae__skipAuction_debtNotZero();
(address _collateralAuction, , , ) = limes.vaults(vault);
ICollateralAuction collateralAuction = ICollateralAuction(_collateralAuction);
(, uint256 ra... | 62,337 |
121 | // Modify the allowance. | _approve(owner, spender, newAllowance);
success = true;
| _approve(owner, spender, newAllowance);
success = true;
| 67,209 |
45 | // See {IPool-activate}. / | function activate(address account, uint256 validatorIndex) external override {
uint256 activatedAmount = _activateAmount(
account,
validatorIndex,
activatedValidators.mul(pendingValidatorsLimit.add(1e4))
);
stakedEthToken.mint(account, activatedAmount);
... | function activate(address account, uint256 validatorIndex) external override {
uint256 activatedAmount = _activateAmount(
account,
validatorIndex,
activatedValidators.mul(pendingValidatorsLimit.add(1e4))
);
stakedEthToken.mint(account, activatedAmount);
... | 67,421 |
37 | // ERC2771Context overrides | function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address sender) {
return ERC2771Context._msgSender();
}
| function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address sender) {
return ERC2771Context._msgSender();
}
| 5,141 |
56 | // Claim all bought HQX for all approved addresses / | function claimAll() onlyOwner whenNotPaused {
for (uint32 i = 0; i < receiversCount; i++) {
address receiver = tokenReceivers[i];
if (approved[receiver] && tokens[receiver] > 0) {
claimFor(receiver);
}
}
}
| function claimAll() onlyOwner whenNotPaused {
for (uint32 i = 0; i < receiversCount; i++) {
address receiver = tokenReceivers[i];
if (approved[receiver] && tokens[receiver] > 0) {
claimFor(receiver);
}
}
}
| 44,971 |
10 | // Sets the maxNonVotingPeriod Admin function to set maxNonVotingPeriod newPeriod_ The new maxNonVotingPeriod (in sec). Must be greater than 90 days and lower than 2 years. RESTRICTION: Admin only. / | function setMaxNonVotingPeriod(uint256 newPeriod_) external;
| function setMaxNonVotingPeriod(uint256 newPeriod_) external;
| 40,900 |
214 | // See {IGovernor-castVoteBySig}. / | function castVoteBySig(
uint256 proposalId,
uint8 support,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override returns (uint256) {
address voter = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support))),
... | function castVoteBySig(
uint256 proposalId,
uint8 support,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override returns (uint256) {
address voter = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support))),
... | 1,665 |
112 | // Decrease the amount of tokens that an owner has allowed to a spender.spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by. / | function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
| function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
| 1,614 |
107 | // Executes deposit operation with delegatecall. _amount: amount to be deposited _provider: address of provider to be used / | function _deposit(uint256 _amount, address _provider) internal {
bytes memory data =
abi.encodeWithSignature("deposit(address,uint256)", vAssets.collateralAsset, _amount);
_execute(_provider, data);
}
| function _deposit(uint256 _amount, address _provider) internal {
bytes memory data =
abi.encodeWithSignature("deposit(address,uint256)", vAssets.collateralAsset, _amount);
_execute(_provider, data);
}
| 39,548 |
5 | // ========== RESTRICTED FUNCTIONS - OWNER ========== / | function setKeeper(address newKeeper) external onlyOwner {
keeper = newKeeper;
}
| function setKeeper(address newKeeper) external onlyOwner {
keeper = newKeeper;
}
| 23,236 |
2 | // Mints liquidity from V3 Pool _tickLower Lower tick _tickUpper Upper tick _amount0 Amount of token0 _amount1 Amount of token1 _payer Address which is adding the liquidityreturn amount0 Amount of token0 deployed to the poolreturn amount1 Amount of token1 deployed to the pool / | function mintLiquidity(
int24 _tickLower,
int24 _tickUpper,
uint256 _amount0,
uint256 _amount1,
address _payer
| function mintLiquidity(
int24 _tickLower,
int24 _tickUpper,
uint256 _amount0,
uint256 _amount1,
address _payer
| 35,621 |
14 | // TimedCrowdsale Crowdsale accepting contributions only within a time frame. / | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 private _closingTime;
/**
* Event for crowdsale extending
* @param newClosingTime new closing time
* @param prevClosingTime old closing time
*/
event TimedCrowdsaleExtended(... | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 private _closingTime;
/**
* Event for crowdsale extending
* @param newClosingTime new closing time
* @param prevClosingTime old closing time
*/
event TimedCrowdsaleExtended(... | 3,797 |
97 | // Create group/ Can be called only by contract owner//_groupName group name/_priority group priority// return code | function createGroup(bytes32 _groupName, uint _priority) external onlyContractOwner returns (uint) {
require(_groupName != bytes32(0));
if (isGroupExists(_groupName)) {
return USER_MANAGER_GROUP_ALREADY_EXIST;
}
uint _groupsCount = groupsCount.add(1);
groupName2... | function createGroup(bytes32 _groupName, uint _priority) external onlyContractOwner returns (uint) {
require(_groupName != bytes32(0));
if (isGroupExists(_groupName)) {
return USER_MANAGER_GROUP_ALREADY_EXIST;
}
uint _groupsCount = groupsCount.add(1);
groupName2... | 2,714 |
2 | // Allows someone to deposit into the yield source without receiving any shares.The deposited token will be the same as token()/ This allows anyone to distribute tokens among the share holders. | function sponsor(uint256 amount) external;
| function sponsor(uint256 amount) external;
| 5,983 |
8 | // get user counter | function getIncrement() public view returns(uint) {
return counter[msg.sender];
}
| function getIncrement() public view returns(uint) {
return counter[msg.sender];
}
| 23,148 |
97 | // Execute the call | CallLib.execute(call, start_gas, msg.sender, getOverhead(), getExtraGas());
| CallLib.execute(call, start_gas, msg.sender, getOverhead(), getExtraGas());
| 16,917 |
32 | // Assigns a new address to act as the COO. Only available to the current COO or CEO./_newCOO The address of the new COO | function setCOO(address _newCOO) external {
require(
msg.sender == ceoAddress ||
msg.sender == cooAddress
);
require(_newCOO != address(0));
cooAddress = _newCOO;
}
| function setCOO(address _newCOO) external {
require(
msg.sender == ceoAddress ||
msg.sender == cooAddress
);
require(_newCOO != address(0));
cooAddress = _newCOO;
}
| 63,110 |
35 | // reset daily Lotto | balDailyLotto=0;
dailyLottoPlayers.length=0;
| balDailyLotto=0;
dailyLottoPlayers.length=0;
| 23,295 |
34 | // Version of signature should be 27 or 28, but 0 and 1 are also possible versions | if (v < 27) {
v += 27;
}
| if (v < 27) {
v += 27;
}
| 22,519 |
169 | // ensure account have escrow migration pending | require(totalEscrowedAccountBalance[addressToMigrate] > 0, "Address escrow balance is 0");
require(totalBalancePendingMigration[addressToMigrate] > 0, "No escrow migration pending");
| require(totalEscrowedAccountBalance[addressToMigrate] > 0, "Address escrow balance is 0");
require(totalBalancePendingMigration[addressToMigrate] > 0, "No escrow migration pending");
| 40,562 |
18 | // Set the converter for liquidation _converter The new converter / | function setConverter(address _converter) external onlyGovernor {
require(_converter != address(0), "empty converter");
converter = IConverter(_converter);
require(converter.source() == address(collateral), "mismatch source token");
require(converter.destination() == address(underlyi... | function setConverter(address _converter) external onlyGovernor {
require(_converter != address(0), "empty converter");
converter = IConverter(_converter);
require(converter.source() == address(collateral), "mismatch source token");
require(converter.destination() == address(underlyi... | 21,862 |
67 | // Define if fee calculation must be skipped for a given trade. By default (false) fee must not be skipped. | mapping(address => mapping(address => bool)) public mustSkipFee;
| mapping(address => mapping(address => bool)) public mustSkipFee;
| 22,665 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.