Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Celo #221

Merged
merged 3 commits into from
Sep 9, 2024
Merged

Celo #221

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- [Tutorials \& examples](#tutorials--examples)
- [Quickstart](#quickstart)
- [Requirements](#requirements)
- [Steps on live testnet](#steps-on-live-testnet)
- [Steps on Live (Public) Testnets](#steps-on-live-public-testnets)
- [Steps on local testnet](#steps-on-local-testnet)
- [Environment Variable Management](#environment-variable-management)
- [Using Remote Secrets (e.g. Github Gists)](#using-remote-secrets-eg-github-gists)
Expand Down Expand Up @@ -49,22 +49,26 @@ In order to set up your own project which uses Chainlink Functions, please refer
## Supported Networks

> ⚠️⚠️⚠️
> As at 13 April 2024, Mumbai (anchored to Goerli) stopped producing blocks. Mumbai's deprecation had been announced in favour of a new Amoy testnet, anchored to Sepolia.
> Amoy support is coming soon, and in the meanwhile we recommend you use the Ethereum Sepolia testnet or the Avalanche Fuji testnet for Functions related projects. Please refer to docs.chain.link to find the latest information on networks that support Chainlink services.
> As at 13 April 2024, Mumbai (anchored to Goerli) stopped producing blocks. Mumbai's deprecation had been announced in favour of a new Amoy testnet, anchored to Sepolia.

### Mainnets

- Ethereum : `ETHEREUM_RPC_URL`, `--network ethereum`
- Polygon : `POLYGON_RPC_URL`, `--network polygon`
- Avalanche : `AVALANCHE_RPC_URL`, `--network avalanche`
- Arbitrum : `ARBITRUM_RPC_URL`, `--network arbitrum`
- Ethereum : `ETHEREUM_RPC_URL`, `--network ethereum`, `ETHERSCAN_API_KEY`
- Polygon : `POLYGON_RPC_URL`, `--network polygon`, `POLYGONSCAN_API_KEY`
- Avalanche : `AVALANCHE_RPC_URL`, `--network avalanche`, `SNOWTRACE_API_KEY`
- Arbitrum : `ARBITRUM_RPC_URL`, `--network arbitrum`, `ARBISCAN_API_KEY`
- Base : `BASE_RPC_URL`, `--network base`, `BASESCAN_API_KEY`
- Celo : `CELO_RPC_URL`, `--network celo`, `CELOSCAN_API_KEY`

### Testnets

- Ethereum Sepolia: `ETHEREUM_SEPOLIA_RPC_URL`, `--network ethereumSepolia`
- Polygon Mumbai: `POLYGON_MUMBAI_RPC_URL`, `--network polygonMumbai`
- Avalanche Fuji: `AVALANCHE_FUJI_RPC_URL`, `--network avalancheFuji`
- Arbitrum Sepolia: `ARBITRUM_SEPOLIA_RPC_URL`, `--network arbitrumSepolia`
- Ethereum Sepolia: `ETHEREUM_SEPOLIA_RPC_URL`, `--network ethereumSepolia`, `ETHERSCAN_API_KEY`
- Polygon Amoy: `POLYGON_AMOY_RPC_URL`, `--network polygonAmoy`, `POLYGONSCAN_API_KEY`
- Avalanche Fuji: `AVALANCHE_FUJI_RPC_URL`, `--network avalancheFuji`, `SNOWTRACE_API_KEY`
- Arbitrum Sepolia: `ARBITRUM_SEPOLIA_RPC_URL`, `--network arbitrumSepolia`, `ARBISCAN_API_KEY`
- Base Sepolia: `BASE_SEPOLIA_RPC_URL`, `--network baseSepolia`, `BASESCAN_API_KEY`
- Optimism Sepolia: `OPTIMISM_SEPOLIA_RPC_URL`, `--network optimismSepolia`, `OP_ETHERSCAN_API_KEY`
- Celo Alfajores: `CELO_ALFAJORES_RPC_URL`, `--network celoAlfajores`, `CELOSCAN_API_KEY`

## For Beginners

Expand Down Expand Up @@ -94,7 +98,7 @@ Install **both** of the following:
1. Clone this repository to your local machine<br><br>. Also ensure that the testnet your wanting to deploy on is [supported](https://docs.chain.link/chainlink-functions/supported-networks) by Chainlink Functions.
2. Open this directory in your command line/terminal app, then run `npm install` to install all dependencies.<br><br>
3. Obtain the values for following environment variables (examples only - please see `./env.enc.example` for env vars you may need):
- `PRIVATE_KEY` for your development wallet - `POLYGON_MUMBAI_RPC_URL`, `ETHEREUM_SEPOLIA_RPC_URL`, or `AVALANCHE_FUJI_RPC_URL`
- `PRIVATE_KEY` for your development wallet - `POLYGON_AMOY_RPC_URL`, `ETHEREUM_SEPOLIA_RPC_URL`, or `AVALANCHE_FUJI_RPC_URL`
- `POLYGONSCAN_API_KEY`, `ETHERSCAN_API_KEY`, or `FUJI_SNOWTRACE_API_KEY` blockchain explore API keys depending on which network you're using
- `COINMARKETCAP_API_KEY` (from [here](https://pro.coinmarketcap.com/))
<br><br>
Expand Down
18 changes: 18 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ module.exports = {
optimismSepolia: networks.optimismSepolia.verifyApiKey,
base: networks.base.verifyApiKey,
optimism: networks.optimism.verifyApiKey,
celoAlfajores: networks.celoAlfajores.verifyApiKey,
celo: networks.celo.verifyApiKey,
},
customChains: [
{
Expand Down Expand Up @@ -107,6 +109,22 @@ module.exports = {
browserURL: "https://optimistic.etherscan.io/",
},
},
{
celoAlfajores: "celoAlfajores",
chainId: 44787,
urls: {
apiURL: "https://alfajores.celoscan.io/api",
browserURL: "https://alfajores.celoscan.io",
},
},
{
celoAlfajores: "celo",
chainId: 42220,
urls: {
apiURL: "https://celoscan.io/api",
browserURL: "https://celoscan.io",
},
},
],
},
gasReporter: {
Expand Down
37 changes: 35 additions & 2 deletions networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const networks = {
gasPrice: undefined,
nonce: undefined,
accounts,
verifyApiKey: process.env.FUJI_SNOWTRACE_API_KEY || "UNSET",
verifyApiKey: process.env.SNOWTRACE_API_KEY || "UNSET",
chainId: 43113,
confirmations: DEFAULT_VERIFICATION_BLOCK_CONFIRMATIONS,
nativeCurrencySymbol: "AVAX",
Expand Down Expand Up @@ -224,7 +224,7 @@ const networks = {
gasPrice: undefined,
nonce: undefined,
accounts,
verifyApiKey: process.env.OPTISCAN_API_KEY || "UNSET",
verifyApiKey: process.env.OP_ETHERSCAN_API_KEY || "UNSET",
chainId: 10,
confirmations: DEFAULT_VERIFICATION_BLOCK_CONFIRMATIONS,
nativeCurrencySymbol: "ETH",
Expand All @@ -234,6 +234,39 @@ const networks = {
donId: "fun-optimism-mainnet-1",
gatewayUrls: ["https://01.functions-gateway.chain.link/", "https://02.functions-gateway.chain.link/"],
},
celoAlfajores: {
url: process.env.CELO_ALFAJORES_RPC_URL || "UNSET",
gasPrice: undefined,
nonce: undefined,
accounts,
verifyApiKey: process.env.CELOSCAN_API_KEY || "UNSET",
chainId: 44787,
confirmations: DEFAULT_VERIFICATION_BLOCK_CONFIRMATIONS,
nativeCurrencySymbol: "ETH",
linkToken: "0x32e08557b14fad8908025619797221281d439071",
linkPriceFeed: "0xeA11fA4307B8BD6D6074Cf1c0caAc9790cf96857", // LINK/CELO
functionsRouter: "0x53BA5D8E5aab0cf9589aCE139666Be2b9Fd268e2",
donId: "fun-celo-alfajores-1",
gatewayUrls: [
"https://01.functions-gateway.testnet.chain.link/",
"https://02.functions-gateway.testnet.chain.link/",
],
},
celo: {
url: process.env.CELO_RPC_URL || "UNSET",
gasPrice: undefined,
nonce: undefined,
accounts,
verifyApiKey: process.env.CELOSCAN_API_KEY || "UNSET",
chainId: 42220,
confirmations: DEFAULT_VERIFICATION_BLOCK_CONFIRMATIONS,
nativeCurrencySymbol: "ETH",
linkToken: "0xd07294e6E917e07dfDcee882dd1e2565085C2ae0",
linkPriceFeed: "0xBa45f0a1a2fa3FB62a4D6dC135741E2aeb1b14e7", // LINK/CELO
functionsRouter: "0xd74646C75163f9dA0F3666C3BE8A9C42F4b3b261",
donId: "fun-celo-mainnet-1",
gatewayUrls: ["https://01.functions-gateway.chain.link/", "https://02.functions-gateway.chain.link/"],
},
// localFunctionsTestnet is updated dynamically by scripts/startLocalFunctionsTestnet.js so it should not be modified here
localFunctionsTestnet: {
url: "http://localhost:8545/",
Expand Down
4 changes: 1 addition & 3 deletions tasks/Functions-consumer/deployAutoConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ task("functions-deploy-auto-consumer", "Deploys the AutomatedFunctionsConsumer c
}
}
} else if (verifyContract && network.name !== "localFunctionsTestnet") {
console.log(
"\nPOLYGONSCAN_API_KEY, ETHERSCAN_API_KEY or FUJI_SNOWTRACE_API_KEY is missing. Skipping contract verification..."
)
console.log("\nBlockchain explorer API key is missing. Skipping contract verification...")
}

console.log(`\nAutomatedFunctionsConsumer contract deployed to ${consumerAddress} on ${network.name}`)
Expand Down
2 changes: 2 additions & 0 deletions tasks/utils/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const BASE_URLS = {
11155420: "https://sepolia-optimistic.etherscan.io/",
8453: "https://basescan.org/",
10: "https://optimistic.etherscan.io/",
44787: "https://alfajores.celoscan.io/",
42220: "https://celoscan.io/",
}

/**
Expand Down
Loading