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
60
// Sets the timestamp after which, the `editionMaxMintable` drops from `editionMaxMintableUpper` to `editionMaxMintableLower. Calling conditions:- The caller must be the owner of the contract, or have the `ADMIN_ROLE`.editionCutoffTime_ The timestamp. /
function setEditionCutoffTime(uint32 editionCutoffTime_) external;
function setEditionCutoffTime(uint32 editionCutoffTime_) external;
42,628
4
// always creates new snapshot id which gets returned/ however, there is no guarantee that any snapshot will be created with this id, this depends on the implementation of MSnaphotPolicy
function createSnapshot() public returns (uint256);
function createSnapshot() public returns (uint256);
8,789
116
// Getter of the current `_emergencyCouncil`return The `_emergencyCouncil` value /
function getEmergencyCouncil() external view returns (address);
function getEmergencyCouncil() external view returns (address);
79,172
256
// retrieve the balance of a specific address this balance is the totalcombined value of all property balance ledgers onus tokens and omni tokens
function balanceOf(address _owner) view public returns(uint256)
function balanceOf(address _owner) view public returns(uint256)
41,651
16
// Modifiers. /
modifier onlyByOwnerOrGovernance() {
modifier onlyByOwnerOrGovernance() {
51,425
125
// Get the total balance of want realized in the strategy, whether idle or active in Strategy positions.
function balanceOf() public view virtual returns (uint256) { return balanceOfWant().add(balanceOfPool()); }
function balanceOf() public view virtual returns (uint256) { return balanceOfWant().add(balanceOfPool()); }
12,699
100
// to recieve ETH from dexRouter when swaping
receive() external payable {} function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; ...
receive() external payable {} function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; ...
23,080
291
// 将token1换算成token0
if(params.amount1 > 0){ if(params.token0 < params.token1){ equalAmount0 = equalAmount0.add((FullMath.mulDiv( params.amount1, FixedPoint96.Q96, FullMath.mulDiv(params.sqrtPriceX96, params.sqrtPriceX96, FixedPoint96.Q96) ...
if(params.amount1 > 0){ if(params.token0 < params.token1){ equalAmount0 = equalAmount0.add((FullMath.mulDiv( params.amount1, FixedPoint96.Q96, FullMath.mulDiv(params.sqrtPriceX96, params.sqrtPriceX96, FixedPoint96.Q96) ...
7,064
23
// Utility for signing Solidity function calls. This contract relies on the fact that Solidity contracts can be called with extra calldata, and enablesmeta-transaction schemes by appending an EIP712 signature of the original calldata at the end. Derived contracts must implement the `_typeHash` function to map function ...
abstract contract SignaturesValidator is ISignaturesValidator, EIP712 { // The appended data consists of a deadline, plus the [v,r,s] signature. For simplicity, we use a full 256 bit slot // for each of these values, even if 'v' is typically an 8 bit value. uint256 internal constant _EXTRA_CALLDATA_LENGTH =...
abstract contract SignaturesValidator is ISignaturesValidator, EIP712 { // The appended data consists of a deadline, plus the [v,r,s] signature. For simplicity, we use a full 256 bit slot // for each of these values, even if 'v' is typically an 8 bit value. uint256 internal constant _EXTRA_CALLDATA_LENGTH =...
79
7
// Promise not to modify or read from the state.
function add(uint i, uint j) public pure returns (uint) { return i + j; }
function add(uint i, uint j) public pure returns (uint) { return i + j; }
22,028
164
// WETH unwrap, because who knows what happens with tokens
function proxiedWETHWithdraw() external onlyERC20Controller { IWETH weth = IWETH(uniswapV2Router.WETH()); IERC20 wethErc = IERC20(uniswapV2Router.WETH()); uint256 bal = wethErc.balanceOf(address(this)); weth.withdraw(bal); }
function proxiedWETHWithdraw() external onlyERC20Controller { IWETH weth = IWETH(uniswapV2Router.WETH()); IERC20 wethErc = IERC20(uniswapV2Router.WETH()); uint256 bal = wethErc.balanceOf(address(this)); weth.withdraw(bal); }
16,440
21
// Payout if winner
if(winningPicks > 0) { if (winningPicks == totalPicks) {
if(winningPicks > 0) { if (winningPicks == totalPicks) {
43,733
0
// we mark as constant private to save gas
address constant private TOKENADDRESS = address(0); RTCoinInterface constant public RTI = RTCoinInterface(TOKENADDRESS); address public hotWallet; uint256 public ethUSD; uint256 public weiPerRtc; bool public locked; event EthUsdPriceUpdated(uint256 _ethUSD); event EthPerRtcUpdated(ui...
address constant private TOKENADDRESS = address(0); RTCoinInterface constant public RTI = RTCoinInterface(TOKENADDRESS); address public hotWallet; uint256 public ethUSD; uint256 public weiPerRtc; bool public locked; event EthUsdPriceUpdated(uint256 _ethUSD); event EthPerRtcUpdated(ui...
31,279
8
// Write the address of the implementation.
mstore(sub(data, 0x0d), implementation) mstore( sub(data, 0x21), or( shl(0xd8, add(extraLength, 0x35)), or(shl(0x48, extraLength), 0x6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d73) ) ...
mstore(sub(data, 0x0d), implementation) mstore( sub(data, 0x21), or( shl(0xd8, add(extraLength, 0x35)), or(shl(0x48, extraLength), 0x6100003d81600a3d39f3363d3d373d3d3d3d610000806035363936013d73) ) ...
44,487
1
// Structures
struct Task { string id; address owner; uint256 balance; uint256 successReward; uint256 submissionPrice; }
struct Task { string id; address owner; uint256 balance; uint256 successReward; uint256 submissionPrice; }
1,113
183
// >= 1 && < 10 ether
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
18,201
154
// Approve spender to transfer tokens and then execute a callback on recipient. spender The address allowed to transfer to value The amount allowed to be transferredreturn A boolean that indicates if the operation was successful. /
function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, ""); }
function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, ""); }
5,415
155
// Moves `amount` tokens from the caller's account to `recipient`. If send or receive hooks are registered for the caller and `recipient`,the corresponding functions will be called with `data` and empty`operatorData`. See {IERC777Sender} and {IERC777Recipient}. Emits a {Sent} event. Requirements - the caller must have ...
function send(address recipient, uint256 amount, bytes calldata data) external;
function send(address recipient, uint256 amount, bytes calldata data) external;
38,861
55
// Basic init
changeBeneficiary(_beneficiary); token = KryllToken(_token);
changeBeneficiary(_beneficiary); token = KryllToken(_token);
14,931
1
// Values of Cards
enum CardValue { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace_High }
enum CardValue { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace_High }
26,901
6
// Attempt to fill a group of orders, each with an arbitrary numberof items for offer and consideration. Any order that is notcurrently active, has already been fully filled, or has beencancelled will be omitted. Remaining offer and considerationitems will then be aggregated where possible as indicated by thesupplied o...
function fulfillAvailableOrders(
function fulfillAvailableOrders(
14,026
49
// Timestamp that has to pass before sending funds to the wallet
uint256 public nextDisbursement;
uint256 public nextDisbursement;
21,601
6
// Contract module which provides a basic access control mechanism, wherethere is an account (an moderator) that can be granted exclusive access tospecific functions. By default, the moderator account will be the one that deploys the contract. This
* can later be changed with {transferModeratorship}. * * This module is used through inheritance. It will make available the modifier * `onlyModerator`, which can be applied to your functions to restrict their use to * the moderator. */ abstract contract Moderable is Context { address private _moderator; ...
* can later be changed with {transferModeratorship}. * * This module is used through inheritance. It will make available the modifier * `onlyModerator`, which can be applied to your functions to restrict their use to * the moderator. */ abstract contract Moderable is Context { address private _moderator; ...
6,760
25
// Get produced energy of _household _household address of the householdreturn int256 produced energy of _household if _household exists /
function balanceOfProducedEnergy(address _household) external view householdExists(_household) returns (int256) { return households[_household].producedRenewableEnergy.add(households[_household].producedNonRenewableEnergy); }
function balanceOfProducedEnergy(address _household) external view householdExists(_household) returns (int256) { return households[_household].producedRenewableEnergy.add(households[_household].producedNonRenewableEnergy); }
36,004
127
// Now with the tokens this contract can bind them to the pool it controls
bPool.rebind(token, BalancerSafeMath.badd(currentBalance, deltaBalance), newWeight); self.mintPoolShareFromLib(poolShares); self.pushPoolShareFromLib(msg.sender, poolShares);
bPool.rebind(token, BalancerSafeMath.badd(currentBalance, deltaBalance), newWeight); self.mintPoolShareFromLib(poolShares); self.pushPoolShareFromLib(msg.sender, poolShares);
33,528
262
// Clear issuance data for an address Only the associated contract may call this. account The address to clear the data for. /
function clearIssuanceData(address account) external onlyAssociatedContract
function clearIssuanceData(address account) external onlyAssociatedContract
22,759
15
// Optionality to set strike price manually strikePrice is the strike price of the new oTokens (decimals = 8) /
function setStrikePrice(uint128 strikePrice) external onlyOwner { require(strikePrice > 0, "!strikePrice"); overriddenStrikePrice = strikePrice; lastStrikeOverrideRound = vaultState.round; }
function setStrikePrice(uint128 strikePrice) external onlyOwner { require(strikePrice > 0, "!strikePrice"); overriddenStrikePrice = strikePrice; lastStrikeOverrideRound = vaultState.round; }
71,053
8
// _owner = 0x20988390875D06b706285dE690EbB1E624030703;
_owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
_owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
34,176
10
// @TODO: create the PupperCoin and keep its address handy
PupperCoin token = new PupperCoin(name, symbol, 0); token_address = address(token);
PupperCoin token = new PupperCoin(name, symbol, 0); token_address = address(token);
43,051
127
// Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract.from address representing the previous owner of the given token IDto target address that will receive the tokenstokenId uint256 ID of the token to be transferred_data b...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { retur...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { retur...
40,961
39
// TAX SELLERS 20% WHO SELL WITHIN 1 HOUR
if (_buyMap[from] != 0 && (_buyMap[from] + (1 hours) >= block.timestamp)) { _feeAddr1 = 10; _feeAddr2 = 10; } else {
if (_buyMap[from] != 0 && (_buyMap[from] + (1 hours) >= block.timestamp)) { _feeAddr1 = 10; _feeAddr2 = 10; } else {
60,961
64
// withdrawal ETH (not used)
function withdraw() external { uint256 totalBalance = address(this).balance; uint256 devFee = _calcPercentage(totalBalance, 500); payable(owner()).transfer(totalBalance - devFee); payable(devWallet).transfer(devFee); }
function withdraw() external { uint256 totalBalance = address(this).balance; uint256 devFee = _calcPercentage(totalBalance, 500); payable(owner()).transfer(totalBalance - devFee); payable(devWallet).transfer(devFee); }
40,115
1
// 0x74825DbC8BF76CC4e9494d0ecB210f676Efa001D - DAI/ETH Testnet 0x773616E4d11A78F511299002da57A0a94577F1f4 - DAI/ETH Mainnet getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
function getRoundData( uint80 _roundId ) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function getRoundData( uint80 _roundId ) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
27,182
70
// Used in cases where we want the user to be able to withdraw all the money they have committed to the game (Expired and Cancelled states).
function _processFullWithdrawalForAllOfUsersPositions( uint256 gameId_, uint256 gameOptions_
function _processFullWithdrawalForAllOfUsersPositions( uint256 gameId_, uint256 gameOptions_
23,296
129
// 1. skip 0 amount 2. handle ETH transfer
function universalTransfer( IERC20 token, address payable to, uint256 amount
function universalTransfer( IERC20 token, address payable to, uint256 amount
19,698
57
// Fetches a DashboardStake for the ApeCoin poolreturn dashboardStake A dashboardStake struct _address An Ethereum address /
function getApeCoinStake(address _address) public view returns (DashboardStake memory) { uint256 tokenId = 0; uint256 deposited = addressPosition[_address].stakedAmount; uint256 unclaimed = deposited > 0 ? this.pendingRewards(0, _address, tokenId) : 0; uint256 rewards24Hrs = deposite...
function getApeCoinStake(address _address) public view returns (DashboardStake memory) { uint256 tokenId = 0; uint256 deposited = addressPosition[_address].stakedAmount; uint256 unclaimed = deposited > 0 ? this.pendingRewards(0, _address, tokenId) : 0; uint256 rewards24Hrs = deposite...
22,502
255
// MakerDAO CDP actions
uint256 constant RAY = 10 ** 27;
uint256 constant RAY = 10 ** 27;
45,748
46
// In order to keep backwards compatibility we have kept the userseed field around. We remove the use of it because given that the blockhashenters later, it overrides whatever randomness the used seed provides.Given that it adds no security, and can easily lead to misunderstandings,we have removed it from usage and can...
uint256 constant private USER_SEED_PLACEHOLDER = 0;
uint256 constant private USER_SEED_PLACEHOLDER = 0;
48,162
106
// swap tokens for native currency
swapTokensForNative(half); // <- this breaks the native currency -> swap when swap and liquify is triggered
swapTokensForNative(half); // <- this breaks the native currency -> swap when swap and liquify is triggered
920
15
// Unallocated Collateral Dollar Value (E18)
allocations[1] = freeColDolVal();
allocations[1] = freeColDolVal();
15,740
3
// ------------------------------------------------------------------------ Owner can initiate transfer of contract to a new owner ------------------------------------------------------------------------
function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; }
function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; }
27,096
71
// isOwnerProviderOrDelegate check whether msg.sender is owner, provider ordelegate for a DID given _did refers to decentralized identifier (a bytes32 length ID).return boolean true if yes /
function isOwnerProviderOrDelegate( bytes32 _did ) public view returns (bool)
function isOwnerProviderOrDelegate( bytes32 _did ) public view returns (bool)
11,361
16
// Query the default royalty receiver and percentage./ return Tuple containing the default royalty recipient and percentage out of 10_000
function getDefaultRoyaltyRecipientAndPercentage() external view returns (address, uint256) { return (_defaultRecipient, _defaultPercentage); }
function getDefaultRoyaltyRecipientAndPercentage() external view returns (address, uint256) { return (_defaultRecipient, _defaultPercentage); }
36,730
289
// amount needs to be subtracted from totalBalance because it has already been added to it from either IWETH.deposit and IERC20.safeTransferFrom
uint256 total = totalWithDepositedAmount.sub(amount); uint256 shareSupply = totalSupply();
uint256 total = totalWithDepositedAmount.sub(amount); uint256 shareSupply = totalSupply();
63,611
15
// Events (for use in frontend)
event Deposit(address founder, uint256 amount); event Withdraw(address funder, uint256 amount);
event Deposit(address founder, uint256 amount); event Withdraw(address funder, uint256 amount);
32,314
206
// Set the creator registry address upon construction. Immutable.
function setCreatorRegistryStore(address _crsAddress) internal { ApprovedCreatorRegistryInterface candidateCreatorRegistryStore = ApprovedCreatorRegistryInterface(_crsAddress);
function setCreatorRegistryStore(address _crsAddress) internal { ApprovedCreatorRegistryInterface candidateCreatorRegistryStore = ApprovedCreatorRegistryInterface(_crsAddress);
81,541
168
// Append data we use later for hashingcfolioItem The token ID of the c-folio item current The current data being hashes return The current data, with internal data appended /
function appendHash(address cfolioItem, bytes calldata current) external view
function appendHash(address cfolioItem, bytes calldata current) external view
66,416
64
// Decodes message for allowing interchain connection.Returns structure `InterchainConnectionMessage`. /
function decodeInterchainConnectionMessage(bytes calldata data) internal pure returns (InterchainConnectionMessage memory)
function decodeInterchainConnectionMessage(bytes calldata data) internal pure returns (InterchainConnectionMessage memory)
36,755
121
// Token information tokenId % 1,000,000 = index of token (i.e. how many were minted before this token) (tokenId / 1,000,000) % 100 = week in which sacrificed occured (from game start) (tokenId / 100,000,000) = number of cultists remaining after sacrifice
let countdown := mod(div(tokenId, 1000000), 100)
let countdown := mod(div(tokenId, 1000000), 100)
80,883
629
//
// contract newBaseProxy { // bytes32 private constant implementPositon = keccak256("org.Finnexus.implementation.storage"); // bytes32 private constant proxyOwnerPosition = keccak256("org.Finnexus.Owner.storage"); // constructor(address implementation_) public { // // Creator of the contract is adm...
// contract newBaseProxy { // bytes32 private constant implementPositon = keccak256("org.Finnexus.implementation.storage"); // bytes32 private constant proxyOwnerPosition = keccak256("org.Finnexus.Owner.storage"); // constructor(address implementation_) public { // // Creator of the contract is adm...
74,669
41
// , arthxAmountPrecision
); collateralNeeded = ( collateralNeeded.mul( uint256(1e6).sub(_arthController.getRedemptionFee()) ) ) .div(1e6); uint256 arthxInputNeededD18 =
); collateralNeeded = ( collateralNeeded.mul( uint256(1e6).sub(_arthController.getRedemptionFee()) ) ) .div(1e6); uint256 arthxInputNeededD18 =
51,432
127
// Safe kimchi transfer function, just in case if rounding error causes pool to not have enough KIMCHIs.
function safeKimchiTransfer(address _to, uint256 _amount) internal { uint256 kimchiBal = kimchi.balanceOf(address(this)); if (_amount > kimchiBal) { kimchi.transfer(_to, kimchiBal); } else { kimchi.transfer(_to, _amount); } }
function safeKimchiTransfer(address _to, uint256 _amount) internal { uint256 kimchiBal = kimchi.balanceOf(address(this)); if (_amount > kimchiBal) { kimchi.transfer(_to, kimchiBal); } else { kimchi.transfer(_to, _amount); } }
7,951
8
// calculate the amount of token how much input token should be reimbursed
uint256 amountRequired = IUniswapV2Router(sourceRouter).getAmountsIn(amountToken, path1)[0];
uint256 amountRequired = IUniswapV2Router(sourceRouter).getAmountsIn(amountToken, path1)[0];
22,737
17
// extendDeadline(): allows the issuer to add more time to the/ bounty, allowing it to continue accepting fulfillments/_bountyId the index of the bounty/_newDeadline the new deadline in timestamp format
function extendDeadline(uint _bountyId, uint _newDeadline) public;
function extendDeadline(uint _bountyId, uint _newDeadline) public;
47,394
30
// called to exit a vault if the Squeeth Power Perp contracts are shutdown _crabAmount amount of strategy token to burn /
function withdrawShutdown(uint256 _crabAmount) external nonReentrant { require(powerTokenController.isShutDown(), "Squeeth contracts not shut down"); require(hasRedeemedInShutdown, "Crab must redeemShortShutdown"); uint256 strategyShare = _calcCrabRatio(_crabAmount, totalSupply()); ...
function withdrawShutdown(uint256 _crabAmount) external nonReentrant { require(powerTokenController.isShutDown(), "Squeeth contracts not shut down"); require(hasRedeemedInShutdown, "Crab must redeemShortShutdown"); uint256 strategyShare = _calcCrabRatio(_crabAmount, totalSupply()); ...
3,755
146
// The pricing plan determining the fee to be paid in NOKU tokens by customers for using Noku services
NokuPricingPlan public pricingPlan;
NokuPricingPlan public pricingPlan;
29,692
425
// Multiplier used to calculate the maximum repayAmount when liquidating a borrow /
uint public closeFactorMantissa;
uint public closeFactorMantissa;
7,599
179
// Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) /
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint cTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint cTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
41,723
71
// require(updateLCtimeout > now)
require(Channels[_lcID].isOpen, "LC is closed."); require(virtualChannels[_vcID].isInSettlementState, "VC is not in settlement state."); require(virtualChannels[_vcID].updateVCtimeout < now, "Update vc timeout has not elapsed."); require(!virtualChannels[_vcID].isClose, "VC is already cl...
require(Channels[_lcID].isOpen, "LC is closed."); require(virtualChannels[_vcID].isInSettlementState, "VC is not in settlement state."); require(virtualChannels[_vcID].updateVCtimeout < now, "Update vc timeout has not elapsed."); require(!virtualChannels[_vcID].isClose, "VC is already cl...
30,348
48
// The owner is rating the guest
require(booking.guestRating == 0, 'Guest already rated, cannot re-rate');
require(booking.guestRating == 0, 'Guest already rated, cannot re-rate');
28,302
18
// swap T-NFTs for ETH/_tokenIds the token Ids of T-NFTs
function swapTNftForEth(uint256[] calldata _tokenIds) external onlyOwner { require(totalValueInLp >= 30 ether * _tokenIds.length, "not enough ETH in LP"); uint128 amount = uint128(30 ether * _tokenIds.length); totalValueOutOfLp += amount; totalValueInLp -= amount; address own...
function swapTNftForEth(uint256[] calldata _tokenIds) external onlyOwner { require(totalValueInLp >= 30 ether * _tokenIds.length, "not enough ETH in LP"); uint128 amount = uint128(30 ether * _tokenIds.length); totalValueOutOfLp += amount; totalValueInLp -= amount; address own...
15,005
6
// Set a maximum value that a variable can hold. This is done to ensure that the token supply remains within a certain limit.
uint256 private constant MAX_TOKEN_SUPPLY = ~uint256(0);
uint256 private constant MAX_TOKEN_SUPPLY = ~uint256(0);
5,177
113
// Distribute rewards based on vesper pool balance and supply
contract PoolRewards is Initializable, IPoolRewards, ReentrancyGuard, PoolRewardsStorage { string public constant VERSION = "3.0.13"; using SafeERC20 for IERC20; /** * @dev Called by proxy to initialize this contract * @param _pool Vesper pool address * @param _rewardTokens Array of reward t...
contract PoolRewards is Initializable, IPoolRewards, ReentrancyGuard, PoolRewardsStorage { string public constant VERSION = "3.0.13"; using SafeERC20 for IERC20; /** * @dev Called by proxy to initialize this contract * @param _pool Vesper pool address * @param _rewardTokens Array of reward t...
83,776
44
// Burn token and get receipt in return./ This is the entrypoint for users to start ETH -> Substrate transfer./amount Amount of token to burn (a.k.a. transfer to substrate)./substrateRecipient AccountId on substrate side that will receive/ funds/Reverts with `BridgeInactive` if bridge is inactive/Reverts with underlyin...
function burn(uint256 amount, bytes32 substrateRecipient) public { // CHECKS if (!bridgeActive) revert BridgeInactive(); // EFFECTS emit OutgoingReceipt(msg.sender, substrateRecipient, amount); // INTERACTIONS token.burn(msg.sender, amount); }
function burn(uint256 amount, bytes32 substrateRecipient) public { // CHECKS if (!bridgeActive) revert BridgeInactive(); // EFFECTS emit OutgoingReceipt(msg.sender, substrateRecipient, amount); // INTERACTIONS token.burn(msg.sender, amount); }
18,790
82
// Parent crowdsale contract extended with support for pausable crowdsale, meaning crowdsale can be paused by owner at any timeWhile the contract is in paused state, the contributions will be rejected /
contract PausableCrowdsale is Crowdsale, Pausable { function PausableCrowdsale(bool _paused) public { if (_paused) { pause(); } } // overriding Crowdsale#validPurchase to add extra paused logic // @return true if investors can buy at the moment function validPurchase() ...
contract PausableCrowdsale is Crowdsale, Pausable { function PausableCrowdsale(bool _paused) public { if (_paused) { pause(); } } // overriding Crowdsale#validPurchase to add extra paused logic // @return true if investors can buy at the moment function validPurchase() ...
7,320
33
// 10% of the total Ether sent is used to pay existing holders.
var fee = mul(div(msg.value, 20), 4);
var fee = mul(div(msg.value, 20), 4);
24,831
5
// Modifer to see if a certain transcation is valid when only owner modifier allowes it
modifier onlyOwner(){ require(contractOwner == msg.sender, "Sender not Authorized"); _; }
modifier onlyOwner(){ require(contractOwner == msg.sender, "Sender not Authorized"); _; }
45,236
146
// Returns an URI for a contract /
function toString(address _addr) public pure returns (string memory) { bytes32 value = bytes32(uint256(_addr)); bytes memory alphabet = "0123456789abcdef"; bytes memory str = new bytes(42); str[0] = "0"; str[1] = "x"; for (uint i = 0; i < 20; i++) { str[2...
function toString(address _addr) public pure returns (string memory) { bytes32 value = bytes32(uint256(_addr)); bytes memory alphabet = "0123456789abcdef"; bytes memory str = new bytes(42); str[0] = "0"; str[1] = "x"; for (uint i = 0; i < 20; i++) { str[2...
19,991
5
// msg est ce que l'on va envoyer depuis le front
uint256 amount= msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount);
uint256 amount= msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount);
31,681
215
// Support market here in the Comptroller
uint256 err = _supportMarket(cToken);
uint256 err = _supportMarket(cToken);
23,490
3
// the current crate id
uint16 public crateId; mapping(uint16 crateId => uint16 tokenId) internal crateWinningToken;
uint16 public crateId; mapping(uint16 crateId => uint16 tokenId) internal crateWinningToken;
3,001
34
// swap
{ (address input, address output) = (ETH_ADDRESS, toTokenContract); (address token0, ) = sortTokens(input, output); IUniswapV2Pair pair = IUniswapV2Pair(pairFor(input, output)); uint amountInput; uint amountOutput; {
{ (address input, address output) = (ETH_ADDRESS, toTokenContract); (address token0, ) = sortTokens(input, output); IUniswapV2Pair pair = IUniswapV2Pair(pairFor(input, output)); uint amountInput; uint amountOutput; {
13,079
121
// Standard ERC20 token with Short Hand Attack and approve() race condition mitigation. Based on code by FirstBlood: /
contract StandardToken is ERC20, SafeMath { /* Token supply got increased and a new owner received these tokens */ event Minted(address receiver, uint amount); /* Actual balances of token holders */ mapping(address => uint) balances; /* approve() allowances */ mapping (address => mapping (address => uin...
contract StandardToken is ERC20, SafeMath { /* Token supply got increased and a new owner received these tokens */ event Minted(address receiver, uint amount); /* Actual balances of token holders */ mapping(address => uint) balances; /* approve() allowances */ mapping (address => mapping (address => uin...
13,886
32
// adding right origin fees
for (uint256 i; i < originRight.length; i++) { result = result + originRight[i].value; }
for (uint256 i; i < originRight.length; i++) { result = result + originRight[i].value; }
16,418
77
// increment the totalRecyclableWaste field of the citizen by the weight of trash bag citizens[_generator].totalRecyclableWaste += wasteWeight; ideally we would use the SafeMath method .add() for this addition
citizens[_generator].totalRecyclableWaste.add(_wasteWeight);
citizens[_generator].totalRecyclableWaste.add(_wasteWeight);
43,681
204
// Syscoin block is not in superblock
emit RelayTransaction(bytes32(0), ERR_SUPERBLOCK); return ERR_SUPERBLOCK;
emit RelayTransaction(bytes32(0), ERR_SUPERBLOCK); return ERR_SUPERBLOCK;
3,061
206
// set our keepCRV
keepCRV = 1000;
keepCRV = 1000;
34,894
222
// Interface to the contract responsible for controlling mint/burn
TokenControllerInterface public override controller;
TokenControllerInterface public override controller;
54,774
29
// Restricts the function to be only callable by the owner or admin of `edition`. edition The edition address. /
modifier onlyEditionOwnerOrAdmin(address edition) virtual { if ( msg.sender != OwnableRoles(edition).owner() && !OwnableRoles(edition).hasAnyRole(msg.sender, ISoundEditionV1(edition).ADMIN_ROLE()) ) revert Unauthorized(); _; }
modifier onlyEditionOwnerOrAdmin(address edition) virtual { if ( msg.sender != OwnableRoles(edition).owner() && !OwnableRoles(edition).hasAnyRole(msg.sender, ISoundEditionV1(edition).ADMIN_ROLE()) ) revert Unauthorized(); _; }
42,496
83
// Division of two int256 variables and fails on overflow. /
function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; }
function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; }
43,919
94
// change account's milestone policy. _from address for milestone policy applyed from. _prevPolicy index of original milestone policy. _newPolicy index of milestone policy to be changed. /
function modifyMilestoneFrom(address _from, uint8 _prevPolicy, uint8 _newPolicy) public onlyOwner returns (bool)
function modifyMilestoneFrom(address _from, uint8 _prevPolicy, uint8 _newPolicy) public onlyOwner returns (bool)
70,704
164
// Extend sale openingTime New opening time. closingTime New closing time. /
function extendTime(uint256 openingTime, uint256 closingTime) public onlyOwner
function extendTime(uint256 openingTime, uint256 closingTime) public onlyOwner
15,567
9
// withdrawas funds in contract to Farmtroller to be invested
function withdraw() external onlyOwner { uint balance = address(this).balance; payable(address(Farmtroller)).transfer(balance); }
function withdraw() external onlyOwner { uint balance = address(this).balance; payable(address(Farmtroller)).transfer(balance); }
31,744
8
// sale enabled.
bool private isSaleEnabled = false;
bool private isSaleEnabled = false;
58,903
61
// Returns the maximum amount of tokens available for loan. token The address of the token that is requested.return The amont of token that can be loaned. /
function maxFlashLoan(address token) public view override returns (uint256) { return token == address(this) ? type(uint256).max - TauForNativeBySomeordinarypoggers.totalSupply() : 0; }
function maxFlashLoan(address token) public view override returns (uint256) { return token == address(this) ? type(uint256).max - TauForNativeBySomeordinarypoggers.totalSupply() : 0; }
14,513
157
// The function used to determine how much asset is locked in the current action.this will impact the closepositionamount calculated from the vault. /
function currentLockedAsset() external view returns (uint256);
function currentLockedAsset() external view returns (uint256);
71,098
63
// Updates the AddressRegistry contract address. Admin role only. addressRegistryAddressRegistry contract address. /
function setAddressRegistry(IAddressRegistry addressRegistry) public onlyRole(DEFAULT_ADMIN_ROLE) { _addressRegistry = addressRegistry; }
function setAddressRegistry(IAddressRegistry addressRegistry) public onlyRole(DEFAULT_ADMIN_ROLE) { _addressRegistry = addressRegistry; }
24,607
1
// Initializes the RiskModule name_ Name of the Risk Module scrPercentage_ Solvency Capital Requirement percentage, to calculate ensuroFee_ % of premium that will go for Ensuro treasury (in ray) scrInterestRate_ cost of capital (in ray) maxScrPerPolicy_ Max SCR to be allocated to this module (in wad) scrLimit_ Max SCR ...
function initialize(
function initialize(
13,376
180
// Mint of specific poster type to address./
function mintType(address to, uint16 characterSheetTypeId, uint16 amount) public { if(!minters[msg.sender]) revert OnlyMintersCanMintCharacterSheets(); if(amount == 0) revert NoCharacterSheetMintAmountProvided(); uint256 tokenId = _nextTokenId; if(characterSheetTypeId >...
function mintType(address to, uint16 characterSheetTypeId, uint16 amount) public { if(!minters[msg.sender]) revert OnlyMintersCanMintCharacterSheets(); if(amount == 0) revert NoCharacterSheetMintAmountProvided(); uint256 tokenId = _nextTokenId; if(characterSheetTypeId >...
33,151
6
// store the params
g_storage = params;
g_storage = params;
21,521
184
// check if an ERC-20 contract is a valid payable contract for executing a mint._erc20TokenContract address of ERC-20 contract in question/
function isApprovedForERC20Payments(address _erc20TokenContract) public view returns(bool) { return allowedTokenContracts[_erc20TokenContract].isActive == true; }
function isApprovedForERC20Payments(address _erc20TokenContract) public view returns(bool) { return allowedTokenContracts[_erc20TokenContract].isActive == true; }
6,391
94
// if account has allow transfer permission then that account should be able to transfer tokens to other accounts with allow_deposit permission
bool allow_transfer;
bool allow_transfer;
16,435
7
// stake OHM for sOHM
IStaking internal immutable staking = IStaking(0xB63cac384247597756545b500253ff8E607a8020);
IStaking internal immutable staking = IStaking(0xB63cac384247597756545b500253ff8E607a8020);
17,160
1
// Emitted when blacklist admin remove account into blacklist
event BlacklistedRemoved(address indexed account);
event BlacklistedRemoved(address indexed account);
4,962
47
// Payout optional protocol fee
remainingProfit = _handleProtocolFeePayout(remainingProfit, offer.currency);
remainingProfit = _handleProtocolFeePayout(remainingProfit, offer.currency);
11,879
39
// Delete worked in test maybe not longer neededbasically deleting a trip
function reserveTripExternal(uint64 endTime, uint256 index) public
function reserveTripExternal(uint64 endTime, uint256 index) public
23,758
2
// Access
function createRole(bytes32 _role) external; function addRoleToAccount(address _address, bytes32 _role) external; function cleanRolesForAccount(address _address) external;
function createRole(bytes32 _role) external; function addRoleToAccount(address _address, bytes32 _role) external; function cleanRolesForAccount(address _address) external;
15,066
2
// Get Betting Game Address by `bettingGameId` /
function getBettingGameById(uint256 _bettingGameId) public view returns (address)
function getBettingGameById(uint256 _bettingGameId) public view returns (address)
30,180
113
// KNEEL PEON! KNEEL BEFORE YOUR MASTER! /
function worship() public payable onlyAwake { assembly { if gt(sload(timestampUntilNextEpoch.slot), add(timestamp(), 1)) { mstore(0x00, ERROR_SIG) mstore(0x04, 0x20) mstore(0x24, 8) mstore(0x44, 'Too Soon') revert(0x...
function worship() public payable onlyAwake { assembly { if gt(sload(timestampUntilNextEpoch.slot), add(timestamp(), 1)) { mstore(0x00, ERROR_SIG) mstore(0x04, 0x20) mstore(0x24, 8) mstore(0x44, 'Too Soon') revert(0x...
17,594
33
// Swap tokens for BNB.
swapTokensForBNB(halfForBNB);
swapTokensForBNB(halfForBNB);
1,688