StrategyChainlinkUSDDynamicAsk
This contract allows a seller to sell an NFT priced in USD and the receivable amount to be in ETH.
ETH_USD_PRICE_FEED_DECIMALS
uint256 ETH_USD_PRICE_FEED_DECIMALS
It is possible to call priceFeed.decimals() to get the decimals, but to save gas, it is hard coded instead.
WETH
address WETH
Wrapped ether (WETH) address.
priceFeed
contract AggregatorV3Interface priceFeed
ETH/USD Chainlink price feed
constructor
constructor(address _owner, address _weth, address _priceFeed) public
Constructor
Parameters
Name | Type | Description |
---|---|---|
_owner | address | Owner address |
_weth | address | Wrapped ether address |
_priceFeed | address | Address of the ETH/USD price feed |
executeStrategyWithTakerBid
function executeStrategyWithTakerBid(struct OrderStructs.Taker takerBid, struct OrderStructs.Maker makerAsk) external view returns (uint256 price, uint256[] itemIds, uint256[] amounts, bool isNonceInvalidated)
This function validates the order under the context of the chosen strategy and returns the fulfillable items/amounts/price/nonce invalidation status. This strategy looks at the seller's desired sale price in USD and minimum sale price in ETH, converts the USD value into ETH using Chainlink's price feed and chooses the higher price.
The client has to provide the seller's desired sale price in USD as the additionalParameters
Parameters
Name | Type | Description |
---|---|---|
takerBid | struct OrderStructs.Taker | Taker bid struct (taker bid-specific parameters for the execution) |
makerAsk | struct OrderStructs.Maker | Maker ask struct (maker ask-specific parameters for the execution) |
isMakerOrderValid
function isMakerOrderValid(struct OrderStructs.Maker makerAsk, bytes4 functionSelector) external view returns (bool isValid, bytes4 errorSelector)
Validate only the maker order under the context of the chosen strategy. It does not revert if the maker order is invalid. Instead it returns false and the error's 4 bytes selector.
Parameters
Name | Type | Description |
---|---|---|
makerAsk | struct OrderStructs.Maker | |
functionSelector | bytes4 | Function selector for the strategy |
Return Values
Name | Type | Description |
---|---|---|
isValid | bool | Whether the maker struct is valid |
errorSelector | bytes4 | If isValid is false, it returns the error's 4 bytes selector |