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
2
// Adds a new extension to the router.
function addExtension(Extension memory extension) external;
function addExtension(Extension memory extension) external;
5,034
179
// Lighthouse accounting /
mapping(address => bool) public isLighthouse;
mapping(address => bool) public isLighthouse;
48,854
9
// Mark N°10 => Moon
function item_10() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#7F0068" d="M197.2,142.1c-5.8,0-10.9,2.9-13.9,7.3c2.3-2.3,5.4-3.7,8.9-3.7c7.1,0,12.9,5.9,12.9,13.3 s-5.8,13.3-12.9,13.3c-3.4,0-6.6-1.4-8.9-3.7c3.1,4.4,8.2,7.3,13.9,7.3c9.3,0,16.9-7.6,16.9-16.9S206.6,142.1,197.2,142.1z"/>' ) ) ); }
function item_10() public pure returns (string memory) { return base( string( abi.encodePacked( '<path fill="#7F0068" d="M197.2,142.1c-5.8,0-10.9,2.9-13.9,7.3c2.3-2.3,5.4-3.7,8.9-3.7c7.1,0,12.9,5.9,12.9,13.3 s-5.8,13.3-12.9,13.3c-3.4,0-6.6-1.4-8.9-3.7c3.1,4.4,8.2,7.3,13.9,7.3c9.3,0,16.9-7.6,16.9-16.9S206.6,142.1,197.2,142.1z"/>' ) ) ); }
47,730
97
// Admin only
function addFarming(uint8 r, uint256 _totalReward, uint256 dailyReward, uint256 _startTime, uint256 _endTime) public onlyOwner { require(IERC20(NFTS).balanceOf(address(this))>= _totalReward, "Unsufficient balance"); poolInfo[r] = PoolInfo({ lastRewardTime: _startTime, expectedLastTime: _endTime, totalReward : _totalReward, blockCreation : block.number }); }
function addFarming(uint8 r, uint256 _totalReward, uint256 dailyReward, uint256 _startTime, uint256 _endTime) public onlyOwner { require(IERC20(NFTS).balanceOf(address(this))>= _totalReward, "Unsufficient balance"); poolInfo[r] = PoolInfo({ lastRewardTime: _startTime, expectedLastTime: _endTime, totalReward : _totalReward, blockCreation : block.number }); }
5,320
16
// We keep the link to the previous address but set the node to inactive (active == false)
role.bearer[account].active = false;
role.bearer[account].active = false;
38,790
12
// Update the given pool's reward token allocation point and `IRewarder` contract. Can only be called by the owner./pid The index of the MasterChef pool. See `poolInfo`./allocPoint New AP of the pool.
function set(uint256 pid, uint256 allocPoint) public onlyOwner { require(poolInfo[pid].lastRewardTime != 0, "Pool does not exist"); totalAllocPoint = totalAllocPoint - poolInfo[pid].allocPoint + allocPoint; poolInfo[pid].allocPoint = allocPoint; emit LogSetPool(pid, allocPoint); }
function set(uint256 pid, uint256 allocPoint) public onlyOwner { require(poolInfo[pid].lastRewardTime != 0, "Pool does not exist"); totalAllocPoint = totalAllocPoint - poolInfo[pid].allocPoint + allocPoint; poolInfo[pid].allocPoint = allocPoint; emit LogSetPool(pid, allocPoint); }
47,592
9
// ERC721 NFT deposit
function depositNFT(address _token, uint256 _tokenId) public onlyAdmin { IERC721(_token).transferFrom(msg.sender, address(this), _tokenId); _nftDeposits[_token].push(_tokenId); if (!_erc721Deposited[_token]) { _erc721Deposited[_token] = true; _erc721Addresses.push(_token); } }
function depositNFT(address _token, uint256 _tokenId) public onlyAdmin { IERC721(_token).transferFrom(msg.sender, address(this), _tokenId); _nftDeposits[_token].push(_tokenId); if (!_erc721Deposited[_token]) { _erc721Deposited[_token] = true; _erc721Addresses.push(_token); } }
19,567
118
// Update staking total amount
_poolTotalStake = _poolTotalStake.add(_amount); return (true, _amount);
_poolTotalStake = _poolTotalStake.add(_amount); return (true, _amount);
7,355
5
// Lets the account receive native tokens.
receive() external payable {} /*/////////////////////////////////////////////////////////////// View functions //////////////////////////////////////////////////////////////*/ /// @notice See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Receiver) returns (bool) { return interfaceId == type(IERC1155Receiver).interfaceId || interfaceId == type(IERC721Receiver).interfaceId || super.supportsInterface(interfaceId); }
receive() external payable {} /*/////////////////////////////////////////////////////////////// View functions //////////////////////////////////////////////////////////////*/ /// @notice See {IERC165-supportsInterface}. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Receiver) returns (bool) { return interfaceId == type(IERC1155Receiver).interfaceId || interfaceId == type(IERC721Receiver).interfaceId || super.supportsInterface(interfaceId); }
22,263
7
// calls an external view token contract method that returns a symbol or name, and parses the output into a string
function callAndParseStringReturn(address token, bytes4 selector) private view returns (string memory) { (bool success, bytes memory data) = token.staticcall(abi.encodeWithSelector(selector)); // if not implemented, or returns empty data, return empty string if (!success || data.length == 0) { return ''; } // bytes32 data always has length 32 if (data.length == 32) { bytes32 decoded = abi.decode(data, (bytes32)); return bytes32ToString(decoded); } else if (data.length > 64) { return abi.decode(data, (string)); } return ''; }
function callAndParseStringReturn(address token, bytes4 selector) private view returns (string memory) { (bool success, bytes memory data) = token.staticcall(abi.encodeWithSelector(selector)); // if not implemented, or returns empty data, return empty string if (!success || data.length == 0) { return ''; } // bytes32 data always has length 32 if (data.length == 32) { bytes32 decoded = abi.decode(data, (bytes32)); return bytes32ToString(decoded); } else if (data.length > 64) { return abi.decode(data, (string)); } return ''; }
12,524
534
// The address of the contract which will receive fees.
address public rewards;
address public rewards;
8,546
20
// Standard Way of deriving salt
bytes32 salt = keccak256(abi.encode(_user, _saltNonce));
bytes32 salt = keccak256(abi.encode(_user, _saltNonce));
11,712
140
// Gets the unlockable tokens of a specified address_of The address to query the the unlockable token count of/
function getUnlockableTokens(address _of) public view returns (uint256 unlockableTokens)
function getUnlockableTokens(address _of) public view returns (uint256 unlockableTokens)
10,478
31
// Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _subtractedValue The amount of tokens to decrease the allowance by. /
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
21,171
48
// withdraw award
uint256 _totalWithdraw = round_m[_rndNo].eth.mul(51) / 100; _totalWithdraw = _totalWithdraw.sub(round_m[_rndNo].exAward); _totalWithdraw = (_totalWithdraw.mul(playerRound_m[_rndNo][msg.sender].keys)); _totalWithdraw = _totalWithdraw / round_m[_rndNo].keys; uint256 _inveterAmount = playerRound_m[_rndNo][msg.sender].getInveterAmount; _totalWithdraw = _totalWithdraw.add(_inveterAmount); uint256 _withdrawed = playerRound_m[_rndNo][msg.sender].withdraw; if(_totalWithdraw > _withdrawed) {
uint256 _totalWithdraw = round_m[_rndNo].eth.mul(51) / 100; _totalWithdraw = _totalWithdraw.sub(round_m[_rndNo].exAward); _totalWithdraw = (_totalWithdraw.mul(playerRound_m[_rndNo][msg.sender].keys)); _totalWithdraw = _totalWithdraw / round_m[_rndNo].keys; uint256 _inveterAmount = playerRound_m[_rndNo][msg.sender].getInveterAmount; _totalWithdraw = _totalWithdraw.add(_inveterAmount); uint256 _withdrawed = playerRound_m[_rndNo][msg.sender].withdraw; if(_totalWithdraw > _withdrawed) {
31,749
2
// solhint-disable-next-line func-name-mixedcase
function __RoyaltyRegistry_init() public initializer { __Ownable_init(); }
function __RoyaltyRegistry_init() public initializer { __Ownable_init(); }
607
158
// Must move the decimal to the right by 9 places to avoid math underflow error
totalDebt.mul( 1e9 ), IERC20( OHM ).totalSupply() ).decode112with18().div( 1e18 );
totalDebt.mul( 1e9 ), IERC20( OHM ).totalSupply() ).decode112with18().div( 1e18 );
44,801
7
// 转账方法to 转账目标value 转账金额 return 转账是否成功/
function transfer(address to, uint256 value) override public returns (bool) { _transfer(msg.sender, to, value); return true; }
function transfer(address to, uint256 value) override public returns (bool) { _transfer(msg.sender, to, value); return true; }
25,717
29
// FIND SUITABLE NODE get the left if empty direct use , if not empty then compare global position value ,if global position more then most right then move next level , until global position is in the middle of left and right then v just loop that particular level
uint32 leftposition = uint32(userlistbyid[uint32(uplineId)].Position); uint32 rightposition = uint32(userlistbyid[uint32(uplineId)].Position); while(true){ leftposition = uint32(leftposition * 2); rightposition = uint32(rightposition * 2 + 1); if(nextPosition < leftposition){
uint32 leftposition = uint32(userlistbyid[uint32(uplineId)].Position); uint32 rightposition = uint32(userlistbyid[uint32(uplineId)].Position); while(true){ leftposition = uint32(leftposition * 2); rightposition = uint32(rightposition * 2 + 1); if(nextPosition < leftposition){
10,849
45
// Modifier to make a function callable only by a certain role. Inaddition to checking the sender's role, `address(0)` 's role is alsoconsidered. Granting a role to `address(0)` is equivalent to enablingthis role for everyone. /
modifier onlyRoleOrOpenRole(bytes32 role) { if (!hasRole(role, address(0))) { _checkRole(role, _msgSender()); } _; }
modifier onlyRoleOrOpenRole(bytes32 role) { if (!hasRole(role, address(0))) { _checkRole(role, _msgSender()); } _; }
5,805
2
// ============ Events ============ // ============ Modifiers ============ / If the time lock period is 0, then allow non-timebound upgrades. This is useful for initialization of the protocol and for testing.
if (timeLockPeriod == 0) { _; return; }
if (timeLockPeriod == 0) { _; return; }
32,809
164
// File: contracts/lib/ledgerlib/LedgerBalanceLimit.sol
pragma solidity ^0.5.1;
pragma solidity ^0.5.1;
55,299
6
// percentage of tokens that are available immediatly when a vesting postiion is created
uint256 public immutable initUnlockedPercent;
uint256 public immutable initUnlockedPercent;
15,048
28
// Executes the swap returning the amountIn needed to spend to receive the desired amountOut.
amountIn = swapRouter.exactOutputSingle(params);
amountIn = swapRouter.exactOutputSingle(params);
31,598
35
// safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
4,145
29
// minCollateralPerToken >= startCollateralNetOfWithdrawal / startTokens.
require( minCollateralPerToken.mul(startTokens).isLessThanOrEqual(startCollateralNetOfWithdrawal), "CR is less than min liq. price" );
require( minCollateralPerToken.mul(startTokens).isLessThanOrEqual(startCollateralNetOfWithdrawal), "CR is less than min liq. price" );
19,163
162
// get share of currency tokens kept in the pool
uint256 currencyAmountToTransfer = amount.mul( currencyBalance()).div(_totalSupply);
uint256 currencyAmountToTransfer = amount.mul( currencyBalance()).div(_totalSupply);
26,670
113
// show the table/ function displayTable()publicviewreturns (string Message, uint256 PlayerBet, uint256 PlayerCard1, uint256 PlayerCard2,uint256 PlayerNewCard, uint256 PlayerCardTotal, uint256 PlayerSplitTotal,uint256 DealerCard1, uint256 DealerCard2, uint256 DealerNewCard1,
// uint256 DealerNewCard2, uint256 DealerCardTotal, uint256 Pot) { // return (_dMsg, _pBet, _pCard1, _pCard2, _pNewCard, _pCardTotal, _pSplitTotal, // _dCard1, _dCard2, _dNewCard[0], _dNewCard[1], _dCardTotal, _safeBalance); // }
// uint256 DealerNewCard2, uint256 DealerCardTotal, uint256 Pot) { // return (_dMsg, _pBet, _pCard1, _pCard2, _pNewCard, _pCardTotal, _pSplitTotal, // _dCard1, _dCard2, _dNewCard[0], _dNewCard[1], _dCardTotal, _safeBalance); // }
13,979
177
// Actual gulp implementation
function _gulp() internal returns (bool _success)
function _gulp() internal returns (bool _success)
5,533
4
// see other checkUpkeep function for description this function may be deprecated in a future version of chainlink automation /
function checkUpkeep( uint256 id ) external returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 gasLimit,
function checkUpkeep( uint256 id ) external returns ( bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed, uint256 gasLimit,
18,917
5
// Std Variables/
address public wrapperaddress; //Address of Wrapper Contract address public ruggedproject = 0x37Db6e16c230b14521E6f1922eFBf6592cBB4A94; //Address of the Rugged Project address public Owner; address public upgradecontract; //Additional contract which will be allowed to manage the TOKEN URI's uint256 private numwraps; uint256 public numholders; uint256 public numblocked;
address public wrapperaddress; //Address of Wrapper Contract address public ruggedproject = 0x37Db6e16c230b14521E6f1922eFBf6592cBB4A94; //Address of the Rugged Project address public Owner; address public upgradecontract; //Additional contract which will be allowed to manage the TOKEN URI's uint256 private numwraps; uint256 public numholders; uint256 public numblocked;
2,416
53
// Mapping of actionIds to policyholders to approvals.
mapping(uint256 actionId => mapping(address policyholder => bool hasApproved)) public approvals;
mapping(uint256 actionId => mapping(address policyholder => bool hasApproved)) public approvals;
33,717
21
// Returns symbol expire date/
function getSymbolExpireDate(bytes memory symbol) public view returns (uint) { return SRStorage().getSymbolExpiration(symbol); }
function getSymbolExpireDate(bytes memory symbol) public view returns (uint) { return SRStorage().getSymbolExpiration(symbol); }
9,885
9
// I increment _tokenIds here so that my first NFT has an ID of 1. More on this in the lesson!
_tokenIds.increment();
_tokenIds.increment();
33,308
16
// Get if an account can point this domain as a subdomain/ May be called by `canDeleteDomain` of the parent domain - implement access control here!!!/ updater The account that may or may not be able to delete a subdomain/ name The subdomain to delete/ parent The parent domain/ return Whether an account can delete the subdomain
function canDeleteSubdomain(address updater, string memory name, IDomain parent) public virtual view returns (bool) { return ownerOf(1) == updater; }
function canDeleteSubdomain(address updater, string memory name, IDomain parent) public virtual view returns (bool) { return ownerOf(1) == updater; }
26,443
11
// Check if the handler is valid. handler The handler to be verified. /
function isValidHandler(address handler) external view override returns (bool)
function isValidHandler(address handler) external view override returns (bool)
40,824
3
// Function to change the whitelist manager of Yieldster./_manager Address of the new manager.
function changeManager(address _manager) public onlyWhitelistManager { whiteListManager = _manager; }
function changeManager(address _manager) public onlyWhitelistManager { whiteListManager = _manager; }
20,969
7
// Returns the details of the sale for a given owner and index There must be sales orders belonging to the owner and the index provided must be validated before running the codeowner The address of the owner of the sale index The index representative of the desired salereturn tokenId The token id of the NFT put up for salereturn price The price of the NFT put up for sale /
function saleOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId, uint256 price);
function saleOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId, uint256 price);
6,904
74
// Interface that any module factory contract should implement /
contract IModuleFactory is Ownable { ERC20 public polyToken; uint256 public setupCost; uint256 public usageCost; uint256 public monthlySubscriptionCost; event LogChangeFactorySetupFee(uint256 _oldSetupcost, uint256 _newSetupCost, address _moduleFactory); event LogChangeFactoryUsageFee(uint256 _oldUsageCost, uint256 _newUsageCost, address _moduleFactory); event LogChangeFactorySubscriptionFee(uint256 _oldSubscriptionCost, uint256 _newMonthlySubscriptionCost, address _moduleFactory); event LogGenerateModuleFromFactory(address _module, bytes32 indexed _moduleName, address indexed _moduleFactory, address _creator, uint256 _timestamp); /** * @notice Constructor * @param _polyAddress Address of the polytoken */ constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public { polyToken = ERC20(_polyAddress); setupCost = _setupCost; usageCost = _usageCost; monthlySubscriptionCost = _subscriptionCost; } //Should create an instance of the Module, or throw function deploy(bytes _data) external returns(address); /** * @notice Type of the Module factory */ function getType() public view returns(uint8); /** * @notice Get the name of the Module */ function getName() public view returns(bytes32); /** * @notice Get the description of the Module */ function getDescription() public view returns(string); /** * @notice Get the title of the Module */ function getTitle() public view returns(string); /** * @notice Get the Instructions that helped to used the module */ function getInstructions() public view returns (string); /** * @notice Get the tags related to the module factory */ function getTags() public view returns (bytes32[]); //Pull function sig from _data function getSig(bytes _data) internal pure returns (bytes4 sig) { uint len = _data.length < 4 ? _data.length : 4; for (uint i = 0; i < len; i++) { sig = bytes4(uint(sig) + uint(_data[i]) * (2 ** (8 * (len - 1 - i)))); } } /** * @notice used to change the fee of the setup cost * @param _newSetupCost new setup cost */ function changeFactorySetupFee(uint256 _newSetupCost) public onlyOwner { emit LogChangeFactorySetupFee(setupCost, _newSetupCost, address(this)); setupCost = _newSetupCost; } /** * @notice used to change the fee of the usage cost * @param _newUsageCost new usage cost */ function changeFactoryUsageFee(uint256 _newUsageCost) public onlyOwner { emit LogChangeFactoryUsageFee(usageCost, _newUsageCost, address(this)); usageCost = _newUsageCost; } /** * @notice used to change the fee of the subscription cost * @param _newSubscriptionCost new subscription cost */ function changeFactorySubscriptionFee(uint256 _newSubscriptionCost) public onlyOwner { emit LogChangeFactorySubscriptionFee(monthlySubscriptionCost, _newSubscriptionCost, address(this)); monthlySubscriptionCost = _newSubscriptionCost; } }
contract IModuleFactory is Ownable { ERC20 public polyToken; uint256 public setupCost; uint256 public usageCost; uint256 public monthlySubscriptionCost; event LogChangeFactorySetupFee(uint256 _oldSetupcost, uint256 _newSetupCost, address _moduleFactory); event LogChangeFactoryUsageFee(uint256 _oldUsageCost, uint256 _newUsageCost, address _moduleFactory); event LogChangeFactorySubscriptionFee(uint256 _oldSubscriptionCost, uint256 _newMonthlySubscriptionCost, address _moduleFactory); event LogGenerateModuleFromFactory(address _module, bytes32 indexed _moduleName, address indexed _moduleFactory, address _creator, uint256 _timestamp); /** * @notice Constructor * @param _polyAddress Address of the polytoken */ constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public { polyToken = ERC20(_polyAddress); setupCost = _setupCost; usageCost = _usageCost; monthlySubscriptionCost = _subscriptionCost; } //Should create an instance of the Module, or throw function deploy(bytes _data) external returns(address); /** * @notice Type of the Module factory */ function getType() public view returns(uint8); /** * @notice Get the name of the Module */ function getName() public view returns(bytes32); /** * @notice Get the description of the Module */ function getDescription() public view returns(string); /** * @notice Get the title of the Module */ function getTitle() public view returns(string); /** * @notice Get the Instructions that helped to used the module */ function getInstructions() public view returns (string); /** * @notice Get the tags related to the module factory */ function getTags() public view returns (bytes32[]); //Pull function sig from _data function getSig(bytes _data) internal pure returns (bytes4 sig) { uint len = _data.length < 4 ? _data.length : 4; for (uint i = 0; i < len; i++) { sig = bytes4(uint(sig) + uint(_data[i]) * (2 ** (8 * (len - 1 - i)))); } } /** * @notice used to change the fee of the setup cost * @param _newSetupCost new setup cost */ function changeFactorySetupFee(uint256 _newSetupCost) public onlyOwner { emit LogChangeFactorySetupFee(setupCost, _newSetupCost, address(this)); setupCost = _newSetupCost; } /** * @notice used to change the fee of the usage cost * @param _newUsageCost new usage cost */ function changeFactoryUsageFee(uint256 _newUsageCost) public onlyOwner { emit LogChangeFactoryUsageFee(usageCost, _newUsageCost, address(this)); usageCost = _newUsageCost; } /** * @notice used to change the fee of the subscription cost * @param _newSubscriptionCost new subscription cost */ function changeFactorySubscriptionFee(uint256 _newSubscriptionCost) public onlyOwner { emit LogChangeFactorySubscriptionFee(monthlySubscriptionCost, _newSubscriptionCost, address(this)); monthlySubscriptionCost = _newSubscriptionCost; } }
19,857
34
// set new distributor address._address new address/
function setDistributorAddress(address payable _address) external onlyGovernor { require(_address != address(0), "UnilendV2: ZERO ADDRESS"); distributorAddress = _address; }
function setDistributorAddress(address payable _address) external onlyGovernor { require(_address != address(0), "UnilendV2: ZERO ADDRESS"); distributorAddress = _address; }
25,750
3
// ============ External ============ //Create a trading pool. Create or select new collateral and create RebalancingSetToken contract toadminister pool. Save relevant data to pool's entry in pools state variable under the RebalancingSet Token address._tradingPairAllocator The address of the allocator the trader wishes to use _startingBaseAssetAllocationStarting base asset allocation in a scaled decimal value (e.g. 100% = 1e18, 1% = 1e16) _startingUSDValue Starting value of one share of the trading pool to 18 decimals of precision _name The name of the new RebalancingSetTokenV2 _symbol The symbol of the new RebalancingSetTokenV2 _rebalancingSetCallData Byte string containing additional call parameters to pass to factory /
function createTradingPool( ISocialAllocator _tradingPairAllocator, uint256 _startingBaseAssetAllocation, uint256 _startingUSDValue, bytes32 _name, bytes32 _symbol, bytes calldata _rebalancingSetCallData ) external
function createTradingPool( ISocialAllocator _tradingPairAllocator, uint256 _startingBaseAssetAllocation, uint256 _startingUSDValue, bytes32 _name, bytes32 _symbol, bytes calldata _rebalancingSetCallData ) external
16,978
46
// update ownership mapping
_ownerOf[_tokenId] = _recipient; _balances[_recipient] += 1;
_ownerOf[_tokenId] = _recipient; _balances[_recipient] += 1;
2,255
77
// Token contract address
address private _tokenAddress;
address private _tokenAddress;
44,985
16
// Initialize the contract _stakedToken: staked token address _rewardToken: reward token address _rewardPerBlock: reward per block (in rewardToken) _startBlock: start block _bonusEndBlock: end block _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) _admin: admin address with ownership /
function initialize( IBEP20 _stakedToken, IBEP20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, uint256 _lockTime, address _admin
function initialize( IBEP20 _stakedToken, IBEP20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, uint256 _lockTime, address _admin
42,401
56
// load fillArgs from storage if price is zero
if (orderInfo.fill.price == 0) { orderInfo.fill = g_fillArgs; g_fillArgs = FillArgs({ price: 0, fee: 0, isNegativeFee: false });
if (orderInfo.fill.price == 0) { orderInfo.fill = g_fillArgs; g_fillArgs = FillArgs({ price: 0, fee: 0, isNegativeFee: false });
28,080
549
// Mint SDVD tax to pool treasury
sdvd.mint(address(poolTreasury), tax);
sdvd.mint(address(poolTreasury), tax);
44,980
42
// Validates that the config is set properly and sets default values if necessary
function _validateConfig(Config memory _config) internal pure returns (Config memory) { if (_config.castWindow == 0) { revert GovernancePool.InitCastWindowNotSet(); } if (_config.externalDAO == address(0)) { revert GovernancePool.InitExternalDAONotSet(); } if (_config.externalToken == address(0)) { revert GovernancePool.InitExternalTokenNotSet(); } if (_config.feeBPS > 0 && _config.feeRecipient == address(0)) { revert GovernancePool.InitFeeRecipientNotSet(); } if (_config.base == address(0)) { revert GovernancePool.InitBaseWalletNotSet(); } // default reserve price if (_config.reservePrice == 0) { _config.reservePrice = 1 wei; } // default cast wait blocks 5 ~= 1 minute if (_config.castWaitBlocks == 0) { _config.castWaitBlocks = 5; } return _config; }
function _validateConfig(Config memory _config) internal pure returns (Config memory) { if (_config.castWindow == 0) { revert GovernancePool.InitCastWindowNotSet(); } if (_config.externalDAO == address(0)) { revert GovernancePool.InitExternalDAONotSet(); } if (_config.externalToken == address(0)) { revert GovernancePool.InitExternalTokenNotSet(); } if (_config.feeBPS > 0 && _config.feeRecipient == address(0)) { revert GovernancePool.InitFeeRecipientNotSet(); } if (_config.base == address(0)) { revert GovernancePool.InitBaseWalletNotSet(); } // default reserve price if (_config.reservePrice == 0) { _config.reservePrice = 1 wei; } // default cast wait blocks 5 ~= 1 minute if (_config.castWaitBlocks == 0) { _config.castWaitBlocks = 5; } return _config; }
24,785
40
// increments the loanIDCounterreturn id_ the new ID requested, which stores it in the loan data /
function newID() internal returns (uint256 id_) { Counters.Counter storage counter = MarketStorageLib.store().loanIDCounter; id_ = Counters.current(counter); Counters.increment(counter); }
function newID() internal returns (uint256 id_) { Counters.Counter storage counter = MarketStorageLib.store().loanIDCounter; id_ = Counters.current(counter); Counters.increment(counter); }
30,283
53
// Conditionally update the epoch for a feed reportContext Report context containing the epoch and round feedVerifierState Feed verifier state to conditionally update /
function _updateEpoch(bytes32[3] memory reportContext, VerifierState storage feedVerifierState) private { uint40 epochAndRound = uint40(uint256(reportContext[1])); uint32 epoch = uint32(epochAndRound >> 8); if (epoch > feedVerifierState.latestEpoch) { feedVerifierState.latestEpoch = epoch; } }
function _updateEpoch(bytes32[3] memory reportContext, VerifierState storage feedVerifierState) private { uint40 epochAndRound = uint40(uint256(reportContext[1])); uint32 epoch = uint32(epochAndRound >> 8); if (epoch > feedVerifierState.latestEpoch) { feedVerifierState.latestEpoch = epoch; } }
19,141
0
// Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool/pool Address of the pool that we want to observe/secondsAgo Number of seconds in the past from which to calculate the time-weighted means/ return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp/ return harmonicMeanLiquidity The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp/ return withFail Flag that true if function observe of IUniswapV3Pool reverts with some error
function consult(address pool, uint32 secondsAgo) internal view returns ( int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity, bool withFail )
function consult(address pool, uint32 secondsAgo) internal view returns ( int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity, bool withFail )
17,444
14
// Returns the number of values on the set. O(1). /
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
function _length(Set storage set) private view returns (uint256) { return set._values.length; }
776
21
// Store Request
Asset memory newRequest = Asset(name, price); buyingRequests.push(newRequest);
Asset memory newRequest = Asset(name, price); buyingRequests.push(newRequest);
27,623
34
// Check if we've received extra tokens or didn't receive enough
uint actualBalance = Ibkr(bkr).balanceOf(address(this)); require(actualBalance >= unallocatedbkr, "LiquidityPoolManager::vestAllocation: Insufficient bkr transferred"); unallocatedbkr = actualBalance;
uint actualBalance = Ibkr(bkr).balanceOf(address(this)); require(actualBalance >= unallocatedbkr, "LiquidityPoolManager::vestAllocation: Insufficient bkr transferred"); unallocatedbkr = actualBalance;
29,932
4
// Removes an address from the list of experts. Callable only by the owner.account - the address to be removed/
function removeExpert(address account) public onlyOwner { experts.remove(account); emit ExpertRemoved(account); }
function removeExpert(address account) public onlyOwner { experts.remove(account); emit ExpertRemoved(account); }
4,367
215
// Clean up struct in mapping, this can be removed later See https:github.com/OriginProtocol/origin-dollar/issues/324
strategies[_addr].isSupported = false; strategies[_addr].targetWeight = 0;
strategies[_addr].isSupported = false; strategies[_addr].targetWeight = 0;
37,500
116
// remove validator from array (since we remove only active it might not exist in the list)
if (indexOf >= 0) { if (_activeValidatorsList.length > 1 && uint256(indexOf) != _activeValidatorsList.length - 1) { _activeValidatorsList[uint256(indexOf)] = _activeValidatorsList[_activeValidatorsList.length - 1]; }
if (indexOf >= 0) { if (_activeValidatorsList.length > 1 && uint256(indexOf) != _activeValidatorsList.length - 1) { _activeValidatorsList[uint256(indexOf)] = _activeValidatorsList[_activeValidatorsList.length - 1]; }
5,459
14
// ensure that we don't overflow
if gt(lengthSize, 31) { revert(0, 0) }
if gt(lengthSize, 31) { revert(0, 0) }
27,593
448
// exposes an array of boostable vaults. Only used for visibility.
function getBoostableVaults() external view returns(ERC4626[] memory) { return boostableVaults; }
function getBoostableVaults() external view returns(ERC4626[] memory) { return boostableVaults; }
61,680
48
// utils
function randomNumber(uint256 _seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( msg.sender, block.timestamp, blockhash(block.number - 1), privateSeed, _seed ) ) ); }
function randomNumber(uint256 _seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( msg.sender, block.timestamp, blockhash(block.number - 1), privateSeed, _seed ) ) ); }
16,669
3
// set Abel Address
function setAbel(address _abel) onlyOscar public{ addressAbel=_abel; }
function setAbel(address _abel) onlyOscar public{ addressAbel=_abel; }
12,628
18
// Set ape to "rented" till a certain date
IAgency(_agencyAddress).setStateForApes(ids, msg.sender, "D");
IAgency(_agencyAddress).setStateForApes(ids, msg.sender, "D");
39,606
392
// Returns the fund's balances of all currencies supported by dYdX.return An array of ERC20 token contract addresses and a corresponding array of balances. /
function getBalances() external view returns (address[] memory, uint256[] memory) { Account.Info memory account = Account.Info(address(this), 0); (address[] memory tokens, , Types.Wei[] memory weis) = _soloMargin.getAccountBalances(account); uint256[] memory balances = new uint256[](weis.length); for (uint256 i = 0; i < weis.length; i++) balances[i] = weis[i].sign ? weis[i].value : 0; return (tokens, balances); }
function getBalances() external view returns (address[] memory, uint256[] memory) { Account.Info memory account = Account.Info(address(this), 0); (address[] memory tokens, , Types.Wei[] memory weis) = _soloMargin.getAccountBalances(account); uint256[] memory balances = new uint256[](weis.length); for (uint256 i = 0; i < weis.length; i++) balances[i] = weis[i].sign ? weis[i].value : 0; return (tokens, balances); }
35,879
42
// Constant token specific fields
string public constant name = "SeeleToken"; string public constant symbol = "Seele"; uint public constant decimals = 18;
string public constant name = "SeeleToken"; string public constant symbol = "Seele"; uint public constant decimals = 18;
29,637
80
// Create a new GanToken with a id and attaches an owner/tokenId The id of the token that's being created
function offerGanTokenForSaleToAddress(uint tokenId, address sendTo, uint256 minSalePriceInWei) external payable { require(tokenIdToOwner[tokenId] == msg.sender); ganTokenOfferedForSale[tokenId] = Offer(true, tokenId, msg.sender, minSalePriceInWei, sendTo); emit GanTokenOfferedForSale(tokenId, minSalePriceInWei, sendTo); }
function offerGanTokenForSaleToAddress(uint tokenId, address sendTo, uint256 minSalePriceInWei) external payable { require(tokenIdToOwner[tokenId] == msg.sender); ganTokenOfferedForSale[tokenId] = Offer(true, tokenId, msg.sender, minSalePriceInWei, sendTo); emit GanTokenOfferedForSale(tokenId, minSalePriceInWei, sendTo); }
6,892
1
// Ethereum : 0xFAd4fbc137B9C270AE2964D03b6d244D105e05A6 Goerli : 0x9F899C497611f8A047A5e55ffaE897f643e77486 Polygon : 0xa9Fcc345700731AE92B4b4F54F680eA13C04f688 Polygon Mumbai : 0xFf5eB9EFf4862EeCBfe32942f1A736F9f3973bfd
ERC20 brsToken = ERC20(0xFf5eB9EFf4862EeCBfe32942f1A736F9f3973bfd); uint8 private _bonusRate; // 1년 이자를 백분율로 기입 e.g. 8% 설정시 8 uint256 private _maxTimestamp; mapping(address => Lib.Stake) private _stakes; uint256 public totalStakes; uint256 public paidBonus;
ERC20 brsToken = ERC20(0xFf5eB9EFf4862EeCBfe32942f1A736F9f3973bfd); uint8 private _bonusRate; // 1년 이자를 백분율로 기입 e.g. 8% 설정시 8 uint256 private _maxTimestamp; mapping(address => Lib.Stake) private _stakes; uint256 public totalStakes; uint256 public paidBonus;
2,586
12
// address of serviceAgent (it can callspayFiat function)
address public serviceAgent;
address public serviceAgent;
47,429
50
// return the beneficiary of the tokens. /
function beneficiary() public view returns (address) { return _beneficiary; }
function beneficiary() public view returns (address) { return _beneficiary; }
526
170
// The price will be the total wei contributed divided by the amount of tokens to be allocated to contributors.
function calculatePrice() public view returns(uint256) { return weiContributed.add(PRESALE_WEI).div(60000000).add(1); }
function calculatePrice() public view returns(uint256) { return weiContributed.add(PRESALE_WEI).div(60000000).add(1); }
37,834
2
// mapping of accounts and their total amount on hold
mapping(address => uint256) internal accountHoldBalances; uint256 public totalSupplyOnHold;
mapping(address => uint256) internal accountHoldBalances; uint256 public totalSupplyOnHold;
35,564
84
// Validates if the receiver sent the correct amounts of funds. Validates if the receiver sent the correct amounts of funds. _instaLoanVariables struct which includes list of initial balances, final balances and fees for the respective tokens./
function validateFlashloan( FlashloanVariables memory _instaLoanVariables
function validateFlashloan( FlashloanVariables memory _instaLoanVariables
12,364
20
// UI helper fx - Returns scripts from offset as[scriptId (index in scriptAddresses[]), address as uint, state, signCount]
function getAllScripts(uint offset) external view returns(uint[4][CHUNK_SIZE] scriptsResult) { for (uint8 i = 0; i < CHUNK_SIZE && i + offset < scriptAddresses.length; i++) { address scriptAddress = scriptAddresses[i + offset]; scriptsResult[i] = [ i + offset, uint(scriptAddress), uint(scripts[scriptAddress].state), scripts[scriptAddress].signCount ]; } }
function getAllScripts(uint offset) external view returns(uint[4][CHUNK_SIZE] scriptsResult) { for (uint8 i = 0; i < CHUNK_SIZE && i + offset < scriptAddresses.length; i++) { address scriptAddress = scriptAddresses[i + offset]; scriptsResult[i] = [ i + offset, uint(scriptAddress), uint(scripts[scriptAddress].state), scripts[scriptAddress].signCount ]; } }
21,044
15
// Access modifier for Commissioner-only functionality
modifier onlyCommissioner() { require(msg.sender == commissionerAddress); _; }
modifier onlyCommissioner() { require(msg.sender == commissionerAddress); _; }
44,264
8
// ERC20Basic /
contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); }
contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); }
81,270
121
// using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply;
amount1 = liquidity.mul(balance1) / _totalSupply;
37,297
273
// Deposit a specific amount of float into a trusted strategy./strategy The trusted strategy to deposit into./underlyingAmount The amount of underlying tokens in float to deposit.
function depositIntoStrategy(Strategy strategy, uint256 underlyingAmount) external requiresAuth { // A strategy must be trusted before it can be deposited into. require(getStrategyData[strategy].trusted, "UNTRUSTED_STRATEGY"); // Increase totalStrategyHoldings to account for the deposit. totalStrategyHoldings += underlyingAmount; unchecked { // Without this the next harvest would count the deposit as profit. // Cannot overflow as the balance of one strategy can't exceed the sum of all. getStrategyData[strategy].balance += underlyingAmount.safeCastTo248(); } emit StrategyDeposit(msg.sender, strategy, underlyingAmount); // We need to deposit differently if the strategy takes ETH. if (strategy.isCEther()) { // Unwrap the right amount of WETH. WETH(payable(address(UNDERLYING))).withdraw(underlyingAmount); // Deposit into the strategy and assume it will revert on error. ETHStrategy(address(strategy)).mint{value: underlyingAmount}(); } else { // Approve underlyingAmount to the strategy so we can deposit. UNDERLYING.safeApprove(address(strategy), underlyingAmount); // Deposit into the strategy and revert if it returns an error code. require(ERC20Strategy(address(strategy)).mint(underlyingAmount) == 0, "MINT_FAILED"); } }
function depositIntoStrategy(Strategy strategy, uint256 underlyingAmount) external requiresAuth { // A strategy must be trusted before it can be deposited into. require(getStrategyData[strategy].trusted, "UNTRUSTED_STRATEGY"); // Increase totalStrategyHoldings to account for the deposit. totalStrategyHoldings += underlyingAmount; unchecked { // Without this the next harvest would count the deposit as profit. // Cannot overflow as the balance of one strategy can't exceed the sum of all. getStrategyData[strategy].balance += underlyingAmount.safeCastTo248(); } emit StrategyDeposit(msg.sender, strategy, underlyingAmount); // We need to deposit differently if the strategy takes ETH. if (strategy.isCEther()) { // Unwrap the right amount of WETH. WETH(payable(address(UNDERLYING))).withdraw(underlyingAmount); // Deposit into the strategy and assume it will revert on error. ETHStrategy(address(strategy)).mint{value: underlyingAmount}(); } else { // Approve underlyingAmount to the strategy so we can deposit. UNDERLYING.safeApprove(address(strategy), underlyingAmount); // Deposit into the strategy and revert if it returns an error code. require(ERC20Strategy(address(strategy)).mint(underlyingAmount) == 0, "MINT_FAILED"); } }
25,927
2
// the reward token address linked to this liquidity mining contract
address internal _rewardTokenAddress;
address internal _rewardTokenAddress;
35,796
30
// Transfers control of the contract to a newAdmin._newAdmin The address to transfer adminship to./
function _transferAdminship(address _newAdmin) internal { require(_newAdmin != address(0)); emit AdminshipTransferred(admin, _newAdmin); admin = _newAdmin; }
function _transferAdminship(address _newAdmin) internal { require(_newAdmin != address(0)); emit AdminshipTransferred(admin, _newAdmin); admin = _newAdmin; }
5,633
1
// check if num/loss was paid as expected bet the bet in EDG with decimals numberthe rolled number limit the limit to roll below or above rollBelow true if the player has to roll below the limit in order to winreturn the win and loss /
function determineOutcome(uint bet, uint number, uint limit, bool rollBelow) public pure returns(uint win, uint loss){ require(limit > 0 && limit <= 999); if(rollBelow && number < limit){//win win = bet*1000/limit - bet; } else if(!rollBelow && number > limit){//win win = bet*1000/(1000-limit) - bet; } else{//loss loss = bet; } }
function determineOutcome(uint bet, uint number, uint limit, bool rollBelow) public pure returns(uint win, uint loss){ require(limit > 0 && limit <= 999); if(rollBelow && number < limit){//win win = bet*1000/limit - bet; } else if(!rollBelow && number > limit){//win win = bet*1000/(1000-limit) - bet; } else{//loss loss = bet; } }
38,421
624
// Load current pool state from storage
bytes32 poolState = _poolState; startTime = poolState.decodeUint32(_START_TIME_OFFSET); endTime = poolState.decodeUint32(_END_TIME_OFFSET); uint256 totalTokens = _getTotalTokens(); endWeights = new uint256[](totalTokens); for (uint256 i = 0; i < totalTokens; i++) { endWeights[i] = poolState.decodeUint16(_END_WEIGHT_OFFSET + i * 16).uncompress16(); }
bytes32 poolState = _poolState; startTime = poolState.decodeUint32(_START_TIME_OFFSET); endTime = poolState.decodeUint32(_END_TIME_OFFSET); uint256 totalTokens = _getTotalTokens(); endWeights = new uint256[](totalTokens); for (uint256 i = 0; i < totalTokens; i++) { endWeights[i] = poolState.decodeUint16(_END_WEIGHT_OFFSET + i * 16).uncompress16(); }
5,223
193
// A transfer/transferFrom is successful when 'call' is successful and depending on the token: - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false) - A single boolean is returned: this boolean needs to be true (non-zero)
if (success) { assembly { switch returndatasize()
if (success) { assembly { switch returndatasize()
28,594
17
// Price (in wei) at end of auction
uint128 endingPrice;
uint128 endingPrice;
36,465
169
// function calculates multiplier for _units_units amount of units/
function getMultiplier(uint256 _units) public pure returns (uint256) { uint256 multiplier = BASE_MULTIPLER; // 1x if (_units >= 100) { multiplier = 150; // 1.5x } else if (_units >= 50) { multiplier = 140; // 1.4 } else if (_units >= 40) { multiplier = 135; // 1.35 } else if (_units >= 30) { multiplier = 130; // 1.3 } else if (_units >= 20) { multiplier = 125; // 1.25 } else if (_units >= 10) { multiplier = 120; // 1.20 } else if (_units >= 5) { multiplier = 115; // 1.15 } else if (_units >= 2) { multiplier = 110; // 1.10 } else if (_units >= 1) { multiplier = 105; // 1.05 } return multiplier; }
function getMultiplier(uint256 _units) public pure returns (uint256) { uint256 multiplier = BASE_MULTIPLER; // 1x if (_units >= 100) { multiplier = 150; // 1.5x } else if (_units >= 50) { multiplier = 140; // 1.4 } else if (_units >= 40) { multiplier = 135; // 1.35 } else if (_units >= 30) { multiplier = 130; // 1.3 } else if (_units >= 20) { multiplier = 125; // 1.25 } else if (_units >= 10) { multiplier = 120; // 1.20 } else if (_units >= 5) { multiplier = 115; // 1.15 } else if (_units >= 2) { multiplier = 110; // 1.10 } else if (_units >= 1) { multiplier = 105; // 1.05 } return multiplier; }
27,388
0
// @inheritdoc IERC20 /
function totalSupply() external view returns (uint256) { return _totalSupply(); }
function totalSupply() external view returns (uint256) { return _totalSupply(); }
22,319
29
// IUniswapPair pair = IUniswapPair(lpToken); address token0 = pair.token0(); address token1 = pair.token1(); (pools[i].reserve0, pools[i].reserve1,) = pair.getReserves(); pools[i].token0 = getTokenInfo(token0); pools[i].token1 = getTokenInfo(token1);
pools[i].lpToken = lpToken; if(_user != address(0)) { UserPoolInfo memory userInfo; (userInfo.totalStaked, userInfo.rewardDebt) = farm.userInfo(i, _user); userInfo.lpBalance = IERC20(lpToken).balanceOf(_user); userInfo.lpAllowance = IERC20(lpToken).allowance(_user, _farm); userInfo.pendingRewards = farm.pendingRewards(i, _user); pools[i].userInfo = userInfo;
pools[i].lpToken = lpToken; if(_user != address(0)) { UserPoolInfo memory userInfo; (userInfo.totalStaked, userInfo.rewardDebt) = farm.userInfo(i, _user); userInfo.lpBalance = IERC20(lpToken).balanceOf(_user); userInfo.lpAllowance = IERC20(lpToken).allowance(_user, _farm); userInfo.pendingRewards = farm.pendingRewards(i, _user); pools[i].userInfo = userInfo;
46,721
187
// Liquidate as much as possible to `want`, up to `_amountNeeded`
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded);
20,083
54
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to add a fee to a module_module Address of the module contract to add fee to _feeTypeType of the fee to add in the module _newFeePercentage Percentage of fee to add in the module (denominated in preciseUnits eg 1% = 1e16) /
function addFee(address _module, uint256 _feeType, uint256 _newFeePercentage) external onlyInitialized onlyOwner { require(isModule[_module], "Module does not exist"); require(fees[_module][_feeType] == 0, "Fee type already exists on module"); fees[_module][_feeType] = _newFeePercentage; emit FeeEdited(_module, _feeType, _newFeePercentage); }
function addFee(address _module, uint256 _feeType, uint256 _newFeePercentage) external onlyInitialized onlyOwner { require(isModule[_module], "Module does not exist"); require(fees[_module][_feeType] == 0, "Fee type already exists on module"); fees[_module][_feeType] = _newFeePercentage; emit FeeEdited(_module, _feeType, _newFeePercentage); }
35,137
78
// Sets the next call's msg.sender to be the input address, and the tx.origin to be the second input
function prank(address msgSender, address txOrigin) external;
function prank(address msgSender, address txOrigin) external;
30,895
1
// 1. Check if she has registered
require(oniProfile.hasRegistered(_msgSender()), "not active");
require(oniProfile.hasRegistered(_msgSender()), "not active");
41,420
49
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a delegate call. _Available since v3.3._ /
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract");
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract");
2,010
55
// gets the latest recorded price of the synth in USD return the last recorded synths price/
function getLatestPrice() public view returns (uint) { return _latestobservedprice; }
function getLatestPrice() public view returns (uint) { return _latestobservedprice; }
1,329
15
// Calculates the increase in balance since the last user interaction user The address of the user for which the interest is being accumulatedreturn The previous principal balance, the new principal balance and the balance increase /
{ uint256 previousPrincipalBalance = super.balanceOf(user); if (previousPrincipalBalance == 0) { return (0, 0, 0); } // Calculation of the accrued interest since the last accumulation uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance); return ( previousPrincipalBalance, previousPrincipalBalance.add(balanceIncrease), balanceIncrease ); }
{ uint256 previousPrincipalBalance = super.balanceOf(user); if (previousPrincipalBalance == 0) { return (0, 0, 0); } // Calculation of the accrued interest since the last accumulation uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance); return ( previousPrincipalBalance, previousPrincipalBalance.add(balanceIncrease), balanceIncrease ); }
20,001
53
// The decimals of the token.
uint256 public decimals;
uint256 public decimals;
7,131
40
// 另外记录众筹数据,以避免受转账影响
allFundingUsers.push(msg.sender); fundBalance[msg.sender]=fundBalance[msg.sender].add(amount);
allFundingUsers.push(msg.sender); fundBalance[msg.sender]=fundBalance[msg.sender].add(amount);
20,822
141
// Returns the name of the Ante Test/This overrides the auto-generated getter for testName as a public var/ return The name of the Ante Test in string format
function testName() external view returns (string memory);
function testName() external view returns (string memory);
42,705
11
// Constructor for HiT creationAssigns the totalSupply to the HiTDistribution contract/
constructor(address _polyDistributionContractAddress) { require(_polyDistributionContractAddress != address(0)); balances[_polyDistributionContractAddress] = totalSupply; emit Transfer(address(0), _polyDistributionContractAddress, totalSupply); }
constructor(address _polyDistributionContractAddress) { require(_polyDistributionContractAddress != address(0)); balances[_polyDistributionContractAddress] = totalSupply; emit Transfer(address(0), _polyDistributionContractAddress, totalSupply); }
10,771
55
// bookkeeping
map[address(pool)] = true; list.push(address(pool));
map[address(pool)] = true; list.push(address(pool));
59,753
252
// ALLOW yEarn USDC
address _yearnUSDC = 0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9; IERC20(underlying).safeApprove(_yearnUSDC, type(uint256).max); whitelist[_yearnUSDC][deposit] = ALLOWED_NO_MSG_VALUE; whitelist[_yearnUSDC][withdraw] = ALLOWED_NO_MSG_VALUE; _approveMax(underlying, _yearnUSDC); _addWhitelist(_yearnUSDC, deposit, false); _addWhitelist(_yearnUSDC, withdraw, false);
address _yearnUSDC = 0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9; IERC20(underlying).safeApprove(_yearnUSDC, type(uint256).max); whitelist[_yearnUSDC][deposit] = ALLOWED_NO_MSG_VALUE; whitelist[_yearnUSDC][withdraw] = ALLOWED_NO_MSG_VALUE; _approveMax(underlying, _yearnUSDC); _addWhitelist(_yearnUSDC, deposit, false); _addWhitelist(_yearnUSDC, withdraw, false);
69,659
21
// wbc token, ERC20 compliant
using SafeMath for uint256; string public constant name = "WEBIC Token"; //The Token's name uint8 public constant decimals = 6; //Number of decimals of the smallest unit string public constant symbol = "WEBIC"; //An identifier uint totoals=0;
using SafeMath for uint256; string public constant name = "WEBIC Token"; //The Token's name uint8 public constant decimals = 6; //Number of decimals of the smallest unit string public constant symbol = "WEBIC"; //An identifier uint totoals=0;
66,469
82
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
uint256[50] private ______gap;
826
68
// Making sure transfer is approved
require(_approved(newOwner, _assetId)); _transfer(oldOwner, newOwner, _assetId);
require(_approved(newOwner, _assetId)); _transfer(oldOwner, newOwner, _assetId);
1,563