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
39
// Emit the transfer event.
Transfer(_from, _to, _tokenId);
Transfer(_from, _to, _tokenId);
20,873
62
// Gets the list of guaridans for a wallet. _wallet The target wallet.return the list of guardians. /
function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { GuardianStorageConfig storage config = configs[address(_wallet)]; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC address[] memory guardians = new address[](config.guardians.length); for (uint256 i = 0; i < co...
function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { GuardianStorageConfig storage config = configs[address(_wallet)]; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC address[] memory guardians = new address[](config.guardians.length); for (uint256 i = 0; i < co...
29,151
49
// array for list of holders accounts (including even inactive holders)
address[] public holders;
address[] public holders;
46,079
16
// set highest index (latest) yes vote - must be processed for member to ragequit
if (proposalIndex > member.highestIndexYesVote) { member.highestIndexYesVote = proposalIndex; }
if (proposalIndex > member.highestIndexYesVote) { member.highestIndexYesVote = proposalIndex; }
20,339
7
// @inheritdoc IVaultRegistry
function isAuthorized(uint256 tokenId, address user) external view returns (bool) { return _isApprovedOrOwner(user, tokenId); }
function isAuthorized(uint256 tokenId, address user) external view returns (bool) { return _isApprovedOrOwner(user, tokenId); }
21,883
8
// Configure time to enable redeem functionality _windowOpen UNIX timestamp for redeem start/
function setRedeemStart(uint256 passID, uint256 _windowOpen) external override onlyRole(DEFAULT_ADMIN_ROLE) { redemptionWindows[passID].windowOpens = _windowOpen; }
function setRedeemStart(uint256 passID, uint256 _windowOpen) external override onlyRole(DEFAULT_ADMIN_ROLE) { redemptionWindows[passID].windowOpens = _windowOpen; }
80,699
35
// Read functions
function getTileHp(uint16 battleboardId, uint8 tileId) constant external returns (uint32) ; function getMedalsBurned(uint16 battleboardId) constant external returns (uint8) ; function getTeam(uint16 battleboardId, uint8 tileId) constant external returns (uint8) ; function getMaxFreeTeams() constant public returns...
function getTileHp(uint16 battleboardId, uint8 tileId) constant external returns (uint32) ; function getMedalsBurned(uint16 battleboardId) constant external returns (uint8) ; function getTeam(uint16 battleboardId, uint8 tileId) constant external returns (uint8) ; function getMaxFreeTeams() constant public returns...
26,442
291
// ========== STRUCTS ========== / Struct for the stake
struct LockedStake { bytes32 kek_id; uint256 start_timestamp; uint256 liquidity; uint256 ending_timestamp; uint256 lock_multiplier; // 6 decimals of precision. 1x = 1000000 }
struct LockedStake { bytes32 kek_id; uint256 start_timestamp; uint256 liquidity; uint256 ending_timestamp; uint256 lock_multiplier; // 6 decimals of precision. 1x = 1000000 }
11,706
16
// State channel update function
function update( uint[3] sig, int r, int[2] _credits, uint[2] _withdrawals, bytes32 _hash, uint _expiry, uint _amount) public onlyplayers
function update( uint[3] sig, int r, int[2] _credits, uint[2] _withdrawals, bytes32 _hash, uint _expiry, uint _amount) public onlyplayers
43,975
267
// We move the last address into the affected account spot.
newExchanges[i] = newExchanges[newExchanges.length - 1];
newExchanges[i] = newExchanges[newExchanges.length - 1];
26,674
85
// Roles Library for managing addresses assigned to a Role. /
library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true;...
library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true;...
34,624
90
// clear proposed values
proposedArtistAddressesAndSplitsHash[_projectId] = bytes32(0);
proposedArtistAddressesAndSplitsHash[_projectId] = bytes32(0);
33,330
142
// See {IERC721Metadata-symbol}. /
function symbol() public view virtual override returns (string memory) { return _symbol; }
function symbol() public view virtual override returns (string memory) { return _symbol; }
843
33
// Model for responses from oracles
struct ResponseInfo { address requester; // Account that requested status bool isOpen; // If open, oracle responses are accepted mapping(uint8 => address[]) responses; // Mapping key is the status code reported ...
struct ResponseInfo { address requester; // Account that requested status bool isOpen; // If open, oracle responses are accepted mapping(uint8 => address[]) responses; // Mapping key is the status code reported ...
39,013
0
// Deploys new Bonds.Creating a Bond involves the two steps of deploying and initialising. /
interface BondCreator { event CreateBond( address indexed bond, string name, string debtSymbol, uint256 debtAmount, address indexed creator, address treasury, uint256 expiryTimestamp, uint256 minimumDeposit, string data ); /** * @...
interface BondCreator { event CreateBond( address indexed bond, string name, string debtSymbol, uint256 debtAmount, address indexed creator, address treasury, uint256 expiryTimestamp, uint256 minimumDeposit, string data ); /** * @...
26,218
9
// Change the MNLTH address contract
function setMnlthAddress(address newAddress) public onlyOwner { mnlthAddress = newAddress; }
function setMnlthAddress(address newAddress) public onlyOwner { mnlthAddress = newAddress; }
11,873
12
// Fills in FullTokenBalance struct with final underlying components. tokenBalance TokenBalance struct consisting oftoken address and its absolute amount.return Final full absolute token amount by token address and absolute amount. /
function getFinalFullTokenBalance(TokenBalance memory tokenBalance) internal returns (FullTokenBalance memory)
function getFinalFullTokenBalance(TokenBalance memory tokenBalance) internal returns (FullTokenBalance memory)
12,794
31
// Calculate the fee amount based on the target amount and the platform fee.
uint256 currentFeeAmount = getFeeAmount(order);
uint256 currentFeeAmount = getFeeAmount(order);
48,411
37
// Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {...
* `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {...
3,346
67
// If `account` had not been already granted `role`, emits a {RoleGranted}event. Note that unlike {grantRole}, this function doesn't perform anychecks on the calling account. [WARNING]====This function should only be called from the constructor when settingup the initial roles for the system. Using this function in any...
function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); }
function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); }
28,140
7
// Live timestamp
uint256 public liveAt;
uint256 public liveAt;
11,857
3
// Sets rent prices. _rentPrices The price array. Each element corresponds to a specific name length; names longer than the length of the array default to the price of the last element. Values are in base price units per second, equal to one wei (1e-18 ETH) each. /
function setPrices(uint[] memory _rentPrices) public onlyOwner { rentPrices = _rentPrices; emit RentPriceChanged(_rentPrices); }
function setPrices(uint[] memory _rentPrices) public onlyOwner { rentPrices = _rentPrices; emit RentPriceChanged(_rentPrices); }
42,046
19
// exclude owner and this contract from max hold limit
isExcludedFromMaxHolding[owner()] = true; isExcludedFromMaxHolding[address(this)] = true; isExcludedFromMaxHolding[marketingWallet] = true; emit Transfer(address(0), owner(), _totalSupply);
isExcludedFromMaxHolding[owner()] = true; isExcludedFromMaxHolding[address(this)] = true; isExcludedFromMaxHolding[marketingWallet] = true; emit Transfer(address(0), owner(), _totalSupply);
18,036
6
// add to registry and posts arr
postRegistry[bzzHash] = newPost; posts.length = posts.push(bzzHash); LogPostPublished(id); return (true, id);
postRegistry[bzzHash] = newPost; posts.length = posts.push(bzzHash); LogPostPublished(id); return (true, id);
22,023
9
// _balanceOf[_from] -= _value;
_balanceOf[_from] = sub(_balanceOf[_from],_value);
_balanceOf[_from] = sub(_balanceOf[_from],_value);
32,679
15
// メンバーを追加する。 正しくないdaoAddressにてコールした場合に対処するために、NFTのAddressをチェックする。/
function addMember(address eoa, string memory name, address daoERC721Address,uint256 tokenId) public onlyMember { require(erc721Address==daoERC721Address,"NFT address isn't correct."); memberInfoes[eoa] = MemberInfo(name,tokenId,_memberIdTracker.current()); memberIds[_memberIdTracker.current...
function addMember(address eoa, string memory name, address daoERC721Address,uint256 tokenId) public onlyMember { require(erc721Address==daoERC721Address,"NFT address isn't correct."); memberInfoes[eoa] = MemberInfo(name,tokenId,_memberIdTracker.current()); memberIds[_memberIdTracker.current...
2,961
37
// User transfer permission /
function allowance( address owner, address spender ) public constant returns (uint remaining)
function allowance( address owner, address spender ) public constant returns (uint remaining)
22,332
1
// +----oOO-{_}-OOo----+
constructor() ERC721Creator("Ashes2ArtContract", "A2AC") {}
constructor() ERC721Creator("Ashes2ArtContract", "A2AC") {}
26,766
127
// Emit an event to validate that the nonce is no longer valid.
emit CANCEL692(nonceToCancel);
emit CANCEL692(nonceToCancel);
27,292
8
// Make `Authority` point to another history contract./_history The new history contract/Emits a `NewHistory` event./Can only be called by the `Authority` owner.
function setHistory(IHistory _history) external onlyOwner { history = _history; emit NewHistory(_history); }
function setHistory(IHistory _history) external onlyOwner { history = _history; emit NewHistory(_history); }
8,935
7
// swap on uniswapV3 using 1inch API
function swapOneInchUniV3( address tokenIn, address tokenOut, uint256 amount, uint256 minReturn, uint256[] calldata pools
function swapOneInchUniV3( address tokenIn, address tokenOut, uint256 amount, uint256 minReturn, uint256[] calldata pools
19,386
63
// If the receiver veCRV lock ends after the Pledge endTimestamp
uint256 lockRemainingDuration = receiverLockEnd - block.timestamp;
uint256 lockRemainingDuration = receiverLockEnd - block.timestamp;
16,870
33
// sanity checks
if (newOperatorShare > PPM_DENOMINATOR) {
if (newOperatorShare > PPM_DENOMINATOR) {
15,804
10
// 5. support for __ESBMC_assume
function __ESBMC_assume(bool) internal pure { } function func_overflow() external { _y = 240; //_x = 100; increment_x(); //_x = get_x(); //_x = nondet(); uint8 _z = nondet(); //uint8 _m = nondet(); // This will be another statement! //__ESBMC_assume(_z != 16); __ESBMC_...
function __ESBMC_assume(bool) internal pure { } function func_overflow() external { _y = 240; //_x = 100; increment_x(); //_x = get_x(); //_x = nondet(); uint8 _z = nondet(); //uint8 _m = nondet(); // This will be another statement! //__ESBMC_assume(_z != 16); __ESBMC_...
17,968
32
// if there are not enough contributions or not looking good brev, refund everyone their eth
function refundEveryone() external onlyOwner { for (uint256 i = 1; i <= NUMBER_OF_CONTRIBUTOORS; i++) { address payable refundAddress = payable(contribution[i].addr); /// refund the contribution refundAddress.transfer(contribution[i].amount); } }
function refundEveryone() external onlyOwner { for (uint256 i = 1; i <= NUMBER_OF_CONTRIBUTOORS; i++) { address payable refundAddress = payable(contribution[i].addr); /// refund the contribution refundAddress.transfer(contribution[i].amount); } }
8,536
96
// Registers tokenIds to global registry/
function _registerId(address _project, uint256 _tokenId) private { require(!tokenRegistry[_project][_tokenId], "Already registered"); tokenRegistry[_project][_tokenId] = true; }
function _registerId(address _project, uint256 _tokenId) private { require(!tokenRegistry[_project][_tokenId], "Already registered"); tokenRegistry[_project][_tokenId] = true; }
36,759
45
// Converts a 'uint256' to its ASCII 'string' decimal representation. /
function toString(uint256 value) internal pure returns(string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } ...
function toString(uint256 value) internal pure returns(string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } ...
50,655
22
// avoid an SLOAD by using the swap return data
amountIn = exactOutputInternal( params.amountOut, params.recipient, params.sqrtPriceLimitX96,
amountIn = exactOutputInternal( params.amountOut, params.recipient, params.sqrtPriceLimitX96,
17,745
320
// Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. _beneficiary Address receiving the tokens _tokenAmount Number of tokens to be purchased /
function _processPurchase( address _beneficiary, uint256 _tokenAmount ) internal
function _processPurchase( address _beneficiary, uint256 _tokenAmount ) internal
12,861
37
// investor => balance in wei10^(-6) available for withdrawal
mapping(address => uint256) private investorBalances;
mapping(address => uint256) private investorBalances;
76,059
478
// Function to delete an existing group for the user / ein _groupIndex describes the associated index of the group for the user / ein /
function deleteGroup(uint _groupIndex)
function deleteGroup(uint _groupIndex)
24,751
0
// Interfaces for ERC20 and ERC721
IERC20 public immutable rewardsToken; IERC721 public immutable nftCollection;
IERC20 public immutable rewardsToken; IERC721 public immutable nftCollection;
3,017
72
// Forward funding to ether wallet
wallet.transfer(amount); bids[receiver] += amount; totalReceived += amount; BidSubmission(receiver, amount);
wallet.transfer(amount); bids[receiver] += amount; totalReceived += amount; BidSubmission(receiver, amount);
49,730
28
// initializes the contract and its parents /
function __BancorArbitrage_init() internal onlyInitializing { __ReentrancyGuard_init(); __Upgradeable_init(); __BancorArbitrage_init_unchained(); }
function __BancorArbitrage_init() internal onlyInitializing { __ReentrancyGuard_init(); __Upgradeable_init(); __BancorArbitrage_init_unchained(); }
3,586
53
// logged on payout transition to mark cash payout to NEU holders
event LogPlatformFeePayout( address paymentToken, address disbursalPool, uint256 amount );
event LogPlatformFeePayout( address paymentToken, address disbursalPool, uint256 amount );
33,916
0
// ========== STRUCTS ========== // Timestamp for current period finish
uint32 periodFinish;
uint32 periodFinish;
10,362
25
// The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() external pure returns (uint);
function quorumVotes() external pure returns (uint);
83,118
192
// Allow to buy remaining if there less left than requested
uint amount = in_amount; // * if(in_amount > ticketPool.sub(ticketsBought)){ // * amount = ticketPool.sub(ticketsBought); // * queueAmount[queueLength] = in_amount.sub(...
uint amount = in_amount; // * if(in_amount > ticketPool.sub(ticketsBought)){ // * amount = ticketPool.sub(ticketsBought); // * queueAmount[queueLength] = in_amount.sub(...
7,276
148
// Universal store of current contract time for testing environments. /
contract Timer { uint256 private currentTime; constructor() public { currentTime = now; // solhint-disable-line not-rely-on-time } /** * @notice Sets the current time. * @dev Will revert if not running in test mode. * @param time timestamp to set `currentTime` to. */ fu...
contract Timer { uint256 private currentTime; constructor() public { currentTime = now; // solhint-disable-line not-rely-on-time } /** * @notice Sets the current time. * @dev Will revert if not running in test mode. * @param time timestamp to set `currentTime` to. */ fu...
21,276
18
// 销毁合约
function stopGame() public onlyAdmin() { selfdestruct(owner); }
function stopGame() public onlyAdmin() { selfdestruct(owner); }
14,043
18
// Case3: The user has never connected before: initialisation of connection
occupiedID[msg.sender] = connectionInitialisation(bandwidth, thresholdBid, burst);
occupiedID[msg.sender] = connectionInitialisation(bandwidth, thresholdBid, burst);
48,015
3
// Fees were unable to be transferred to the fee manager. /
error FeeTransferFailed();
error FeeTransferFailed();
5,395
105
// This method should be called by the owner before the contribution/period starts This initializes most of the parameters
function initialize( address _token, address _destTokensReserve, address _destTokensTeam, address _destTokensBounties, address _destTokensAirdrop, address _destTokensAdvisors, address _destTokensEarlyInvestors
function initialize( address _token, address _destTokensReserve, address _destTokensTeam, address _destTokensBounties, address _destTokensAirdrop, address _destTokensAdvisors, address _destTokensEarlyInvestors
51,388
83
// XGXCoin extends BurnableToken, PausableToken, Ownable /
contract XGXCoin is ERC20, ERC20Detailed, ERC20Burnable, ERC20Pausable, Ownable { // 2 billion uint256 public constant INITIAL_SUPPLY = 2000000000 * (10 ** uint256(decimals())); /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() public ERC20Detailed("XGX Coin", "XGX", ...
contract XGXCoin is ERC20, ERC20Detailed, ERC20Burnable, ERC20Pausable, Ownable { // 2 billion uint256 public constant INITIAL_SUPPLY = 2000000000 * (10 ** uint256(decimals())); /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() public ERC20Detailed("XGX Coin", "XGX", ...
12,490
138
// 50% of the LP tokens kept by the unstaking fee will be locked forever in the BRRR contract, the other 50% will be sent to team.
uint256 lpTokensToLock = withdrawFeeAmount.div(2); uint256 lpTokensToTeam = lpTokensToLock; pool.lpToken.safeTransfer(address(msg.sender), remainingUserAmount); pool.lpToken.safeTransfer(devaddr, lpTokensToTeam); pool.lpToken.safeTransfer(address(this), lpTokensToLock); ...
uint256 lpTokensToLock = withdrawFeeAmount.div(2); uint256 lpTokensToTeam = lpTokensToLock; pool.lpToken.safeTransfer(address(msg.sender), remainingUserAmount); pool.lpToken.safeTransfer(devaddr, lpTokensToTeam); pool.lpToken.safeTransfer(address(this), lpTokensToLock); ...
31,227
386
// Transfer ETH to sender
msg.sender.transfer(transferAmount);
msg.sender.transfer(transferAmount);
37,123
31
// Modifies `self` to contain everything from the first occurrence of `needle` to the end of the slice. `self` is set to the empty slice if `needle` is not found. self The slice to search and modify. needle The text to search for.return `self`. /
function toHexDigit(uint8 d) pure internal returns (byte) { if (0 <= d && d <= 9) { return byte(uint8(byte('0')) + d); } else if (10 <= uint8(d) && uint8(d) <= 15) { return byte(uint8(byte('a')) + d - 10); } // revert("Invalid hex digit"); revert(); ...
function toHexDigit(uint8 d) pure internal returns (byte) { if (0 <= d && d <= 9) { return byte(uint8(byte('0')) + d); } else if (10 <= uint8(d) && uint8(d) <= 15) { return byte(uint8(byte('a')) + d - 10); } // revert("Invalid hex digit"); revert(); ...
13,372
89
// Flash loan collaterals sitting in this contract/ Loaned amount + fee must be repaid by the end of the transaction for the transaction to not be reverted/_tokenAddress Token to flashLoan/_amount Amount to flashLoan/_receiver Receiver of the flashLoan
function flashLoan(address _tokenAddress, uint256 _amount, IFlashLoanReceiver _receiver) public nonReentrant { IERC20 _token = IERC20(_tokenAddress); uint256 startBalance = _token.balanceOf(address(this)); _token.safeTransfer(address(_receiver), _amount); (uint256 fee,) = feeCalcula...
function flashLoan(address _tokenAddress, uint256 _amount, IFlashLoanReceiver _receiver) public nonReentrant { IERC20 _token = IERC20(_tokenAddress); uint256 startBalance = _token.balanceOf(address(this)); _token.safeTransfer(address(_receiver), _amount); (uint256 fee,) = feeCalcula...
37,965
166
// View function to see pending PICKLEs on frontend.
function pendingPickle(uint256 _pid, address _user) external view returns (uint256)
function pendingPickle(uint256 _pid, address _user) external view returns (uint256)
45,914
1
// Returns the base URI for the metadata of this NFT collection.return The base URI for the metadata of this NFT collection. /
function baseURI() external view returns (string memory);
function baseURI() external view returns (string memory);
10,482
119
// Internal function to remove a token ID from the list of a given address _from address representing the previous owner of the given token ID _tokenId uint256 ID of the token to be removed from the tokens list of the given address /
function removeTokenFrom(address _from, uint256 _tokenId) internal whenNotPaused { require(_ownerOf(_tokenId) == _from); require(!frozenAccount[_from]); ownedTokensCount[_from] = ownedTokensCount[_from].sub(1); tokenOwner[_tokenId] = address(0); }
function removeTokenFrom(address _from, uint256 _tokenId) internal whenNotPaused { require(_ownerOf(_tokenId) == _from); require(!frozenAccount[_from]); ownedTokensCount[_from] = ownedTokensCount[_from].sub(1); tokenOwner[_tokenId] = address(0); }
3,440
194
// emitted on setFeeRecipient
event UpdateFeeRecipient(address sender, address receipient); function deposit( IERC20 asset, address recipient, uint128 amount, bool claim ) external; function withdraw(
event UpdateFeeRecipient(address sender, address receipient); function deposit( IERC20 asset, address recipient, uint128 amount, bool claim ) external; function withdraw(
6,051
1
// mapping
mapping (uint256 => Campaign) public campaigns;
mapping (uint256 => Campaign) public campaigns;
5,571
51
// If the condition is false, discard this run's fuzz inputs and generate new ones.
function assume(bool condition) external pure;
function assume(bool condition) external pure;
47,545
3
// mints a new Alchemy ContractnftAddresses_ the nft addresses array to add to the contract owner_ the owner of the contract tokenIds_ the token id array of the nft to be added totalSupply_ the total supply of the erc20 name_ the token name symbol_ the token symbol buyoutPrice_ the buyout price to buyout the dao voting...
function NFTDAOMint( IERC721[] memory nftAddresses_, address owner_, uint256[] memory tokenIds_, uint256 totalSupply_, string memory name_, string memory symbol_, uint256 buyoutPrice_, uint256 votingPeriod_, uint256 timelockDelay_
function NFTDAOMint( IERC721[] memory nftAddresses_, address owner_, uint256[] memory tokenIds_, uint256 totalSupply_, string memory name_, string memory symbol_, uint256 buyoutPrice_, uint256 votingPeriod_, uint256 timelockDelay_
65,188
30
// Transfer Tokens to User
_token.safeTransfer(msg.sender, amountTokens); _claimedAmount = _claimedAmount.add(amountTokens); emit Claimed(msg.sender, amountTokens); return true;
_token.safeTransfer(msg.sender, amountTokens); _claimedAmount = _claimedAmount.add(amountTokens); emit Claimed(msg.sender, amountTokens); return true;
18,706
3
// Creator of the contract is admin during initialization
admin = msg.sender;
admin = msg.sender;
11,716
117
// Moves `amount` tokens from `sender` to `recipient`. The caller mustbe an operator of `sender`. If send or receive hooks are registered for `sender` and `recipient`,the corresponding functions will be called with `data` and`operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits a {Sent} event. Requirements ...
function operatorSend(
function operatorSend(
16,261
187
// Destroys `amount` tokens from `account`, deducting from the caller'sallowance.
* See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account_, uint256 amount_) public virtual { _burnFrom(account_, amount_); }
* See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account_, uint256 amount_) public virtual { _burnFrom(account_, amount_); }
411
212
// Performs a Solidity function call using a low level `call`. Aplain `call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
3,239
169
// public
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); bool isOwner = msg.sender == owner(); require(!paused); require(_mintAmount > 0); require(isOwner || _mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sen...
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); bool isOwner = msg.sender == owner(); require(!paused); require(_mintAmount > 0); require(isOwner || _mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sen...
1,187
6
// Swap tokens to ETH
_swapTokensForEth(address(this).balance);
_swapTokensForEth(address(this).balance);
32,675
48
// send token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE if you want to withdraw ether
function withdraw(address token) public onlyOwner returns(bool) { //for ether withdrawal from smart contract if (address(token) == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { uint256 amount = address(this).balance; msg.sender.transfer(amount); } //for ether ...
function withdraw(address token) public onlyOwner returns(bool) { //for ether withdrawal from smart contract if (address(token) == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { uint256 amount = address(this).balance; msg.sender.transfer(amount); } //for ether ...
1,661
18
// Returns value of collateral that must increase to reach recollateralization target (if 0 means no recollateralization)
function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) { uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and ...
function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) { uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and ...
32,282
26
// ------------------------------------------------------------------------ Mint tokens ------------------------------------------------------------------------
function mint(address tokenOwner, uint tokens) public onlyOwner returns (bool success) { require(mintable); balances[tokenOwner] = balances[tokenOwner].add(tokens); _totalSupply = _totalSupply.add(tokens); Transfer(address(0), tokenOwner, tokens); return true; }
function mint(address tokenOwner, uint tokens) public onlyOwner returns (bool success) { require(mintable); balances[tokenOwner] = balances[tokenOwner].add(tokens); _totalSupply = _totalSupply.add(tokens); Transfer(address(0), tokenOwner, tokens); return true; }
42,644
72
// An array of all the erc20 token addresses the smart fund holds
address[] public tokenAddresses;
address[] public tokenAddresses;
45,805
4
// Address of the token B /
address private _tokenB;
address private _tokenB;
21,832
45
// Check that the output transaction actually created the output.
require(_transactionIncluded(_outputTx, _utxoPos, _outputTxInclusionProof));
require(_transactionIncluded(_outputTx, _utxoPos, _outputTxInclusionProof));
26,698
213
// Updates the reward for a given address, before executing function.Locks 80% of new rewards up for 6 months, vesting linearly from (time of last action + 6 months) to(now + 6 months). This allows rewards to be distributed close to how they were accrued, as opposedto locking up for a flat 6 months from the time of thi...
modifier updateReward(address _account) { _updateReward(_account); _; }
modifier updateReward(address _account) { _updateReward(_account); _; }
46,699
3
// folk[i]->token->balance
mapping (address => mapping (address => uint256)) public balance;
mapping (address => mapping (address => uint256)) public balance;
16,221
75
// Returns how long a two-step ownership handover is valid for in seconds.
function ownershipHandoverValidFor() public view virtual returns (uint64) { return 48 * 3600; }
function ownershipHandoverValidFor() public view virtual returns (uint64) { return 48 * 3600; }
41,877
36
// View function which returns if an account is whitelisted account Account to check white list status ofreturn If the account is whitelisted /
function isWhitelisted(address account) public view returns (bool) { return (whitelistAccountExpirations[account] > block.timestamp); }
function isWhitelisted(address account) public view returns (bool) { return (whitelistAccountExpirations[account] > block.timestamp); }
17,360
321
// Called with the sale price to determine how much royaltyis owed and to whom. - the NFT asset queried for royalty information salePrice_ - the sale price of the NFT asset specified by _tokenIdreturn receiver - address of who should be sent the royalty paymentreturn royaltyAmount - the royalty payment amount for _sale...
function royaltyInfo(uint256, uint256 salePrice_) external view virtual override returns (address receiver, uint256 royaltyAmount) { receiver = _royaltyReceiver;
function royaltyInfo(uint256, uint256 salePrice_) external view virtual override returns (address receiver, uint256 royaltyAmount) { receiver = _royaltyReceiver;
81,920
130
// transfers the oracle's LINK to another address. Can only be calledby the oracle's admin. _oracle is the oracle whose LINK is transferred _recipient is the address to send the LINK to _amount is the amount of LINK to send /
function withdrawPayment(address _oracle, address _recipient, uint256 _amount) external
function withdrawPayment(address _oracle, address _recipient, uint256 _amount) external
22,479
875
// Minimum deposit required to create a Dispute
uint256 public minimumDeposit;
uint256 public minimumDeposit;
84,733
11
// See {IERC1155-setApprovalForAll}. /
function setApprovalForAll(address operator, bool approved) public virtual override {
function setApprovalForAll(address operator, bool approved) public virtual override {
23,603
116
// initializes bond parameters_controlVariable uint_vestingTerm uint32_minimumPrice uint_maxPayout uint_fee uint_maxDebt uint_initialDebt uint /
function initializeBondTerms( uint _controlVariable, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt, uint32 _vestingTerm
function initializeBondTerms( uint _controlVariable, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt, uint32 _vestingTerm
2,965
52
// Add liquidity tokens to staking contract _amount of LP tokens to stake /
function addLiquidityStake(uint256 _amount) external { _addStake(msg.sender, _amount, true); emit StakeLiquidityAdded(msg.sender, _amount); }
function addLiquidityStake(uint256 _amount) external { _addStake(msg.sender, _amount, true); emit StakeLiquidityAdded(msg.sender, _amount); }
11,788
101
// An abbreviated name for NFTokens. /
string internal nftSymbol;
string internal nftSymbol;
2,374
381
// ACR Roles/ keccak256("DEFAULT_ADMIN_ROLE");
bytes32 internal constant ADMIN_ROLE = 0x1effbbff9c66c5e59634f24fe842750c60d18891155c32dd155fc2d661a4c86d;
bytes32 internal constant ADMIN_ROLE = 0x1effbbff9c66c5e59634f24fe842750c60d18891155c32dd155fc2d661a4c86d;
8,259
11
// Refund ETH if necessary. No need to refund TKN because we transferred the actual amount.
if (refundETH > 0) { msg.sender.transfer(refundETH); }
if (refundETH > 0) { msg.sender.transfer(refundETH); }
30,577
14
// Approve Balancer vault to spend tokens
IERC20(OHM).approve(address(balancerVault), amountOHM); IERC20(WETH).approve(address(balancerVault), amountETH); IERC20(DAI).approve(address(balancerVault), amountDAI);
IERC20(OHM).approve(address(balancerVault), amountOHM); IERC20(WETH).approve(address(balancerVault), amountETH); IERC20(DAI).approve(address(balancerVault), amountDAI);
7,633
149
// Swap fees are typically charged on 'token in', but there is no 'token in' here, so we apply it to 'token out'. This results in slightly larger price impact.
uint256 amountOutWithFee; if (invariantRatioWithoutFees > balanceRatiosWithoutFee[i]) { uint256 nonTaxableAmount = balances[i].mulDown(invariantRatioWithoutFees.complement()); uint256 taxableAmount = amountsOut[i].sub(nonTaxableAmount); uint256 ta...
uint256 amountOutWithFee; if (invariantRatioWithoutFees > balanceRatiosWithoutFee[i]) { uint256 nonTaxableAmount = balances[i].mulDown(invariantRatioWithoutFees.complement()); uint256 taxableAmount = amountsOut[i].sub(nonTaxableAmount); uint256 ta...
13,366
5
// External Imports /
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /** * @title OVM_GasPriceOracle * @dev This contract exposes the current l2 gas price, a measure of how congested the network * currently is. This measure is used by the Sequencer to determine what fee to charge for * transactions. When the syst...
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /** * @title OVM_GasPriceOracle * @dev This contract exposes the current l2 gas price, a measure of how congested the network * currently is. This measure is used by the Sequencer to determine what fee to charge for * transactions. When the syst...
1,313
80
// Gets the a value for the latest timestamp available return value for timestamp of last proof of work submited return true if the is a timestamp for the lastNewValue/
function getLastNewValue(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256, bool) { return ( retrieveData( self, self.requestIdByTimestamp[self.uintVars[keccak256("timeOfLastNewValue")]], self.uintVars[keccak256("timeOfLa...
function getLastNewValue(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256, bool) { return ( retrieveData( self, self.requestIdByTimestamp[self.uintVars[keccak256("timeOfLastNewValue")]], self.uintVars[keccak256("timeOfLa...
11,574
102
// Returns the symbol of the token, usually a shorter version of thename. /
function symbol() public view returns (string memory) { return _symbol; }
function symbol() public view returns (string memory) { return _symbol; }
11,297
73
// transfer overrride
function transfer( address _to, uint256 _value ) public
function transfer( address _to, uint256 _value ) public
58,549
62
// PUBLIC-FUNCTIONS
function getUserWallet(address _investor) public view returns (uint, uint, uint, uint, int, uint)
function getUserWallet(address _investor) public view returns (uint, uint, uint, uint, int, uint)
24,024
8
// Override of `_baseURI()` that returns `baseTokenURI`
function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; }
function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; }
70,668
121
// Modified OpenZeppelin ERC721 contract, remove unnecessary stuffs to reduce gas usages. /
contract ERC721 is Context, ERC165, IERC721 { using Address for address; using Strings for uint256; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from...
contract ERC721 is Context, ERC165, IERC721 { using Address for address; using Strings for uint256; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from...
39,670