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 | // CONSTANTS USED ACROSS CONTRACTS //Used by all contracts that interfaces with Ethernauts/The ERC-165 interface signature for ERC-721./Ref: https:github.com/ethereum/EIPs/issues/165/Ref: https:github.com/ethereum/EIPs/issues/721 | bytes4 constant InterfaceSignature_ERC721 =
bytes4(keccak256('name()')) ^
bytes4(keccak256('symbol()')) ^
bytes4(keccak256('totalSupply()')) ^
bytes4(keccak256('balanceOf(address)')) ^
bytes4(keccak256('ownerOf(uint256)')) ^
bytes4(keccak256('approve(address,uint256)')) ^
bytes4(keccak25... | bytes4 constant InterfaceSignature_ERC721 =
bytes4(keccak256('name()')) ^
bytes4(keccak256('symbol()')) ^
bytes4(keccak256('totalSupply()')) ^
bytes4(keccak256('balanceOf(address)')) ^
bytes4(keccak256('ownerOf(uint256)')) ^
bytes4(keccak256('approve(address,uint256)')) ^
bytes4(keccak25... | 29,935 |
27 | // Implementation of the {IERC20} interface./ Sets the values for {name} and {symbol}, initializes {decimals} witha default value of 18./ | constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
governance = tx.origin;
}
| constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
governance = tx.origin;
}
| 12,132 |
93 | // Returns a list of all Property IDs assigned to an address./_owner The owner whose Properties we are interested in./This method MUST NEVER be called by smart contract code. First, it&39;s fairly/expensive (it walks the entire Kitty array looking for cats belonging to owner),/but it also returns a dynamic array, which... | function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCo... | function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCo... | 49,527 |
36 | // store token in storage | listed.push(_tokenId);
| listed.push(_tokenId);
| 31,486 |
25 | // set the mPendleConvertor address/_mPendleConvertor the mPendleConvertor address | function setMPendleConvertor(address _mPendleConvertor) external onlyOwner {
address oldMPendleConvertor = mPendleConvertor;
mPendleConvertor = _mPendleConvertor;
emit SetMPendleConvertor(oldMPendleConvertor, mPendleConvertor);
}
| function setMPendleConvertor(address _mPendleConvertor) external onlyOwner {
address oldMPendleConvertor = mPendleConvertor;
mPendleConvertor = _mPendleConvertor;
emit SetMPendleConvertor(oldMPendleConvertor, mPendleConvertor);
}
| 24,395 |
252 | // Get the caller as a Safe instance. | TurboSafe safe = TurboSafe(msg.sender);
| TurboSafe safe = TurboSafe(msg.sender);
| 19,184 |
11 | // / | constructor(ClipperExchangeInterface initialExchangeInterface) payable ERC20("Clipper Pool Token", "CLPRPL") {
require(msg.value > 0, "Clipper: Must deposit ETH");
_mint(msg.sender, msg.value*10);
lastETHBalance = msg.value;
fullyDilutedSupply = totalSupply();
... | constructor(ClipperExchangeInterface initialExchangeInterface) payable ERC20("Clipper Pool Token", "CLPRPL") {
require(msg.value > 0, "Clipper: Must deposit ETH");
_mint(msg.sender, msg.value*10);
lastETHBalance = msg.value;
fullyDilutedSupply = totalSupply();
... | 58,862 |
49 | // max wallet code | if (!isMaxWalletExempt[recipient]) {
uint256 heldTokens = balanceOf(recipient);
require(
(heldTokens + amount) <= _maxWalletToken,
"Max wallet reached."
);
}
| if (!isMaxWalletExempt[recipient]) {
uint256 heldTokens = balanceOf(recipient);
require(
(heldTokens + amount) <= _maxWalletToken,
"Max wallet reached."
);
}
| 8,349 |
19 | // We now transform x into a 20 decimal fixed point number, to have enhanced precision when computing the smaller terms. | x *= 100;
| x *= 100;
| 16,760 |
487 | // creates a pool token for the specified token / | function createPoolToken(Token token) external returns (IPoolToken);
| function createPoolToken(Token token) external returns (IPoolToken);
| 75,629 |
198 | // Tells the address of the ownerreturn the address of the owner / | function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
| function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
| 43,058 |
356 | // Token Base/Shared logic for token contracts | contract FellowshipDailyArtCollection is ERC721, Ownable, RevokableDefaultOperatorFiltererUpgradeable {
uint256 private immutable MAX_SUPPLY;
address public royaltyReceiver;
address public minter;
address public metadataContract;
uint256 public royaltyFraction;
uint256 public royaltyDenominat... | contract FellowshipDailyArtCollection is ERC721, Ownable, RevokableDefaultOperatorFiltererUpgradeable {
uint256 private immutable MAX_SUPPLY;
address public royaltyReceiver;
address public minter;
address public metadataContract;
uint256 public royaltyFraction;
uint256 public royaltyDenominat... | 22,057 |
5 | // Max gas to consume during the matching process for supply, borrow, withdraw and repay functions. | struct MaxGasForMatching {
uint64 supply;
uint64 borrow;
uint64 withdraw;
uint64 repay;
}
| struct MaxGasForMatching {
uint64 supply;
uint64 borrow;
uint64 withdraw;
uint64 repay;
}
| 34,581 |
92 | // don't swap or buy tokens when uniswapV2Pair is sender, to avoid circular loop | if(!inSwapAndLiquify && sender != uniswapV2Pair) {
bool swap = true;
uint256 contractBalance = address(this).balance;
| if(!inSwapAndLiquify && sender != uniswapV2Pair) {
bool swap = true;
uint256 contractBalance = address(this).balance;
| 14,761 |
152 | // `verifyVMInternal` serves to validate an arbitrary vm against a valid Guardian set if checkHash is set then the hash field of the vm is verified against the hash of its contents in the case that the vm is securely parsed and the hash field can be trusted, checkHash can be set to false as the check would be redundant... | function verifyVMInternal(Structs.VM memory vm, bool checkHash) internal view returns (bool valid, string memory reason) {
/// @dev Obtain the current guardianSet for the guardianSetIndex provided
Structs.GuardianSet memory guardianSet = getGuardianSet(vm.guardianSetIndex);
/**
* V... | function verifyVMInternal(Structs.VM memory vm, bool checkHash) internal view returns (bool valid, string memory reason) {
/// @dev Obtain the current guardianSet for the guardianSetIndex provided
Structs.GuardianSet memory guardianSet = getGuardianSet(vm.guardianSetIndex);
/**
* V... | 11,935 |
6 | // Save box index to mappings for sender & recipient | senderMap[msg.sender].push(boxes.length - 1);
recipientMap[_recipient].push(boxes.length - 1);
if(_sendToken == ERC20Interface(address(0)))
| senderMap[msg.sender].push(boxes.length - 1);
recipientMap[_recipient].push(boxes.length - 1);
if(_sendToken == ERC20Interface(address(0)))
| 56,274 |
42 | // Charge fee | {
uint256 usedGas = startGas - gasleft();
uint256 fee = (usedGas * bank.TRANSFER_FEE_MULTIPLIER / bank.TRANSFER_FEE_DIVIDEND) * tx.gasprice;
if (fee > 0) {
require(msg.value >= fee, "Not enough fee.");
bank.suterAgency.transfer(fee... | {
uint256 usedGas = startGas - gasleft();
uint256 fee = (usedGas * bank.TRANSFER_FEE_MULTIPLIER / bank.TRANSFER_FEE_DIVIDEND) * tx.gasprice;
if (fee > 0) {
require(msg.value >= fee, "Not enough fee.");
bank.suterAgency.transfer(fee... | 8,241 |
32 | // Commits permission grants for the given address./Reverts if governance delay has not passed yet./target The given address. | function commitPermissionGrants(address target) external;
| function commitPermissionGrants(address target) external;
| 17,336 |
52 | // Deposit token to contract for a user anc charge a deposit fee | function depositTokenForUserWithFee(address token, uint128 amount, address user, uint256 depositFee) {
// Check sender is AMB bridge
if (safeMul(depositFee, 1e18) / amount > 1e17) revert(); // deposit fee is more than 10% of the deposit amount
addBalance(token, user, safeSub(amount, deposi... | function depositTokenForUserWithFee(address token, uint128 amount, address user, uint256 depositFee) {
// Check sender is AMB bridge
if (safeMul(depositFee, 1e18) / amount > 1e17) revert(); // deposit fee is more than 10% of the deposit amount
addBalance(token, user, safeSub(amount, deposi... | 8,880 |
268 | // Buy/Mints NFT/ | function mintNFT(uint256 numberOfNfts) public payable {
require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started");
require(totalSupply() <= MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(numberOfNfts <= 20, "Yo... | function mintNFT(uint256 numberOfNfts) public payable {
require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started");
require(totalSupply() <= MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(numberOfNfts <= 20, "Yo... | 21,851 |
2 | // Boolean that determines the operational status of application logic contracts | bool public isOperational;
| bool public isOperational;
| 17,143 |
121 | // Withdraws from funds from the Wise Vault _shares: Number of shares to withdraw / | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | 3,166 |
336 | // Prepare a users array to whitelist the Safe. | address[] memory users = new address[](1);
users[0] = address(safe);
| address[] memory users = new address[](1);
users[0] = address(safe);
| 61,600 |
150 | // 获取用户总体的存款和借款情况 | function getTotalDepositAndBorrow(address account)
public
view
returns (uint256, uint256)
| function getTotalDepositAndBorrow(address account)
public
view
returns (uint256, uint256)
| 75,872 |
61 | // The ConfirmedOwner contract A contract with helpers for basic contract ownership. / | contract ConfirmedOwnerWithProposal is OwnableInterface {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(address indexed from, address indexed to);
event OwnershipTransferred(address indexed from, address indexed to);
constructor(address newOwner, address pendingOw... | contract ConfirmedOwnerWithProposal is OwnableInterface {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(address indexed from, address indexed to);
event OwnershipTransferred(address indexed from, address indexed to);
constructor(address newOwner, address pendingOw... | 16,492 |
258 | // calculate player earning from their own buy (only based on the keys they just bought).& update player earnings mask | uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
| uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
| 7,753 |
22 | // Emit an event to notify clients | emit NewBooking(_sampleId, bookingId++);
| emit NewBooking(_sampleId, bookingId++);
| 42,276 |
15 | // Assume they always get the Headline | string Headline = newsDetails.Headline;
string Article;
string Image;
string Video;
| string Headline = newsDetails.Headline;
string Article;
string Image;
string Video;
| 38,292 |
41 | // PUBLIC READ FUNCTIONS | function getAvailableReward(address investor) public view returns(uint256) {
uint256 timeSinceLastAction = block.timestamp - lastAction[investor] > timer ? timer : block.timestamp - lastAction[investor];
uint256 availableReward = principalBalance[investor] * roi[investor] * timeSinceLastAction / tim... | function getAvailableReward(address investor) public view returns(uint256) {
uint256 timeSinceLastAction = block.timestamp - lastAction[investor] > timer ? timer : block.timestamp - lastAction[investor];
uint256 availableReward = principalBalance[investor] * roi[investor] * timeSinceLastAction / tim... | 31,876 |
9 | // Set subscription price. _price New price in USD. Must have `PRICE_PRECISION` decimals. Could only be invoked by the contract owner. / | function setPrice(uint256 _price) external onlyOwner {
require(_price > 0, "Cant be zero");
price = _price;
emit SetPrice(_price);
}
| function setPrice(uint256 _price) external onlyOwner {
require(_price > 0, "Cant be zero");
price = _price;
emit SetPrice(_price);
}
| 47,547 |
41 | // [--growth-window--][--max-window--][--freeze-window--] / | var call = FutureBlockCall(this);
uint cutoff = call.targetBlock() - BEFORE_CALL_FREEZE_WINDOW;
| var call = FutureBlockCall(this);
uint cutoff = call.targetBlock() - BEFORE_CALL_FREEZE_WINDOW;
| 16,897 |
259 | // Explicity sets and ERC-20 contract as an allowed payment method for minting_erc20TokenContract address of ERC-20 contract in question_isActive default status of if contract should be allowed to accept payments_chargeAmountInTokens fee (in tokens) to charge for mints for this specific ERC-20 token/ | function addOrUpdateERC20ContractAsPayment(address _erc20TokenContract, bool _isActive, uint256 _chargeAmountInTokens) public onlyTeamOrOwner {
allowedTokenContracts[_erc20TokenContract].isActive = _isActive;
allowedTokenContracts[_erc20TokenContract].chargeAmount = _chargeAmountInTokens;
}
| function addOrUpdateERC20ContractAsPayment(address _erc20TokenContract, bool _isActive, uint256 _chargeAmountInTokens) public onlyTeamOrOwner {
allowedTokenContracts[_erc20TokenContract].isActive = _isActive;
allowedTokenContracts[_erc20TokenContract].chargeAmount = _chargeAmountInTokens;
}
| 11,047 |
8 | // From state 1 - "Open to redeem" to state 2 - "Autograph requested" - Only owner of the NFT can change it | if(erc721.ownerOf(currentTokenId) != msg.sender) {
revert UTAutographControllerNotOwnerOfToken(msg.sender);
}
| if(erc721.ownerOf(currentTokenId) != msg.sender) {
revert UTAutographControllerNotOwnerOfToken(msg.sender);
}
| 13,888 |
21 | // make sure the message caller is the registration agent. this will fail when an event isn't registered, or the dispatcher isn't the one who registered the event. | require(msg.sender == eventDispatchers[eventHash], 'INVALID_DISPATCH');
| require(msg.sender == eventDispatchers[eventHash], 'INVALID_DISPATCH');
| 17,700 |
20 | // Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. / | function supportsInterface(bytes4 interfaceId) external view returns (bool);
| function supportsInterface(bytes4 interfaceId) external view returns (bool);
| 27,045 |
12 | // Subtracts two signed integers, reverts on overflow./ | function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
| function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
| 28,574 |
46 | // Gets all the recorded logs | function getRecordedLogs() external returns (Log[] memory logs);
| function getRecordedLogs() external returns (Log[] memory logs);
| 30,865 |
16 | // Calculate -x.Revert on overflow.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function neg (int128 x) internal pure returns (int128) {
require (x != MIN_64x64);
return -x;
}
| function neg (int128 x) internal pure returns (int128) {
require (x != MIN_64x64);
return -x;
}
| 8,237 |
23 | // function panelProposalsGetter (uint256 _electorateID) | // public constant returns (uint256[]) {
// return (electorateProposals[_electorateID]);
// }
| // public constant returns (uint256[]) {
// return (electorateProposals[_electorateID]);
// }
| 46,256 |
9 | // -------------------------------------------------------------------------/Send `(tokens/1000000000000000000).fixed(0,18)` PLAY to `to`./Throws if amount to send is zero. Throws if `msg.sender` has/insufficient balance for transfer. Throws if `to` is the zero address./to The address to where PLAY is being sent./token... | function transfer(address to, uint tokens)
public
notZero(uint(to))
notZero(tokens)
sufficientFunds(msg.sender, tokens)
returns(bool)
| function transfer(address to, uint tokens)
public
notZero(uint(to))
notZero(tokens)
sufficientFunds(msg.sender, tokens)
returns(bool)
| 14,610 |
198 | // Grab a reference to the potential matron | Pony storage matron = ponies[_matronId];
| Pony storage matron = ponies[_matronId];
| 2,404 |
66 | // only pay referrals for the first investment of each player | if(
(!m_referrals[msg.sender] && limitedReferralsMode == true)
||
limitedReferralsMode == false
) {
uint _referralEarning = m_refPercent.mul(value);
unclaimedReturns = unclaimedReturns.a... | if(
(!m_referrals[msg.sender] && limitedReferralsMode == true)
||
limitedReferralsMode == false
) {
uint _referralEarning = m_refPercent.mul(value);
unclaimedReturns = unclaimedReturns.a... | 23,993 |
3 | // solium-enable |
for (uint i = 0; i < len; i++) {
require(_endTimes[i] >= _startTimes[i]);
uint stageCap;
if (_capRatios[i] != 0) {
stageCap = cap.mul(uint(_capRatios[i])).div(coeff);
} else {
|
for (uint i = 0; i < len; i++) {
require(_endTimes[i] >= _startTimes[i]);
uint stageCap;
if (_capRatios[i] != 0) {
stageCap = cap.mul(uint(_capRatios[i])).div(coeff);
} else {
| 15,731 |
83 | // decrease in creditline impacts amount available for new loans | assessor.changeBorrowAmountEpoch(safeSub(assessor.borrowAmountEpoch(), amountDAI));
| assessor.changeBorrowAmountEpoch(safeSub(assessor.borrowAmountEpoch(), amountDAI));
| 30,522 |
2 | // Token Contract call and send Functions / | interface Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (... | interface Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (... | 14,239 |
34 | // StoremanGroup unregistration application/StoremanGroup unregistration application/storemanGroup StoremanGroup's address | function applyUnregistration(address storemanGroup)
public
notHalted
onlyStoremanGroupAdmin
returns (bool)
| function applyUnregistration(address storemanGroup)
public
notHalted
onlyStoremanGroupAdmin
returns (bool)
| 43,156 |
44 | // Get the current and new invariants. Since we need a bigger new invariant, we round the current one up. | uint256 currentInvariant = _calculateInvariant(amp, balances, true);
uint256 newInvariant = bptTotalSupply.sub(bptAmountIn).divUp(bptTotalSupply).mulUp(currentInvariant);
| uint256 currentInvariant = _calculateInvariant(amp, balances, true);
uint256 newInvariant = bptTotalSupply.sub(bptAmountIn).divUp(bptTotalSupply).mulUp(currentInvariant);
| 35,473 |
6 | // exec-tx GelatoCore internal gas requirement | function setInternalGasRequirement(uint256 _newRequirement) external override onlyOwner {
emit LogInternalGasRequirementSet(internalGasRequirement, _newRequirement);
internalGasRequirement = _newRequirement;
}
| function setInternalGasRequirement(uint256 _newRequirement) external override onlyOwner {
emit LogInternalGasRequirementSet(internalGasRequirement, _newRequirement);
internalGasRequirement = _newRequirement;
}
| 44,443 |
12 | // max elite whitelists | uint256 public constant maxEliteWhitelists = 1000; //max 1000 elite whitelistes
mapping(address => uint256) public eliteWhitelistsOf;
| uint256 public constant maxEliteWhitelists = 1000; //max 1000 elite whitelistes
mapping(address => uint256) public eliteWhitelistsOf;
| 1,621 |
20 | // ------------------------------------------------------------------------------ Get the token balance for the account ------------------------------------------------------------------------------ | function balanceOf(address tokenOwner) override public view returns(uint balance) {
return balances[tokenOwner];
}
| function balanceOf(address tokenOwner) override public view returns(uint balance) {
return balances[tokenOwner];
}
| 20,996 |
143 | // Updates beefy fee recipient. _beefyFeeRecipient new beefy fee recipient address. / | function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
beefyFeeRecipient = _beefyFeeRecipient;
}
| function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner {
beefyFeeRecipient = _beefyFeeRecipient;
}
| 18,040 |
43 | // does validator exist? return true if yes, false if no/ | function isValidator(address _validator) public view returns (bool) {
return validators[_validator];
}
| function isValidator(address _validator) public view returns (bool) {
return validators[_validator];
}
| 50,448 |
19 | // Update the given pool's V3S allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint) public onlyOperator {
massUpdatePools();
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint_ = totalAllocPoint_.sub(pool.allocPoint).add(_allocPoint);
}
pool.allocPoint = _allocPoint;
}... | function set(uint256 _pid, uint256 _allocPoint) public onlyOperator {
massUpdatePools();
PoolInfo storage pool = poolInfo[_pid];
if (pool.isStarted) {
totalAllocPoint_ = totalAllocPoint_.sub(pool.allocPoint).add(_allocPoint);
}
pool.allocPoint = _allocPoint;
}... | 14,806 |
101 | // Mutative Functions | function claimFees() external returns (bool);
function claimOnBehalf(address claimingForAddress) external returns (bool);
function closeCurrentFeePeriod() external;
| function claimFees() external returns (bool);
function claimOnBehalf(address claimingForAddress) external returns (bool);
function closeCurrentFeePeriod() external;
| 14,092 |
281 | // the operator can use to refund ETH or ERC20 to buyer _orderId the refund order id _recepient the receiver address _currency the refund currency (can be ETH or ERC20) _amount the refund amount / | function refund(
uint128 _orderId,
address _recepient,
address _currency,
uint256 _amount
| function refund(
uint128 _orderId,
address _recepient,
address _currency,
uint256 _amount
| 14,805 |
2 | // Constructor takes the address of the AAVE protocol addresses provider. Should not change once deployed. (https:docs.aave.com/developers/deployed-contracts) | constructor(address _lendingPoolAddressesProvider) public {
addressesProvider = ILendingPoolAddressesProvider(
_lendingPoolAddressesProvider
);
lendingPool = ILendingPool(addressesProvider.getLendingPool());
}
| constructor(address _lendingPoolAddressesProvider) public {
addressesProvider = ILendingPoolAddressesProvider(
_lendingPoolAddressesProvider
);
lendingPool = ILendingPool(addressesProvider.getLendingPool());
}
| 16,188 |
47 | // If offer has become dust during buy, we cancel it | if (isActive(id) && offers[id].pay_amt < _dust[address(offers[id].pay_gem)]) {
cancel(id);
}
| if (isActive(id) && offers[id].pay_amt < _dust[address(offers[id].pay_gem)]) {
cancel(id);
}
| 19,364 |
4 | // duration of a slice period for the vesting in seconds | uint256 slicePeriodSeconds;
| uint256 slicePeriodSeconds;
| 13,964 |
10 | // Asset suspension timestamp, used to suspend specific assets only on the current day (according to the time zone). | mapping(address => uint256) internal assetPauseTime;
| mapping(address => uint256) internal assetPauseTime;
| 52,116 |
23 | // Any board member can get seconds per blocks. | function getSecondsPerBlock() public view onlyVideoBaseBoardMembers
| function getSecondsPerBlock() public view onlyVideoBaseBoardMembers
| 49,844 |
35 | // mint | mintOnChainMfer(_dna);
| mintOnChainMfer(_dna);
| 2,119 |
98 | // mint 1:1 and deposit | bridgeableToken.mint(address(this), _depositAmount);
_posDeposit(bridgeableToken, _addrTo, _depositAmount);
| bridgeableToken.mint(address(this), _depositAmount);
_posDeposit(bridgeableToken, _addrTo, _depositAmount);
| 26,325 |
150 | // See {Governor-_quorumReached}. / | function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalvote = _proposalVotes[proposalId];
return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes;
}
| function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalvote = _proposalVotes[proposalId];
return quorum(proposalSnapshot(proposalId)) <= proposalvote.forVotes + proposalvote.abstainVotes;
}
| 80,666 |
58 | // IPFS Hashes to Score Query | mapping(bytes32 => ScoreQuery) scoreQueries;
| mapping(bytes32 => ScoreQuery) scoreQueries;
| 43,148 |
110 | // SPDX-License-Identifier: MIT SPDX-License-Identifier: MIT | interface UniswapRouterV2 {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address ... | interface UniswapRouterV2 {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address ... | 16,612 |
103 | // normal case, where we are in the middle of the distribution | else {
_deltaBlock = block.number.sub(lastBlock);
}
| else {
_deltaBlock = block.number.sub(lastBlock);
}
| 19,119 |
5 | // Store params in memory | mstore(memPtr, schemaHash)
mstore(add(memPtr, 32), nameHash)
mstore(add(memPtr, 64), versionHash)
mstore(add(memPtr, 96), chainId)
mstore(add(memPtr, 128), verifyingContract)
| mstore(memPtr, schemaHash)
mstore(add(memPtr, 32), nameHash)
mstore(add(memPtr, 64), versionHash)
mstore(add(memPtr, 96), chainId)
mstore(add(memPtr, 128), verifyingContract)
| 6,406 |
8 | // burnerIndex[tokenAddress][poolIndex][userAddress]=> the index at which a user exceeded the trackBurnerIndexThreshold for a specific pool | mapping(address => mapping(uint256 => mapping(address => uint256))) public burnerIndex;
| mapping(address => mapping(uint256 => mapping(address => uint256))) public burnerIndex;
| 19,464 |
32 | // $1.8 | return 180 * 10**decimals / 100;
| return 180 * 10**decimals / 100;
| 26,822 |
43 | // uint256 public hump; surplus buffer [rad] | function hump() public view returns (uint256);
| function hump() public view returns (uint256);
| 40,811 |
51 | // Number of SECCoins sent to Ether contributors | uint public SECCoinSold;
| uint public SECCoinSold;
| 19,284 |
6 | // Emitted when a collateral factor is changed by admin | event NewCollateralFactor(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
| event NewCollateralFactor(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
| 9,046 |
55 | // The ID a motion on an address is currently operating at. Zero if no such motion is running. | mapping(address => uint) public targetMotionID;
| mapping(address => uint) public targetMotionID;
| 35,712 |
0 | // Sets initial admin / | constructor(address _admin) {
Ownable.transferOwnership(_admin);
}
| constructor(address _admin) {
Ownable.transferOwnership(_admin);
}
| 14,007 |
7 | // Constructor, takes params to set up quasar contract plasmaFrameworkContract Plasma Framework contract address _quasarOwner Receiver address on Plasma _safeBlockMargin The Quasar will not accept exits for outputs younger than the current plasma block minus the safe block margin_waitingPeriod Waiting period from submi... | constructor (
address plasmaFrameworkContract,
address spendingConditionRegistryContract,
address _quasarOwner,
uint256 _safeBlockMargin,
uint256 _waitingPeriod,
uint256 _bondValue
| constructor (
address plasmaFrameworkContract,
address spendingConditionRegistryContract,
address _quasarOwner,
uint256 _safeBlockMargin,
uint256 _waitingPeriod,
uint256 _bondValue
| 40,723 |
43 | // sellAmount {sellTok} Surplus amount (whole tokens)/ buyAmount {buyTok} Deficit amount (whole tokens)/ sellPrice {UoA/sellTok}/ buyPrice {UoA/sellTok}/ Defining "sell" and "buy": If bal(e) > (quantity(e)range.top), then e is in surplus by the difference If bal(e) < (quantity(e)range.bottom), then e is in deficit by t... | function nextTradePair(
ComponentCache memory components,
TradingRules memory rules,
IERC20[] memory erc20s,
BasketRange memory range
) private view returns (TradeInfo memory trade) {
MaxSurplusDeficit memory maxes;
maxes.surplusStatus = CollateralStatus.IFFY; // ... | function nextTradePair(
ComponentCache memory components,
TradingRules memory rules,
IERC20[] memory erc20s,
BasketRange memory range
) private view returns (TradeInfo memory trade) {
MaxSurplusDeficit memory maxes;
maxes.surplusStatus = CollateralStatus.IFFY; // ... | 27,020 |
62 | // Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see{TransparentUpgradeableProxy}. / | contract UpgradeableProxy is Proxy {
| contract UpgradeableProxy is Proxy {
| 62,710 |
16 | // The upper tick of the range | function tickUpper() external view returns (int24);
| function tickUpper() external view returns (int24);
| 21,557 |
59 | // Delete your Glofile uri with index `i` Deletes an uri with a specific index. i index of uri to delete / | function deleteUri(uint i) {
delete glofiles[msg.sender].uris[i];
Update(msg.sender);
}
| function deleteUri(uint i) {
delete glofiles[msg.sender].uris[i];
Update(msg.sender);
}
| 10,436 |
174 | // Get the (soon to be) popped strategy. | Strategy poppedStrategy = withdrawalStack[withdrawalStack.length - 1];
| Strategy poppedStrategy = withdrawalStack[withdrawalStack.length - 1];
| 6,266 |
71 | // Mapping owner address to address data. Bits Layout: - [0..63]`balance` - [64..127]`numberMinted` - [128..191] `numberBurned` - [192..255] `aux` | mapping(address => uint256) internal _packedAddressData;
| mapping(address => uint256) internal _packedAddressData;
| 5,163 |
0 | // -------------contract interfaces------------- / | function fundToken() internal view returns (address) {
return requireAndGetAddress(CONTRACT_FUNDTOKEN, "Missing FundToken Address");
}
| function fundToken() internal view returns (address) {
return requireAndGetAddress(CONTRACT_FUNDTOKEN, "Missing FundToken Address");
}
| 23,700 |
0 | // AppToken build contract interface (for apps ICO) / | interface AppTokenBuildI {
/**
* @dev CreateAppTokenContract - create new AppToken contract and return him address
*/
function CreateAppTokenContract(string _name, string _symbol, address _CrowdSale, address _PMFund, address _dev) external returns (address);
} | interface AppTokenBuildI {
/**
* @dev CreateAppTokenContract - create new AppToken contract and return him address
*/
function CreateAppTokenContract(string _name, string _symbol, address _CrowdSale, address _PMFund, address _dev) external returns (address);
} | 44,587 |
31 | // updates the deposit fee can only be called by the owner _depositFee new deposit fee in basis points / | function setDepositFee(uint256 _depositFee) external onlyOwner {
require(_depositFee <= DEPOSIT_FEE_CAP, 'setDepositFee: CAP_EXCEEDED');
depositFee = _depositFee;
emit SetDepositFee(_depositFee);
}
| function setDepositFee(uint256 _depositFee) external onlyOwner {
require(_depositFee <= DEPOSIT_FEE_CAP, 'setDepositFee: CAP_EXCEEDED');
depositFee = _depositFee;
emit SetDepositFee(_depositFee);
}
| 2,145 |
27 | // Returns the number of the first codepoint in the slice. self The slice to operate on.return The number of the first codepoint in the slice. / | function ord(slice memory self) internal pure returns (uint256 ret) {
if (self._len == 0) {
return 0;
}
uint256 word;
uint256 length;
uint256 divisor = 2**248;
// Load the rune into the MSBs of b
assembly {
word := mload(mload(add(sel... | function ord(slice memory self) internal pure returns (uint256 ret) {
if (self._len == 0) {
return 0;
}
uint256 word;
uint256 length;
uint256 divisor = 2**248;
// Load the rune into the MSBs of b
assembly {
word := mload(mload(add(sel... | 17,894 |
203 | // the liquidation threshold of the reserve. Expressed in percentage (0-100) | uint256 liquidationThreshold;
| uint256 liquidationThreshold;
| 9,049 |
129 | // Helper function to migrate user's tokens. Should be called in migrateFunds() function._tokens address[] representing the token addresses which are going to be migrated./ | function migrateTokens(address[] _tokens) private {
for (uint256 index = 0; index < _tokens.length; index++) {
address tokenAddress = _tokens[index];
uint256 tokenAmount = balances[tokenAddress][msg.sender];
if (0 == tokenAmount) {
continue;
... | function migrateTokens(address[] _tokens) private {
for (uint256 index = 0; index < _tokens.length; index++) {
address tokenAddress = _tokens[index];
uint256 tokenAmount = balances[tokenAddress][msg.sender];
if (0 == tokenAmount) {
continue;
... | 12,662 |
122 | // Allow the Owner to withdraw any funds that have been 'wrongly'transferred to the migrator contract / | function withdrawFund(IERC20 token, uint256 amount) external onlyOwner {
if (token == IERC20(0)) {
(bool success, ) = owner().call{value: amount}("");
require(success, "Migrator: TRANSFER_ETH_FAILED");
} else {
token.safeTransfer(owner(), amount);
}
}
| function withdrawFund(IERC20 token, uint256 amount) external onlyOwner {
if (token == IERC20(0)) {
(bool success, ) = owner().call{value: amount}("");
require(success, "Migrator: TRANSFER_ETH_FAILED");
} else {
token.safeTransfer(owner(), amount);
}
}
| 59,972 |
72 | // Token address of the bridge asset that prices are derived from if the specified pair price is missing | address public masterQuoteAsset;
| address public masterQuoteAsset;
| 52,109 |
7 | // Resets all mocked methods and invocation counts. / | function reset() external;
| function reset() external;
| 27,300 |
257 | // Set the capitalization flags based on the characters and the checksums. | characterIsCapitalized[2 * i] = (
leftNibbleAddress > 9 &&
leftNibbleHash > 7
);
characterIsCapitalized[2 * i + 1] = (
rightNibbleAddress > 9 &&
rightNibbleHash > 7
);
| characterIsCapitalized[2 * i] = (
leftNibbleAddress > 9 &&
leftNibbleHash > 7
);
characterIsCapitalized[2 * i + 1] = (
rightNibbleAddress > 9 &&
rightNibbleHash > 7
);
| 23,160 |
270 | // register the supported interfaces to conform to ERC1155 via ERC165 | _registerInterface(_INTERFACE_ID_ERC1155);
| _registerInterface(_INTERFACE_ID_ERC1155);
| 4,836 |
109 | // Internal liquidation process asset The address of the main collateral token positionOwner The address of a position's owner mainAssetToLiquidator The amount of main asset to send to a liquidator colToLiquidator The amount of COL to send to a liquidator mainAssetToPositionOwner The amount of main asset to send to a p... | {
require(liquidationBlock[asset][positionOwner] != 0, "Unit Protocol: NOT_TRIGGERED_LIQUIDATION");
uint mainAssetInPosition = collaterals[asset][positionOwner];
uint mainAssetToFoundation = mainAssetInPosition.sub(mainAssetToLiquidator).sub(mainAssetToPositionOwner);
uint colInPos... | {
require(liquidationBlock[asset][positionOwner] != 0, "Unit Protocol: NOT_TRIGGERED_LIQUIDATION");
uint mainAssetInPosition = collaterals[asset][positionOwner];
uint mainAssetToFoundation = mainAssetInPosition.sub(mainAssetToLiquidator).sub(mainAssetToPositionOwner);
uint colInPos... | 44,886 |
72 | // Creating locked balances | struct LockBox {
address beneficiary;
uint256 lockedBalance;
uint256 unlockTime;
bool locked;
}
| struct LockBox {
address beneficiary;
uint256 lockedBalance;
uint256 unlockTime;
bool locked;
}
| 31,482 |
9 | // return indicator whether encoded payload is a list. negate this function call for isData. | function isList(RLPItem memory item) internal pure returns (bool) {
if (item.len == 0) return false;
uint8 byte0;
uint memPtr = item.memPtr;
assembly {
byte0 := byte(0, mload(memPtr))
}
if (byte0 < LIST_SHORT_START)
return false;
retu... | function isList(RLPItem memory item) internal pure returns (bool) {
if (item.len == 0) return false;
uint8 byte0;
uint memPtr = item.memPtr;
assembly {
byte0 := byte(0, mload(memPtr))
}
if (byte0 < LIST_SHORT_START)
return false;
retu... | 12,571 |
41 | // Liquidate a Position/Steps to liquidate: update position's fixed and variable token balances to account for balances accumulated throughout the trades made since the last mint/burn/poke,/Check if the position is liquidatable by calling the isLiquidatablePosition function of the calculator, revert if that is not the ... | function liquidatePosition(
address _owner,
int24 _tickLower,
int24 _tickUpper
) external returns (uint256);
| function liquidatePosition(
address _owner,
int24 _tickLower,
int24 _tickUpper
) external returns (uint256);
| 27,248 |
2 | // Fees declaration | uint256 public _burnFee = 1;
uint256 private _previousBurnFee = _burnFee;
uint256 public _deflectionFee = 1;
uint256 private _previousDeflectionFee = _deflectionFee;
| uint256 public _burnFee = 1;
uint256 private _previousBurnFee = _burnFee;
uint256 public _deflectionFee = 1;
uint256 private _previousDeflectionFee = _deflectionFee;
| 2,720 |
36 | // Base contract for contracts that should not own things. Remco Bloemen <remco@2π.com> Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens orOwned contracts. See respective base contracts for details. / | contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
}
| contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
}
| 51,338 |
33 | // Approves an order. Cannot already be approved or canceled. orderThe order to approve / | function approveOrder(
Order memory order
)
public
| function approveOrder(
Order memory order
)
public
| 43,104 |
47 | // sy=((qy-py)/(qx-px))(px-sx)-py | (sy, dy) = projectiveSub(px, z1, sx, dx); // px-sx
(sy, dy) = projectiveMul(sy, dy, lx, lz); // ((qy-py)/(qx-px))(px-sx)
(sy, dy) = projectiveSub(sy, dy, py, z1); // ((qy-py)/(qx-px))(px-sx)-py
if (dx != dy) { // Cross-multiply to put everything over a common denominator
sx = mulmod(sx,... | (sy, dy) = projectiveSub(px, z1, sx, dx); // px-sx
(sy, dy) = projectiveMul(sy, dy, lx, lz); // ((qy-py)/(qx-px))(px-sx)
(sy, dy) = projectiveSub(sy, dy, py, z1); // ((qy-py)/(qx-px))(px-sx)-py
if (dx != dy) { // Cross-multiply to put everything over a common denominator
sx = mulmod(sx,... | 45,288 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.