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
178
// if _amountNeeded is more than currently available, need to unstake some and/or sell rewards to free up assets
uint256 unstaked = balanceOfUnstaked(); if (_amountNeeded > unstaked) { uint256 desiredWithdrawAmount = _amountNeeded.sub(unstaked);
uint256 unstaked = balanceOfUnstaked(); if (_amountNeeded > unstaked) { uint256 desiredWithdrawAmount = _amountNeeded.sub(unstaked);
74,879
230
// burn the tokens that have not been sold yet
function burnTokens() public onlyOwner { maxTotalTokens = totalSupply(); }
function burnTokens() public onlyOwner { maxTotalTokens = totalSupply(); }
7,174
9
// Update the artwork's status and ownership
Artwork storage current = artworks[_artworkId]; require(current.status == 0, "Rejected"); current.status++; current.currentOwner = payable(msg.sender); current.quantity--;
Artwork storage current = artworks[_artworkId]; require(current.status == 0, "Rejected"); current.status++; current.currentOwner = payable(msg.sender); current.quantity--;
14,069
28
// no consensus, challenge failed.
for (uint i = 0; i < numAgrees; i++) { consensus_strikes[agrees[i]] += 2; if (consensus_strikes[agrees[i]] > FAIL_THRESHOLD) { reward += penalize(agrees[i]); }
for (uint i = 0; i < numAgrees; i++) { consensus_strikes[agrees[i]] += 2; if (consensus_strikes[agrees[i]] > FAIL_THRESHOLD) { reward += penalize(agrees[i]); }
43,921
14
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0;
bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0;
12,754
11
// Simulate the swap fee
uint256 fee = outputAmount.mul(swapFee).div(FEE_DENOMINATOR); outputAmount = outputAmount.sub(fee);
uint256 fee = outputAmount.mul(swapFee).div(FEE_DENOMINATOR); outputAmount = outputAmount.sub(fee);
1,690
20
// Convert `_wei` to an amount in tokens using the current rate_wei amount of wei to convertreturn The amount in tokens /
function toTokens(uint256 _wei) returns (uint256 amount) { uint256 rate = 0; if (stage != Stages.Ended && now >= start && now <= end) { // Check for preico if (now <= start + ratePreICOEnd) { rate = ratePreICO; } // Check for waiting ...
function toTokens(uint256 _wei) returns (uint256 amount) { uint256 rate = 0; if (stage != Stages.Ended && now >= start && now <= end) { // Check for preico if (now <= start + ratePreICOEnd) { rate = ratePreICO; } // Check for waiting ...
3,798
45
// Create a new vesting schedule A transfer is used to bring tokens into the VestingDepositAccount so pre-approval is required _beneficiary beneficiary of the vested tokens _amount amount of tokens (in wei) /
function createVestingSchedule(address _beneficiary, uint256 _amount) external returns (bool) { require(msg.sender == owner, "VestingContract::createVestingSchedule: Only Owner"); return _createVestingSchedule(_beneficiary, _amount); }
function createVestingSchedule(address _beneficiary, uint256 _amount) external returns (bool) { require(msg.sender == owner, "VestingContract::createVestingSchedule: Only Owner"); return _createVestingSchedule(_beneficiary, _amount); }
18,210
199
// Deposit LP tokens to Trainer for CRZF allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accCharizardPerShare).div(1e12).sub(user.re...
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accCharizardPerShare).div(1e12).sub(user.re...
27,819
0
// The Birth event is fired whenever a new kitten comes into existence. This obviously/includes any time a cat is created through the giveBirth method, but it is also called/when a new gen0 cat is created.
event Birth(address owner, uint256 kittyId, uint256 matronId, uint256 sireId, uint256 genes);
event Birth(address owner, uint256 kittyId, uint256 matronId, uint256 sireId, uint256 genes);
3,959
9
// Withdraws to address _to form the address _from up to the amount _value /
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0 && balances[_to] + _value > balances[_to]) { balances[_from] = balances[_fro...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0 && balances[_to] + _value > balances[_to]) { balances[_from] = balances[_fro...
2,902
105
// If its bigger than 0 we handle
if(tokenBeingWrappedBalChange > 0) { totalWrapTokenContributed = totalWrapTokenContributed.add(tokenBeingWrappedBalChange);
if(tokenBeingWrappedBalChange > 0) { totalWrapTokenContributed = totalWrapTokenContributed.add(tokenBeingWrappedBalChange);
37,591
12
// Admin parametersDefine administration parameters for this contract/
contract admined { //This token contract is administered address public admin; //Master address is public mapping(address => uint256) public level; //Admin level bool public lockSupply; //Burn Lock flag /** * @dev Contract constructor * define initial administrator */ constructor() publ...
contract admined { //This token contract is administered address public admin; //Master address is public mapping(address => uint256) public level; //Admin level bool public lockSupply; //Burn Lock flag /** * @dev Contract constructor * define initial administrator */ constructor() publ...
68,470
227
// ============ Helper ============ //Returns whether the SetToken has a default position for a given component (if the real unit is > 0) /
function hasDefaultPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getDefaultPositionRealUnit(_component) > 0; }
function hasDefaultPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getDefaultPositionRealUnit(_component) > 0; }
2,779
553
// in 2019, stars may spawn at most 1024 planets. this limit doublesfor every subsequent year.Note: 1546300800 corresponds to 2019-01-01
uint256 yearsSince2019 = (_time - 1546300800) / 365 days; if (yearsSince2019 < 6) { limit = uint32( 1024 * (2 ** yearsSince2019) ); }
uint256 yearsSince2019 = (_time - 1546300800) / 365 days; if (yearsSince2019 < 6) { limit = uint32( 1024 * (2 ** yearsSince2019) ); }
52,087
14
// Begins new feature, approved and signed by COO./_cutieId - ID of token to auction, sender must be owner./_parameter - arbitrary parameter
function runSigned( uint40 _cutieId, uint256 _parameter, address _owner ) external payable; function withdraw() public;
function runSigned( uint40 _cutieId, uint256 _parameter, address _owner ) external payable; function withdraw() public;
50,530
191
// Trigger harvest only if strategy has rewards, otherwise, there's nothing to harvest. This logic is added on top of existing gas efficient harvestTrigger() in the parent class
function harvestTrigger(uint256 callCost) public override view returns (bool) { return super.harvestTrigger(_estimateAmountsOut(callCost, wethWantPath)) && balanceOfReward() > 0 && netPositive(); }
function harvestTrigger(uint256 callCost) public override view returns (bool) { return super.harvestTrigger(_estimateAmountsOut(callCost, wethWantPath)) && balanceOfReward() > 0 && netPositive(); }
16,054
134
// Same as {xref-ERC721-_safeMint-address-uint-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. /
function _safeMint( address to, uint tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" );
function _safeMint( address to, uint tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" );
8,972
23
// Constructor/ofCompetition Address of the competition contract
function CompetitionCompliance(address ofCompetition) public { competitionAddress = ofCompetition; }
function CompetitionCompliance(address ofCompetition) public { competitionAddress = ofCompetition; }
38,208
116
// Returns the token collection name. /
function name() external view returns(string memory);
function name() external view returns(string memory);
19,801
221
// PRIVILEGED GOVERNANCE FUNCTION. Delegate votes using signature to 'delegatee'Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half o...
function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s, bool prefix
function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s, bool prefix
34,070
146
// Looks up the canonical identifier for a local representation. If no such canonical ID is known, this instead returns (0, bytes32(0)) _local The local address of the representation /
function getCanonicalAddress(address _local) external view returns (uint32 _domain, bytes32 _id)
function getCanonicalAddress(address _local) external view returns (uint32 _domain, bytes32 _id)
65,658
136
// Emitted when the earnings of a maturity are updated./timestamp current timestamp./maturity maturity date where the earnings were updated./unassignedEarnings pending unassigned earnings.
event FixedEarningsUpdate(uint256 timestamp, uint256 indexed maturity, uint256 unassignedEarnings);
event FixedEarningsUpdate(uint256 timestamp, uint256 indexed maturity, uint256 unassignedEarnings);
24,457
10
// Borrow AVAX/ARC20_Token using the Mapping. Borrow a token using Benqi tokenId The token id of the token to borrow.(For eg: DAI-A) amt The amount of the token to borrow. getId ID to retrieve amt. setId ID stores the amount of tokens borrowed./
function borrow( string calldata tokenId, uint256 amt, uint256 getId, uint256 setId
function borrow( string calldata tokenId, uint256 amt, uint256 getId, uint256 setId
43,367
7
// Helper to check balance based on shares ownership._payee Address of user whose balance we are checking. _shares Eligible shares of user. /
function balanceByShares(address _payee, uint256 _shares) public view returns (uint256) { return address(this).balance.add(totalReleased).mul(_shares).div(totalShares).sub(released[_payee]); }
function balanceByShares(address _payee, uint256 _shares) public view returns (uint256) { return address(this).balance.add(totalReleased).mul(_shares).div(totalShares).sub(released[_payee]); }
35,467
162
// Wrappers over Solidity's uintXX casting operators with added overflowchecks. Downcasting from uint256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usuallyassume that overflows raise errors. `SafeCast` restores this intuition by reverting the tran...
* Can be combined with {SafeMath} to extend it to smaller types, by performing * all math on `uint256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart...
* Can be combined with {SafeMath} to extend it to smaller types, by performing * all math on `uint256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart...
6,758
1,222
// UniswapV2Adapter Contract/Enzyme Council <[email protected]>/Adapter for interacting with Uniswap v2
contract UniswapV2Adapter is AdapterBase { using SafeMath for uint256; address private immutable FACTORY; address private immutable ROUTER; constructor( address _integrationManager, address _router, address _factory
contract UniswapV2Adapter is AdapterBase { using SafeMath for uint256; address private immutable FACTORY; address private immutable ROUTER; constructor( address _integrationManager, address _router, address _factory
83,196
9
// Scale the returned price value down to Liquity's target precision
price = _price.div(10**(_answerDigits - TARGET_DIGITS));
price = _price.div(10**(_answerDigits - TARGET_DIGITS));
41,536
37
// Required for ERC-721 compliance. return bool/
function implementsERC721() public pure returns (bool) { return true; }
function implementsERC721() public pure returns (bool) { return true; }
40,912
208
// Update the given pool's JOE allocation point. Can only be called by the owner.
function set( uint256 _pid, uint256 _allocPoint
function set( uint256 _pid, uint256 _allocPoint
9,098
38
// Pulls `_amount` of `_token` from `_safe` to this contract._safe The safe address. _token The token address. _amount The amount /
function _pullFee(Safe _safe, address _token, uint256 _amount) internal { if (_token == address(0) || _token == EL_DIEGO) { // solium-disable-next-line security/no-send bool result = _safe.execTransactionFromModule(payable(address(this)), _amount, "", Enum.Operation.Call); ...
function _pullFee(Safe _safe, address _token, uint256 _amount) internal { if (_token == address(0) || _token == EL_DIEGO) { // solium-disable-next-line security/no-send bool result = _safe.execTransactionFromModule(payable(address(this)), _amount, "", Enum.Operation.Call); ...
44,704
29
// Used by the owner to withdraw the eth raised during the sale.
function withdrawETH() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
function withdrawETH() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
58,919
1
// Event emitted when artist attribution is set for a generation. generation the generation that attribution was set for artist the artist who created the artwork for the generation infoURI the artist's website / portfolio URI /
event AttributionSet(Generation generation, string artist, string infoURI);
event AttributionSet(Generation generation, string artist, string infoURI);
34,716
0
// ------ EVENTS ------
event _Application(bytes32 listing, uint deposit); event _Challenge(bytes32 listing, uint deposit, uint pollID); event _Deposit(bytes32 listing, uint added, uint newTotal); event _Withdrawal(bytes32 listing, uint withdrew, uint newTotal); event _NewListingWhitelisted(bytes32 listing); event _Ap...
event _Application(bytes32 listing, uint deposit); event _Challenge(bytes32 listing, uint deposit, uint pollID); event _Deposit(bytes32 listing, uint added, uint newTotal); event _Withdrawal(bytes32 listing, uint withdrew, uint newTotal); event _NewListingWhitelisted(bytes32 listing); event _Ap...
393
218
// Addresses
address public DexRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public RewardToken = 0xc2FD70fc04f7D15E63FF230075741957963B2152; address private TeamReceiver = 0x8486fBCab3531105b7fb86A7C80147f4e098bA46; // Team address private CreatorReceiver = 0x8486fBCab3531105b7fb86A7C80147f4e098bA46;...
address public DexRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public RewardToken = 0xc2FD70fc04f7D15E63FF230075741957963B2152; address private TeamReceiver = 0x8486fBCab3531105b7fb86A7C80147f4e098bA46; // Team address private CreatorReceiver = 0x8486fBCab3531105b7fb86A7C80147f4e098bA46;...
16,313
13
// The address of the DAO reputation token
ReputationInterface public rep;
ReputationInterface public rep;
27,136
13
// Checks whether the vault has enough lpToken (+ rewards) to redeem for the specified amount of shares _vault Vault contract address _underlyingToken Underlying token address for the given liquidity pool _liquidityPool Liquidity pool's contract address from where to redeem the tokens _redeemAmount Amount of lpToken (+...
function isRedeemableAmountSufficient(
function isRedeemableAmountSufficient(
33,983
51
// Elimina registro de prestamos al encargado asociado
prestamos[msg.sender] = 0;
prestamos[msg.sender] = 0;
2,214
863
// _triggerExternalLiquidityTrade(); p2.internalLiquiditySwap(coverCurr);
tf.burnStakerLockedToken(coverid, coverCurr, sumAssured);
tf.burnStakerLockedToken(coverid, coverCurr, sumAssured);
29,416
22
// bob approves alice to transfer id 2
vm.prank(bob); erc721b.approve(alice, 2); assertEq(erc721b.getApproved(1), address(0)); assertEq(erc721b.getApproved(2), alice); vm.startPrank(alice);
vm.prank(bob); erc721b.approve(alice, 2); assertEq(erc721b.getApproved(1), address(0)); assertEq(erc721b.getApproved(2), alice); vm.startPrank(alice);
48,196
0
// ETf1 (Proposal Appendix)
function voteOnProposal(uint256 _id, bool _approve)
function voteOnProposal(uint256 _id, bool _approve)
13,423
22
// | bytes4(keccak256("isValidSignature(bytes,bytes)"))
bytes4 constant internal ERC1271_MAGICVALUE = 0x20c13b0b;
bytes4 constant internal ERC1271_MAGICVALUE = 0x20c13b0b;
33,932
20
// lets get the current token balance of the _tokenRecipient
uint256 _recipientTokenBalance = tokenContract.balanceOf(_tokenRecipient);
uint256 _recipientTokenBalance = tokenContract.balanceOf(_tokenRecipient);
23,932
56
// BiFi Liquidation Manager ContractBiFi /
contract etherLiquidationManager is liquidationManagerInterface, LiquidationManagerErrors { event CircuitBreaked(bool breaked, uint256 blockNumber); address payable owner; bool emergency = false; uint256 constant unifiedPoint = 10 ** 18; marketManagerInterface public marketManager; struct LiquidationModel { ...
contract etherLiquidationManager is liquidationManagerInterface, LiquidationManagerErrors { event CircuitBreaked(bool breaked, uint256 blockNumber); address payable owner; bool emergency = false; uint256 constant unifiedPoint = 10 ** 18; marketManagerInterface public marketManager; struct LiquidationModel { ...
78,016
132
// function to calculate square root of a number/
function sqrt(uint x) internal pure returns (uint y) { uint z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } }
function sqrt(uint x) internal pure returns (uint y) { uint z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } }
28,237
2
// used by the messaging library to publish verified payload_srcChainId - the source chain identifier_srcAddress - the source contract (as bytes) at the source chain_dstAddress - the address on destination chain_nonce - the unbound message ordering nonce_gasLimit - the gas limit for external contract execution_payload ...
function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;
function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;
34,720
43
// DAI Token
i = 0;
i = 0;
53,632
63
// Check the signature length
if (sig.length != 65) { return (address(0)); }
if (sig.length != 65) { return (address(0)); }
6,899
0
// Policy commissions code. /
interface IPolicyCommissionsFacet { /** * @dev Payout commission balances. */ function payCommissions () external; /** * @dev Get accumulated commission balances. * * Note that these balances do not include amounts that have already been paid out (see `payCommissions()`). * * @return brokerC...
interface IPolicyCommissionsFacet { /** * @dev Payout commission balances. */ function payCommissions () external; /** * @dev Get accumulated commission balances. * * Note that these balances do not include amounts that have already been paid out (see `payCommissions()`). * * @return brokerC...
36,220
4
// Gets the pending repaid amount to withdraw by the lenderdeposit - loan deposit addresslender - lender address/
function getWithdrawAmount(address deposit, address lender) external view
function getWithdrawAmount(address deposit, address lender) external view
4,196
25
// Claims game has ended due to a timeout./_index index identifying the game
function claimTimeout(uint256 _index) public onlyActive(_index) { GameContext storage context = instances[_index]; if (context.claimTimeout(_index)) { // game ended by timeout deactivate(_index); } }
function claimTimeout(uint256 _index) public onlyActive(_index) { GameContext storage context = instances[_index]; if (context.claimTimeout(_index)) { // game ended by timeout deactivate(_index); } }
37,882
95
// perRate represents the interest rate of the user's midterm bonds
uint256 perRate = 0; if (investors[investor].per.currentBalance > 0) { if (investors[investor].per.currentHolding < DECIMALS.mul(12)) { if (investors[investor].per.currentBalance < DECIMALS.mul(800)) { perRate = 850; }
uint256 perRate = 0; if (investors[investor].per.currentBalance > 0) { if (investors[investor].per.currentHolding < DECIMALS.mul(12)) { if (investors[investor].per.currentBalance < DECIMALS.mul(800)) { perRate = 850; }
7,538
60
// we are setting this here before the CALL() value transfer to assure that in the case of a malicious recipient contract trying to call executeProposal() recursively money can't be transferred multiple times out of the DAO
lastTimeMinQuorumMet = block.timestamp; p.proposalPassed = true;
lastTimeMinQuorumMet = block.timestamp; p.proposalPassed = true;
36,596
47
// When document key personal-portion retrieval request is received.
event DocumentKeyPersonalRetrievalRequested(bytes32 serverKeyId, bytes requesterPublic);
event DocumentKeyPersonalRetrievalRequested(bytes32 serverKeyId, bytes requesterPublic);
41,952
48
// Returns true if the slice is empty (has a length of 0). self The slice to operate on.return True if the slice is empty, False otherwise. /
function empty(slice self) internal returns (bool) { return self._len == 0; }
function empty(slice self) internal returns (bool) { return self._len == 0; }
4,223
11
// The ZKP has block headers for [startBlockNumber, endBlockNumber] blocks. We extract some common information from the calldata.
function getBoundaryBlockData(bytes calldata proofData) internal pure returns (bytes32 prevHash, bytes32 endHash, uint32 startBlockNumber, uint32 endBlockNumber, bytes32 root)
function getBoundaryBlockData(bytes calldata proofData) internal pure returns (bytes32 prevHash, bytes32 endHash, uint32 startBlockNumber, uint32 endBlockNumber, bytes32 root)
5,944
34
// Public function that sets the maximum number of ERC721 tokens that exist under this contract.If supply is reduced below the number of tokens that have already been minted, tokens above thethreshold WILL be burned and lost forever. Not sure how much I love this function, so it'sbehavior will likely be revisited in th...
function setSupply(uint16 newSupply, uint256 confirmation) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { // Require a confirmation code to prevent accidental burn require(confirmation == 73435567465418567456694564986745984357984); for (uint16 i = maxSupply; i > newSupply; --i) { ...
function setSupply(uint16 newSupply, uint256 confirmation) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { // Require a confirmation code to prevent accidental burn require(confirmation == 73435567465418567456694564986745984357984); for (uint16 i = maxSupply; i > newSupply; --i) { ...
20,180
8
// Marks deal as prepared. Can only be called by the contractor and only from the initial state. /
function markPrepared() public virtual onlyContractor { require(state == INIT_STATE, "Invalid transition"); _markPrepared(); }
function markPrepared() public virtual onlyContractor { require(state == INIT_STATE, "Invalid transition"); _markPrepared(); }
25,997
186
// Pause Presale
function pausePreSale() external onlyOwner { preSaleIsActive = false; }
function pausePreSale() external onlyOwner { preSaleIsActive = false; }
76,304
101
// Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`._from the address of the sender _value the amount of money to burn /
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balances[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowed[_from][msg.sender]); // Check allowance balances[_from] -= _value; // Subtrac...
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balances[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowed[_from][msg.sender]); // Check allowance balances[_from] -= _value; // Subtrac...
19,903
158
// get current active loans in the system/start of the index/count number of loans to return/unsafeOnly boolean if true return unsafe loan only (open for liquidation)/isLiquidatable boolean if true return liquidatable loans only
function getActiveLoansAdvanced( uint256 start, uint256 count, bool unsafeOnly, bool isLiquidatable ) external view returns (LoanReturnData[] memory loansData); function getActiveLoansCount() external view returns (uint256);
function getActiveLoansAdvanced( uint256 start, uint256 count, bool unsafeOnly, bool isLiquidatable ) external view returns (LoanReturnData[] memory loansData); function getActiveLoansCount() external view returns (uint256);
45,408
373
// Return `true` if the account belongs to the user role.
function isStaticUser(address account) public virtual view returns (bool)
function isStaticUser(address account) public virtual view returns (bool)
14,378
11
// if we're here, we need to iterate over the next pool in the path
path = path.skipToken(); previousTokenIn = tokenIn;
path = path.skipToken(); previousTokenIn = tokenIn;
24,792
41
// get the most recently reported answer[deprecated] Use latestRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point toan already answered Aggregator or use the recommended latestRoundDatainstead which includes better verification information. /
function latestAnswer() public view virtual override returns (int256)
function latestAnswer() public view virtual override returns (int256)
74,380
173
// Returns the minimal required dVIX to liquidate a Vault _vaultId of the vault to liquidatereturn amount required of the dVIX Token LT = ((((Dr) / 100) - cDVIX)100) / (r - (p + 100))cDVIX = ((Ccp) / P)LT = Required Liquidation dVIX (i.e. the Liquidation Threshold)D = Vault DebtC = Required CollateralP = dVIX Token Pri...
function requiredLiquidationDVIX(uint256 _vaultId) public view virtual returns (uint256 amount)
function requiredLiquidationDVIX(uint256 _vaultId) public view virtual returns (uint256 amount)
5,223
0
// Public variables of the token
string public name; string public symbol; uint8 public decimals = 8;
string public name; string public symbol; uint8 public decimals = 8;
2,400
1
// Retrieving the adopters
function getAdopters() public view returns (address[16] memory) { // memory return adopters; //gives the data location for the variable }
function getAdopters() public view returns (address[16] memory) { // memory return adopters; //gives the data location for the variable }
53,119
79
// ========== INTERNAL VIEW FUNCTIONS ========== //Calculate current market price of payout token in quote tokens/ See marketPrice() in IBondAuctioneer for explanation of price computation/ Uses info from storage because data has been updated before call (vs marketPrice())/id_Market ID/ return Price for market in payou...
function _currentMarketPrice(uint256 id_) internal view returns (uint256) { BondMarket memory market = markets[id_]; return terms[id_].controlVariable.mulDiv(market.totalDebt, market.scale); }
function _currentMarketPrice(uint256 id_) internal view returns (uint256) { BondMarket memory market = markets[id_]; return terms[id_].controlVariable.mulDiv(market.totalDebt, market.scale); }
5,555
50
// Have fun reading it. Hopefully it's bug-free. God bless.
contract BooDao is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; struct LockedItem { uint256 amount; uint256 release; } // Info of each user. struct UserInfo { uint256 amount; ...
contract BooDao is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; struct LockedItem { uint256 amount; uint256 release; } // Info of each user. struct UserInfo { uint256 amount; ...
26,039
9
// JP25.00%
jp2.transfer(div(mul(msg.value,500),10000));
jp2.transfer(div(mul(msg.value,500),10000));
41,387
0
// Marketplace Mintnote: Should Be Implemented With onlyMarketplace Access Modifiernote: Should Return The TokenID Being Transferred To The Recipient / function _MintToFactory(uint ProjectID, address Recipient, uint Amount) external virtual; EXAMPLE: function _MintToFactory(uint ProjectID, address Recipient, uint Amoun...
// { // require(totalSupply() + Amount <= 100, "MP: Max Supply Reached"); // _mint(Recipient, Amount); // }
// { // require(totalSupply() + Amount <= 100, "MP: Max Supply Reached"); // _mint(Recipient, Amount); // }
33,306
49
// records the number of days between the last payout time and now
uint activeDays = (now.sub(lastClock[_stakeholder])).div(86400);
uint activeDays = (now.sub(lastClock[_stakeholder])).div(86400);
9,760
42
// solhint-disable-next-line no-inline-assembly
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
2,071
59
// Admin can change APY% (or reward rate %) Changing reward rate percent will also affect user's pending earnings Be careful while using this function
function setRewardRatePercentX100(uint _rewardRatePercentX100) public onlyOwner { rewardRatePercentX100 = _rewardRatePercentX100; }
function setRewardRatePercentX100(uint _rewardRatePercentX100) public onlyOwner { rewardRatePercentX100 = _rewardRatePercentX100; }
79,674
0
// Label for files /
struct Label { bytes28 name; // Label name bytes4 color; // Label color }
struct Label { bytes28 name; // Label name bytes4 color; // Label color }
39,038
126
// Returns the value stored in the pool. /
function tokensHere() public virtual view returns (uint256) { return token.balanceOf(address(this)); }
function tokensHere() public virtual view returns (uint256) { return token.balanceOf(address(this)); }
42,616
25
// Withdraw balance to the owners
function withdraw() public onlyOwner { payable(owner()).transfer(address(this).balance); }
function withdraw() public onlyOwner { payable(owner()).transfer(address(this).balance); }
25,208
12
// return NEON token address
function neonTokenAddress() external view returns (address) { return _neonTokenAddress; }
function neonTokenAddress() external view returns (address) { return _neonTokenAddress; }
17,010
15
// ESCROW PROTOCOL ------------------------ /Deposits tokens (ERC-20/721) into escrow- locked funds can be released by `msg.sender` `depositor`
// - both parties can {lock} for `resolver`. /// @param receiver The account that receives funds. /// @param resolver The account that unlock funds. /// @param token The asset used for funds. /// @param value The amount of funds - if `nft`, the 'tokenId' in first value is used. /// @param termi...
// - both parties can {lock} for `resolver`. /// @param receiver The account that receives funds. /// @param resolver The account that unlock funds. /// @param token The asset used for funds. /// @param value The amount of funds - if `nft`, the 'tokenId' in first value is used. /// @param termi...
16,321
14
// Returns the TREX version of the token.current version is 3.0.0 /
function version() external view returns (string memory);
function version() external view returns (string memory);
34,840
12
// 컨트랙트 설명 확인
function getDescription(bytes32 _name) constant public returns (bytes32) { return contracts[_name].description; }
function getDescription(bytes32 _name) constant public returns (bytes32) { return contracts[_name].description; }
29,900
203
// callable by the DAO Council multisig, we can instantly remove a group of malicious contracts / approvals (no delay needed from DAO voting)
function emergencyRemoveWhitelist(WhitelistData[] calldata _rmActions, Approves[] calldata _newDepprovals) external { require(msg.sender == daoCouncilMultisig, "FARMBOSSV1: !multisig"); require(_rmActions.length.add(_newDepprovals.length) <= LOOP_LIMIT, "FARMBOSSV1: >LOOP_LIMIT"); // dont allow unbo...
function emergencyRemoveWhitelist(WhitelistData[] calldata _rmActions, Approves[] calldata _newDepprovals) external { require(msg.sender == daoCouncilMultisig, "FARMBOSSV1: !multisig"); require(_rmActions.length.add(_newDepprovals.length) <= LOOP_LIMIT, "FARMBOSSV1: >LOOP_LIMIT"); // dont allow unbo...
69,624
0
// iTokenBalance
{ /// @return {uint256} number of `owner`'s tokens function balanceOf( address owner )external view returns( uint256 ); /// @return {uint256} number of `caller`'s tokens //function balanceOf( //)external view returns( //uint256 //); /// /// @return {a...
{ /// @return {uint256} number of `owner`'s tokens function balanceOf( address owner )external view returns( uint256 ); /// @return {uint256} number of `caller`'s tokens //function balanceOf( //)external view returns( //uint256 //); /// /// @return {a...
32,578
41
// set to false for no fee on buys
bool takeFee = true; if(from != owner() && to != owner()) { if(_cooldownEnabled) { if(!cooldown[msg.sender].exists) { cooldown[msg.sender] = User(0,0,true); }
bool takeFee = true; if(from != owner() && to != owner()) { if(_cooldownEnabled) { if(!cooldown[msg.sender].exists) { cooldown[msg.sender] = User(0,0,true); }
33,963
68
// https:explorer.optimism.io/address/0xf86048DFf23cF130107dfB4e6386f574231a5C65
address public constant new_FuturesMarketETH_contract = 0xf86048DFf23cF130107dfB4e6386f574231a5C65;
address public constant new_FuturesMarketETH_contract = 0xf86048DFf23cF130107dfB4e6386f574231a5C65;
52,159
186
// ==========Constants========== // ==========Storage========== // ==========Constructor========== /
constructor(address _oldContract) { oldContract = _oldContract; }
constructor(address _oldContract) { oldContract = _oldContract; }
55,108
12
// Variables = New= Undeveloped
address internal AXPRtoken; mapping(address => string) public profileHashed; // User Prime
address internal AXPRtoken; mapping(address => string) public profileHashed; // User Prime
39,366
13
// This is internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.This inten...
function _transfer( address sender, address recipient, uint256 amount ) internal virtual override { require(false); super._transfer(sender, recipient, amount); }
function _transfer( address sender, address recipient, uint256 amount ) internal virtual override { require(false); super._transfer(sender, recipient, amount); }
36,471
255
// get the price for the next tick
step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);
step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);
11,383
41
// Optimised for front-end Address Provider interface
interface IAppAddressProvider { function getDataCompressor() external view returns (address); function getGearToken() external view returns (address); function getWethToken() external view returns (address); function getWETHGateway() external view returns (address); function getPriceOracle() ext...
interface IAppAddressProvider { function getDataCompressor() external view returns (address); function getGearToken() external view returns (address); function getWethToken() external view returns (address); function getWETHGateway() external view returns (address); function getPriceOracle() ext...
30,372
34
// Addition to StandardToken methods. Increase the amount of tokens thatan owner allowed to a spender and execute a call with the sent data. approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From ...
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) { require(_spender != address(this)); super.increaseApproval(_spender, _addedValue); require(_spender.call(_data)); return true; }
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) { require(_spender != address(this)); super.increaseApproval(_spender, _addedValue); require(_spender.call(_data)); return true; }
53,133
59
// update _invite info
require(_invite != address(0) ,"invite cannot be null" ); user.invite = _invite; referArr[_invite].push(msg.sender); uint counterTmp = serialAddr[_invite]; if (serialUser[counterTmp].depoistTime == 0){ if (serialUser[counterTmp].withdrawPermis...
require(_invite != address(0) ,"invite cannot be null" ); user.invite = _invite; referArr[_invite].push(msg.sender); uint counterTmp = serialAddr[_invite]; if (serialUser[counterTmp].depoistTime == 0){ if (serialUser[counterTmp].withdrawPermis...
48,258
7
// curve metapool factory
address public constant METAPOOL_FACTORY = address(0xB9fC157394Af804a3578134A6585C0dc9cc990d4);
address public constant METAPOOL_FACTORY = address(0xB9fC157394Af804a3578134A6585C0dc9cc990d4);
52,436
11
// Used to purchase shares
function purchaseShares(uint256 _shares, uint256 _id) public payable { /// @dev Get the owner of this token address payable owner = getTokenOwner(_id); /// @dev Get the price per share of this token uint256 _pricePerShare = getPricePerShare(_id); /// @dev Mae sure the contract can spend the owner'...
function purchaseShares(uint256 _shares, uint256 _id) public payable { /// @dev Get the owner of this token address payable owner = getTokenOwner(_id); /// @dev Get the price per share of this token uint256 _pricePerShare = getPricePerShare(_id); /// @dev Mae sure the contract can spend the owner'...
46,368
146
// Returns the state of an authorization Nonces are randomly generated 32-byte data unique to theauthorizer's address authorizerAuthorizer's address nonce Nonce of the authorizationreturn True if the nonce is used /
function authorizationState(address authorizer, bytes32 nonce)
function authorizationState(address authorizer, bytes32 nonce)
10,212
2
// PXL 글로벌 락 해제거래소 상장 후 락 해제 /
function unlock() external onlyOwner { isTransferable = true; }
function unlock() external onlyOwner { isTransferable = true; }
44,795
33
// Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.`SafeMath` restores this ...
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) {...
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) {...
106
50
// Etalon Token Presale Presale contract /
contract EtalonTokenPresale is Haltable { using SafeMath for uint256; string public name = "Etalon Token Presale"; EtalonToken public token; address public beneficiary; uint256 public hardCap; uint256 public softCap; uint256 public collected; uint256 public price; uint256 public tokensSold = 0; ...
contract EtalonTokenPresale is Haltable { using SafeMath for uint256; string public name = "Etalon Token Presale"; EtalonToken public token; address public beneficiary; uint256 public hardCap; uint256 public softCap; uint256 public collected; uint256 public price; uint256 public tokensSold = 0; ...
14,798
6
// owner of the TDT during first TBTC mint receives the FRT
if(!feeRebateToken.exists(_tdtId)){ feeRebateToken.mint(msg.sender, _tdtId); }
if(!feeRebateToken.exists(_tdtId)){ feeRebateToken.mint(msg.sender, _tdtId); }
53,254
2
// Reverts if a delegatecall has failed
error DELEGATE_CALL_FAILED();
error DELEGATE_CALL_FAILED();
35,865