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
91
// Admin Functions //Sets a new price oracle for the controllerAdmin function to set a new price oracle return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the controller PriceOracle oldOracle = oracle; // Set controller's oracle to newOracle oracle = newOracle; // Emit NewPriceOracle(oldOracle, newOracle) emit NewPriceOracle(oldOracle, newOracle); return uint(Error.NO_ERROR); }
function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the controller PriceOracle oldOracle = oracle; // Set controller's oracle to newOracle oracle = newOracle; // Emit NewPriceOracle(oldOracle, newOracle) emit NewPriceOracle(oldOracle, newOracle); return uint(Error.NO_ERROR); }
3,189
6
// Verify _verification
bytes32 params; bytes memory signature; (params, signature) = abi.decode(_verification, (bytes32, bytes));
bytes32 params; bytes memory signature; (params, signature) = abi.decode(_verification, (bytes32, bytes));
18,197
92
// Allows the current superuser or owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
function transferOwnership(address _newOwner) public onlyOwnerOrSuperuser { _transferOwnership(_newOwner); }
function transferOwnership(address _newOwner) public onlyOwnerOrSuperuser { _transferOwnership(_newOwner); }
34,765
3
// nameHash -> address
mapping(bytes32 => address) public domains;
mapping(bytes32 => address) public domains;
27,510
152
// new function to burn tokens from a centralized owner _who The address which will be burned. _value The amount of tokens to burn.return A boolean that indicates if the operation was successful. /
function _forcedBurn(address _who, uint256 _value) internal
function _forcedBurn(address _who, uint256 _value) internal
26,356
1
// Unwraps the contract's WETH9 balance and sends it to recipient as ETH, with a percentage between/ 0 (exclusive), and 1 (inclusive) going to feeRecipient/The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
function unwrapWETH9WithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable;
function unwrapWETH9WithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable;
40,892
50
// Game session id counter. Points to next free game session slot. So gameIdCntr -1 is the number of game sessions created.
uint public gameIdCntr;
uint public gameIdCntr;
50,177
92
// Verifies a merkle proof for an account's whitelisted tokens _account Account to verify _whitelistedTokens Number of whitelisted tokens for _account _proof Merkle proof to be verifiedreturn isVerified True if the merkle proof is verified /
function verifyWhitelisted( address _account, uint256 _whitelistedTokens, bytes32[] calldata _proof ) public pure returns (bool isVerified)
function verifyWhitelisted( address _account, uint256 _whitelistedTokens, bytes32[] calldata _proof ) public pure returns (bool isVerified)
49,636
8
// push
bytes32 hash = _hash(_token, _id, msg.sender); orderInfo[hash] = Order(_orderType, msg.sender, _token, _id, _startPrice, _endPrice, block.number, _endBlock, 0, address(0), false); orderIdByToken[_token][_id].push(hash); orderIdBySeller[msg.sender].push(hash); console.log("%s token is of Sender %s", _id, IERC721(_token).ownerOf(_id)); console.log("Trying to send %s token to %s", _id, address(this));
bytes32 hash = _hash(_token, _id, msg.sender); orderInfo[hash] = Order(_orderType, msg.sender, _token, _id, _startPrice, _endPrice, block.number, _endBlock, 0, address(0), false); orderIdByToken[_token][_id].push(hash); orderIdBySeller[msg.sender].push(hash); console.log("%s token is of Sender %s", _id, IERC721(_token).ownerOf(_id)); console.log("Trying to send %s token to %s", _id, address(this));
28,966
40
// Add undistributed RGT
undistributedRgt += _rgtPerRftAtLastSpeedUpdate[i].sub(_rgtPerRftAtLastDistribution[i][holder]).mul(rftBalance).div(1e18);
undistributedRgt += _rgtPerRftAtLastSpeedUpdate[i].sub(_rgtPerRftAtLastDistribution[i][holder]).mul(rftBalance).div(1e18);
28,974
7
// make ETH rewards claimable to registered stakers
stakersETHRewards = (contractETHBalance * stakersETHRewardsPercentNumerator) / 100; uint256 totalRegisteredStakedTokens = 0; uint256 registeredStakersLength = lotteryFactory .getRegisteredStakersLength(); for (uint256 i = 0; i < registeredStakersLength; i++) { totalRegisteredStakedTokens += askoStaking.stakeValue(
stakersETHRewards = (contractETHBalance * stakersETHRewardsPercentNumerator) / 100; uint256 totalRegisteredStakedTokens = 0; uint256 registeredStakersLength = lotteryFactory .getRegisteredStakersLength(); for (uint256 i = 0; i < registeredStakersLength; i++) { totalRegisteredStakedTokens += askoStaking.stakeValue(
13,414
2
// Renders a JSON object for tokenURI
function tokenMetadata( bytes memory attributes, uint256 tokenId, uint256 number ) external view returns(bytes memory);
function tokenMetadata( bytes memory attributes, uint256 tokenId, uint256 number ) external view returns(bytes memory);
33,971
5
// if already in zone
teller[_address].pos = TellerPosition(lat, lng, countryId, postalCode); teller[_address].index = tellerInZone[countryId][postalCode].push(_address) - 1;
teller[_address].pos = TellerPosition(lat, lng, countryId, postalCode); teller[_address].index = tellerInZone[countryId][postalCode].push(_address) - 1;
25,675
6
// Performs a swap of input tokens to exact output WCHI tokens. /
function swapExactOutput (IERC20 inputToken, uint outputAmount, bytes calldata data) public virtual;
function swapExactOutput (IERC20 inputToken, uint outputAmount, bytes calldata data) public virtual;
6,914
29
// Function to get the total supply of tokens currently available /
function totalSupply() public view returns (uint256) { return tokens.length; }
function totalSupply() public view returns (uint256) { return tokens.length; }
14,709
23
// - Calculates the pending ERC20 reward tokens the user can claim_pid - The pool id_user - The address of the user return - the pending ERC20 reward tokens to be claimed/
function pendingRwd(uint256 _pid, address _user) external view returns (uint256)
function pendingRwd(uint256 _pid, address _user) external view returns (uint256)
13,728
12
// On-Chain Metadata Construction / REQUIRED for token contract
function hasOnchainMetadata(uint256) public view returns (bool) { return _useOnChainMetadata; }
function hasOnchainMetadata(uint256) public view returns (bool) { return _useOnChainMetadata; }
71,846
27
// Mainnet Dai https:etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0freadContract
address daiAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F; Erc20 dai = Erc20(daiAddress);
address daiAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F; Erc20 dai = Erc20(daiAddress);
2,804
8
// assign traits and mint
function setTraitsAndMint(uint256 _quantity) private { uint256 nextToBeMinted = totalSupply(); for (uint8 i; i < _quantity; i++) { metadata.setRandom(nextToBeMinted + i); } _mint(msg.sender, _quantity); }
function setTraitsAndMint(uint256 _quantity) private { uint256 nextToBeMinted = totalSupply(); for (uint8 i; i < _quantity; i++) { metadata.setRandom(nextToBeMinted + i); } _mint(msg.sender, _quantity); }
30,636
95
// total SAND used for purchase land
uint256 public totalSANDUsedForPurchase = 0; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( IERC20 _VEMP, address _adminaddr, uint256 _VEMPPerBlock,
uint256 public totalSANDUsedForPurchase = 0; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( IERC20 _VEMP, address _adminaddr, uint256 _VEMPPerBlock,
34,062
51
// check if it is called within the constructor solhint-disable-next-line avoid-tx-origin
require(msg.sender != tx.origin, "SF: APP_RULE_NO_REGISTRATION_FOR_EOA"); { uint256 cs;
require(msg.sender != tx.origin, "SF: APP_RULE_NO_REGISTRATION_FOR_EOA"); { uint256 cs;
26,117
7
// Create additional deeds for the existing supply of tokens of a collection/collection The address of the collection to add editions to/additionalEditions The amount of deeds to add
function increaseEditions( address collection, uint256 additionalEditions
function increaseEditions( address collection, uint256 additionalEditions
18,390
340
// Gets the current holder of the exclusive role, `roleId`. Reverts if `roleId` does not represent an initialized, exclusive role. roleId the ExclusiveRole membership to check.return the address of the current ExclusiveRole member. /
function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) { return roles[roleId].exclusiveRoleMembership.getMember(); }
function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) { return roles[roleId].exclusiveRoleMembership.getMember(); }
9,127
5
// Where the products will be stored
mapping (uint => Product) internal products;
mapping (uint => Product) internal products;
24,556
72
// Allows contract owner to notify the network that BTC has been paid to claiming user btcTxId Transaction ID of the BTC transfer from AMFEIX hot wallet toethTxId Transaction ID of the token transfer from amfeixPool to user Ethereum address customer Ethereum address of the claiming user btcAmount Amount of BTC paid to claiming user /
function btcDelivery(address btcTxId, address ethTxId, address customer, uint256 btcAmount) public virtual onlyOwner returns (bool) { uint256 swapRatio = _swapRatio; emit PaidBTC(btcTxId, ethTxId, customer, btcAmount, swapRatio); return true; }
function btcDelivery(address btcTxId, address ethTxId, address customer, uint256 btcAmount) public virtual onlyOwner returns (bool) { uint256 swapRatio = _swapRatio; emit PaidBTC(btcTxId, ethTxId, customer, btcAmount, swapRatio); return true; }
28,334
44
// the function take tokens from users to contract the sum is entered in whole tokens (1 = 1 token)
uint256 value = _value; require (_Investor != address(0)); require (value >= 1); value = value.mul(1 ether); token.acceptTokens(_Investor, value);
uint256 value = _value; require (_Investor != address(0)); require (value >= 1); value = value.mul(1 ether); token.acceptTokens(_Investor, value);
45,924
4
// CT -> X
function transport(address _to, uint _value) public payable { address _this = address(this); require(_this.balance >= _value, "@_value must <= _this.balance"); _to.transfer(_value); emit Transfer(_this, _to, _value, "@transport, CT -> X"); }
function transport(address _to, uint _value) public payable { address _this = address(this); require(_this.balance >= _value, "@_value must <= _this.balance"); _to.transfer(_value); emit Transfer(_this, _to, _value, "@transport, CT -> X"); }
15,663
11
// Returns the pool address for a given pair of tokens and a tick spacing value, or address 0 if it does not exist/tokenA and tokenB may be passed in either token0/token1 or token1/token0 order/tokenA The contract address of either token0 or token1/tokenB The contract address of the other token/tickSpacing The tick spacing value for the pool/ return pool The pool address
function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);
function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);
21,659
44
// Remove a debt token from the per-account list This function is called from `DebtToken` when user's balance changes to `0` The caller should ensure to not pass `address(0)` as `_account` account_ The account address /
function removeFromDebtTokensOfAccount(address account_) external onlyIfMsgSenderIsDebtToken { require(debtTokensOfAccount.remove(account_, msg.sender), "debt-token-doesnt-exist"); }
function removeFromDebtTokensOfAccount(address account_) external onlyIfMsgSenderIsDebtToken { require(debtTokensOfAccount.remove(account_, msg.sender), "debt-token-doesnt-exist"); }
6,765
33
// Processes the payment for minting and/or subscription renewal./paymentCurrency_ Payment currency address / (should be zero if the payment is supposed to be made in native currency)./amount_ Amount of tokens./isSubscriptionRenewal_ Boolean value indicating whether the operation corresponds to minting or subscription renewal.
function _processPayment(address paymentCurrency_, uint256 amount_, bool isSubscriptionRenewal_) private { unchecked { uint256 price; if (isSubscriptionRenewal_) { price = subscriptionPrice * amount_; } else { price = (tokenPrice + subscriptionPrice) * amount_; } if (paymentCurrency_ == address(tether)) { if (msg.value > 0) { revert NonZeroMsgValue(); } tether.safeTransferFrom(msg.sender, treasury, price / 10 ** (DECIMALS - tether.decimals())); } else if (paymentCurrency_ == address(0)) { (, int256 answer, , ,) = priceOracle.latestRoundData(); uint256 castedAnswer = answer.toUint256(); uint256 adjustmentFactor = 10 ** (DECIMALS - priceOracle.decimals()); uint256 actualPrice = msg.value * castedAnswer * adjustmentFactor / 1 ether; if (actualPrice < price) { revert InsufficientPrice(price - actualPrice); } else { uint256 nativeCurrencyPrice = price * 1 ether / (castedAnswer * adjustmentFactor); treasury.sendValue(nativeCurrencyPrice); if (msg.value > nativeCurrencyPrice) { payable(msg.sender).sendValue(msg.value - nativeCurrencyPrice); } } } else { revert InvalidPaymentCurrency(); } } }
function _processPayment(address paymentCurrency_, uint256 amount_, bool isSubscriptionRenewal_) private { unchecked { uint256 price; if (isSubscriptionRenewal_) { price = subscriptionPrice * amount_; } else { price = (tokenPrice + subscriptionPrice) * amount_; } if (paymentCurrency_ == address(tether)) { if (msg.value > 0) { revert NonZeroMsgValue(); } tether.safeTransferFrom(msg.sender, treasury, price / 10 ** (DECIMALS - tether.decimals())); } else if (paymentCurrency_ == address(0)) { (, int256 answer, , ,) = priceOracle.latestRoundData(); uint256 castedAnswer = answer.toUint256(); uint256 adjustmentFactor = 10 ** (DECIMALS - priceOracle.decimals()); uint256 actualPrice = msg.value * castedAnswer * adjustmentFactor / 1 ether; if (actualPrice < price) { revert InsufficientPrice(price - actualPrice); } else { uint256 nativeCurrencyPrice = price * 1 ether / (castedAnswer * adjustmentFactor); treasury.sendValue(nativeCurrencyPrice); if (msg.value > nativeCurrencyPrice) { payable(msg.sender).sendValue(msg.value - nativeCurrencyPrice); } } } else { revert InvalidPaymentCurrency(); } } }
9,422
20
// Causes a compilation error if super._unpause is not internal
function _unpause( address account ) internal
function _unpause( address account ) internal
21,028
138
// Controls state and access rights for contract functions Operational Control Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)Inspired and adapted from contract created by OpenZeppelin/
contract OperationalControl { /// Facilitates access & control for the game. /// Roles: /// -The Managers (Primary/Secondary): Has universal control of all elements (No ability to withdraw) /// -The Banker: The Bank can withdraw funds and adjust fees / prices. /// -otherManagers: Contracts that need access to functions for gameplay /// @dev Emited when contract is upgraded event ContractUpgrade(address newContract); /// @dev The addresses of the accounts (or contracts) that can execute actions within each roles. address public managerPrimary; address public managerSecondary; address public bankManager; // Contracts that require access for gameplay mapping(address => uint8) public otherManagers; // @dev Keeps track whether the contract is paused. When that is true, most actions are blocked bool public paused = false; // @dev Keeps track whether the contract erroredOut. When that is true, most actions are blocked & refund can be claimed bool public error = false; /** * @dev Operation modifiers for limiting access only to Managers */ modifier onlyManager() { require (msg.sender == managerPrimary || msg.sender == managerSecondary); _; } /** * @dev Operation modifiers for limiting access to only Banker */ modifier onlyBanker() { require (msg.sender == bankManager); _; } /** * @dev Operation modifiers for any Operators */ modifier anyOperator() { require ( msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); _; } /** * @dev Operation modifier for any Other Manager */ modifier onlyOtherManagers() { require (otherManagers[msg.sender] == 1); _; } /** * @dev Assigns a new address to act as the Primary Manager. * @param _newGM New primary manager address */ function setPrimaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerPrimary = _newGM; } /** * @dev Assigns a new address to act as the Secondary Manager. * @param _newGM New Secondary Manager Address */ function setSecondaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerSecondary = _newGM; } /** * @dev Assigns a new address to act as the Banker. * @param _newBK New Banker Address */ function setBanker(address _newBK) external onlyManager { require (_newBK != address(0)); bankManager = _newBK; } /// @dev Assigns a new address to act as the Other Manager. (State = 1 is active, 0 is disabled) function setOtherManager(address _newOp, uint8 _state) external onlyManager { require (_newOp != address(0)); otherManagers[_newOp] = _state; } /*** Pausable functionality adapted from OpenZeppelin ***/ /// @dev Modifier to allow actions only when the contract IS NOT paused modifier whenNotPaused() { require (!paused); _; } /// @dev Modifier to allow actions only when the contract IS paused modifier whenPaused { require (paused); _; } /// @dev Modifier to allow actions only when the contract has Error modifier whenError { require (error); _; } /** * @dev Called by any Operator role to pause the contract. * Used only if a bug or exploit is discovered (Here to limit losses / damage) */ function pause() external onlyManager whenNotPaused { paused = true; } /** * @dev Unpauses the smart contract. Can only be called by the Game Master */ function unpause() public onlyManager whenPaused { // can't unpause if contract was upgraded paused = false; } /** * @dev Errors out the contract thus mkaing the contract non-functionable */ function hasError() public onlyManager whenPaused { error = true; } /** * @dev Removes the Error Hold from the contract and resumes it for working */ function noError() public onlyManager whenPaused { error = false; } }
contract OperationalControl { /// Facilitates access & control for the game. /// Roles: /// -The Managers (Primary/Secondary): Has universal control of all elements (No ability to withdraw) /// -The Banker: The Bank can withdraw funds and adjust fees / prices. /// -otherManagers: Contracts that need access to functions for gameplay /// @dev Emited when contract is upgraded event ContractUpgrade(address newContract); /// @dev The addresses of the accounts (or contracts) that can execute actions within each roles. address public managerPrimary; address public managerSecondary; address public bankManager; // Contracts that require access for gameplay mapping(address => uint8) public otherManagers; // @dev Keeps track whether the contract is paused. When that is true, most actions are blocked bool public paused = false; // @dev Keeps track whether the contract erroredOut. When that is true, most actions are blocked & refund can be claimed bool public error = false; /** * @dev Operation modifiers for limiting access only to Managers */ modifier onlyManager() { require (msg.sender == managerPrimary || msg.sender == managerSecondary); _; } /** * @dev Operation modifiers for limiting access to only Banker */ modifier onlyBanker() { require (msg.sender == bankManager); _; } /** * @dev Operation modifiers for any Operators */ modifier anyOperator() { require ( msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); _; } /** * @dev Operation modifier for any Other Manager */ modifier onlyOtherManagers() { require (otherManagers[msg.sender] == 1); _; } /** * @dev Assigns a new address to act as the Primary Manager. * @param _newGM New primary manager address */ function setPrimaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerPrimary = _newGM; } /** * @dev Assigns a new address to act as the Secondary Manager. * @param _newGM New Secondary Manager Address */ function setSecondaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerSecondary = _newGM; } /** * @dev Assigns a new address to act as the Banker. * @param _newBK New Banker Address */ function setBanker(address _newBK) external onlyManager { require (_newBK != address(0)); bankManager = _newBK; } /// @dev Assigns a new address to act as the Other Manager. (State = 1 is active, 0 is disabled) function setOtherManager(address _newOp, uint8 _state) external onlyManager { require (_newOp != address(0)); otherManagers[_newOp] = _state; } /*** Pausable functionality adapted from OpenZeppelin ***/ /// @dev Modifier to allow actions only when the contract IS NOT paused modifier whenNotPaused() { require (!paused); _; } /// @dev Modifier to allow actions only when the contract IS paused modifier whenPaused { require (paused); _; } /// @dev Modifier to allow actions only when the contract has Error modifier whenError { require (error); _; } /** * @dev Called by any Operator role to pause the contract. * Used only if a bug or exploit is discovered (Here to limit losses / damage) */ function pause() external onlyManager whenNotPaused { paused = true; } /** * @dev Unpauses the smart contract. Can only be called by the Game Master */ function unpause() public onlyManager whenPaused { // can't unpause if contract was upgraded paused = false; } /** * @dev Errors out the contract thus mkaing the contract non-functionable */ function hasError() public onlyManager whenPaused { error = true; } /** * @dev Removes the Error Hold from the contract and resumes it for working */ function noError() public onlyManager whenPaused { error = false; } }
38,201
40
// A workaround for MintableERC721Predicate that requires a depositor to be equal to token owner: https:github.com/maticnetwork/pos-portal/blob/88dbf0a88fd68fa11f7a3b9d36629930f6b93a05/contracts/root/TokenPredicates/MintableERC721Predicate.solL94
_transfer(_msgSender(), address(this), tokenId); _approve(predicate, tokenId); IRootChainManager(manager).depositFor(_msgSender(), address(this), abi.encode(tokenId));
_transfer(_msgSender(), address(this), tokenId); _approve(predicate, tokenId); IRootChainManager(manager).depositFor(_msgSender(), address(this), abi.encode(tokenId));
6,492
146
// ErrorLog( "cannot afford to pay", calcPayment( submissionData.numShares, submissionData.difficulty ) );
VerifyClaim( msg.sender, 0x84000000, payment ); return false;
VerifyClaim( msg.sender, 0x84000000, payment ); return false;
34,862
93
// We have set a capped price. Log it so we can detect the situation and investigate.
emit CappedPricePosted(asset, requestedPriceMantissa, localVars.cappingAnchorPriceMantissa, localVars.price.mantissa);
emit CappedPricePosted(asset, requestedPriceMantissa, localVars.cappingAnchorPriceMantissa, localVars.price.mantissa);
19,420
9
// 挤奶员;
string milkingUser;
string milkingUser;
52,996
83
// TODO Check test commentuint256 public onlyTestTimestamp = 0;
//function onlyTestSetTimestamp(uint256 newTimestamp) public { // onlyTestTimestamp = newTimestamp; //}
//function onlyTestSetTimestamp(uint256 newTimestamp) public { // onlyTestTimestamp = newTimestamp; //}
51,387
45
// if (feeAmount > 0) stakingToken.safeTransfer(_owner, feeAmount); stakingToken.safeTransfer(msg.sender, amount.sub(feeAmount));
stakingToken.safeTransfer(msg.sender, amount); totalSupply = totalSupply.sub(amount); emit Withdraw(msg.sender, amount);
stakingToken.safeTransfer(msg.sender, amount); totalSupply = totalSupply.sub(amount); emit Withdraw(msg.sender, amount);
11,147
7
// MANAGER ONLY: Updates address receiving issue/redeem fees for a given SetToken._setToken Instance of the SetToken to update fee recipient _newFeeRecipientNew fee recipient address /
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
49,937
41
// Get the current owner /
function owner() public view override returns ( address )
function owner() public view override returns ( address )
34,711
4
// Get the Avastar Replicant associated with a given Token ID _tokenId the token ID of the specified Replicantreturn tokenId the Replicant's token IDreturn serial the Replicant's serialreturn traits the Replicant's trait hashreturn generation the Replicant's generationreturn gender the Replicant's genderreturn ranking the Replicant's ranking /
function getReplicantByTokenId(uint256 _tokenId) external view returns ( uint256 tokenId, uint256 serial, uint256 traits, Generation generation, Gender gender, uint8 ranking
function getReplicantByTokenId(uint256 _tokenId) external view returns ( uint256 tokenId, uint256 serial, uint256 traits, Generation generation, Gender gender, uint8 ranking
47,136
86
// Getter for Tokens monthlyLimit
uint256 public monthlyLimit;
uint256 public monthlyLimit;
18,232
228
// Ensure whether or not contract has been set to disaster statereturn disasterState /
function isDisasterStateSet() external view returns (bool);
function isDisasterStateSet() external view returns (bool);
12,418
61
// Pausable ERC827 token ERC827 token modified with pausable functions. /
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value, _data); } function approve(address _spender, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.approve(_spender, _value, _data); } function increaseApproval(address _spender, uint _addedValue, bytes _data) public whenNotPaused returns (bool) { return super.increaseApproval(_spender, _addedValue, _data); } function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public whenNotPaused returns (bool) { return super.decreaseApproval(_spender, _subtractedValue, _data); } }
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value, _data); } function approve(address _spender, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.approve(_spender, _value, _data); } function increaseApproval(address _spender, uint _addedValue, bytes _data) public whenNotPaused returns (bool) { return super.increaseApproval(_spender, _addedValue, _data); } function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public whenNotPaused returns (bool) { return super.decreaseApproval(_spender, _subtractedValue, _data); } }
37,632
22
// allows withdraw of vest if enough time has past since last withdraw and address balance is below maxholdings
function withdraw() external { uint _balance = shiburai.balanceOf(msg.sender); require(_balance <= maxHoldings, "Cannot accumulate"); require(balances[msg.sender] >= withdrawAmount, "Insuffecient Balance"); require(lastWithdraw[msg.sender].add(waitTime) <= block.timestamp, "Must wait more time"); lastWithdraw[msg.sender] = block.timestamp; shiburai.transfer(address(msg.sender), withdrawAmount); balances[msg.sender] = balances[msg.sender].sub(withdrawAmount); contractShiburaiBalance = contractShiburaiBalance.sub(withdrawAmount); }
function withdraw() external { uint _balance = shiburai.balanceOf(msg.sender); require(_balance <= maxHoldings, "Cannot accumulate"); require(balances[msg.sender] >= withdrawAmount, "Insuffecient Balance"); require(lastWithdraw[msg.sender].add(waitTime) <= block.timestamp, "Must wait more time"); lastWithdraw[msg.sender] = block.timestamp; shiburai.transfer(address(msg.sender), withdrawAmount); balances[msg.sender] = balances[msg.sender].sub(withdrawAmount); contractShiburaiBalance = contractShiburaiBalance.sub(withdrawAmount); }
46,413
0
// solhint-disable var-name-mixedcase, func-name-mixedcase
interface ICurveFactoryPlainPool { function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount ) external returns (uint256); function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256); function exchange( int128 i, int128 j, uint256 _dx, uint256 _min_dy, address _receiver ) external returns (uint256); function get_dy( int128 i, int128 j, uint256 dx ) external view returns (uint256); function coins(uint256 index) external view returns (address); }
interface ICurveFactoryPlainPool { function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount ) external returns (uint256); function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256); function exchange( int128 i, int128 j, uint256 _dx, uint256 _min_dy, address _receiver ) external returns (uint256); function get_dy( int128 i, int128 j, uint256 dx ) external view returns (uint256); function coins(uint256 index) external view returns (address); }
29,173
109
// get the address at a specific index from array revert if the index is out of bounds self Storage array containing address type variables index the index in the array /
function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) { require(index < size(self), "the index is out of bounds"); return self._items[index]; }
function getAddressAtIndex(Addresses storage self, uint256 index) internal view returns (address) { require(index < size(self), "the index is out of bounds"); return self._items[index]; }
78,005
161
// uniswap token0 has a lower address than token1if tokenIn<tokenOut, we are selling an exact amount of token0 in exchange for token1zeroForOne determines which token is being sold and which is being bought
bool zeroForOne = tokenIn < tokenOut;
bool zeroForOne = tokenIn < tokenOut;
24,070
35
// Withdraw ETH to the owner account. Ownable-->Pausable-->AlchemyBase
function withdrawETH() external onlyCAO { cfo.transfer(address(this).balance); }
function withdrawETH() external onlyCAO { cfo.transfer(address(this).balance); }
68,963
3
// Extend parent behavior requiring purchase to respect the funding cap. beneficiary Token purchaser weiAmount Amount of wei contributed /
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view { super._preValidatePurchase(beneficiary, weiAmount); require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded"); require(weiAmount <= _maxContribution, "max contribution exceeded"); require(weiAmount >= _minContribution, "contribution too low"); }
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view { super._preValidatePurchase(beneficiary, weiAmount); require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded"); require(weiAmount <= _maxContribution, "max contribution exceeded"); require(weiAmount >= _minContribution, "contribution too low"); }
11,254
25
// for reading the user's canPublish permission
function canPublish(address user) external view returns (bool) { return permissionsSet[user].canPublish; }
function canPublish(address user) external view returns (bool) { return permissionsSet[user].canPublish; }
25,595
3
// keccak256( "EIP712Domain(uint256 chainId,address verifyingContract)" );
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = 0x80b006280932094e7cc965863eb5118dc07e5d272c6670c4a7c87299e04fceeb;
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = 0x80b006280932094e7cc965863eb5118dc07e5d272c6670c4a7c87299e04fceeb;
133
2
// Throws if the sender is not the SetToken methodologist /
modifier onlyMethodologist() { require(msg.sender == methodologist, "Must be methodologist"); _; }
modifier onlyMethodologist() { require(msg.sender == methodologist, "Must be methodologist"); _; }
45,535
18
// Public functions //Contract constructor function sets dutch auction contract address and assigns all tokens to dutch auction./dutchAuction Address of dutch auction contract./owners Array of addresses receiving preassigned tokens./tokens Array of preassigned token amounts.
function GnosisToken(address dutchAuction, address[] owners, uint[] tokens) public
function GnosisToken(address dutchAuction, address[] owners, uint[] tokens) public
38,324
54
// Return the kill factor for the goblin + ETH debt, using 1e4 as denom.
function killFactor(address goblin, uint256 /* debt */) external view returns (uint256) { require(isStable(goblin), "!stable"); return uint256(goblins[goblin].killFactor); }
function killFactor(address goblin, uint256 /* debt */) external view returns (uint256) { require(isStable(goblin), "!stable"); return uint256(goblins[goblin].killFactor); }
41,962
66
// Stake tokens to earn rewards tokenAddress Staking token address amount Amount of tokens to be staked /
function stake( address referrerAddress, address tokenAddress, uint256 amount
function stake( address referrerAddress, address tokenAddress, uint256 amount
57,112
588
// Inserts 192 bit shifted by an offset into a 256 bit word, replacing the old value. Returns the new word. Assumes `value` can be represented using 192 bits. /
function insertBits192( bytes32 word, bytes32 value, uint256 offset
function insertBits192( bytes32 word, bytes32 value, uint256 offset
5,043
105
// This function is a function in the ERC721A inherited contractWe override it so we can set a custom variable
function _baseURI() internal view virtual override returns (string memory) { return baseURI; //put baseURI in here }
function _baseURI() internal view virtual override returns (string memory) { return baseURI; //put baseURI in here }
37,766
3
// The L2 token address
ERC20 public immutable l2Token;
ERC20 public immutable l2Token;
39,601
275
// Given that we need to have a greater final balance out, the invariant needs to be rounded up
uint256 invariant = _calculateInvariant(amplificationParameter, balances, true); balances[tokenIndexIn] = balances[tokenIndexIn].add(tokenAmountIn); uint256 finalBalanceOut = _getTokenBalanceGivenInvariantAndAllOtherBalances( amplificationParameter, balances, invariant, tokenIndexOut );
uint256 invariant = _calculateInvariant(amplificationParameter, balances, true); balances[tokenIndexIn] = balances[tokenIndexIn].add(tokenAmountIn); uint256 finalBalanceOut = _getTokenBalanceGivenInvariantAndAllOtherBalances( amplificationParameter, balances, invariant, tokenIndexOut );
64,001
185
// Call DST to transfer tokens
dstContract.buyForHackerGold(hkg);
dstContract.buyForHackerGold(hkg);
32,452
22
// Add the IPFS group information
ipfsData.push(_ipfsGroup);
ipfsData.push(_ipfsGroup);
16,966
120
// This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. /
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
57,994
17
// 将私募代理人地址从白名单移除 _addr 私募代理人地址 /
function removeAddressFromPrivateWhiteList(address _addr) public onlyOwner
function removeAddressFromPrivateWhiteList(address _addr) public onlyOwner
50,168
214
// Check amount.
if (params.sellAmount > orderInfo.remainingAmount) { revert("_sellNFT/EXCEEDS_REMAINING_AMOUNT"); }
if (params.sellAmount > orderInfo.remainingAmount) { revert("_sellNFT/EXCEEDS_REMAINING_AMOUNT"); }
2,568
478
// Go back to waiting for a signature
_d.setAwaitingWithdrawalSignature(); _d.logRedemptionRequested( msg.sender, _sighash, _d.utxoValue(), _d.redeemerOutputScript, _d.latestRedemptionFee, _d.utxoOutpoint);
_d.setAwaitingWithdrawalSignature(); _d.logRedemptionRequested( msg.sender, _sighash, _d.utxoValue(), _d.redeemerOutputScript, _d.latestRedemptionFee, _d.utxoOutpoint);
31,715
537
// Returns the URI for a given token ID. May return an empty string. If the token's URI is non-empty and a base URI was set (via
* {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // Even if there is a base URI, it is only appended to non-empty token-specific URIs if (bytes(_tokenURI).length == 0) { return ""; } else { // abi.encodePacked is being used to concatenate strings return string(abi.encodePacked(_baseURI, _tokenURI)); } }
* {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // Even if there is a base URI, it is only appended to non-empty token-specific URIs if (bytes(_tokenURI).length == 0) { return ""; } else { // abi.encodePacked is being used to concatenate strings return string(abi.encodePacked(_baseURI, _tokenURI)); } }
2,215
21
// ===============================================================================================================/Events/ ===============================================================================================================
event LogExecutorAdded(address executor); event LogExecutorRemoved(address executor); event LogSmartContractActorFunded(string actorRole, address actor, uint256 timestamp); event LogPullPaymentExecuted( address customerAddress, address receiverAddress, uint256 amountInPMA, bytes32 paymentID, bytes32 businessID,
event LogExecutorAdded(address executor); event LogExecutorRemoved(address executor); event LogSmartContractActorFunded(string actorRole, address actor, uint256 timestamp); event LogPullPaymentExecuted( address customerAddress, address receiverAddress, uint256 amountInPMA, bytes32 paymentID, bytes32 businessID,
28,865
15
// Emits a {ProviderRemoved} event indicating the address of the removed provider.provider fee is also set to 0. Requirements: - the caller must be the owner of the contract- the provider must already exist in the registryprovider provider to remove /
function removeProvider(address provider) external onlyOwner { require( _provider[provider], "RiskProviderRegistry::removeProvider: Provider does not exist" ); _provider[provider] = false; feeHandler.setRiskProviderFee(provider, 0); emit ProviderRemoved(provider);
function removeProvider(address provider) external onlyOwner { require( _provider[provider], "RiskProviderRegistry::removeProvider: Provider does not exist" ); _provider[provider] = false; feeHandler.setRiskProviderFee(provider, 0); emit ProviderRemoved(provider);
35,063
5
// Binance 4
m_exchangeAirdropAddresses[3] = 0x0681d8Db095565FE8A346fA0277bFfdE9C0eDBBF; m_exchangeAirdropAmounts[3] = 5953786344335;
m_exchangeAirdropAddresses[3] = 0x0681d8Db095565FE8A346fA0277bFfdE9C0eDBBF; m_exchangeAirdropAmounts[3] = 5953786344335;
39,114
395
// StableMasterStorage/Angle Core Team/`StableMaster` is the contract handling all the collateral types accepted for a given stablecoin/ It does all the accounting and is the point of entry in the protocol for stable holders and seekers as well as SLPs/This file contains all the variables and parameters used in the `StableMaster` contract
contract StableMasterStorage is StableMasterEvents, FunctionUtils { // All the details about a collateral that are going to be stored in `StableMaster` struct Collateral { // Interface for the token accepted by the underlying `PoolManager` contract IERC20 token; // Reference to the `SanToken` for the pool ISanToken sanToken; // Reference to the `PerpetualManager` for the pool IPerpetualManager perpetualManager; // Adress of the oracle for the change rate between // collateral and the corresponding stablecoin IOracle oracle; // Amount of collateral in the reserves that comes from users // converted in stablecoin value. Updated at minting and burning. // A `stocksUsers` of 10 for a collateral type means that overall the balance of the collateral from users // that minted/burnt stablecoins using this collateral is worth 10 of stablecoins uint256 stocksUsers; // Exchange rate between sanToken and collateral uint256 sanRate; // Base used in the collateral implementation (ERC20 decimal) uint256 collatBase; // Parameters for SLPs and update of the `sanRate` SLPData slpData; // All the fees parameters MintBurnData feeData; } // ============================ Variables and References ===================================== /// @notice Maps a `PoolManager` contract handling a collateral for this stablecoin to the properties of the struct above mapping(IPoolManager => Collateral) public collateralMap; /// @notice Reference to the `AgToken` used in this `StableMaster` /// This reference cannot be changed IAgToken public agToken; // Maps a contract to an address corresponding to the `IPoolManager` address // It is typically used to avoid passing in parameters the address of the `PerpetualManager` when `PerpetualManager` // is calling `StableMaster` to get information // It is the Access Control equivalent for the `SanToken`, `PoolManager`, `PerpetualManager` and `FeeManager` // contracts associated to this `StableMaster` mapping(address => IPoolManager) internal _contractMap; // List of all collateral managers IPoolManager[] internal _managerList; // Reference to the `Core` contract of the protocol ICore internal _core; }
contract StableMasterStorage is StableMasterEvents, FunctionUtils { // All the details about a collateral that are going to be stored in `StableMaster` struct Collateral { // Interface for the token accepted by the underlying `PoolManager` contract IERC20 token; // Reference to the `SanToken` for the pool ISanToken sanToken; // Reference to the `PerpetualManager` for the pool IPerpetualManager perpetualManager; // Adress of the oracle for the change rate between // collateral and the corresponding stablecoin IOracle oracle; // Amount of collateral in the reserves that comes from users // converted in stablecoin value. Updated at minting and burning. // A `stocksUsers` of 10 for a collateral type means that overall the balance of the collateral from users // that minted/burnt stablecoins using this collateral is worth 10 of stablecoins uint256 stocksUsers; // Exchange rate between sanToken and collateral uint256 sanRate; // Base used in the collateral implementation (ERC20 decimal) uint256 collatBase; // Parameters for SLPs and update of the `sanRate` SLPData slpData; // All the fees parameters MintBurnData feeData; } // ============================ Variables and References ===================================== /// @notice Maps a `PoolManager` contract handling a collateral for this stablecoin to the properties of the struct above mapping(IPoolManager => Collateral) public collateralMap; /// @notice Reference to the `AgToken` used in this `StableMaster` /// This reference cannot be changed IAgToken public agToken; // Maps a contract to an address corresponding to the `IPoolManager` address // It is typically used to avoid passing in parameters the address of the `PerpetualManager` when `PerpetualManager` // is calling `StableMaster` to get information // It is the Access Control equivalent for the `SanToken`, `PoolManager`, `PerpetualManager` and `FeeManager` // contracts associated to this `StableMaster` mapping(address => IPoolManager) internal _contractMap; // List of all collateral managers IPoolManager[] internal _managerList; // Reference to the `Core` contract of the protocol ICore internal _core; }
44,344
170
// EVENTS
event TokenMinted(uint tokenId);
event TokenMinted(uint tokenId);
40,203
232
// Gets the cumulative sum of the transfer destination's "before receive" withdrawable reward amount and the cumulative sum of the maximum mint amount. /
(uint256 amountTo, uint256 priceTo) = _calculateAmount(_property, _to);
(uint256 amountTo, uint256 priceTo) = _calculateAmount(_property, _to);
35,066
8
// Set the oracle fee for requesting randomnessfee uint256 /
function setFee(uint256 fee) public onlyOwner { s_fee = fee; }
function setFee(uint256 fee) public onlyOwner { s_fee = fee; }
6,607
64
// Executed when a purchase has been validated and is ready to be executed. Doesn&39;t necessarily emit/sendtokens. beneficiary Address receiving the tokens tokenAmount Number of tokens to be purchased /
function _processPurchase(address beneficiary, uint256 tokenAmount) internal { _deliverTokens(beneficiary, tokenAmount); }
function _processPurchase(address beneficiary, uint256 tokenAmount) internal { _deliverTokens(beneficiary, tokenAmount); }
19,537
39
// Modifier to allow function calls only from the whitelisted address. /
modifier onlyWhitelisted() { require(whitelist[msg.sender], "Not a whitelisted address"); _; }
modifier onlyWhitelisted() { require(whitelist[msg.sender], "Not a whitelisted address"); _; }
50,655
5
// Enforce owners only
modifier onlyOwners() { require(isOwner(msg.sender), "MREQ2: Not an Owner."); _; }
modifier onlyOwners() { require(isOwner(msg.sender), "MREQ2: Not an Owner."); _; }
30,130
123
// File: contracts\ERC721.sol/the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // 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 token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // 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 token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
3,314
9
// Selling Southparkcoins
function sell_southparkcoins(address investor, uint southparkcoins_sold) external { equity_southparkcoins[investor] -= southparkcoins_sold; equity_usd[investor] = equity_southparkcoins[investor] / 1; total_southparkcoins_bought -= southparkcoins_sold; }
function sell_southparkcoins(address investor, uint southparkcoins_sold) external { equity_southparkcoins[investor] -= southparkcoins_sold; equity_usd[investor] = equity_southparkcoins[investor] / 1; total_southparkcoins_bought -= southparkcoins_sold; }
52,653
47
// Deposit to the `SeniorPool` and stake your shares with a lock-up in the same transaction./usdcAmount The amount of USDC to deposit into the senior pool. All shares from deposit/ will be staked./lockupPeriod The period over which to lock staked tokens
function depositAndStakeWithLockup(uint256 usdcAmount, LockupPeriod lockupPeriod) public nonReentrant whenNotPaused updateReward(0)
function depositAndStakeWithLockup(uint256 usdcAmount, LockupPeriod lockupPeriod) public nonReentrant whenNotPaused updateReward(0)
27,295
448
// if credit balance exists, if amount owed > creidt credit zero add amount else reduce credit by certain amount. else if credit balance doesn't exist add amount to balance TODO: this function should have an event
function _updateBenefactorBalance(address benefactor) public { uint256 patronageDueForBenefactor = patronageDueBenefactor(benefactor); if (patronageDueForBenefactor > 0) { _increaseBenefactorBalance(benefactor, patronageDueForBenefactor); } timeLastCollectedBenefactor[benefactor] = now; }
function _updateBenefactorBalance(address benefactor) public { uint256 patronageDueForBenefactor = patronageDueBenefactor(benefactor); if (patronageDueForBenefactor > 0) { _increaseBenefactorBalance(benefactor, patronageDueForBenefactor); } timeLastCollectedBenefactor[benefactor] = now; }
27,141
53
// freezing account list
mapping(address => FreezingNode[]) internal c_freezing_list;
mapping(address => FreezingNode[]) internal c_freezing_list;
36,831
276
// Return list of keepers
function keepers() external view returns (address[] memory) { return _keepers.values(); }
function keepers() external view returns (address[] memory) { return _keepers.values(); }
5,440
441
// Remove compound approval to be extra safe
success = config.getUSDC().approve(address(cUSDC), 0); require(success, "Failed to approve USDC for compound");
success = config.getUSDC().approve(address(cUSDC), 0); require(success, "Failed to approve USDC for compound");
61,914
23
// Allows a whitelister to enable assiciate wrappers to a token/_token Address of the token/_wrapper Address of the exchange/_isWhitelisted Bool whitelisted
function whitelistTokenOnWrapper(address _token, address _wrapper, bool _isWhitelisted) external onlyAdmin
function whitelistTokenOnWrapper(address _token, address _wrapper, bool _isWhitelisted) external onlyAdmin
50,454
135
// Get flashloan fee for flashloan amount before make product(BiFi-X)handlerID The ID of handler with accumulated flashloan feeamount The amount of flashloan amountbifiAmount The amount of Bifi amount return The amount of fee for flashloan amount/
function getFeeFromArguments( uint256 handlerID, uint256 amount, uint256 bifiAmount
function getFeeFromArguments( uint256 handlerID, uint256 amount, uint256 bifiAmount
12,577
10
// When minting
_addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId);
_addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId);
10,958
15
// Custom functions
function setBaseURI(string memory uri_) external onlyRole(DEFAULT_ADMIN_ROLE)
function setBaseURI(string memory uri_) external onlyRole(DEFAULT_ADMIN_ROLE)
24,443
13
// Estimate staking reward for a user. user Address of the user.return Estimated staking reward. /
function calculateStakingReward(address user) public view returns (uint256) { uint256 staked = stakedRewards[user]; if (staked == 0) return 0; uint256 timeStaked = block.timestamp - stakedStartTime[user]; if (timeStaked >= AUTO_STAKE_DURATION) return staked; uint256 reward = staked.mul(timeStaked).mul(staked).div(AUTO_STAKE_DURATION); return reward; }
function calculateStakingReward(address user) public view returns (uint256) { uint256 staked = stakedRewards[user]; if (staked == 0) return 0; uint256 timeStaked = block.timestamp - stakedStartTime[user]; if (timeStaked >= AUTO_STAKE_DURATION) return staked; uint256 reward = staked.mul(timeStaked).mul(staked).div(AUTO_STAKE_DURATION); return reward; }
14,017
2
// constructor() { assert(isContract(this) == false) }
function isContract(address addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(addr) }
function isContract(address addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(addr) }
2,991
129
// add report
fundManagerCashedOut = fundManagerCashedOut.add(fundManagerCut);
fundManagerCashedOut = fundManagerCashedOut.add(fundManagerCut);
45,856
100
// Get the initial tokens and balances for the pool.
(address[] memory tokens, uint256[] memory balances) = getInitialTokensAndBalances( listID, indexSize, uint144(initialWethValue) ); initializer.initialize(address(this), poolAddress, tokens, balances); emit NewPoolInitializer( poolAddress,
(address[] memory tokens, uint256[] memory balances) = getInitialTokensAndBalances( listID, indexSize, uint144(initialWethValue) ); initializer.initialize(address(this), poolAddress, tokens, balances); emit NewPoolInitializer( poolAddress,
75,758
62
// Notifies the managed contracts on a change in a contract address/invokes the refreshContracts() function in each contract that queries the relevant contract addresses
function notifyOnContractsChange() private { for (uint i = 0; i < managedContractAddresses.length; i++) { IManagedContract(managedContractAddresses[i]).refreshContracts(); } }
function notifyOnContractsChange() private { for (uint i = 0; i < managedContractAddresses.length; i++) { IManagedContract(managedContractAddresses[i]).refreshContracts(); } }
69,029
16
// Function to set pre-sale slot3 window w.r.t sale start time _daysPrior number of days prior to sale start time _durationInSecs duration of presale in seconds or epoch from slot3 start time /
function setPreSaleSlot3Window(uint _daysPrior, uint _durationInSecs) external onlyOwner { presaleSlot3StartTime = saleStartTime - (_daysPrior * 24 * 60 * 60); presaleSlot3EndTime = presaleSlot3StartTime + _durationInSecs; require(presaleSlot3EndTime <= saleStartTime, 'Presale Slot3 end time greater than sale time'); }
function setPreSaleSlot3Window(uint _daysPrior, uint _durationInSecs) external onlyOwner { presaleSlot3StartTime = saleStartTime - (_daysPrior * 24 * 60 * 60); presaleSlot3EndTime = presaleSlot3StartTime + _durationInSecs; require(presaleSlot3EndTime <= saleStartTime, 'Presale Slot3 end time greater than sale time'); }
32,469
77
// We need to convert
if (routes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(router, 0); IERC20(_token).safeApprove(router, balanceToSwap); IUniswapV2Router02(router).swapExactTokensForTokens( balanceToSwap, 1, // We will accept any amount
if (routes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(router, 0); IERC20(_token).safeApprove(router, balanceToSwap); IUniswapV2Router02(router).swapExactTokensForTokens( balanceToSwap, 1, // We will accept any amount
11,256
20
// Check allowance if owner if not sender
if (msg.sender != _owner) { uint256 currentAllowance = allowance(_owner, msg.sender); require(currentAllowance >= _shares, "ERC4626: redeem exceeds allowance"); _approve(_owner, msg.sender, currentAllowance - _shares); }
if (msg.sender != _owner) { uint256 currentAllowance = allowance(_owner, msg.sender); require(currentAllowance >= _shares, "ERC4626: redeem exceeds allowance"); _approve(_owner, msg.sender, currentAllowance - _shares); }
37,152
3
// Check if already called for the current epoch
require(!isCurrentEpochRun(), "Current epoch already run"); lastRunEpoch = currentEpoch();
require(!isCurrentEpochRun(), "Current epoch already run"); lastRunEpoch = currentEpoch();
22,324
3
// Invests the underlying asset./amount The amount of tokens to invest./Assume the contract's balance is greater than the amount
function _skim(uint256 amount) internal virtual;
function _skim(uint256 amount) internal virtual;
24,674
83
// Builds a prefixed hash to mimic the behavior of eth_sign.
function prefixed(bytes32 hash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hash)); }
function prefixed(bytes32 hash) internal view returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hash)); }
10,721
488
// transfer to the core contract
core.transferToReserve.value(msg.value)(_reserve, msg.sender, _amount);
core.transferToReserve.value(msg.value)(_reserve, msg.sender, _amount);
12,228