Skip to content

Commit

Permalink
feat: added sepolia and base support and fix IPFS returning empty str…
Browse files Browse the repository at this point in the history
…ings (#10)

* feat: added sepolia and base support

* fix: replaced outdated IPFS server url

* fix: empty return value
  • Loading branch information
heueristik authored Oct 18, 2023
1 parent 7477f69 commit 3ff241a
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GENERAL

## The network used for testing purposes
NETWORK_NAME="mainnet" # ["mainnet", "goerli", "polygon", "polygonMumbai"]
NETWORK_NAME="mainnet" # ["mainnet", "goerli", "sepolia", "polygon", "polygonMumbai", "base", "baseGoerli"]

# CONTRACTS

Expand All @@ -28,4 +28,4 @@ GRAPH_KEY="zzzzzzzzzzzz"
## Subgraph
SUBGRAPH_NAME="osx"
SUBGRAPH_VERSION="alice-debug-1s"
SUBGRAPH_NETWORK_NAME="goerli" # ["mainnet", "goerli", "polygon", "polygonMumbai"]
SUBGRAPH_NETWORK_NAME="goerli" # ["mainnet", "goerli", "sepolia", "polygon", "polygonMumbai", "base", "baseGoerli"]
6 changes: 2 additions & 4 deletions packages/contracts/deploy/02_setup/12_publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Upload the metadata to IPFS
const releaseMetadataURI = `ipfs://${await uploadToIPFS(
JSON.stringify(METADATA.release),
false
JSON.stringify(METADATA.release)
)}`;
const buildMetadataURI = `ipfs://${await uploadToIPFS(
JSON.stringify(METADATA.build),
false
JSON.stringify(METADATA.build)
)}`;

console.log(`Uploaded release metadata: ${releaseMetadataURI}`);
Expand Down
32 changes: 31 additions & 1 deletion packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '@nomiclabs/hardhat-etherscan';
import '@openzeppelin/hardhat-upgrades';
import '@typechain/hardhat';
import {config as dotenvConfig} from 'dotenv';
import {ethers} from 'ethers';
import 'hardhat-deploy';
import 'hardhat-gas-reporter';
import {extendEnvironment, HardhatUserConfig} from 'hardhat/config';
Expand All @@ -23,8 +24,10 @@ if (!process.env.INFURA_API_KEY) {
const apiUrls: NetworkNameMapping = {
mainnet: 'https://mainnet.infura.io/v3/',
goerli: 'https://goerli.infura.io/v3/',
sepolia: 'https://sepolia.infura.io/v3/',
polygon: 'https://polygon-mainnet.infura.io/v3/',
polygonMumbai: 'https://polygon-mumbai.infura.io/v3/',
base: 'https://mainnet.base.org',
baseGoerli: 'https://goerli.base.org',
};

Expand All @@ -45,6 +48,10 @@ export const networks: {[index: string]: NetworkUserConfig} = {
chainId: 5,
url: `${apiUrls.goerli}${process.env.INFURA_API_KEY}`,
},
sepolia: {
chainId: 11155111,
url: `${apiUrls.sepolia}${process.env.INFURA_API_KEY}`,
},
polygon: {
chainId: 137,
url: `${apiUrls.polygon}${process.env.INFURA_API_KEY}`,
Expand All @@ -53,10 +60,15 @@ export const networks: {[index: string]: NetworkUserConfig} = {
chainId: 80001,
url: `${apiUrls.polygonMumbai}${process.env.INFURA_API_KEY}`,
},
base: {
chainId: 8453,
url: `${apiUrls.base}`,
gasPrice: ethers.utils.parseUnits('0.001', 'gwei').toNumber(),
},
baseGoerli: {
chainId: 84531,
url: `${apiUrls.baseGoerli}`,
gasPrice: 20000000000,
gasPrice: ethers.utils.parseUnits('0.0000001', 'gwei').toNumber(),
},
};

Expand Down Expand Up @@ -87,11 +99,29 @@ const config: HardhatUserConfig = {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY || '',
goerli: process.env.ETHERSCAN_API_KEY || '',
sepolia: process.env.ETHERSCAN_API_KEY || '',
polygon: process.env.POLYGONSCAN_API_KEY || '',
polygonMumbai: process.env.POLYGONSCAN_API_KEY || '',
base: process.env.BASESCAN_API_KEY || '',
baseGoerli: process.env.BASESCAN_API_KEY || '',
},
customChains: [
{
network: 'sepolia',
chainId: 11155111,
urls: {
apiURL: 'https://api-sepolia.etherscan.io/api',
browserURL: 'https://sepolia.etherscan.io',
},
},
{
network: 'base',
chainId: 8453,
urls: {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org',
},
},
{
network: 'baseGoerli',
chainId: 84531,
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"tmp-promise": "^3.0.3"
},
"dependencies": {
"@aragon/osx": "^1.3.0-rc0.1",
"@aragon/osx-ethers": "^1.3.0-rc0.1",
"@aragon/osx": "^1.3.0-rc0.3",
"@aragon/osx-ethers": "^1.3.0-rc0.3",
"@ensdomains/ens-contracts": "0.0.20",
"@openzeppelin/contracts": "^4.8.2",
"@openzeppelin/contracts-upgradeable": "^4.8.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const osxContracts: ContractList = activeContractsList;
export const networkNameMapping: NetworkNameMapping = {
mainnet: 'mainnet',
goerli: 'goerli',
sepolia: 'sepolia',
polygon: 'polygon',
polygonMumbai: 'mumbai',
base: 'base',
baseGoerli: 'baseGoerli',
};

Expand Down
15 changes: 5 additions & 10 deletions packages/contracts/utils/ipfs.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import {BytesLike, ethers} from 'ethers';
import IPFS from 'ipfs-http-client';

export async function uploadToIPFS(
content: string,
testing: boolean = true
): Promise<string> {
export async function uploadToIPFS(content: string): Promise<string> {
const client = IPFS.create({
url: testing
? 'https://testing-ipfs-0.aragon.network/api/v0'
: 'https://ipfs-0.aragon.network/api/v0',
url: 'https://prod.ipfs.aragon.network/api/v0',
headers: {
'X-API-KEY': 'b477RhECf8s8sdM7XrkLBs2wHc4kCMwpbcFC55Kt',
},
});

const cid = await client.add(content);
await client.pin.add(cid.cid);
return cid.path;
const res = await client.add(content);
await client.pin.add(res.cid);
return res.cid.toString();
}

export function toHex(input: string): BytesLike {
Expand Down
2 changes: 1 addition & 1 deletion packages/js-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"typescript": "^4.6.2"
},
"dependencies": {
"@aragon/osx-ethers": "1.3.0-rc0",
"@aragon/osx-ethers": "1.3.0-rc0.3",
"@aragon/sdk-client-common": "1.2.0-rc0",
"@aragon/sdk-common": "1.5.0",
"@aragon/simple-storage-ethers": "1.0.0",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
dependencies:
ethers "^5.6.2"

"@aragon/osx-ethers@^1.3.0-rc0.1":
version "1.3.0-rc0.1"
resolved "https://registry.yarnpkg.com/@aragon/osx-ethers/-/osx-ethers-1.3.0-rc0.1.tgz#d8168205d76edfae42e961d5eab5e545c1bacb99"
integrity sha512-KjaEoIXG6+P6cxfX2FzmlTc+A67+l44FxpnSSW0GljyI5kcdFlXIrsgOeyj8iIcKo2iHsCkPibjjNgSc3sP6QA==
"@aragon/[email protected].3", "@aragon/osx-ethers@^1.3.0-rc0.3":
version "1.3.0-rc0.3"
resolved "https://registry.yarnpkg.com/@aragon/osx-ethers/-/osx-ethers-1.3.0-rc0.3.tgz#53c7ee2888e25704932e4450c1518014cb383093"
integrity sha512-8hjNtAni7rGygtZDScJuCUh0QnA5q6gF8zhQycyhCvvjwakxWouLFEySpBPIYoFsMziqFa4E2uu/XyNHQb+YiQ==
dependencies:
ethers "^5.6.2"

"@aragon/osx@^1.3.0-rc0.1":
version "1.3.0-rc0.1"
resolved "https://registry.yarnpkg.com/@aragon/osx/-/osx-1.3.0-rc0.1.tgz#284133efcea4d9c142a24179bc1be6d808f91e6b"
integrity sha512-JGfomBRqeHii6qLRUVmmu+s2xsSHIw0RD3Q38ZFN6P0TiYPK5BVnDnWKpC/6uBdxFrwUi3HwWCMevYEr5nBH/w==
"@aragon/osx@^1.3.0-rc0.3":
version "1.3.0-rc0.3"
resolved "https://registry.yarnpkg.com/@aragon/osx/-/osx-1.3.0-rc0.3.tgz#d35ff40ccbb1b7e24f0c74ecb31953e14d79be73"
integrity sha512-QRxS2jXxYir6p94zjhjfc6HH1R+3D48p0DcMU0nYAzKIhjPXORfEpLTk49CkqldhQkCZZXXKYCwNZ97XzHC00g==
dependencies:
"@ensdomains/ens-contracts" "0.0.11"
"@openzeppelin/contracts" "4.8.1"
Expand Down

0 comments on commit 3ff241a

Please sign in to comment.