Skip to content

Commit

Permalink
feat: deprecate ropsten and rinkeby (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaackps authored Oct 27, 2022
1 parent 89e062d commit d04dbd3
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 74 deletions.
59 changes: 33 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ npx -p @govtechsg/open-attestation-cli open-attestation <arguments>
| Network | Chain ID | Type |
| ------- | -------- | ---------- |
| mainnet | 1 | Production |
| ropsten | 3 | Test |
| rinkeby | 4 | Test |
| goerli | 5 | Test |
| polygon | 137 | Production |
| mumbai | 80001 | Test |
Expand Down Expand Up @@ -259,7 +257,7 @@ open-attestation deploy token-registry <registry-name> <registry-symbol> [option
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation deploy token-registry "My Sample Token" MST --network ropsten
open-attestation deploy token-registry "My Sample Token" MST --network goerli
✔ success Token registry deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842
```
Expand All @@ -275,7 +273,7 @@ open-attestation deploy title-escrow --network <NETWORK> --address <TOKEN_REGIST
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation deploy title-escrow --network ropsten --address 0x4B127b8d5e53872d403ce43414afeb1db67B1842 --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca
open-attestation deploy title-escrow --network goerli --address 0x4B127b8d5e53872d403ce43414afeb1db67B1842 --beneficiary 0x6FFeD6E6591b808130a9b248fEA32101b5220eca --holder 0x6FFeD6E6591b808130a9b248fEA32101b5220eca
✔ success Title escrow deployed at 0xB26B4941941C51a4885E5B7D3A1B861E54405f90
```
Expand All @@ -291,7 +289,7 @@ open-attestation token-registry issue --network <NETWORK> --address <TOKEN_REGIS
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation token-registry mint --network ropsten --address 0x6133f580aE903b8e79845340375cCfd78a45FF35 --tokenId 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c --to 0xB26B4941941C51a4885E5B7D3A1B861E54405f90
open-attestation token-registry mint --network goerli --address 0x6133f580aE903b8e79845340375cCfd78a45FF35 --tokenId 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c --to 0xB26B4941941C51a4885E5B7D3A1B861E54405f90
✔ success Token with hash 0x10ee711d151bc2139473a57531f91d961b639affb876b350c31d031059cdcc2c has been issued on 0x6133f580aE903b8e79845340375cCfd78a45FF35 with the initial recipient being 0xB26B4941941C51a4885E5B7D3A1B861E54405f90
Expand All @@ -312,7 +310,7 @@ open-attestation deploy document-store <store-name> [options]
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation deploy document-store "My Name" --network ropsten
open-attestation deploy document-store "My Name" --network goerli
✔ success Document store deployed at 0x4B127b8d5e53872d403ce43414afeb1db67B1842
```
Expand All @@ -328,7 +326,7 @@ open-attestation document-store issue --address <DOCUMENT_STORE_ADDRESS> --hash
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation document-store issue --network ropsten --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1
open-attestation document-store issue --network goerli --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1
✔ success Document/Document Batch with hash 0x0c1a666aa55d17d26412bb57fbed96f40ec5a08e2f995a108faf45429ae3511f has been issued on 0x19f89607b52268D0A19543e48F790c65750869c6
```
Expand All @@ -344,7 +342,7 @@ open-attestation document-store revoke --address <DOCUMENT_STORE_ADDRESS> --hash
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation document-store revoke --network ropsten --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1
open-attestation document-store revoke --network goerli --address 0x19f89607b52268D0A19543e48F790c65750869c6 --hash 0x43033b53a462036304f526aeaf3aaeea8d905997d6fde3bb1a02188eadbaaec1
✔ success Document/Document Batch with hash 0x0c1a666aa55d17d26412bb57fbed96f40ec5a08e2f995a108faf45429ae3511f has been revoked on 0x19f89607b52268D0A19543e48F790c65750869c6
```
Expand All @@ -360,7 +358,7 @@ open-attestation document-store transfer-ownership --address <DOCUMENT_STORE_ADD
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation document-store transfer-ownership --address 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 --new-owner 0xf81ea9d2c0133de728d28b8d7f186bed61079997 --network ropsten
open-attestation document-store transfer-ownership --address 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 --new-owner 0xf81ea9d2c0133de728d28b8d7f186bed61079997 --network goerli
✔ success Ownership of document store 0x80732bF5CA47A85e599f3ac9572F602c249C8A28 has been transferred to new wallet 0xf81ea9d2c0133de728d28b8d7f186bed61079997
```
Expand All @@ -370,7 +368,7 @@ open-attestation document-store transfer-ownership --address 0x80732bF5CA47A85e5
Verify if a document is valid.
```bash
open-attestation verify --document ./examples/wrapped-documents/example.0.json --network ropsten
open-attestation verify --document ./examples/wrapped-documents/example.0.json --network goerli
… awaiting Verifying examples/wrapped-documents/example.0.json
✔ success The document is valid
Expand Down Expand Up @@ -475,29 +473,29 @@ Example:

```bash
# Using encrypted-wallet-path option
open-attestation deploy document-store "My Name" --network ropsten --encrypted-wallet-path /path/to/wallet.json
open-attestation deploy document-store "My Name" --network goerli --encrypted-wallet-path /path/to/wallet.json
# Then you will be prompted to type your password to decrypt the wallet
? Wallet password [input is hidden]
# Using environment variable
export OA_PRIVATE_KEY=0000000000000000000000000000000000000000000000000000000000000001
open-attestation deploy document-store "My Name" --network ropsten
open-attestation deploy document-store "My Name" --network goerli
unset OA_PRIVATE_KEY
# Using private key stored in file
echo -n 0000000000000000000000000000000000000000000000000000000000000002 >> ./examples/sample-key
open-attestation deploy document-store "My Name" --network ropsten --key-file ./examples/sample-key
open-attestation deploy document-store "My Name" --network goerli --key-file ./examples/sample-key
rm ./examples/sample-key
# Providing the key to the command
open-attestation deploy document-store "My Name" --network ropsten --key 0000000000000000000000000000000000000000000000000000000000000003
open-attestation deploy document-store "My Name" --network goerli --key 0000000000000000000000000000000000000000000000000000000000000003
```

### Config (Create configuration file)

This command will generate a config file with sandbox DNS, document store and token registry.

> Please note that a wallet.json file in ropsten network with sufficient **funds** must be provided in order for this command to work.
> Please note that a wallet.json file with sufficient **funds** in goerli network must be provided in order for this command to work.

You will need:

Expand All @@ -512,30 +510,39 @@ There are 2 ways of using this command to generate a config file, both in which,

This method will generate the most basic config file with a sandbox DNS, document store and token registry. The reference config templates are [here](https://github.com/TradeTrust/document-creator-website/tree/master/src/test/fixtures/config/_generated-config-files/v2).

Step 1: Generate a wallet.json file
Step 1a: Generate a wallet.json file

```
// If you already have a wallet.json that is in ropsten network with sufficient funds, you can skip this step.
open-attestation wallet create --output-file wallet.json --fund ropsten
// If you already have a wallet.json that has sufficient funds in goerli network, you can skip this step.
open-attestation wallet create --output-file wallet.json
```

Step 1b: Add fund into the newly created wallet.json

Currently, we do not provide any faucet to dispense any funds into the wallet.json. You can search the web for some faucets.

Step 2: Generate config file by passing in the generated wallet.json file

```
// Please note that to proceed successfully with this step you would require a wallet.json with sufficient funds.
open-attestation config create --output-dir ./example-configs --encrypted-wallet-path </path/to>/wallet.json --config-template-url <remote url>
```

#### Method 2: Using config-template-path option

This method will generate a copy of your existing config file with the updated sandbox DNS, document store and token registry.

Step 1: Generate a wallet.json file
Step 1a: Generate a wallet.json file

```
// If you already have a wallet.json that is in ropsten network with sufficient funds, you can skip this step.
open-attestation wallet create --output-file wallet.json --fund ropsten
// If you already have a wallet.json that has sufficient funds in goerli network, you can skip this step.
open-attestation wallet create --output-file wallet.json
```

Step 1b: Add fund into the newly created wallet.json

Currently, we do not provide any faucet to dispense any funds into the wallet.json. You can search the web for some faucets.

Step 2: Generate config file by passing in the generated wallet.json file and a existing config file

```
Expand All @@ -562,11 +569,11 @@ open-attestation transaction cancel --nonce <pending transaction nonce> --gas-pr
Examples:

```
open-attestation transaction cancel --nonce 1 --gas-price 300 --network ropsten --encrypted-wallet-path /path/to/wallet
open-attestation transaction cancel --nonce 1 --gas-price 300 --network goerli --encrypted-wallet-path /path/to/wallet
```

```
open-attestation transaction cancel --transaction-hash 0x000 --network ropsten --encrypted-wallet-path /path/to/wallet
open-attestation transaction cancel --transaction-hash 0x000 --network goerli --encrypted-wallet-path /path/to/wallet
```

### Title Escrow
Expand Down Expand Up @@ -649,7 +656,7 @@ open-attestation title-escrow surrender --token-registry <TOKEN_REGISTRY_ADDRESS
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network ropsten
open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network goerli
✔ success Transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been surrendered.
```
Expand All @@ -665,7 +672,7 @@ open-attestation title-escrow reject-surrendered --token-registry <TOKEN_REGISTR
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network ropsten
open-attestation title-escrow reject-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network goerli
✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been rejected.
```
Expand All @@ -681,7 +688,7 @@ open-attestation title-escrow accept-surrendered --token-registry <TOKEN_REGISTR
Example - with private key set in `OA_PRIVATE_KEY` environment variable (recommended). [More options](#providing-the-wallet).
```bash
open-attestation title-escrow accept-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network ropsten
open-attestation title-escrow accept-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network goerli
✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been accepted.
```
Expand Down
10 changes: 0 additions & 10 deletions src/commands/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ type SupportedNetwork = {
enum NetworkCmdName {
Local = "local",
Mainnet = "mainnet",
Ropsten = "ropsten",
Rinkeby = "rinkeby",
Goerli = "goerli",
Sepolia = "sepolia",
Polygon = "polygon",
Expand Down Expand Up @@ -37,14 +35,6 @@ export const supportedNetwork: {
explorer: "https://etherscan.io",
provider: defaultInfuraProvider("homestead"),
},
[NetworkCmdName.Ropsten]: {
explorer: "https://ropsten.etherscan.io",
provider: defaultInfuraProvider("ropsten"),
},
[NetworkCmdName.Rinkeby]: {
explorer: "https://rinkeby.etherscan.io",
provider: defaultInfuraProvider("rinkeby"),
},
[NetworkCmdName.Goerli]: {
explorer: "https://goerli.etherscan.io",
provider: defaultInfuraProvider("goerli"),
Expand Down
22 changes: 8 additions & 14 deletions src/commands/wallet/create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Argv } from "yargs";
import signale, { error, info } from "signale";
import { Argv } from "yargs";
import { create } from "../../implementations/wallet/create";
import { getLogger } from "../../logger";
import { getErrorMessage, highlight } from "../../utils";
import { CreateWalletCommand } from "./wallet.type";
import { create } from "../../implementations/wallet/create";

const { trace } = getLogger("wallet:create");

Expand All @@ -12,18 +12,12 @@ export const command = "create [options]";
export const describe = "Create a random wallet and encrypt the result into the provided path";

export const builder = (yargs: Argv): Argv =>
yargs
.option("output-file", {
alias: "of",
description: "Write output to a file",
type: "string",
demandOption: true,
})
.option("fund", {
description: "Automatically add funds for the specified network",
type: "string",
choices: ["ropsten"],
});
yargs.option("output-file", {
alias: "of",
description: "Write output to a file",
type: "string",
demandOption: true,
});

export const handler = async (args: CreateWalletCommand): Promise<void> => {
trace(`Args: ${JSON.stringify(args, null, 2)}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"network": "ropsten",
"network": "goerli",
"wallet": {
"type": "ENCRYPTED_JSON",
"encryptedJson": "{\"address\":\"1245e5b64d785b25057f7438f715f4aa5d965733\",\"id\":\"bf069d1b-4e88-487c-b695-f2e03ed7c1ff\",\"version\":3,\"Crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"1f34e7bfdaee4b0778ecea4c8d12a543\"},\"ciphertext\":\"4f6cee88b4776f4f6f8eedf3da11c6a13542aa4bb65d46a5c1bc44c100a96f54\",\"kdf\":\"scrypt\",\"kdfparams\":{\"salt\":\"d931e0ea13032fd70060e40054c5a76c0571f4d840ec91eeda1bf68bdcad84db\",\"n\":1,\"dklen\":32,\"p\":1,\"r\":8},\"mac\":\"06c7897e3ff04245bf4f0765d8b6a8482c1c9981cb46ae88f636f9c83cd0b891\"},\"x-ethers\":{\"client\":\"ethers.js\",\"gethFilename\":\"UTC--2020-05-15T09-03-13.0Z--1245e5b64d785b25057f7438f715f4aa5d965733\",\"mnemonicCounter\":\"99b7f5b6897dcfe22fc7aa00d8e3cf5e\",\"mnemonicCiphertext\":\"6e7c1d38f162e54050b125f1f51b43ca\",\"path\":\"m/44'/60'/0'/0/0\",\"version\":\"0.1\"}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"network": "ropsten",
"network": "goerli",
"wallet": {
"type": "ENCRYPTED_JSON",
"encryptedJson": "{\"address\":\"709731d94d65b078496937655582401157c8a640\",\"id\":\"90167e7e-af5c-44b1-a6a3-2525300d1032\",\"version\":3,\"Crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"02004e981623b906938a205c24805bef\"},\"ciphertext\":\"06568387223b88fe860bfed23442966124fe38e463fdb5501a0a0f8b9d1519db\",\"kdf\":\"scrypt\",\"kdfparams\":{\"salt\":\"56b3c1e89f4d8a3f76564d4e6f64e832e46729c881764328a4509a2e96c052fe\",\"n\":131072,\"dklen\":32,\"p\":1,\"r\":8},\"mac\":\"7611744a709d7cac37379617e8ddd9f134658b7a99b09f55eeaa50b4af6e0d39\"},\"x-ethers\":{\"client\":\"ethers.js\",\"gethFilename\":\"UTC--2021-02-01T06-07-08.0Z--709731d94d65b078496937655582401157c8a640\",\"mnemonicCounter\":\"f2706de1481a3541e7b49885f9a21fa7\",\"mnemonicCiphertext\":\"7eb14f3487659d100e5dddac1cef72dd\",\"path\":\"m/44'/60'/0'/0/0\",\"locale\":\"en\",\"version\":\"0.1\"}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"network": "ropsten",
"network": "goerli",
"wallet": {
"type": "ENCRYPTED_JSON",
"encryptedJson": "{\"address\":\"1245e5b64d785b25057f7438f715f4aa5d965733\",\"id\":\"bf069d1b-4e88-487c-b695-f2e03ed7c1ff\",\"version\":3,\"Crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"1f34e7bfdaee4b0778ecea4c8d12a543\"},\"ciphertext\":\"4f6cee88b4776f4f6f8eedf3da11c6a13542aa4bb65d46a5c1bc44c100a96f54\",\"kdf\":\"scrypt\",\"kdfparams\":{\"salt\":\"d931e0ea13032fd70060e40054c5a76c0571f4d840ec91eeda1bf68bdcad84db\",\"n\":1,\"dklen\":32,\"p\":1,\"r\":8},\"mac\":\"06c7897e3ff04245bf4f0765d8b6a8482c1c9981cb46ae88f636f9c83cd0b891\"},\"x-ethers\":{\"client\":\"ethers.js\",\"gethFilename\":\"UTC--2020-05-15T09-03-13.0Z--1245e5b64d785b25057f7438f715f4aa5d965733\",\"mnemonicCounter\":\"99b7f5b6897dcfe22fc7aa00d8e3cf5e\",\"mnemonicCiphertext\":\"6e7c1d38f162e54050b125f1f51b43ca\",\"path\":\"m/44'/60'/0'/0/0\",\"version\":\"0.1\"}}"
Expand Down
10 changes: 4 additions & 6 deletions src/implementations/deploy/title-escrow/title-escrow.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { TransactionReceipt } from "@ethersproject/providers";
import { TitleEscrowFactory } from "@govtechsg/token-registry";
import { getWalletOrSigner } from "../../utils/wallet";
import signale from "signale";
import { getLogger } from "../../../logger";
import { TransactionReceipt } from "@ethersproject/providers";
import { DeployTitleEscrowCommand } from "../../../commands/deploy/deploy.types";
import { validateAddress } from "../../utils/validation";
import { getLogger } from "../../../logger";
import { dryRunMode } from "../../utils/dryRun";
import { validateAddress } from "../../utils/validation";
import { getWalletOrSigner } from "../../utils/wallet";

const { trace } = getLogger("deploy:title-escrow");

const CREATOR_CONTRACTS: { [network: string]: string } = {
mainnet: "0x907A4D491A09D59Bcb5dC38eeb9d121ac47237F1",
ropsten: "0xB0dE5E22bAc12820b6dbF6f63287B1ec44026c83",
rinkeby: "0xa51B8dAC076d5aC80507041146AC769542aAe195",
goerli: "0x3906daFc722089A8eb3D07D833CDE3C84629FF52",
};

Expand Down
Loading

0 comments on commit d04dbd3

Please sign in to comment.