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
155
// Set the address of the interestModel contractinterestModelAddr The address of the interestModel contract return true (TODO: validate results)/
function setInterestModel(address interestModelAddr) onlyOwner public returns (bool)
function setInterestModel(address interestModelAddr) onlyOwner public returns (bool)
13,995
66
// Stores a new address in the EIP1967 implementation slot. /
function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), 'ERC1967: new implementation is not a contract'); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; }
function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), 'ERC1967: new implementation is not a contract'); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; }
9,198
206
// Perform the transfer: if there is a problem, an exception will be thrown in this call.
return _transferFromByProxy(messageSender, from, to, value);
return _transferFromByProxy(messageSender, from, to, value);
12,636
12
// Defining a function to check and skip the code if the person is already voted else allow to vote and calculate totalvotes for team C
function temaCF(address _address) public returns(
function temaCF(address _address) public returns(
31,000
5
// Checks if a given address is the current owner of a particular planet. _claimant the address we are validating against. _tokenId planet id, only valid when > 0
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) { return planetIndexToOwner[_tokenId] == _claimant; }
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) { return planetIndexToOwner[_tokenId] == _claimant; }
14,602
33
// Remove previous adapter from allowed list and set up new one
allowedAdapters[contractToAdapter[targetContract]] = false; // T:[CF-10] allowedAdapters[adapter] = true; // T:[CF-9, 10] allowedContractsSet.add(targetContract); contractToAdapter[targetContract] = adapter; // T:[CF-9, 10] emit ContractAllowed(targetContract, adapter); // T:[C...
allowedAdapters[contractToAdapter[targetContract]] = false; // T:[CF-10] allowedAdapters[adapter] = true; // T:[CF-9, 10] allowedContractsSet.add(targetContract); contractToAdapter[targetContract] = adapter; // T:[CF-9, 10] emit ContractAllowed(targetContract, adapter); // T:[C...
72,780
162
// for network token, the return amount is identical to the target amount
if (liquidity.reserveToken == networkToken) { return (targetAmount, targetAmount, 0); }
if (liquidity.reserveToken == networkToken) { return (targetAmount, targetAmount, 0); }
14,063
2
// =============================================================================================/ State/=============================================================================================
function minter() external view returns (address);
function minter() external view returns (address);
28,560
63
// If funds already payed to the specified player by index. _playerIndex Player index. /
function isPayed(uint _playerIndex) public constant returns (bool) { address playerAddress; uint ticketAmount; uint dreamAmount; (playerAddress, ticketAmount, dreamAmount) = ticketHolder.getTickets(_playerIndex); require(playerAddress != 0); return fund.isPayed(player...
function isPayed(uint _playerIndex) public constant returns (bool) { address playerAddress; uint ticketAmount; uint dreamAmount; (playerAddress, ticketAmount, dreamAmount) = ticketHolder.getTickets(_playerIndex); require(playerAddress != 0); return fund.isPayed(player...
32,775
59
// Calculate total voting power at some point in the past/point The point (bias/slope) to start search from/t Time to calculate the total voting power at/ return Total voting power at that time
function _supply_at(Point memory point, uint t) internal view returns (uint) { Point memory last_point = point; uint t_i = (last_point.ts / WEEK) * WEEK; for (uint i = 0; i < 255; ++i) { t_i += WEEK; int128 d_slope = 0; if (t_i > t) { t_i =...
function _supply_at(Point memory point, uint t) internal view returns (uint) { Point memory last_point = point; uint t_i = (last_point.ts / WEEK) * WEEK; for (uint i = 0; i < 255; ++i) { t_i += WEEK; int128 d_slope = 0; if (t_i > t) { t_i =...
18,687
8
// Register a differed payment. _wallet The payment wallet address. _ethAmount The payment amount in ETH. /
function registerDifferPayment(address _wallet, uint256 _ethAmount) external;
function registerDifferPayment(address _wallet, uint256 _ethAmount) external;
29,914
6
// returns the index of the observation corresponding to the given timestamp
function observationIndexOf(uint256 timestamp_) public view returns (uint8 index)
function observationIndexOf(uint256 timestamp_) public view returns (uint8 index)
1,654
10
// ERC20-compatible version only, breaks ERC223 compliance but block explorers and exchanges expect ERC20. Also, cannot overload events
event Transfer( address indexed from, address indexed to, uint256 value );
event Transfer( address indexed from, address indexed to, uint256 value );
14,296
70
// Allows an owner to confirm a transaction.Overrides the function in MultiSig. transactionIdTransaction ID. /
function confirmTransaction( uint256 transactionId ) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) notFullyConfirmed(transactionId)
function confirmTransaction( uint256 transactionId ) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) notFullyConfirmed(transactionId)
4,242
30
// Deposit LP tokens to TanosiaLPT for SUSHI allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12)...
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12)...
33,117
44
// parse bytes storageRoot = 4
require(proto[index] == 0x22, "Invalid storageRoot proto tag"); index++; require(proto[index] == 0x20, "Invalid storageRoot length"); index++; // start of storageRoot bytes
require(proto[index] == 0x22, "Invalid storageRoot proto tag"); index++; require(proto[index] == 0x20, "Invalid storageRoot length"); index++; // start of storageRoot bytes
31,620
11
// Interface for ERC20 tokens
interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() ex...
interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() ex...
16,209
21
// bounty & fee related requirements
if (_bounty > 0) { if (address(crowns) == _bountyAddress) { require(crowns.balanceOf(msg.sender) >= fee + _bounty, "not enough CWS for fee & bounty"); } else {
if (_bounty > 0) { if (address(crowns) == _bountyAddress) { require(crowns.balanceOf(msg.sender) >= fee + _bounty, "not enough CWS for fee & bounty"); } else {
22,148
317
// StableMasterEvents/Angle Core Team/`StableMaster` is the contract handling all the collateral types accepted for a given stablecoin/ It does all the accounting and is the point of entry in the protocol for stable holders and seekers as well as SLPs/This file contains all the events of the `StableMaster` contract
contract StableMasterEvents { event SanRateUpdated(address indexed _token, uint256 _newSanRate); event StocksUsersUpdated(address indexed _poolManager, uint256 _stocksUsers); event MintedStablecoins(address indexed _poolManager, uint256 amount, uint256 amountForUserInStable); event BurntStablecoins(a...
contract StableMasterEvents { event SanRateUpdated(address indexed _token, uint256 _newSanRate); event StocksUsersUpdated(address indexed _poolManager, uint256 _stocksUsers); event MintedStablecoins(address indexed _poolManager, uint256 amount, uint256 amountForUserInStable); event BurntStablecoins(a...
44,282
129
// Include an address to specify the WitnetRequestBoard._wrb WitnetRequestBoard address./
constructor(address _wrb) { wrb = WitnetRequestBoardInterface(_wrb); }
constructor(address _wrb) { wrb = WitnetRequestBoardInterface(_wrb); }
47,571
133
// Checks whether schain exists. /
function isSchainExist(bytes32 schainId) external view returns (bool) { return keccak256(abi.encodePacked(schains[schainId].name)) != keccak256(abi.encodePacked("")); }
function isSchainExist(bytes32 schainId) external view returns (bool) { return keccak256(abi.encodePacked(schains[schainId].name)) != keccak256(abi.encodePacked("")); }
83,507
3,496
// 1749
entry "rollered" : ENG_ADJECTIVE
entry "rollered" : ENG_ADJECTIVE
18,361
13
// Changes the home gateway./_homeGateway The address of the new home gateway.
function changeHomeGateway(address _homeGateway) external { require(governor == msg.sender, "Access not allowed: Governor only."); homeGateway = _homeGateway; }
function changeHomeGateway(address _homeGateway) external { require(governor == msg.sender, "Access not allowed: Governor only."); homeGateway = _homeGateway; }
12,504
109
// _Available since v3.1._ /
interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,a...
interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,a...
5,144
4
// Declare storage for components list
bytes4[] public componentsList;
bytes4[] public componentsList;
17,923
100
// Safely mints `tokenId` and transfers it to `to`.Requirements:- `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
1,947
169
// Initialize v2 newName New token name /
function initializeV2(string calldata newName) external { // solhint-disable-next-line reason-string require(initialized && _initializedVersion == 0); name = newName; DOMAIN_SEPARATOR = EIP712.makeDomainSeparator(newName, "2"); _initializedVersion = 1; }
function initializeV2(string calldata newName) external { // solhint-disable-next-line reason-string require(initialized && _initializedVersion == 0); name = newName; DOMAIN_SEPARATOR = EIP712.makeDomainSeparator(newName, "2"); _initializedVersion = 1; }
39,860
19
// Mapping from STARK public key to the Ethereum public key of its owner.
mapping(uint256 => address) ethKeys; // NOLINT: uninitialized-state.
mapping(uint256 => address) ethKeys; // NOLINT: uninitialized-state.
42,089
151
// When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
MapEntry storage lastEntry = map._entries[lastIndex];
MapEntry storage lastEntry = map._entries[lastIndex];
23,003
187
// Returns whether the SetToken component external position is greater than or equal to the real units passed in. /
function hasSufficientExternalUnits( ISetToken _setToken, address _component, address _positionModule, uint256 _unit
function hasSufficientExternalUnits( ISetToken _setToken, address _component, address _positionModule, uint256 _unit
35,029
14
// ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public view returns (uint) { return _totalSupply; }
function totalSupply() public view returns (uint) { return _totalSupply; }
7,064
13
// Reverts transaction if config args are invalid
modifier checkConfigValid(uint256 numTransmitters, uint256 f) { if (numTransmitters > MAX_NUM_ORACLES) revert InvalidConfig("too many transmitters"); if (f == 0) revert InvalidConfig("f must be positive"); _; }
modifier checkConfigValid(uint256 numTransmitters, uint256 f) { if (numTransmitters > MAX_NUM_ORACLES) revert InvalidConfig("too many transmitters"); if (f == 0) revert InvalidConfig("f must be positive"); _; }
7,453
10
// 抽奖 只有管理员有权限
function luckDraw() public { require(lastUserId != 0); //确保当前盘内有人投注 require(winningLotteryNumber.length == 0); require(msg.sender == owner); //利用当前区块的时间戳、挖矿难度和盘内投注彩民数来取随机值 winningLotteryNumber.push(uint(keccak256(abi.encodePacked(block.timestamp,block.difficulty,owner,las...
function luckDraw() public { require(lastUserId != 0); //确保当前盘内有人投注 require(winningLotteryNumber.length == 0); require(msg.sender == owner); //利用当前区块的时间戳、挖矿难度和盘内投注彩民数来取随机值 winningLotteryNumber.push(uint(keccak256(abi.encodePacked(block.timestamp,block.difficulty,owner,las...
30,464
73
// key = maxIndex value Mapping of (key = ticketNumber, value = array of walletAddressOfTicketHolder)
mapping(uint256 => mapping(uint256 => address)) public participants; uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; event TicketCosts(uint256 cost); event Game(uint256 game); event GameOver(uint256 game); event Ticket(uint256 ...
mapping(uint256 => mapping(uint256 => address)) public participants; uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; event TicketCosts(uint256 cost); event Game(uint256 game); event GameOver(uint256 game); event Ticket(uint256 ...
3,178
10
// Reconstruct an Order object from the given Types.OrderParam and Types.OrderAddressSet objects.orderParam The Types.OrderParam object containing the Order data. orderAddressSet An object containing addresses common across each order.return The reconstructed Order object. /
function getOrderFromOrderParam( Types.OrderParam memory orderParam, Types.OrderAddressSet memory orderAddressSet ) private pure returns (Types.Order memory order)
function getOrderFromOrderParam( Types.OrderParam memory orderParam, Types.OrderAddressSet memory orderAddressSet ) private pure returns (Types.Order memory order)
5,682
96
// Returns the maximum capacity of the vault in terms of the vault's asset /
function cap() external view returns (uint256) { return vaultParams.cap; }
function cap() external view returns (uint256) { return vaultParams.cap; }
75,271
151
// Collects YFV tokens
IYfvRewards(rewards).getReward(); uint256 _yfv = IERC20(yfv).balanceOf(address(this)); if (_yfv > 0) { if (keepYFV > 0) {
IYfvRewards(rewards).getReward(); uint256 _yfv = IERC20(yfv).balanceOf(address(this)); if (_yfv > 0) { if (keepYFV > 0) {
67,372
59
// Wrapper around `LiquidityAmounts.getAmountsForLiquidity()`./pool Uniswap V3 pool/liquidityThe liquidity being valued/_tickLower The lower tick of the range/_tickUpper The upper tick of the range/ return amounts of token0 and token1 that corresponds to liquidity
function amountsForLiquidity( IUniswapV3Pool pool, uint128 liquidity, int24 _tickLower, int24 _tickUpper
function amountsForLiquidity( IUniswapV3Pool pool, uint128 liquidity, int24 _tickLower, int24 _tickUpper
1,283
1
// uint supply = totalSupply();
uint supply = MAX_TOKENS; for (uint i = 0; i < _reserveAmount; i++) { _safeMint(_to, supply + i); }
uint supply = MAX_TOKENS; for (uint i = 0; i < _reserveAmount; i++) { _safeMint(_to, supply + i); }
3,268
61
// Claim your winnings. betIdBet id. /
function claimFilledBet(uint256 betId) external nonReentrant { // check for valid listing // require(listings[bets[betId].listingId].isExisting, "Invalid betId"); require(bets[betId].isExisting, "Invalid betId or already claimed"); require( listings[bets[betId].listingId]...
function claimFilledBet(uint256 betId) external nonReentrant { // check for valid listing // require(listings[bets[betId].listingId].isExisting, "Invalid betId"); require(bets[betId].isExisting, "Invalid betId or already claimed"); require( listings[bets[betId].listingId]...
23,632
4
// // Minting /// Think of it as an array of 100 elements, where we takea random index, and then we want to make sure we don'tpick it again. If it hasn't been picked, the mapping points to 0, otherwiseit will point to the index which took its place
function getNextImageID(uint256 index) internal returns (uint256) { uint256 nextImageID = indexer[index]; // if it's 0, means it hasn't been picked yet if (nextImageID == 0) { nextImageID = index; } // Swap last one with the picked one. // Last one can be...
function getNextImageID(uint256 index) internal returns (uint256) { uint256 nextImageID = indexer[index]; // if it's 0, means it hasn't been picked yet if (nextImageID == 0) { nextImageID = index; } // Swap last one with the picked one. // Last one can be...
8,977
35
// use mint rather than _safeMint here to reduce gas costs
_mint(addresses[i], nextTokenId());
_mint(addresses[i], nextTokenId());
25,558
303
// Auction contract checks input sizes
require(_owns(msg.sender, _matronId)); require(isReadyToBreed(_matronId)); require(_canBreedWithViaAuction(_matronId, _sireId));
require(_owns(msg.sender, _matronId)); require(isReadyToBreed(_matronId)); require(_canBreedWithViaAuction(_matronId, _sireId));
20,936
38
// Returns video key of the specified video id/_liveId id of the live/ return video key of the specified video id
function videoKeyOf(uint256 _liveId) public view returns (string) { require(_exists(_liveId)); return lives[_liveId].videoKey; }
function videoKeyOf(uint256 _liveId) public view returns (string) { require(_exists(_liveId)); return lives[_liveId].videoKey; }
54,041
55
// Defaults
burner = msg.sender; minter = msg.sender; paused = false;
burner = msg.sender; minter = msg.sender; paused = false;
56,291
37
// Indicator that this is a CToken contract (for inspection) /
bool public constant isCToken = true;
bool public constant isCToken = true;
25,653
2
// Mapping to store addresses of players who have placed wagers
mapping(uint256 => address) public players;
mapping(uint256 => address) public players;
22,233
52
// This is the endpoint for Claiming the Stake + Rewards /
function claim() external { require(isStakingPaused == false, "Claim:: Pool is Paused"); require(isPoolActive == true, "Claim:: Pool is not active"); require(StakeHolders[msg.sender].isClaimed == false, "Claim:: Already Claimed"); require(StakeHolders[msg.sender].amount > 0, "Claim::...
function claim() external { require(isStakingPaused == false, "Claim:: Pool is Paused"); require(isPoolActive == true, "Claim:: Pool is not active"); require(StakeHolders[msg.sender].isClaimed == false, "Claim:: Already Claimed"); require(StakeHolders[msg.sender].amount > 0, "Claim::...
18,295
6
// Owner calls to set RUNE
function setRune(address _rune) public onlyOwner { RUNE = _rune; }
function setRune(address _rune) public onlyOwner { RUNE = _rune; }
10,114
7
// disables borrowing on a reserve_reserve the address of the reserve/
function disableBorrowingOnReserve(address _reserve) external onlyLendingPoolManager { LendingPoolCore core = LendingPoolCore(poolAddressesProvider.getLendingPoolCore()); core.disableBorrowingOnReserve(_reserve); emit BorrowingDisabledOnReserve(_reserve); }
function disableBorrowingOnReserve(address _reserve) external onlyLendingPoolManager { LendingPoolCore core = LendingPoolCore(poolAddressesProvider.getLendingPoolCore()); core.disableBorrowingOnReserve(_reserve); emit BorrowingDisabledOnReserve(_reserve); }
30,894
65
// Constructor function sets the Lunyr Multisig address and/ total number of locked tokens to transfer
function LUNVault(address _lunyrMultisig) internal { if (_lunyrMultisig == 0x0) throw; lunyrToken = LunyrToken(msg.sender); lunyrMultisig = _lunyrMultisig; isLUNVault = true; unlockedAtBlockNumber = safeAdd(block.number, numBlocksLocked); // 180 days of blocks later }
function LUNVault(address _lunyrMultisig) internal { if (_lunyrMultisig == 0x0) throw; lunyrToken = LunyrToken(msg.sender); lunyrMultisig = _lunyrMultisig; isLUNVault = true; unlockedAtBlockNumber = safeAdd(block.number, numBlocksLocked); // 180 days of blocks later }
40,873
354
// bool statusNft;
bool statusNft = _nftInfo[nftIndex].valid;
bool statusNft = _nftInfo[nftIndex].valid;
26,556
2
// 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2; MAINNET ETH0xc778417E063141139Fce010982780140Aa0cD5Ab; RINKEBY ETH
uniSymbol = "UNI-V2";
uniSymbol = "UNI-V2";
44,413
13
// amount of maha rewarded per epoch.
uint256 contractionRewardPerEpoch;
uint256 contractionRewardPerEpoch;
10,064
8
// Sets the address of the sortedOracles contract. _sortedOracles The new address of the sorted oracles contract. /
function setSortedOracles(ISortedOracles _sortedOracles) public onlyOwner { require(address(_sortedOracles) != address(0), "SortedOracles address must be set"); sortedOracles = _sortedOracles; emit SortedOraclesUpdated(address(_sortedOracles)); }
function setSortedOracles(ISortedOracles _sortedOracles) public onlyOwner { require(address(_sortedOracles) != address(0), "SortedOracles address must be set"); sortedOracles = _sortedOracles; emit SortedOraclesUpdated(address(_sortedOracles)); }
25,801
48
// Unstake the token ids _tokenIds uint[] /
function unstake(uint256[] calldata _tokenIds) external { if (_tokenIds.length == 0) revert ZeroStakeError(); for (uint256 i; i < _tokenIds.length; ) { uint256 tokenId = _tokenIds[i]; if (ownerOf(tokenId) != _msgSender()) revert NotTokenOwnerError(); uint256 stak...
function unstake(uint256[] calldata _tokenIds) external { if (_tokenIds.length == 0) revert ZeroStakeError(); for (uint256 i; i < _tokenIds.length; ) { uint256 tokenId = _tokenIds[i]; if (ownerOf(tokenId) != _msgSender()) revert NotTokenOwnerError(); uint256 stak...
21,079
11
// Unwrap tokens, withdraw from TopDog and send them to user only user or CDPManager could call this method /
function withdraw(address _user, uint256 _amount) public override nonReentrant { require(_amount > 0, "Unit Protocol Wrapped Assets: INVALID_AMOUNT"); require(msg.sender == _user || vaultParameters.canModifyVault(msg.sender), "Unit Protocol Wrapped Assets: AUTH_FAILED"); IERC20 sslpToken = ...
function withdraw(address _user, uint256 _amount) public override nonReentrant { require(_amount > 0, "Unit Protocol Wrapped Assets: INVALID_AMOUNT"); require(msg.sender == _user || vaultParameters.canModifyVault(msg.sender), "Unit Protocol Wrapped Assets: AUTH_FAILED"); IERC20 sslpToken = ...
29,436
20
// Minimum investable amount in USD
uint256 public minimumInvestmentUSD;
uint256 public minimumInvestmentUSD;
33,024
738
// If any of above checks failed, revert the execution (if ETH was sent, it is returned to the sender)
revert(0, 0)
revert(0, 0)
5,933
136
// Get the maximum allowed amount to borrow of the user from the given handleruserAddr The address of the usercallerID The target handler to borrow return extraCollateralAmount The maximum allowed amount to borrow from/
function getUserCollateralizableAmount(address payable userAddr, uint256 callerID) external view override returns (uint256)
function getUserCollateralizableAmount(address payable userAddr, uint256 callerID) external view override returns (uint256)
65,500
27
// this event is emitted when the Agent has been removed from the agent list of this Compliance.the event is emitted by the Compliance constructor and by the removeTokenAgent function`_agentAddress` is the address of the Agent to remove/
event TokenAgentRemoved(address _agentAddress);
event TokenAgentRemoved(address _agentAddress);
19,608
12
// See {NFTYieldedToken._spendFrom} /
function spendFrom( address account, uint256 tokenId, uint256 amount, uint256 serviceId, bytes calldata data ) public { _spendFrom(account, tokenId, amount); emit TokenSpent(account, amount, serviceId, data);
function spendFrom( address account, uint256 tokenId, uint256 amount, uint256 serviceId, bytes calldata data ) public { _spendFrom(account, tokenId, amount); emit TokenSpent(account, amount, serviceId, data);
49,746
11
// index of decimal place (0 if no decimal)
uint8 decimalIndex;
uint8 decimalIndex;
6,869
38
// Previous nonce must have been invalidated by the oracle. However, if the proposal was internally invalidated, it should not be possible to ask it again.
bytes32 currentQuestionId = questionIds[questionHash]; require(currentQuestionId != INVALIDATED, "This proposal has been marked as invalid"); require(oracle.resultFor(currentQuestionId) == INVALIDATED, "Previous proposal was not invalidated");
bytes32 currentQuestionId = questionIds[questionHash]; require(currentQuestionId != INVALIDATED, "This proposal has been marked as invalid"); require(oracle.resultFor(currentQuestionId) == INVALIDATED, "Previous proposal was not invalidated");
44,866
55
// creates the token to be sold. override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) { return new MintableToken(); }
function createTokenContract() internal returns (MintableToken) { return new MintableToken(); }
13,105
58
// Total number of Rei (XBETtokenMultiplier) that will be auctioned
uint public tokensAuctioned;
uint public tokensAuctioned;
4,282
0
// @inheritdoc IDiamondOwnerFacet
function diamondOwner() view external returns(address) { return LibDiamond.contractOwner(); }
function diamondOwner() view external returns(address) { return LibDiamond.contractOwner(); }
15,164
55
// Execute spin.
function _spinTokens(TKN _tkn, uint divRate) private betIsValid(_tkn.value, divRate)
function _spinTokens(TKN _tkn, uint divRate) private betIsValid(_tkn.value, divRate)
28,972
61
// The timestamp of the block when the current floor is generated.
uint32 floorCreationTime;
uint32 floorCreationTime;
77,017
325
// Completes a scheduled withdrawal from a past round. Uses finalized pps for the roundreturn amountETHOut the current withdrawal amount /
function _completeWithdraw(uint256) internal returns (uint256) { Vault.Withdrawal storage withdrawal = withdrawals[msg.sender]; uint256 withdrawalShares = withdrawal.shares; uint256 withdrawalRound = withdrawal.round; // This checks if there is a withdrawal require(withdraw...
function _completeWithdraw(uint256) internal returns (uint256) { Vault.Withdrawal storage withdrawal = withdrawals[msg.sender]; uint256 withdrawalShares = withdrawal.shares; uint256 withdrawalRound = withdrawal.round; // This checks if there is a withdrawal require(withdraw...
71,216
4
// mint 20% to deployer and the rest to the contract
friendrCoin = new FriendrCoin( "FriendrCOIN", "FRIEND", twentyMillion, eightyMillion, owner(), address(this) ); profileCount = 0; // Init to 0 publicMessageCount = 0; // Init to 0
friendrCoin = new FriendrCoin( "FriendrCOIN", "FRIEND", twentyMillion, eightyMillion, owner(), address(this) ); profileCount = 0; // Init to 0 publicMessageCount = 0; // Init to 0
29,165
114
// get ris3 toten address
function getRis3Address() public view returns (address _ris3Address) { return address(ris3); }
function getRis3Address() public view returns (address _ris3Address) { return address(ris3); }
12,793
255
// internal owner
_beforeTokenTransfer(owner, address(0), tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
7,691
299
// Token added to Franklin net
event NewToken( address indexed token, uint16 indexed tokenId );
event NewToken( address indexed token, uint16 indexed tokenId );
29,830
11
// Transfers all tokens to multisig wallet
function walletWithdraw() public isWallet
function walletWithdraw() public isWallet
7,547
20
// Checking if msg.sender are the same as the owner or handler.
modifier onlyHandler() { if (msg.sender != owner() && msg.sender != _handler) { revert NotAllowedHandler(); } _; }
modifier onlyHandler() { if (msg.sender != owner() && msg.sender != _handler) { revert NotAllowedHandler(); } _; }
26,162
38
// Sets the STS_ETH Uniswap oracle address
function setSTSEthOracle(address _sts_oracle_addr, address _weth_address) public onlyByOwnerOrGovernance { sts_eth_oracle_address = _sts_oracle_addr; stsEthOracle = UniswapPairOracle(_sts_oracle_addr); weth_address = _weth_address; }
function setSTSEthOracle(address _sts_oracle_addr, address _weth_address) public onlyByOwnerOrGovernance { sts_eth_oracle_address = _sts_oracle_addr; stsEthOracle = UniswapPairOracle(_sts_oracle_addr); weth_address = _weth_address; }
12,896
45
// Move the contract out of the Redeeming state
isRedeeming = false;
isRedeeming = false;
41,258
124
// ReportStatus("Request incorrect.");
return false;
return false;
1,599
39
// Calculate MOMA accrued by a borrower Borrowers will not begin to accrue until after the first interaction with the protocol To avoid revert: marketBorrowIndex > 0 pool The pool in which the borrower is interacting mToken The market in which the borrower is interacting borrower The address of the borrower to distribu...
function newBorrowerMomaInternal(address pool, MToken mToken, address borrower, uint marketBorrowIndex, Double memory borrowIndex) internal view returns (uint, uint) { Double memory borrowerIndex = Double({mantissa: marketStates[pool][address(mToken)].borrowerIndex[borrower]}); uint _borrowerAccrued...
function newBorrowerMomaInternal(address pool, MToken mToken, address borrower, uint marketBorrowIndex, Double memory borrowIndex) internal view returns (uint, uint) { Double memory borrowerIndex = Double({mantissa: marketStates[pool][address(mToken)].borrowerIndex[borrower]}); uint _borrowerAccrued...
31,179
81
// The user's streams balance at the given timestamp./userId The user ID./assetId The used asset ID/currReceivers The current streams receivers list./ It must be exactly the same as the last list set for the user with `_setStreams`./timestamp The timestamps for which balance should be calculated./ It can't be lower tha...
function _balanceAt( uint256 userId, uint256 assetId, StreamReceiver[] memory currReceivers, uint32 timestamp
function _balanceAt( uint256 userId, uint256 assetId, StreamReceiver[] memory currReceivers, uint32 timestamp
22,939
97
// ID for the NFT (ERC721 token ID)
uint256 nftId;
uint256 nftId;
83,610
171
// Set the amount of STRK distributed per block strikeRate_ The amount of STRK wei per block to distribute /
function _setStrikeRate(uint strikeRate_) public { require(adminOrInitializing(), "only admin can change strike rate"); uint oldRate = strikeRate; strikeRate = strikeRate_; emit NewStrikeRate(oldRate, strikeRate_); // refreshStrikeSpeedsInternal(); }
function _setStrikeRate(uint strikeRate_) public { require(adminOrInitializing(), "only admin can change strike rate"); uint oldRate = strikeRate; strikeRate = strikeRate_; emit NewStrikeRate(oldRate, strikeRate_); // refreshStrikeSpeedsInternal(); }
48,529
32
// Check target address is service/_address target address/ return `true` when an address is a service, `false` otherwise
function isService(address _address) public view returns (bool);
function isService(address _address) public view returns (bool);
12,807
9
// Getter for the amount of `token` tokens already released to a payee. `token` should be the address of anIERC20 contract. /
function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; }
function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; }
969
6
// ---------------------------------------------------------------------------- Safe Math Library----------------------------------------------------------------------------
contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) internal pure ret...
contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) internal pure ret...
9,349
63
// 匯率 1白金:白金幣
uint256 public rate = 10;
uint256 public rate = 10;
42,830
81
// Liquidate as many assets as possible to `want`, irregardless of slippage,up to `_amount`. Any excess should be re-invested here as well. /
function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _amountFreed, uint256 _loss) { uint256 _balance = want.balanceOf(address(this)); uint256 assets = netBalanceLent().add(_balance); uint256 debtOutstanding = vault.debtOutstanding(); if(debtOutstandi...
function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _amountFreed, uint256 _loss) { uint256 _balance = want.balanceOf(address(this)); uint256 assets = netBalanceLent().add(_balance); uint256 debtOutstanding = vault.debtOutstanding(); if(debtOutstandi...
45,933
16
// this completes the random word request and retrieves the andom word
function fulfill(bytes32 _requestId, bytes32 _word) public recordChainlinkFulfillment(_requestId) { tokenIdToRandomWord[tokenCounter - 1] = (bytes32ToString(_word)); }
function fulfill(bytes32 _requestId, bytes32 _word) public recordChainlinkFulfillment(_requestId) { tokenIdToRandomWord[tokenCounter - 1] = (bytes32ToString(_word)); }
50,365
92
// swap out the flywheel booster contract
function setBooster(IFlywheelBooster newBooster) external requiresAuth { flywheelBooster = newBooster; emit FlywheelBoosterUpdate(address(newBooster)); }
function setBooster(IFlywheelBooster newBooster) external requiresAuth { flywheelBooster = newBooster; emit FlywheelBoosterUpdate(address(newBooster)); }
35,044
89
// nexusque/Pause contract to help stop transactions.
abstract contract Pauseable is Ownable { bool public paused = false; /** * @dev pause or resume the pledge function and the claim function * @param _state true means paused */ function pause(bool _state) external onlyOwner { paused = _state; } }
abstract contract Pauseable is Ownable { bool public paused = false; /** * @dev pause or resume the pledge function and the claim function * @param _state true means paused */ function pause(bool _state) external onlyOwner { paused = _state; } }
62,173
115
// step functions
int[] memory zeroArr = new int[](1); zeroArr[0] = 0; conversionRates.setQtyStepFunction(token, zeroArr, zeroArr, zeroArr, zeroArr); conversionRates.setImbalanceStepFunction(token, zeroArr, zeroArr, zeroArr, zeroArr); conversionRates.enableTokenTrade(token);
int[] memory zeroArr = new int[](1); zeroArr[0] = 0; conversionRates.setQtyStepFunction(token, zeroArr, zeroArr, zeroArr, zeroArr); conversionRates.setImbalanceStepFunction(token, zeroArr, zeroArr, zeroArr, zeroArr); conversionRates.enableTokenTrade(token);
78,302
160
// first return funded tokens
_burn(msg.sender, _fundTokenAmount); uint256 assetCount = supportedAssets.length; if(_forfeitSuspendedSynths){ ISystemStatus status = ISystemStatus(addressResolver.getAddress(_SYSTEM_STATUS_KEY)); for (uint256 i = 0; i < assetCount; i++) { try status.req...
_burn(msg.sender, _fundTokenAmount); uint256 assetCount = supportedAssets.length; if(_forfeitSuspendedSynths){ ISystemStatus status = ISystemStatus(addressResolver.getAddress(_SYSTEM_STATUS_KEY)); for (uint256 i = 0; i < assetCount; i++) { try status.req...
42,178
154
// Emitted when fee configuration changes/feeTo Recipient of government fees/governmentFeeBps Fee amount, in basis points,/ to be collected out of the fee charged for a pool swap
event FeeConfigurationUpdated(address feeTo, uint16 governmentFeeBps);
event FeeConfigurationUpdated(address feeTo, uint16 governmentFeeBps);
4,132
15
// callback from oracle
function swapCallback(bytes32 _requestId, uint256 _value) public payable recordChainlinkFulfillment(_requestId)
function swapCallback(bytes32 _requestId, uint256 _value) public payable recordChainlinkFulfillment(_requestId)
11,805
16
// require that this mint request is fulfillable
require( numMintRequests + mintQuantity + packForSale.mintedCount <= packForSale.capacity || packForSale.capacity == 0, "cant service req" ); numRandomExpansionPurchases += 1; _packIdToOutstandingMintRequestsV2[sale.tokenContract][sale.packId] = n...
require( numMintRequests + mintQuantity + packForSale.mintedCount <= packForSale.capacity || packForSale.capacity == 0, "cant service req" ); numRandomExpansionPurchases += 1; _packIdToOutstandingMintRequestsV2[sale.tokenContract][sale.packId] = n...
36,018
95
// Only when depositing via a non-contract will this be called
if(now.sub(lastTradeTime) > secondsInDay){ checkAndSwapTokens(true); }
if(now.sub(lastTradeTime) > secondsInDay){ checkAndSwapTokens(true); }
12,457
2
// bytes4 hash of the transfer selector
bytes4 private constant _TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)"))); address private immutable _stakingProxy; address private immutable _aSelfCustody;
bytes4 private constant _TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)"))); address private immutable _stakingProxy; address private immutable _aSelfCustody;
26,836
2
// responsibility of instance operators
ObjectType public constant INSTANCE = ObjectType.wrap(20); ObjectType public constant PRODUCT = ObjectType.wrap(21); ObjectType public constant ORACLE = ObjectType.wrap(22); ObjectType public constant RISKPOOL = ObjectType.wrap(23);
ObjectType public constant INSTANCE = ObjectType.wrap(20); ObjectType public constant PRODUCT = ObjectType.wrap(21); ObjectType public constant ORACLE = ObjectType.wrap(22); ObjectType public constant RISKPOOL = ObjectType.wrap(23);
36,494
343
// Returns the downcasted int240 from int256, reverting onoverflow (when the input is less than smallest int240 orgreater than largest int240). Counterpart to Solidity's `int240` operator. Requirements: - input must fit into 240 bits _Available since v4.7._ /
function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(value); }
function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(value); }
7,555