TokenizedDerivative

onlyThis() modifier

constructor(struct TokenizedDerivativeParams.ConstructorParams params, string _name, string _symbol) public

createTokens(uint256 marginForPurchase, uint256 tokensToPurchase) external

Creates tokens with sent margin and sends the caller back any additional margin.

Parameters:

  • marginForPurchase: Maximum amount of margin currency to use to create tokens.

  • tokensToPurchase: Number of tokens to create.

depositAndCreateTokens(uint256 marginForPurchase, uint256 tokensToPurchase) external

Creates tokens with sent margin and deposits additional margin in short account.

Parameters:

  • marginForPurchase: Maximum amount of margin currency to use to create tokens.

  • tokensToPurchase: Number of tokens to create.

redeemTokens(uint256 tokensToRedeem) external

Redeems tokens for margin currency.

dispute(uint256 depositMargin) external

Triggers a price dispute for the most recent remargin time.

Parameters:

  • depositMargin: Must be at least disputeDeposit percent of the required margin.

withdraw(uint256 amount) external

Withdraws amount from short margin account.

remargin() external

Pays (Oracle and service) fees for the previous period, updates the contract NAV, moves margin between long and short accounts to reflect the new NAV, and checks if both accounts meet minimum requirements.,@notice A core contract method called independently or as a part of other financial contract transactions. It pays fees and moves money between margin accounts to make sure they reflect the NAV of the contract.

acceptPriceAndSettle() external

Forgo the Oracle verified price and settle the contract with last remargin price.

This method is only callable on contracts in the Defaulted state, and the default penalty is always transferred from the short to the long account.

setApDelegate(address apDelegate) external

Assigns an address to be the contract’s Delegate AP that can create and redeem.

Replaces previous value. Set to 0x0 to indicate there is no Delegate AP.

emergencyShutdown() external

Moves the contract into the Emergency state, where it waits on an Oracle price for the most recent remargin time.,@notice Initiates the shutdown process, in case of an emergency.

settle() external

Performs a final remargin, assesses any penalties, and moves the contract into the Settled state. An Oracle price must be available.

deposit(uint256 amountToDeposit) external

Adds the margin to the short account.

For ETH-margined contracts, send ETH along with the call. In the case of an ERC20 margin currency, authorize before calling this method.

withdrawUnexpectedErc20(address erc20Address, uint256 amount) external

Withdraw any ERC20 balance that is not the margin token. Only callable by the sponsor.

burn(uint256 value) external

Destroys value tokens from the caller.

Only this contract or its libraries are allowed to burn tokens.,@notice Burns a specific amount of the caller’s tokens. Only burns the caller’s tokens, so it is safe to leave this method permissionless.

mint(address to, uint256 value) → bool external

Creates value tokens and assigns them to to, increasing the total supply.

Only this contract or its libraries are allowed to mint tokens.,@notice Mints tokens and adds them to the balance of the to address. This method should be permissioned to only allow designated parties to mint tokens.

calcNAV() → int256 navNew external

Returns the expected net asset value (NAV) of the contract using the latest available Price Feed price.

calcTokenValue() → int256 newTokenValue external

Returns the expected value of each the outstanding tokens of the contract using the latest available Price Feed price.

calcShortMarginBalance() → int256 newShortMarginBalance external

Returns the expected balance of the short margin account using the latest available Price Feed price.

calcExcessMargin() → int256 excessMargin external

Returns the expected short margin in excess of the margin requirement using the latest available Price Feed price.

Value will be negative if the short margin is expected to be below the margin requirement.

getCurrentRequiredMargin() → int256 requiredMargin external

Returns the required margin, as of the last remargin.

Note that calcExcessMargin uses updated values using the latest available Price Feed price.

canBeSettled() → bool canContractBeSettled external

Returns whether the contract can be settled, i.e., is it valid to call settle() now.

getUpdatedUnderlyingPrice() → int256 underlyingPrice, uint256 time external

Returns the updated underlying price that was used in the calc* methods above.

It will be a price feed price if the contract is Live and will remain Live, or an Oracle price if the contract is settled/about to be settled. Reverts if no Oracle price is available but an Oracle price is required.

totalSupply() → uint256 public

See IERC20.totalSupply.,@dev Returns the amount of tokens in existence.

balanceOf(address account) → uint256 public

See IERC20.balanceOf.,@dev Returns the amount of tokens owned by account.

transfer(address recipient, uint256 amount) → bool public

See IERC20.transfer.

Requirements:

  • recipient cannot be the zero address.

  • the caller must have a balance of at least amount.,@dev Moves amount tokens from the caller’s account to recipient.

Returns a boolean value indicating whether the operation succeeded.

Emits a Transfer event.

allowance(address owner, address spender) → uint256 public

See IERC20.allowance.,@dev Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom. This is zero by default.

This value changes when approve or transferFrom are called.

approve(address spender, uint256 value) → bool public

See IERC20.approve.

Requirements:

  • spender cannot be the zero address.,@dev Sets amount as the allowance of spender over the caller’s tokens.

Returns a boolean value indicating whether the operation succeeded.

Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender’s allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729

Emits an Approval event.

transferFrom(address sender, address recipient, uint256 amount) → bool public

See IERC20.transferFrom.

Emits an Approval event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of ERC20;

Requirements: - sender and recipient cannot be the zero address. - sender must have a balance of at least value. - the caller must have allowance for sender’s tokens of at least `amount.,@dev Moves amount tokens from sender to recipient using the allowance mechanism. amount is then deducted from the caller’s allowance.

Returns a boolean value indicating whether the operation succeeded.

Emits a Transfer event.

increaseAllowance(address spender, uint256 addedValue) → bool public

Atomically increases the allowance granted to spender by the caller.

This is an alternative to approve that can be used as a mitigation for problems described in IERC20.approve.

Emits an Approval event indicating the updated allowance.

Requirements:

  • spender cannot be the zero address.

decreaseAllowance(address spender, uint256 subtractedValue) → bool public

Atomically decreases the allowance granted to spender by the caller.

This is an alternative to approve that can be used as a mitigation for problems described in IERC20.approve.

Emits an Approval event indicating the updated allowance.

Requirements:

  • spender cannot be the zero address.

  • spender must have allowance for the caller of at least subtractedValue.

_transfer(address sender, address recipient, uint256 amount) internal

Moves tokens amount from sender to recipient.

This is internal function is equivalent to transfer, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc.

Emits a Transfer event.

Requirements:

  • sender cannot be the zero address.

  • recipient cannot be the zero address.

  • sender must have a balance of at least amount.

_mint(address account, uint256 amount) internal

Creates amount tokens and assigns them to account, increasing the total supply.

Emits a Transfer event with from set to the zero address.

Requirements

  • to cannot be the zero address.

_burn(address account, uint256 value) internal

Destoys amount tokens from account, reducing the total supply.

Emits a Transfer event with to set to the zero address.

Requirements

  • account cannot be the zero address.

  • account must have at least amount tokens.

_approve(address owner, address spender, uint256 value) internal

Sets amount as the allowance of spender over the `owner`s tokens.

This is internal function is equivalent to approve, and can be used to e.g. set automatic allowances for certain subsystems, etc.

Emits an Approval event.

Requirements:

  • owner cannot be the zero address.

  • spender cannot be the zero address.

_burnFrom(address account, uint256 amount) internal

Destoys amount tokens from account.amount is then deducted from the caller’s allowance.

See _burn and _approve.

NavUpdated(string symbol, int256 newNav, int256 newTokenPrice) event

Default(string symbol, uint256 defaultTime, int256 defaultNav) event

Settled(string symbol, uint256 settleTime, int256 finalNav) event

Expired(string symbol, uint256 expiryTime) event

Disputed(string symbol, uint256 timeDisputed, int256 navDisputed) event

EmergencyShutdownTransition(string symbol, uint256 shutdownTime) event

TokensCreated(string symbol, uint256 numTokensCreated) event

TokensRedeemed(string symbol, uint256 numTokensRedeemed) event

Deposited(string symbol, uint256 amount) event

Withdrawal(string symbol, uint256 amount) event

Transfer(address from, address to, uint256 value) event

Emitted when value tokens are moved from one account (from) to another (to).

Note that value may be zero.

Approval(address owner, address spender, uint256 value) event

Emitted when the allowance of a spender for an owner is set by a call to approve. value is the new allowance.

© UMA Project 2018-2019