diff --git a/gsn/compose.yml b/gsn/compose.yml index 3bc33260..32a7c183 100644 --- a/gsn/compose.yml +++ b/gsn/compose.yml @@ -7,7 +7,7 @@ services: build: context: ./ working_dir: /app/packages/deployer - command: ["yarn", "deploy", "--network", "dev"] + entrypoint: ["yarn", "deploy"] networks: - eth_network volumes: @@ -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 @@ -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 diff --git a/gsn/deploy/config/deployment-config.ts b/gsn/deploy/config/deployment-config.ts index ee9255d5..f0e267a8 100644 --- a/gsn/deploy/config/deployment-config.ts +++ b/gsn/deploy/config/deployment-config.ts @@ -2,6 +2,7 @@ module.exports = { '18021980': { environmentsKey: 'ethereumMainnet', relayHubConfiguration: { + // User 1. devAddress: '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc', devFee: 10 }, @@ -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' } + } } } \ No newline at end of file diff --git a/gsn/deploy/config/hardhat.config.ts b/gsn/deploy/config/hardhat.config.ts index ad73856f..8ddad377 100644 --- a/gsn/deploy/config/hardhat.config.ts +++ b/gsn/deploy/config/hardhat.config.ts @@ -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'))) { @@ -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', @@ -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") + }, } }