Skip to content

Commit 1c1f94b

Browse files
authored
feat: update networks (#183)
* feat: add polygon amoy * feat: remove mumbai * feat: remove xdc * ci: update cov
1 parent 3668fa6 commit 1c1f94b

File tree

6 files changed

+56
-60
lines changed

6 files changed

+56
-60
lines changed

.github/workflows/pull_requests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
tests:
1212
name: Tests
1313
uses: ./.github/workflows/tests.yml
14+
secrets:
15+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
1416

1517
linters:
1618
name: Linters

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
tests:
1515
name: Tests
1616
uses: ./.github/workflows/tests.yml
17+
secrets:
18+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
1719

1820
linters:
1921
name: Linters

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
on:
22
workflow_call:
3+
secrets:
4+
codecov_token:
5+
required: true
36

47
env:
58
NODE_ENV: ci
@@ -47,3 +50,4 @@ jobs:
4750
with:
4851
fail_ci_if_error: true
4952
verbose: true
53+
token: ${{ secrets.codecov_token }}

README.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
<img src="https://img.shields.io/github/license/open-attestation/token-registry" />
1515
</p>
1616

17-
The Electronic Bill of Lading (eBL) is a digital document which you can use to prove the ownership of goods. It is a standardized document accepted by all major shipping lines and customs authorities.
17+
The Electronic Bill of Lading (eBL) is a digital document which you can use to prove the ownership of goods. It is a standardized document accepted by all major shipping lines and customs authorities.
1818

1919
The [Token Registry](https://github.com/Open-Attestation/token-registry) repository contains the following:
2020

21-
* The smart contract code for token registry in the `/contracts` folder
22-
* The node package for using this library in the `/src` folder
21+
- The smart contract code for token registry in the `/contracts` folder
22+
- The node package for using this library in the `/src` folder
2323

2424
## Table of Contents
2525

26-
27-
2826
- [Installation](#installation)
2927
- [Usage](#usage)
3028
- [TradeTrustToken](#tradetrusttoken)
@@ -60,12 +58,12 @@ npm install --save @govtechsg/token-registry
6058

6159
## Usage
6260

63-
Provide one of the following depending on your purpose:
61+
Provide one of the following depending on your purpose:
6462

65-
* To use the package, provide your own
66-
Web3 [provider](https://docs.ethers.io/v5/api/providers/api-providers/)
63+
- To use the package, provide your own
64+
Web3 [provider](https://docs.ethers.io/v5/api/providers/api-providers/)
6765

68-
* To write to the blockchain, provide the [signer](https://docs.ethers.io/v5/api/signer/#Wallet) that exposes the [Typechain (Ethers)](https://github.com/dethcrypto/TypeChain/tree/master/packages/target-ethers-v5) bindings for the contracts
66+
- To write to the blockchain, provide the [signer](https://docs.ethers.io/v5/api/signer/#Wallet) that exposes the [Typechain (Ethers)](https://github.com/dethcrypto/TypeChain/tree/master/packages/target-ethers-v5) bindings for the contracts
6967

7068
### TradeTrustToken
7169

@@ -76,6 +74,7 @@ In this case, an SBT is used because the token is largely restricted to its desi
7674
See issue [#108](https://github.com/Open-Attestation/token-registry/issues/108) for more details.
7775

7876
#### Connecting to an existing token registry
77+
7978
The following is a code example that connects to a token registry:
8079

8180
```ts
@@ -114,6 +113,7 @@ Using the Title Escrow contract, you can manage and represent the ownership of a
114113
The actual owners will use the Title Escrow contract to perform their ownership operations.
115114

116115
#### Connecting to a Title Escrow
116+
117117
The following is a code example that connects to a Title Escrow:
118118

119119
```ts
@@ -137,11 +137,11 @@ function nominate(address beneficiaryNominee) external;
137137
138138
```
139139

140-
* The `transferBeneficiary` transfers only the beneficiary and `transferHolder` transfers only the holder.
140+
- The `transferBeneficiary` transfers only the beneficiary and `transferHolder` transfers only the holder.
141141

142-
* To transfer both the beneficiary and holder in a single transaction, use `transferOwners`.
142+
- To transfer both the beneficiary and holder in a single transaction, use `transferOwners`.
143143

144-
* Transfer of the beneficiary will require a nomination through the `nominate` method.
144+
- Transfer of the beneficiary will require a nomination through the `nominate` method.
145145

146146
#### Surrendering or burning a document
147147

@@ -174,9 +174,10 @@ const nominatedBeneficiary = await connectedEscrow.nominee();
174174

175175
### Title Escrow signable (experimental)
176176

177-
This is similar to the [Title Escrow](#title-escrow) with the additional support for off-chain nomination and the endorsement of beneficiary nominees:
178-
* The on-chain nominee will take precedence.
179-
* The current beneficiary will initiate the transfer transaction with the endorsement.
177+
This is similar to the [Title Escrow](#title-escrow) with the additional support for off-chain nomination and the endorsement of beneficiary nominees:
178+
179+
- The on-chain nominee will take precedence.
180+
- The current beneficiary will initiate the transfer transaction with the endorsement.
180181

181182
With this feature, you can save on gas fees for cases where frequent nominations and endorsements occur between the owners.
182183

@@ -205,7 +206,7 @@ contract TitleEscrowFactory is ITitleEscrowFactory {
205206
206207
```
207208

208-
>**Note:** This is currently an experimental feature. Implementers need to set up a "book-keeping" backend for the signed data.
209+
> **Note:** This is currently an experimental feature. Implementers need to set up a "book-keeping" backend for the signed data.
209210
210211
### Provider & signer
211212

@@ -237,14 +238,14 @@ Using roles, you can grant the users to access only certain functions. Currently
237238
| `AccepterRole` | Able to accept a surrendered token |
238239
| `RestorerRole` | Able to restore a surrendered token |
239240

240-
241241
The admin user can grant a trusted user multiple roles to perform different operations.
242242

243243
To grant roles to the users or revoke roles from them, the admin user can call the following functions:
244244

245245
#### Granting a role to a user
246246

247247
Only the default admin or the role admin will be able to call this function:
248+
248249
<!--Flag: according to the table above, there is no "role admin".-->
249250

250251
```ts
@@ -286,25 +287,25 @@ With Hardhat, you can manage the contract development environment and deployment
286287

287288
Starting from V4, the token registry includes an easy and cost-effective way to deploy the contracts and meanwhile keep the options available for advanced users to set up the contracts in a preferable way.
288289

289-
>**Note:** Before deployment, ensure that you have set up your configuration file. See the [Configuration](#configuration) section for more details. The deployer (configured in your `.env` file) will be the default admin.
290+
> **Note:** Before deployment, ensure that you have set up your configuration file. See the [Configuration](#configuration) section for more details. The deployer (configured in your `.env` file) will be the default admin.
290291
291292
## Quick start
292293

293294
To quickly deploy contracts with ease, you need to supply your token name and symbol to the command:
294295

295296
```
296-
npx hardhat deploy:token --network mumbai --name "The Great Shipping Co." --symbol GSC
297+
npx hardhat deploy:token --network amoy --name "The Great Shipping Co." --symbol GSC
297298
```
298299

299-
The above is the easiest and most cost-effective method to deploy. Currently, this is supported on Ethereum, Sepolia, Polygon, and Polygon Mumbai. The deployed contract will inherit all the standard functionalities from the Token Registry's on-chain contracts. This saves deployment costs and makes the process more convenient for users and integrators.
300+
The above is the easiest and most cost-effective method to deploy. Currently, this is supported on Ethereum, Sepolia, Polygon, and Polygon Amoy. The deployed contract will inherit all the standard functionalities from the Token Registry's on-chain contracts. This saves deployment costs and makes the process more convenient for users and integrators.
300301

301-
>**Note:** Remember to supply the`--network` argument with the name of the network on which you want to deploy. See the [Network configuration](#network-configuration) section for more information on the list of network names.
302+
> **Note:** Remember to supply the`--network` argument with the name of the network on which you want to deploy. See the [Network configuration](#network-configuration) section for more information on the list of network names.
302303
303304
## Advanced usage
304305

305306
For experienced users who want more control over their setup (or have extra fund to spend), a few other options and commands are provided.
306307

307-
>**Important:** Depending on your use case, the gas costs might be higher than the method described in [Quick start](#quick-start).
308+
> **Important:** Depending on your use case, the gas costs might be higher than the method described in [Quick start](#quick-start).
308309
309310
### Token contract
310311

@@ -324,19 +325,20 @@ OPTIONS:
324325
deploy:token: Deploys the TradeTrust token
325326
```
326327

327-
>**Note:**
328-
> * The `--factory` argument is optional. If not provided, the task will use the default Title Escrow Factory.
329-
> * You can also reuse a previously deployed Title Escrow factory by passing its address to the `--factory` argument.
328+
> **Note:**
329+
>
330+
> - The `--factory` argument is optional. If not provided, the task will use the default Title Escrow Factory.
331+
> - You can also reuse a previously deployed Title Escrow factory by passing its address to the `--factory` argument.
330332
331333
#### Standalone contract
332334

333335
To deploy your own modified version or your own copy of the token contract, use the `--standalone` flag:
334336

335337
```
336-
npx hardhat deploy:token --network mumbai --name "The Great Shipping Co." --symbol GSC --verify --standalone
338+
npx hardhat deploy:token --network amoy --name "The Great Shipping Co." --symbol GSC --verify --standalone
337339
```
338340

339-
The above command will deploy a _full token contract_ with the name _The Great Shipping Co._ under the symbol _GSC_ on the Polygon _mumbai_ network using the default Title Escrow factory. The contract will also be _verified_ on Etherscan.
341+
The above command will deploy a _full token contract_ with the name _The Great Shipping Co._ under the symbol _GSC_ on the Polygon _amoy_ network using the default Title Escrow factory. The contract will also be _verified_ on Etherscan.
340342

341343
#### Using an existing Title Escrow factory
342344

@@ -384,17 +386,14 @@ When verifying the contracts through either the Hardhat's verify plugin or passi
384386

385387
The table below shows the network names that are currently pre-configured:
386388

387-
| Network ID | Name | Network | Type |
388-
| ---------- | ------------------------ | ------------ | ---------- |
389-
| `1` | Ethereum Mainnet | `mainnet` | Production |
390-
| `11155111` | Ethereum Testnet Sepolia | `sepolia` | Test |
391-
| `137` | Polygon Mainnet | `polygon` | Production |
392-
| `80001` | Polygon Testnet Mumbai | `mumbai` | Test |
393-
| `50` | XDC Network | `xdc` | Production |
394-
| `51` | XDC Apothem Network | `xdcapothem` | Test |
395-
389+
| Network ID | Name | Network | Type |
390+
| ---------- | ------------------------ | --------- | ---------- |
391+
| `1` | Ethereum Mainnet | `mainnet` | Production |
392+
| `11155111` | Ethereum Testnet Sepolia | `sepolia` | Test |
393+
| `137` | Polygon Mainnet | `polygon` | Production |
394+
| `80002` | Polygon Testnet Amoy | `amoy` | Test |
396395

397-
>**Note:** You can configure the existing networks and add others to which you want to deploy in the `hardhat.config.ts` file.
396+
> **Note:** You can configure the existing networks and add others to which you want to deploy in the `hardhat.config.ts` file.
398397
399398
## Configuration
400399

@@ -417,9 +416,10 @@ DEPLOYER_PK=
417416
MNEMONIC=
418417
```
419418

420-
Only one of the following is needed:
421-
* `DEPLOYER_PK`
422-
* `MNEMONIC`
419+
Only one of the following is needed:
420+
421+
- `DEPLOYER_PK`
422+
- `MNEMONIC`
423423

424424
## Development
425425

@@ -439,6 +439,7 @@ npm run build
439439
```
440440

441441
For more information on the commands below, see the [Deployment](#deployment) section:
442+
442443
```sh
443444
npx hardhat deploy:token
444445
npx hardhat deploy:factory

hardhat.config.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ const config: HardhatUserConfig = {
7474
* Polygon
7575
*/
7676
polygon: POLYGONSCAN_API_KEY!,
77-
polygonMumbai: POLYGONSCAN_API_KEY!,
7877
},
7978
},
8079
networks: {
@@ -89,14 +88,6 @@ const config: HardhatUserConfig = {
8988
...networkConfig,
9089
url: "https://rpc.sepolia.org",
9190
},
92-
xdc: {
93-
...networkConfig,
94-
url: "https://erpc.xinfin.network",
95-
},
96-
xdcapothem: {
97-
...networkConfig,
98-
url: "https://erpc.apothem.network",
99-
},
10091
/**
10192
* Polygon
10293
*/
@@ -106,11 +97,11 @@ const config: HardhatUserConfig = {
10697
// Uncomment line below if using Infura
10798
// url: `https://polygon-mainnet.infura.io/v3/${INFURA_APP_ID}`,
10899
},
109-
mumbai: {
100+
amoy: {
110101
...networkConfig,
111-
url: "https://matic-mumbai.chainstacklabs.com",
102+
url: `https://rpc-amoy.polygon.technology`,
112103
// Uncomment line below if using Infura
113-
// url: `https://polygon-mumbai.infura.io/v3/${INFURA_APP_ID}`,
104+
// url: `https://polygon-amoy.infura.io/v3/${INFURA_APP_ID}`,
114105
},
115106
/**
116107
* Development

src/constants/contract-address.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@ const ChainId = {
22
Ethereum: 1,
33
Sepolia: 11155111,
44
Polygon: 137,
5-
PolygonMumbai: 80001,
6-
XDC: 50,
7-
XDCApothem: 51,
5+
PolygonAmoy: 80002,
86
};
97

108
export const contractAddress = {
119
TitleEscrowFactory: {
1210
[ChainId.Ethereum]: "0xA38CC56c9291B9C1f52F862dd92326d352e710b8",
1311
[ChainId.Sepolia]: "0x5aA71Cc9559bC5e54E9504a81496d9F8454721F5",
1412
[ChainId.Polygon]: "0x5B5F8d94782be18E22420f3276D5ef5a1bc65C53",
15-
[ChainId.PolygonMumbai]: "0x5aA71Cc9559bC5e54E9504a81496d9F8454721F5",
16-
[ChainId.XDC]: "0x50BfCc1b699fD2308B978B7a6A26e3C3Bbad16DC",
17-
[ChainId.XDCApothem]: "0xce28778bE6cF32ef3Ccbc09910258DF592F3b6F1",
13+
[ChainId.PolygonAmoy]: "0x0B0E0DA7Db10dB96f673dBe3796f7A509c68B472",
1814
},
1915
Deployer: {
2016
[ChainId.Ethereum]: "0x92470d0Fc33Cbf2f04B39696733806a15eD7eef3",
2117
[ChainId.Sepolia]: "0x9eBC30E7506E6Ce36eAc5507FCF0121BaF7AeA57",
2218
[ChainId.Polygon]: "0x92470d0Fc33Cbf2f04B39696733806a15eD7eef3",
23-
[ChainId.PolygonMumbai]: "0x9eBC30E7506E6Ce36eAc5507FCF0121BaF7AeA57",
19+
[ChainId.PolygonAmoy]: "0x7a46A1eA20E260987a28b192efbfBb266C097C42",
2420
},
2521
TokenImplementation: {
2622
[ChainId.Ethereum]: "0xd3F09dD800525Ecf7e452C3c167C7c716632d016",
2723
[ChainId.Sepolia]: "0xC78BA1a49663Ef8b920F36B036E91Ab40D8F26D6",
2824
[ChainId.Polygon]: "0xd3F09dD800525Ecf7e452C3c167C7c716632d016",
29-
[ChainId.PolygonMumbai]: "0x83A533397eFE1d90baA26dEc7743626d7598656F",
25+
[ChainId.PolygonAmoy]: "0x718355AE8c625C3A84F734fCC1D59aAd1700f819",
3026
},
3127
};

0 commit comments

Comments
 (0)