Licensing
License Types
TimeBased.sol

TimeBased

A license which allows for the dynamic pricing, based on the time of purchase.

Configuration Functions

setEmbargo(bytes32 id, Embargo calldata _embargo)

Sets the embargo state for a passed node id. The embargo is a set of parameters that define the pricing function functionality.

enum Time {
    MINS,
    DAYS,
    WEEKS,
    YEARS
}
 
enum PricingFunction {
    STEP,
    LINEAR,
    EXPONENTIAL,
    BINARY
}
 
struct Embargo {
    uint256 embargoDate;
    uint256 retailPrice;
    uint256 premium;
    Time timeDenom;
    PricingFunction priceFunc;
}
  • embargoDate: The date by which the retail price is effective.
  • retailPrice: The price as a uint at the embargo date
  • premium: a uint256 multiple used to grow the price before the embargoDate
  • timeDenom: a unit of time used as the denominator in calculating the x to be used in the pricing function.
  • PricingFunction: a function that specifies how the premium is applied to the retail price before the embargoDate.

Access Functions

price(bytes32 id, uint256 time)

Returns the price of purchasing access of a node at a specific time. The returned value can be used to inform a subsequent call to purchaseAccess()

getEmbargo(bytes32 id)

Returns the parameters of the embargo set on a given node.

purchaseAccess(bytes32 id)

Called by a purchaser of access to a passed node. The value sent in the call should be >= the price of content. Additional funds will be returned to the caller.

Errors if the caller supplies a value less than the price.

auth(bytes32 id, address user)

Returns if a user has purchased access to a given node using its id.

See Smart Contracts for the address of this license.