Skip to content

Commit

Permalink
Adds Amoy as a network for OpenGSN.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesduncombe committed Apr 4, 2024
1 parent eea231a commit d6a8a4e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 14 deletions.
17 changes: 14 additions & 3 deletions gsn/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
build:
context: ./
working_dir: /app/packages/deployer
command: ["yarn", "deploy", "--network", "dev"]
entrypoint: ["yarn", "deploy"]
networks:
- eth_network
volumes:
Expand All @@ -20,9 +20,14 @@ services:
- type: bind
source: ./deploy/config/deployment-config.ts
target: /app/packages/deployer/deployments/deployment-config.ts
# Deployments held in memory.
- type: tmpfs
- type: bind
source: ./deploy/data/deployments
target: /app/packages/deployer/deployments/networks
secrets:
- source: gsn_amoy_deployer_key_json
target: /app/packages/deployer/conf/keys.amoy.json
- source: gsn_dev_deployer_key_json
target: /app/packages/deployer/conf/keys.dev.json

gsn_relay:
image: ts-opengsn
Expand Down Expand Up @@ -52,3 +57,9 @@ networks:
eth_network:
name: eth_network
external: true

secrets:
gsn_amoy_deployer_key_json:
environment: GSN_AMOY_DEPLOYER_KEY_JSON
gsn_dev_deployer_key_json:
environment: GSN_DEV_DEPLOYER_KEY_JSON
19 changes: 19 additions & 0 deletions gsn/deploy/config/deployment-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
'18021980': {
environmentsKey: 'ethereumMainnet',
relayHubConfiguration: {
// User 1.
devAddress: '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc',
devFee: 10
},
Expand All @@ -15,5 +16,23 @@ module.exports = {
// This is tied into our dev setup.
minimumStakePerToken: { '0x3E8174689882c629de7478B4a0336266B6560C6D': '0.00000000000005' }
}
},
// Polygon - Amoy.
'80002': {
environmentsKey: 'ethereumMainnet',
relayHubConfiguration: {
// Deployer.
devAddress: '0x61B1E290d2F465d6667336d4934941aa2517AfA2',
devFee: 10
},
deploymentConfiguration: {
registrationMaxAge: 15552000,
paymasterDeposit: '0.1',
isArbitrum: false,
deployTestPaymaster: false,
deploySingleRecipientPaymaster: false,
// Set the staking token to a small number of X tokens.
minimumStakePerToken: { 'test': '0.00000000000005' }
}
}
}
37 changes: 26 additions & 11 deletions gsn/deploy/config/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@ import '@nomiclabs/hardhat-etherscan'

import fs from 'fs'
import { type HardhatUserConfig } from 'hardhat/config'
import { type NetworkUserConfig } from 'hardhat/src/types/config'
import path from 'path'
import chalk from 'chalk'
import './src/exportTask'

function getNetwork(url: string): NetworkUserConfig {
return {
url,
accounts: [
/* user1 - exposed local dev account */ "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
]
}
}

const CONTRACTS_LINK = 'contracts-link'

if (!fs.existsSync(path.join(CONTRACTS_LINK, 'RelayHub.sol'))) {
Expand All @@ -33,6 +23,17 @@ if (!fs.existsSync(path.join(CONTRACTS_LINK, 'paymasters/SingleRecipientPaymaste
fs.symlinkSync('../../paymasters/contracts', CONTRACTS_LINK + '/paymasters')
}

export const accounts = (networkName: string): string[] => {
try {
return JSON.parse(
fs.readFileSync(`./conf/keys.${networkName}.json`, "utf8")
);
} catch (_error) {
console.warn(`Cannot read keys file at conf/keys.${networkName}.json .`);
return [];
}
};

const config: HardhatUserConfig = {
solidity: {
version: '0.8.7',
Expand All @@ -49,7 +50,21 @@ const config: HardhatUserConfig = {
networks: {
// TS updates
// Local geth node
dev: getNetwork('http://geth:8546'),
dev: {
url: 'http://geth:8546',
chainId: 18021980,
saveDeployments: true,
live: true,
accounts: accounts("dev")
},
// Polygon Amoy
amoy: {
url: "https://rpc-amoy.polygon.technology",
chainId: 80002,
saveDeployments: true,
live: true,
accounts: accounts("amoy")
},
}
}

Expand Down

0 comments on commit d6a8a4e

Please sign in to comment.