OptimisticRewarderNoTokenTest
OptimisticRewarderNoTokenTest
#
#
Functionsconstructor(contract OptimisticRewarderToken _token, uint256 _liveness, contract IERC20 _bondToken, uint256 _bond, bytes32 _identifier, bytes _customAncillaryData, contract FinderInterface _finder, address _timerAddress) (public)
getCurrentTime() โ uint256 (public)
setCurrentTime(uint256 time) (external)
Sets the current time.
Will revert if not running in test mode.
#
Parameters:- time: timestamp to set current Testable time to.
mintNextToken(address recipient) โ uint256 (public)
Used to mint the next ERC721 tokenId.
even if token contract does not support the mintNextToken
function, this contract can still function
correctly assuming there is some other way to mint the ERC721 tokens. An issue in this method will only
affect the mint token in the base contract. Other methods will work fine.
#
Parameters:- recipient: the recipient of the newly minted token.
ownerOf(uint256 tokenId) โ address (public)
Used to check the owner of the token.
this override forwards the call to the external token contract.
#
Parameters:- tokenId: the tokenId to check the owner of.
depositRewards(contract IERC20 token, uint256 amount) (public)
Allows anyone to deposit reward tokens into the contract. Presumably, this would be the deployer or protocol that wishes to reward the users interacting with the system.
Once tokens are deposited, they cannot be withdrawn without claiming a reward. If a deployer wants an "escape hatch", they can create a special tokenId for this purpose.
#
Parameters:- token: ERC20 token that is being deposited.
- amount: amount of rewards to deposit.
mint(address receiver, bytes data) โ uint256 tokenId (public)
Allows the caller to mint a token to the receiver and include a reward-relevant update event with it. This is intended to be used when the user first interacts with a reward-granting protocol.
if the user prefers to only mint a new token, they should call the mintNextToken function.
#
Parameters:- receiver: user that will receive the newly minted token.
- data: arbitrary caller-generated data that will be associated with this update.
updateToken(uint256 tokenId, bytes data) (public)
Applies a reward-relevant update to an existing token.
#
Parameters:- tokenId: the existing tokenId that the update should be applied to.
- data: arbitrary caller-generated data that will be associated with this update.
requestRedemption(uint256 tokenId, struct OptimisticRewarderBase.RedemptionAmount[] cumulativeRedemptions) โ uint256 totalBond (public)
Requests a redemption for any tokenId. This can be called by anyone.
if called by someone who doesn't own the token, they are effectively gifting their bond to the owner.
#
Parameters:- tokenId: the tokenId the redemption is for.
- cumulativeRedemptions: the cumulative token addresses and amounts that this tokenId is eligible for at the current timestap. cumulative redemptions that are too low should be considered to be valid.
dispute(uint256 tokenId, struct OptimisticRewarderBase.RedemptionAmount[] cumulativeRedemptions) (public)
Disputes a redemption request.
this will cancel a request if the final fee changes or something causes the optimistic oracle proposal to fail.
#
Parameters:- tokenId: the tokenId the redemption is for.
- cumulativeRedemptions: the cumulative redemptions that were provided in the original request.
redeem(uint256 tokenId, struct OptimisticRewarderBase.RedemptionAmount[] cumulativeRedemptions) (public)
Redeem a redemption request that has passed liveness.
returns the bond that was paid with the initial proposal.
#
Parameters:- tokenId: the tokenId the redemption is for.
- cumulativeRedemptions: the cumulative redemptions that were provided in the original request.
sync() (public)
Syncs external addresses and parameters into the contract.
These are stored rather than read on each run to avoid expensive external calls in the happy-path.
getRedemptionId(uint256 tokenId, struct OptimisticRewarderBase.RedemptionAmount[] cumulativeRedemptions) โ bytes32 (public)
Generates a redemption id for the tokenId and the claim amounts.
#
Parameters:- tokenId: the tokenId that the claim is for.
- cumulativeRedemptions: the cumulative redemptions that were provided in the request.
_sync() (internal)
_getStore() โ contract StoreInterface (internal)
_getOptimisticOracle() โ contract SkinnyOptimisticOracleInterface (internal)
_getIdentifierWhitelist() โ contract IdentifierWhitelistInterface (internal)
_getCollateralWhitelist() โ contract AddressWhitelistInterface (internal)
_cancelRedemption(uint256 tokenId, bytes32 redemptionId) (internal)
multicall(bytes[] data) โ bytes[] results (external)
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
#
EventsUpdateToken(uint256 tokenId, address caller, bytes data)
Deposited(address depositor, contract IERC20 token, uint256 amount)
Requested(uint256 tokenId, bytes32 redemptionId, struct OptimisticRewarderBase.RedemptionAmount[] cumulativeRedemptions, uint256 expiryTime)
Canceled(uint256 tokenId, bytes32 redemptionId, uint256 expiryTime)
Disputed(uint256 tokenId, bytes32 redemptionId, uint256 expiryTime)
Redeemed(uint256 tokenId, bytes32 redemptionId, uint256 expiryTime)
#
ModifiersonlyIfTest()
Reverts if not running in test mode.
nonReentrant()
Prevents a contract from calling itself, directly or indirectly.
Calling a nonReentrant
function from another nonReentrant
function is not supported. It is possible to
prevent this from happening by making the nonReentrant
function external, and making it call a private
function that does the actual state modification.
nonReentrantView()
Designed to prevent a view-only method from being re-entered during a call to a nonReentrant()
state-changing method.