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
3
// If the identity provider is none then set the identifier to empty string
identifier = "";
identifier = "";
37,717
40
// reward for deployer 2%
payable(getDeployerAddress()).transfer(address(this).balance); currentBalance = address(this).balance; _changeState(State.Closed);
payable(getDeployerAddress()).transfer(address(this).balance); currentBalance = address(this).balance; _changeState(State.Closed);
5,891
0
// The Attributes known by this instance of the rules engine
mapping(bytes32 => WonkaLibrary.WonkaAttr) private attrMap; WonkaLibrary.WonkaAttr[] public attributes;
mapping(bytes32 => WonkaLibrary.WonkaAttr) private attrMap; WonkaLibrary.WonkaAttr[] public attributes;
4,140
148
// Base URI extension used for computing {tokenURI}. If set, the resulting URI for eachtoken will be the concatenation of the baseURI, tokenId, and this value. Emptyby default, can be overriden in child contracts. /
function _baseURIExtension() internal view virtual returns (string memory) { return ""; }
function _baseURIExtension() internal view virtual returns (string memory) { return ""; }
4,438
13
// don't revert on signature failure: return SIG_VALIDATION_FAILED
if (!_check(sponsorSig, sig)) { return ("", _packValidationData(true, validUntil, validAfter)); }
if (!_check(sponsorSig, sig)) { return ("", _packValidationData(true, validUntil, validAfter)); }
11,414
4
// Rari USDC pool manager
IRariPool public constant poolManager = IRariPool(0xC6BF8C8A55f77686720E0a88e2Fd1fEEF58ddf4a);
IRariPool public constant poolManager = IRariPool(0xC6BF8C8A55f77686720E0a88e2Fd1fEEF58ddf4a);
81,278
48
// logic for getting the current segment after the game completes (waiting round is over)
currentSegment = waitingRoundSegmentStart.sub(firstSegmentStart).div(segmentLength) + block.timestamp.sub((waitingRoundSegmentStart.add(waitingRoundSegmentLength))).div(segmentLength) + 1;
currentSegment = waitingRoundSegmentStart.sub(firstSegmentStart).div(segmentLength) + block.timestamp.sub((waitingRoundSegmentStart.add(waitingRoundSegmentLength))).div(segmentLength) + 1;
6,995
34
// proof.W2
mstore(mload(add(proof_ptr, 0x20)), mod(calldataload(add(data_ptr, 0x60)), q)) mstore(add(mload(add(proof_ptr, 0x20)), 0x20), mod(calldataload(add(data_ptr, 0x40)), q))
mstore(mload(add(proof_ptr, 0x20)), mod(calldataload(add(data_ptr, 0x60)), q)) mstore(add(mload(add(proof_ptr, 0x20)), 0x20), mod(calldataload(add(data_ptr, 0x40)), q))
48,307
214
// Allocate additional memory for the plots array (this is more efficient than .push-ing each individual plot, as that requires multiple dynamic allocations).
plots.length = plots.length.add(_deedIds.length); for (uint256 i = 0; i < _deedIds.length; i++) { uint256 _deedId = _deedIds[i]; require(validIdentifier(_deedId));
plots.length = plots.length.add(_deedIds.length); for (uint256 i = 0; i < _deedIds.length; i++) { uint256 _deedId = _deedIds[i]; require(validIdentifier(_deedId));
13,358
0
// ___positionRange____ ||tickLowertickUpper ||current tick| __|__|__|__|__|__|__|__|__||| -112tickSpacingOffset floorTick = (current tick / tickSpacing)tickSpacing;if tickSpacingOffset is negative => floorTick+tickSpacingOffset = upper tickif tickSpacingOffset is positive => floorTick+tickSpacing+tickSpacingOffset = l...
struct Strategy { int24 tickSpacingOffset; int24 positionRange; uint24 poolFeeAmt; uint256 weight; }
struct Strategy { int24 tickSpacingOffset; int24 positionRange; uint24 poolFeeAmt; uint256 weight; }
31,380
48
// add the liquidity
try uniswapV2Router.addLiquidityETH{value: ethAmount}(
try uniswapV2Router.addLiquidityETH{value: ethAmount}(
8,722
1,020
// 512
entry "mackly" : ENG_ADVERB
entry "mackly" : ENG_ADVERB
21,348
0
// @inheritdoc IRewardsCollector
function collectRewards(bytes calldata looksRareClaim) external { (bool success,) = LOOKS_RARE_REWARDS_DISTRIBUTOR.call(looksRareClaim); if (!success) revert UnableToClaim(); uint256 balance = LOOKS_RARE_TOKEN.balanceOf(address(this)); LOOKS_RARE_TOKEN.transfer(ROUTER_REWARDS_DISTRI...
function collectRewards(bytes calldata looksRareClaim) external { (bool success,) = LOOKS_RARE_REWARDS_DISTRIBUTOR.call(looksRareClaim); if (!success) revert UnableToClaim(); uint256 balance = LOOKS_RARE_TOKEN.balanceOf(address(this)); LOOKS_RARE_TOKEN.transfer(ROUTER_REWARDS_DISTRI...
7,270
13
// Set approval using permit signature
IERC20Permit(token).permit(payer, address(this), amount, deadline, v, r, s); _createPayment(token, payer, receiver, startTime, amount, paymentDurationInSecs, cliffDurationInDays);
IERC20Permit(token).permit(payer, address(this), amount, deadline, v, r, s); _createPayment(token, payer, receiver, startTime, amount, paymentDurationInSecs, cliffDurationInDays);
34,410
25
// sets an attribute to an NFT, if attribute is not canonical it adds it, if NFT has not a single attribute, it creates the data struct to store attributes.
function setAttribute(address _a, string memory _att_name, string memory _att_value) public onlyOwner{ // if attribute is completely new, then I add it to the canonicals to keep track of which attributes we've created. if(!isAttCanonical(_att_name)){ attCanonical.isCanonical[_att_name]=t...
function setAttribute(address _a, string memory _att_name, string memory _att_value) public onlyOwner{ // if attribute is completely new, then I add it to the canonicals to keep track of which attributes we've created. if(!isAttCanonical(_att_name)){ attCanonical.isCanonical[_att_name]=t...
66,700
35
// Check if proposed referral is a new one or enabled
if (!referral.defined || referral.enabled) { return referral_; }
if (!referral.defined || referral.enabled) { return referral_; }
41,233
314
// берем тип машины
CarType storage carType = CarsTypes[carTypeId];
CarType storage carType = CarsTypes[carTypeId];
32,477
30
// Getter function that gets the oracle API_oracle is the oracle address to look up return the API and oracle address/
function getDetails(address _oracle) public view returns(string,address){ OracleDetails storage _current = oracle_list[oracle_index[_oracle]]; return(_current.API,_current.location); }
function getDetails(address _oracle) public view returns(string,address){ OracleDetails storage _current = oracle_list[oracle_index[_oracle]]; return(_current.API,_current.location); }
31,628
181
// withdraw
function withdraw() external payable onlyOwner { require(payable(_address_for_withdrawal).send(address(this).balance-1)); }
function withdraw() external payable onlyOwner { require(payable(_address_for_withdrawal).send(address(this).balance-1)); }
57,514
2
// emit when lottery winnings deposited in pending withdrawals
event LotteryWinningsDeposited( uint256 lotteryId, address winningAddress, uint256 amountDeposited );
event LotteryWinningsDeposited( uint256 lotteryId, address winningAddress, uint256 amountDeposited );
25,891
90
// Enable or disable anti bot Only callable by the owner _antiBotEnabled Enable or disable anti bot /
function setAntiBotEnabled(bool _antiBotEnabled) external onlyOwner { antiBotEnabled = _antiBotEnabled; }
function setAntiBotEnabled(bool _antiBotEnabled) external onlyOwner { antiBotEnabled = _antiBotEnabled; }
19,372
163
// result ptr, jump over length
let resultPtr := add(result, 32)
let resultPtr := add(result, 32)
8,284
23
// function balanceOf will display balance of given address /
function balanceOf(address _owner)public constant returns (uint256 balance)
function balanceOf(address _owner)public constant returns (uint256 balance)
37,235
191
// if we are not taking profit, there is nothing to do
if (!takeProfit) { return (0, 0, 0); }
if (!takeProfit) { return (0, 0, 0); }
16,094
111
// The view of balances/owner The address of an account/ return The balance of the account
function balanceOf(address owner) 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 (bool); ...
function balanceOf(address owner) 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 (bool); ...
37,253
18
// To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
16,141
142
// This is pure profit, figure out allocation Split the amount sent to the treasury, stakers and executor if one exists
if(_executor != address(0)){
if(_executor != address(0)){
19,547
2
// ========== CONSTRUCTOR ========== /
constructor() { setChainlinkToken(0xb0897686c545045aFc77CF20eC7A532E3120E0F1); setChainlinkOracle(0xA98FEd1e6E59fB7Cf6b35fD240Cd72EBf2DA7d66); }
constructor() { setChainlinkToken(0xb0897686c545045aFc77CF20eC7A532E3120E0F1); setChainlinkOracle(0xA98FEd1e6E59fB7Cf6b35fD240Cd72EBf2DA7d66); }
18,458
169
// Cancels an auction during shutdown or via governance action/Sender has to be allowed to call this method/auctionId Id of the auction to cancel
function cancelAuction(uint256 auctionId) external override checkCaller checkReentrancy { if (auctions[auctionId].user == address(0)) revert NoLossCollateralAuction__cancelAuction_notRunningAction(); address vault = auctions[auctionId].vault; uint256 tokenId = auctions[auctionId].tokenId; ...
function cancelAuction(uint256 auctionId) external override checkCaller checkReentrancy { if (auctions[auctionId].user == address(0)) revert NoLossCollateralAuction__cancelAuction_notRunningAction(); address vault = auctions[auctionId].vault; uint256 tokenId = auctions[auctionId].tokenId; ...
68,764
8
// @inheritdoc IntelligentNFTv2Spec /
string public override name = "Intelligent NFT";
string public override name = "Intelligent NFT";
54,164
454
// Staking Functions
function depositStake(uint256[] calldata tokenIds) external { require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!"); for (uint256 i; i < tokenIds.length; i++) { safeTransferFrom( msg.sender, address(this),...
function depositStake(uint256[] calldata tokenIds) external { require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!"); for (uint256 i; i < tokenIds.length; i++) { safeTransferFrom( msg.sender, address(this),...
22,396
125
// Set error bit if amount is zero.
errorBuffer := iszero(amount)
errorBuffer := iszero(amount)
22,635
4
// A mapping of addresses to remainingallowed. /
mapping(address => uint64) whitelist;
mapping(address => uint64) whitelist;
44,446
108
// uint64:create time/uint64:claimed time
mapping(uint256 => uint256) private claimTokenMap; uint256 constant MAX_TOKEN_CLAIM=1000; uint256 constant TOKEN_GAP=1;//24h for production,10m for test uint256 public lastWeekFirstMint; mapping(uint256 => address) private controllerMap; uint256 public editBlocktimestamp; address public l...
mapping(uint256 => uint256) private claimTokenMap; uint256 constant MAX_TOKEN_CLAIM=1000; uint256 constant TOKEN_GAP=1;//24h for production,10m for test uint256 public lastWeekFirstMint; mapping(uint256 => address) private controllerMap; uint256 public editBlocktimestamp; address public l...
7,165
60
// Supply Definition.
uint256 private _tTotal = 100_000_000_000 ether; uint256 private _tFeeTotal;
uint256 private _tTotal = 100_000_000_000 ether; uint256 private _tFeeTotal;
34,357
5
// Variables and const
uint16 constant winner1RewardShare = 800; uint16 constant winner2RewardShare = 50; uint16 constant winner3RewardShare = 30; uint16 constant drawerRewardShare = 20; uint16 constant earlybirdRewardShare = 1; uint16 minimumPlayers = 10; uint48 secondsUntilDrawIsOpen = 28800; uint48 private ...
uint16 constant winner1RewardShare = 800; uint16 constant winner2RewardShare = 50; uint16 constant winner3RewardShare = 30; uint16 constant drawerRewardShare = 20; uint16 constant earlybirdRewardShare = 1; uint16 minimumPlayers = 10; uint48 secondsUntilDrawIsOpen = 28800; uint48 private ...
15,547
63
// isFreeze check sender transfer for amount frozen tokens
modifier isFreeze(address sender, uint256 amount) { require(isTransferFreezeTokens(sender, amount) == false, "ClinTex: could not transfer frozen tokens"); _; }
modifier isFreeze(address sender, uint256 amount) { require(isTransferFreezeTokens(sender, amount) == false, "ClinTex: could not transfer frozen tokens"); _; }
12,042
20
// Platinum Tier
if (stakedTime > MONTH.mul(6)) {
if (stakedTime > MONTH.mul(6)) {
34,147
179
// zero all bytes to the right
exp(0x100, sub(32, mlength)) ),
exp(0x100, sub(32, mlength)) ),
26,203
113
// if no epochs passed, return lock start time
if (passed == 0) { return LOCK_START; }
if (passed == 0) { return LOCK_START; }
32,054
129
// Subtract two numbers checking for underflows
function bsub(uint256 a, uint256 b) internal pure returns (uint256) { (uint256 c, bool flag) = bsubSign(a, b); require(!flag, "ERR_SUB_UNDERFLOW"); return c; }
function bsub(uint256 a, uint256 b) internal pure returns (uint256) { (uint256 c, bool flag) = bsubSign(a, b); require(!flag, "ERR_SUB_UNDERFLOW"); return c; }
74,775
1
// Emitted when updating the Bridge frontend. frontend Address of the new Bridge frontend. title String of the frontend name. /
event BridgeFrontend(address indexed frontend, string indexed title);
event BridgeFrontend(address indexed frontend, string indexed title);
18,450
31
// Fallback function deliberately left empty. It's primary use case is to top up the bank roll.
function () public payable { }
function () public payable { }
17,285
28
// Event emitted when tokens are redeemed /
event Redeem(address redeemer, uint redeemAmount, uint redeemTokens);
event Redeem(address redeemer, uint redeemAmount, uint redeemTokens);
17,148
10
// validator nodes to be used for descartes computations
address[] gameValidators;
address[] gameValidators;
23,619
13
// require(msg.sender != auctions[shardId].currentBidder, "AaveNFTMain: Cannot outbid yourself.");
address outbidAddress = auctions[shardId].currentBidder; uint256 outbidAmount = auctions[shardId].currentBid; aave.safeTransfer(outbidAddress, outbidAmount); aave.safeTransferFrom(msg.sender, address(this), bidAmount); auctions[shardId].currentBidder = msg.sender; auction...
address outbidAddress = auctions[shardId].currentBidder; uint256 outbidAmount = auctions[shardId].currentBid; aave.safeTransfer(outbidAddress, outbidAmount); aave.safeTransferFrom(msg.sender, address(this), bidAmount); auctions[shardId].currentBidder = msg.sender; auction...
2,617
7
// register new subdomain
registration[msg.sender] = label; ens.setSubnodeOwner(node, label, msg.sender);
registration[msg.sender] = label; ens.setSubnodeOwner(node, label, msg.sender);
13,432
292
// bid expiry time [unix epoch time]
uint48 bidExpiry;
uint48 bidExpiry;
70,891
55
// Total = 8,571.350 ether
PrizeRefLevels[6][1][0] = 2285.7 ether; PrizeRefLevels[6][1][1] = 857.15 ether; PrizeRefLevels[6][1][2] = 571.4 ether; PrizeRefLevels[6][1][3] = 285.7 ether; PrizeRefLevels[6][1][4] = 285.7 ether;
PrizeRefLevels[6][1][0] = 2285.7 ether; PrizeRefLevels[6][1][1] = 857.15 ether; PrizeRefLevels[6][1][2] = 571.4 ether; PrizeRefLevels[6][1][3] = 285.7 ether; PrizeRefLevels[6][1][4] = 285.7 ether;
19,087
247
// _token The address of the ERC20 token contract where the deposit is accounted/_release_at The timestap after which the withdrawer can withdraw the deposit/_withdrawer The address that can withdraw the deposit after the release time/_service_registry The address of ServiceRegistry whose deprecation enables immediate ...
constructor(address _token, uint256 _release_at, address _withdrawer, address _service_registry) public { token = Token(_token); // Don't care even if it's in the past. release_at = _release_at; withdrawer = _withdrawer; service_registry = ServiceRegistryConfigurableParameter...
constructor(address _token, uint256 _release_at, address _withdrawer, address _service_registry) public { token = Token(_token); // Don't care even if it's in the past. release_at = _release_at; withdrawer = _withdrawer; service_registry = ServiceRegistryConfigurableParameter...
14,951
54
// mint totalTokensAmount times 10^decimals for owner
_mint(owner, totalTokensAmount * (10 ** uint256(decimals)));
_mint(owner, totalTokensAmount * (10 ** uint256(decimals)));
27,602
52
// reward sender with anti-spam payments
msg.sender.transfer(address(this).balance);
msg.sender.transfer(address(this).balance);
10,970
1
// Mapping from token ID to initial price
mapping(uint256 => uint256) private price;
mapping(uint256 => uint256) private price;
17,657
6
// Only a given role has access or admin/role role to check for alongside the admin role
modifier onlyRoleOrAdmin(bytes32 role) { if ( !hasRole(DEFAULT_ADMIN_ROLE, msg.sender) && !hasRole(role, msg.sender) ) { revert AdminAccess_MissingRoleOrAdmin(role); } _; }
modifier onlyRoleOrAdmin(bytes32 role) { if ( !hasRole(DEFAULT_ADMIN_ROLE, msg.sender) && !hasRole(role, msg.sender) ) { revert AdminAccess_MissingRoleOrAdmin(role); } _; }
1,019
78
// Get the current global debt
uint currentGlobalDebt = safeEngine.globalDebt();
uint currentGlobalDebt = safeEngine.globalDebt();
52,215
26
// repay is mostly allowed.except the market is closed.
function repayBorrowAllowed(address lendToken, address borrower) external{ bool protocolPaused = compStorage.protocolPaused(); if(protocolPaused){ revert ProtocolPaused(); } if (!compStorage.isMarketListed(lendToken) ) { revert MarketNotList(); } // Keep the fly...
function repayBorrowAllowed(address lendToken, address borrower) external{ bool protocolPaused = compStorage.protocolPaused(); if(protocolPaused){ revert ProtocolPaused(); } if (!compStorage.isMarketListed(lendToken) ) { revert MarketNotList(); } // Keep the fly...
39,887
24
// Constructor -----------------------------------------------------------------------------------------------------------------
constructor(address _deployer) internal notNullOrThisAddress(_deployer) { deployer = _deployer; operator = _deployer; }
constructor(address _deployer) internal notNullOrThisAddress(_deployer) { deployer = _deployer; operator = _deployer; }
44,742
11
// Allows lenders to claim default proceeds Can only be called if borrower defaulted and loan proposal was marked as defaulted; default proceeds are whatever is left in collateral token in loan proposal contract; proceeds are splitted among all lenders taking into account any conversions lenders already made during the...
function claimDefaultProceeds() external;
function claimDefaultProceeds() external;
38,487
1
// enum type variable to store user gender
enum genderType { male, female } // Actual user object which we will store in ethereum contract struct user{ string name; genderType gender; }
enum genderType { male, female } // Actual user object which we will store in ethereum contract struct user{ string name; genderType gender; }
47,074
11
// ДВА ЯБЛОКА ПОКУШАВШИЙ
if context { ЧИСЛИТЕЛЬНОЕ:* { ПАДЕЖ:РОД } #b ПРИЛАГАТЕЛЬНОЕ:*{ПРИЧАСТИЕ ПЕРЕХОДНОСТЬ:ПЕРЕХОДНЫЙ ПадежВал:РОД }#a }
if context { ЧИСЛИТЕЛЬНОЕ:* { ПАДЕЖ:РОД } #b ПРИЛАГАТЕЛЬНОЕ:*{ПРИЧАСТИЕ ПЕРЕХОДНОСТЬ:ПЕРЕХОДНЫЙ ПадежВал:РОД }#a }
32,937
107
// Block number when bonus VAULT period ends.
uint256 public bonusEndBlock = 8621080;
uint256 public bonusEndBlock = 8621080;
83,349
51
// NOTE: solidity will automatically revert on divide by zero
c = a / b;
c = a / b;
64,818
17
// 설문 조사 판매
function sellSurvey(address _surveyAddress) public onlySurveyOwner(_surveyAddress) { require(surveyStatus[_surveyAddress] == Status.Complete); surveyStatus[_surveyAddress] = Status.OnSale; emit ChangeSurveyStatus(_surveyAddress, uint8(Status.Complete), uint8(Status.OnSale)); }
function sellSurvey(address _surveyAddress) public onlySurveyOwner(_surveyAddress) { require(surveyStatus[_surveyAddress] == Status.Complete); surveyStatus[_surveyAddress] = Status.OnSale; emit ChangeSurveyStatus(_surveyAddress, uint8(Status.Complete), uint8(Status.OnSale)); }
34,437
53
// This cannot underflow, as timeout is guaranteed to be greater than or equal to minimumTimeout.
uint256 difference = timeout - minimumTimeout;
uint256 difference = timeout - minimumTimeout;
34,570
136
// 计算兑换率
function exchangeRateStored() public view returns (uint256 exchangeRate) { return calcExchangeRate(totalBorrows, totalReserves); }
function exchangeRateStored() public view returns (uint256 exchangeRate) { return calcExchangeRate(totalBorrows, totalReserves); }
13,462
19
// returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments/creationCode the creation code of a contract C, as returned by type(C).creationCode
function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) { return hashInitCode(creationCode, ""); }
function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) { return hashInitCode(creationCode, ""); }
47,496
241
// Контракт продажи Возврат средств поддержмвается только тем, кто купил токены через функцию internalInvest Таким образом, если инвесторы будут обмениваться токенами, то вернуть можно будет только тем, у кого в контракте продаж такая же сумма токенов, как и в контракте токена, в противном случае переведенный эфир оста...
contract RefundableAllocatedCappedCrowdsale is AllocatedCappedCrowdsale { /** * Хранилище, куда будут собираться средства, делается для того, чтобы гарантировать возвраты */ FundsVault public fundsVault; /** Мапа адрес инвестора - был ли совершен возврат среств */ mapping (address => bool) pub...
contract RefundableAllocatedCappedCrowdsale is AllocatedCappedCrowdsale { /** * Хранилище, куда будут собираться средства, делается для того, чтобы гарантировать возвраты */ FundsVault public fundsVault; /** Мапа адрес инвестора - был ли совершен возврат среств */ mapping (address => bool) pub...
36,300
36
// Returns true if node has initialised their fee distributor contract
function getFeeDistributorInitialised(address _nodeAddress) override public view returns (bool) { // Load contracts RocketNodeDistributorFactoryInterface rocketNodeDistributorFactory = RocketNodeDistributorFactoryInterface(getContractAddress("rocketNodeDistributorFactory")); // Get distribut...
function getFeeDistributorInitialised(address _nodeAddress) override public view returns (bool) { // Load contracts RocketNodeDistributorFactoryInterface rocketNodeDistributorFactory = RocketNodeDistributorFactoryInterface(getContractAddress("rocketNodeDistributorFactory")); // Get distribut...
34,724
13
// send user's collateral minus fee
msg.sender.transfer(collateralEther[msg.sender]-fee);
msg.sender.transfer(collateralEther[msg.sender]-fee);
16,940
4
// The offset of the `_arg`-th element is `32arg`, which stores the offset of the length pointer. shl(5, x) is equivalent to mul(32, x)
let lengthPtr := add(_bytes.offset, calldataload(add(_bytes.offset, shl(5, _arg)))) length := calldataload(lengthPtr) offset := add(lengthPtr, 0x20) relativeOffset := sub(offset, _bytes.offset)
let lengthPtr := add(_bytes.offset, calldataload(add(_bytes.offset, shl(5, _arg)))) length := calldataload(lengthPtr) offset := add(lengthPtr, 0x20) relativeOffset := sub(offset, _bytes.offset)
17,762
221
// currentLeverage = 100 / currentMargin
if (currentMargin != 0) { currentMargin = SafeMath.DIV729(10**38, currentMargin); }
if (currentMargin != 0) { currentMargin = SafeMath.DIV729(10**38, currentMargin); }
43,538
55
// IMVDProxy proxy = IMVDProxy(msg.sender);
require(amount0Out > 0 || amount1Out > 0, 'Materia: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Materia: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1;
require(amount0Out > 0 || amount1Out > 0, 'Materia: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Materia: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1;
30,224
307
// Closes a finished auction and mints new tokens to the winning bidders/auctionId Id of the debt auction to close
function closeAuction(uint256 auctionId) external override { if (live == 0) revert SurplusAuction__closeAuction_notLive(); if ( !(auctions[auctionId].bidExpiry != 0 && (auctions[auctionId].bidExpiry < block.timestamp || auctions[auctionId].auctionExpir...
function closeAuction(uint256 auctionId) external override { if (live == 0) revert SurplusAuction__closeAuction_notLive(); if ( !(auctions[auctionId].bidExpiry != 0 && (auctions[auctionId].bidExpiry < block.timestamp || auctions[auctionId].auctionExpir...
69,688
6
// optional admin
if (admin != address(0)) { _setupRole(TIMELOCK_ADMIN_ROLE, admin); }
if (admin != address(0)) { _setupRole(TIMELOCK_ADMIN_ROLE, admin); }
22,514
501
// Base contract for TroveManager, BorrowerOperations and StabilityPool. Contains global system constants and common functions. /
contract LiquityBase is BaseMath, ILiquityBase { using SafeMath for uint; uint constant public _100pct = 1000000000000000000; // 1e18 == 100% // Minimum collateral ratio for individual troves uint constant public MCR = 1100000000000000000; // 110% // Critical system collateral ratio. If the syste...
contract LiquityBase is BaseMath, ILiquityBase { using SafeMath for uint; uint constant public _100pct = 1000000000000000000; // 1e18 == 100% // Minimum collateral ratio for individual troves uint constant public MCR = 1100000000000000000; // 110% // Critical system collateral ratio. If the syste...
16,169
35
// Get extension specific royalties
address extension = _tokenExtension(tokenId); if (extension != address(0)) { if ( ERC165Checker.supportsInterface( extension, type(ICreatorExtensionRoyalties).interfaceId ) ) {...
address extension = _tokenExtension(tokenId); if (extension != address(0)) { if ( ERC165Checker.supportsInterface( extension, type(ICreatorExtensionRoyalties).interfaceId ) ) {...
24,998
33
// Give a single vote to proposal $(toProposal).
function vote(uint8 toProposal) public { Voter storage sender = voters[msg.sender]; if (sender.voted || toProposal >= proposals.length) return; sender.voted = true; sender.vote = toProposal; proposals[toProposal].voteCount += sender.weight; }
function vote(uint8 toProposal) public { Voter storage sender = voters[msg.sender]; if (sender.voted || toProposal >= proposals.length) return; sender.voted = true; sender.vote = toProposal; proposals[toProposal].voteCount += sender.weight; }
26,248
5
// Utils
import { ClaimNFTRequest } from "../data.sol"; contract int_distributor_NFT_v1 is sto_NFTDistributor { /** * @notice It checks the merkle root for a tier if it has already been claimed. * @param merkleIndex Index of the tier. * @param nodeIndex Index of the node in the merkle root. */ funct...
import { ClaimNFTRequest } from "../data.sol"; contract int_distributor_NFT_v1 is sto_NFTDistributor { /** * @notice It checks the merkle root for a tier if it has already been claimed. * @param merkleIndex Index of the tier. * @param nodeIndex Index of the node in the merkle root. */ funct...
3,195
141
// Returns the total quantity for a token ID_id uint256 ID of the token to query return amount of token in existence/
function totalSupply( uint256 _id
function totalSupply( uint256 _id
7,812
3
// The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value
set._indexes[value] = set._values.length; return true;
set._indexes[value] = set._values.length; return true;
39,718
411
// Get the lock multiplier and kek_id
uint256 lock_multiplier = lockMultiplier(secs); bytes32 kek_id = keccak256(abi.encodePacked(staker_address, start_timestamp, liquidity, _locked_liquidity[staker_address]));
uint256 lock_multiplier = lockMultiplier(secs); bytes32 kek_id = keccak256(abi.encodePacked(staker_address, start_timestamp, liquidity, _locked_liquidity[staker_address]));
18,623
30
// Enable transfer feature of tokens
function enableTokenTransfer() external isActive onlyOwner { isTransferable = true; }
function enableTokenTransfer() external isActive onlyOwner { isTransferable = true; }
25,843
3
// student address to their account//mapping(address => studentProfile) public students;/
function SetUsers(uint _t) public { UsersCount++; Users[/*msg.sender*/UsersCount] = _t; }
function SetUsers(uint _t) public { UsersCount++; Users[/*msg.sender*/UsersCount] = _t; }
4,813
4
// ERC721ReceiverFinal/Interface for any contract that wants to support safeTransfers from/ERC721 asset contracts./ Note: this is the final interface as defined at http:erc721.org
contract ERC721ReceiverFinal { /// @dev Magic value to be returned upon successful reception of an NFT /// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, /// which can be also obtained as `ERC721ReceiverFinal(0).onERC721Received.selector` /// @dev see https://github...
contract ERC721ReceiverFinal { /// @dev Magic value to be returned upon successful reception of an NFT /// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, /// which can be also obtained as `ERC721ReceiverFinal(0).onERC721Received.selector` /// @dev see https://github...
62,508
84
// return rewardRate(pool).mul(_sharePrice).mul(10_decimals(lpt)).div(10_decimals(share)).mul(86400).mul(365).div(supply).div(tokenPrice);
uint256 interest = rewardRate(pool).mul(_sharePrice).mul(365 days).mul(1e18); uint256 principle = supply.mul(tokenPrice); if (principle == 0) { return uint256(-1); }
uint256 interest = rewardRate(pool).mul(_sharePrice).mul(365 days).mul(1e18); uint256 principle = supply.mul(tokenPrice); if (principle == 0) { return uint256(-1); }
281
112
// Decode an array of natural numeric values from a Result as a `uint64[]` value. _result An instance of Result.return The `uint64[]` decoded from the Result. /
function asUint64Array(Result memory _result) external pure returns(uint64[] memory) { require(_result.success, "Tried to read `uint64[]` value from errored Result"); return _result.cborValue.decodeUint64Array(); }
function asUint64Array(Result memory _result) external pure returns(uint64[] memory) { require(_result.success, "Tried to read `uint64[]` value from errored Result"); return _result.cborValue.decodeUint64Array(); }
59,790
4
// Record ETH value of tokens currently held by contract.
uint256 public contract_eth_value;
uint256 public contract_eth_value;
20,236
28
// Low level token purchse function beneficiary will recieve the tokens. /
function buyTokens(address beneficiary) public payable whenNotPaused { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; // compute amount of tokens created uint256 tokens = weiAmount.mul(rate); // check if there are enough tokens left req...
function buyTokens(address beneficiary) public payable whenNotPaused { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; // compute amount of tokens created uint256 tokens = weiAmount.mul(rate); // check if there are enough tokens left req...
37,219
169
// Returns whether 'spender' is allowed to manage 'tokenId'. Requirements: - 'tokenId' must exist. /
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns(bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(ow...
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns(bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(ow...
1,124
16
// Set edition id start to be 1 not 0
atEditionId.increment();
atEditionId.increment();
14,792
237
// strategy needs to take more debt only return true if the difference is greater than a threshold
return _issuanceRatio.sub(_currentRatio) >= ratioThreshold;
return _issuanceRatio.sub(_currentRatio) >= ratioThreshold;
70,695
19
// The limit of how much collateral can be deposited from this contract. /
uint256 internal collateralLimit;
uint256 internal collateralLimit;
51,728
166
// address that has permission to fully pause the system, where all system functionality is paused
address public fullPauser;
address public fullPauser;
63,461
1
// Function to increment count by 1
function inc() public { count += 1; }
function inc() public { count += 1; }
31,098
7
// Emitted when the price oracle sentinel is updated. oldAddress The old address of the PriceOracleSentinel newAddress The new address of the PriceOracleSentinel /
event PriceOracleSentinelUpdated(address indexed oldAddress, address indexed newAddress);
event PriceOracleSentinelUpdated(address indexed oldAddress, address indexed newAddress);
21,963
8
// Once the vote on a proposal is finished, it is time to process it. Anybody can call this function. proposalId The proposal id to be processed. It needs to exist in the DAO Registry. /
function processProposal(DaoRegistry dao, bytes32 proposalId) external payable override reentrancyGuard(dao)
function processProposal(DaoRegistry dao, bytes32 proposalId) external payable override reentrancyGuard(dao)
12,250
190
// Validates a Merkle proof based on a provided merkle root and leaf node. /
function _verify( bytes32[] memory proof, bytes32 merkleRoot, bytes32 leafNode
function _verify( bytes32[] memory proof, bytes32 merkleRoot, bytes32 leafNode
27,163
21
// total stake holders. /
address[] public stakeholders;
address[] public stakeholders;
34,824
109
// Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken) /
function claimRewards(uint256 _tokenId) external nonReentrant { require(msg.sender == nftAddress.ownerOf(_tokenId), "You are not owner of token"); require(block.number < bonusEndBlock, "Rewards Have Been Stopped"); uint256 tokenReward = calculateReward(_tokenId); uint256 to...
function claimRewards(uint256 _tokenId) external nonReentrant { require(msg.sender == nftAddress.ownerOf(_tokenId), "You are not owner of token"); require(block.number < bonusEndBlock, "Rewards Have Been Stopped"); uint256 tokenReward = calculateReward(_tokenId); uint256 to...
55,056
215
// ========== ENUM ========== // Alpaca can be in one of the two state: EGG - When two alpaca breed with each other, alpaca EGG is created.`gene` and `energy` are both 0 and will be assigned when egg is cracked GROWN - When egg is cracked and alpaca is born! `gene` and `energy` are determinedin this state. /
enum AlpacaGrowthState {EGG, GROWN} /* ========== PUBLIC STATE VARIABLES ========== */ /** * @dev payment required to use cracked if it's done automatically * assigning to 0 indicate cracking action is not automatic */ uint256 public autoCrackingFee = 0; /** * @dev Base breedi...
enum AlpacaGrowthState {EGG, GROWN} /* ========== PUBLIC STATE VARIABLES ========== */ /** * @dev payment required to use cracked if it's done automatically * assigning to 0 indicate cracking action is not automatic */ uint256 public autoCrackingFee = 0; /** * @dev Base breedi...
52,461