Skip to content

Commit

Permalink
Feature/chainlink api (#77)
Browse files Browse the repository at this point in the history
* add box mainnet logic contract

* update environment variables

* update dependencies

* factor out VRF interfaces

* Add Seed Storage contract and test stub

* add order oracle

* add pizza interfaces

* add initial deployment script

* add initial pizza contract (WIP)

* Update Deployment scripts

remove env vars that are not actually used.  Add a mint pizza sequence diagram.  update docs, etc

* Add fulfillment event

update fallback function

* npm upgrade

* dont run the bonding curve tests all the time

they take a while

* moar tool updates

* clean up seed storage deployment

add a deployment to mumbai

* update gitignore and packages

* rename mumbai to maticmum

when ethers added official support, they chose maticmum as the name.

see here: ethers-io/ethers.js#1546 (comment)

* add deployment for polygon random consumer

* pizza storage set random consumer

* update docs

* Remove purchase logic, use box token id

remove the logic to purchase a pizza.  it now just redirects to the box contract (for api consistency).  Also use the box id as the token id for the pizza for now.

* missed interface upgrade

* clean up the order api consumer deployment

add the job as a string and use assembly to load it into bytes32. note this is dangerous.

* check the chainlink callback is a contract

use openzep's _msgSender() in some places

* remove references to kovan

update packages

* fix test

* reanme

* update pizza deployment

* Fix the IPFS hash resolution

The IPFS hashes are too big when coming in from the chainlink oracle to fit in bytes32 so they get converted from base58 into a uint and the multihash bytes are stripped off, then recombined when reading out the hash when calling tokenURI.

* PR self review

* add a couple tests and scripts

* add missing interface members

add missing function parameters add a few missing checks. change the data type of the address to a uint

* add toggle for sale

* add authorized requesstor to order api consumer

* update deployed addresses

* use call() when calling order api response contract

* use token id var
  • Loading branch information
AddressXception authored Oct 25, 2021
1 parent b6e18c0 commit 1d9201e
Show file tree
Hide file tree
Showing 75 changed files with 31,628 additions and 22,417 deletions.
98 changes: 72 additions & 26 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
# Network to use in config
NETWORK=

#############################################################################

# Go to https://www.alchemyapi.io, sign up, create
# a new App in its dashboard, and replace "KEY" with its key
ALCHEMY_MAINNET_KEY=
ALCHEMY_GOERLI_KEY=
ALCHEMY_RINKEBY_KEY=
ALCHEMY_ROPSTEN_KEY=

ALCHEMY_MATIC_KEY=
ALCHEMY_MUMBAI_KEY=

# Your API key for Etherscan
# Obtain one at https://etherscan.io/
ETHERSCAN_API_KEY=

#############################################################################

# Replace these private keys with your testnet account private keys
# To export your private key from Metamask, open Metamask and
# go to Account Details > Export Private Key
Expand All @@ -22,66 +29,105 @@ GOERLI_PRIVATE_KEY=
RINKEBY_PRIVATE_KEY=
ROPSTEN_PRIVATE_KEY=

MATIC_PRIVATE_KEY=
MATIC_MUMBAI_PRIVATE_KEY=

#############################################################################

# Chainlink BTC-ETH Price Feeds
# from: https://docs.chain.link/docs/ethereum-addresses#config
CHAINLINK_MAINNET_PRICE_FEED=0xdeb288F737066589598e9214E782fa5A8eD689e8
CHAINLINK_KOVAN_PRICE_FEED=0xF7904a295A029a3aBDFFB6F12755974a958C7C25
CHAINLINK_GOERLI_PRICE_FEED=0x0000000000000000000000000000000000000000
CHAINLINK_RINKEBY_PRICE_FEED=0x2431452A0010a43878bF198e170F6319Af6d27F4
CHAINLINK_ROPSTEN_PRICE_FEED=0x0000000000000000000000000000000000000000

# Chainlink Link Token
# from: https://docs.chain.link/docs/link-token-contracts
CHAINLINK_MAINNET_TOKEN=0x514910771af9ca656af840dff83e8264ecf986ca
CHAINLINK_KOVAN_TOKEN=0xa36085F69e2889c224210F603D836748e7dC0088
CHAINLINK_GOERLI_TOKEN=0x326c977e6efc84e512bb9c30f76e30c160ed06fb
CHAINLINK_RINKEBY_TOKEN=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
CHAINLINK_ROPSTEN_TOKEN=0x0000000000000000000000000000000000000000

CHAINLINK_MATIC_TOKEN=0xb0897686c545045afc77cf20ec7a532e3120e0f1
CHAINLINK_MATIC_MUMBAI_TOKEN=0x326C977E6efc84E512bB9C30f76E30c160eD06FB

# Chainlink VRF Coordinator
# from: https://docs.chain.link/docs/vrf-contracts
CHAINLINK_MAINNET_VRF_COORD=0x0000000000000000000000000000000000000000
CHAINLINK_KOVAN_VRF_COORD=0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9
CHAINLINK_GOERLI_VRF_COORD=0x0000000000000000000000000000000000000000
CHAINLINK_MAINNET_VRF_COORD=0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
CHAINLINK_RINKEBY_VRF_COORD=0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B
CHAINLINK_ROPSTEN_VRF_COORD=0x0000000000000000000000000000000000000000

CHAINLINK_MATIC_VRF_COORD=0x0000000000000000000000000000000000000000
CHAINLINK_MATIC_VRF_COORD=0x3d2341ADb2D31f1c5530cDC622016af293177AE0
CHAINLINK_MATIC_MUMBAI_VRF_COORD=0x8C7382F9D8f56b33781fE506E897a4F1e2d17255

#Chainlink VRF Key Hash
# from: https://docs.chain.link/docs/vrf-contracts
CHAINLINK_MAINNET_VRF_KEY_HASH=0x00
CHAINLINK_KOVAN_VRF_KEY_HASH=0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4
CHAINLINK_GOERLI_VRF_KEY_HASH=0x00
CHAINLINK_MAINNET_VRF_KEY_HASH=0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445
CHAINLINK_RINKEBY_VRF_KEY_HASH=0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311
CHAINLINK_ROPSTEN_VRF_KEY_HASH=0x00

CHAINLINK_MATIC_VRF_KEY_HASH=0x00
CHAINLINK_MATIC_VRF_KEY_HASH=0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da
CHAINLINK_MATIC_MUMBAI_VRF_KEY_HASH=0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4

#CHAINLINK VRF Fee
CHAINLINK_MAINNET_VRF_FEE=0
CHAINLINK_KOVAN_VRF_FEE=100000000000000000
CHAINLINK_GOERLI_VRF_FEE=0
CHAINLINK_MAINNET_VRF_FEE=2000000000000000000
CHAINLINK_RINKEBY_VRF_FEE=100000000000000000
CHAINLINK_ROPSTEN_VRF_FEE=0
CHAINLINK_MATIC_VRF_FEE=0
CHAINLINK_MATIC_VRF_FEE=100000000000000
CHAINLINK_MATIC_MUMBAI_VRF_FEE=100000000000000

# These are the proxy addresses of the permanant testnet deployments
# useful for testing upgrades across environments
#############################################################################

# Proxy Deployments

RAREPIZZAS_BOX_MAINNET_PROXY_ADDRESS=0x4ae57798AEF4aF99eD03818f83d2d8AcA89952c7
RAREPIZZAS_BOX_GOERLI_PROXY_ADDRESS=
RAREPIZZAS_BOX_RINKEBY_PROXY_ADDRESS=0x8f5AE25105C3c03Bce89aE3b5ed1E30456755fAb

# Proxy Administrator
RAREPIZZAS_MAINNET_PROXY_ADDRESS=
RAREPIZZAS_RINKEBY_PROXY_ADDRESS=0x4bC497fF4ccaA5C3E052Fe47179bd68CA551B347

# SeedStorage Variables
RAREPIZZAS_SEEDSTORAGE_MATIC_PROXY_ADDRESS=
RAREPIZZAS_SEEDSTORAGE_MUMBAI_PROXY_ADDRESS=0x0f03e846492c704321df4cedf6fb07475f4a728a

RAREPIZZAS_SEEDSTORAGE_AUTHORIZED_REQUESTOR_MATIC_ADDRESS=
RAREPIZZAS_SEEDSTORAGE_AUTHORIZED_REQUESTOR_MUMBAI_ADDRESS=

#############################################################################

# Proxy Administrator (usually a multi sig or a dao contract)
RAREPIZZAS_BOX_MAINNET_PROXY_ADMIN_ADDRESS=0xBA5E28a2D1C8cF67Ac9E0dfc850DC8b7b21A4DE2
RAREPIZZAS_BOX_RINKEBY_PROXY_ADMIN_ADDRESS=0x465cDAC68140B62c11a1E89eCD30e97aA5a18413

RAREPIZZAS_MAINNET_PROXY_ADMIN_ADDRESS=0xBA5E28a2D1C8cF67Ac9E0dfc850DC8b7b21A4DE2
RAREPIZZAS_RINKEBY_PROXY_ADMIN_ADDRESS=0x465cDAC68140B62c11a1E89eCD30e97aA5a18413

RAREPIZZAS_MATIC_PROXY_ADMIN_ADDRESS=0xded5e5Ca9767A9AF8dAc90ddc206c0479A2573Bb
RAREPIZZAS_MUMBAI_PROXY_ADMIN_ADDRESS=

#############################################################################

# Random Consumer
RAREPIZZAS_BOX_MAINNET_RANDOM_CONSUMER_ADDRESS=0x1226C38D4fadDa4273eff3aC2a35dd52960b2969
RAREPIZZAS_BOX_RINKEBY_RANDOM_CONSUMER_ADDRESS=0x3Bf50f988717BFA53aDd58c8fd15Ba904c475DB0
RAREPIZZAS_BOX_RINKEBY_RANDOM_CONSUMER_ADDRESS=0x3Bf50f988717BFA53aDd58c8fd15Ba904c475DB0
RAREPIZZAS_MATIC_RANDOM_CONSUMER_ADDRESS=
RAREPIZZAS_MUMBAI_RANDOM_CONSUMER_ADDRESS=0x70aCe1A25455425e1Fe770505120Aa4E5e14fe83

#############################################################################

# Order API Oracle
RAREPIZZAS_ORDER_API_MAINNET_ORACLE_NODE_ADDRESS=
RAREPIZZAS_ORDER_API_RINKEBY_ORACLE_NODE_ADDRESS=0xbBa8473580dB06239f1383753e1ed714E4eEd6f5

RAREPIZZAS_ORDER_API_MAINNET_ORACLE_CONTRACT_ADDRESS=
RAREPIZZAS_ORDER_API_RINKEBY_ORACLE_CONTRACT_ADDRESS=0xC416a5c13EC95adDB74789a775e2FeF0605328AF

RAREPIZZAS_ORDER_API_CONSUMER_MAINNET_CONTRACT_ADDRESS=
RAREPIZZAS_ORDER_API_CONSUMER_RINKEBY_CONTRACT_ADDRESS=0x3afD8Cc13fD8bc2B1F60F1e591a56EB4d0E1A3BD

# usually the same as RAREPIZZAS_MAINNET_PROXY_ADDRESS
RAREPIZZAS_ORDER_API_CONSUMER_AUTHORIZED_REQUESTOR_MAINNET_ADDRESS=

# usually the same as RAREPIZZAS_RINKEBY_PROXY_ADDRESS
RAREPIZZAS_ORDER_API_CONSUMER_AUTHORIZED_REQUESTOR_RINKEBY_ADDRESS=

RAREPIZZAS_ORDER_API_MAINNET_JOB_ID=
RAREPIZZAS_ORDER_API_RINKEBY_JOB_ID=

RAREPIZZAS_ORDER_API_MAINNET_JOB_FEE=100000000000000000
RAREPIZZAS_ORDER_API_RINKEBY_JOB_FEE=100000000000000000

#############################################################################
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ node_modules
npm-debug.log*

# Openzeppelin
.openzeppelin/unknown-*.json
.openzeppelin/unknown-31337.json
Loading

0 comments on commit 1d9201e

Please sign in to comment.