Overview
Max Total Supply
309,795.687374104476027926 PcDAI
Holders
3,091 ( -0.032%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Minimal Proxy Contract for 0x09576c5af80167fc410eb33f85c74a891832085f
Contract Name:
Ticket
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "sortition-sum-tree-factory/contracts/SortitionSumTreeFactory.sol";import "@pooltogether/uniform-random-number/contracts/UniformRandomNumber.sol";import "./ControlledToken.sol";import "./TicketInterface.sol";contract Ticket is ControlledToken, TicketInterface {using SortitionSumTreeFactory for SortitionSumTreeFactory.SortitionSumTrees;bytes32 constant private TREE_KEY = keccak256("PoolTogether/Ticket");uint256 constant private MAX_TREE_LEAVES = 5;// Ticket-weighted oddsSortitionSumTreeFactory.SortitionSumTrees internal sortitionSumTrees;/// @notice Initializes the Controlled Token with Token Details and the Controller/// @param _name The name of the Token/// @param _symbol The symbol for the Token/// @param _decimals The number of decimals for the Token/// @param _trustedForwarder Address of the Forwarding Contract for GSN Meta-Txs/// @param _controller Address of the Controller contract for minting & burningfunction initialize(
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "./PrizePoolBuilder.sol";import "./SingleRandomWinnerBuilder.sol";import "../registry/RegistryInterface.sol";import "../prize-strategy/single-random-winner/SingleRandomWinnerProxyFactory.sol";import "../prize-pool/compound/CompoundPrizePoolProxyFactory.sol";import "../token/ControlledTokenProxyFactory.sol";import "../token/TicketProxyFactory.sol";import "../external/compound/CTokenInterface.sol";import "../external/openzeppelin/OpenZeppelinProxyFactoryInterface.sol";/// @title Builds new Compound Prize Pools/* solium-disable security/no-block-members */contract CompoundPrizePoolBuilder is PrizePoolBuilder {using SafeMath for uint256;using SafeCast for uint256;struct CompoundPrizePoolConfig {CTokenInterface cToken;uint256 maxExitFeeMantissa;uint256 maxTimelockDuration;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "../prize-pool/PrizePool.sol";import "../prize-strategy/single-random-winner/SingleRandomWinner.sol";contract PrizePoolBuilder {using SafeCast for uint256;event PrizePoolCreated (address indexed creator,address indexed prizePool);function _setupSingleRandomWinner(PrizePool prizePool,SingleRandomWinner singleRandomWinner,uint256 ticketCreditRateMantissa,uint256 ticketCreditLimitMantissa) internal {address ticket = address(singleRandomWinner.ticket());prizePool.setPrizeStrategy(singleRandomWinner);prizePool.addControlledToken(ticket);
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/IERC721.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";import "../external/pooltogether/FixedPoint.sol";import "../registry/RegistryInterface.sol";import "../reserve/ReserveInterface.sol";import "./YieldSource.sol";import "../token/TokenListenerInterface.sol";import "../token/ControlledToken.sol";import "../token/TokenControllerInterface.sol";import "../utils/MappedSinglyLinkedList.sol";import "../utils/RelayRecipient.sol";import "./PrizePoolInterface.sol";/// @title Escrows assets and deposits them into a yield source. Exposes interest to Prize Strategy. Users deposit and withdraw from this contractto participate in Prize Pool./// @notice Accounting is managed using Controlled Tokens, whose mint and burn functions can only be called by this contract./// @dev Must be inherited to provide specific yield-bearing asset control, such as Compound cTokensabstract contract PrizePool is PrizePoolInterface, YieldSource, OwnableUpgradeSafe, RelayRecipient, ReentrancyGuardUpgradeSafe,TokenControllerInterface {
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "../GSN/Context.sol";import "../Initializable.sol";/*** @dev Contract module which provides a basic access control mechanism, where* there is an account (an owner) that can be granted exclusive access to* specific functions.** By default, the owner account will be the one that deploys the contract. This* can later be changed with {transferOwnership}.** This module is used through inheritance. It will make available the modifier* `onlyOwner`, which can be applied to your functions to restrict their use to* the owner.*/contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {address private _owner;event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);/*** @dev Initializes the contract setting the deployer as the initial owner.*/function __Ownable_init() internal initializer {
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "../Initializable.sol";/** @dev Provides information about the current execution context, including the* sender of the transaction and its data. While these are generally available* via msg.sender and msg.data, they should not be accessed in such a direct* manner, since when dealing with GSN meta-transactions the account sending and* paying for execution may not be the actual sender (as far as an application* is concerned).** This contract is only required for intermediate, library-like contracts.*/contract ContextUpgradeSafe is Initializable {// Empty internal constructor, to prevent people from mistakenly deploying// an instance of this contract, which should be used via inheritance.function __Context_init() internal initializer {__Context_init_unchained();}function __Context_init_unchained() internal initializer {}
1234567891011121314151617181920212223242526pragma solidity >=0.4.24 <0.7.0;/*** @title Initializable** @dev Helper contract to support initializer functions. To use it, replace* the constructor with a function that has the `initializer` modifier.* WARNING: Unlike constructors, initializer functions must be manually* invoked. This applies both to deploying an Initializable contract, as well* as extending an Initializable contract via inheritance.* WARNING: When used with inheritance, manual care must be taken to not invoke* a parent initializer twice, or ensure that all initializers are idempotent,* because this is not dealt with automatically as with constructors.*/contract Initializable {/*** @dev Indicates that the contract has been initialized.*/bool private initialized;/*** @dev Indicates that the contract is in the process of being initialized.*/bool private initializing;
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Wrappers over Solidity's uintXX casting operators with added overflow* checks.** Downcasting from uint256 in Solidity does not revert on overflow. This can* easily result in undesired exploitation or bugs, since developers usually* assume that overflows raise errors. `SafeCast` restores this intuition by* reverting the transaction when such an operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.** Can be combined with {SafeMath} to extend it to smaller types, by performing* all math on `uint256` and then downcasting.*/library SafeCast {/*** @dev Returns the downcasted uint128 from uint256, reverting on* overflow (when the input is greater than largest uint128).** Counterpart to Solidity's `uint128` operator.*
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "../Initializable.sol";/*** @dev Contract module that helps prevent reentrant calls to a function.** Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier* available, which can be applied to functions to make sure there are no nested* (reentrant) calls to them.** Note that because there is a single `nonReentrant` guard, functions marked as* `nonReentrant` may not call one another. This can be worked around by making* those functions `private`, and then adding `external` `nonReentrant` entry* points to them.** TIP: If you would like to learn more about reentrancy and alternative ways* to protect against it, check out our blog post* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].*/contract ReentrancyGuardUpgradeSafe is Initializable {bool private _notEntered;function __ReentrancyGuard_init() internal initializer {__ReentrancyGuard_init_unchained();}
1234567891011121314151617181920212223242526pragma solidity ^0.6.2;import "../../introspection/IERC165.sol";/*** @dev Required interface of an ERC721 compliant contract.*/interface IERC721 is IERC165 {event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);event ApprovalForAll(address indexed owner, address indexed operator, bool approved);/*** @dev Returns the number of NFTs in ``owner``'s account.*/function balanceOf(address owner) external view returns (uint256 balance);/*** @dev Returns the owner of the NFT specified by `tokenId`.*/function ownerOf(uint256 tokenId) external view returns (address owner);/*** @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to* another (`to`).*
12345678910111213141516171819202122pragma solidity ^0.6.0;/*** @dev Interface of the ERC165 standard, as defined in the* https://eips.ethereum.org/EIPS/eip-165[EIP].** Implementers can declare support of contract interfaces, which can then be* queried by others ({ERC165Checker}).** For an implementation, see {ERC165}.*/interface IERC165 {/*** @dev Returns true if this contract implements the interface defined by* `interfaceId`. See the corresponding* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]* to learn more about how these ids are created.** This function call must use less than 30 000 gas.*/function supportsInterface(bytes4 interfaceId) external view returns (bool);}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "./IERC20.sol";import "../../math/SafeMath.sol";import "../../utils/Address.sol";/*** @title SafeERC20* @dev Wrappers around ERC20 operations that throw on failure (when the token* contract returns false). Tokens that return no value (and instead revert or* throw on failure) are also supported, non-reverting calls are assumed to be* successful.* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.*/library SafeERC20 {using SafeMath for uint256;using Address for address;function safeTransfer(IERC20 token, address to, uint256 value) internal {_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));}function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Interface of the ERC20 standard as defined in the EIP.*/interface IERC20 {/*** @dev Returns the amount of tokens in existence.*/function totalSupply() external view returns (uint256);/*** @dev Returns the amount of tokens owned by `account`.*/function balanceOf(address account) external view returns (uint256);/*** @dev Moves `amount` tokens from the caller's account to `recipient`.** Returns a boolean value indicating whether the operation succeeded.** Emits a {Transfer} event.*/function transfer(address recipient, uint256 amount) external returns (bool);/**
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Wrappers over Solidity's arithmetic operations with added overflow* checks.** Arithmetic operations in Solidity wrap on overflow. This can easily result* in bugs, because programmers usually assume that an overflow raises an* error, which is the standard behavior in high level programming languages.* `SafeMath` restores this intuition by reverting the transaction when an* operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.*/library SafeMath {/*** @dev Returns the addition of two unsigned integers, reverting on* overflow.** Counterpart to Solidity's `+` operator.** Requirements:* - Addition cannot overflow.*/function add(uint256 a, uint256 b) internal pure returns (uint256) {
1234567891011121314151617181920212223242526pragma solidity ^0.6.2;/*** @dev Collection of functions related to the address type*/library Address {/*** @dev Returns true if `account` is a contract.** [IMPORTANT]* ====* It is unsafe to assume that an address for which this function returns* false is an externally-owned account (EOA) and not a contract.** Among others, `isContract` will return false for the following* types of addresses:** - an externally-owned account* - a contract in construction* - an address where a contract will be created* - an address where a contract lived, but was destroyed* ====*/function isContract(address account) internal view returns (bool) {// According to EIP-1052, 0x0 is the value returned for not-yet created accounts// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
1234567891011121314151617181920212223242526/**Copyright 2020 PoolTogether Inc.This file is part of PoolTogether.PoolTogether is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation under version 3 of the License.PoolTogether is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with PoolTogether. If not, see <https://www.gnu.org/licenses/>.*/pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";/*** @author Brendan Asselstine* @notice Provides basic fixed point math calculations.*
12345678// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;/// @title Interface that allows a user to draw an address using an indexinterface RegistryInterface {function lookup() external view returns (address);}
12345678// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;/// @title Interface that allows a user to draw an address using an indexinterface ReserveInterface {function reserveRateMantissa(address prizePool) external view returns (uint256);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";/// @title Defines the functions used to interact with a yield source. The Prize Pool inherits this contract./// @notice Prize Pools subclasses need to implement this interface so that yield can be generated.abstract contract YieldSource {/// @notice Determines whether the passed token can be transferred out as an external award./// @dev Different yield sources will hold the deposits as another kind of token: such a Compound's cToken. The/// prize strategy should not be allowed to move those tokens./// @param _externalToken The address of the token to check/// @return True if the token may be awarded, false otherwisefunction _canAwardExternal(address _externalToken) internal virtual view returns (bool);/// @notice Returns the ERC20 asset token used for deposits./// @return The ERC20 asset tokenfunction _token() internal virtual view returns (IERC20);/// @notice Returns the total balance (in asset tokens). This includes the deposits and interest./// @return The underlying balance of asset tokensfunction _balance() internal virtual returns (uint256);/// @notice Supplies asset tokens to the yield source./// @param mintAmount The amount of asset tokens to be supplied
1234567891011121314151617181920// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;/// @title An interface that allows a contract to listen to token mint, transfer and burn events.interface TokenListenerInterface {/// @notice Called when tokens are minted./// @param to The address of the receiver of the minted tokens./// @param amount The amount of tokens being minted/// @param controlledToken The address of the token that is being minted/// @param referrer The address that referred the minting.function beforeTokenMint(address to, uint256 amount, address controlledToken, address referrer) external;/// @notice Called when tokens are transferred or burned./// @param from The address of the sender of the token transfer/// @param to The address of the receiver of the token transfer. Will be the zero address if burning./// @param amount The amount of tokens transferred/// @param controlledToken The address of the token that was transferredfunction beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken) external;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";import "../utils/RelayRecipient.sol";import "./TokenControllerInterface.sol";/// @title Controlled ERC20 Token/// @notice ERC20 Tokens with a controller for minting & burningcontract ControlledToken is RelayRecipient, ERC20UpgradeSafe {/// @notice Interface to the contract responsible for controlling mint/burnTokenControllerInterface public controller;/// @notice Initializes the Controlled Token with Token Details and the Controller/// @param _name The name of the Token/// @param _symbol The symbol for the Token/// @param _decimals The number of decimals for the Token/// @param _trustedForwarder Address of the Forwarding Contract for GSN Meta-Txs/// @param _controller Address of the Controller contract for minting & burningfunction initialize(string memory _name,string memory _symbol,uint8 _decimals,
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "../../GSN/Context.sol";import "./IERC20.sol";import "../../math/SafeMath.sol";import "../../utils/Address.sol";import "../../Initializable.sol";/*** @dev Implementation of the {IERC20} interface.** This implementation is agnostic to the way tokens are created. This means* that a supply mechanism has to be added in a derived contract using {_mint}.* For a generic mechanism see {ERC20MinterPauser}.** TIP: For a detailed writeup see our guide* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How* to implement supply mechanisms].** We have followed general OpenZeppelin guidelines: functions revert instead* of returning `false` on failure. This behavior is nonetheless conventional* and does not conflict with the expectations of ERC20 applications.** Additionally, an {Approval} event is emitted on calls to {transferFrom}.* This allows applications to reconstruct the allowance for all accounts just* by listening to said events. Other implementations of the EIP may not emit
1234567891011// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@opengsn/gsn/contracts/BaseRelayRecipient.sol";contract RelayRecipient is BaseRelayRecipient {function versionRecipient() external override view returns (string memory) {return "2.0.0";}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier:MIT// solhint-disable no-inline-assemblypragma solidity ^0.6.2;import "./interfaces/IRelayRecipient.sol";/*** A base contract to be inherited by any contract that want to receive relayed transactions* A subclass must use "_msgSender()" instead of "msg.sender"*/abstract contract BaseRelayRecipient is IRelayRecipient {/** Forwarder singleton we accept calls from*/address public trustedForwarder;function isTrustedForwarder(address forwarder) public override view returns(bool) {return forwarder == trustedForwarder;}/*** return the sender of this call.* if the call came through our trusted forwarder, return the original sender.* otherwise, return `msg.sender`.* should be used in the contract anywhere instead of msg.sender
1234567891011121314151617181920212223242526// SPDX-License-Identifier:MITpragma solidity ^0.6.2;/*** a contract must implement this interface in order to support relayed transaction.* It is better to inherit the BaseRelayRecipient as its implementation.*/abstract contract IRelayRecipient {/*** return if the forwarder is trusted to forward relayed transactions to us.* the forwarder is required to verify the sender's signature, and verify* the call is not a replay.*/function isTrustedForwarder(address forwarder) public virtual view returns(bool);/*** return the sender of this call.* if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes* of the msg.data.* otherwise, return `msg.sender`* should be used in the contract anywhere instead of msg.sender*/function _msgSender() internal virtual view returns (address payable);/**
12345678910111213141516// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;/// @title Controlled ERC20 Token Interface/// @notice Required interface for Controlled ERC20 Tokens linked to a Prize Pool/// @dev Defines the spec required to be implemented by a Controlled ERC20 Tokeninterface TokenControllerInterface {/// @dev Controller hook to provide notifications & rule validations on token transfers to the controller./// This includes minting and burning./// @param from Address of the account sending the tokens (address(0x0) on minting)/// @param to Address of the account receiving the tokens (address(0x0) on burning)/// @param amount Amount of tokens being transferredfunction beforeTokenTransfer(address from, address to, uint256 amount) external;}
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;/// @notice An efficient implementation of a singly linked list of addresses/// @dev A mapping(address => address) tracks the 'next' pointer. A special address called the SENTINEL is used to denote the beginning and end ofthe list.library MappedSinglyLinkedList {/// @notice The special value address used to denote the end of the listaddress public constant SENTINEL = address(0x1);/// @notice The data structure to use for the list.struct Mapping {uint256 count;mapping(address => address) addressMap;}/// @notice Initializes the list./// @dev It is important that this is called so that the SENTINEL is correctly setup.function initialize(Mapping storage self) internal {require(self.count == 0, "Already init");self.addressMap[SENTINEL] = SENTINEL;}
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/IERC721.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";import "../external/pooltogether/FixedPoint.sol";import "../reserve/ReserveInterface.sol";import "./YieldSource.sol";import "../token/TokenListenerInterface.sol";import "../token/ControlledToken.sol";import "../token/TokenControllerInterface.sol";import "../utils/MappedSinglyLinkedList.sol";import "../utils/RelayRecipient.sol";/// @title Escrows assets and deposits them into a yield source. Exposes interest to Prize Strategy. Users deposit and withdraw from this contractto participate in Prize Pool./// @notice Accounting is managed using Controlled Tokens, whose mint and burn functions can only be called by this contract./// @dev Must be inherited to provide specific yield-bearing asset control, such as Compound cTokensinterface PrizePoolInterface {/// @notice Deposit assets into the Prize Pool in exchange for tokens
1234567891011121314151617// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "../PeriodicPrizeStrategy.sol";/* solium-disable security/no-block-members */contract SingleRandomWinner is PeriodicPrizeStrategy {function _distribute(uint256 randomNumber) internal override {uint256 prize = prizePool.captureAwardBalance();address winner = ticket.draw(randomNumber);if (winner != address(0)) {_awardTickets(winner, prize);_awardAllExternalTokens(winner);}}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "@openzeppelin/contracts-ethereum-package/contracts/introspection/IERC1820Registry.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";import "@pooltogether/pooltogether-rng-contracts/contracts/RNGInterface.sol";import "../token/TokenListenerInterface.sol";import "../external/pooltogether/FixedPoint.sol";import "../token/TokenControllerInterface.sol";import "../token/ControlledToken.sol";import "../token/TicketInterface.sol";import "../prize-pool/PrizePool.sol";import "../Constants.sol";import "../utils/RelayRecipient.sol";/* solium-disable security/no-block-members */abstract contract PeriodicPrizeStrategy is Initializable,OwnableUpgradeSafe,RelayRecipient,
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Interface of the global ERC1820 Registry, as defined in the* https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register* implementers for interfaces in this registry, as well as query support.** Implementers may be shared by multiple accounts, and can also implement more* than a single interface for each account. Contracts can implement interfaces* for themselves, but externally-owned accounts (EOA) must delegate this to a* contract.** {IERC165} interfaces can also be queried via the registry.** For an in-depth explanation and source code analysis, see the EIP text.*/interface IERC1820Registry {/*** @dev Sets `newManager` as the manager for `account`. A manager of an* account is able to set interface implementers for it.** By default, each account is its own manager. Passing a value of `0x0` in* `newManager` will reset the manager to this initial state.** Emits a {ManagerChanged} event.*
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0;/// @title Random Number Generator Interface/// @notice Provides an interface for requesting random numbers from 3rd-party RNG services (Chainlink VRF, Starkware VDF, etc..)interface RNGInterface {/// @notice Emitted when a new request for a random number has been submitted/// @param requestId The indexed ID of the request used to get the results of the RNG service/// @param sender The indexed address of the sender of the requestevent RandomNumberRequested(uint32 indexed requestId, address indexed sender);/// @notice Emitted when an existing request for a random number has been completed/// @param requestId The indexed ID of the request used to get the results of the RNG service/// @param randomNumber The random number produced by the 3rd-party serviceevent RandomNumberCompleted(uint32 indexed requestId, uint256 randomNumber);/// @notice Gets the last request id used by the RNG service/// @return requestId The last request id used in the last requestfunction getLastRequestId() external view returns (uint32 requestId);/// @notice Gets the Fee for making a Request against an RNG service/// @return feeToken The address of the token that is used to pay fees/// @return requestFee The fee required to be paid to make a requestfunction getRequestFee() external view returns (address feeToken, uint256 requestFee);
1234567891011// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;/// @title Interface that allows a user to draw an address using an indexinterface TicketInterface {/// @notice Selects a user using a random number. The random number will be uniformly bounded to the ticket totalSupply./// @param randomNumber The random number to use to select a user./// @return The winnerfunction draw(uint256 randomNumber) external view returns (address);}
12345678910111213141516171819pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/introspection/IERC1820Registry.sol";library Constants {IERC1820Registry public constant REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);// keccak256("ERC777TokensSender")bytes32 public constant TOKENS_SENDER_INTERFACE_HASH =0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895;// keccak256("ERC777TokensRecipient")bytes32 public constant TOKENS_RECIPIENT_INTERFACE_HASH =0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b;// keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));bytes32 public constant ACCEPT_MAGIC =0xa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "@pooltogether/pooltogether-rng-contracts/contracts/RNGInterface.sol";import "../token/TokenListenerInterface.sol";import "../prize-pool/PrizePool.sol";import "../prize-strategy/single-random-winner/SingleRandomWinnerProxyFactory.sol";import "../token/ControlledTokenProxyFactory.sol";import "../token/TicketProxyFactory.sol";import "../external/openzeppelin/OpenZeppelinProxyFactoryInterface.sol";/* solium-disable security/no-block-members */contract SingleRandomWinnerBuilder {using SafeCast for uint256;event SingleRandomWinnerCreated (address indexed singleRandomWinner,address indexed ticket,address indexed sponsorship);struct SingleRandomWinnerConfig {RNGInterface rngService;uint256 prizePeriodStart;
12345678910111213141516171819// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "./SingleRandomWinner.sol";import "../../external/openzeppelin/ProxyFactory.sol";contract SingleRandomWinnerProxyFactory is ProxyFactory {SingleRandomWinner public instance;constructor () public {instance = new SingleRandomWinner();}function create() external returns (SingleRandomWinner) {return SingleRandomWinner(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;// solium-disable security/no-inline-assembly// solium-disable security/no-low-level-callscontract ProxyFactory {event ProxyCreated(address proxy);function deployMinimal(address _logic, bytes memory _data) public returns (address proxy) {// Adapted from https://github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.solbytes20 targetBytes = bytes20(_logic);assembly {let clone := mload(0x40)mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)mstore(add(clone, 0x14), targetBytes)mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)proxy := create(0, clone, 0x37)}emit ProxyCreated(address(proxy));if(_data.length > 0) {(bool success,) = proxy.call(_data);require(success, "ProxyFactory/constructor-call-failed");}}
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "./ControlledToken.sol";import "../external/openzeppelin/ProxyFactory.sol";/// @title Controlled ERC20 Token Factory/// @notice Minimal proxy pattern for creating new Controlled ERC20 Tokenscontract ControlledTokenProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied tokensControlledToken public instance;/// @notice Initializes the Factory with an instance of the Controlled ERC20 Tokenconstructor () public {instance = new ControlledToken();}/// @notice Creates a new Controlled ERC20 Token as a proxy of the template instance/// @return A reference to the new proxied Controlled ERC20 Tokenfunction create() external returns (ControlledToken) {return ControlledToken(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";import "./Ticket.sol";import "../external/openzeppelin/ProxyFactory.sol";/// @title Controlled ERC20 Token Factory/// @notice Minimal proxy pattern for creating new Controlled ERC20 Tokenscontract TicketProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied tokensTicket public instance;/// @notice Initializes the Factory with an instance of the Controlled ERC20 Tokenconstructor () public {instance = new Ticket();}/// @notice Creates a new Controlled ERC20 Token as a proxy of the template instance/// @return A reference to the new proxied Controlled ERC20 Tokenfunction create() external returns (Ticket) {return Ticket(deployMinimal(address(instance), ""));}
12345678910111213141516171819202122232425/*** @reviewers: [@clesaege, @unknownunknown1, @ferittuncer]* @auditors: []* @bounties: [<14 days 10 ETH max payout>]* @deployments: []*/pragma solidity ^0.6.0;/*** @title SortitionSumTreeFactory* @author Enrique Piqueras - <epiquerass@gmail.com>* @dev A factory of trees that keep track of staked values for sortition.*/library SortitionSumTreeFactory {/* Structs */struct SortitionSumTree {uint K; // The maximum number of childs per node.// We use this to keep track of vacant positions in the tree after removing a leaf. This is for keeping the tree as balanced as possiblewithout spending gas on moving nodes around.uint[] stack;uint[] nodes;// Two-way mapping of IDs to node indexes. Note that node index 0 is reserved for the root node, and means the ID does not have a node.mapping(bytes32 => uint) IDsToNodeIndexes;mapping(uint => bytes32) nodeIndexesToIDs;
1234567891011121314151617181920212223242526/**Copyright 2019 PoolTogether LLCThis file is part of PoolTogether.PoolTogether is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation under version 3 of the License.PoolTogether is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with PoolTogether. If not, see <https://www.gnu.org/licenses/>.*/pragma solidity ^0.6.0;/*** @author Brendan Asselstine* @notice A library that uses entropy to select a random number within a bound. Compensates for modulo bias.* @dev Thanks to https://medium.com/hownetworks/dont-waste-cycles-with-modulo-bias-35b6fdafcf94*/library UniformRandomNumber {
123456pragma solidity >=0.6.0 <0.7.0;interface OpenZeppelinProxyFactoryInterface {function deploy(uint256 _salt, address _logic, address _admin, bytes calldata _data) external returns (address);function getDeploymentAddress(uint256 _salt, address _sender) external view returns (address);}
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "./CompoundPrizePool.sol";import "../../external/openzeppelin/ProxyFactory.sol";/// @title Compound Prize Pool Proxy Factory/// @notice Minimal proxy pattern for creating new Compound Prize Poolscontract CompoundPrizePoolProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied Prize PoolsCompoundPrizePool public instance;/// @notice Initializes the Factory with an instance of the Compound Prize Poolconstructor () public {instance = new CompoundPrizePool();}/// @notice Creates a new Compound Prize Pool as a proxy of the template instance/// @return A reference to the new proxied Compound Prize Poolfunction create() external returns (CompoundPrizePool) {return CompoundPrizePool(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "../../external/pooltogether/FixedPoint.sol";import "../../external/compound/CTokenInterface.sol";import "../PrizePool.sol";/// @title Prize Pool with Compound's cToken/// @notice Manages depositing and withdrawing assets from the Prize Poolcontract CompoundPrizePool is PrizePool {using SafeMath for uint256;event CompoundPrizePoolInitialized(address indexed cToken);/// @notice Interface for the Yield-bearing cToken by CompoundCTokenInterface public cToken;/// @notice Initializes the Prize Pool and Yield Service with the required contract connections/// @param _trustedForwarder Address of the Forwarding Contract for GSN Meta-Txs/// @param _controlledTokens Array of addresses for the Ticket and Sponsorship Tokens controlled by the Prize Pool/// @param _maxExitFeeMantissa The maximum exit fee size, relative to the withdrawal amount
123456789101112131415pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";interface CTokenInterface is IERC20 {function decimals() external view returns (uint8);function totalSupply() external override view returns (uint256);function underlying() external view returns (address);function balanceOfUnderlying(address owner) external returns (uint256);function supplyRatePerBlock() external returns (uint256);function exchangeRateCurrent() external returns (uint256);function mint(uint256 mintAmount) external returns (uint256);function balanceOf(address user) external override view returns (uint256);function redeemUnderlying(uint256 redeemAmount) external returns (uint256);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "../token/ControlledTokenProxyFactory.sol";import "../token/TicketProxyFactory.sol";/* solium-disable security/no-block-members */contract ControlledTokenBuilder {event CreatedControlledToken(address indexed token);event CreatedTicket(address indexed token);address public trustedForwarder;ControlledTokenProxyFactory public controlledTokenProxyFactory;TicketProxyFactory public ticketProxyFactory;struct ControlledTokenConfig {string name;string symbol;uint8 decimals;TokenControllerInterface controller;}constructor (
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "./PrizePoolBuilder.sol";import "../registry/RegistryInterface.sol";import "./SingleRandomWinnerBuilder.sol";import "../prize-pool/stake/StakePrizePoolProxyFactory.sol";/* solium-disable security/no-block-members */contract StakePrizePoolBuilder is PrizePoolBuilder {using SafeMath for uint256;using SafeCast for uint256;struct StakePrizePoolConfig {IERC20 token;uint256 maxExitFeeMantissa;uint256 maxTimelockDuration;}RegistryInterface public reserveRegistry;StakePrizePoolProxyFactory public stakePrizePoolProxyFactory;SingleRandomWinnerBuilder public singleRandomWinnerBuilder;address public trustedForwarder;
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "./StakePrizePool.sol";import "../../external/openzeppelin/ProxyFactory.sol";/// @title Stake Prize Pool Proxy Factory/// @notice Minimal proxy pattern for creating new yVault Prize Poolscontract StakePrizePoolProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied Prize PoolsStakePrizePool public instance;/// @notice Initializes the Factory with an instance of the yVault Prize Poolconstructor () public {instance = new StakePrizePool();}/// @notice Creates a new Stake Prize Pool as a proxy of the template instance/// @return A reference to the new proxied Stake Prize Poolfunction create() external returns (StakePrizePool) {return StakePrizePool(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "../PrizePool.sol";contract StakePrizePool is PrizePool {IERC20 private stakeToken;event StakePrizePoolInitialized(address indexed stakeToken);/// @notice Initializes the Prize Pool and Yield Service with the required contract connections/// @param _trustedForwarder Address of the Forwarding Contract for GSN Meta-Txs/// @param _controlledTokens Array of addresses for the Ticket and Sponsorship Tokens controlled by the Prize Pool/// @param _maxExitFeeMantissa The maximum exit fee size, relative to the withdrawal amount/// @param _maxTimelockDuration The maximum length of time the withdraw timelock could be/// @param _stakeToken Address of the stake tokenfunction initialize (address _trustedForwarder,RegistryInterface _reserveRegistry,address[] memory _controlledTokens,uint256 _maxExitFeeMantissa,uint256 _maxTimelockDuration,
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "../registry/RegistryInterface.sol";import "./SingleRandomWinnerBuilder.sol";import "./PrizePoolBuilder.sol";import "../prize-strategy/single-random-winner/SingleRandomWinnerProxyFactory.sol";import "../prize-pool/yearn/yVaultPrizePoolProxyFactory.sol";import "../token/ControlledTokenProxyFactory.sol";import "../token/TicketProxyFactory.sol";import "../external/yearn/yVaultInterface.sol";import "../external/openzeppelin/OpenZeppelinProxyFactoryInterface.sol";/* solium-disable security/no-block-members */contract yVaultPrizePoolBuilder is PrizePoolBuilder {using SafeMath for uint256;using SafeCast for uint256;struct yVaultPrizePoolConfig {yVaultInterface vault;uint256 reserveRateMantissa;uint256 maxExitFeeMantissa;uint256 maxTimelockDuration;}
12345678910111213141516171819202122232425// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "./yVaultPrizePool.sol";import "../../external/openzeppelin/ProxyFactory.sol";/// @title yVault Prize Pool Proxy Factory/// @notice Minimal proxy pattern for creating new yVault Prize Poolscontract yVaultPrizePoolProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied Prize PoolsyVaultPrizePool public instance;/// @notice Initializes the Factory with an instance of the yVault Prize Poolconstructor () public {instance = new yVaultPrizePool();}/// @notice Creates a new yVault Prize Pool as a proxy of the template instance/// @return A reference to the new proxied yVault Prize Poolfunction create() external returns (yVaultPrizePool) {return yVaultPrizePool(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "../../external/yearn/yVaultInterface.sol";import "../PrizePool.sol";/// @title Prize Pool for yEarn's yVaultscontract yVaultPrizePool is PrizePool {using SafeMath for uint256;event yVaultPrizePoolInitialized(address indexed vault);event ReserveRateMantissaSet(uint256 reserveRateMantissa);/// @notice Interface for the yEarn yVaultyVaultInterface public vault;/// Amount that is never exposed to the prizeuint256 public reserveRateMantissa;/// @notice Initializes the Prize Pool and Yield Service with the required contract connections/// @param _trustedForwarder Address of the Forwarding Contract for GSN Meta-Txs
123456789101112131415pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";interface yVaultInterface is IERC20 {function token() external view returns (address);function balance() external view returns (uint);function deposit(uint _amount) external;function withdraw(uint _shares) external;function getPricePerFullShare() external view returns (uint);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "../utils/UInt256Array.sol";import "./ComptrollerStorage.sol";import "../token/TokenListenerInterface.sol";/// @title The Comptroller disburses rewards to pool users/* solium-disable security/no-block-members */contract Comptroller is ComptrollerStorage, TokenListenerInterface {using SafeMath for uint256;using SafeCast for uint256;using UInt256Array for uint256[];using ExtendedSafeCast for uint256;using BalanceDrip for BalanceDrip.State;using VolumeDrip for VolumeDrip.State;using BalanceDripManager for BalanceDripManager.State;using VolumeDripManager for VolumeDripManager.State;using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping;/// @notice Emitted when a balance drip is activedevent BalanceDripActivated(
123456789101112// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;library UInt256Array {function remove(uint256[] storage self, uint256 index) internal {require(index < self.length, "UInt256Array/unknown-index");self[index] = self[self.length-1];delete self[self.length-1];self.pop();}}
1234567891011121314151617// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "../drip/BalanceDripManager.sol";import "../drip/VolumeDripManager.sol";contract ComptrollerStorage is OwnableUpgradeSafe {mapping(address => VolumeDripManager.State) internal volumeDrips;mapping(address => VolumeDripManager.State) internal referralVolumeDrips;mapping(address => BalanceDripManager.State) internal balanceDrips;mapping(address => uint256) internal dripTokenTotalSupply;mapping(address => mapping(address => uint256)) internal dripTokenBalances;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "../utils/MappedSinglyLinkedList.sol";import "./BalanceDrip.sol";/// @title Manages the lifecycle of a set of Balance Drips.library BalanceDripManager {using SafeMath for uint256;using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping;using BalanceDrip for BalanceDrip.State;struct State {mapping(address => MappedSinglyLinkedList.Mapping) activeBalanceDrips;mapping(address => mapping(address => BalanceDrip.State)) balanceDrips;}/// @notice Activates a drip by setting it's state and adding it to the active balance drips list./// @param self The BalanceDripManager state/// @param measure The measure token/// @param dripToken The drip token/// @param dripRatePerSecond The amount of the drip token to be dripped per secondfunction activateDrip(
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "../utils/ExtendedSafeCast.sol";import "../external/pooltogether/FixedPoint.sol";/// @title Calculates a users share of a token faucet./// @notice The tokens are dripped at a "drip rate per second". This is the number of tokens that/// are dripped each second to the entire supply of a "measure" token. A user's share of ownership/// of the measure token corresponds to the share of the drip tokens per second.library BalanceDrip {using SafeMath for uint256;using SafeCast for uint256;using ExtendedSafeCast for uint256;struct UserState {uint128 lastExchangeRateMantissa;}struct State {uint256 dripRatePerSecond;uint112 exchangeRateMantissa;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;library ExtendedSafeCast {/*** @dev Converts an unsigned uint256 into a unsigned uint112.** Requirements:** - input must be less than or equal to maxUint112.*/function toUint112(uint256 value) internal pure returns (uint112) {require(value < 2**112, "SafeCast: value doesn't fit in an uint112");return uint112(value);}/*** @dev Converts an unsigned uint256 into a unsigned uint96.** Requirements:** - input must be less than or equal to maxUint96.*/function toUint96(uint256 value) internal pure returns (uint96) {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";import "../utils/MappedSinglyLinkedList.sol";import "./VolumeDrip.sol";/// @title Manages the active set of Volume Drips.library VolumeDripManager {using SafeMath for uint256;using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping;using VolumeDrip for VolumeDrip.State;struct State {mapping(address => MappedSinglyLinkedList.Mapping) activeVolumeDrips;mapping(address => mapping(address => VolumeDrip.State)) volumeDrips;}/// @notice Activates a volume drip for the given (measure,dripToken) pair./// @param self The VolumeDripManager state/// @param measure The measure token/// @param dripToken The drip token/// @param periodSeconds The period of the volume drip in seconds/// @param dripAmount The amount of tokens to drip each period
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";import "@openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol";import "../external/pooltogether/FixedPoint.sol";import "../utils/ExtendedSafeCast.sol";library VolumeDrip {using SafeMath for uint256;using SafeCast for uint256;using ExtendedSafeCast for uint256;struct Deposit {uint112 balance;uint32 period;}struct Period {uint112 totalSupply;uint112 dripAmount;uint32 endTime;}
12345678910111213141516171819202122// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "../prize-pool/PrizePool.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";contract CounterfactualAction {function depositTo(address payable user, PrizePool prizePool, address output, address referrer) external {IERC20 token = prizePool.token();uint256 amount = token.balanceOf(address(this));token.approve(address(prizePool), amount);prizePool.depositTo(user, amount, output, referrer);selfdestruct(user);}function cancel(address payable user, PrizePool prizePool) external {IERC20 token = prizePool.token();token.transfer(user, token.balanceOf(address(this)));selfdestruct(user);}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/utils/Create2.sol";import "./CounterfactualAction.sol";import "../utils/MinimalProxyLibrary.sol";contract CounterfactualActionFactory {CounterfactualAction public depositor;PrizePool public prizePool;function initialize(PrizePool _prizePool) external {require(address(_prizePool) != address(0), "CounterfactualActionFactory/prize-pool-not-zero");depositor = new CounterfactualAction();prizePool = _prizePool;}function calculateAddress(address payable user) external view returns (address) {return Create2.computeAddress(salt(user), keccak256(MinimalProxyLibrary.minimalProxy(address(depositor))));}function depositTo(address payable user, address token, address referrer) external {CounterfactualAction d = newAction(user);d.depositTo(user, prizePool, token, referrer);
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.* `CREATE2` can be used to compute in advance the address where a smart* contract will be deployed, which allows for interesting new mechanisms known* as 'counterfactual interactions'.** See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more* information.*/library Create2 {/*** @dev Deploys a contract using `CREATE2`. The address where the contract* will be deployed can be known in advance via {computeAddress}.** The bytecode for a contract can be obtained from Solidity with* `type(contractName).creationCode`.** Requirements:** - `bytecode` must not be empty.* - `salt` must have not been used for `bytecode` already.* - the factory must have a balance of at least `amount`.* - if `amount` is non-zero, `bytecode` must have a `payable` constructor.*/
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.6.0 <0.7.0;// solium-disable security/no-inline-assemblylibrary MinimalProxyLibrary {function minimalProxy(address _logic) internal pure returns (bytes memory clone) {// Adapted from https://github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.solbytes20 targetBytes = bytes20(_logic);// solhint-disable-next-line no-inline-assemblyassembly {let size := 0x37// allocate output byte array - this could also be done without assembly// by using clone = new bytes(size)clone := mload(0x40)// new "memory end" including paddingmstore(0x40, add(clone, and(add(add(size, 0x20), 0x1f), not(0x1f))))// store length in memorymstore(clone, size)mstore(add(clone, 0x20), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)mstore(add(clone, 0x34), targetBytes)mstore(add(clone, 0x48), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)}}}
1234567891011// SPDX-License-Identifier: GPL-3.0pragma solidity ^0.6.12;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";interface DaiInterface is IERC20 {// --- Approve by signature ---function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external;function transferFrom(address src, address dst, uint wad) external override returns (bool);}
123456pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "@opengsn/gsn/contracts/forwarder/Forwarder.sol";contract TrustedForwarder is Forwarder {}
1234567891011121314151617181920212223242526// SPDX-License-Identifier:MITpragma solidity ^0.6.2;pragma experimental ABIEncoderV2;import "@openzeppelin/contracts/cryptography/ECDSA.sol";import "./IForwarder.sol";contract Forwarder is IForwarder {using ECDSA for bytes32;string public constant GENERIC_PARAMS = "address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data";string public constant EIP712_DOMAIN_TYPE = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)";mapping(bytes32 => bool) public typeHashes;mapping(bytes32 => bool) public domains;// Nonces of senders, used to prevent replay attacksmapping(address => uint256) private nonces;// solhint-disable-next-line no-empty-blocksreceive() external payable {}function getNonce(address from)public view overridereturns (uint256) {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity ^0.6.0;/*** @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.** These functions can be used to verify that a message was signed by the holder* of the private keys of a given address.*/library ECDSA {/*** @dev Returns the address that signed a hashed message (`hash`) with* `signature`. This address can then be used for verification purposes.** The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:* this function rejects them by requiring the `s` value to be in the lower* half order, and the `v` value to be either 27 or 28.** IMPORTANT: `hash` _must_ be the result of a hash operation for the* verification to be secure: it is possible to craft signatures that* recover to arbitrary addresses for non-hashed data. A safe way to ensure* this is by receiving a hash of the original message (which may otherwise* be too long), and then calling {toEthSignedMessageHash} on it.*/function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
1234567891011121314151617181920212223242526// SPDX-License-Identifier:MITpragma solidity ^0.6.2;pragma experimental ABIEncoderV2;interface IForwarder {struct ForwardRequest {address from;address to;uint256 value;uint256 gas;uint256 nonce;bytes data;}function getNonce(address from)external viewreturns(uint256);/*** verify the transaction would execute.* validate the signature and the nonce of the request.* revert if either signature or nonce are incorrect.*/function verify(ForwardRequest calldata forwardRequest,
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity ^0.6.12;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";import "../external/maker/DaiInterface.sol";import "../prize-pool/PrizePoolInterface.sol";/// @title Allows users to approve and deposit dai into a prize pool in a single transaction.contract PermitAndDepositDai {using SafeERC20 for DaiInterface;/// @notice Permits this contract to spend on a users behalf, and deposits into the prize pool./// @dev The Dai permit params match the Dai#permit function, but it expects the `spender` to be/// the address of this contract./// @param holder The address spending the tokens/// @param nonce The nonce of the tx. Should be retrieved from the Dai token/// @param expiry The timestamp at which the sig expires/// @param allowed If true, then the spender is approving holder the max allowance. False makes the allowance zero./// @param v The `v` portion of the signature./// @param r The `r` portion of the signature./// @param s The `s` portion of the signature./// @param prizePool The prize pool to deposit into/// @param to The address that will receive the controlled tokens/// @param amount The amount to deposit
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "./RegistryInterface.sol";/// @title Interface that allows a user to draw an address using an indexcontract Registry is OwnableUpgradeSafe, RegistryInterface {address private pointer;event Registered(address indexed pointer);constructor () public {__Ownable_init();}function register(address _pointer) external onlyOwner {pointer = _pointer;emit Registered(pointer);}function lookup() external override view returns (address) {return pointer;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity >=0.5.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";import "./ReserveInterface.sol";import "../prize-pool/PrizePoolInterface.sol";/// @title Interface that allows a user to draw an address using an indexcontract Reserve is OwnableUpgradeSafe, ReserveInterface {event ReserveRateMantissaSet(uint256 rateMantissa);uint256 public rateMantissa;constructor () public {__Ownable_init();}function setRateMantissa(uint256 _rateMantissa)externalonlyOwner{
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../drip/BalanceDrip.sol";contract BalanceDripExposed {using BalanceDrip for BalanceDrip.State;event DrippedTotalSupply(uint256 newTokens);event Dripped(address indexed user,uint256 newTokens);BalanceDrip.State internal dripState;function setDripRate(uint256 dripRatePerSecond) external {dripState.dripRatePerSecond = dripRatePerSecond;}function drip(uint256 measureTotalSupply,
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../drip/BalanceDripManager.sol";contract BalanceDripManagerExposed {using BalanceDripManager for BalanceDripManager.State;BalanceDripManager.State dripManager;function activateDrip(address measure, address dripToken, uint256 dripRatePerSecond) external {dripManager.activateDrip(measure, dripToken, dripRatePerSecond);}function deactivateDrip(address measure, address prevDripToken, address dripToken, uint32 currentTime, uint256 maxNewTokens) external {dripManager.deactivateDrip(measure, prevDripToken, dripToken, currentTime, maxNewTokens);}function isDripActive(address measure, address dripToken) external view returns (bool) {return dripManager.isDripActive(measure, dripToken);}function setDripRate(address measure, address dripToken, uint256 dripRatePerSecond, uint32 currentTime, uint256 maxNewTokens) external {dripManager.setDripRate(measure, dripToken, dripRatePerSecond, currentTime, maxNewTokens);}function getActiveBalanceDrips(address measure) external view returns (address[] memory) {
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../prize-pool/compound/CompoundPrizePool.sol";/* solium-disable security/no-block-members */contract CompoundPrizePoolHarness is CompoundPrizePool {uint256 public currentTime;function setCurrentTime(uint256 _currentTime) external {currentTime = _currentTime;}function setTimelockBalance(uint256 _timelockBalance) external {timelockTotalSupply = _timelockBalance;}function _currentTime() internal override view returns (uint256) {return currentTime;}function supply(uint256 mintAmount) external {_supply(mintAmount);}function redeem(uint256 redeemAmount) external returns (uint256) {
1234567891011121314151617181920212223pragma solidity >=0.6.0 <0.7.0;import "./CompoundPrizePoolHarness.sol";import "../external/openzeppelin/ProxyFactory.sol";/// @title Compound Prize Pool Proxy Factory/// @notice Minimal proxy pattern for creating new Compound Prize Poolscontract CompoundPrizePoolHarnessProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied Prize PoolsCompoundPrizePoolHarness public instance;/// @notice Initializes the Factory with an instance of the Compound Prize Poolconstructor () public {instance = new CompoundPrizePoolHarness();}/// @notice Creates a new Compound Prize Pool as a proxy of the template instance/// @return A reference to the new proxied Compound Prize Poolfunction create() external returns (CompoundPrizePoolHarness) {return CompoundPrizePoolHarness(deployMinimal(address(instance), ""));}}
12345678910111213141516171819pragma solidity >=0.6.0 <0.7.0;pragma experimental ABIEncoderV2;import "../comptroller/Comptroller.sol";/* solium-disable security/no-block-members */contract ComptrollerHarness is Comptroller {uint256 internal time;function setCurrentTime(uint256 _time) external {time = _time;}function _currentTime() internal override view returns (uint256) {return time;}}
1234567891011121314151617181920212223242526/**Copyright 2019 PoolTogether LLCThis file is part of PoolTogether.PoolTogether is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation under version 3 of the License.PoolTogether is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with PoolTogether. If not, see <https://www.gnu.org/licenses/>.*/pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";import "../external/pooltogether/FixedPoint.sol";import "./ERC20Mintable.sol";contract CTokenMock is ERC20UpgradeSafe {
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";/*** @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole},* which have permission to mint (create) new tokens as they see fit.** At construction, the deployer of the contract is the only minter.*/contract ERC20Mintable is ERC20UpgradeSafe {constructor(string memory _name, string memory _symbol) public {__ERC20_init(_name, _symbol);}/*** @dev See {ERC20-_mint}.** Requirements:** - the caller must have the {MinterRole}.*/function mint(address account, uint256 amount) public returns (bool) {_mint(account, amount);return true;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: GPL-3.0pragma solidity ^0.6.12;import "@openzeppelin/contracts/math/SafeMath.sol";import "@openzeppelin/contracts/utils/Address.sol";import "../external/maker/DaiInterface.sol";contract Dai is DaiInterface {using SafeMath for uint256;using Address for address;mapping (address => uint256) private _balances;mapping (address => mapping (address => uint256)) private _allowances;uint256 private _totalSupply;string private _name;string private _symbol;uint8 private _decimals;/*** @dev Sets the values for {name} and {symbol}, initializes {decimals} with* a default value of 18.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity ^0.6.0;/*** @dev Wrappers over Solidity's arithmetic operations with added overflow* checks.** Arithmetic operations in Solidity wrap on overflow. This can easily result* in bugs, because programmers usually assume that an overflow raises an* error, which is the standard behavior in high level programming languages.* `SafeMath` restores this intuition by reverting the transaction when an* operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.*/library SafeMath {/*** @dev Returns the addition of two unsigned integers, reverting on* overflow.** Counterpart to Solidity's `+` operator.** Requirements:*
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity ^0.6.2;/*** @dev Collection of functions related to the address type*/library Address {/*** @dev Returns true if `account` is a contract.** [IMPORTANT]* ====* It is unsafe to assume that an address for which this function returns* false is an externally-owned account (EOA) and not a contract.** Among others, `isContract` will return false for the following* types of addresses:** - an externally-owned account* - a contract in construction* - an address where a contract will be created* - an address where a contract lived, but was destroyed* ====*/function isContract(address account) internal view returns (bool) {
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;/* solium-disable security/no-inline-assembly */contract DoppelgangerWithExec {struct MockCall {bool initialized;bool reverts;bytes returnValue;}mapping(bytes32 => MockCall) mockConfig;fallback() external payable {MockCall storage mockCall = __internal__getMockCall();if (mockCall.reverts == true) {__internal__mockRevert();return;}__internal__mockReturn(mockCall.returnValue);}function __waffle__mockReverts(bytes memory data) public {mockConfig[keccak256(data)] = MockCall({initialized: true,reverts: true,returnValue: ""
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/introspection/IERC1820Implementer.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC777/IERC777Recipient.sol";import "../Constants.sol";contract ERC1820ImplementerMock is IERC1820Implementer, IERC777Recipient {constructor () public {Constants.REGISTRY.setInterfaceImplementer(address(this), Constants.TOKENS_RECIPIENT_INTERFACE_HASH, address(this));}function canImplementInterfaceForAddress(bytes32, address) external view virtual override returns(bytes32) {return Constants.ACCEPT_MAGIC;}function tokensReceived(address operator,address from,address to,uint256 amount,bytes calldata userData,bytes calldata operatorData) external override {}
1234567891011121314151617pragma solidity ^0.6.0;/*** @dev Interface for an ERC1820 implementer, as defined in the* https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP].* Used by contracts that will be registered as implementers in the* {IERC1820Registry}.*/interface IERC1820Implementer {/*** @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract* implements `interfaceHash` for `account`.** See {IERC1820Registry-setInterfaceImplementer}.*/function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32);}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.** Accounts can be notified of {IERC777} tokens being sent to them by having a* contract implement this interface (contract holders can be their own* implementer) and registering it on the* https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].** See {IERC1820Registry} and {ERC1820Implementer}.*/interface IERC777Recipient {/*** @dev Called by an {IERC777} token contract whenever tokens are being* moved or created into a registered account (`to`). The type of operation* is conveyed by `from` being the zero address or not.** This call occurs _after_ the token contract's state is updated, so* {IERC777-balanceOf}, etc., can be used to query the post-operation state.** This function may revert to prevent the operation from being executed.*/function tokensReceived(address operator,address from,
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721.sol";/*** @dev Extension of {ERC721} for Minting/Burning*/contract ERC721Mintable is ERC721UpgradeSafe {constructor () public {__ERC721_init("ERC 721", "NFT");}/*** @dev See {ERC721-_mint}.*/function mint(address to, uint256 tokenId) public {_mint(to, tokenId);}/*** @dev See {ERC721-_burn}.*/function burn(uint256 tokenId) public {_burn(tokenId);}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "../../GSN/Context.sol";import "./IERC721.sol";import "./IERC721Metadata.sol";import "./IERC721Enumerable.sol";import "./IERC721Receiver.sol";import "../../introspection/ERC165.sol";import "../../math/SafeMath.sol";import "../../utils/Address.sol";import "../../utils/EnumerableSet.sol";import "../../utils/EnumerableMap.sol";import "../../utils/Strings.sol";import "../../Initializable.sol";/*** @title ERC721 Non-Fungible Token Standard basic implementation* @dev see https://eips.ethereum.org/EIPS/eip-721*/contract ERC721UpgradeSafe is Initializable, ContextUpgradeSafe, ERC165UpgradeSafe, IERC721, IERC721Metadata, IERC721Enumerable {using SafeMath for uint256;using Address for address;using EnumerableSet for EnumerableSet.UintSet;using EnumerableMap for EnumerableMap.UintToAddressMap;using Strings for uint256;
12345678910111213pragma solidity ^0.6.2;import "./IERC721.sol";/*** @title ERC-721 Non-Fungible Token Standard, optional metadata extension* @dev See https://eips.ethereum.org/EIPS/eip-721*/interface IERC721Metadata is IERC721 {function name() external view returns (string memory);function symbol() external view returns (string memory);function tokenURI(uint256 tokenId) external view returns (string memory);}
1234567891011121314pragma solidity ^0.6.2;import "./IERC721.sol";/*** @title ERC-721 Non-Fungible Token Standard, optional enumeration extension* @dev See https://eips.ethereum.org/EIPS/eip-721*/interface IERC721Enumerable is IERC721 {function totalSupply() external view returns (uint256);function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);function tokenByIndex(uint256 index) external view returns (uint256);}
12345678910111213141516171819202122232425pragma solidity ^0.6.0;/*** @title ERC721 token receiver interface* @dev Interface for any contract that wants to support safeTransfers* from ERC721 asset contracts.*/interface IERC721Receiver {/*** @notice Handle the receipt of an NFT* @dev The ERC721 smart contract calls this function on the recipient* after a {IERC721-safeTransferFrom}. This function MUST return the function selector,* otherwise the caller will revert the transaction. The selector to be* returned can be obtained as `this.onERC721Received.selector`. This* function MAY throw to revert and reject the transfer.* Note: the ERC721 contract address is always the message sender.* @param operator The address which called `safeTransferFrom` function* @param from The address which previously owned the token* @param tokenId The NFT identifier which is being transferred* @param data Additional data with no specified format* @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`*/function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)external returns (bytes4);}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;import "./IERC165.sol";import "../Initializable.sol";/*** @dev Implementation of the {IERC165} interface.** Contracts may inherit from this and call {_registerInterface} to declare* their support of an interface.*/contract ERC165UpgradeSafe is Initializable, IERC165 {/** bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7*/bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;/*** @dev Mapping of interface ids to whether or not it's supported.*/mapping(bytes4 => bool) private _supportedInterfaces;function __ERC165_init() internal initializer {__ERC165_init_unchained();}
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Library for managing* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive* types.** Sets have the following properties:** - Elements are added, removed, and checked for existence in constant time* (O(1)).* - Elements are enumerated in O(n). No guarantees are made on the ordering.** ```* contract Example {* // Add the library methods* using EnumerableSet for EnumerableSet.AddressSet;** // Declare a set state variable* EnumerableSet.AddressSet private mySet;* }* ```** As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`* (`UintSet`) are supported.*/
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev Library for managing an enumerable variant of Solidity's* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]* type.** Maps have the following properties:** - Entries are added, removed, and checked for existence in constant time* (O(1)).* - Entries are enumerated in O(n). No guarantees are made on the ordering.** ```* contract Example {* // Add the library methods* using EnumerableMap for EnumerableMap.UintToAddressMap;** // Declare a set state variable* EnumerableMap.UintToAddressMap private myMap;* }* ```** As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are* supported.*/
1234567891011121314151617181920212223242526pragma solidity ^0.6.0;/*** @dev String operations.*/library Strings {/*** @dev Converts a `uint256` to its ASCII `string` representation.*/function toString(uint256 value) internal pure returns (string memory) {// Inspired by OraclizeAPI's implementation - MIT licence// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.solif (value == 0) {return "0";}uint256 temp = value;uint256 digits;while (temp != 0) {digits++;temp /= 10;}bytes memory buffer = new bytes(digits);uint256 index = digits - 1;temp = value;while (temp != 0) {
123456789101112pragma solidity >=0.6.0 <0.7.0;import "../utils/ExtendedSafeCast.sol";contract ExtendedSafeCastExposed {function toUint112(uint256 value) external pure returns (uint112) {return ExtendedSafeCast.toUint112(value);}function toUint96(uint256 value) external pure returns (uint96) {return ExtendedSafeCast.toUint96(value);}}
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../utils/MappedSinglyLinkedList.sol";contract MappedSinglyLinkedListExposed {using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping;MappedSinglyLinkedList.Mapping list;function initialize() external {list.initialize();}function addressArray() external view returns (address[] memory) {return list.addressArray();}function addAddresses(address[] calldata addresses) external {list.addAddresses(addresses);}function addAddress(address newAddress) external {list.addAddress(newAddress);}function removeAddress(address prevAddress, address addr) external {
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../prize-pool/PrizePool.sol";import "./YieldSourceStub.sol";contract PrizePoolHarness is PrizePool {uint256 public currentTime;YieldSourceStub stubYieldSource;function initializeAll(address _trustedForwarder,RegistryInterface _reserveRegistry,address[] memory _controlledTokens,uint256 _maxExitFeeMantissa,uint256 _maxTimelockDuration,YieldSourceStub _stubYieldSource)public{PrizePool.initialize(_trustedForwarder,_reserveRegistry,_controlledTokens,_maxExitFeeMantissa,
123456789101112131415pragma solidity >=0.6.0 <0.7.0;import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";interface YieldSourceStub {function canAwardExternal(address _externalToken) external view returns (bool);function token() external view returns (IERC20);function balance() external returns (uint256);function supply(uint256 mintAmount) external;function redeem(uint256 redeemAmount) external returns (uint256);}
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "@pooltogether/pooltogether-rng-contracts/contracts/RNGInterface.sol";contract RNGServiceMock is RNGInterface {uint256 internal random;address internal feeToken;uint256 internal requestFee;function getLastRequestId() external override view returns (uint32 requestId) {return 1;}function setRequestFee(address _feeToken, uint256 _requestFee) external {feeToken = _feeToken;requestFee = _requestFee;}/// @return _feeToken/// @return _requestFeefunction getRequestFee() external override view returns (address _feeToken, uint256 _requestFee) {return (feeToken, requestFee);}function setRandomNumber(uint256 _random) external {
12345678910111213141516171819202122pragma solidity >=0.6.0 <0.7.0;import "../prize-strategy/single-random-winner/SingleRandomWinner.sol";/* solium-disable security/no-block-members */contract SingleRandomWinnerHarness is SingleRandomWinner {uint256 internal time;function setCurrentTime(uint256 _time) external {time = _time;}function _currentTime() internal override view returns (uint256) {return time;}function setRngRequest(uint32 requestId, uint32 lockBlock) external {rngRequest.id = requestId;rngRequest.lockBlock = lockBlock;}}
1234567891011121314151617pragma solidity >=0.6.0 <0.7.0;import "./SingleRandomWinnerHarness.sol";import "../external/openzeppelin/ProxyFactory.sol";contract SingleRandomWinnerHarnessProxyFactory is ProxyFactory {SingleRandomWinnerHarness public instance;constructor () public {instance = new SingleRandomWinnerHarness();}function create() external returns (SingleRandomWinnerHarness) {return SingleRandomWinnerHarness(deployMinimal(address(instance), ""));}}
12345678pragma solidity >=0.6.0 <0.7.0;/* solium-disable security/no-block-members */contract Timestamp {function blockTime() public view returns (uint256) {return block.timestamp;}}
123456789101112131415161718192021222324pragma solidity >=0.6.0 <0.7.0;import "../utils/UInt256Array.sol";contract UInt256ArrayExposed {using UInt256Array for uint256[];uint256[] internal array;constructor (uint256[] memory _array) public {array = new uint256[](_array.length);for (uint256 i = 0; i < _array.length; i++) {array[i] = _array[i];}}function remove(uint256 index) external {array.remove(index);}function toArray() external view returns (uint256[] memory) {return array;}}
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../drip/VolumeDrip.sol";contract VolumeDripExposed {using VolumeDrip for VolumeDrip.State;event DripTokensBurned(address user, uint256 amount);event Minted(uint256 amount);event MintedTotalSupply(uint256 amount);VolumeDrip.State state;function setNewPeriod(uint32 periodSeconds, uint112 dripAmount, uint32 endTime) external {state.setNewPeriod(periodSeconds, dripAmount, endTime);}function setNextPeriod(uint32 periodSeconds, uint112 dripAmount) external {state.setNextPeriod(periodSeconds, dripAmount);}function drip(uint256 currentTime, uint256 maxNewTokens) external returns (uint256) {uint256 newTokens = state.drip(currentTime, maxNewTokens);emit MintedTotalSupply(newTokens);
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../drip/VolumeDripManager.sol";contract VolumeDripManagerExposed {using VolumeDripManager for VolumeDripManager.State;using VolumeDrip for VolumeDrip.State;VolumeDripManager.State manager;function activate(address measure,address dripToken,uint32 periodSeconds,uint112 dripAmount,uint32 endTime)external{manager.activate(measure, dripToken, periodSeconds, dripAmount, endTime);}function deactivate(address measure,address dripToken,address prevDripToken
1234567891011121314151617181920212223242526pragma solidity >=0.6.0 <0.7.0;import "../external/yearn/yVaultInterface.sol";import "./ERC20Mintable.sol";import "../external/pooltogether/FixedPoint.sol";import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";contract yVaultMock is yVaultInterface, ERC20UpgradeSafe {ERC20UpgradeSafe private asset;uint256 public vaultFeeMantissa;constructor (ERC20Mintable _asset) public {asset = _asset;vaultFeeMantissa = 0.05 ether;}function token() external override view returns (address) {return address(asset);}function balance() public override view returns (uint) {return asset.balanceOf(address(this));}function removeLiquidity(uint _amount) external {
123456789101112131415161718192021222324pragma solidity >=0.6.0 <0.7.0;import "../prize-pool/yearn/yVaultPrizePool.sol";contract yVaultPrizePoolHarness is yVaultPrizePool {uint256 public currentTime;function setCurrentTime(uint256 _currentTime) external {currentTime = _currentTime;}function _currentTime() internal override view returns (uint256) {return currentTime;}function supply(uint256 mintAmount) external {_supply(mintAmount);}function redeem(uint256 redeemAmount) external returns (uint256) {return _redeem(redeemAmount);}}
1234567891011121314151617181920212223pragma solidity >=0.6.0 <0.7.0;import "./yVaultPrizePoolHarness.sol";import "../external/openzeppelin/ProxyFactory.sol";/// @title Compound Prize Pool Proxy Factory/// @notice Minimal proxy pattern for creating new Compound Prize Poolscontract yVaultPrizePoolHarnessProxyFactory is ProxyFactory {/// @notice Contract template for deploying proxied Prize PoolsyVaultPrizePoolHarness public instance;/// @notice Initializes the Factory with an instance of the Compound Prize Poolconstructor () public {instance = new yVaultPrizePoolHarness();}/// @notice Creates a new Compound Prize Pool as a proxy of the template instance/// @return A reference to the new proxied Compound Prize Poolfunction create() external returns (yVaultPrizePoolHarness) {return yVaultPrizePoolHarness(deployMinimal(address(instance), ""));}}
1234567891011121314151617181920{"metadata": {"useLiteralContent": true},"optimizer": {"enabled": true,"runs": 200},"outputSelection": {"*": {"*": ["evm.bytecode","evm.deployedBytecode","abi"]}},"evmVersion": "istanbul","libraries": {}}
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"chanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract TokenControllerInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"controllerBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"controllerBurnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"controllerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"randomNumber","type":"uint256"}],"name":"draw","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"address","name":"_trustedForwarder","type":"address"},{"internalType":"contract TokenControllerInterface","name":"_controller","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.