Skip to content

Replace OrderAPIConsumer with a lightweight version #87

Description

@AddressXception

We'll be removing the chainlink node from the pizza oven infrastructure and in order to do that, we need to replace the orderAPI consumer with one that does not require chainlink as part of it's request response model.

In the current system, when a user calls RarePizzas.RedeemRarePizzasBox(boxTokenId,recipeId) the request is propagated to the order API consumer via OrderAPIConsumer.executeRequest(requestor,tokenId,recipeId). In the new contract the executeRequest function must remain ABI compatible so that we do not need to update the pizza contract code, just the reference to it's external function.

In executeRequest a chainlink request is built and then sent to the oracle contract. Instead of sending the request to the chainlink contract, we should just immediately emit an event that includes tghe relevant data necessary for the API to process the request and fulfill the response.

This new contract does not need to inherit ChainlinkClient and it does not need to deal with link token at all.

We still need to keep track of requests in flight and reqs that have been fulfilled

Implementation Details

The new contract should:

  1. remain ABI compatible with the existing IOrderAPIConsumer and IOrderAPIConsumerAdmin interfaces
  2. set requestId == keccak256(abi.encodePacked(this, requestCount)); ???
  3. set JobId: keccak256(abi.encodePacked(tokenId, recipeId)); ???
  4. continue to emit Requested and Fulfilled events
  5. emit an event that includes all of the metadata necessary for fulfilling the response (e.g. requestor, tokenid, recipeId)
  6. use access control to constrain fulfillResponse instead of recordChainlinkFulfillment
  7. implement a withdraw function
  8. include deployment scripts to deploy it

Acceptance criteria

  1. the new contract meets the spec above
  2. there are unit tests demonstrating the benavior
  3. there is a deployment script to deploy the contract

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

WIPWork in Progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions