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
345
// return our iron bank deposit:state changing
uint256 ibBorrows = SCErc20I(ironBankToken).borrowBalanceCurrent(address(this)); SCErc20I(ironBankToken).repayBorrow(Math.min(ibBorrows, want.balanceOf(address(this)))); want.safeTransfer(_newStrategy, want.balanceOf(address(this))); IERC20 _comp = IERC20(comp); uint _compB = _...
uint256 ibBorrows = SCErc20I(ironBankToken).borrowBalanceCurrent(address(this)); SCErc20I(ironBankToken).repayBorrow(Math.min(ibBorrows, want.balanceOf(address(this)))); want.safeTransfer(_newStrategy, want.balanceOf(address(this))); IERC20 _comp = IERC20(comp); uint _compB = _...
51,965
0
// flag and index for Ethereum address
mapping(address => Data) private isEthereumAddressAdded;
mapping(address => Data) private isEthereumAddressAdded;
45,508
2
// setAddress updates signer address
function setAddress(address _newSigner) public payable onlySigner { signer = _newSigner; uint256 _value = msg.value; // solhint-disable-next-line avoid-low-level-calls (bool success, ) = _newSigner.call{value: _value, gas: 21000}(""); require(success, "SignerStorage: transf...
function setAddress(address _newSigner) public payable onlySigner { signer = _newSigner; uint256 _value = msg.value; // solhint-disable-next-line avoid-low-level-calls (bool success, ) = _newSigner.call{value: _value, gas: 21000}(""); require(success, "SignerStorage: transf...
10,307
18
// Cap voting power to remaining unminted voting power supply.
uint96 votingPower_ = votingPower.safeCastUint256ToUint96(); if (totalVotingPower - mintedVotingPower_ < votingPower_) { votingPower_ = totalVotingPower - mintedVotingPower_; }
uint96 votingPower_ = votingPower.safeCastUint256ToUint96(); if (totalVotingPower - mintedVotingPower_ < votingPower_) { votingPower_ = totalVotingPower - mintedVotingPower_; }
31,582
27
// The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
920
7
// address constant WETH = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;kovan
address constant uniSwapRouterAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // mainnet & ropsten & goerli
address constant uniSwapRouterAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // mainnet & ropsten & goerli
7,792
189
// Returns whether the state is locked at the given block number. self The Blocklock state blockNumber The current block number. /
function isLocked(State storage self, uint256 blockNumber) public view returns (bool) { uint256 endAt = lockEndAt(self); return ( self.lockedAt != 0 && blockNumber >= self.lockedAt && blockNumber < endAt ); }
function isLocked(State storage self, uint256 blockNumber) public view returns (bool) { uint256 endAt = lockEndAt(self); return ( self.lockedAt != 0 && blockNumber >= self.lockedAt && blockNumber < endAt ); }
55,173
6
// return total supply of tokens /
function totalSupply() external view returns (uint256 supply);
function totalSupply() external view returns (uint256 supply);
4,628
14
// Total Fee for Swap
uint8 private _SwapFeeTotal = 6;
uint8 private _SwapFeeTotal = 6;
12,429
2
// Assert that the function returns the correct greeting
Assert.equal(greeting, "Hello World", "It should greet me with Hello World.");
Assert.equal(greeting, "Hello World", "It should greet me with Hello World.");
19,736
306
// BToken initialize does the bulk of the work
super.initialize(bController_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
super.initialize(bController_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
76,873
6
// Hammer setter _hammer New hammer address /
function setHammer(address _hammer) onlyHammer
function setHammer(address _hammer) onlyHammer
20,197
53
// unpacks r, s, v from signature bytes
function getRsv(bytes memory sig) public pure returns (bytes32, bytes32, uint8) { bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := and(mload(add(sig, 65)), 255) } if (v < 27) v += 27; return (r, s, v); }
function getRsv(bytes memory sig) public pure returns (bytes32, bytes32, uint8) { bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := and(mload(add(sig, 65)), 255) } if (v < 27) v += 27; return (r, s, v); }
13,849
40
// RetrieverCoin Contract to create the Retriever Coin /
contract RetrieverCoin is CrowdsaleToken { string public constant name = "Retriever Coin"; string public constant symbol = "RETR"; uint32 public constant decimals = 1; }
contract RetrieverCoin is CrowdsaleToken { string public constant name = "Retriever Coin"; string public constant symbol = "RETR"; uint32 public constant decimals = 1; }
35,620
28
// If this is the first level, prev level is 0 / 0
amountPrevLevel = 0; discountPrevLevel = 0;
amountPrevLevel = 0; discountPrevLevel = 0;
27,996
5
// Testing Functions //Tests the `batchFillOrders` function's payment of protocol fees./testProtocolFees The TestProtocolFees that should be tested against./protocolFeeMultiplier The protocol fee multiplier that should be registered/in the test suite before executing `batchFillOrders`./numberOfOrders The number of orde...
function testBatchFillOrdersProtocolFees( TestProtocolFees testProtocolFees, uint256 protocolFeeMultiplier, uint256 numberOfOrders, bool shouldSetProtocolFeeCollector ) external payable handleState(testProtocolFees, protocolFeeMultiplier, shouldSetProtocol...
function testBatchFillOrdersProtocolFees( TestProtocolFees testProtocolFees, uint256 protocolFeeMultiplier, uint256 numberOfOrders, bool shouldSetProtocolFeeCollector ) external payable handleState(testProtocolFees, protocolFeeMultiplier, shouldSetProtocol...
21,609
21
// subtract 1 from activeOffers tracker.
activeOffers--; emit MarketTransaction("Remove offer", msg.sender, _tokenId);
activeOffers--; emit MarketTransaction("Remove offer", msg.sender, _tokenId);
18,127
27
// Internal Mint Function Only
function _mint(address account, uint256 amount) internal { require(amount != 0); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
function _mint(address account, uint256 amount) internal { require(amount != 0); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
24,183
100
// Errors library Defines the error messages emitted by the different contracts Error messages prefix glossary: - VL = ValidationLogic - MATH = Math libraries - CT = Common errors between tokens (DepositToken, VariableDebtToken and StableDebtToken) - AT = DepositToken - SDT = StableDebtToken - VDT = VariableDebtToken -...
library Errors { //contract specific errors string public constant VL_INVALID_AMOUNT = '1'; // Amount must be greater than 0 string public constant VL_NO_ACTIVE_RESERVE = '2'; // Action requires an active reserve string public constant VL_RESERVE_FROZEN = '3'; // Action cannot be performed because the reserve i...
library Errors { //contract specific errors string public constant VL_INVALID_AMOUNT = '1'; // Amount must be greater than 0 string public constant VL_NO_ACTIVE_RESERVE = '2'; // Action requires an active reserve string public constant VL_RESERVE_FROZEN = '3'; // Action cannot be performed because the reserve i...
26,545
94
// Allows merchant or Monetha to initiate exchange of tokens by withdrawing all tokens to deposit address of the exchange /
function withdrawAllTokensToExchange(address _tokenAddress, address _depositAccount, uint _minAmount) external onlyMerchantOrMonetha whenNotPaused { require(_tokenAddress != address(0)); uint balance = GenericERC20(_tokenAddress).balanceOf(address(this)); require(balance >=...
function withdrawAllTokensToExchange(address _tokenAddress, address _depositAccount, uint _minAmount) external onlyMerchantOrMonetha whenNotPaused { require(_tokenAddress != address(0)); uint balance = GenericERC20(_tokenAddress).balanceOf(address(this)); require(balance >=...
16,847
45
// stakeOnBehalfOfAnotherUser is called for airdropping Aurora users/account the account address/amount in AURORA tokens/ WARNING: rewards are not claimed during stake. Airdrop script must claim or/ only distribute to accounts without stake
function stakeOnBehalfOfAnotherUser(address account, uint256 amount) external pausable(1) onlyRole(AIRDROP_ROLE)
function stakeOnBehalfOfAnotherUser(address account, uint256 amount) external pausable(1) onlyRole(AIRDROP_ROLE)
2,352
76
// ark, round 38
st0 := addmod(st0, 0x1166d9e554616dba9e753eea427c17b7fecd58c076dfe42708b08f5b783aa9af, q) st1 := addmod(st1, 0x2de52989431a859593413026354413db177fbf4cd2ac0b56f855a888357ee466, q) st2 := addmod(st2, 0x3006eb4ffc7a85819a6da492f3a8ac1df51aee5b17b8e89d74bf01cf5f71e9ad, q)
st0 := addmod(st0, 0x1166d9e554616dba9e753eea427c17b7fecd58c076dfe42708b08f5b783aa9af, q) st1 := addmod(st1, 0x2de52989431a859593413026354413db177fbf4cd2ac0b56f855a888357ee466, q) st2 := addmod(st2, 0x3006eb4ffc7a85819a6da492f3a8ac1df51aee5b17b8e89d74bf01cf5f71e9ad, q)
8,298
146
// Ensure that a user signing key is set on this smart wallet.
require(userSigningKey != address(0), "No user signing key provided."); _userSigningKey = userSigningKey; emit NewUserSigningKey(userSigningKey);
require(userSigningKey != address(0), "No user signing key provided."); _userSigningKey = userSigningKey; emit NewUserSigningKey(userSigningKey);
26,723
163
// ``` The following map types are supported: - `uint256 -> address` (`UintToAddressMap`) since v3.0.0- `address -> uint256` (`AddressToUintMap`) since v4.6.0 /
library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and ...
library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and ...
20,095
3
// Prevent resetting the settings logic for standalone test deployments.
if (address(settings()) != address(0x0)) return require(settingsAddress.isContract(), "SETTINGS_MUST_BE_A_CONTRACT"); bytes32 slot = SETTINGS_SLOT; assembly { sstore(slot, settingsAddress) }
if (address(settings()) != address(0x0)) return require(settingsAddress.isContract(), "SETTINGS_MUST_BE_A_CONTRACT"); bytes32 slot = SETTINGS_SLOT; assembly { sstore(slot, settingsAddress) }
43,541
60
// when selling eth its possible that some eth isn't sold and it is returned back
(success, tokens[0], tokens[1]) = takeOrder(orderAddresses, _callData, address(this).balance, _data[0]);
(success, tokens[0], tokens[1]) = takeOrder(orderAddresses, _callData, address(this).balance, _data[0]);
84,886
15
// Function to recover the funds on the contract /
function killAndRefund() onlyOwner public { for (uint256 i = 0; i < indexTracker; i++) { depositIndex[i].transfer(balanceOf[depositIndex[i]] * price / 10 ** decimals); } selfdestruct(owner); }
function killAndRefund() onlyOwner public { for (uint256 i = 0; i < indexTracker; i++) { depositIndex[i].transfer(balanceOf[depositIndex[i]] * price / 10 ** decimals); } selfdestruct(owner); }
26,830
54
// New max size must be greater than old max size
require(_size > self.maxSize); self.maxSize = _size;
require(_size > self.maxSize); self.maxSize = _size;
4,731
3
// - See SecuredLine.constructor(). Deploys a new SecuredLine contract with params provided by factory. - Deploy from lib not factory so we can have multiple factories (aka marketplaces) built on same Line contractsreturn line - address of newly deployed line /
function deploySecuredLine( address oracle, address arbiter, address borrower, address payable swapTarget, address s, address e, uint256 ttl, uint8 revenueSplit
function deploySecuredLine( address oracle, address arbiter, address borrower, address payable swapTarget, address s, address e, uint256 ttl, uint8 revenueSplit
45,194
56
// Masterchef Contract
Masterchef public masterchef = Masterchef(Constants.MASTERCHEF); uint256 public univ2SushiEthPoolId = 12;
Masterchef public masterchef = Masterchef(Constants.MASTERCHEF); uint256 public univ2SushiEthPoolId = 12;
29,743
39
// Convert signed 64.64 fixed point number into signed 64-bit integer numberrounding down.x signed 64.64-bit fixed point numberreturn signed 64-bit integer number /
function toInt (int128 x) internal pure returns (int64) { unchecked { return int64 (x >> 64); } }
function toInt (int128 x) internal pure returns (int64) { unchecked { return int64 (x >> 64); } }
32,712
4
// assert(a == bc + a % b);There is no case in which this doesn't hold
return c;
return c;
5,586
129
// ERC677 transfer callback function. _from address of tokens sender. _value amount of transferred tokens. _data additional transfer data, can be used for passing alternative receiver address. /
function onTokenTransfer( address _from, uint256 _value, bytes calldata _data
function onTokenTransfer( address _from, uint256 _value, bytes calldata _data
8,954
122
// Gets the integration for the module with the passed in name. Validates that the address is not empty /
function getAndValidateAdapter(string memory _integrationName) internal view returns(address) { bytes32 integrationHash = getNameHash(_integrationName); return getAndValidateAdapterWithHash(integrationHash); }
function getAndValidateAdapter(string memory _integrationName) internal view returns(address) { bytes32 integrationHash = getNameHash(_integrationName); return getAndValidateAdapterWithHash(integrationHash); }
27,810
24
// This function allows governance to take unsupported tokens out of the contract. This is in an effort to make someone whole, should they seriously mess up. There is no guarantee governance will vote to return these. It also allows for removal of airdropped tokens.
function governanceRecoverUnsupported(IERC20 _token, uint256 amount, address to) external onlyOwner { _token.safeTransfer(to, amount); }
function governanceRecoverUnsupported(IERC20 _token, uint256 amount, address to) external onlyOwner { _token.safeTransfer(to, amount); }
19,874
85
// Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance atreturn The number of votes the account had as ...
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require(blockNumber < block.number, "UFARM::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent bal...
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require(blockNumber < block.number, "UFARM::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent bal...
30,714
38
// Safely transfers the ownership of a given token ID to another addressIf the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,the transfer is reverted.Req...
function safeTransferFrom( ERC721Data storage self, address _from, address _to, uint256 _tokenId, bytes _data
function safeTransferFrom( ERC721Data storage self, address _from, address _to, uint256 _tokenId, bytes _data
37,292
24
// Appeal a ruling. Note that it has to be called before the arbitrator contract calls rule. _disputeID ID of the dispute to be appealed. _extraData Can be used to give extra info on the appeal./
function appeal(uint _disputeID, bytes memory _extraData) public requireAppealFee(_disputeID,_extraData) payable { emit AppealDecision(_disputeID, Arbitrable(msg.sender));
function appeal(uint _disputeID, bytes memory _extraData) public requireAppealFee(_disputeID,_extraData) payable { emit AppealDecision(_disputeID, Arbitrable(msg.sender));
15,558
12
// Submit level to the core Ethernaut contract
levelSuccessfullyPassed = ethernaut.submitLevelInstance(payable(levelAddress));
levelSuccessfullyPassed = ethernaut.submitLevelInstance(payable(levelAddress));
5,724
6
// 0x780e9d63 ===bytes4(keccak256(&39;totalSupply()&39;)) ^bytes4(keccak256(&39;tokenOfOwnerByIndex(address,uint256)&39;)) ^bytes4(keccak256(&39;tokenByIndex(uint256)&39;)) /
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
39,948
128
// forgefmt: disable-next-item
result := and( shr(mul(22, x), 0x375f0016260009d80004ec0002d00001e0000180000180000200000400001), 0x3fffff ) break
result := and( shr(mul(22, x), 0x375f0016260009d80004ec0002d00001e0000180000180000200000400001), 0x3fffff ) break
19,907
62
// IERC777TokensSender ERC777TokensSender interface /
interface IERC777TokensSender { function canTransfer( bytes32 partition, address from, address to, uint value, bytes calldata data, bytes calldata operatorData ) external view returns(bool); function tokensToTransfer( bytes32 partition, address operator, address from, add...
interface IERC777TokensSender { function canTransfer( bytes32 partition, address from, address to, uint value, bytes calldata data, bytes calldata operatorData ) external view returns(bool); function tokensToTransfer( bytes32 partition, address operator, address from, add...
23,761
125
// Maximum IVs for stats. 0: ATK1: DEF 2: AGL3: LUK 4: HP.
uint32[5] maxIVForStats;
uint32[5] maxIVForStats;
17,287
0
// Contract inspired from https:www.youtube.com/watch?v=19SSvs32m8I&ab_channel=ArturChmaro
mapping (uint256 => string) private _tokenURIs; //We create the mapping for TokenID -> URI using Counters for Counters.Counter; Counters.Counter private _tokenIds; //Counter to keep track of the number of NFT we minted and make sure we dont try to mint the same twice
mapping (uint256 => string) private _tokenURIs; //We create the mapping for TokenID -> URI using Counters for Counters.Counter; Counters.Counter private _tokenIds; //Counter to keep track of the number of NFT we minted and make sure we dont try to mint the same twice
10,644
102
// Check whether the token exists id The id of tokenreturn bool True if the token exists, otherwise false /
function _isExist(uint id) private view returns (bool)
function _isExist(uint id) private view returns (bool)
41,212
206
// Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._ /
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } }
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } }
29,236
52
// return Rate of one Tempus Principal Share expressed in Asset Tokens
function pricePerPrincipalShare() external returns (uint256);
function pricePerPrincipalShare() external returns (uint256);
57,765
372
// newTributary
edition.fundingRecipient ); ITributaryRegistry(tributaryRegistry).setTributary( clone, edition.fundingRecipient );
edition.fundingRecipient ); ITributaryRegistry(tributaryRegistry).setTributary( clone, edition.fundingRecipient );
20,851
8
// === Upgradeability === solhint-disable-next-line no-empty-blocks
function _authorizeUpgrade(address newImplementation) internal override onlyRole(OWNER) {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4....
function _authorizeUpgrade(address newImplementation) internal override onlyRole(OWNER) {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4....
38,591
9
// the keccak encoded spaceId of the snapshot space
bytes32 public spaceId;
bytes32 public spaceId;
77,893
1
// --- ERC721
string baseURI; uint256 totalSupply; mapping (uint256 => ERC721Token) items;
string baseURI; uint256 totalSupply; mapping (uint256 => ERC721Token) items;
14,150
1
// Requests randomness from a user-provided seed /
function getRandomNumber(uint256 userProvidedSeed) public returns (bytes32 requestId)
function getRandomNumber(uint256 userProvidedSeed) public returns (bytes32 requestId)
60,063
40
// returns the origination fee percentage/
function getLoanOriginationFeePercentage() external view returns (uint256) { return originationFeePercentage; }
function getLoanOriginationFeePercentage() external view returns (uint256) { return originationFeePercentage; }
15,404
4
// Non-owner actions are always processed via the Authorizer, as "owner only" ones are when delegated.
return _getAuthorizer().canPerform(actionId, account, address(this));
return _getAuthorizer().canPerform(actionId, account, address(this));
22,073
302
// Checks if redeem is valid_setToken Instance of the SetToken _reserveAsset Address of the reserve asset _setTokenQuantity Quantity of SetTokens to redeem returnboolReturns true if redeem is valid /
function isRedeemValid( ISetToken _setToken, address _reserveAsset, uint256 _setTokenQuantity ) external view returns (bool)
function isRedeemValid( ISetToken _setToken, address _reserveAsset, uint256 _setTokenQuantity ) external view returns (bool)
27,635
194
// transfer tokens to contract
xmon.safeTransferFrom(msg.sender, address(this), amount);
xmon.safeTransferFrom(msg.sender, address(this), amount);
60,983
39
// Test to see if the term has already ended
require(block.timestamp < releaseEpoch, "Term has already ended");
require(block.timestamp < releaseEpoch, "Term has already ended");
25,674
171
// Info of each pool
struct PoolInfo { IERC20 lpToken; // Address of LP token contract uint256 allocPoint; // How many allocation points assigned to this pool. HOLYs to distribute per block uint256 lastRewardCalcBlock; // Last block number for which HOLYs distribution is already calculated ...
struct PoolInfo { IERC20 lpToken; // Address of LP token contract uint256 allocPoint; // How many allocation points assigned to this pool. HOLYs to distribute per block uint256 lastRewardCalcBlock; // Last block number for which HOLYs distribution is already calculated ...
14,479
1,088
// INTERNAL VARIABLES AND STORAGE// EVENTS // ADMIN STATE MODIFYING FUNCTIONS// Adds the provided identifier as a supported identifier. Price requests using this identifier will succeed after this call. identifier unique UTF-8 representation for the feed being added. Eg: BTC/USD. /
function addSupportedIdentifier(bytes32 identifier) external override onlyOwner { if (!supportedIdentifiers[identifier]) { supportedIdentifiers[identifier] = true; emit SupportedIdentifierAdded(identifier); } }
function addSupportedIdentifier(bytes32 identifier) external override onlyOwner { if (!supportedIdentifiers[identifier]) { supportedIdentifiers[identifier] = true; emit SupportedIdentifierAdded(identifier); } }
12,429
12
// Allows the proxy owner to upgrade the current version of the proxy. implementation representing the address of the new implementation to be set. /
function upgradeTo(address implementation) public virtual onlyProxyOwner { address currentImplementation; bytes32 position = implementationPosition; assembly { currentImplementation := sload(position) } require(currentImplementation != implementation); ass...
function upgradeTo(address implementation) public virtual onlyProxyOwner { address currentImplementation; bytes32 position = implementationPosition; assembly { currentImplementation := sload(position) } require(currentImplementation != implementation); ass...
17,617
15
// Process Allowance reduction
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value); emit Approval(msg.sender, to, value); return true;
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value); emit Approval(msg.sender, to, value); return true;
13,449
100
// create event for each approval? _tokenId guaranteed to hold correct value?
Approval(msg.sender, _to, _tokenId);
Approval(msg.sender, _to, _tokenId);
9,505
24
// Refund it
currentHighestBidder.transfer(currentHighestBiddersAmount);
currentHighestBidder.transfer(currentHighestBiddersAmount);
30,587
70
// Get smart contract balance in Parsecs
uint256 parsecBalance = parsecToken.balanceOf(this);
uint256 parsecBalance = parsecToken.balanceOf(this);
9,580
19
// Airdrop minting
function mintMany(address[] calldata _to, uint256[] calldata _tokenIds) public onlyOwner { require(_to.length == _tokenIds.length, "Mismatched lengths."); uint256 newSupplyAmount = totalSupply() + _tokenIds.length; require(newSupplyAmount <= _maxSupply, "Reached minting limit."); f...
function mintMany(address[] calldata _to, uint256[] calldata _tokenIds) public onlyOwner { require(_to.length == _tokenIds.length, "Mismatched lengths."); uint256 newSupplyAmount = totalSupply() + _tokenIds.length; require(newSupplyAmount <= _maxSupply, "Reached minting limit."); f...
32,637
206
// Internal function that handles transfering payments from buyers to sellers with special WETH handling/this function assumes that if the recipient address is a contract, it cannot handle ETH - so we always deliver WETH/special care needs to be taken when using contract addresses to sell deals - to ensure it can handl...
function transferPayment( address weth, address token, address from, address payable to, uint256 amount
function transferPayment( address weth, address token, address from, address payable to, uint256 amount
35,671
115
// This function handles token purchases for round 1. /
function _buyTokenR1() private { if (token.balanceOf(address(this)) > 0) { require(!_hasEnded[0], "The first round must be active"); bool isRoundEnded = _buyToken(0, rateR1, totalSupplyR1); if (isRoundEnded == true) { _startTimeR2 = bl...
function _buyTokenR1() private { if (token.balanceOf(address(this)) > 0) { require(!_hasEnded[0], "The first round must be active"); bool isRoundEnded = _buyToken(0, rateR1, totalSupplyR1); if (isRoundEnded == true) { _startTimeR2 = bl...
5,209
0
// chainlink aggregator for price feeds
interface AggregatorV3Interface { function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
interface AggregatorV3Interface { function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
32,610
245
// get generated URI for given tokenreturn token URI /
function uri(uint256 tokenId) external view returns (string memory);
function uri(uint256 tokenId) external view returns (string memory);
55,837
17
// Send 50% of ETH to marketing wallet
(bool successMarketing,) = address(marketingWallet).call{value: halfEth}("");
(bool successMarketing,) = address(marketingWallet).call{value: halfEth}("");
29,000
37
// Increase the total supply of tokens
totalSupply += tokens;
totalSupply += tokens;
13,612
25
// overwrite supportsInterface due to the removal of the ERC721Enumerable functionality
function supportsInterface(bytes4 interfaceId) public pure override(ERC721EnumerableUpgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId || interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgrad...
function supportsInterface(bytes4 interfaceId) public pure override(ERC721EnumerableUpgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId || interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgrad...
48,234
5
// set the last 64 bits of tokenId which is the exercise window to the new value
unchecked { goldenToken = ((goldenToken >> 64) << 64) + _exerciseWindow; }
unchecked { goldenToken = ((goldenToken >> 64) << 64) + _exerciseWindow; }
15,390
121
// Friday, 3 January 2020 г., 23:59:00
require(now >= endICODate + 47260800); token.transfer(walletE, paymentSizeE); completedE[order] = true;
require(now >= endICODate + 47260800); token.transfer(walletE, paymentSizeE); completedE[order] = true;
63,728
22
// 用应收账款赊买
function buyUsingReceivable(address seller, uint receivableId, string sku, uint amount) public { Company storage fromCompany = companies[msg.sender]; Company storage toCompany = companies[seller]; Inventory storage inventory = companies[seller].inventories[sku]; Receivable storage re...
function buyUsingReceivable(address seller, uint receivableId, string sku, uint amount) public { Company storage fromCompany = companies[msg.sender]; Company storage toCompany = companies[seller]; Inventory storage inventory = companies[seller].inventories[sku]; Receivable storage re...
9,157
13
// Modifier verify the price sent/
modifier requirePaidEnough(uint _value)
modifier requirePaidEnough(uint _value)
47,192
18
// iz fri??
if ( msg.value == 0){ require ( ((totalSupply()-teemHfMentid) <= HOWMENEE_FREE_MINNZ), "nO mO freeee MiNNzzz!"); require(addressToMintedFree[_msgSender()]+count<=FREE_GARB_PRO_WALLY,"tO muCHy forr Frrre dON beuRGH grrreeeDii!"); addressToMintedFree[_msgSe...
if ( msg.value == 0){ require ( ((totalSupply()-teemHfMentid) <= HOWMENEE_FREE_MINNZ), "nO mO freeee MiNNzzz!"); require(addressToMintedFree[_msgSender()]+count<=FREE_GARB_PRO_WALLY,"tO muCHy forr Frrre dON beuRGH grrreeeDii!"); addressToMintedFree[_msgSe...
18,573
631
// SDVD-ETH pair address
uint256 pairSDVDBalance = IERC20(sdvd).balanceOf(stakedToken); if (pairSDVDBalance == 0) { require(msg.value <= LGE_INITIAL_DEPOSIT_CAP, 'Initial deposit cap reached'); }
uint256 pairSDVDBalance = IERC20(sdvd).balanceOf(stakedToken); if (pairSDVDBalance == 0) { require(msg.value <= LGE_INITIAL_DEPOSIT_CAP, 'Initial deposit cap reached'); }
45,035
370
// Disallows the standard ERC20 approve() function
function approve(address, uint256) public override returns (bool) { revert("Unimplemented"); }
function approve(address, uint256) public override returns (bool) { revert("Unimplemented"); }
63,346
28
// Determine whether or not a user is authorized for public operation. _sender The address of the user.return Authorization status. /
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
54,288
74
// Define the token name, symbol, and decimals
string private _name = "DIONE ISLAND CLUB"; string private _symbol = "DICLUB"; uint8 private _decimals = 18;
string private _name = "DIONE ISLAND CLUB"; string private _symbol = "DICLUB"; uint8 private _decimals = 18;
51,012
246
// Sets the whitelist statuses for the given owners. Must only be called by the governor.
function setOwnerWhitelists(address[] calldata _owners, bool ok) external onlyGov { for (uint idx = 0; idx < _owners.length; idx++) { ownerWhitelists[_owners[idx]] = ok; emit SetOwnerWhitelist(_owners[idx], ok); } }
function setOwnerWhitelists(address[] calldata _owners, bool ok) external onlyGov { for (uint idx = 0; idx < _owners.length; idx++) { ownerWhitelists[_owners[idx]] = ok; emit SetOwnerWhitelist(_owners[idx], ok); } }
34,882
426
// Log when an ERC20 allocation is registered //Log when an ERC20 allocation is removed // Add a new ERC20 token to the asset allocation Should not allow duplicate tokens token The new token /
function registerErc20Token(IDetailedERC20 token) external;
function registerErc20Token(IDetailedERC20 token) external;
12,877
75
// Update the given pool's ESW allocation point. Can only be called by the owner. Good practice to update pools without messing up the contract
function set( uint256 _pid, uint256 _allocPoint, bool _withUpdate
function set( uint256 _pid, uint256 _allocPoint, bool _withUpdate
20,549
117
// Constructor/
constructor () { //contract creator gets 90% of the token to create LP-Pair uint256 deployerBalance=_circulatingSupply*9/10; _balances[msg.sender] = deployerBalance; emit Transfer(address(0), msg.sender, deployerBalance); //contract gets 10% of the token to generate LP token ...
constructor () { //contract creator gets 90% of the token to create LP-Pair uint256 deployerBalance=_circulatingSupply*9/10; _balances[msg.sender] = deployerBalance; emit Transfer(address(0), msg.sender, deployerBalance); //contract gets 10% of the token to generate LP token ...
11,476
162
// Larger modulos games specify the right edge of half-open interval of winning bet outcomes.
require(betMask > 0 && betMask <= modulo, "betMask larger than modulo"); rollUnder = betMask;
require(betMask > 0 && betMask <= modulo, "betMask larger than modulo"); rollUnder = betMask;
18,076
1
// The swap fee is internally stored using 64 bits, which is enough to represent _MAX_SWAP_FEE_PERCENTAGE.
bytes32 internal _miscData; uint256 private _lastInvariant; IVault private immutable _vault; bytes32 private immutable _poolId; IERC20 internal immutable _token0; IERC20 internal immutable _token1;
bytes32 internal _miscData; uint256 private _lastInvariant; IVault private immutable _vault; bytes32 private immutable _poolId; IERC20 internal immutable _token0; IERC20 internal immutable _token1;
35,499
18
// Emitted when the prop submitter is changed
event SubmitterChanged(address oldSubmitter, address newSubmitter);
event SubmitterChanged(address oldSubmitter, address newSubmitter);
9,242
131
// Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(toke...
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(toke...
34,338
275
// Now calculate each one per the above formulas. Note: since tokens have 18 decimals of precision we multiply the result by 1e18.
if (ethTowardsICOPriceTokens != 0) { icoPriceTokens = ethTowardsICOPriceTokens.mul(1e18).div(tokenPriceInitial_); }
if (ethTowardsICOPriceTokens != 0) { icoPriceTokens = ethTowardsICOPriceTokens.mul(1e18).div(tokenPriceInitial_); }
24,415
277
// function ecRecoverTest( uint256 proposalId, VoteSig[] memory votesFor, VoteSig[] memory votesAgainst
// ) public { // bytes32 domainSeparator = // keccak256( // abi.encode( // DOMAIN_TYPEHASH, // keccak256(bytes(name)), // getChainId(), // address(this) // ) // ); // bytes32 structHashFor = // keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, true)); // bytes32 structHashAga...
// ) public { // bytes32 domainSeparator = // keccak256( // abi.encode( // DOMAIN_TYPEHASH, // keccak256(bytes(name)), // getChainId(), // address(this) // ) // ); // bytes32 structHashFor = // keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, true)); // bytes32 structHashAga...
22,764
43
// Track the extension that minted the token
_tokensExtension[_tokenCount] = extension;
_tokensExtension[_tokenCount] = extension;
12,743
178
// rare words
[ string("bad dude"), string("not nice!"), string("say sorry"), string("you made me cry"), string("i want to puke"), string("thot we were frnieds :("), string("please say sike") ],
[ string("bad dude"), string("not nice!"), string("say sorry"), string("you made me cry"), string("i want to puke"), string("thot we were frnieds :("), string("please say sike") ],
17,903
43
// Functions used for generating the URI
function amountOfZeros(uint256 num, uint256 base) public pure returns(uint256){ uint256 result = 0; num /= base; while (num > 0){ num /= base; result += 1; } return result; }
function amountOfZeros(uint256 num, uint256 base) public pure returns(uint256){ uint256 result = 0; num /= base; while (num > 0){ num /= base; result += 1; } return result; }
42,865
46
// Returns a list of owners addresses /
function owners() public view virtual returns (address [] memory) { return _ownersList; }
function owners() public view virtual returns (address [] memory) { return _ownersList; }
71,464
143
// Withdraw LP tokens from PioneerOre.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accTokenPerSha...
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accTokenPerSha...
5,645
2
// Delegates the current call to nftImplementation This function does not return to its internal call site - it will return directly to the external caller. /
fallback() external payable { IAddressRelay addressRelay = IAddressRelay( StorageSlot.getAddressSlot(_ADDRESS_RELAY_SLOT).value ); address implContract = addressRelay.getImplAddress(msg.sig); assembly { calldatacopy(0, 0, calldatasize()) let resul...
fallback() external payable { IAddressRelay addressRelay = IAddressRelay( StorageSlot.getAddressSlot(_ADDRESS_RELAY_SLOT).value ); address implContract = addressRelay.getImplAddress(msg.sig); assembly { calldatacopy(0, 0, calldatasize()) let resul...
773
130
// calculate fees
uint256 feesAmount0 = provider0.amount.mul(feesController.feesPpm()) / 1000; uint256 feesAmount1 = provider1.amount.mul(feesController.feesPpm()) / 1000;
uint256 feesAmount0 = provider0.amount.mul(feesController.feesPpm()) / 1000; uint256 feesAmount1 = provider1.amount.mul(feesController.feesPpm()) / 1000;
73,933
274
// INTERFACE: Create a tree and return the root, given bytes32 elements in memory
function create_from_many_m(bytes32[] memory elements) internal pure returns (bytes32 new_element_root) { return hash_node(bytes32(elements.length), get_root_from_many_m(elements)); }
function create_from_many_m(bytes32[] memory elements) internal pure returns (bytes32 new_element_root) { return hash_node(bytes32(elements.length), get_root_from_many_m(elements)); }
14,296
108
// Verify that the asset being used in the purchase is valid.
bytes32 itemKey = keccak256(abi.encode(pools[_id].currentPoolVersion, _groupId)); require(_assetIndex < pools[_id].itemPricesLength[itemKey], "MintShop1155: specified asset index is not valid");
bytes32 itemKey = keccak256(abi.encode(pools[_id].currentPoolVersion, _groupId)); require(_assetIndex < pools[_id].itemPricesLength[itemKey], "MintShop1155: specified asset index is not valid");
46,439