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
17
// Withdraws the funds from the contract. Only the owner can call this function. Thefunds are sent to the artist address. /
function withdraw(address to_) external onlyOwner { payable(to_).transfer(address(this).balance); }
function withdraw(address to_) external onlyOwner { payable(to_).transfer(address(this).balance); }
38,425
152
// Mint function for addresses that are on the allow list for early mint. Calls _mintLoop after require conditions are met./_mintAmount The amount of NFTs that the caller would like to mint in allow list./_tier the tier of NFT that the caller would like to mint (Tier 1, 2, or 3).
function mintAllowList(uint256 _mintAmount, uint256 _tier) external payable mintCompliance(_mintAmount, _tier) { require(isAllowListActive, "Allow list is not active"); require(_mintAmount <= _allowList[msg.sender], "Exceeded max available to purchase"); require(totalSupply(_tier) + _mintAmount <= tierMaxSupplies[_tier - 1], "Purchase would exceed max tokens"); require(tierCosts[_tier - 1] * _mintAmount <= msg.value, "Ether value sent is not correct"); _allowList[msg.sender] -= _mintAmount; _mintLoop(msg.sender, _mintAmount, _tier); }
function mintAllowList(uint256 _mintAmount, uint256 _tier) external payable mintCompliance(_mintAmount, _tier) { require(isAllowListActive, "Allow list is not active"); require(_mintAmount <= _allowList[msg.sender], "Exceeded max available to purchase"); require(totalSupply(_tier) + _mintAmount <= tierMaxSupplies[_tier - 1], "Purchase would exceed max tokens"); require(tierCosts[_tier - 1] * _mintAmount <= msg.value, "Ether value sent is not correct"); _allowList[msg.sender] -= _mintAmount; _mintLoop(msg.sender, _mintAmount, _tier); }
24,017
48
// Checks the calculated dart is not higher than urn.art (total debt), otherwise uses its value
dart = uint(dart) <= art ? - dart : - toInt(art);
dart = uint(dart) <= art ? - dart : - toInt(art);
21,446
242
// bytes32 internal constant _rewards2Span_= 'rewards2Span';
bytes32 internal constant _rewards2Begin_ = 'rewards2Begin'; uint public lep; // 1: linear, 2: exponential, 3: power uint public period; uint public begin; mapping (address => uint256) public paid; function __StakingPool_init(address _governor, address _rewardsDistribution,
bytes32 internal constant _rewards2Begin_ = 'rewards2Begin'; uint public lep; // 1: linear, 2: exponential, 3: power uint public period; uint public begin; mapping (address => uint256) public paid; function __StakingPool_init(address _governor, address _rewardsDistribution,
4,999
0
// Interface for AKA Protocol Registry (akap.me)Christian Felde Mohamed ElshamiThis interface defines basic meta data operations in addition to hashOf and claim functions on AKAP nodes.Functionality related to the ERC-721 nature of nodes also available on AKAP, like transferFrom(..), etc. /
contract IAKAP { enum ClaimCase {RECLAIM, NEW, TRANSFER} enum NodeAttribute {EXPIRY, SEE_ALSO, SEE_ADDRESS, NODE_BODY, TOKEN_URI} event Claim(address indexed sender, uint indexed nodeId, uint indexed parentId, bytes label, ClaimCase claimCase); event AttributeChanged(address indexed sender, uint indexed nodeId, NodeAttribute attribute); event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Calculate the hash of a parentId and node label. * * @param parentId Hash value of parent ID * @param label Label of node * @return Hash ID of node */ function hashOf(uint parentId, bytes memory label) public pure returns (uint id); /** * @dev Claim or reclaim a node identified by the given parent ID hash and node label. * * There are 4 potential return value outcomes: * * 0: No action taken. This is the default if msg.sender does not have permission to act on the specified node. * 1: An existing node already owned by msg.sender was reclaimed. * 2: Node did not previously exist and is now minted and allocated to msg.sender. * 3: An existing node already exist but was expired. Node ownership transferred to msg.sender. * * If msg.sender is not the owner but is instead approved "spender" of node, the same logic applies. Only on * case 2 and 3 does msg.sender become owner of the node. On case 1 only the expiry is updated. * * Whenever the return value is non-zero, the expiry of the node has been set to 52 weeks into the future. * * @param parentId Hash value of parent ID * @param label Label of node * @return Returns one of the above 4 outcomes */ function claim(uint parentId, bytes calldata label) external returns (uint status); /** * @dev Returns true if nodeId exists. * * @param nodeId Node hash ID * @return True if node exists */ function exists(uint nodeId) external view returns (bool); /** * @dev Returns whether msg.sender can transfer, claim or operate on a given node ID. * * @param nodeId Node hash ID * @return bool True if approved or owner */ function isApprovedOrOwner(uint nodeId) external view returns (bool); /** * @dev Gets the owner of the specified node ID. * * @param tokenId Node hash ID * @return address Node owner address */ function ownerOf(uint256 tokenId) public view returns (address); /** * @dev Return parent hash ID for given node ID. * * @param nodeId Node hash ID * @return Parent hash ID */ function parentOf(uint nodeId) external view returns (uint); /** * @dev Return expiry timestamp for given node ID. * * @param nodeId Node hash ID * @return Expiry timestamp as seconds since unix epoch */ function expiryOf(uint nodeId) external view returns (uint); /** * @dev Return "see also" value for given node ID. * * @param nodeId Node hash ID * @return "See also" value */ function seeAlso(uint nodeId) external view returns (uint); /** * @dev Return "see address" value for given node ID. * * @param nodeId Node hash ID * @return "See address" value */ function seeAddress(uint nodeId) external view returns (address); /** * @dev Return "node body" value for given node ID. * * @param nodeId Node hash ID * @return "Node body" value */ function nodeBody(uint nodeId) external view returns (bytes memory); /** * @dev Return "token URI" value for given node ID. * * @param tokenId Node hash ID * @return "Token URI" value */ function tokenURI(uint256 tokenId) external view returns (string memory); /** * @dev Will immediately expire node on given node ID. * * An expired node will continue to function as any other node, * but is now available to be claimed by a new owner. * * @param nodeId Node hash ID */ function expireNode(uint nodeId) external; /** * @dev Set "see also" value on given node ID. * * @param nodeId Node hash ID * @param value New "see also" value */ function setSeeAlso(uint nodeId, uint value) external; /** * @dev Set "see address" value on given node ID. * * @param nodeId Node hash ID * @param value New "see address" value */ function setSeeAddress(uint nodeId, address value) external; /** * @dev Set "node body" value on given node ID. * * @param nodeId Node hash ID * @param value New "node body" value */ function setNodeBody(uint nodeId, bytes calldata value) external; /** * @dev Set "token URI" value on given node ID. * * @param nodeId Node hash ID * @param uri New "token URI" value */ function setTokenURI(uint nodeId, string calldata uri) external; /** * @dev Approves another address to transfer the given token ID * * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public; /** * @dev Gets the approved address for a token ID, or zero if no address set * * Reverts if the token ID does not exist. * * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public view returns (address); /** * @dev Sets or unsets the approval of a given operator * * An operator is allowed to transfer all tokens of the sender on their behalf. * * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public; /** * @dev Tells whether an operator is approved by a given owner. * * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public view returns (bool); /** * @dev Transfers the ownership of a given token ID to another address. * * Usage of this method is discouraged, use `safeTransferFrom` whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom(address from, address to, uint256 tokenId) public; /** * @dev Safely transfers the ownership of a given token ID to another address * * If 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. * Requires the msg.sender to be the owner, approved, or operator * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom(address from, address to, uint256 tokenId) public; /** * @dev Safely transfers the ownership of a given token ID to another address * * If 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. * Requires the msg.sender to be the owner, approved, or operator * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public; }
contract IAKAP { enum ClaimCase {RECLAIM, NEW, TRANSFER} enum NodeAttribute {EXPIRY, SEE_ALSO, SEE_ADDRESS, NODE_BODY, TOKEN_URI} event Claim(address indexed sender, uint indexed nodeId, uint indexed parentId, bytes label, ClaimCase claimCase); event AttributeChanged(address indexed sender, uint indexed nodeId, NodeAttribute attribute); event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Calculate the hash of a parentId and node label. * * @param parentId Hash value of parent ID * @param label Label of node * @return Hash ID of node */ function hashOf(uint parentId, bytes memory label) public pure returns (uint id); /** * @dev Claim or reclaim a node identified by the given parent ID hash and node label. * * There are 4 potential return value outcomes: * * 0: No action taken. This is the default if msg.sender does not have permission to act on the specified node. * 1: An existing node already owned by msg.sender was reclaimed. * 2: Node did not previously exist and is now minted and allocated to msg.sender. * 3: An existing node already exist but was expired. Node ownership transferred to msg.sender. * * If msg.sender is not the owner but is instead approved "spender" of node, the same logic applies. Only on * case 2 and 3 does msg.sender become owner of the node. On case 1 only the expiry is updated. * * Whenever the return value is non-zero, the expiry of the node has been set to 52 weeks into the future. * * @param parentId Hash value of parent ID * @param label Label of node * @return Returns one of the above 4 outcomes */ function claim(uint parentId, bytes calldata label) external returns (uint status); /** * @dev Returns true if nodeId exists. * * @param nodeId Node hash ID * @return True if node exists */ function exists(uint nodeId) external view returns (bool); /** * @dev Returns whether msg.sender can transfer, claim or operate on a given node ID. * * @param nodeId Node hash ID * @return bool True if approved or owner */ function isApprovedOrOwner(uint nodeId) external view returns (bool); /** * @dev Gets the owner of the specified node ID. * * @param tokenId Node hash ID * @return address Node owner address */ function ownerOf(uint256 tokenId) public view returns (address); /** * @dev Return parent hash ID for given node ID. * * @param nodeId Node hash ID * @return Parent hash ID */ function parentOf(uint nodeId) external view returns (uint); /** * @dev Return expiry timestamp for given node ID. * * @param nodeId Node hash ID * @return Expiry timestamp as seconds since unix epoch */ function expiryOf(uint nodeId) external view returns (uint); /** * @dev Return "see also" value for given node ID. * * @param nodeId Node hash ID * @return "See also" value */ function seeAlso(uint nodeId) external view returns (uint); /** * @dev Return "see address" value for given node ID. * * @param nodeId Node hash ID * @return "See address" value */ function seeAddress(uint nodeId) external view returns (address); /** * @dev Return "node body" value for given node ID. * * @param nodeId Node hash ID * @return "Node body" value */ function nodeBody(uint nodeId) external view returns (bytes memory); /** * @dev Return "token URI" value for given node ID. * * @param tokenId Node hash ID * @return "Token URI" value */ function tokenURI(uint256 tokenId) external view returns (string memory); /** * @dev Will immediately expire node on given node ID. * * An expired node will continue to function as any other node, * but is now available to be claimed by a new owner. * * @param nodeId Node hash ID */ function expireNode(uint nodeId) external; /** * @dev Set "see also" value on given node ID. * * @param nodeId Node hash ID * @param value New "see also" value */ function setSeeAlso(uint nodeId, uint value) external; /** * @dev Set "see address" value on given node ID. * * @param nodeId Node hash ID * @param value New "see address" value */ function setSeeAddress(uint nodeId, address value) external; /** * @dev Set "node body" value on given node ID. * * @param nodeId Node hash ID * @param value New "node body" value */ function setNodeBody(uint nodeId, bytes calldata value) external; /** * @dev Set "token URI" value on given node ID. * * @param nodeId Node hash ID * @param uri New "token URI" value */ function setTokenURI(uint nodeId, string calldata uri) external; /** * @dev Approves another address to transfer the given token ID * * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public; /** * @dev Gets the approved address for a token ID, or zero if no address set * * Reverts if the token ID does not exist. * * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public view returns (address); /** * @dev Sets or unsets the approval of a given operator * * An operator is allowed to transfer all tokens of the sender on their behalf. * * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public; /** * @dev Tells whether an operator is approved by a given owner. * * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public view returns (bool); /** * @dev Transfers the ownership of a given token ID to another address. * * Usage of this method is discouraged, use `safeTransferFrom` whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom(address from, address to, uint256 tokenId) public; /** * @dev Safely transfers the ownership of a given token ID to another address * * If 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. * Requires the msg.sender to be the owner, approved, or operator * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom(address from, address to, uint256 tokenId) public; /** * @dev Safely transfers the ownership of a given token ID to another address * * If 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. * Requires the msg.sender to be the owner, approved, or operator * * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public; }
27,621
88
// BK Ok - event EmergencyManagerUpdated(address indexed emergencyManager);
emit EmergencyManagerUpdated(_newEmergencyManager);
emit EmergencyManagerUpdated(_newEmergencyManager);
37,558
2
// to invest in compound
contract cDAI { function mint(uint amount) public; }
contract cDAI { function mint(uint amount) public; }
47,230
209
// function used to safely approve ERC20 transfers.erc20TokenAddress address of the token to approve.to receiver of the approval.value amount to approve for. /
function _safeApprove(address erc20TokenAddress, address to, uint256 value) internal virtual { if(value == 0) { return; } bytes memory returnData = _call(erc20TokenAddress, abi.encodeWithSelector(IERC20(erc20TokenAddress).approve.selector, to, value)); require(returnData.length == 0 || abi.decode(returnData, (bool)), 'APPROVE_FAILED'); }
function _safeApprove(address erc20TokenAddress, address to, uint256 value) internal virtual { if(value == 0) { return; } bytes memory returnData = _call(erc20TokenAddress, abi.encodeWithSelector(IERC20(erc20TokenAddress).approve.selector, to, value)); require(returnData.length == 0 || abi.decode(returnData, (bool)), 'APPROVE_FAILED'); }
1,986
56
// exclude owner and this contract from fee
_isExcludedFromFee[tokenOwner] = true; _isExcludedFromFee[address(this)] = true; require( msg.value >= devTax); payable(devWallet).transfer(msg.value); _transferOwnership(tokenOwner); emit Transfer(address(0), tokenOwner, _tTotal);
_isExcludedFromFee[tokenOwner] = true; _isExcludedFromFee[address(this)] = true; require( msg.value >= devTax); payable(devWallet).transfer(msg.value); _transferOwnership(tokenOwner); emit Transfer(address(0), tokenOwner, _tTotal);
27,910
38
// Thrown if a user attempts to open an account on a Credit Facade that has expired
error OpenAccountNotAllowedAfterExpirationException();
error OpenAccountNotAllowedAfterExpirationException();
28,737
4
// automate the transfer of ownershipin order to enable the transfer, we need to ask someone to act on our behalf for the trasnfer - the custodian
function mintNft(string memory tokenURI, uint price, address custodian) public { uint256 newItemId = _tokenIds.current(); _safeMint(msg.sender, newItemId); //msg sender mint the newitemid into the NFT _setTokenURI(newItemId, tokenURI); //set token URI approve(custodian, newItemId); //not want to give everyone ability to transfer NFT, so we approve the custodian identity of transfering NFT NFTSale memory sale = NFTSale(newItemId, price, true); //list NFT for sale _listed.push(sale); _tokenIds.increment(); }
function mintNft(string memory tokenURI, uint price, address custodian) public { uint256 newItemId = _tokenIds.current(); _safeMint(msg.sender, newItemId); //msg sender mint the newitemid into the NFT _setTokenURI(newItemId, tokenURI); //set token URI approve(custodian, newItemId); //not want to give everyone ability to transfer NFT, so we approve the custodian identity of transfering NFT NFTSale memory sale = NFTSale(newItemId, price, true); //list NFT for sale _listed.push(sale); _tokenIds.increment(); }
9,169
10
// Error returned when attempting operations incompatible with a token's StakingStatus /
error IncompatibleStakingStatus(StakingStatus);
error IncompatibleStakingStatus(StakingStatus);
5,994
133
// The session has been settled and can't be claimed again. The receiver is indexed to allow services to know when claims have been successfully processed. When users want to get notified about low balances, they should listen for UserDeposit.BalanceReduced, instead. The first three values identify the session, `transferred` is the amount of tokens that has actually been transferred during the claim.
event Claimed( address sender, address indexed receiver, uint256 expiration_block, uint256 transferred );
event Claimed( address sender, address indexed receiver, uint256 expiration_block, uint256 transferred );
62,009
123
// Distributes msg.sender's orbs token rewards to a list of addresses, by transferring directly into the staking contract./`to[0]` must be the sender's main address/Total delegators reward (`to[1:n]`) must be less then maxDelegatorsStakingRewardsPercentMille of total amount
function distributeOrbsTokenStakingRewards(uint256 totalAmount, uint256 fromBlock, uint256 toBlock, uint split, uint txIndex, address[] calldata to, uint256[] calldata amounts) external;
function distributeOrbsTokenStakingRewards(uint256 totalAmount, uint256 fromBlock, uint256 toBlock, uint split, uint txIndex, address[] calldata to, uint256[] calldata amounts) external;
43,039
160
// Safe wav3 transfer function, just in case if rounding error causes pool to not have enough EHTY.
function safeWav3Transfer(address _to, uint256 _amount) internal { uint256 wav3Bal = wav3.balanceOf(address(this)); if (_amount > wav3Bal) { wav3.transfer(_to, wav3Bal); } else { wav3.transfer(_to, _amount); } }
function safeWav3Transfer(address _to, uint256 _amount) internal { uint256 wav3Bal = wav3.balanceOf(address(this)); if (_amount > wav3Bal) { wav3.transfer(_to, wav3Bal); } else { wav3.transfer(_to, _amount); } }
18,323
0
// msg 是一個全域變數,它是一個包含了交易資訊的物件 msg.sender 就是調用這個合約的地址(人)
address public owner = msg.sender;
address public owner = msg.sender;
5,726
4
// Maximum swap fee
uint public constant MAX_FEE = BONE / 10;
uint public constant MAX_FEE = BONE / 10;
45,431
149
// Gets the value of the bits between left and right, both inclusive, in the given integer. 255 is the leftmost bit, 0 is the rightmost bit.For example: bitsFrom(10, 3, 1) == 7 (101 in binary), because 10 is 1010 in binarybitsFrom(10, 2, 0) == 2 (010 in binary), because 10 is 1010 in binary /
function bitsFrom(uint integer, uint left, uint right) internal pure returns (uint) { require(left >= right, "left > right"); require(left <= 255, "left > 255"); uint delta = left - right + 1; return (integer & (((1 << delta) - 1) << right)) >> right; }
function bitsFrom(uint integer, uint left, uint right) internal pure returns (uint) { require(left >= right, "left > right"); require(left <= 255, "left > 255"); uint delta = left - right + 1; return (integer & (((1 << delta) - 1) << right)) >> right; }
18,996
2
// linked list
bytes32 prev; bytes32 next;
bytes32 prev; bytes32 next;
5,035
1
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed)");
bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb; mapping(address => uint256) public nonces; mapping(address => mapping(address => uint256)) public expirations; constructor( string memory _name, string memory _symbol, uint8 _decimals
bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb; mapping(address => uint256) public nonces; mapping(address => mapping(address => uint256)) public expirations; constructor( string memory _name, string memory _symbol, uint8 _decimals
31,513
19
// Returns the latest id. The id start from 1 and increments by 1. /
function latestId() external returns (uint256);
function latestId() external returns (uint256);
9,965
30
// Emits when the contract URI is setcontractURI - an URL to the metadata/
event ContractURISet(string contractURI);
event ContractURISet(string contractURI);
50,460
141
// 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 expected return value, Requirements: - `target` must be a contract.- calling `target` with `data` must not revert. _Available since v3.1._ /
function functionCall( address target, bytes memory data
function functionCall( address target, bytes memory data
6,552
25
// ------------------------------------------------------------------------ Address of openANX crowdsale token contract ------------------------------------------------------------------------
ERC20Interface public tokenContract;
ERC20Interface public tokenContract;
8,312
0
// import { IManagerIssuanceHook } from "../../interfaces/IManagerIssuanceHook.sol";import { Invoke } from "../lib/Invoke.sol";
import { ISetToken } from "../../interfaces/ISetToken.sol";
import { ISetToken } from "../../interfaces/ISetToken.sol";
13,416
72
// mint a token from an extension. Can only be called by a registered extension.to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) amounts- Can be a single element array (all recipients get the same amount) or a multi-element array uris - If no elements, all tokens use the default uri.If any element is an empty string, the corresponding token uses the default uri.Requirements: If to is a multi-element array, then uris must be empty or single element arrayIf to is a multi-element array, then amounts must be
function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
7,917
108
// Check user is claiming the correct bracket
require(rewardForTicketId != 0, "No prize for this bracket"); if (_brackets[i] != 5) { require( _calculateRewardsForTicketId(_lotteryId, thisTicketId, _brackets[i] + 1) == 0, "Bracket must be higher" ); }
require(rewardForTicketId != 0, "No prize for this bracket"); if (_brackets[i] != 5) { require( _calculateRewardsForTicketId(_lotteryId, thisTicketId, _brackets[i] + 1) == 0, "Bracket must be higher" ); }
33,938
17
// Withdraw given bAsset from the cache /
function withdrawRaw(address _receiver, address _bAsset, uint256 _amount) external;
function withdrawRaw(address _receiver, address _bAsset, uint256 _amount) external;
37,966
235
// returns the observation from the oldest epoch (at the beginning of the window) relative to the current time
function getFirstObservationInWindow(address pair) private view returns (Observation storage firstObservation) { uint8 observationIndex = observationIndexOf(block.timestamp); // no overflow issue. if observationIndex + 1 overflows, result is still zero. uint8 firstObservationIndex = (observationIndex + 1) % granularity; firstObservation = pairObservations[pair][firstObservationIndex]; }
function getFirstObservationInWindow(address pair) private view returns (Observation storage firstObservation) { uint8 observationIndex = observationIndexOf(block.timestamp); // no overflow issue. if observationIndex + 1 overflows, result is still zero. uint8 firstObservationIndex = (observationIndex + 1) % granularity; firstObservation = pairObservations[pair][firstObservationIndex]; }
41,007
19
// Mint cToken
cToken.mint(numTokensToSupply);
cToken.mint(numTokensToSupply);
8,475
69
// Lets astaker collect the current payout for all their stakes._numberOfWeeks - the number of weeks to collect. Set to 0 to collect all weeks. returns _payout - the total payout over all the collected weeks
function collectPayout(uint _numberOfWeeks) public
function collectPayout(uint _numberOfWeeks) public
1,695
9
// IERC20(_btcCrv).safeApprove(_rewardsGauge, 0); IERC20(_btcCrv).safeApprove(_rewardsGauge, btcCrvBalance);
IRewardsGauge(_rewardsGauge).deposit(btcCrvBalance); emit Invest(underlyingBalanceInModel(), block.timestamp);
IRewardsGauge(_rewardsGauge).deposit(btcCrvBalance); emit Invest(underlyingBalanceInModel(), block.timestamp);
39,999
9
// ------------------------------------------------ Events ------------------------------------------------
event MetaEvidence(uint indexed _metaEvidenceID, string _evidence); event Dispute(address indexed _arbitrator, uint indexed _disputeID, uint _metaEvidenceID); event Evidence(address indexed _arbitrator, uint indexed _disputeID, address indexed _party, string _evidence); event Ruling(address indexed _arbitrator, uint indexed _disputeID, uint _ruling);
event MetaEvidence(uint indexed _metaEvidenceID, string _evidence); event Dispute(address indexed _arbitrator, uint indexed _disputeID, uint _metaEvidenceID); event Evidence(address indexed _arbitrator, uint indexed _disputeID, address indexed _party, string _evidence); event Ruling(address indexed _arbitrator, uint indexed _disputeID, uint _ruling);
24,030
331
// We cannot pay more than we owe
amount = Math.min(amount, debt); _checkAllowance( MakerDaiDelegateLib.daiJoinAddress(), address(investmentToken), amount ); if (amount > 0) {
amount = Math.min(amount, debt); _checkAllowance( MakerDaiDelegateLib.daiJoinAddress(), address(investmentToken), amount ); if (amount > 0) {
77,001
259
// total blocks owned by a player /
function ownBlockNumber(address _customerAddress) public view returns(uint256)
function ownBlockNumber(address _customerAddress) public view returns(uint256)
20,266
17
// Set remaining deposit to be collected.
owed = depositOf(tokenId_);
owed = depositOf(tokenId_);
20,025
218
// Compute the bare minimum amount we need for this withdrawal.
uint256 floatMissingForWithdrawal = underlyingAmount - float;
uint256 floatMissingForWithdrawal = underlyingAmount - float;
25,875
3,428
// 1716
entry "Canadianly" : ENG_ADVERB
entry "Canadianly" : ENG_ADVERB
22,552
114
// Given an bytes32 input, injects return/sub values if specified/_param The original input value/_mapType Indicated the type of the input in paramMapping/_subData Array of subscription data we can replace the input value with/_returnValues Array of subscription data we can replace the input value with
function _parseParamABytes32( bytes32 _param, uint8 _mapType, bytes[] memory _subData, bytes32[] memory _returnValues
function _parseParamABytes32( bytes32 _param, uint8 _mapType, bytes[] memory _subData, bytes32[] memory _returnValues
3,267
157
// Swap specified proportion of tokenIn for tokenOut
uint256 swapAmount = _amount * _convertPercentage / 100; _swap(swapAmount, _minReceiveAmount, _inTokenAddress, _outTokenAddress, _recipient);
uint256 swapAmount = _amount * _convertPercentage / 100; _swap(swapAmount, _minReceiveAmount, _inTokenAddress, _outTokenAddress, _recipient);
47,094
12
// update the next epoch pool size
Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1]; pNextEpoch.size = token.balanceOf(address(this)); pNextEpoch.set = true; Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress]; uint256 balanceBefore = getEpochUserBalance(msg.sender, tokenAddress, currentEpoch);
Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1]; pNextEpoch.size = token.balanceOf(address(this)); pNextEpoch.set = true; Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress]; uint256 balanceBefore = getEpochUserBalance(msg.sender, tokenAddress, currentEpoch);
9,741
15
// The mint price for elders and heroes
uint256 public elderMintPrice;
uint256 public elderMintPrice;
39,629
69
// lending did not go through full period, fees percent will be lower, lets refund to lender
uint256 _actualSalaryLenderReceives = SafeMath.sub(_streamSalaryAmount, uint256(_balanceNotStreamed)); uint256 _platformFeeToCollectUpdated = SafeMath.mul(SafeMath.div(_actualSalaryLenderReceives, 100), _feesPercent); uint256 _platformFeeToRefund = SafeMath.sub(_platformFeeToCollect, _platformFeeToCollectUpdated); _platformFeeToCollect =_platformFeeToCollectUpdated; IERC20(acceptedPayTokenAddress).transfer(lenderAddress, uint256(_platformFeeToRefund));
uint256 _actualSalaryLenderReceives = SafeMath.sub(_streamSalaryAmount, uint256(_balanceNotStreamed)); uint256 _platformFeeToCollectUpdated = SafeMath.mul(SafeMath.div(_actualSalaryLenderReceives, 100), _feesPercent); uint256 _platformFeeToRefund = SafeMath.sub(_platformFeeToCollect, _platformFeeToCollectUpdated); _platformFeeToCollect =_platformFeeToCollectUpdated; IERC20(acceptedPayTokenAddress).transfer(lenderAddress, uint256(_platformFeeToRefund));
7,548
45
// Calculates the effective amount given the amount, (safe) base token exchange rate,/ and (safe) effective multiplier for a position/amount The amount of staked tokens/safeBaseTokenExchangeRate The (safe) base token exchange rate. Seecomment below./safeEffectiveMultiplier The (safe) effective multiplier. Seecomment below./Do NOT pass in the unsafeBaseTokenExchangeRate or unsafeEffectiveMultiplier in storage./ Convert it to safe values using `safeBaseTokenExchangeRate()` and `safeEffectiveMultiplier()`before calling this function.
function toEffectiveAmount( uint256 amount, uint256 safeBaseTokenExchangeRate, uint256 safeEffectiveMultiplier
function toEffectiveAmount( uint256 amount, uint256 safeBaseTokenExchangeRate, uint256 safeEffectiveMultiplier
10,205
23
// return {ref/tok} Actual quantity of whole reference units per whole collateral tokens
function _underlyingRefPerTok() internal view virtual returns (uint192);
function _underlyingRefPerTok() internal view virtual returns (uint192);
31,255
80
// Changes the artists withdraw address/_artistAddress The new address to withdraw to
function updateArtistAddress(address _artistAddress) public { require(msg.sender == artistAddress, "GB: Only artist"); artistAddress = _artistAddress; }
function updateArtistAddress(address _artistAddress) public { require(msg.sender == artistAddress, "GB: Only artist"); artistAddress = _artistAddress; }
29,086
1
// Function that returns true ifgiven address has access account Address to check /
function requireHasAccessMock(address account) public view requireHasAccess(account) returns (bool)
function requireHasAccessMock(address account) public view requireHasAccess(account) returns (bool)
28,489
127
// Safe Robot transfer function, just in case if rounding error causes pool to not have enough robot.
function safeRobotTransfer(address _to, uint256 _amount) internal { uint256 robotBal = robot.balanceOf(address(this)); if (_amount > robotBal) { robot.transfer(_to, robotBal); } else { robot.transfer(_to, _amount); } }
function safeRobotTransfer(address _to, uint256 _amount) internal { uint256 robotBal = robot.balanceOf(address(this)); if (_amount > robotBal) { robot.transfer(_to, robotBal); } else { robot.transfer(_to, _amount); } }
27,526
124
// Here I now re-use that uint256 to create the bit flags.
tmp = 0;
tmp = 0;
21,526
0
// Hash for the EIP712 Order Schema
bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", "address feeRecipientAddress,", "address senderAddress,", "uint256 makerAssetAmount,", "uint256 takerAssetAmount,", "uint256 makerFee,", "uint256 takerFee,",
bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", "address feeRecipientAddress,", "address senderAddress,", "uint256 makerAssetAmount,", "uint256 takerAssetAmount,", "uint256 makerFee,", "uint256 takerFee,",
32,952
7
// https:docs.pynthetix.io/contracts/source/interfaces/irewardescrow
interface IRewardEscrow { // Views function balanceOf(address account) external view returns (uint); function numVestingEntries(address account) external view returns (uint); function totalEscrowedAccountBalance(address account) external view returns (uint); function totalVestedAccountBalance(address account) external view returns (uint); // Mutative functions function appendVestingEntry(address account, uint quantity) external; function vest() external; }
interface IRewardEscrow { // Views function balanceOf(address account) external view returns (uint); function numVestingEntries(address account) external view returns (uint); function totalEscrowedAccountBalance(address account) external view returns (uint); function totalVestedAccountBalance(address account) external view returns (uint); // Mutative functions function appendVestingEntry(address account, uint quantity) external; function vest() external; }
3,916
10
// [desc] Get parcel's track info (first and last track). [param] _index: parcel index. [param] _position: track position (0: means first track, 1: means last track). [param] _tag: element tag. [return] true/false./
function _getParcelTrackElement(uint _index, uint8 _position, string _tag) private view returns (string) { // check param require((0 == _position) || (1 == _position)); string memory num = LogisticsCore(coreAddr_).getNumByIndex(_index); uint trackIndex = _getTrackIndex(num, _position); return LogisticsCore(coreAddr_).getTrackElement(num, trackIndex, _tag); }
function _getParcelTrackElement(uint _index, uint8 _position, string _tag) private view returns (string) { // check param require((0 == _position) || (1 == _position)); string memory num = LogisticsCore(coreAddr_).getNumByIndex(_index); uint trackIndex = _getTrackIndex(num, _position); return LogisticsCore(coreAddr_).getTrackElement(num, trackIndex, _tag); }
35,245
31
// Calculates geometric mean of x and y, i.e. sqrt(xy), rounding down.//Requirements:/ - xy must fit within MAX_UD60x18, lest it overflows.//x The first operand as an unsigned 60.18-decimal fixed-point number./y The second operand as an unsigned 60.18-decimal fixed-point number./ return result The result as an unsigned 60.18-decimal fixed-point number.
function gm(PRBMath.UD60x18 memory x, PRBMath.UD60x18 memory y) internal pure returns (PRBMath.UD60x18 memory result)
function gm(PRBMath.UD60x18 memory x, PRBMath.UD60x18 memory y) internal pure returns (PRBMath.UD60x18 memory result)
46
13
// pay the fee
erc20.transfer(superblockSubmitterAddress, superblockSubmitterFee); emit TokenUnfreezeFee(superblockSubmitterAddress, superblockSubmitterFee);
erc20.transfer(superblockSubmitterAddress, superblockSubmitterFee); emit TokenUnfreezeFee(superblockSubmitterAddress, superblockSubmitterFee);
46,837
117
// ------------------------------------------------------------------------ Dividends: Token Transfers------------------------------------------------------------------------
function updateAccount(address _account) external { _updateAccount(_account); }
function updateAccount(address _account) external { _updateAccount(_account); }
15,519
97
// --------------------------------------------------------- Handle 0x22C1f6050E56d2876009903609a2cC3fEf83B415 bridged as 0x2884220b55615C48B656Ea57C467206756378F88 ---------------------------------------------------------
bridgedToken = address(new ERC721TokenProxy(tokenImage, _readName(address(0x2884220b55615C48B656Ea57C467206756378F88)), _readSymbol(address(0x2884220b55615C48B656Ea57C467206756378F88)), address(this))); _setTokenAddressPair(address(0x22C1f6050E56d2876009903609a2cC3fEf83B415), bridgedToken); delete addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", address(0x2884220b55615C48B656Ea57C467206756378F88)))];
bridgedToken = address(new ERC721TokenProxy(tokenImage, _readName(address(0x2884220b55615C48B656Ea57C467206756378F88)), _readSymbol(address(0x2884220b55615C48B656Ea57C467206756378F88)), address(this))); _setTokenAddressPair(address(0x22C1f6050E56d2876009903609a2cC3fEf83B415), bridgedToken); delete addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", address(0x2884220b55615C48B656Ea57C467206756378F88)))];
25,573
26
// See {IERC20Taxable-transferWithTax}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function transferWithTax(address recipient, uint256 amount, uint256 tax) internal virtual returns (bool) { _transferWithTax(_msgSender(), recipient, amount, tax); return true; }
function transferWithTax(address recipient, uint256 amount, uint256 tax) internal virtual returns (bool) { _transferWithTax(_msgSender(), recipient, amount, tax); return true; }
22,618
9
// See {_acceptOfferERC721WithTokens} for more details. _seller Address of the seller _tokenId ID of the token _amount Amount of the token _tokenPayment Address of the ERC-20 Token /
function acceptOfferERC721WithTokens( address _seller, uint256 _tokenId, uint256 _amount, address _tokenPayment ) external { _acceptOfferERC721WithTokens(_seller, _tokenId, _amount, _tokenPayment); }
function acceptOfferERC721WithTokens( address _seller, uint256 _tokenId, uint256 _amount, address _tokenPayment ) external { _acceptOfferERC721WithTokens(_seller, _tokenId, _amount, _tokenPayment); }
50,239
66
// Check if a given token id corresponds to a physical lot._tokenId - the id of the token to checkreturn physical - true if the item corresponds to a physical lot /
function isPhysical(uint256 _tokenId) external returns (bool);
function isPhysical(uint256 _tokenId) external returns (bool);
18,172
25
// 5760 blocks per day
reward = rewardsPerBlock.mul(5760); incvReward = incvRewardsPerBlock.mul(5760);
reward = rewardsPerBlock.mul(5760); incvReward = incvRewardsPerBlock.mul(5760);
25,410
1
// save draw time
rafflesDrawTime[bids][raffleId] = block.timestamp + 3600;
rafflesDrawTime[bids][raffleId] = block.timestamp + 3600;
19,412
27
// This is already owned in ENS
if (_ens.owner(nodeHash) != address(0)) { throw; }
if (_ens.owner(nodeHash) != address(0)) { throw; }
7,305
77
// Transfer "A token" to "B token".
function swapExactTokenToToken(address _fromContract, address _toContract, uint amountIn, uint amountOutMin, address[] memory swapPath, uint deadline) payable public returns (uint[] memory) { require(amountIn > 0, "amount in is invalid"); // // approve for the transaction through ERC20 // IERC20 erc_obj = IERC20(_fromContract); // // For some tokens, e.g USDT, transferFrom has no return, so cannot check the return value. // erc_obj.safeTransferFrom(msg.sender, address(this), amountIn); // erc_obj.safeApprove(address(uniswapRouter), amountIn); require(swapPath.length >= 2, "swap path length is invalid"); require(deadline > 0, "deadline is invalid"); uint[] memory amounts = uniswapRouter.swapExactTokensForTokens(amountIn, amountOutMin, swapPath, address(this), deadline); return amounts; }
function swapExactTokenToToken(address _fromContract, address _toContract, uint amountIn, uint amountOutMin, address[] memory swapPath, uint deadline) payable public returns (uint[] memory) { require(amountIn > 0, "amount in is invalid"); // // approve for the transaction through ERC20 // IERC20 erc_obj = IERC20(_fromContract); // // For some tokens, e.g USDT, transferFrom has no return, so cannot check the return value. // erc_obj.safeTransferFrom(msg.sender, address(this), amountIn); // erc_obj.safeApprove(address(uniswapRouter), amountIn); require(swapPath.length >= 2, "swap path length is invalid"); require(deadline > 0, "deadline is invalid"); uint[] memory amounts = uniswapRouter.swapExactTokensForTokens(amountIn, amountOutMin, swapPath, address(this), deadline); return amounts; }
24,412
61
// Transfer to recipient
msg.sender.transfer(currentComponentQuantity);
msg.sender.transfer(currentComponentQuantity);
35,836
197
// IGarden Interface for operating with a Garden. /
interface ICoreGarden { /* ============ Constructor ============ */ /* ============ View ============ */ function privateGarden() external view returns (bool); function publicStrategists() external view returns (bool); function publicStewards() external view returns (bool); function controller() external view returns (IBabController); function creator() external view returns (address); function isGardenStrategy(address _strategy) external view returns (bool); function getContributor(address _contributor) external view returns ( uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256 ); function reserveAsset() external view returns (address); function totalContributors() external view returns (uint256); function gardenInitializedAt() external view returns (uint256); function minContribution() external view returns (uint256); function depositHardlock() external view returns (uint256); function minLiquidityAsset() external view returns (uint256); function minStrategyDuration() external view returns (uint256); function maxStrategyDuration() external view returns (uint256); function reserveAssetRewardsSetAside() external view returns (uint256); function absoluteReturns() external view returns (int256); function totalStake() external view returns (uint256); function minVotesQuorum() external view returns (uint256); function minVoters() external view returns (uint256); function maxDepositLimit() external view returns (uint256); function strategyCooldownPeriod() external view returns (uint256); function getStrategies() external view returns (address[] memory); function extraCreators(uint256 index) external view returns (address); function getFinalizedStrategies() external view returns (address[] memory); function strategyMapping(address _strategy) external view returns (bool); function getLockedBalance(address _contributor) external view returns (uint256); function keeperDebt() external view returns (uint256); function totalKeeperFees() external view returns (uint256); function lastPricePerShare() external view returns (uint256); function lastPricePerShareTS() external view returns (uint256); function pricePerShareDecayRate() external view returns (uint256); function pricePerShareDelta() external view returns (uint256); /* ============ Write ============ */ function deposit( uint256 _reserveAssetQuantity, uint256 _minGardenTokenReceiveQuantity, address _to, bool mintNFT ) external payable; function depositBySig( uint256 _amountIn, uint256 _minAmountOut, bool _mintNft, uint256 _nonce, uint256 _maxFee, uint256 _pricePerShare, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; function withdraw( uint256 _gardenTokenQuantity, uint256 _minReserveReceiveQuantity, address payable _to, bool _withPenalty, address _unwindStrategy ) external; function withdrawBySig( uint256 _gardenTokenQuantity, uint256 _minReserveReceiveQuantity, uint256 _nonce, uint256 _maxFee, bool _withPenalty, address _unwindStrategy, uint256 _pricePerShare, uint256 _strategyNAV, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; function claimReturns(address[] calldata _finalizedStrategies) external; function claimRewardsBySig( uint256 _babl, uint256 _profits, uint256 _nonce, uint256 _maxFee, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; }
interface ICoreGarden { /* ============ Constructor ============ */ /* ============ View ============ */ function privateGarden() external view returns (bool); function publicStrategists() external view returns (bool); function publicStewards() external view returns (bool); function controller() external view returns (IBabController); function creator() external view returns (address); function isGardenStrategy(address _strategy) external view returns (bool); function getContributor(address _contributor) external view returns ( uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256 ); function reserveAsset() external view returns (address); function totalContributors() external view returns (uint256); function gardenInitializedAt() external view returns (uint256); function minContribution() external view returns (uint256); function depositHardlock() external view returns (uint256); function minLiquidityAsset() external view returns (uint256); function minStrategyDuration() external view returns (uint256); function maxStrategyDuration() external view returns (uint256); function reserveAssetRewardsSetAside() external view returns (uint256); function absoluteReturns() external view returns (int256); function totalStake() external view returns (uint256); function minVotesQuorum() external view returns (uint256); function minVoters() external view returns (uint256); function maxDepositLimit() external view returns (uint256); function strategyCooldownPeriod() external view returns (uint256); function getStrategies() external view returns (address[] memory); function extraCreators(uint256 index) external view returns (address); function getFinalizedStrategies() external view returns (address[] memory); function strategyMapping(address _strategy) external view returns (bool); function getLockedBalance(address _contributor) external view returns (uint256); function keeperDebt() external view returns (uint256); function totalKeeperFees() external view returns (uint256); function lastPricePerShare() external view returns (uint256); function lastPricePerShareTS() external view returns (uint256); function pricePerShareDecayRate() external view returns (uint256); function pricePerShareDelta() external view returns (uint256); /* ============ Write ============ */ function deposit( uint256 _reserveAssetQuantity, uint256 _minGardenTokenReceiveQuantity, address _to, bool mintNFT ) external payable; function depositBySig( uint256 _amountIn, uint256 _minAmountOut, bool _mintNft, uint256 _nonce, uint256 _maxFee, uint256 _pricePerShare, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; function withdraw( uint256 _gardenTokenQuantity, uint256 _minReserveReceiveQuantity, address payable _to, bool _withPenalty, address _unwindStrategy ) external; function withdrawBySig( uint256 _gardenTokenQuantity, uint256 _minReserveReceiveQuantity, uint256 _nonce, uint256 _maxFee, bool _withPenalty, address _unwindStrategy, uint256 _pricePerShare, uint256 _strategyNAV, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; function claimReturns(address[] calldata _finalizedStrategies) external; function claimRewardsBySig( uint256 _babl, uint256 _profits, uint256 _nonce, uint256 _maxFee, uint256 _fee, uint8 v, bytes32 r, bytes32 s ) external; }
75,559
24
// 0 - init 1 - processed 2 - cancelled
uint8 state;
uint8 state;
56,367
695
// prevent withdrawing from the current bucket if it is also the critical bucket
if ((bucket != 0) && (bucket == lockedBucket)) { continue; }
if ((bucket != 0) && (bucket == lockedBucket)) { continue; }
35,352
115
// Claimable Implementation of the claiming utils that can be useful for withdrawing accidentally sent tokens that are not used in bridge operations. /
contract Claimable { using SafeERC20 for address; /** * Throws if a given address is equal to address(0) */ modifier validAddress(address _to) { require(_to != address(0)); /* solcov ignore next */ _; } /** * @dev Withdraws the erc20 tokens or native coins from this contract. * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()). * @param _token address of the claimed token or address(0) for native coins. * @param _to address of the tokens/coins receiver. */ function claimValues(address _token, address _to) internal validAddress(_to) { if (_token == address(0)) { claimNativeCoins(_to); } else { claimErc20Tokens(_token, _to); } } /** * @dev Internal function for withdrawing all native coins from the contract. * @param _to address of the coins receiver. */ function claimNativeCoins(address _to) internal { uint256 value = address(this).balance; Address.safeSendValue(_to, value); } /** * @dev Internal function for withdrawing all tokens of ssome particular ERC20 contract from this contract. * @param _token address of the claimed ERC20 token. * @param _to address of the tokens receiver. */ function claimErc20Tokens(address _token, address _to) internal { ERC20Basic token = ERC20Basic(_token); uint256 balance = token.balanceOf(this); _token.safeTransfer(_to, balance); } }
contract Claimable { using SafeERC20 for address; /** * Throws if a given address is equal to address(0) */ modifier validAddress(address _to) { require(_to != address(0)); /* solcov ignore next */ _; } /** * @dev Withdraws the erc20 tokens or native coins from this contract. * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()). * @param _token address of the claimed token or address(0) for native coins. * @param _to address of the tokens/coins receiver. */ function claimValues(address _token, address _to) internal validAddress(_to) { if (_token == address(0)) { claimNativeCoins(_to); } else { claimErc20Tokens(_token, _to); } } /** * @dev Internal function for withdrawing all native coins from the contract. * @param _to address of the coins receiver. */ function claimNativeCoins(address _to) internal { uint256 value = address(this).balance; Address.safeSendValue(_to, value); } /** * @dev Internal function for withdrawing all tokens of ssome particular ERC20 contract from this contract. * @param _token address of the claimed ERC20 token. * @param _to address of the tokens receiver. */ function claimErc20Tokens(address _token, address _to) internal { ERC20Basic token = ERC20Basic(_token); uint256 balance = token.balanceOf(this); _token.safeTransfer(_to, balance); } }
12,371
490
// PRIVATE FUNCTIONS/Returns if expiration timestamp is on hardcoded list.
function _isValidTimestamp(uint256 timestamp) private view returns (bool) { for (uint256 i = 0; i < VALID_EXPIRATION_TIMESTAMPS.length; i++) { if (VALID_EXPIRATION_TIMESTAMPS[i] == timestamp) { return true; } } return false; }
function _isValidTimestamp(uint256 timestamp) private view returns (bool) { for (uint256 i = 0; i < VALID_EXPIRATION_TIMESTAMPS.length; i++) { if (VALID_EXPIRATION_TIMESTAMPS[i] == timestamp) { return true; } } return false; }
12,088
9
// Last tokenId that was minted
uint256 internal currentTokenId;
uint256 internal currentTokenId;
71,982
8
// Fully replace an existing extension of the router.The extension with name `extension.name` is the extension being replaced._extension The extension to replace or overwrite. /
function replaceExtension(Extension memory _extension) public virtual onlyAuthorizedCall { _replaceExtension(_extension); }
function replaceExtension(Extension memory _extension) public virtual onlyAuthorizedCall { _replaceExtension(_extension); }
27,371
39
// redeem all user's underlying
require(_cToken.redeem(_amount) == 0, "Something went wrong when redeeming in cTokens");
require(_cToken.redeem(_amount) == 0, "Something went wrong when redeeming in cTokens");
26,448
47
// Calculates the maximum amount of vested tokens that can be claimed for particular address/receiver Address of token receiver/ return Number of vested tokens one can claim
function claimable(address receiver) external view returns (uint);
function claimable(address receiver) external view returns (uint);
79,866
237
// Admin Functions
function setPriceBasedMaxStep(uint32 newMaxPriceBasedStep) public { require(hasRole(MANAGER_ROLE, msg.sender), "only manager"); _maxPriceUnlockMoveStep = newMaxPriceBasedStep; }
function setPriceBasedMaxStep(uint32 newMaxPriceBasedStep) public { require(hasRole(MANAGER_ROLE, msg.sender), "only manager"); _maxPriceUnlockMoveStep = newMaxPriceBasedStep; }
61,555
32
// max fee is 5%
require(rate <= 500 && rate >= 0, "Commune: fee rate must be between 0 and 500"); _feeRate = rate; emit UpdateFee(rate);
require(rate <= 500 && rate >= 0, "Commune: fee rate must be between 0 and 500"); _feeRate = rate; emit UpdateFee(rate);
45,854
19
// permanently prevent dev from calling `specialMint`.
function lockSpecialMint() external onlyOwner
function lockSpecialMint() external onlyOwner
79,581
2
// Transitions: 2 -> 1: owner, transferOut operation 1 -> 2: creator, abort operation 1 -> 0: creator, acceptoperation 0 -> 2: creator, commitoperation
event Here(address from, bytes32 data, uint256 id); event TransferOut(address from, bytes32 data, uint256 id); event NotHere(address from, bytes32 data, uint256 id);
event Here(address from, bytes32 data, uint256 id); event TransferOut(address from, bytes32 data, uint256 id); event NotHere(address from, bytes32 data, uint256 id);
51,585
62
// Send token holding bonus to account /
function _sendBonus(address account) internal { if (account == address(0) || isContract(account)) { return; } User storage u = _users[account]; uint256 tNow = now; uint256 bal = _balances[account]; if (bal >= MinHoldToReward) { uint256 bonus = bal.mul(tNow.sub(u.lastRewardTime)).mul(HolderDailyPerMil).div(1000*24*3600); if (bonus > 0) { uint256 amount = min(bonus, _balances[address(this)]); _balances[address(this)] = _balances[address(this)].sub(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(this), account, amount); } } u.lastRewardTime = tNow; }
function _sendBonus(address account) internal { if (account == address(0) || isContract(account)) { return; } User storage u = _users[account]; uint256 tNow = now; uint256 bal = _balances[account]; if (bal >= MinHoldToReward) { uint256 bonus = bal.mul(tNow.sub(u.lastRewardTime)).mul(HolderDailyPerMil).div(1000*24*3600); if (bonus > 0) { uint256 amount = min(bonus, _balances[address(this)]); _balances[address(this)] = _balances[address(this)].sub(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(this), account, amount); } } u.lastRewardTime = tNow; }
53,365
2
// See {ERC1155-_mint}.Requirements:- the caller must have the `MINTER_ROLE`. /
function mint(address account, uint256 id, uint256 amount, bytes memory data) external;
function mint(address account, uint256 id, uint256 amount, bytes memory data) external;
362
63
// A certain portion of IDO sales revenue are entitiled to owner,/
bool public hasCollected = false; event Collected(address indexed _account, uint _amount);
bool public hasCollected = false; event Collected(address indexed _account, uint _amount);
25,510
10
// sETH balance of owner factoring in the latest exchange rate of the Stakehouse/_owner Account containing sETH tokens
function activeBalanceOf(address _owner) public view returns (uint256) { uint256 sETHBalance = slotRegistry.sETHForSLOTBalance(stakehouse(), balanceOf(_owner)); return sETHBalance.sDivision(slotRegistry.BASE_EXCHANGE_RATE()); }
function activeBalanceOf(address _owner) public view returns (uint256) { uint256 sETHBalance = slotRegistry.sETHForSLOTBalance(stakehouse(), balanceOf(_owner)); return sETHBalance.sDivision(slotRegistry.BASE_EXCHANGE_RATE()); }
17,066
23
// Will revert if pool token doesnt implement permit
IERC2612Permit(address(poolInfo[_pid].lpToken)).permit(msg.sender, address(this), _amount, _deadline, _v, _r, _s); deposit(_pid, _amount);
IERC2612Permit(address(poolInfo[_pid].lpToken)).permit(msg.sender, address(this), _amount, _deadline, _v, _r, _s); deposit(_pid, _amount);
16,928
18
// -f / (em + d)
xPrime = f.div(e.mul(m).add(d)).neg();
xPrime = f.div(e.mul(m).add(d)).neg();
39,296
2
// The storage of uses and their roles
mapping(address => UserInfo) internal _userDetails;
mapping(address => UserInfo) internal _userDetails;
37,397
40
// The printing press for the EulerBeats token contract.This contract is responsible for minting and burning EulerBeat prints. To be functional, this must be set as the owner of the original EulerBeats contract,and the EulerBeats contract should be disabled.After that, this is the only way to print those fresh beats.
contract PrintingPress is Ownable, ERC1155Holder, ReentrancyGuard { using SafeMath for uint256; /***********************************| | Variables and Events | |__________________________________*/ bool public burnEnabled = false; bool public printEnabled = false; // Supply restriction on seeds/original NFTs uint256 constant MAX_SEEDS_SUPPLY = 27; // The 40 bit is flag to distinguish prints - 1 for print uint256 constant PRINTS_FLAG_BIT = 1 << 39; // PrintingPress EulerBeats wrapper specific storage address public EulerBeats; mapping (uint => uint) public seedToPrintId; /** * @dev Function to return the seedIds in an iterable array of uints */ function getSeedIds() public pure returns (uint256[MAX_SEEDS_SUPPLY] memory seedIds){ seedIds = [ uint256(21575894274), uint256(18052613891), uint256(12918588162), uint256(21760049923), uint256(22180136451), uint256(8926004995), uint256(22364095747), uint256(17784178691), uint256(554240256), uint256(17465084160), uint256(13825083651), uint256(12935627264), uint256(8925938433), uint256(4933026051), uint256(8673888000), uint256(13439075074), uint256(13371638787), uint256(17750625027), uint256(21592343040), uint256(4916052483), uint256(4395697411), uint256(13556253699), uint256(470419715), uint256(17800760067), uint256(9193916675), uint256(9395767298), uint256(22314157057) ]; } constructor(address _parent) { EulerBeats = _parent; uint256[MAX_SEEDS_SUPPLY] memory seedIds = getSeedIds(); for (uint256 i = 0; i < MAX_SEEDS_SUPPLY; i++) { // Set the valid original seeds and hard-code their corresponding print tokenId seedToPrintId[seedIds[i]] = getPrintTokenIdFromSeed(seedIds[i]); } } /***********************************| | User Interactions | |__________________________________*/ /** * @dev Function to correct a seedToOwner value if incorrect, before royalty paid * @param seed The NFT id to mint print of * @param _owner The current on-chain owner of the seed */ function ensureEulerBeatsSeedOwner(uint256 seed, address _owner) public { require(seedToPrintId[seed] > 0, "Seed does not exist"); require(IEulerBeats(EulerBeats).balanceOf(_owner, seed) == 1, "Incorrect seed owner"); address registeredOwner = IEulerBeats(EulerBeats).seedToOwner(seed); if (registeredOwner != _owner) { IEulerBeats(EulerBeats).safeTransferFrom(address(this), _owner, seed, 0, hex""); require(IEulerBeats(EulerBeats).seedToOwner(seed) == _owner, "Invalid seed owner"); } } /** * @dev Function to mint prints from an existing seed. Msg.value must be sufficient. * @param seed The NFT id to mint print of * @param _owner The current on-chain owner of the seed */ function mintPrint(uint256 seed, address payable _owner) public payable nonReentrant returns (uint256) { require(printEnabled, "Printing is disabled"); // Record initial balance minus msg.value (difference to be refunded to user post-print) uint preCallBalance = address(this).balance.sub(msg.value); // Test that seed is valid require(seedToPrintId[seed] > 0, "Seed does not exist"); // Verify owner of seed & ensure royalty ownership ensureEulerBeatsSeedOwner(seed, _owner); // Get print tokenId from seed uint256 tokenId = seedToPrintId[seed]; // Enable EB.mintPrint IEulerBeats(EulerBeats).setEnabled(true); // EB.mintPrint(), let EB check price and refund to address(this) IEulerBeats(EulerBeats).mintPrint{value: msg.value}(seed); // Disable EB.mintPrint IEulerBeats(EulerBeats).setEnabled(false); // Transfer print to msg.sender IEulerBeats(EulerBeats).safeTransferFrom(address(this), msg.sender, tokenId, 1, hex""); // Send to user difference between current and preCallBalance if nonzero amt uint refundBalance = address(this).balance.sub(preCallBalance); if (refundBalance > 0) { (bool success, ) = msg.sender.call{value: refundBalance}(""); require(success, "Refund payment failed"); } return tokenId; } /** * @dev Function to burn a print * @param seed The seed for the print to burn. * @param minimumSupply The minimum token supply for burn to succeed, this is a way to set slippage. * Set to 1 to allow burn to go through no matter what the price is. */ function burnPrint(uint256 seed, uint256 minimumSupply) public nonReentrant { require(burnEnabled, "Burning is disabled"); uint startBalance = address(this).balance; // Check that seed is one of hard-coded 27 require(seedToPrintId[seed] > 0, "Seed does not exist"); // Get token id for prints uint256 tokenId = seedToPrintId[seed]; // Transfer 1 EB print @ tokenID from msg.sender to this contract (requires approval) IEulerBeats(EulerBeats).safeTransferFrom(msg.sender, address(this), tokenId, 1, hex""); // Enable EulerBeats IEulerBeats(EulerBeats).setEnabled(true); // Burn print on v1, should receive the funds here IEulerBeats(EulerBeats).burnPrint(seed, minimumSupply); // Disable EulerBeats IEulerBeats(EulerBeats).setEnabled(false); (bool success, ) = msg.sender.call{value: address(this).balance.sub(startBalance)}(""); require(success, "Refund payment failed"); } /***********************************| | Admin | |__________________________________*/ /** * Should never be a balance here, only via selfdestruct * @dev Withdraw earned funds from original Nft sales and print fees. Cannot withdraw the reserve funds. */ function withdraw() public onlyOwner { msg.sender.transfer(address(this).balance); } /** * @dev Function to enable/disable printing * @param _enabled The flag to turn printing on or off */ function setPrintEnabled(bool _enabled) public onlyOwner { printEnabled = _enabled; } /** * @dev Function to enable/disable burning prints * @param _enabled The flag to turn burning on or off */ function setBurnEnabled(bool _enabled) public onlyOwner { burnEnabled = _enabled; } /** * @dev The token id for the prints contains the seed/original NFT id * @param seed The seed/original NFT token id */ function getPrintTokenIdFromSeed(uint256 seed) internal pure returns (uint256) { return seed | PRINTS_FLAG_BIT; } /***********************************| | Admin - Passthrough | |__________________________________*/ // methods that can access onlyOwner methods of EB contract, must be onlyOwner /** * @dev Function to transfer ownership of the EB contract * @param newowner Address to set as the new owner of EB */ function transferOwnershipEB(address newowner) public onlyOwner { IEulerBeats(EulerBeats).transferOwnership(newowner); } /** * @dev Function to enable/disable mintPrint and burnPrint on EB contract * @param enabled Bool value for setting whether EB is enabled */ function setEnabledEB(bool enabled) public onlyOwner { IEulerBeats(EulerBeats).setEnabled(enabled); } /** * @dev Function to withdraw Treum fee balance from EB contract */ function withdrawEB() public onlyOwner { IEulerBeats(EulerBeats).withdraw(); msg.sender.transfer(address(this).balance); } /** * @dev Set the base metadata uri on the EB contract * @param newuri The new base uri */ function setURIEB(string memory newuri) public onlyOwner { IEulerBeats(EulerBeats).setURI(newuri); } /** * @dev Reset script count in EB */ function resetScriptCountEB() public onlyOwner { IEulerBeats(EulerBeats).resetScriptCount(); } /** * @dev Add script string to EB * @param _script String chunk of EB music gen code */ function addScriptEB(string memory _script) public onlyOwner { IEulerBeats(EulerBeats).addScript(_script); } /** * @dev Update script at index * @param _script String chunk of EB music gen code * @param index Index of the script which will be updated */ function updateScriptEB(string memory _script, uint256 index) public onlyOwner { IEulerBeats(EulerBeats).updateScript(_script, index); } /** * @dev Locks ability to check scripts in EB, this is irreversible * @param locked Bool value whether to lock the script updates */ function setLockedEB(bool locked) public onlyOwner { IEulerBeats(EulerBeats).setLocked(locked); } // Need payable fallback to receive ETH from burns, withdraw, etc receive() external payable { // WARNING: this does not prevent selfdestruct ETH transfers require(msg.sender == EulerBeats, "Only EulerBeats allowed to send ETH here"); } }
contract PrintingPress is Ownable, ERC1155Holder, ReentrancyGuard { using SafeMath for uint256; /***********************************| | Variables and Events | |__________________________________*/ bool public burnEnabled = false; bool public printEnabled = false; // Supply restriction on seeds/original NFTs uint256 constant MAX_SEEDS_SUPPLY = 27; // The 40 bit is flag to distinguish prints - 1 for print uint256 constant PRINTS_FLAG_BIT = 1 << 39; // PrintingPress EulerBeats wrapper specific storage address public EulerBeats; mapping (uint => uint) public seedToPrintId; /** * @dev Function to return the seedIds in an iterable array of uints */ function getSeedIds() public pure returns (uint256[MAX_SEEDS_SUPPLY] memory seedIds){ seedIds = [ uint256(21575894274), uint256(18052613891), uint256(12918588162), uint256(21760049923), uint256(22180136451), uint256(8926004995), uint256(22364095747), uint256(17784178691), uint256(554240256), uint256(17465084160), uint256(13825083651), uint256(12935627264), uint256(8925938433), uint256(4933026051), uint256(8673888000), uint256(13439075074), uint256(13371638787), uint256(17750625027), uint256(21592343040), uint256(4916052483), uint256(4395697411), uint256(13556253699), uint256(470419715), uint256(17800760067), uint256(9193916675), uint256(9395767298), uint256(22314157057) ]; } constructor(address _parent) { EulerBeats = _parent; uint256[MAX_SEEDS_SUPPLY] memory seedIds = getSeedIds(); for (uint256 i = 0; i < MAX_SEEDS_SUPPLY; i++) { // Set the valid original seeds and hard-code their corresponding print tokenId seedToPrintId[seedIds[i]] = getPrintTokenIdFromSeed(seedIds[i]); } } /***********************************| | User Interactions | |__________________________________*/ /** * @dev Function to correct a seedToOwner value if incorrect, before royalty paid * @param seed The NFT id to mint print of * @param _owner The current on-chain owner of the seed */ function ensureEulerBeatsSeedOwner(uint256 seed, address _owner) public { require(seedToPrintId[seed] > 0, "Seed does not exist"); require(IEulerBeats(EulerBeats).balanceOf(_owner, seed) == 1, "Incorrect seed owner"); address registeredOwner = IEulerBeats(EulerBeats).seedToOwner(seed); if (registeredOwner != _owner) { IEulerBeats(EulerBeats).safeTransferFrom(address(this), _owner, seed, 0, hex""); require(IEulerBeats(EulerBeats).seedToOwner(seed) == _owner, "Invalid seed owner"); } } /** * @dev Function to mint prints from an existing seed. Msg.value must be sufficient. * @param seed The NFT id to mint print of * @param _owner The current on-chain owner of the seed */ function mintPrint(uint256 seed, address payable _owner) public payable nonReentrant returns (uint256) { require(printEnabled, "Printing is disabled"); // Record initial balance minus msg.value (difference to be refunded to user post-print) uint preCallBalance = address(this).balance.sub(msg.value); // Test that seed is valid require(seedToPrintId[seed] > 0, "Seed does not exist"); // Verify owner of seed & ensure royalty ownership ensureEulerBeatsSeedOwner(seed, _owner); // Get print tokenId from seed uint256 tokenId = seedToPrintId[seed]; // Enable EB.mintPrint IEulerBeats(EulerBeats).setEnabled(true); // EB.mintPrint(), let EB check price and refund to address(this) IEulerBeats(EulerBeats).mintPrint{value: msg.value}(seed); // Disable EB.mintPrint IEulerBeats(EulerBeats).setEnabled(false); // Transfer print to msg.sender IEulerBeats(EulerBeats).safeTransferFrom(address(this), msg.sender, tokenId, 1, hex""); // Send to user difference between current and preCallBalance if nonzero amt uint refundBalance = address(this).balance.sub(preCallBalance); if (refundBalance > 0) { (bool success, ) = msg.sender.call{value: refundBalance}(""); require(success, "Refund payment failed"); } return tokenId; } /** * @dev Function to burn a print * @param seed The seed for the print to burn. * @param minimumSupply The minimum token supply for burn to succeed, this is a way to set slippage. * Set to 1 to allow burn to go through no matter what the price is. */ function burnPrint(uint256 seed, uint256 minimumSupply) public nonReentrant { require(burnEnabled, "Burning is disabled"); uint startBalance = address(this).balance; // Check that seed is one of hard-coded 27 require(seedToPrintId[seed] > 0, "Seed does not exist"); // Get token id for prints uint256 tokenId = seedToPrintId[seed]; // Transfer 1 EB print @ tokenID from msg.sender to this contract (requires approval) IEulerBeats(EulerBeats).safeTransferFrom(msg.sender, address(this), tokenId, 1, hex""); // Enable EulerBeats IEulerBeats(EulerBeats).setEnabled(true); // Burn print on v1, should receive the funds here IEulerBeats(EulerBeats).burnPrint(seed, minimumSupply); // Disable EulerBeats IEulerBeats(EulerBeats).setEnabled(false); (bool success, ) = msg.sender.call{value: address(this).balance.sub(startBalance)}(""); require(success, "Refund payment failed"); } /***********************************| | Admin | |__________________________________*/ /** * Should never be a balance here, only via selfdestruct * @dev Withdraw earned funds from original Nft sales and print fees. Cannot withdraw the reserve funds. */ function withdraw() public onlyOwner { msg.sender.transfer(address(this).balance); } /** * @dev Function to enable/disable printing * @param _enabled The flag to turn printing on or off */ function setPrintEnabled(bool _enabled) public onlyOwner { printEnabled = _enabled; } /** * @dev Function to enable/disable burning prints * @param _enabled The flag to turn burning on or off */ function setBurnEnabled(bool _enabled) public onlyOwner { burnEnabled = _enabled; } /** * @dev The token id for the prints contains the seed/original NFT id * @param seed The seed/original NFT token id */ function getPrintTokenIdFromSeed(uint256 seed) internal pure returns (uint256) { return seed | PRINTS_FLAG_BIT; } /***********************************| | Admin - Passthrough | |__________________________________*/ // methods that can access onlyOwner methods of EB contract, must be onlyOwner /** * @dev Function to transfer ownership of the EB contract * @param newowner Address to set as the new owner of EB */ function transferOwnershipEB(address newowner) public onlyOwner { IEulerBeats(EulerBeats).transferOwnership(newowner); } /** * @dev Function to enable/disable mintPrint and burnPrint on EB contract * @param enabled Bool value for setting whether EB is enabled */ function setEnabledEB(bool enabled) public onlyOwner { IEulerBeats(EulerBeats).setEnabled(enabled); } /** * @dev Function to withdraw Treum fee balance from EB contract */ function withdrawEB() public onlyOwner { IEulerBeats(EulerBeats).withdraw(); msg.sender.transfer(address(this).balance); } /** * @dev Set the base metadata uri on the EB contract * @param newuri The new base uri */ function setURIEB(string memory newuri) public onlyOwner { IEulerBeats(EulerBeats).setURI(newuri); } /** * @dev Reset script count in EB */ function resetScriptCountEB() public onlyOwner { IEulerBeats(EulerBeats).resetScriptCount(); } /** * @dev Add script string to EB * @param _script String chunk of EB music gen code */ function addScriptEB(string memory _script) public onlyOwner { IEulerBeats(EulerBeats).addScript(_script); } /** * @dev Update script at index * @param _script String chunk of EB music gen code * @param index Index of the script which will be updated */ function updateScriptEB(string memory _script, uint256 index) public onlyOwner { IEulerBeats(EulerBeats).updateScript(_script, index); } /** * @dev Locks ability to check scripts in EB, this is irreversible * @param locked Bool value whether to lock the script updates */ function setLockedEB(bool locked) public onlyOwner { IEulerBeats(EulerBeats).setLocked(locked); } // Need payable fallback to receive ETH from burns, withdraw, etc receive() external payable { // WARNING: this does not prevent selfdestruct ETH transfers require(msg.sender == EulerBeats, "Only EulerBeats allowed to send ETH here"); } }
6,980
44
// Get the highest bid price for the option NFT
uint256 highestBidPrice = getHighestBidPrice(_optionId);
uint256 highestBidPrice = getHighestBidPrice(_optionId);
5,683
15
// When submitting a bid we lock up the funds of the investors we take money from.In order for them to get their money back in case we don't update the bid statusfor a specific bid, we abi.encode the investors and _amountsInvestedand store the resulting bytes in a Bid struct alongside the current timestampand the ONGOING status/Some people want to let us invest for them but only want a fraction of LAND
mapping(address => mapping(bytes32 => uint256)) splitBalances;
mapping(address => mapping(bytes32 => uint256)) splitBalances;
9,120
22
// @inheritdoc IStrategy/this will also claim any unclaimed gains in the stability pool
function invest() external virtual override(IStrategy) onlyManager { uint256 balance = underlying.balanceOf(address(this)); if (balance == 0) revert StrategyNoUnderlying(); // claims LQTY & ETH rewards if there are any stabilityPool.provideToSP(balance, address(0)); emit StrategyInvested(balance); }
function invest() external virtual override(IStrategy) onlyManager { uint256 balance = underlying.balanceOf(address(this)); if (balance == 0) revert StrategyNoUnderlying(); // claims LQTY & ETH rewards if there are any stabilityPool.provideToSP(balance, address(0)); emit StrategyInvested(balance); }
14,352
0
// "Aggregator" interface contains one function, which describe how an array of unsigned integers should be processed/ into a single unsigned integer result. The function will return ok = false if the aggregation fails.
interface Aggregator { function aggregate(uint256[] calldata data, uint256 size) external pure returns (uint256 result, bool ok); }
interface Aggregator { function aggregate(uint256[] calldata data, uint256 size) external pure returns (uint256 result, bool ok); }
2,325
22
// Called by the Builder DAO to offer opt-in implementation upgrades for all other DAOs/baseImpl The base implementation address/upgradeImpl The upgrade implementation address
function registerUpgrade(address baseImpl, address upgradeImpl) external;
function registerUpgrade(address baseImpl, address upgradeImpl) external;
32,231
37
// Sets contract URI for the storefront-level metadata of the contract.
function setContractURI(string calldata _URI) external onlyProtocolAdmin { _contractURI = _URI; }
function setContractURI(string calldata _URI) external onlyProtocolAdmin { _contractURI = _URI; }
28,590
268
// Deposits liquidity in a range on the Uniswap pool.
function _mintLiquidity( int24 tickLower, int24 tickUpper, uint128 liquidity
function _mintLiquidity( int24 tickLower, int24 tickUpper, uint128 liquidity
9,815
0
//
// it("Deposit should result in balance increase for user in exchange", function () { // var account0 = accounts[0]; // var account0_starting_balance = web3.eth.getBalance(accounts[0]). // var account0_finishing_balance; // // var amount = 10; // // return bearchange.deployed().then(function(instance) { // return instance.depositEther({from: accounts[0], value: web3.toWei(amount, "ether")}); // }).then(function (txhash) { // gasUsed += txHash.receipt.cumulativeGasUsed * web3.eth.getTransaction(txHash.receipt.transactionHash).gasPrice.toNumber(); //here we have a problem // balanceAfterDeposit = web3.eth.getBalance(accounts[0]); // return myExchangeInstance.getEthBalanceInWei.call(); // // }); // // });
// it("Deposit should result in balance increase for user in exchange", function () { // var account0 = accounts[0]; // var account0_starting_balance = web3.eth.getBalance(accounts[0]). // var account0_finishing_balance; // // var amount = 10; // // return bearchange.deployed().then(function(instance) { // return instance.depositEther({from: accounts[0], value: web3.toWei(amount, "ether")}); // }).then(function (txhash) { // gasUsed += txHash.receipt.cumulativeGasUsed * web3.eth.getTransaction(txHash.receipt.transactionHash).gasPrice.toNumber(); //here we have a problem // balanceAfterDeposit = web3.eth.getBalance(accounts[0]); // return myExchangeInstance.getEthBalanceInWei.call(); // // }); // // });
51,477
18
// get the balance of a user./token The token type/ return The balance
function getBalance(ERC20 token, address user) public view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return user.balance; else return token.balanceOf(user); }
function getBalance(ERC20 token, address user) public view returns(uint) { if (token == ETH_TOKEN_ADDRESS) return user.balance; else return token.balanceOf(user); }
9,049
116
// otherwise return Pending
return LoanStatus.Pending;
return LoanStatus.Pending;
3,661
0
// The address of the adoption contract to be tested
Adoption adoption = Adoption(DeployedAddresses.Adoption());
Adoption adoption = Adoption(DeployedAddresses.Adoption());
14,359
131
// the result would be base value times paytable multiplier OVER multipler denominators since both paytable and jackpotMultiplier store integers assuming a certain divisor to be applied
return baseJackpotValue * paytableMultiplier / JACKPOT_MULTIPLIER_BASE / JACKPOT_PAYTABLE_BASE;
return baseJackpotValue * paytableMultiplier / JACKPOT_MULTIPLIER_BASE / JACKPOT_PAYTABLE_BASE;
2,408
54
// make settlement flag
emit DidLCUpdateState ( _lcID, updateParams[0], updateParams[1], updateParams[2], updateParams[3], updateParams[4], updateParams[5], _VCroot,
emit DidLCUpdateState ( _lcID, updateParams[0], updateParams[1], updateParams[2], updateParams[3], updateParams[4], updateParams[5], _VCroot,
30,336
24
// Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase /
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { require(_beneficiary != address(0)); require(_weiAmount != 0); }
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { require(_beneficiary != address(0)); require(_weiAmount != 0); }
6,906
159
// Eyes N°4 => Color White/Green
function item_4() public pure returns (string memory) { return eyesNoFillAndColorPupils(Colors.WHITE, Colors.GREEN); }
function item_4() public pure returns (string memory) { return eyesNoFillAndColorPupils(Colors.WHITE, Colors.GREEN); }
33,945