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 |
|---|---|---|---|---|
49 | // Gets the total amount of tokens stored by the contractreturn uint256 representing the total amount of tokens / | function totalSupply() public view returns (uint256) {
return _allTokens.length;
}
| function totalSupply() public view returns (uint256) {
return _allTokens.length;
}
| 17,927 |
10 | // Repay Flash loan | manager.repayAaveLoan(loanAddress);
| manager.repayAaveLoan(loanAddress);
| 6,991 |
162 | // Setter for the maths utils address _mathsUtils the address of the new math utils / | function setMathsUtils(address _mathsUtils) external;
| function setMathsUtils(address _mathsUtils) external;
| 23,700 |
83 | // Number of consecutive blocks where there must be no new interest before bonus ends. | uint constant public BONUS_LATCH = 2;
| uint constant public BONUS_LATCH = 2;
| 7,855 |
24 | // Liquidate a position. Liquidate a position. borrower Borrower's Address. tokenToPay The address of the token to pay for liquidation.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) cTokenPay Corresponding cToken address. tokenInReturn The address of the token to return for liquidation. cTokenColl Corresponding ... | function liquidateRaw(
address borrower,
address tokenToPay,
address cTokenPay,
address tokenInReturn,
address cTokenColl,
uint256 amt,
uint256 getId,
uint256 setId
| function liquidateRaw(
address borrower,
address tokenToPay,
address cTokenPay,
address tokenInReturn,
address cTokenColl,
uint256 amt,
uint256 getId,
uint256 setId
| 18,742 |
2 | // ================================================== constractor ================================================== | constructor() {
_grantRole(ADMIN, msg.sender);
}
| constructor() {
_grantRole(ADMIN, msg.sender);
}
| 663 |
22 | // of those NFTs is `${baseURIForTokens}/${tokenId}`._data Additional bytes data to be used at the discretion of the consumer of the contract. return batchIdA unique integer identifier for the batch of NFTs lazy minted together. / | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
if (!_canLazyMint()) {
revert AuthError();
}
| function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
if (!_canLazyMint()) {
revert AuthError();
}
| 2,908 |
2 | // Mapping fot pictures |
mapping(uint256 => Picture) public pictures;
|
mapping(uint256 => Picture) public pictures;
| 25,635 |
122 | // Function that puts the funds to work.It gets called whenever someone deposits in the strategy's vault contract.It deposits soak in the MasterChef to earn rewards in soak. / | function deposit() public whenNotPaused {
uint256 soakBal = IERC20(soak).balanceOf(address(this));
if (soakBal > 0) {
IMasterChef(masterchef).enterStaking(soakBal);
}
}
| function deposit() public whenNotPaused {
uint256 soakBal = IERC20(soak).balanceOf(address(this));
if (soakBal > 0) {
IMasterChef(masterchef).enterStaking(soakBal);
}
}
| 13,632 |
5 | // Returns the length of a null-terminated bytes32 string. self The value to find the length of.return The length of the string, from 0 to 32. / | function len(bytes32 self) internal returns (uint) {
uint ret;
if (self == 0)
return 0;
if (self & 0xffffffffffffffffffffffffffffffff == 0) {
ret += 16;
self = bytes32(uint(self) / 0x100000000000000000000000000000000);
}
if (self & 0xffffff... | function len(bytes32 self) internal returns (uint) {
uint ret;
if (self == 0)
return 0;
if (self & 0xffffffffffffffffffffffffffffffff == 0) {
ret += 16;
self = bytes32(uint(self) / 0x100000000000000000000000000000000);
}
if (self & 0xffffff... | 34,964 |
57 | // AutoLP tax, keep these variables same, DO NOT CHANGE | _autoLPFee = _autoLpTaxBPS / 2;
_liquidityFee = _autoLpTaxBPS / 2;
_totalTax = _taxFee + _developmentFee + _autoLPFee + _liquidityFee;
require(_totalTax <= 1500, "total tax cannot exceed 15%");
require((_developmentFee + _autoLPFee) >= 100, "ERR: development + autoLP fee shoul... | _autoLPFee = _autoLpTaxBPS / 2;
_liquidityFee = _autoLpTaxBPS / 2;
_totalTax = _taxFee + _developmentFee + _autoLPFee + _liquidityFee;
require(_totalTax <= 1500, "total tax cannot exceed 15%");
require((_developmentFee + _autoLPFee) >= 100, "ERR: development + autoLP fee shoul... | 22,136 |
23 | // Transfer premium payment to writer | Opts[ID].writer.transfer(Opts[ID].premium);
Opts[ID].buyer = msg.sender;
| Opts[ID].writer.transfer(Opts[ID].premium);
Opts[ID].buyer = msg.sender;
| 12,334 |
14 | // Event which is triggered to log all transfers to this contract's event log | event Transfer(
address indexed _from,
address indexed _to,
uint _value
);
| event Transfer(
address indexed _from,
address indexed _to,
uint _value
);
| 9,088 |
5 | // Lets a borrower request for a loan. Returned value is type uint256. _lendingToken The address of the token being requested. _poolId The Id of the pool. _principal The principal amount being requested. _duration The duration of the loan. _expirationDuration The time in which the loan has to be accepted before it expi... | function loanRequest(
address _lendingToken,
uint256 _poolId,
uint256 _principal,
uint32 _duration,
uint32 _expirationDuration,
uint16 _APR,
address _receiver
| function loanRequest(
address _lendingToken,
uint256 _poolId,
uint256 _principal,
uint32 _duration,
uint32 _expirationDuration,
uint16 _APR,
address _receiver
| 23,110 |
21 | // Function allow ADMIN set max tokens per one use / | function setMaxTokensInOneUsing(uint8 _maxTokenInOneUsing) external onlyRole(DEFAULT_ADMIN_ROLE) {
MAX_TOKENS_IN_USING = _maxTokenInOneUsing;
emit SetMaxTokensInOneUsing(_maxTokenInOneUsing);
}
| function setMaxTokensInOneUsing(uint8 _maxTokenInOneUsing) external onlyRole(DEFAULT_ADMIN_ROLE) {
MAX_TOKENS_IN_USING = _maxTokenInOneUsing;
emit SetMaxTokensInOneUsing(_maxTokenInOneUsing);
}
| 7,340 |
77 | // src/UniswapConsecutiveSlotsPriceFeedMedianizer.sol/ pragma solidity 0.6.7; // import "geb-treasury-reimbursement/math/GebMath.sol"; // import './uni/interfaces/IUniswapV2Factory.sol'; // import './uni/interfaces/IUniswapV2Pair.sol'; // import './uni/libs/UniswapV2Library.sol'; // import './uni/libs/UniswapV2OracleLi... | abstract contract ConverterFeedLike_1 {
function getResultWithValidity() virtual external view returns (uint256,bool);
function updateResult(address) virtual external;
}
abstract contract IncreasingRewardRelayerLike_1 {
function reimburseCaller(address) virtual external;
}
contract UniswapConsecutiveSlots... | abstract contract ConverterFeedLike_1 {
function getResultWithValidity() virtual external view returns (uint256,bool);
function updateResult(address) virtual external;
}
abstract contract IncreasingRewardRelayerLike_1 {
function reimburseCaller(address) virtual external;
}
contract UniswapConsecutiveSlots... | 73,545 |
85 | // Swap exact number of NOCLAIM tokens for DAI on Balancer | _approve(noclaimToken, address(data.bpool), mintAmount);
(uint256 daiReceived, ) = data.bpool.swapExactAmountIn(
address(noclaimToken),
mintAmount,
address(dai),
0,
type(uint256).max
);
require(daiReceived > 0, "received 0 DAI f... | _approve(noclaimToken, address(data.bpool), mintAmount);
(uint256 daiReceived, ) = data.bpool.swapExactAmountIn(
address(noclaimToken),
mintAmount,
address(dai),
0,
type(uint256).max
);
require(daiReceived > 0, "received 0 DAI f... | 42,733 |
2 | // Initializes governing token./dao_ address of cloned DAO./factory_ address of factory./supply_ total supply of tokens. | function initializeCustom(address dao_, address factory_, uint256 supply_) external;
| function initializeCustom(address dao_, address factory_, uint256 supply_) external;
| 27,356 |
73 | // set signing address after deployment | function setSigner(address _signer) public onlyOwner {
require(_signer != address(0));
signer = _signer;
}
| function setSigner(address _signer) public onlyOwner {
require(_signer != address(0));
signer = _signer;
}
| 14,412 |
47 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address.- `from` mu... | function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
| function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
| 33,581 |
13 | // return {UoA/target} The price of a target unit in UoA | function pricePerTarget() public view virtual returns (uint192) {
return FIX_ONE;
}
| function pricePerTarget() public view virtual returns (uint192) {
return FIX_ONE;
}
| 27,595 |
94 | // Mint tokens for crowdsale participants investorsAddress List of Purchasers addresses amountOfTokens List of token amounts for investor / | function mintTokensForCrowdsaleParticipants(address[] investorsAddress, uint256[] amountOfTokens)
external
onlyOwner
| function mintTokensForCrowdsaleParticipants(address[] investorsAddress, uint256[] amountOfTokens)
external
onlyOwner
| 33,322 |
24 | // set true | request.recipient.transfer(request.value);
request.complete = true;
| request.recipient.transfer(request.value);
request.complete = true;
| 27,216 |
22 | // Removes a key-value pair from a map. O(1). Returns true if the key was removed from the map, that is if it was present. / | function _remove(CardMap storage map, bytes32 key) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) {
// Equivalent to contains(map, key)
// To ... | function _remove(CardMap storage map, bytes32 key) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) {
// Equivalent to contains(map, key)
// To ... | 15,572 |
16 | // Constructor _nom The numerator to calculate the global `reserveRatioDailyExpansion` from _denom The denominator to calculate the global `reserveRatioDailyExpansion` from / | function initialize(
INameService _ns,
uint256 _nom,
uint256 _denom
| function initialize(
INameService _ns,
uint256 _nom,
uint256 _denom
| 47,745 |
137 | // Based on https:github.com/madler/zlib/blob/master/contrib/puff | library InflateLib {
// Maximum bits in a code
uint256 constant MAXBITS = 15;
// Maximum number of literal/length codes
uint256 constant MAXLCODES = 286;
// Maximum number of distance codes
uint256 constant MAXDCODES = 30;
// Maximum codes lengths to read
uint256 constant MAXCODES = (MAX... | library InflateLib {
// Maximum bits in a code
uint256 constant MAXBITS = 15;
// Maximum number of literal/length codes
uint256 constant MAXLCODES = 286;
// Maximum number of distance codes
uint256 constant MAXDCODES = 30;
// Maximum codes lengths to read
uint256 constant MAXCODES = (MAX... | 2,000 |
9 | // The owner of the Paymaster can change the instance of the RelayHub this Paymaster works with.:warning: Warning :warning: The deposit on the previous RelayHub must be withdrawn first. / | function setRelayHub(IRelayHub hub) public onlyOwner {
require(address(hub).supportsInterface(type(IRelayHub).interfaceId), "target is not a valid IRelayHub");
relayHub = hub;
}
| function setRelayHub(IRelayHub hub) public onlyOwner {
require(address(hub).supportsInterface(type(IRelayHub).interfaceId), "target is not a valid IRelayHub");
relayHub = hub;
}
| 23,677 |
5 | // // USER FUNCTIONS /// | function publicSaleRemainingCount() public view returns (uint256) {
uint256 totalWhiteListRemainingCount = firstWhiteListSaleRemainingCount +
secondWhiteListSaleRemainingCount;
return
publicSalePurchasedCount <= totalWhiteListRemainingCount
? totalWhiteLis... | function publicSaleRemainingCount() public view returns (uint256) {
uint256 totalWhiteListRemainingCount = firstWhiteListSaleRemainingCount +
secondWhiteListSaleRemainingCount;
return
publicSalePurchasedCount <= totalWhiteListRemainingCount
? totalWhiteLis... | 47,611 |
13 | // each one box is entitled to every pair of the socks so if boxIds.length = n, then we mint 3n pairs of socks | amounts[0] = boxIdsLength;
amounts[1] = boxIdsLength;
amounts[2] = boxIdsLength;
STANCE_RKL_COLLECTION.mint(msg.sender, SOX_TRIPLET, amounts);
| amounts[0] = boxIdsLength;
amounts[1] = boxIdsLength;
amounts[2] = boxIdsLength;
STANCE_RKL_COLLECTION.mint(msg.sender, SOX_TRIPLET, amounts);
| 4,619 |
14 | // Emitted when a new Connext address is set connext The new connext address / | event SetConnext(address indexed connext);
| event SetConnext(address indexed connext);
| 12,247 |
46 | // sweeps any ammount of tokens / | function sweepMany(address[] memory _erc20sToSweep) public {
for(uint i = 0; i < _erc20sToSweep.length; i++){
sweepERC20(_erc20sToSweep[i]);
}
}
| function sweepMany(address[] memory _erc20sToSweep) public {
for(uint i = 0; i < _erc20sToSweep.length; i++){
sweepERC20(_erc20sToSweep[i]);
}
}
| 14,871 |
142 | // Hook that is called before any token transfer. This includes mintingand burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will betransferred to `to`.- When `from` is zero, `tokenId` will be minted for `to`.- When `to` is zero, ``from``'s `tokenId` will be burned.- `from` can... | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
| function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
| 3,041 |
7 | // MIN_AMOUNT_FOR_NEW_CLONE is the minimum amount for a clone | dm.duplicate(nftAddr, nftId, currencyAddr, 1, false, 0);
vm.expectRevert(abi.encodeWithSelector(DittoMachine.InvalidFloorId.selector));
dm.duplicate(nftAddr, nftId, currencyAddr, MIN_AMOUNT_FOR_NEW_CLONE, true, 0);
vm.stopPrank();
| dm.duplicate(nftAddr, nftId, currencyAddr, 1, false, 0);
vm.expectRevert(abi.encodeWithSelector(DittoMachine.InvalidFloorId.selector));
dm.duplicate(nftAddr, nftId, currencyAddr, MIN_AMOUNT_FOR_NEW_CLONE, true, 0);
vm.stopPrank();
| 45,693 |
10 | // Use Identity (0x04) precompile to memcpy the base | if iszero(staticcall(10000, 0x04, add(base, 0x20), bl, add(p, 0x60), bl)) {
revert(0, 0)
}
| if iszero(staticcall(10000, 0x04, add(base, 0x20), bl, add(p, 0x60), bl)) {
revert(0, 0)
}
| 20,615 |
22 | // See {ICreatorCore-setBaseTokenURI}. / | function setBaseTokenURI(string calldata uri_) external override adminRequired {
_setBaseTokenURI(uri_);
}
| function setBaseTokenURI(string calldata uri_) external override adminRequired {
_setBaseTokenURI(uri_);
}
| 32,399 |
29 | // Get token contract for item. | address token = address(getTokenToBurnItem(itemId));
| address token = address(getTokenToBurnItem(itemId));
| 5,994 |
167 | // mint the difference only to MC, update mintReward | mintReward = mint.maxSupply().sub(mint.totalSupply());
mint.mint(address(this), mintReward);
| mintReward = mint.maxSupply().sub(mint.totalSupply());
mint.mint(address(this), mintReward);
| 1,559 |
130 | // user should already have shares here, let's increment | vaultUsers[_user].vaultShares += previewDepositEpoch(
vaultUsers[_user].assetsDeposited,
vaultUsers[_user].epochLastDeposited + 1
);
vaultUsers[_user].assetsDeposited = 0;
vaultUsers[_user].epochLastDeposited = 0;
| vaultUsers[_user].vaultShares += previewDepositEpoch(
vaultUsers[_user].assetsDeposited,
vaultUsers[_user].epochLastDeposited + 1
);
vaultUsers[_user].assetsDeposited = 0;
vaultUsers[_user].epochLastDeposited = 0;
| 3,302 |
10 | // This is the code that is executed after `simpleFlashLoan` initiated the flash-borrowWhen this code executes, this contract will hold the flash-borrowed _amount of _tokenBorrow | function simpleFlashLoanExecute(
address _tokenBorrow,
uint _amount,
address _pairAddress,
bool _isBorrowingEth,
bool _isPayingEth,
bytes memory _userData
| function simpleFlashLoanExecute(
address _tokenBorrow,
uint _amount,
address _pairAddress,
bool _isBorrowingEth,
bool _isPayingEth,
bytes memory _userData
| 17,895 |
100 | // updates list of supported tokens, it can be use also to disable or enable particualr token/addrs array of address of pools/toggles array of addresses of assets/withApprovals resets tokens to unlimited approval with the swaps integration (kyber, etc.) | function setSupportedTokens(
address[] calldata addrs,
bool[] calldata toggles,
bool withApprovals
) external;
| function setSupportedTokens(
address[] calldata addrs,
bool[] calldata toggles,
bool withApprovals
) external;
| 40,158 |
457 | // updates the state of the user as a consequence of a swap rate action._reserve the address of the reserve on which the user is performing the swap_user the address of the borrower_balanceIncrease the accrued interest on the borrowed amount_currentRateMode the current rate mode of the user/ | ) internal returns (CoreLibrary.InterestRateMode) {
CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve];
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
CoreLibrary.InterestRateMode newMode = CoreLibrary.InterestRateMode.NONE;
if (_currentRate... | ) internal returns (CoreLibrary.InterestRateMode) {
CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve];
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
CoreLibrary.InterestRateMode newMode = CoreLibrary.InterestRateMode.NONE;
if (_currentRate... | 32,169 |
24 | // Yields the excess beyond the floor of x./Based on the odd function definition https:en.wikipedia.org/wiki/Fractional_part./x The unsigned 60.18-decimal fixed-point number to get the fractional part of./result The fractional part of x as an unsigned 60.18-decimal fixed-point number. | function frac(uint256 x) internal pure returns (uint256 result) {
assembly {
result := mod(x, SCALE)
}
}
| function frac(uint256 x) internal pure returns (uint256 result) {
assembly {
result := mod(x, SCALE)
}
}
| 23,383 |
18 | // / | function getTokenData(uint256 tokenId, uint256 index) public view returns (string memory _tokenHash, string memory _tokenType) {
require(_exists(tokenId), "Token does not exist.");
uint256 tokenBatchRef = referenceTotokenBatch[tokenId];
_tokenHash = tokenBatch[to... | function getTokenData(uint256 tokenId, uint256 index) public view returns (string memory _tokenHash, string memory _tokenType) {
require(_exists(tokenId), "Token does not exist.");
uint256 tokenBatchRef = referenceTotokenBatch[tokenId];
_tokenHash = tokenBatch[to... | 24,865 |
49 | // storing the protocol fee | execution.sellProtocolFee = protocolFee;
| execution.sellProtocolFee = protocolFee;
| 17,726 |
191 | // Concatenate the tokenID to the baseURI. | return string(abi.encodePacked(_baseTokenURI, tokenId.toString()));
| return string(abi.encodePacked(_baseTokenURI, tokenId.toString()));
| 57,407 |
0 | // IReserveInterestRateStrategyInterface interface Interface for the calculation of the interest rates Aave / | interface IReserveInterestRateStrategy {
function baseVariableBorrowRate() external view returns (uint256);
function getMaxVariableBorrowRate() external view returns (uint256);
function calculateInterestRates(
address reserve,
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVar... | interface IReserveInterestRateStrategy {
function baseVariableBorrowRate() external view returns (uint256);
function getMaxVariableBorrowRate() external view returns (uint256);
function calculateInterestRates(
address reserve,
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVar... | 28,818 |
186 | // Look up information about a specific tick in the pool/tick The tick to look up/ return liquidityGross total liquidity amount from positions that uses this tick as a lower or upper tick/ liquidityNet how much liquidity changes when the pool tick crosses above the tick/ feeGrowthOutside the fee growth on the other sid... | function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside,
uint128 secondsPerLiquidityOutside
);
| function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside,
uint128 secondsPerLiquidityOutside
);
| 30,857 |
202 | // underflow attempts BTFO | SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremen... | SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremen... | 21,560 |
89 | // Distribute tokens to farm in linear fashion based on time / | function distribute() public override {
// cannot distribute until distribution start
uint256 amount = nextDistribution();
if (amount == 0) {
return;
}
// transfer tokens & update state
lastDistribution = block.timestamp;
distributed = distribute... | function distribute() public override {
// cannot distribute until distribution start
uint256 amount = nextDistribution();
if (amount == 0) {
return;
}
// transfer tokens & update state
lastDistribution = block.timestamp;
distributed = distribute... | 78,322 |
155 | // Only maintain 1e6 resolution. | newInfo = info & ~(((U256_1 << 20) - 1) << 160);
newInfo = newInfo | ((w / 1e12) << 160);
| newInfo = info & ~(((U256_1 << 20) - 1) << 160);
newInfo = newInfo | ((w / 1e12) << 160);
| 18,555 |
168 | // Distribute the `tRewardFee` tokens to all holders that are included in receiving reward.amount received is based on how many token one owns. / | function _distributeFee(uint256 rRewardFee, uint256 tRewardFee) private {
// This would decrease rate, thus increase amount reward receive based on one's balance.
_reflectionTotal = _reflectionTotal - rRewardFee;
_totalRewarded += tRewardFee;
}
| function _distributeFee(uint256 rRewardFee, uint256 tRewardFee) private {
// This would decrease rate, thus increase amount reward receive based on one's balance.
_reflectionTotal = _reflectionTotal - rRewardFee;
_totalRewarded += tRewardFee;
}
| 18,952 |
27 | // Proxy Proxy is a transparent proxy that passes through the call if the caller is the owner orif the caller is address(0), meaning that the call originated from an off-chainsimulation. / | contract Proxy {
/**
* @notice The storage slot that holds the address of the implementation.
* bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
*/
bytes32 internal constant IMPLEMENTATION_KEY =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
... | contract Proxy {
/**
* @notice The storage slot that holds the address of the implementation.
* bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
*/
bytes32 internal constant IMPLEMENTATION_KEY =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
... | 31,012 |
124 | // STORAGE UPDATE 1 | EverscaleAddress configurationAlien_;
| EverscaleAddress configurationAlien_;
| 64,342 |
8 | // Update user name. |
if (users[msg.sender].name != 0x0)
{
users[msg.sender].name = name;
return (users[msg.sender].name);
}
|
if (users[msg.sender].name != 0x0)
{
users[msg.sender].name = name;
return (users[msg.sender].name);
}
| 49,779 |
139 | // verify if sessionPubkeyHash was verified already, if not.. let's do it! | if (provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){
provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset);
}
| if (provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){
provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset);
}
| 5,579 |
4 | // Allowance amounts on behalf of others | mapping(address => mapping(address => uint)) internal allowances;
| mapping(address => mapping(address => uint)) internal allowances;
| 65,939 |
11 | // Sweep any ERC20 token.Sometimes people accidentally send tokens to a contract without any way to retrieve them.This contract makes sure any erc20 tokens can be removed from the contract. / | contract SweeperUpgradeable is OwnableUpgradeable {
struct NFT {
IERC721 nftaddress;
uint256[] ids;
}
mapping(address => bool) public lockedTokens;
bool public allowNativeSweep;
event SweepWithdrawToken(
address indexed receiver,
IERC20 indexed token,
uint256... | contract SweeperUpgradeable is OwnableUpgradeable {
struct NFT {
IERC721 nftaddress;
uint256[] ids;
}
mapping(address => bool) public lockedTokens;
bool public allowNativeSweep;
event SweepWithdrawToken(
address indexed receiver,
IERC20 indexed token,
uint256... | 27,633 |
200 | // our simple algo get the lowest apr strat cycle through and see who could take its funds plus want for the highest apr | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | 30,658 |
4 | // Interactions | uint256 tokensToTransfer = (theFraction*totalAssets())/ONE_IN_TEN_DECIMALS;
IERC20(STAKING_TOKEN).safeTransfer(msg.sender, tokensToTransfer);
emit FeesTaken(entitledFeesInDollars, averagePoolBalanceInDollars, tokensToTransfer);
| uint256 tokensToTransfer = (theFraction*totalAssets())/ONE_IN_TEN_DECIMALS;
IERC20(STAKING_TOKEN).safeTransfer(msg.sender, tokensToTransfer);
emit FeesTaken(entitledFeesInDollars, averagePoolBalanceInDollars, tokensToTransfer);
| 4,840 |
36 | // Returns the downcasted int8 from int256, reverting onoverflow (when the input is less than smallest int8 orgreater than largest int8). Counterpart to Solidity's `int8` operator. Requirements: - input must fit into 8 bits. _Available since v3.1._ / | function toInt8(int256 value) internal pure returns (int8) {
require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
return int8(value);
}
| function toInt8(int256 value) internal pure returns (int8) {
require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
return int8(value);
}
| 4,315 |
11 | // MAINNET ADDRESSES The contracts in this list should correspond to MCD core contracts, verify against the current release list at: https:changelog.makerdao.com/releases/mainnet/1.0.9/contracts.json |
address constant mcd_vat35 = 0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B; //inject NONSTANDARD NAMING
address constant mcd_jug497 = 0x19c0976f590D67707E62397C87829d896Dc0f1F1; //inject NONSTANDARD NAMING
address constant mcd_vow892 = 0xA950524441892A31ebddF91d3cEEFa04Bf454466; //inje... |
address constant mcd_vat35 = 0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B; //inject NONSTANDARD NAMING
address constant mcd_jug497 = 0x19c0976f590D67707E62397C87829d896Dc0f1F1; //inject NONSTANDARD NAMING
address constant mcd_vow892 = 0xA950524441892A31ebddF91d3cEEFa04Bf454466; //inje... | 45,602 |
0 | // Mapping from bundle UID => bundle info. | mapping(uint256 => BundleInfo) private bundle;
| mapping(uint256 => BundleInfo) private bundle;
| 15,557 |
81 | // 设置众筹结束时间 | function setClosingTime(uint256 _closingTime) onlyOwner public {
require(_closingTime >= block.timestamp);
require(_closingTime >= openingTime);
closingTime = _closingTime;
}
| function setClosingTime(uint256 _closingTime) onlyOwner public {
require(_closingTime >= block.timestamp);
require(_closingTime >= openingTime);
closingTime = _closingTime;
}
| 28,598 |
154 | // wearable energy | uint256 wearableEnergy;
| uint256 wearableEnergy;
| 41,796 |
6 | // constructor for the StakingTokenWrapper/_tribalChief the TribalChief contract/_beneficiary the recipient of all harvested TRIBE | constructor(
ITribalChief _tribalChief,
address _beneficiary
| constructor(
ITribalChief _tribalChief,
address _beneficiary
| 52,413 |
130 | // 10% given to the governance treasury | fryToken.mint(address(governanceTreasury), uint(10000000).mul(10 ** uint256(fryToken.decimals())));
| fryToken.mint(address(governanceTreasury), uint(10000000).mul(10 ** uint256(fryToken.decimals())));
| 31,512 |
265 | // Records the owner of a given tokenId / | function _recordOwner(
address _keyOwner,
uint _tokenId
) internal
| function _recordOwner(
address _keyOwner,
uint _tokenId
) internal
| 41,612 |
39 | // The ordered list of calldata to be passed to each call | bytes[] calldatas;
| bytes[] calldatas;
| 4,602 |
3 | // Constructor / | constructor() {
FARM_BOOSTER_PROXY_FACTORY = msg.sender;
}
| constructor() {
FARM_BOOSTER_PROXY_FACTORY = msg.sender;
}
| 32,886 |
61 | // Admin - Add a rewards programme | function addRewardsProgramme(uint256 _allocPoint, uint256 _minStakingLengthInBlocks, bool _withUpdate) external {
require(
accessControls.hasAdminRole(_msgSender()),
// StakingRewards.addRewardsProgramme: Only admin
"OA"
);
require(
isActiveRewardPro... | function addRewardsProgramme(uint256 _allocPoint, uint256 _minStakingLengthInBlocks, bool _withUpdate) external {
require(
accessControls.hasAdminRole(_msgSender()),
// StakingRewards.addRewardsProgramme: Only admin
"OA"
);
require(
isActiveRewardPro... | 26,567 |
115 | // encode a uint112 as a UQ112x112 | function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
| function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
| 9,873 |
49 | // The total transfer amount is the same as the deducted amount | require(totalTransfer == deductedAmount, "panic, calculation error");
| require(totalTransfer == deductedAmount, "panic, calculation error");
| 31,243 |
594 | // Public Mint Monai Universe/ | function mintMonai(uint256 numberOfTokens)
external
payable
| function mintMonai(uint256 numberOfTokens)
external
payable
| 58,276 |
281 | // show founder caps | function getfoundercaps() external view returns (uint16,uint8,uint8) {
return(founderpackcap1,founderpackcap2,founderpackcap3);
}
| function getfoundercaps() external view returns (uint16,uint8,uint8) {
return(founderpackcap1,founderpackcap2,founderpackcap3);
}
| 18,884 |
19 | // Allows the owner to update dynamic L2OutputOracle config._l2OutputOracleDynamicConfig Dynamic L2OutputOracle config. / | function updateL2OutputOracleDynamicConfig(
L2OutputOracleDynamicConfig memory _l2OutputOracleDynamicConfig
| function updateL2OutputOracleDynamicConfig(
L2OutputOracleDynamicConfig memory _l2OutputOracleDynamicConfig
| 14,948 |
519 | // Burns `amount` tokens from `owner`'s balance.//ownerThe address to burn tokens from./amount The amount of tokens to burn.// return If burning the tokens was successful. | function burnFrom(address owner, uint256 amount) external returns (bool);
| function burnFrom(address owner, uint256 amount) external returns (bool);
| 44,461 |
208 | // Verify only the transfer quantity is subtracted | require(
newBalance == existingBalance.sub(_quantity),
"Invalid post transfer balance"
);
| require(
newBalance == existingBalance.sub(_quantity),
"Invalid post transfer balance"
);
| 57,555 |
13 | // Check for preico | if (now <= start + ratePreICOEnd) {
rate = ratePreICO;
}
| if (now <= start + ratePreICOEnd) {
rate = ratePreICO;
}
| 11,799 |
0 | // Ethereum addresses of multisig owners | address public owner1;
address public owner2;
| address public owner1;
address public owner2;
| 47,710 |
95 | // fromReturnsBSestimate first calculates the stddev of an array of price returns then uses that as the volatility param for the blackScholesEstimate _numbers uint256[] array of price returns for volatility calculation _underlying uint256 price of the underlying asset _time uint256 days to expiration in years multiplie... | function retBasedBlackScholesEstimate(
uint256[] memory _numbers,
uint256 _underlying,
uint256 _time
| function retBasedBlackScholesEstimate(
uint256[] memory _numbers,
uint256 _underlying,
uint256 _time
| 13,599 |
8 | // ------ SUBSCRIPTION FUNCTIONS ------ /// | function subscribeToChannel(uint256 _channelId) public payable {
require(
msg.value == CHANNEL_SUBSCRIPTION_FEE,
"Must pay exact fee to subscribe"
);
channelIdToUserSubscriptionStatus[currentFeePeriod][_channelId][msg
.sender] = true;
}
| function subscribeToChannel(uint256 _channelId) public payable {
require(
msg.value == CHANNEL_SUBSCRIPTION_FEE,
"Must pay exact fee to subscribe"
);
channelIdToUserSubscriptionStatus[currentFeePeriod][_channelId][msg
.sender] = true;
}
| 28,075 |
0 | // Renaming this contract/ solhint-disable / | contract BondingCurve is BancorFormula {
}
| contract BondingCurve is BancorFormula {
}
| 49,546 |
2 | // 1 token === 1 day |
if (apiKey.startDate == 0) {
|
if (apiKey.startDate == 0) {
| 25,453 |
52 | // fallback payable function to receive ether from other contract addresses | fallback() external payable {}
}
| fallback() external payable {}
}
| 30,529 |
46 | // Places bid for canvas that is in the state STATE_INITIAL_BIDDING. If somebody is outbid his pending withdrawals will be to topped up./ | function makeBid(uint32 _canvasId) external payable stateBidding(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
Bid storage oldBid = bids[_canvasId];
if (msg.value < minimumBidAmount || msg.value <= oldBid.amount) {
revert();
}
if (oldBid.bidder != ... | function makeBid(uint32 _canvasId) external payable stateBidding(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
Bid storage oldBid = bids[_canvasId];
if (msg.value < minimumBidAmount || msg.value <= oldBid.amount) {
revert();
}
if (oldBid.bidder != ... | 4,630 |
14 | // Sets the cost for deploying pools _deploymentCost: Amount of BNB to pay / | function setDeploymentCost(uint256 _deploymentCost) external onlyOwner {
require(deploymentCost != _deploymentCost, "Already set");
deploymentCost = _deploymentCost;
emit NewDeploymentCost(_deploymentCost);
}
| function setDeploymentCost(uint256 _deploymentCost) external onlyOwner {
require(deploymentCost != _deploymentCost, "Already set");
deploymentCost = _deploymentCost;
emit NewDeploymentCost(_deploymentCost);
}
| 27,114 |
142 | // withdraw nfts from farm/only can call by nfts's owner, also claim reward earned/burn an amount of farmingToken (if needed) from msg.sender/fId farm's id/nftIds nfts to withdraw | function withdraw(uint256 fId, uint256[] memory nftIds) external;
| function withdraw(uint256 fId, uint256[] memory nftIds) external;
| 19,062 |
15 | // 私募和ICO解锁时间 2018-01-15 00:00:00 | uint public unlockTime = 1515945600;
| uint public unlockTime = 1515945600;
| 4,812 |
101 | // CityToken with Governance. | contract DelhiCityToken is ERC20("DELHI.cityswap.io", "DELHI"), Ownable {
uint256 public constant MAX_SUPPLY = 21285000 * 10**18;
/**
* @notice Creates `_amount` token to `_to`. Must only be called by the owner (TravelAgency).
*/
function mint(address _to, uint256 _amount) public on... | contract DelhiCityToken is ERC20("DELHI.cityswap.io", "DELHI"), Ownable {
uint256 public constant MAX_SUPPLY = 21285000 * 10**18;
/**
* @notice Creates `_amount` token to `_to`. Must only be called by the owner (TravelAgency).
*/
function mint(address _to, uint256 _amount) public on... | 36,573 |
145 | // Burns the specified value from the sender's balance. Sender's balanced is subtracted by the amount they wish to burn. _valueThe amount to burn. return success true if the burn succeeded./ | function burn(uint256 _value) public returns (bool success) {
require(blocked[msg.sender] != true, "account blocked");
uint256 balanceOfSender = erc20Store.balances(msg.sender);
require(_value <= balanceOfSender, "disallow burning more, than amount of the balance");
erc20Store.setBa... | function burn(uint256 _value) public returns (bool success) {
require(blocked[msg.sender] != true, "account blocked");
uint256 balanceOfSender = erc20Store.balances(msg.sender);
require(_value <= balanceOfSender, "disallow burning more, than amount of the balance");
erc20Store.setBa... | 38,271 |
61 | // Get position information | function getPosition(uint id) external override view returns (Position memory) {
return positionMap[id];
}
| function getPosition(uint id) external override view returns (Position memory) {
return positionMap[id];
}
| 61,818 |
5 | // Special Mint | uint256 public specialEthPrice;
uint256 public specialTokenPrice;
address public specialToken;
uint256 public transferPrice = 0.05 ether;
uint256 public refFee = 10; //10%
SharedData public sharedData;
bool public claimEnable = false;
| uint256 public specialEthPrice;
uint256 public specialTokenPrice;
address public specialToken;
uint256 public transferPrice = 0.05 ether;
uint256 public refFee = 10; //10%
SharedData public sharedData;
bool public claimEnable = false;
| 32,647 |
28 | // transfers token considering approvals / | function _approveTransfer(
address spender,
address from,
address to,
uint256 tokenId
| function _approveTransfer(
address spender,
address from,
address to,
uint256 tokenId
| 6,953 |
84 | // Calc base ticks depending on base threshold and tickspacing | function baseTicks(int24 currentTick, int24 baseThreshold, int24 tickSpacing) internal pure returns(int24 tickLower, int24 tickUpper) {
int24 tickFloor = floor(currentTick, tickSpacing);
tickLower = tickFloor - baseThreshold;
tickUpper = tickFloor + baseThreshold;
}
| function baseTicks(int24 currentTick, int24 baseThreshold, int24 tickSpacing) internal pure returns(int24 tickLower, int24 tickUpper) {
int24 tickFloor = floor(currentTick, tickSpacing);
tickLower = tickFloor - baseThreshold;
tickUpper = tickFloor + baseThreshold;
}
| 4,146 |
9 | // Payment is in BEP-20 | uint256 cost = getCost(paymentToken, numberOfTokens);
require(
paymentToken.allowance(msg.sender, address(this)) >= cost / 1000000000000,
"Not enough allowance"
);
_buyTokens(numberOfTokens, referrer);
paymentToken.safeTransferF... | uint256 cost = getCost(paymentToken, numberOfTokens);
require(
paymentToken.allowance(msg.sender, address(this)) >= cost / 1000000000000,
"Not enough allowance"
);
_buyTokens(numberOfTokens, referrer);
paymentToken.safeTransferF... | 2,553 |
30 | // The external account linked to the HashflowPool on the source chain.If the HashflowPool holds funds, this should be address(0). / | address srcExternalAccount;
| address srcExternalAccount;
| 10,359 |
18 | // Mapping from 'Largest tokenId of a batch of tokens with the same baseURI'to base URI for the respective batch of tokens. //Mapping from 'Largest tokenId of a batch of 'delayed-reveal' tokens withthe same baseURI' to encrypted base URI for the respective batch of tokens. //Mapping from address => total number of NFTs... | mapping(address => uint256) public walletClaimCount;
| mapping(address => uint256) public walletClaimCount;
| 29,090 |
294 | // CHANGE PARAMETERS / | function setInit(address _witchesanddemons, address _newt) external onlyOwner{
witchesanddemons = WitchesandDemons(_witchesanddemons); // reference to the WitchesandDemons NFT contract
newt = ITNewt(_newt); //reference... | function setInit(address _witchesanddemons, address _newt) external onlyOwner{
witchesanddemons = WitchesandDemons(_witchesanddemons); // reference to the WitchesandDemons NFT contract
newt = ITNewt(_newt); //reference... | 19,744 |
201 | // forward funds to the wallet | forwardFunds(purchaser, purchaseAmount);
| forwardFunds(purchaser, purchaseAmount);
| 79,889 |
28 | // transfer bmi profit to the user | bmiToken.transfer(_msgSender(), profit);
emit StakingBMIProfitWithdrawn(tokenId, policyBookAddress, _msgSender(), profit);
| bmiToken.transfer(_msgSender(), profit);
emit StakingBMIProfitWithdrawn(tokenId, policyBookAddress, _msgSender(), profit);
| 40,823 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.