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
116
// sell reward token to token2 we can accept 1 as minimum because this is called only by a trusted role
if (uniswapRoutes[uniLPComponentToken1].length > 1) {
if (uniswapRoutes[uniLPComponentToken1].length > 1) {
28,716
34
// update message status as processed
messages[_messageHash] = MessageStatus.Processed;
messages[_messageHash] = MessageStatus.Processed;
51,326
43
// erc20 -> USDC -> jEur to this wallet
mintParams.recipient = address(this); (, , uint256 synthMinted) = atomicSwap.swapExactTokensAndMint( amountTokensIn, collateralAmountOutMin, tokenSwapPath, synthereumPool, mintParams );
mintParams.recipient = address(this); (, , uint256 synthMinted) = atomicSwap.swapExactTokensAndMint( amountTokensIn, collateralAmountOutMin, tokenSwapPath, synthereumPool, mintParams );
7,734
0
// Get Methods /
function getAddress(bytes32 key) public view returns (address) { return _addressStorage[msg.sender][key]; }
function getAddress(bytes32 key) public view returns (address) { return _addressStorage[msg.sender][key]; }
11,628
14
// We need the last 4 transactions but want to use push on the array which fixed size ones don't have
lastTransactions.push(Transaction(now, price));
lastTransactions.push(Transaction(now, price));
33,035
113
// check if there is enough tokens
uint256 balance = recurly.balanceOf(address(this)); require(balance >= item.value);
uint256 balance = recurly.balanceOf(address(this)); require(balance >= item.value);
24,521
44
// Reverts if a delegatecall has failed
error DELEGATE_CALL_FAILED();
error DELEGATE_CALL_FAILED();
17,913
49
// Get a reference to the new used overflow allowance.
uint256 _newUsedOverflowAllowanceOf = usedOverflowAllowanceOf[_projectId][ fundingCycle.configuration ] + _amount;
uint256 _newUsedOverflowAllowanceOf = usedOverflowAllowanceOf[_projectId][ fundingCycle.configuration ] + _amount;
9,497
17
// Chainlink off-chain request callback function to fulfil the request for bytes response requestId - The unique id of the request for which the function is triggered data - The response data received for the query errorMessage - The error message received for the query /
function queryResponseBytes(
function queryResponseBytes(
5,624
130
// 10% Ref
citizenContract.pushRefIncome.value(toRefAmount)(_sender);
citizenContract.pushRefIncome.value(toRefAmount)(_sender);
19,039
24
// Guard against someone accidentally calling redeem before any reserve has been returned.
require(_currentReserveBalance > 0, "RESERVE_BALANCE"); uint256 reserveAmount_ = units_ .mul(_currentReserveBalance) .div(_supplyBeforeBurn); emit Redeem( msg.sender, [units_, reserveAmount_] ); reserve.safeTransfer( msg.sender,
require(_currentReserveBalance > 0, "RESERVE_BALANCE"); uint256 reserveAmount_ = units_ .mul(_currentReserveBalance) .div(_supplyBeforeBurn); emit Redeem( msg.sender, [units_, reserveAmount_] ); reserve.safeTransfer( msg.sender,
33,477
48
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) { return weiAmount.mul(rate); }
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) { return weiAmount.mul(rate); }
29,986
10
// Calculates a rectangle's surface and perimeter. return uint Length of holder's account./
function countHolders() view public returns(uint) { return holderAccts.length; }
function countHolders() view public returns(uint) { return holderAccts.length; }
41,964
23
// This is a non-standard ERC-20
success := not(0) // set success to true
success := not(0) // set success to true
37,896
30
// Transfers the ownership of an NFT from one address to another address /This works identically to the other function with an extra data parameter, /except this function just sets data to "" /_from The current owner of the NFT /_to The new owner /_tokenId The NFT to transfer
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
26,343
55
// update state
weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds();
weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds();
1,266
53
// Calculates partial value given a numerator and denominator, rounded up. numeratorNumeratordenominatorDenominatortarget Value to calculate partial ofreturnRounded-up result of targetnumerator / denominator /
function getPartialAmountRoundedUp( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256)
function getPartialAmountRoundedUp( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256)
58,601
10
// This function can be called with no datato deposit an amount of ETH to the caller's balance on L2.Since the receive function doesn't take data, a conservativedefault amount is forwarded to L2. /
// receive() external payable onlyEOA { // _initiateETHDeposit(msg.sender, msg.sender, 200_000, bytes("")); // }
// receive() external payable onlyEOA { // _initiateETHDeposit(msg.sender, msg.sender, 200_000, bytes("")); // }
19,629
219
// Approveand migrate the assets.
address assetAddr = INFTXVault(v2Vault).assetAddress(); uint256[] memory ids = new uint256[](count); uint256[] memory amounts = new uint256[](count); for (uint256 i = 0; i < count; i++) { uint256 tokenId = store.holdingsAt(v1VaultId, i); ids[i] = tokenId; amounts[i] = 1; approveERC721(assetAddr, v2Vault, tokenId); }
address assetAddr = INFTXVault(v2Vault).assetAddress(); uint256[] memory ids = new uint256[](count); uint256[] memory amounts = new uint256[](count); for (uint256 i = 0; i < count; i++) { uint256 tokenId = store.holdingsAt(v1VaultId, i); ids[i] = tokenId; amounts[i] = 1; approveERC721(assetAddr, v2Vault, tokenId); }
77,458
28
// Increment highest id in game. This will be the id of the new item
ids++; uint id = ids;
ids++; uint id = ids;
18,124
180
// Return the S1 Citizen.
_assetTransferFrom(S1_CITIZEN, address(this), msg.sender, citizenId);
_assetTransferFrom(S1_CITIZEN, address(this), msg.sender, citizenId);
42,942
7
// uint256 public investreturns;
bool public isActive; //check if we are seling or not
bool public isActive; //check if we are seling or not
54,174
1
// Allows EOAs to bridge ETH by sending directly to the bridge. /
receive() external payable override onlyEOA {
receive() external payable override onlyEOA {
43,651
0
// RewardsDistributor Compound /
interface RewardsDistributor { /// @dev The token to reward (i.e., COMP) function rewardToken() external view returns (address); /// @notice The portion of compRate that each market currently receives function compSupplySpeeds(address) external view returns (uint256); /// @notice The portion of compRate that each market currently receives function compBorrowSpeeds(address) external view returns (uint256); /// @notice The COMP accrued but not yet transferred to each user function compAccrued(address) external view returns (uint256); /** * @notice Keeps the flywheel moving pre-mint and pre-redeem * @dev Called by the Comptroller * @param cToken The relevant market * @param supplier The minter/redeemer */ function flywheelPreSupplierAction(address cToken, address supplier) external; /** * @notice Keeps the flywheel moving pre-borrow and pre-repay * @dev Called by the Comptroller * @param cToken The relevant market * @param borrower The borrower */ function flywheelPreBorrowerAction(address cToken, address borrower) external; /** * @notice Returns an array of all markets. */ function getAllMarkets() external view returns (CToken[] memory); }
interface RewardsDistributor { /// @dev The token to reward (i.e., COMP) function rewardToken() external view returns (address); /// @notice The portion of compRate that each market currently receives function compSupplySpeeds(address) external view returns (uint256); /// @notice The portion of compRate that each market currently receives function compBorrowSpeeds(address) external view returns (uint256); /// @notice The COMP accrued but not yet transferred to each user function compAccrued(address) external view returns (uint256); /** * @notice Keeps the flywheel moving pre-mint and pre-redeem * @dev Called by the Comptroller * @param cToken The relevant market * @param supplier The minter/redeemer */ function flywheelPreSupplierAction(address cToken, address supplier) external; /** * @notice Keeps the flywheel moving pre-borrow and pre-repay * @dev Called by the Comptroller * @param cToken The relevant market * @param borrower The borrower */ function flywheelPreBorrowerAction(address cToken, address borrower) external; /** * @notice Returns an array of all markets. */ function getAllMarkets() external view returns (CToken[] memory); }
22,318
117
// _addUsedTx updates txid list which is spent. (single hash)/_txid The array of txid.
function _addUsedTx(bytes32 _txid) internal { used[_txid] = true; }
function _addUsedTx(bytes32 _txid) internal { used[_txid] = true; }
2,165
13
// Calculates the amount of ether that has already vested. Default implementation is a linear vesting curve. /
function vestedAmount(uint64 timestamp) public view virtual returns (uint256) { return _vestingSchedule(address(this).balance + released(), timestamp); }
function vestedAmount(uint64 timestamp) public view virtual returns (uint256) { return _vestingSchedule(address(this).balance + released(), timestamp); }
37,412
531
// updates the state of the user being liquidated as a consequence of a liquidation action._reserve the address of the principal reserve that is being repaid_user the address of the borrower_amountToLiquidate the amount being repaid by the liquidator_feeLiquidated the amount of origination fee being liquidated_balanceIncrease the accrued interest on the borrowed amount/
) internal { CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; CoreLibrary.ReserveData storage reserve = reserves[_reserve]; //first increase by the compounded interest, then decrease by the liquidated amount user.principalBorrowBalance = user.principalBorrowBalance.add(_balanceIncrease).sub( _amountToLiquidate ); if ( getUserCurrentBorrowRateMode(_reserve, _user) == CoreLibrary.InterestRateMode.VARIABLE ) { user.lastVariableBorrowCumulativeIndex = reserve.lastVariableBorrowCumulativeIndex; } if(_feeLiquidated > 0){ user.originationFee = user.originationFee.sub(_feeLiquidated); } //solium-disable-next-line user.lastUpdateTimestamp = uint40(block.timestamp); }
) internal { CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; CoreLibrary.ReserveData storage reserve = reserves[_reserve]; //first increase by the compounded interest, then decrease by the liquidated amount user.principalBorrowBalance = user.principalBorrowBalance.add(_balanceIncrease).sub( _amountToLiquidate ); if ( getUserCurrentBorrowRateMode(_reserve, _user) == CoreLibrary.InterestRateMode.VARIABLE ) { user.lastVariableBorrowCumulativeIndex = reserve.lastVariableBorrowCumulativeIndex; } if(_feeLiquidated > 0){ user.originationFee = user.originationFee.sub(_feeLiquidated); } //solium-disable-next-line user.lastUpdateTimestamp = uint40(block.timestamp); }
18,801
83
// Perform implementation upgrade with additional setup call.
* Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } }
* Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } }
4,515
36
// Freeze the account at the target address /target The address of the account to be frozen
function freezeAccount(address target, bool freeze) onlyOwner { require(freeze); //Check if account has to be freezed frozenAccount[target] = freeze; //Freeze the account FrozenFunds(target, freeze); }
function freezeAccount(address target, bool freeze) onlyOwner { require(freeze); //Check if account has to be freezed frozenAccount[target] = freeze; //Freeze the account FrozenFunds(target, freeze); }
2,817
130
// how many nifties this contract is sellingused for metadat retrieval
uint public numNiftiesCurrentlyInContract;
uint public numNiftiesCurrentlyInContract;
50,151
3
// One time use: staking rewards
require(totalSupply() == 0, "No more mints"); _mint(msg.sender, totalSupply());
require(totalSupply() == 0, "No more mints"); _mint(msg.sender, totalSupply());
36,020
9
// Used when the operator filter registry external call fails/Used for bubbling error up to clients.
error RemoteOperatorFilterRegistryCallFailed();
error RemoteOperatorFilterRegistryCallFailed();
10,236
4
// Sets new User for the 4907 token
IERC4907(address(token)).setUser(_item, newUser, uint64((_expiration * 1 minutes) + block.timestamp)); uint256 id = _item; erc721Items[id] = ERC721Item({ marketplace: msg.sender, seller: tokenOwner, user: newUser, item: _item, expiration: block.timestamp + (_expiration * 1 minutes) });
IERC4907(address(token)).setUser(_item, newUser, uint64((_expiration * 1 minutes) + block.timestamp)); uint256 id = _item; erc721Items[id] = ERC721Item({ marketplace: msg.sender, seller: tokenOwner, user: newUser, item: _item, expiration: block.timestamp + (_expiration * 1 minutes) });
2,212
210
// Checks that these Kydys are a valid couple.
require(_isValidCouple( yin, _yinId, yang, _yangId ));
require(_isValidCouple( yin, _yinId, yang, _yangId ));
17,381
61
// See {IERC777-operatorSend}. Emits {Sent} and {IERC20-Transfer} events. /
function operatorSend( address sender, address recipient, uint256 amount, bytes memory data, bytes memory operatorData ) public virtual override
function operatorSend( address sender, address recipient, uint256 amount, bytes memory data, bytes memory operatorData ) public virtual override
21,622
62
// Company addresses
address public TeamAndAdvisors; address public Investors; uint256 timeBonus1 = 20; uint256 timeBonus2 = 10;
address public TeamAndAdvisors; address public Investors; uint256 timeBonus1 = 20; uint256 timeBonus2 = 10;
10,448
194
// A 2-person game starts the countdown.
if(_t.status==2){ _t.endTime=add(_now,gameConfig_.countdown);
if(_t.status==2){ _t.endTime=add(_now,gameConfig_.countdown);
52,421
17
// ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; }
function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; }
1,575
65
// namehash('addr.reverse')
bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; EnsRegistry public ens; EnsResolver public defaultResolver;
bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; EnsRegistry public ens; EnsResolver public defaultResolver;
1,073
0
// Emitted when a fine is paid._challenger The address of the challenger to pay the fines to._voucher The address of the penalized voucher that pays the fine._disputeID The ID of the related dispute that was ruled in favor of the challenger._value The amount paid. /
event FinePaid(address indexed _challenger, address indexed _voucher, uint indexed _disputeID, uint _value);
event FinePaid(address indexed _challenger, address indexed _voucher, uint indexed _disputeID, uint _value);
26,031
29
// price & timestamp are integers, currency as a string will follow behind
for (uint i = 0; i < len || index < 2;) { uint c = getCharAt(bytesString, i);
for (uint i = 0; i < len || index < 2;) { uint c = getCharAt(bytesString, i);
23,851
24
// Subtract from the sender
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_from] = balanceOf[_from].sub(_value);
42,889
2
// Public Methods
function testStateOrdering() public
function testStateOrdering() public
28,324
380
// ============ External Functions============/ Send the message to the destination domain and recipient Increment nonce, format the message, and emit `MessageSent` event with message information. destinationDomain Domain of destination chain recipient Address of message recipient on destination chain as bytes32 messageBody Raw bytes content of messagereturn nonce reserved by message /
function sendMessage( uint32 destinationDomain, bytes32 recipient, bytes calldata messageBody
function sendMessage( uint32 destinationDomain, bytes32 recipient, bytes calldata messageBody
2,118
3
// Total number of tokens in circulation
uint256 public totalSupply;
uint256 public totalSupply;
12,222
311
// Miner take according proportion which set
mined = tmp;
mined = tmp;
12,676
33
// function that is called when transaction target is an address
function transferToAddress(address _to, uint256 _value, bytes _data) private returns (bool success) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = safeSub(balanceOf(msg.sender), _value); balances[_to] = safeAdd(balanceOf(_to), _value); emit Transfer(msg.sender, _to, _value, _data); return true; }
function transferToAddress(address _to, uint256 _value, bytes _data) private returns (bool success) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = safeSub(balanceOf(msg.sender), _value); balances[_to] = safeAdd(balanceOf(_to), _value); emit Transfer(msg.sender, _to, _value, _data); return true; }
30,165
2
// Initializes the contract in unpaused state. /
constructor() { _paused = false; }
constructor() { _paused = false; }
10,693
22
// 设置联系信息
function commun(uint256 id, string calldata data) public { message[msg.sender][id] = data; }
function commun(uint256 id, string calldata data) public { message[msg.sender][id] = data; }
2,270
311
// Returns the URI for a particular butterfly gene -- useful for seeing the butterfly "as it was"when it dropped a heartgene uint64 isAlive boolreturn string /
function getButterflyURIFromGene(uint64 gene, bool isAlive) public view returns (string) { return GameDataLib.getButterflyURIFromGene(data, gene, isAlive); }
function getButterflyURIFromGene(uint64 gene, bool isAlive) public view returns (string) { return GameDataLib.getButterflyURIFromGene(data, gene, isAlive); }
32,109
18
// ========== PRIVATE FUNCTIONS ========== // Allows the risk score of a strategy to be set (internal)
* Emits a {RiskAssessed} event indicating the assessor of the score and the * newly set risk score of the strategy * * Requirements: * * - the risk score must be less than 100 * * @param strategy strategy to set risk score for * @param riskScore risk score to set on the strategy */ function _setRisk(address strategy, uint8 riskScore) private { require(riskScore <= MAX_RISK_SCORE, "RiskProviderRegistry::_setRisk: Risk score too big"); _risk[msg.sender][strategy] = riskScore; emit RiskAssessed(msg.sender, strategy, riskScore); }
* Emits a {RiskAssessed} event indicating the assessor of the score and the * newly set risk score of the strategy * * Requirements: * * - the risk score must be less than 100 * * @param strategy strategy to set risk score for * @param riskScore risk score to set on the strategy */ function _setRisk(address strategy, uint8 riskScore) private { require(riskScore <= MAX_RISK_SCORE, "RiskProviderRegistry::_setRisk: Risk score too big"); _risk[msg.sender][strategy] = riskScore; emit RiskAssessed(msg.sender, strategy, riskScore); }
5,034
9
// Event to notify that a user is pausing her profile
event UserUpdate( address indexed userAddress, address nftAddress, uint256 tokenId );
event UserUpdate( address indexed userAddress, address nftAddress, uint256 tokenId );
22,242
21
// Updates the rate and completion time for this contract's reward program Owner only - governance hook Insufficient funds will revert - excess funds will be refunded to the reserve rate Reward token amount to disperse to enter staking pool per second complete Timestamp the reward program ends /
function updateRewardProgram(uint256 rate, uint256 complete) external onlyOwner { require(complete > block.timestamp, "Incentivizer: already ended"); _settle(); // Set new reward rate (rewardRate, rewardComplete, rewardUpdated) = (rate, complete, block.timestamp); // Return rewards in excess of the required amount (, uint256 excessRewards) = _verifyBalance(); rewardToken.safeTransfer(registry.reserve(), excessRewards); emit RewardProgramUpdate(rate, complete); }
function updateRewardProgram(uint256 rate, uint256 complete) external onlyOwner { require(complete > block.timestamp, "Incentivizer: already ended"); _settle(); // Set new reward rate (rewardRate, rewardComplete, rewardUpdated) = (rate, complete, block.timestamp); // Return rewards in excess of the required amount (, uint256 excessRewards) = _verifyBalance(); rewardToken.safeTransfer(registry.reserve(), excessRewards); emit RewardProgramUpdate(rate, complete); }
25,219
9
// query support of ERC165 itself
if (supportsERC165(account)) {
if (supportsERC165(account)) {
7,548
6
// The quantity of tokens minted must be more than zero. /
error MintZeroQuantity();
error MintZeroQuantity();
27,037
0
// The name of this contract
string public constant name = "Deerfi Governor Alpha";
string public constant name = "Deerfi Governor Alpha";
6,387
2
// Emits when a game is updated./oldId The id of the previous erc721 GAME token./newId The id of the newly minted token./update The changes made to the Game: new assets, removed assets, uri
event GameTokenUpdated(uint256 indexed oldId, uint256 indexed newId, IGameToken.GameData update);
event GameTokenUpdated(uint256 indexed oldId, uint256 indexed newId, IGameToken.GameData update);
27,567
2
// address of the contract that will burn req token (probably through Kyber)
address public requestBurnerContract;
address public requestBurnerContract;
3,024
96
// Swap Token for exact amount of ETH 1. Receive Token from caller 2. Swap Token for ibETH. 3. Unwrap ibETH to ETH.
function swapAlphaForExactETH( uint256 amountETHOut, uint256 amountAlphaInMax, address to, uint256 deadline
function swapAlphaForExactETH( uint256 amountETHOut, uint256 amountAlphaInMax, address to, uint256 deadline
18,283
6
// Get ERC20 token address
address tokenAddress = assetData.readAddress(16); balance = LibERC20Token.balanceOf(tokenAddress, ownerAddress);
address tokenAddress = assetData.readAddress(16); balance = LibERC20Token.balanceOf(tokenAddress, ownerAddress);
54,692
38
// This returns the total number of NFTs minted on the platform/
function totalSupply() public view virtual returns (uint256) { return _tokenIds.current(); }
function totalSupply() public view virtual returns (uint256) { return _tokenIds.current(); }
40,494
2
// Receive approved ERC20 tokens _from Spender address _value Transaction value _token ERC20 token contract address _extraData Custom additional data /
function receiveApproval(address _from, uint256 _value,
function receiveApproval(address _from, uint256 _value,
32,563
113
// transfer 処理に引き継ぐ
transfer(from, to, amount);
transfer(from, to, amount);
4,653
13
// Fallback function that is called when the health check fails.
function healthCheckFailedFallback() internal virtual { revert HealthCheckFailed(); }
function healthCheckFailedFallback() internal virtual { revert HealthCheckFailed(); }
26,355
77
// Transfer token to the specified recipient
_transferGrToken(currentLock.beneficiary, currentLock.amount);
_transferGrToken(currentLock.beneficiary, currentLock.amount);
29,318
0
// intialize the etherStore variable with the contract address
constructor(address _etherStoreAddress) { etherStore = EtherStore(_etherStoreAddress); }
constructor(address _etherStoreAddress) { etherStore = EtherStore(_etherStoreAddress); }
34,698
132
// DepositBP address
address public bp;
address public bp;
25,831
54
// Enumerator that describes all supported message types. /
enum MessageType { EMPTY, TRANSFER_ETH, TRANSFER_ERC20, TRANSFER_ERC20_AND_TOTAL_SUPPLY, TRANSFER_ERC20_AND_TOKEN_INFO, TRANSFER_ERC721, TRANSFER_ERC721_AND_TOKEN_INFO, USER_STATUS, INTERCHAIN_CONNECTION, TRANSFER_ERC1155, TRANSFER_ERC1155_AND_TOKEN_INFO, TRANSFER_ERC1155_BATCH, TRANSFER_ERC1155_BATCH_AND_TOKEN_INFO, TRANSFER_ERC721_WITH_METADATA, TRANSFER_ERC721_WITH_METADATA_AND_TOKEN_INFO }
enum MessageType { EMPTY, TRANSFER_ETH, TRANSFER_ERC20, TRANSFER_ERC20_AND_TOTAL_SUPPLY, TRANSFER_ERC20_AND_TOKEN_INFO, TRANSFER_ERC721, TRANSFER_ERC721_AND_TOKEN_INFO, USER_STATUS, INTERCHAIN_CONNECTION, TRANSFER_ERC1155, TRANSFER_ERC1155_AND_TOKEN_INFO, TRANSFER_ERC1155_BATCH, TRANSFER_ERC1155_BATCH_AND_TOKEN_INFO, TRANSFER_ERC721_WITH_METADATA, TRANSFER_ERC721_WITH_METADATA_AND_TOKEN_INFO }
13,731
114
// Compound accumulated rewards from a MasterChef pool back into the pool/ Only a harvester can call this function, and the pool must not be stopped//poolIndex index of the pool/paramsparameters for compounding
function compound(uint256 poolIndex, CompoundParams calldata params) external nonReentrant onlyRole(HARVESTER_ROLE)
function compound(uint256 poolIndex, CompoundParams calldata params) external nonReentrant onlyRole(HARVESTER_ROLE)
35,293
2
// (_-_~_-~~~~`,,' )`~ -^(__;-,((()))
// ~~~~ {_ -_(()) // // `\ } //
// ~~~~ {_ -_(()) // // `\ } //
2,836
663
// console.log("purchase user: %s", msg.sender);
address purchaseUser = msg.sender; baseRequire(purchaseUser, amount); uint[] storage tokens = ownedToken[purchaseUser]; if (tokens.length + amount > ACCOUNT_LIMITATION) { require(false, "WastelandUnion: purchase limited(3) 10 NFTs at most"); }
address purchaseUser = msg.sender; baseRequire(purchaseUser, amount); uint[] storage tokens = ownedToken[purchaseUser]; if (tokens.length + amount > ACCOUNT_LIMITATION) { require(false, "WastelandUnion: purchase limited(3) 10 NFTs at most"); }
35,529
13
// Price (in wei) at end of auction
uint128 endingPrice;
uint128 endingPrice;
18,690
7
// OwnableThe Ownable contract has an owner address, and provides basic authorization control functions, this simplifies the implementation of "user permissions"./
contract Ownable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns(address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner()); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns(bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
contract Ownable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns(address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner()); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns(bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
8,694
852
// Ignore if address is already included
if (whitelist[newElement] == Status.In) { return; }
if (whitelist[newElement] == Status.In) { return; }
1,822
0
// compute: convert 1 usd token to ?? cny via the med price
uint256 inputUsd = SafeMath.mul(1, 10**18); uint256 result = convertAmount(inputUsd, 704710, 100000); assert(result == 7047100000000000000); return true;
uint256 inputUsd = SafeMath.mul(1, 10**18); uint256 result = convertAmount(inputUsd, 704710, 100000); assert(result == 7047100000000000000); return true;
33,282
66
// activate the contract
activated_ = true;
activated_ = true;
21,257
32
// Same comment as `emergencyShutdown`. For the sake of simplicity, this will simply exit silently. /
function remargin() external override isInitialized() nonReentrant() { return; }
function remargin() external override isInitialized() nonReentrant() { return; }
37,123
0
// The premia token
IERC20 public premia;
IERC20 public premia;
29,293
4
// Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
688
26
// Expose vault function that increments user's balance in the vault.Available to system modules _tokensThe addresses of the ERC20 tokens_owner The address of the token owner_quantitiesThe numbers of tokens to attribute to owner /
function batchIncrementTokenOwnerModule(
function batchIncrementTokenOwnerModule(
21,659
22
// We need this to avoid stack too deep errors. /
function getEncodedListing(LoanData.ListingTerms memory _listingTerms) internal pure returns (bytes memory) { return abi.encodePacked( _listingTerms.loanERC20Denomination, _listingTerms.minLoanPrincipalAmount, _listingTerms.maxLoanPrincipalAmount, _listingTerms.nftCollateralContract, _listingTerms.nftCollateralId, _listingTerms.revenueSharePartner, _listingTerms.minLoanDuration, _listingTerms.maxLoanDuration, _listingTerms.maxInterestRateForDurationInBasisPoints, _listingTerms.referralFeeInBasisPoints ); }
function getEncodedListing(LoanData.ListingTerms memory _listingTerms) internal pure returns (bytes memory) { return abi.encodePacked( _listingTerms.loanERC20Denomination, _listingTerms.minLoanPrincipalAmount, _listingTerms.maxLoanPrincipalAmount, _listingTerms.nftCollateralContract, _listingTerms.nftCollateralId, _listingTerms.revenueSharePartner, _listingTerms.minLoanDuration, _listingTerms.maxLoanDuration, _listingTerms.maxInterestRateForDurationInBasisPoints, _listingTerms.referralFeeInBasisPoints ); }
40,358
19
// Lets a Club's owner add a TierCreate a new Tier struct and add it to corresponding Club_param AddTierParam - the parameter that governs the tier to be created.See struct `AddTierParam` for more info./
function addTier(AddTierParam memory _param) external;
function addTier(AddTierParam memory _param) external;
17,253
178
// File: https:github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/lzApp/NonblockingLzApp.sol
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;
19,279
5
// Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. /
function transferFrom(
function transferFrom(
9,307
61
// FeePool Interface Abstract contract to hold public getters /
contract IFeePool { address public FEE_ADDRESS; uint public exchangeFeeRate; function amountReceivedFromExchange(uint value) external view returns (uint); function amountReceivedFromTransfer(uint value) external view returns (uint); function recordFeePaid(uint sUSDAmount) external; function appendAccountIssuanceRecord(address account, uint lockedAmount, uint debtEntryIndex) external; function setRewardsToDistribute(uint amount) external; }
contract IFeePool { address public FEE_ADDRESS; uint public exchangeFeeRate; function amountReceivedFromExchange(uint value) external view returns (uint); function amountReceivedFromTransfer(uint value) external view returns (uint); function recordFeePaid(uint sUSDAmount) external; function appendAccountIssuanceRecord(address account, uint lockedAmount, uint debtEntryIndex) external; function setRewardsToDistribute(uint amount) external; }
27,284
33
// Account auth
function getSubAccount(address primary, uint subAccountId) internal pure returns (address) { require(subAccountId < 256, "e/sub-account-id-too-big"); return address(uint160(primary) ^ uint160(subAccountId)); }
function getSubAccount(address primary, uint subAccountId) internal pure returns (address) { require(subAccountId < 256, "e/sub-account-id-too-big"); return address(uint160(primary) ^ uint160(subAccountId)); }
8,903
35
// Distribute the VOX tokens collected by the multiplier purchases
function distribute() external { require(msg.sender == governance, "!governance"); uint256 b = vox.balanceOf(address(this)); if (b > 0) { uint256 toBurn = b.mul(burnFee).div(burnFeeBase); uint256 leftover = b.sub(toBurn); vox.safeTransfer(burn, toBurn); vox.safeTransfer(treasury, leftover); } }
function distribute() external { require(msg.sender == governance, "!governance"); uint256 b = vox.balanceOf(address(this)); if (b > 0) { uint256 toBurn = b.mul(burnFee).div(burnFeeBase); uint256 leftover = b.sub(toBurn); vox.safeTransfer(burn, toBurn); vox.safeTransfer(treasury, leftover); } }
41,213
25
// File: @openzeppelin/contracts/GSN/Context.sol/ Provides information about the current execution context, including thesender of the transaction and its data. While these are generally availablevia msg.sender and msg.data, they should not be accessed in such a directmanner, since when dealing with GSN meta-transactions the account sending andpaying for execution may not be the actual sender (as far as an applicationis concerned). This contract is only required for intermediate, library-like contracts. /
contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
10,035
19
// @inheritdoc IStrategy/Only BentoBox can call harvest on this strategy./Ensures that (1) the caller was this contract (called through the safeHarvest function)/ and (2) that we are not being frontrun by a large BentoBox deposit when harvesting profits./Beware that calling harvest can result in a subsequent skim or withdraw call if it's rebalancing.
function harvest(uint256 balance, address sender) external override isActive onlyBentoBox returns (int256) { require(address(currentSubStrategy) != address(0), "zero address"); /// @dev Don't revert if conditions aren't met in order to allow /// BentoBox to continue execution as it might need to do a rebalance. if (sender == address(this) && IBentoBoxMinimal(bentoBox).totals(strategyToken).elastic <= maxBentoBoxBalance && balance > 0) { return int256(currentSubStrategy.harvest()); } return int256(0); }
function harvest(uint256 balance, address sender) external override isActive onlyBentoBox returns (int256) { require(address(currentSubStrategy) != address(0), "zero address"); /// @dev Don't revert if conditions aren't met in order to allow /// BentoBox to continue execution as it might need to do a rebalance. if (sender == address(this) && IBentoBoxMinimal(bentoBox).totals(strategyToken).elastic <= maxBentoBoxBalance && balance > 0) { return int256(currentSubStrategy.harvest()); } return int256(0); }
46,309
24
// File: contracts/roles/MinterRole.sol/ Minter Role Follows the openzeppelin's guidelines of working with roles. Derived contracts must implement the `addMinter` and the `removeMinter` functions. /
contract MinterRole { using Roles for Roles.Role; Roles.Role private _minters; /** * @notice Fired when a new role is added. */ event MinterAdded(address indexed account); /** * @notice Fired when a new role is added. */ event MinterRemoved(address indexed account); /** * @dev The role is granted to the deployer. */ constructor () internal { _addMinter(msg.sender); } /** * @dev Callers must have the role. */ modifier onlyMinter() { require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role"); _; } /** * @dev The role is removed for the caller. */ function renounceMinter() public { _removeMinter(msg.sender); } /** * @dev Checks if @param account has the role. */ function isMinter(address account) public view returns (bool) { return _minters.has(account); } /** * @dev Assigns the role to @param account. */ function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } /** * @dev Removes the role from @param account. */ function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } }
contract MinterRole { using Roles for Roles.Role; Roles.Role private _minters; /** * @notice Fired when a new role is added. */ event MinterAdded(address indexed account); /** * @notice Fired when a new role is added. */ event MinterRemoved(address indexed account); /** * @dev The role is granted to the deployer. */ constructor () internal { _addMinter(msg.sender); } /** * @dev Callers must have the role. */ modifier onlyMinter() { require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role"); _; } /** * @dev The role is removed for the caller. */ function renounceMinter() public { _removeMinter(msg.sender); } /** * @dev Checks if @param account has the role. */ function isMinter(address account) public view returns (bool) { return _minters.has(account); } /** * @dev Assigns the role to @param account. */ function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } /** * @dev Removes the role from @param account. */ function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } }
31,216
7
// The event fired when a speed bump has been created:
event updatedSpeedBump(uint256 QNTToWithdraw,uint16 speedBumpHours);
event updatedSpeedBump(uint256 QNTToWithdraw,uint16 speedBumpHours);
17,432
87
// How much reserve Ether do we have left in the contract?
var reserveAmount = reserve();
var reserveAmount = reserve();
27,752
4
// this method will be called as a last method in registration process when old contract will be replaced/ when called, new contract address is already in registry
function unregister() virtual external;
function unregister() virtual external;
37,060
5
// Mapping of owners to token type to balance. 0 type is balance total.
mapping(address => mapping(bytes32 => uint256)) private balances_;
mapping(address => mapping(bytes32 => uint256)) private balances_;
16,736
6
// REQUIRED OVERRIDES:
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721Enumerable)
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721Enumerable)
53,875
49
// array mapping the property Price Updates of the Asset to keep track of the number of times its been update
mapping(bytes32 => uint256) internal propertyPriceUpdateCountAsset_;
mapping(bytes32 => uint256) internal propertyPriceUpdateCountAsset_;
15,174
2
// actor => amount
EnumerableMap.AddressToUintMap private toDexTrades; EnumerableMap.AddressToUintMap private fromDexTrades; EnumerableSet.AddressSet private blockActors; address private lastActorToDex; address private lastActorFromDex; constructor() ERC20("RobinHoo Coin", "ROBINHOO") ERC20Permit("RobinHoo Coin")
EnumerableMap.AddressToUintMap private toDexTrades; EnumerableMap.AddressToUintMap private fromDexTrades; EnumerableSet.AddressSet private blockActors; address private lastActorToDex; address private lastActorFromDex; constructor() ERC20("RobinHoo Coin", "ROBINHOO") ERC20Permit("RobinHoo Coin")
37,351
82
// Leave the bar. Claim back your A5s.
function leave(uint256 _share) public { uint256 totalShares = totalSupply(); uint256 what = _share.mul(a5.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); a5.transfer(msg.sender, what); }
function leave(uint256 _share) public { uint256 totalShares = totalSupply(); uint256 what = _share.mul(a5.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); a5.transfer(msg.sender, what); }
14,471
67
// The lower tick of the range
function tickLower() external view returns (int24);
function tickLower() external view returns (int24);
18,387
7
// Batch contract pays the requests thourgh EthFeeProxy
for (uint256 i = 0; i < _recipients.length; i++) { require(address(this).balance >= _amounts[i] + _feeAmounts[i], 'not enough funds'); amount += _amounts[i]; paymentEthFeeProxy.transferWithReferenceAndFee{value: _amounts[i] + _feeAmounts[i]}(
for (uint256 i = 0; i < _recipients.length; i++) { require(address(this).balance >= _amounts[i] + _feeAmounts[i], 'not enough funds'); amount += _amounts[i]; paymentEthFeeProxy.transferWithReferenceAndFee{value: _amounts[i] + _feeAmounts[i]}(
32,462