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:
- remain ABI compatible with the existing
IOrderAPIConsumer and IOrderAPIConsumerAdmin interfaces
- set
requestId == keccak256(abi.encodePacked(this, requestCount)); ???
- set
JobId: keccak256(abi.encodePacked(tokenId, recipeId)); ???
- continue to emit
Requested and Fulfilled events
- emit an event that includes all of the metadata necessary for fulfilling the response (e.g. requestor, tokenid, recipeId)
- use access control to constrain
fulfillResponse instead of recordChainlinkFulfillment
- implement a withdraw function
- include deployment scripts to deploy it
Acceptance criteria
- the new contract meets the spec above
- there are unit tests demonstrating the benavior
- there is a deployment script to deploy the contract
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 viaOrderAPIConsumer.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
executeRequesta 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
ChainlinkClientand 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:
IOrderAPIConsumerandIOrderAPIConsumerAdmininterfacesrequestId == keccak256(abi.encodePacked(this, requestCount));???JobId: keccak256(abi.encodePacked(tokenId, recipeId));???RequestedandFulfilledeventsfulfillResponseinstead ofrecordChainlinkFulfillmentAcceptance criteria