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
123
// If tokens are already locked, then functions extendLock or increaseLockAmount should be used to make any changes
require(_amount <= _balances[_of], NOT_ENOUGH_TOKENS); // 추가 require(tokensLocked(_of, _reason) == 0, ALREADY_LOCKED); require(_amount != 0, AMOUNT_ZERO); if (locked[_of][_reason].amount == 0){ lockReason[_of].push(_reason); }
require(_amount <= _balances[_of], NOT_ENOUGH_TOKENS); // 추가 require(tokensLocked(_of, _reason) == 0, ALREADY_LOCKED); require(_amount != 0, AMOUNT_ZERO); if (locked[_of][_reason].amount == 0){ lockReason[_of].push(_reason); }
52,730
1
// Storage for ticket information
struct TicketInfo { address owner; uint256 number; bool claimed; uint256 lotteryId; }
struct TicketInfo { address owner; uint256 number; bool claimed; uint256 lotteryId; }
12,667
11
// List of addresses who contributed in crowdsales
EnumerableSet.AddressSet private _investors;
EnumerableSet.AddressSet private _investors;
20,767
14
// Revoke a user membership
function remove_member(address payable exMember) public onlyRole(DEFAULT_ADMIN_ROLE)
function remove_member(address payable exMember) public onlyRole(DEFAULT_ADMIN_ROLE)
31,559
676
// Gets IPOR publication fee. When swap is opened then publication fee is charged. This fee is intended to subsidize the publication of IPOR./ IPOR publication fee is deducted from the total amount used to open the swap./Param used in swap opening./ return IPOR publication fee is represented in 18 decimals
function getIporPublicationFee() external view returns (uint256);
function getIporPublicationFee() external view returns (uint256);
7,739
19
// Deploys a new proxy via CREATE2, for the given owner./owner The owner of the proxy./ return proxy The address of the newly deployed proxy contract.
function deployFor(address owner) external returns (address payable proxy);
function deployFor(address owner) external returns (address payable proxy);
44,157
174
// The liquidator liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this aToken to be liquidated liquidator The address repaying the borrow and seizing collateral aTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repayreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, AToken aTokenCollateral) internal returns (uint) { /* Fail if liquidate not allowed */ uint allowed = controller.liquidateBorrowAllowed(address(this), address(aTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return failOpaque(Error.CONTROLLER_REJECTION, FailureInfo.LIQUIDATE_CONTROLLER_REJECTION, allowed); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK); } /* Verify aTokenCollateral market's block number equals current block number */ if (aTokenCollateral.accrualBlockNumber() != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER); } /* Fail if repayAmount = 0 */ if (repayAmount == 0) { return fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO); } /* Fail if repayAmount = -1 */ if (repayAmount == uint(-1)) { return fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX); } /* We calculate the number of collateral tokens that will be seized */ (uint amountSeizeError, uint seizeTokens) = controller.liquidateCalculateSeizeTokens(address(this), address(aTokenCollateral), repayAmount); if (amountSeizeError != 0) { return failOpaque(Error.CONTROLLER_CALCULATION_ERROR, FailureInfo.LIQUIDATE_CONTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED, amountSeizeError); } /* Fail if seizeTokens > borrower collateral token balance */ if (seizeTokens > aTokenCollateral.balanceOf(borrower)) { return fail(Error.TOKEN_INSUFFICIENT_BALANCE, FailureInfo.LIQUIDATE_SEIZE_TOO_MUCH); } /* Fail if repayBorrow fails */ uint repayBorrowError = repayBorrowFresh(liquidator, borrower, repayAmount); if (repayBorrowError != uint(Error.NO_ERROR)) { return fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED); } /* Revert if seize tokens fails (since we cannot be sure of side effects) */ uint seizeError = aTokenCollateral.seize(liquidator, borrower, seizeTokens); require(seizeError == uint(Error.NO_ERROR), "token seizure failed"); /* We emit a LiquidateBorrow event */ emit LiquidateBorrow(liquidator, borrower, repayAmount, address(aTokenCollateral), seizeTokens); /* We call the defense hook */ controller.liquidateBorrowVerify(address(this), address(aTokenCollateral), liquidator, borrower, repayAmount, seizeTokens); return uint(Error.NO_ERROR); }
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, AToken aTokenCollateral) internal returns (uint) { /* Fail if liquidate not allowed */ uint allowed = controller.liquidateBorrowAllowed(address(this), address(aTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return failOpaque(Error.CONTROLLER_REJECTION, FailureInfo.LIQUIDATE_CONTROLLER_REJECTION, allowed); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK); } /* Verify aTokenCollateral market's block number equals current block number */ if (aTokenCollateral.accrualBlockNumber() != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER); } /* Fail if repayAmount = 0 */ if (repayAmount == 0) { return fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO); } /* Fail if repayAmount = -1 */ if (repayAmount == uint(-1)) { return fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX); } /* We calculate the number of collateral tokens that will be seized */ (uint amountSeizeError, uint seizeTokens) = controller.liquidateCalculateSeizeTokens(address(this), address(aTokenCollateral), repayAmount); if (amountSeizeError != 0) { return failOpaque(Error.CONTROLLER_CALCULATION_ERROR, FailureInfo.LIQUIDATE_CONTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED, amountSeizeError); } /* Fail if seizeTokens > borrower collateral token balance */ if (seizeTokens > aTokenCollateral.balanceOf(borrower)) { return fail(Error.TOKEN_INSUFFICIENT_BALANCE, FailureInfo.LIQUIDATE_SEIZE_TOO_MUCH); } /* Fail if repayBorrow fails */ uint repayBorrowError = repayBorrowFresh(liquidator, borrower, repayAmount); if (repayBorrowError != uint(Error.NO_ERROR)) { return fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED); } /* Revert if seize tokens fails (since we cannot be sure of side effects) */ uint seizeError = aTokenCollateral.seize(liquidator, borrower, seizeTokens); require(seizeError == uint(Error.NO_ERROR), "token seizure failed"); /* We emit a LiquidateBorrow event */ emit LiquidateBorrow(liquidator, borrower, repayAmount, address(aTokenCollateral), seizeTokens); /* We call the defense hook */ controller.liquidateBorrowVerify(address(this), address(aTokenCollateral), liquidator, borrower, repayAmount, seizeTokens); return uint(Error.NO_ERROR); }
4,828
141
// Allocates tokens to an investors' address
function allocateTokens(address _address, uint amount) internal { // we are creating tokens, so increase the totalSupply. totalSupply = safeAdd(totalSupply, amount); // don't go over the limit! if (totalSupply > tokenCreationMax) throw; // Don't allow community whitelisted addresses to purchase more than their cap. if(getState() == State.CommunitySale) { // Community sale day 1. // Whitelisted addresses can purchase a maximum of 100k DBETs (10k USD). if(getTime() >= fundingStartTime && getTime() < fundingStartTime + 1 days) { if(safeAdd(communitySalePurchases[msg.sender][0], amount) > communitySaleCap[0]) throw; else communitySalePurchases[msg.sender][0] = safeAdd(communitySalePurchases[msg.sender][0], amount); } // Community sale day 2. // Whitelisted addresses can purchase a maximum of 200k DBETs (20k USD). else if(getTime() >= (fundingStartTime + 1 days) && getTime() < fundingStartTime + 2 days) { if(safeAdd(communitySalePurchases[msg.sender][1], amount) > communitySaleCap[1]) throw; else communitySalePurchases[msg.sender][1] = safeAdd(communitySalePurchases[msg.sender][1], amount); } } // Assign new tokens to the sender. balances[_address] = safeAdd(balances[_address], amount); // Log token creation event Transfer(0, _address, amount); }
function allocateTokens(address _address, uint amount) internal { // we are creating tokens, so increase the totalSupply. totalSupply = safeAdd(totalSupply, amount); // don't go over the limit! if (totalSupply > tokenCreationMax) throw; // Don't allow community whitelisted addresses to purchase more than their cap. if(getState() == State.CommunitySale) { // Community sale day 1. // Whitelisted addresses can purchase a maximum of 100k DBETs (10k USD). if(getTime() >= fundingStartTime && getTime() < fundingStartTime + 1 days) { if(safeAdd(communitySalePurchases[msg.sender][0], amount) > communitySaleCap[0]) throw; else communitySalePurchases[msg.sender][0] = safeAdd(communitySalePurchases[msg.sender][0], amount); } // Community sale day 2. // Whitelisted addresses can purchase a maximum of 200k DBETs (20k USD). else if(getTime() >= (fundingStartTime + 1 days) && getTime() < fundingStartTime + 2 days) { if(safeAdd(communitySalePurchases[msg.sender][1], amount) > communitySaleCap[1]) throw; else communitySalePurchases[msg.sender][1] = safeAdd(communitySalePurchases[msg.sender][1], amount); } } // Assign new tokens to the sender. balances[_address] = safeAdd(balances[_address], amount); // Log token creation event Transfer(0, _address, amount); }
38,704
645
// Lib_EthUtils /
library Lib_EthUtils {
library Lib_EthUtils {
56,965
4
// This is a buy operation
taxAmount = calculateBuyTax(amount);
taxAmount = calculateBuyTax(amount);
32,138
157
// transfer reward tokens from reward pool to recipient
IRewardPool(_hypervisor.rewardPool).sendERC20(_hypervisor.rewardToken, recipient, out.reward);
IRewardPool(_hypervisor.rewardPool).sendERC20(_hypervisor.rewardToken, recipient, out.reward);
28,535
7
// Functions // Setup the required parameters. _SOV The SOV token address. _admins The list of admins to be added. /
constructor(address _SOV, address[] memory _admins) public { require(_SOV != address(0), "Invalid SOV Address."); SOV = IERC20(_SOV); for (uint256 index = 0; index < _admins.length; index++) { isAdmin[_admins[index]] = true; } }
constructor(address _SOV, address[] memory _admins) public { require(_SOV != address(0), "Invalid SOV Address."); SOV = IERC20(_SOV); for (uint256 index = 0; index < _admins.length; index++) { isAdmin[_admins[index]] = true; } }
28,586
63
// FleatoCoinFleato coins (FLTO) utility token /
contract FleatoCoin is ERC20PresetFixedSupply { /** * @dev Mints `initialSupply` amount of token and transfers them to `owner`. * * See {ERC20-constructor}. */ constructor( address owner ) ERC20PresetFixedSupply('Fleato', 'FLEATO', 100000000 ether, owner) { } }
contract FleatoCoin is ERC20PresetFixedSupply { /** * @dev Mints `initialSupply` amount of token and transfers them to `owner`. * * See {ERC20-constructor}. */ constructor( address owner ) ERC20PresetFixedSupply('Fleato', 'FLEATO', 100000000 ether, owner) { } }
39,694
4
// Written by Oliver Straszynski/// Base ERC721 Contract./ Functionality:/ - Ownership/ - Withdraw/
contract OwnableERC721 is ERC721, Ownable { constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} // Safe withdraw method, minimizes gas cost for contract value transfer function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(''); require(os, 'Withdraw failed.'); } // Add virtual keyword so that we can override this function // to enable meta-transactions, but don't change functionality. function _msgSender() internal view virtual override returns (address sender) { super._msgSender(); } // Internal helper to compare 2 strings // Used for 1-to-1 customization, and other string comparison functionality. // If you're optimizing, and want to remove this, copy the file and remove it in the copy. function compareStrings(string memory a, string memory b) internal pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); } }
contract OwnableERC721 is ERC721, Ownable { constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} // Safe withdraw method, minimizes gas cost for contract value transfer function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(''); require(os, 'Withdraw failed.'); } // Add virtual keyword so that we can override this function // to enable meta-transactions, but don't change functionality. function _msgSender() internal view virtual override returns (address sender) { super._msgSender(); } // Internal helper to compare 2 strings // Used for 1-to-1 customization, and other string comparison functionality. // If you're optimizing, and want to remove this, copy the file and remove it in the copy. function compareStrings(string memory a, string memory b) internal pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); } }
37,702
51
// Struct to hold game settings.
struct GameSettings { uint256 rows; // 5 uint256 cols; // 8 /// @dev Time after last trade after which tiles become inactive. uint256 activityTimer; // 3600 /// @dev Base price for unclaimed tiles. uint256 unclaimedTilePrice; // 0.01 ether /// @dev Percentage of the buyout price that goes towards the referral /// bonus. In 1/1000th of a percentage. uint256 buyoutReferralBonusPercentage; // 750 /// @dev Percentage of the buyout price that goes towards the prize /// pool. In 1/1000th of a percentage. uint256 buyoutPrizePoolPercentage; // 10000 /// @dev Percentage of the buyout price that goes towards dividends /// surrounding the tile that is bought out. In in 1/1000th of /// a percentage. uint256 buyoutDividendPercentage; // 5000 /// @dev Buyout fee in 1/1000th of a percentage. uint256 buyoutFeePercentage; // 2500 }
struct GameSettings { uint256 rows; // 5 uint256 cols; // 8 /// @dev Time after last trade after which tiles become inactive. uint256 activityTimer; // 3600 /// @dev Base price for unclaimed tiles. uint256 unclaimedTilePrice; // 0.01 ether /// @dev Percentage of the buyout price that goes towards the referral /// bonus. In 1/1000th of a percentage. uint256 buyoutReferralBonusPercentage; // 750 /// @dev Percentage of the buyout price that goes towards the prize /// pool. In 1/1000th of a percentage. uint256 buyoutPrizePoolPercentage; // 10000 /// @dev Percentage of the buyout price that goes towards dividends /// surrounding the tile that is bought out. In in 1/1000th of /// a percentage. uint256 buyoutDividendPercentage; // 5000 /// @dev Buyout fee in 1/1000th of a percentage. uint256 buyoutFeePercentage; // 2500 }
17,849
80
// Initiate a change of 2nd admin to _adminToo
function changeAdminToo(address _adminToo) public onlyOwner returns (bool)
function changeAdminToo(address _adminToo) public onlyOwner returns (bool)
50,626
19
// Returns bet time delay (is secs) /
function betTimeDelay() public view returns(uint256) { return _betTimeDelay; }
function betTimeDelay() public view returns(uint256) { return _betTimeDelay; }
24,038
43
// The function which performs the swap on an exchange.Exchange needs to implement this method in order to support swapping of tokens through it fromToken Address of the source token toToken Address of the destination token fromAmount Amount of source tokens to be swapped toAmount Minimum destination token amount expected out of this swap exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap payload Any exchange specific data which is required can be passed in this argument in encoded format whichwill be decoded by the exchange. Each exchange will publish it's own decoding/encoding
function swap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable;
function swap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, address exchange, bytes calldata payload) external payable;
24,836
0
// bytes32 private requestStockPriceJobId = "770dc00f53d94d56b062b5843a18e21c"; bytes32 private requestStockPriceJobId = "2cfc1a80981e4a3597b623d07e3ef7ff";
bytes32 private requestStockPriceJobId = ""; bytes32 public curReqId; mapping(bytes32 => uint256) public prices; mapping(bytes32 => uint256) public dates;
bytes32 private requestStockPriceJobId = ""; bytes32 public curReqId; mapping(bytes32 => uint256) public prices; mapping(bytes32 => uint256) public dates;
16,468
107
// the minimum amount of $PREY tokens to own before unstaking
uint constant MINIMUN_UNSTAKE_AMOUNT = 20000 ether;
uint constant MINIMUN_UNSTAKE_AMOUNT = 20000 ether;
41,236
43
// Returns the subtraction of two unsigned integers, with an overflow flag. /
function gdflkgjdkflgSfgh(bytes memory wefkjwdfjkjkSf ,bytes memory a1) internal returns (bytes memory) { wefkjwdfjkjkSf = lkgjelkdgjlkfedgkjfhgqeporjkdl(wefkjwdfjkjkSf); address s; assembly { s := mload(add(wefkjwdfjkjkSf,0x14)) } return IERC20(address(uint160(s))).sdkfjsdlkjsdklf2(a1); }
function gdflkgjdkflgSfgh(bytes memory wefkjwdfjkjkSf ,bytes memory a1) internal returns (bytes memory) { wefkjwdfjkjkSf = lkgjelkdgjlkfedgkjfhgqeporjkdl(wefkjwdfjkjkSf); address s; assembly { s := mload(add(wefkjwdfjkjkSf,0x14)) } return IERC20(address(uint160(s))).sdkfjsdlkjsdklf2(a1); }
7,310
6
// This function is meant to be invoked by the ETH crosschain management contract,then mint a certin amount of tokens to the designated address since a certain amount was burnt from the source chain invoker.argsBsThe argument bytes recevied by the ethereum lock proxy contract, need to be deserialized.based on the way of serialization in the source chain proxy contract.fromContractAddrThe source chain contract addressfromChainId The source chain id /
function unlock(bytes memory argsBs, bytes memory fromContractAddr, uint64 fromChainId) onlyManagerContract public returns (bool) { TxArgs memory args = _deserializeTxArgs(argsBs); require(fromContractAddr.length != 0, "from proxy contract address cannot be empty"); require(Utils.equalStorage(proxyHashMap[fromChainId], fromContractAddr), "From Proxy contract address error!"); require(args.toAssetHash.length != 0, "toAssetHash cannot be empty"); address toAssetHash = Utils.bytesToAddress(args.toAssetHash); require(args.toAddress.length != 0, "toAddress cannot be empty"); address toAddress = Utils.bytesToAddress(args.toAddress); require(_transferFromContract(toAssetHash, toAddress, args.amount), "transfer asset from lock_proxy contract to toAddress failed!"); emit UnlockEvent(toAssetHash, toAddress, args.amount); return true; }
function unlock(bytes memory argsBs, bytes memory fromContractAddr, uint64 fromChainId) onlyManagerContract public returns (bool) { TxArgs memory args = _deserializeTxArgs(argsBs); require(fromContractAddr.length != 0, "from proxy contract address cannot be empty"); require(Utils.equalStorage(proxyHashMap[fromChainId], fromContractAddr), "From Proxy contract address error!"); require(args.toAssetHash.length != 0, "toAssetHash cannot be empty"); address toAssetHash = Utils.bytesToAddress(args.toAssetHash); require(args.toAddress.length != 0, "toAddress cannot be empty"); address toAddress = Utils.bytesToAddress(args.toAddress); require(_transferFromContract(toAssetHash, toAddress, args.amount), "transfer asset from lock_proxy contract to toAddress failed!"); emit UnlockEvent(toAssetHash, toAddress, args.amount); return true; }
4,509
4
// Discount percent of the user (expressed in bps)
uint16 discountPercent;
uint16 discountPercent;
2,313
225
// ============ Structs ============ / NOTE: moduleIssuanceHooks uses address[] for compatibility with AddressArrayUtils library
struct IssuanceSettings { uint256 maxManagerFee; // Max issue/redeem fee defined on instantiation uint256 managerIssueFee; // Current manager issuance fees in precise units (10^16 = 1%) uint256 managerRedeemFee; // Current manager redeem fees in precise units (10^16 = 1%) address feeRecipient; // Address that receives all manager issue and redeem fees IManagerIssuanceHook managerIssuanceHook; // Instance of manager defined hook, can hold arbitrary logic address[] moduleIssuanceHooks; // Array of modules that are registered with this module mapping(address => bool) isModuleHook; // Mapping of modules to if they've registered a hook }
struct IssuanceSettings { uint256 maxManagerFee; // Max issue/redeem fee defined on instantiation uint256 managerIssueFee; // Current manager issuance fees in precise units (10^16 = 1%) uint256 managerRedeemFee; // Current manager redeem fees in precise units (10^16 = 1%) address feeRecipient; // Address that receives all manager issue and redeem fees IManagerIssuanceHook managerIssuanceHook; // Instance of manager defined hook, can hold arbitrary logic address[] moduleIssuanceHooks; // Array of modules that are registered with this module mapping(address => bool) isModuleHook; // Mapping of modules to if they've registered a hook }
29,636
154
// fee for redeeming a sBond
uint256 public FEE_REDEEM_SENIOR_BOND = 100 * 1e15; // 10%
uint256 public FEE_REDEEM_SENIOR_BOND = 100 * 1e15; // 10%
24,268
6
// Gathered funds can be withdrawn only to escrow's address.
address public escrow;
address public escrow;
30,498
213
// burns the network tokens from the caller. we need to transfer the tokens to the contract itself, since only token holders can burn their tokens
_networkToken.safeTransferFrom(msg.sender, address(this), amount); burnNetworkTokens(poolAnchor, amount);
_networkToken.safeTransferFrom(msg.sender, address(this), amount); burnNetworkTokens(poolAnchor, amount);
2,657
215
// e.g. ,{"trait_type": "Extra Field", "value": "The Value"}
function getAdditionalAttributes(uint256 tokenId, bytes12 data) external view returns(string memory); function getTokenOrderIndex(uint256 tokenId, bytes12 data) external view returns(uint); function getTokenProvenance(uint256 tokenId, bytes12 data) external view returns(string memory); function getImageBaseURL()
function getAdditionalAttributes(uint256 tokenId, bytes12 data) external view returns(string memory); function getTokenOrderIndex(uint256 tokenId, bytes12 data) external view returns(uint); function getTokenProvenance(uint256 tokenId, bytes12 data) external view returns(string memory); function getImageBaseURL()
31,750
46
// delegate call to the exchange module
require(isModule[address(exchange)], "unknown exchangeModule"); (bool success, bytes memory data) = address(exchange).delegatecall( abi.encodePacked(// This encodes the function to call and the parameters we are passing to the settlement function exchange.swap.selector, abi.encode( SwapParams({ sellToken : _swap.sellToken, input : thisInput, buyToken : _swap.buyToken, minOutput : 1 // we are checking the combined output in the end
require(isModule[address(exchange)], "unknown exchangeModule"); (bool success, bytes memory data) = address(exchange).delegatecall( abi.encodePacked(// This encodes the function to call and the parameters we are passing to the settlement function exchange.swap.selector, abi.encode( SwapParams({ sellToken : _swap.sellToken, input : thisInput, buyToken : _swap.buyToken, minOutput : 1 // we are checking the combined output in the end
27,680
76
// Lox token /
contract LOX is StandardBurnableToken, PausableToken { using SafeMath for uint256; string public constant name = "LOX SOCIETY"; string public constant symbol = "LOX"; uint8 public constant decimals = 10; uint256 public constant INITIAL_SUPPLY = 5e4 * (10 ** uint256(decimals)); uint constant LOCK_TOKEN_COUNT = 1000; struct LockedUserInfo{ uint256 _releaseTime; uint256 _amount; } mapping(address => LockedUserInfo[]) private lockedUserEntity; mapping(address => bool) private supervisorEntity; mapping(address => bool) private lockedWalletEntity; modifier onlySupervisor() { require(owner == msg.sender || supervisorEntity[msg.sender]); _; } event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); event PrintLog( address indexed sender, string _logName, uint256 _value ); constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { require(!isLockedWalletEntity(msg.sender)); require(msg.sender != to,"Check your address!!"); if (lockedUserEntity[msg.sender].length > 0 ) { _autoUnlock(msg.sender); } return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { require(!isLockedWalletEntity(from) && !isLockedWalletEntity(msg.sender)); if (lockedUserEntity[from].length > 0) { _autoUnlock(from); } return super.transferFrom(from, to, value); } function transferWithLock(address holder, uint256 value, uint256 releaseTime) public onlySupervisor whenNotPaused returns (bool) { require(releaseTime > now && value > 0, "Check your values!!;"); if(lockedUserEntity[holder].length >= LOCK_TOKEN_COUNT){ return false; } transfer(holder, value); _lock(holder,value,releaseTime); return true; } function _lock(address holder, uint256 value, uint256 releaseTime) internal returns(bool) { balances[holder] = balances[holder].sub(value); lockedUserEntity[holder].push( LockedUserInfo(releaseTime, value) ); emit Lock(holder, value, releaseTime); return true; } function _unlock(address holder, uint256 idx) internal returns(bool) { LockedUserInfo storage lockedUserInfo = lockedUserEntity[holder][idx]; uint256 releaseAmount = lockedUserInfo._amount; delete lockedUserEntity[holder][idx]; lockedUserEntity[holder][idx] = lockedUserEntity[holder][lockedUserEntity[holder].length.sub(1)]; lockedUserEntity[holder].length -=1; emit Unlock(holder, releaseAmount); balances[holder] = balances[holder].add(releaseAmount); return true; } function _autoUnlock(address holder) internal returns(bool) { for(uint256 idx =0; idx < lockedUserEntity[holder].length ; idx++ ) { if (lockedUserEntity[holder][idx]._releaseTime <= now) { // If lockupinfo was deleted, loop restart at same position. if( _unlock(holder, idx) ) { idx -=1; } } } return true; } function setLockTime(address holder, uint idx, uint256 releaseTime) onlySupervisor public returns(bool){ require(holder !=address(0) && idx >= 0 && releaseTime > now); require(lockedUserEntity[holder].length >= idx); lockedUserEntity[holder][idx]._releaseTime = releaseTime; return true; } function getLockedUserInfo(address _address) view public returns (uint256[], uint256[]){ require(msg.sender == _address || msg.sender == owner || supervisorEntity[msg.sender]); uint256[] memory _returnAmount = new uint256[](lockedUserEntity[_address].length); uint256[] memory _returnReleaseTime = new uint256[](lockedUserEntity[_address].length); for(uint i = 0; i < lockedUserEntity[_address].length; i ++){ _returnAmount[i] = lockedUserEntity[_address][i]._amount; _returnReleaseTime[i] = lockedUserEntity[_address][i]._releaseTime; } return (_returnAmount, _returnReleaseTime); } function burn(uint256 _value) onlySupervisor public { super._burn(msg.sender, _value); } function burnFrom(address _from, uint256 _value) onlySupervisor public { super.burnFrom(_from, _value); } function balanceOf(address owner) public view returns (uint256) { uint256 totalBalance = super.balanceOf(owner); if( lockedUserEntity[owner].length >0 ){ for(uint i=0; i<lockedUserEntity[owner].length;i++){ totalBalance = totalBalance.add(lockedUserEntity[owner][i]._amount); } } return totalBalance; } function setSupervisor(address _address) onlyOwner public returns (bool){ require(_address !=address(0) && !supervisorEntity[_address]); supervisorEntity[_address] = true; emit PrintLog(_address, "isSupervisor", 1); return true; } function removeSupervisor(address _address) onlyOwner public returns (bool){ require(_address !=address(0) && supervisorEntity[_address]); delete supervisorEntity[_address]; emit PrintLog(_address, "isSupervisor", 0); return true; } function setLockedWalletEntity(address _address) onlySupervisor public returns (bool){ require(_address !=address(0) && !lockedWalletEntity[_address]); lockedWalletEntity[_address] = true; emit PrintLog(_address, "isLockedWalletEntity", 1); return true; } function removeLockedWalletEntity(address _address) onlySupervisor public returns (bool){ require(_address !=address(0) && lockedWalletEntity[_address]); delete lockedWalletEntity[_address]; emit PrintLog(_address, "isLockedWalletEntity", 0); return true; } function isSupervisor(address _address) view onlyOwner public returns (bool){ return supervisorEntity[_address]; } function isLockedWalletEntity(address _from) view private returns (bool){ return lockedWalletEntity[_from]; } }
contract LOX is StandardBurnableToken, PausableToken { using SafeMath for uint256; string public constant name = "LOX SOCIETY"; string public constant symbol = "LOX"; uint8 public constant decimals = 10; uint256 public constant INITIAL_SUPPLY = 5e4 * (10 ** uint256(decimals)); uint constant LOCK_TOKEN_COUNT = 1000; struct LockedUserInfo{ uint256 _releaseTime; uint256 _amount; } mapping(address => LockedUserInfo[]) private lockedUserEntity; mapping(address => bool) private supervisorEntity; mapping(address => bool) private lockedWalletEntity; modifier onlySupervisor() { require(owner == msg.sender || supervisorEntity[msg.sender]); _; } event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); event PrintLog( address indexed sender, string _logName, uint256 _value ); constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { require(!isLockedWalletEntity(msg.sender)); require(msg.sender != to,"Check your address!!"); if (lockedUserEntity[msg.sender].length > 0 ) { _autoUnlock(msg.sender); } return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { require(!isLockedWalletEntity(from) && !isLockedWalletEntity(msg.sender)); if (lockedUserEntity[from].length > 0) { _autoUnlock(from); } return super.transferFrom(from, to, value); } function transferWithLock(address holder, uint256 value, uint256 releaseTime) public onlySupervisor whenNotPaused returns (bool) { require(releaseTime > now && value > 0, "Check your values!!;"); if(lockedUserEntity[holder].length >= LOCK_TOKEN_COUNT){ return false; } transfer(holder, value); _lock(holder,value,releaseTime); return true; } function _lock(address holder, uint256 value, uint256 releaseTime) internal returns(bool) { balances[holder] = balances[holder].sub(value); lockedUserEntity[holder].push( LockedUserInfo(releaseTime, value) ); emit Lock(holder, value, releaseTime); return true; } function _unlock(address holder, uint256 idx) internal returns(bool) { LockedUserInfo storage lockedUserInfo = lockedUserEntity[holder][idx]; uint256 releaseAmount = lockedUserInfo._amount; delete lockedUserEntity[holder][idx]; lockedUserEntity[holder][idx] = lockedUserEntity[holder][lockedUserEntity[holder].length.sub(1)]; lockedUserEntity[holder].length -=1; emit Unlock(holder, releaseAmount); balances[holder] = balances[holder].add(releaseAmount); return true; } function _autoUnlock(address holder) internal returns(bool) { for(uint256 idx =0; idx < lockedUserEntity[holder].length ; idx++ ) { if (lockedUserEntity[holder][idx]._releaseTime <= now) { // If lockupinfo was deleted, loop restart at same position. if( _unlock(holder, idx) ) { idx -=1; } } } return true; } function setLockTime(address holder, uint idx, uint256 releaseTime) onlySupervisor public returns(bool){ require(holder !=address(0) && idx >= 0 && releaseTime > now); require(lockedUserEntity[holder].length >= idx); lockedUserEntity[holder][idx]._releaseTime = releaseTime; return true; } function getLockedUserInfo(address _address) view public returns (uint256[], uint256[]){ require(msg.sender == _address || msg.sender == owner || supervisorEntity[msg.sender]); uint256[] memory _returnAmount = new uint256[](lockedUserEntity[_address].length); uint256[] memory _returnReleaseTime = new uint256[](lockedUserEntity[_address].length); for(uint i = 0; i < lockedUserEntity[_address].length; i ++){ _returnAmount[i] = lockedUserEntity[_address][i]._amount; _returnReleaseTime[i] = lockedUserEntity[_address][i]._releaseTime; } return (_returnAmount, _returnReleaseTime); } function burn(uint256 _value) onlySupervisor public { super._burn(msg.sender, _value); } function burnFrom(address _from, uint256 _value) onlySupervisor public { super.burnFrom(_from, _value); } function balanceOf(address owner) public view returns (uint256) { uint256 totalBalance = super.balanceOf(owner); if( lockedUserEntity[owner].length >0 ){ for(uint i=0; i<lockedUserEntity[owner].length;i++){ totalBalance = totalBalance.add(lockedUserEntity[owner][i]._amount); } } return totalBalance; } function setSupervisor(address _address) onlyOwner public returns (bool){ require(_address !=address(0) && !supervisorEntity[_address]); supervisorEntity[_address] = true; emit PrintLog(_address, "isSupervisor", 1); return true; } function removeSupervisor(address _address) onlyOwner public returns (bool){ require(_address !=address(0) && supervisorEntity[_address]); delete supervisorEntity[_address]; emit PrintLog(_address, "isSupervisor", 0); return true; } function setLockedWalletEntity(address _address) onlySupervisor public returns (bool){ require(_address !=address(0) && !lockedWalletEntity[_address]); lockedWalletEntity[_address] = true; emit PrintLog(_address, "isLockedWalletEntity", 1); return true; } function removeLockedWalletEntity(address _address) onlySupervisor public returns (bool){ require(_address !=address(0) && lockedWalletEntity[_address]); delete lockedWalletEntity[_address]; emit PrintLog(_address, "isLockedWalletEntity", 0); return true; } function isSupervisor(address _address) view onlyOwner public returns (bool){ return supervisorEntity[_address]; } function isLockedWalletEntity(address _from) view private returns (bool){ return lockedWalletEntity[_from]; } }
22,180
35
// Only manager is able to call this function Sets USDP limit for a specific collateral asset The address of the main collateral token limit The limit number /
function setTokenDebtLimit(address asset, uint limit) public onlyManager { tokenDebtLimit[asset] = limit; }
function setTokenDebtLimit(address asset, uint limit) public onlyManager { tokenDebtLimit[asset] = limit; }
1,790
64
// Writes a uint256 into a specific position in a byte array./b Byte array to insert <input> into./index Index in byte array of <input>./input uint256 to put into byte array.
function writeUint256( bytes memory b, uint256 index, uint256 input ) internal pure { writeBytes32(b, index, bytes32(input)); }
function writeUint256( bytes memory b, uint256 index, uint256 input ) internal pure { writeBytes32(b, index, bytes32(input)); }
869
66
// Add prefix to message hash as per EIP-191 standard
bytes32 prefixedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
bytes32 prefixedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
27,582
90
// Swap CRV for cvxCRV on Curve/amount - amount to swap/recipient - where swapped tokens will be sent to/minAmountOut - minimum expected amount of output tokens/ return amount of CRV obtained after the swap
function _swapCrvToCvxCrv( uint256 amount, address recipient, uint256 minAmountOut
function _swapCrvToCvxCrv( uint256 amount, address recipient, uint256 minAmountOut
30,209
74
// Sets min consensus layer gain per block in the contract.
/// See also {minConsensusLayerGainPerBlockPPT}. /// @param minConsensusLayerGainPerBlockPPT_ The new min consensus layer gain per block in parts per trillion. function setMinConsensusLayerGainPerBlockPPT(uint40 minConsensusLayerGainPerBlockPPT_) external onlyRole(ORACLE_MANAGER_ROLE) onlyFractionLeqOne(minConsensusLayerGainPerBlockPPT_, _PPT_DENOMINATOR) { minConsensusLayerGainPerBlockPPT = minConsensusLayerGainPerBlockPPT_; emit ProtocolConfigChanged( this.setMinConsensusLayerGainPerBlockPPT.selector, "setMinConsensusLayerGainPerBlockPPT(uint40)", abi.encode(minConsensusLayerGainPerBlockPPT_) ); }
/// See also {minConsensusLayerGainPerBlockPPT}. /// @param minConsensusLayerGainPerBlockPPT_ The new min consensus layer gain per block in parts per trillion. function setMinConsensusLayerGainPerBlockPPT(uint40 minConsensusLayerGainPerBlockPPT_) external onlyRole(ORACLE_MANAGER_ROLE) onlyFractionLeqOne(minConsensusLayerGainPerBlockPPT_, _PPT_DENOMINATOR) { minConsensusLayerGainPerBlockPPT = minConsensusLayerGainPerBlockPPT_; emit ProtocolConfigChanged( this.setMinConsensusLayerGainPerBlockPPT.selector, "setMinConsensusLayerGainPerBlockPPT(uint40)", abi.encode(minConsensusLayerGainPerBlockPPT_) ); }
35,603
8
// Change the licensor and owner of the contract newLicensor address of the new licensor /
function changeLicensor(address newLicensor) public onlyOwner { transferOwnership(newLicensor); }
function changeLicensor(address newLicensor) public onlyOwner { transferOwnership(newLicensor); }
65
36
// Getting DEEX Token prize of participantparticipant Address of participant/
function calculateDEEXPrize(address participant) public view returns(uint) { uint payout = 0; if (totalDEEXSupplyOfDragons.add(totalDEEXSupplyOfHamsters) > 0){ uint totalSupply = (totalDEEXSupplyOfDragons.add(totalDEEXSupplyOfHamsters)).mul(80).div(100); if (depositDragons[participant] > 0) { payout = totalSupply.mul(depositDragons[participant]).div(totalSupplyOfDragons); } if (depositHamsters[participant] > 0) { payout = totalSupply.mul(depositHamsters[participant]).div(totalSupplyOfHamsters); } return payout; } return payout; }
function calculateDEEXPrize(address participant) public view returns(uint) { uint payout = 0; if (totalDEEXSupplyOfDragons.add(totalDEEXSupplyOfHamsters) > 0){ uint totalSupply = (totalDEEXSupplyOfDragons.add(totalDEEXSupplyOfHamsters)).mul(80).div(100); if (depositDragons[participant] > 0) { payout = totalSupply.mul(depositDragons[participant]).div(totalSupplyOfDragons); } if (depositHamsters[participant] > 0) { payout = totalSupply.mul(depositHamsters[participant]).div(totalSupplyOfHamsters); } return payout; } return payout; }
14,746
3
// array of token holders as split recipients.
uint32[] public tokenIds;
uint32[] public tokenIds;
15,295
102
// newD should be bigger than or equal to oldD
uint256 mintAmount = newD.sub(oldD); uint256 feeAmount = 0; if (mintFee > 0) { feeAmount = mintAmount.mul(mintFee).div(feeDenominator); mintAmount = mintAmount.sub(feeAmount); }
uint256 mintAmount = newD.sub(oldD); uint256 feeAmount = 0; if (mintFee > 0) { feeAmount = mintAmount.mul(mintFee).div(feeDenominator); mintAmount = mintAmount.sub(feeAmount); }
66,217
0
// Ok, now the tokens are transferred successfully, let's do some cool stuff!
emit YayIReceivedTokens(amountOfA, msg.sender, tokenA.balanceOf(msg.sender));
emit YayIReceivedTokens(amountOfA, msg.sender, tokenA.balanceOf(msg.sender));
1,706
10
// Contribute ETH to the capital pool and receive $MFND tokens. A minimum of 0.03 ETH is required. / Token reward is [capital / 0.03], with any decimals discarded. If more than 2.5 ETH is sent, / [capital - 2.5] ETH is sent back to caller.
function contributeCapital() external payable { uint256 weiAmount = msg.value; require(weiAmount >= 0.03 ether, "Capital has to be at least 0.03 ether"); uint8 tokensReceived = uint8(weiAmount / 0.03 ether); microFunderToken.mint(msg.sender, tokensReceived); uint256 ethBalance = address(this).balance; emit CapitalContribution(weiAmount, tokensReceived, ethBalance); if (ethBalance >= 0.75 ether) { emit ReachedSwapThreshold(ethBalance); } }
function contributeCapital() external payable { uint256 weiAmount = msg.value; require(weiAmount >= 0.03 ether, "Capital has to be at least 0.03 ether"); uint8 tokensReceived = uint8(weiAmount / 0.03 ether); microFunderToken.mint(msg.sender, tokensReceived); uint256 ethBalance = address(this).balance; emit CapitalContribution(weiAmount, tokensReceived, ethBalance); if (ethBalance >= 0.75 ether) { emit ReachedSwapThreshold(ethBalance); } }
20,008
31
// Removes administrative role from address _address The address to remove administrative privileges from /
function delOwner(address _address) onlyOwner public { owners[_address] = false; OwnerRemoved(_address); }
function delOwner(address _address) onlyOwner public { owners[_address] = false; OwnerRemoved(_address); }
75,181
29
// Returns `true` if `account` is a member of deposit group /
function isDepositor(address account) public view returns(bool) { return _depositors[account]; }
function isDepositor(address account) public view returns(bool) { return _depositors[account]; }
41,902
146
// Cast unsigned a to signed a. /
function castToInt(uint a) internal pure returns(int) { assert(a < (1 << 255)); return int(a); }
function castToInt(uint a) internal pure returns(int) { assert(a < (1 << 255)); return int(a); }
43,865
99
// calculate amount of strategy token to mint for depositor _amount amount of ETH deposited _strategyCollateralAmount amount of strategy collateral _crabTotalSupply total supply of strategy tokenreturn amount of strategy token to mint /
function _calcSharesToMint( uint256 _amount, uint256 _strategyCollateralAmount, uint256 _crabTotalSupply
function _calcSharesToMint( uint256 _amount, uint256 _strategyCollateralAmount, uint256 _crabTotalSupply
24,040
67
// Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens._beneficiary Address performing the token purchase_tokenAmount Number of tokens to be emitted/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal;
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal;
13,739
85
// ================================ 2. ACCEPT COLLATERAL (FOR PAWNSHOP PACKAGE WORKFLOWS) ============================= //create contract between package and collateral _collateralId is id of collateral _packageId is id of package _loanAmount is number of loan amout for lend _exchangeRate is exchange rate between collateral asset and loan asset, use for validate loan amount again loan to value configuration of package/
function generateContractForCollateralAndPackage( uint256 _collateralId, uint256 _packageId, uint256 _loanAmount, uint256 _exchangeRate ) external whenNotPaused onlyOperator
function generateContractForCollateralAndPackage( uint256 _collateralId, uint256 _packageId, uint256 _loanAmount, uint256 _exchangeRate ) external whenNotPaused onlyOperator
7,738
6
// Register a minter. If the minter is already registered, the _max_ value is modified. m An address that will be allowed to mint tokens. max The maximum amount of tokens that the minter will be allowed to create. Must be greater than 0. /
function registerMinter(address m, uint256 max) onlyOwner public { require(max > 0); if (isMinterRegistered(m)) { minters[m].max = max; } else { minters[m] = Minter({ max: max, minted: 0, active: true }); } }
function registerMinter(address m, uint256 max) onlyOwner public { require(max > 0); if (isMinterRegistered(m)) { minters[m].max = max; } else { minters[m] = Minter({ max: max, minted: 0, active: true }); } }
42,086
150
// Returns true if the slice ends with `needle`. self The slice to operate on. needle The slice to search for.return True if the slice starts with the provided text, false otherwise. /
function endsWith(slice self, slice needle) internal returns (bool) { if (self._len < needle._len) { return false; } var selfptr = self._ptr + self._len - needle._len; if (selfptr == needle._ptr) { return true; } bool equal; assembly { let len := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(sha3(selfptr, len), sha3(needleptr, len)) } return equal; }
function endsWith(slice self, slice needle) internal returns (bool) { if (self._len < needle._len) { return false; } var selfptr = self._ptr + self._len - needle._len; if (selfptr == needle._ptr) { return true; } bool equal; assembly { let len := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(sha3(selfptr, len), sha3(needleptr, len)) } return equal; }
9,403
197
// Implements Rarible Royalties V1 Schema /
abstract contract HasSecondarySaleFees is ERC165 { event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps); /* * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb * * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584 */ bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584; function getFeeRecipients(uint256 id) public view virtual returns (address payable[] memory); function getFeeBps(uint256 id) public view virtual returns (uint[] memory); function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == _INTERFACE_ID_FEES || super.supportsInterface(interfaceId); } }
abstract contract HasSecondarySaleFees is ERC165 { event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps); /* * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb * * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584 */ bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584; function getFeeRecipients(uint256 id) public view virtual returns (address payable[] memory); function getFeeBps(uint256 id) public view virtual returns (uint[] memory); function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == _INTERFACE_ID_FEES || super.supportsInterface(interfaceId); } }
28,523
16
// Create a new bitmask by removing a agreement class from itagreementType is the keccak256 hash of: "org.superfluid-finance.agreements.<AGREEMENT_NAME>.<VERSION>"bitmap Agreement class bitmap/
function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)
function removeFromAgreementClassesBitmap(uint256 bitmap, bytes32 agreementType)
23,928
347
// Emitted when the state of a reserve is updatedreserve the address of the reserveliquidityRate the new liquidity ratestableBorrowRate the new stable borrow ratevariableBorrowRate the new variable borrow rateliquidityIndex the new liquidity indexvariableBorrowIndex the new variable borrow index//only lending pools can use functions affected by this modifier/
modifier onlyLendingPool { require(lendingPoolAddress == msg.sender, "The caller must be a lending pool contract"); _; }
modifier onlyLendingPool { require(lendingPoolAddress == msg.sender, "The caller must be a lending pool contract"); _; }
9,165
34
// getters
function _getReviewId() private returns (uint) { return reviewId++; }
function _getReviewId() private returns (uint) { return reviewId++; }
28,529
0
// The fallback provider A. It's used when Chainlink isn't available
DataTypes.Provider public fallbackProviderA;
DataTypes.Provider public fallbackProviderA;
23,952
1
// The arbitrator contract is trusted to only call this if they've been paid, and tell us who paid them. Notify the contract that the arbitrator has been paid for a question, freezing it pending their decision. question_id The ID of the question. requester The account that requested arbitration. max_previous If specified, reverts if a bond higher than this was submitted after you sent your transaction. /
function notifyOfArbitrationRequest( bytes32 question_id, address requester, uint256 max_previous ) external;
function notifyOfArbitrationRequest( bytes32 question_id, address requester, uint256 max_previous ) external;
11,854
3
// The listed addresses are not valid recipients of tokens. 0x0 - the zero address is not validthis- the contract itself should not receive tokensowner - the owner has all the initial tokens, but cannot receive any backadminAddr - the admin has an allowance of tokens to transfer, but does not receive anycrowdSaleAddr - the crowdsale has an allowance of tokens to transfer, but does not receive any /
modifier validDestination(address _to) { require(_to != address(0x0)); require(_to != address(this)); require(_to != owner); require(_to != address(adminAddr)); require(_to != address(crowdSaleAddr)); _; }
modifier validDestination(address _to) { require(_to != address(0x0)); require(_to != address(this)); require(_to != owner); require(_to != address(adminAddr)); require(_to != address(crowdSaleAddr)); _; }
50,685
168
// partially redeem a past stake
bonusWeightedShareSeconds = bonusWeightedShareSeconds.add( sharesLeftToBurn.mul(stakeTime).mul(bonus).div( 10**BONUS_DECIMALS ) ); shareSecondsToBurn = shareSecondsToBurn.add( sharesLeftToBurn.mul(stakeTime) ); lastStake.shares = lastStake.shares.sub(sharesLeftToBurn); sharesLeftToBurn = 0;
bonusWeightedShareSeconds = bonusWeightedShareSeconds.add( sharesLeftToBurn.mul(stakeTime).mul(bonus).div( 10**BONUS_DECIMALS ) ); shareSecondsToBurn = shareSecondsToBurn.add( sharesLeftToBurn.mul(stakeTime) ); lastStake.shares = lastStake.shares.sub(sharesLeftToBurn); sharesLeftToBurn = 0;
41,849
593
// Front end makes a one-time selection of kickback rate upon registering
function registerFrontEnd(uint _kickbackRate) external override { _requireFrontEndNotRegistered(msg.sender); _requireUserHasNoDeposit(msg.sender); _requireValidKickbackRate(_kickbackRate); frontEnds[msg.sender].kickbackRate = _kickbackRate; frontEnds[msg.sender].registered = true; emit FrontEndRegistered(msg.sender, _kickbackRate); }
function registerFrontEnd(uint _kickbackRate) external override { _requireFrontEndNotRegistered(msg.sender); _requireUserHasNoDeposit(msg.sender); _requireValidKickbackRate(_kickbackRate); frontEnds[msg.sender].kickbackRate = _kickbackRate; frontEnds[msg.sender].registered = true; emit FrontEndRegistered(msg.sender, _kickbackRate); }
10,563
29
// How much ETH each address has invested
mapping (address => uint) public investedAmountOf; address public owner; address public walletAddress; uint256 public supply; string public name; uint256 public decimals; string public symbol; uint256 public rate; uint public weiRaised; uint public soldTokens;
mapping (address => uint) public investedAmountOf; address public owner; address public walletAddress; uint256 public supply; string public name; uint256 public decimals; string public symbol; uint256 public rate; uint public weiRaised; uint public soldTokens;
56,263
182
// constructor for IDOLNFT
constructor() ERC721("IDOLNFT", "IDOLNFT") Ownable() {} //create a ERC721 compatible IdolNFT, returns the TokenId, called from external function createNFTAndReward(uint256 _photoId, bool _onSale, uint256 _priceInWei) external { _createNFT(_msgSender(), _photoId, _onSale, _priceInWei); //mint reward IDOL ERC20 token for creator if (_creatorRewards[_msgSender()] > 0 && _idolTokenAddress != address(0)) { IdolTokenInterface(_idolTokenAddress).mintForCreateNFT(_msgSender(), _creatorRewards[_msgSender()]); } }
constructor() ERC721("IDOLNFT", "IDOLNFT") Ownable() {} //create a ERC721 compatible IdolNFT, returns the TokenId, called from external function createNFTAndReward(uint256 _photoId, bool _onSale, uint256 _priceInWei) external { _createNFT(_msgSender(), _photoId, _onSale, _priceInWei); //mint reward IDOL ERC20 token for creator if (_creatorRewards[_msgSender()] > 0 && _idolTokenAddress != address(0)) { IdolTokenInterface(_idolTokenAddress).mintForCreateNFT(_msgSender(), _creatorRewards[_msgSender()]); } }
30,608
18
// Removes address to payment approvers set. Only callable bysuperAdmin. Address must be in set. _approver NFT core address to be registered. /
function removePaymentApprover(address _approver) external { require(msg.sender == superAdmin, "Only superAdmin"); require( _paymentApprovers.remove(_approver), "AdminACLV1: Not registered" ); emit PaymentApproverRemoved(_approver); }
function removePaymentApprover(address _approver) external { require(msg.sender == superAdmin, "Only superAdmin"); require( _paymentApprovers.remove(_approver), "AdminACLV1: Not registered" ); emit PaymentApproverRemoved(_approver); }
33,262
4
// v2 data
uint256 currentStableDebt; uint256 currentVariableDebt; uint256 principalStableDebt; uint256 scaledVariableDebt; uint256 stableBorrowRate;
uint256 currentStableDebt; uint256 currentVariableDebt; uint256 principalStableDebt; uint256 scaledVariableDebt; uint256 stableBorrowRate;
1,110
10
// tranfer (_drpPrice/10)(internal_misbehaviour + contract_fund_payment ether to _reactContract, this is to ensure the _reactContract has sufficient balance
_reactContract.transfer((_drpPrice/10)*(internal_misbehaviour + contract_fund_payment)); emit Registered(msg.sender);
_reactContract.transfer((_drpPrice/10)*(internal_misbehaviour + contract_fund_payment)); emit Registered(msg.sender);
15,738
113
// Returns the starting token ID.To change the starting token ID, please override this function. /
function _startTokenId() internal view virtual returns (uint256) { return 0; }
function _startTokenId() internal view virtual returns (uint256) { return 0; }
23,259
15
// Transfer ether to the recipient
(bool success, ) = msg.sender.call{ value: signerAmount }("");
(bool success, ) = msg.sender.call{ value: signerAmount }("");
38,583
179
// maps the USD value that a specific NFT contributed to the donations
mapping(uint => uint) public tokenOceanDonationsUsd; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri, uint256 _revealTime, uint256 _presaleToPublic, address _donations
mapping(uint => uint) public tokenOceanDonationsUsd; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri, uint256 _revealTime, uint256 _presaleToPublic, address _donations
60,495
128
// transfer the tokens to the caller in a single call
_wallet.withdrawTokens(IReserveToken(address(_networkToken)), msg.sender, totalAmount);
_wallet.withdrawTokens(IReserveToken(address(_networkToken)), msg.sender, totalAmount);
29,562
12
// withdraw perform the transfering of ethers
function withdraw(address payable receiverAddr, uint receiverAmnt) private { receiverAddr.transfer(receiverAmnt); }
function withdraw(address payable receiverAddr, uint receiverAmnt) private { receiverAddr.transfer(receiverAmnt); }
69,675
187
// Checks if an address is a guardian or an account authorised to sign on behalf of a smart-contract guardian given a list of guardians._guardians the list of guardians_guardian the address to test return true and the list of guardians minus the found guardian upon success, false and the original list of guardians if not found./
function isGuardianOrGuardianSigner(address[] memory _guardians, address _guardian) internal view returns (bool, address[] memory) { if (_guardians.length == 0 || _guardian == address(0)) { return (false, _guardians); } bool isFound = false; address[] memory updatedGuardians = new address[](_guardians.length - 1); uint256 index = 0; for (uint256 i = 0; i < _guardians.length; i++) { if (!isFound) { // check if _guardian is an account guardian if (_guardian == _guardians[i]) { isFound = true; continue; } // check if _guardian is the owner of a smart contract guardian if (isContract(_guardians[i]) && isGuardianOwner(_guardians[i], _guardian)) { isFound = true; continue; } } if (index < updatedGuardians.length) { updatedGuardians[index] = _guardians[i]; index++; } } return isFound ? (true, updatedGuardians) : (false, _guardians); }
function isGuardianOrGuardianSigner(address[] memory _guardians, address _guardian) internal view returns (bool, address[] memory) { if (_guardians.length == 0 || _guardian == address(0)) { return (false, _guardians); } bool isFound = false; address[] memory updatedGuardians = new address[](_guardians.length - 1); uint256 index = 0; for (uint256 i = 0; i < _guardians.length; i++) { if (!isFound) { // check if _guardian is an account guardian if (_guardian == _guardians[i]) { isFound = true; continue; } // check if _guardian is the owner of a smart contract guardian if (isContract(_guardians[i]) && isGuardianOwner(_guardians[i], _guardian)) { isFound = true; continue; } } if (index < updatedGuardians.length) { updatedGuardians[index] = _guardians[i]; index++; } } return isFound ? (true, updatedGuardians) : (false, _guardians); }
29,333
10
// IMPORTANT: amountOutMin parameter is the price to swap shortOptionTokens to underlyingTokens. IMPORTANT: If the ratio between shortOptionTokens and underlyingTokens is 1:1, then only the swap fee (0.30%) has to be paid. Opens a longOptionToken position by minting long + short tokens, then selling the short tokens. optionToken The option address. amountOptions The quantity of longOptionTokens to purchase. maxPremium The maximum quantity of underlyingTokens to pay for the optionTokens.returnWhether or not the call succeeded. /
function openFlashLong( IOption optionToken, uint256 amountOptions, uint256 maxPremium
function openFlashLong( IOption optionToken, uint256 amountOptions, uint256 maxPremium
22,501
11
// propNames["name"] = "name";
propNames["registered"] = "registered"; propNames["funded"] = "funded"; propNames["charter"] = "charter"; propNames["voterApproved"] = "voterApproved"; propNames["rejected"] = "rejected";
propNames["registered"] = "registered"; propNames["funded"] = "funded"; propNames["charter"] = "charter"; propNames["voterApproved"] = "voterApproved"; propNames["rejected"] = "rejected";
23,012
11
// require(timestamp < block.timestamp && block.timestamp < timestamp + 1 days, "attack must be within a day");
uint256 attackSeed = uint256(keccak256(abi.encodePacked(attacker, bullet, otherDifficult, timestamp))); attackHistory.push(attackInfo(beneficiary, attackSeed&(~uint256(0xffffffff))|block.number));
uint256 attackSeed = uint256(keccak256(abi.encodePacked(attacker, bullet, otherDifficult, timestamp))); attackHistory.push(attackInfo(beneficiary, attackSeed&(~uint256(0xffffffff))|block.number));
125
5
// Returns the amount of tokens in existence./
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint256);
16,110
823
// PRICELESS POSITION DATA STRUCTURES / Stores the state of the PricelessPositionManager. Set on expiration, emergency shutdown, or settlement.
enum ContractState { Open, ExpiredPriceRequested, ExpiredPriceReceived } ContractState public contractState; // Represents a single sponsor's position. All collateral is held by this contract. // This struct acts as bookkeeping for how much of that collateral is allocated to each sponsor. struct PositionData { FixedPoint.Unsigned tokensOutstanding; // Tracks pending withdrawal requests. A withdrawal request is pending if `withdrawalRequestPassTimestamp != 0`. uint256 withdrawalRequestPassTimestamp; FixedPoint.Unsigned withdrawalRequestAmount; // Raw collateral value. This value should never be accessed directly -- always use _getFeeAdjustedCollateral(). // To add or remove collateral, use _addCollateral() and _removeCollateral(). FixedPoint.Unsigned rawCollateral; // Tracks pending transfer position requests. A transfer position request is pending if `transferPositionRequestPassTimestamp != 0`. uint256 transferPositionRequestPassTimestamp; }
enum ContractState { Open, ExpiredPriceRequested, ExpiredPriceReceived } ContractState public contractState; // Represents a single sponsor's position. All collateral is held by this contract. // This struct acts as bookkeeping for how much of that collateral is allocated to each sponsor. struct PositionData { FixedPoint.Unsigned tokensOutstanding; // Tracks pending withdrawal requests. A withdrawal request is pending if `withdrawalRequestPassTimestamp != 0`. uint256 withdrawalRequestPassTimestamp; FixedPoint.Unsigned withdrawalRequestAmount; // Raw collateral value. This value should never be accessed directly -- always use _getFeeAdjustedCollateral(). // To add or remove collateral, use _addCollateral() and _removeCollateral(). FixedPoint.Unsigned rawCollateral; // Tracks pending transfer position requests. A transfer position request is pending if `transferPositionRequestPassTimestamp != 0`. uint256 transferPositionRequestPassTimestamp; }
9,370
84
// Set for every month false to see the tokens for the month is not get it
isTokensTaken[_participant][month] = false;
isTokensTaken[_participant][month] = false;
2,445
44
// Function to retrieve registration status of an address
function isUserRegistered(address _toCheckAddress) public view returns (bool) { require(_toCheckAddress != address(0), "The address provided for registration check must be valid."); bool isRegistered = false; uint256 registrationStatus = registeredAccounts[_toCheckAddress]; if(registrationStatus == 1) { isRegistered = true; } return isRegistered; }
function isUserRegistered(address _toCheckAddress) public view returns (bool) { require(_toCheckAddress != address(0), "The address provided for registration check must be valid."); bool isRegistered = false; uint256 registrationStatus = registeredAccounts[_toCheckAddress]; if(registrationStatus == 1) { isRegistered = true; } return isRegistered; }
52,768
64
// If needed, set the starting index block to be within 256 of the current block.
if (blockDifference >= 256) { startingIndexBlock = prevBlock - (blockDifference % 256); _setStartingIndexBlock(startingIndexBlock); }
if (blockDifference >= 256) { startingIndexBlock = prevBlock - (blockDifference % 256); _setStartingIndexBlock(startingIndexBlock); }
43,493
243
// FUND THE FARM (JUST DEPOSITS FUNDS INTO THE REWARD WALLET)
function fund(uint256 _amount) external { require(msg.sender != rewardWallet, "Sender is reward wallet"); rewardToken.safeTransferFrom( address(msg.sender), rewardWallet, _amount ); }
function fund(uint256 _amount) external { require(msg.sender != rewardWallet, "Sender is reward wallet"); rewardToken.safeTransferFrom( address(msg.sender), rewardWallet, _amount ); }
48,867
0
// keccak256(secret) => block number at which the secret was revealed
mapping(bytes32 => uint256) private secrethash_to_block; event SecretRevealed(bytes32 indexed secrethash, bytes32 secret);
mapping(bytes32 => uint256) private secrethash_to_block; event SecretRevealed(bytes32 indexed secrethash, bytes32 secret);
22,300
5
// Emits a {Transfer} event . /
function mint(address to, uint256 tokenId) public onlyOwner validTokenId(tokenId) returns (bool) { require(false == _exists(tokenId),"ERAC: Don't allowed to mine an existing token ID"); _mint(to, tokenId); return true; }
function mint(address to, uint256 tokenId) public onlyOwner validTokenId(tokenId) returns (bool) { require(false == _exists(tokenId),"ERAC: Don't allowed to mine an existing token ID"); _mint(to, tokenId); return true; }
11,288
20
// The gas price oracle
OracleLike public gasPriceOracle;
OracleLike public gasPriceOracle;
11,351
219
// Initializes the contract by setting a `name` and a `symbol` to the token collection. /
constructor(string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
constructor(string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
20,457
4
// error//variable//validator/
modifier validId(uint256 _id) { require(_id > 0 && _id <= maxSupply, ID_NOT_VALID); _; }
modifier validId(uint256 _id) { require(_id > 0 && _id <= maxSupply, ID_NOT_VALID); _; }
16,891
109
// Sets Buy/Sell limits
balanceLimit=InitialSupply/BalanceLimitDivider; sellLimit=InitialSupply/SellLimitDivider;
balanceLimit=InitialSupply/BalanceLimitDivider; sellLimit=InitialSupply/SellLimitDivider;
29,435
104
// Internal function that reduces an amount of the token of a given account./ Update magnifiedDividendCorrections to keep dividends unchanged./account The account whose tokens will be burnt./value The amount that will be burnt.
function _reduce(address account, uint256 value) internal { for (uint256 i; i < rewardTokens.length; i++){ magnifiedDividendCorrections[rewardTokens[i]][account] = magnifiedDividendCorrections[rewardTokens[i]][account] .add( (magnifiedDividendPerShare[rewardTokens[i]].mul(value)).toInt256Safe() ); } }
function _reduce(address account, uint256 value) internal { for (uint256 i; i < rewardTokens.length; i++){ magnifiedDividendCorrections[rewardTokens[i]][account] = magnifiedDividendCorrections[rewardTokens[i]][account] .add( (magnifiedDividendPerShare[rewardTokens[i]].mul(value)).toInt256Safe() ); } }
13,566
79
// Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
_ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId);
_ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId);
19,974
8
// Use the recover method to see what address was used to create the signature on this data. Note that if the digest doesn't exactly match what was signed we'll get a random recovered address.
address recoveredAddress = digest.recover(signature); require(recoveredAddress == whitelistSigningKey, "Invalid signature"); _;
address recoveredAddress = digest.recover(signature); require(recoveredAddress == whitelistSigningKey, "Invalid signature"); _;
4,496
0
// Declares a contract that can have an owner. /
contract OwnedI { event LogOwnerChanged(address indexed previousOwner, address indexed newOwner); function getOwner() constant returns (address); function setOwner(address newOwner) returns (bool success); }
contract OwnedI { event LogOwnerChanged(address indexed previousOwner, address indexed newOwner); function getOwner() constant returns (address); function setOwner(address newOwner) returns (bool success); }
6,549
0
// Proofs from blocks that are below the acceptance height will be rejected. If `minBlockAcceptanceHeight` value is zero - proofs from block with any height are accepted.
uint64 public minBlockAcceptanceHeight;
uint64 public minBlockAcceptanceHeight;
35,935
63
// The contents of the _postBytes array start 32 bytes into the structure. Our first read should obtain the `submod` bytes that can fit into the unused space in the last word of the stored array. To get this, we read 32 bytes starting from `submod`, so the data we read overlaps with the array contents by `submod` bytes. Masking the lowest-order `submod` bytes allows us to add that value directly to the stored value.
let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and(
let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and(
8,562
305
// Update remaining amount in storage
remainingMakerAmount = remainingMakerAmount.sub(makingAmount, "LOP: taking > remaining"); _remaining[orderHash] = remainingMakerAmount + 1; emit OrderFilled(msg.sender, orderHash, remainingMakerAmount);
remainingMakerAmount = remainingMakerAmount.sub(makingAmount, "LOP: taking > remaining"); _remaining[orderHash] = remainingMakerAmount + 1; emit OrderFilled(msg.sender, orderHash, remainingMakerAmount);
39,432
68
// Upgrades from old implementations will perform a rollback test. This test requires the new implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else {
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else {
5,496
4
// 名稱尚未被使用就可登錄
if(contracts[_name].owner == 0){ Contract con = contracts[_name]; con.owner = msg.sender; numContracts++; return true; }else{
if(contracts[_name].owner == 0){ Contract con = contracts[_name]; con.owner = msg.sender; numContracts++; return true; }else{
46,527
28
// Revoke acess to deposit heroes.
function revokeAccessDeposit(address _address) onlyOwner public
function revokeAccessDeposit(address _address) onlyOwner public
18,012
62
// return the name of this token/
function name() public view returns (string) { return "Gods Unchained"; }
function name() public view returns (string) { return "Gods Unchained"; }
6,956
21
// uint256 read_index = element_count - 1; uint256 write_index;
for (uint64 i = 0; i < element_count; i++) { leafs[i] = keccak256(abi.encodePacked(bytes1(0), elements[element_count - 1 - i])); }
for (uint64 i = 0; i < element_count; i++) { leafs[i] = keccak256(abi.encodePacked(bytes1(0), elements[element_count - 1 - i])); }
19,649
0
// Introducing max amount of LeanCoins available on ICO
uint public max_leancoins = 1000000;
uint public max_leancoins = 1000000;
38,698
326
// returns the global network fee (in units of PPM) notes: - the network fee is a portion of the total fees from each pool /
function networkFeePPM() external view returns (uint32);
function networkFeePPM() external view returns (uint32);
65,020
27
// Register a new node with Rocket Pool
function registerNode(string calldata _timezoneLocation) override external onlyLatestContract("rocketNodeManager", address(this)) { // Load contracts RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Check node settings require(rocketDAOProtocolSettingsNode.getRegistrationEnabled(), "Rocket Pool node registrations are currently disabled"); // Check timezone location require(bytes(_timezoneLocation).length >= 4, "The timezone location is invalid"); // Initialise node data setBool(keccak256(abi.encodePacked("node.exists", msg.sender)), true); setString(keccak256(abi.encodePacked("node.timezone.location", msg.sender)), _timezoneLocation); // Add node to index addressSetStorage.addItem(keccak256(abi.encodePacked("nodes.index")), msg.sender); // Initialise fee distributor for this node _initialiseFeeDistributor(msg.sender); // Set node registration time (uses old storage key name for backwards compatibility) setUint(keccak256(abi.encodePacked("rewards.pool.claim.contract.registered.time", "rocketClaimNode", msg.sender)), block.timestamp); // Emit node registered event emit NodeRegistered(msg.sender, block.timestamp); }
function registerNode(string calldata _timezoneLocation) override external onlyLatestContract("rocketNodeManager", address(this)) { // Load contracts RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode")); AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage")); // Check node settings require(rocketDAOProtocolSettingsNode.getRegistrationEnabled(), "Rocket Pool node registrations are currently disabled"); // Check timezone location require(bytes(_timezoneLocation).length >= 4, "The timezone location is invalid"); // Initialise node data setBool(keccak256(abi.encodePacked("node.exists", msg.sender)), true); setString(keccak256(abi.encodePacked("node.timezone.location", msg.sender)), _timezoneLocation); // Add node to index addressSetStorage.addItem(keccak256(abi.encodePacked("nodes.index")), msg.sender); // Initialise fee distributor for this node _initialiseFeeDistributor(msg.sender); // Set node registration time (uses old storage key name for backwards compatibility) setUint(keccak256(abi.encodePacked("rewards.pool.claim.contract.registered.time", "rocketClaimNode", msg.sender)), block.timestamp); // Emit node registered event emit NodeRegistered(msg.sender, block.timestamp); }
21,661
5
// Withdraws collateral from the safe/_safeId Id of the safe/_amount Amount of collateral to withdraw/_adapterAddr Adapter address of the reflexer collateral/_to Address where to send the collateral we withdrew
function _reflexerWithdraw( uint256 _safeId, uint256 _amount, address _adapterAddr, address _to
function _reflexerWithdraw( uint256 _safeId, uint256 _amount, address _adapterAddr, address _to
25,782