Skip to content

Commit

Permalink
feat: added network fees to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
osslgtm committed Sep 12, 2023
1 parent 4a74869 commit 8908f3f
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,63 @@ npx -p @govtechsg/open-attestation-cli open-attestation <arguments>

## Usage

### Network Fees

For information on how network fees work, please refer to the ethereum documentation: [https://ethereum.org/en/developers/docs/gas/](https://ethereum.org/en/developers/docs/gas/)

#### Adjusting preset gas price

To adjust transaction gas price, use the variable of `priority` to scale against the market price.

Calculation:
priority \* previous block priority fee

Example:

| Priority | Previous block priority fee | Priority Fee to use |
| -------- | --------------------------- | ------------------- |
| 1 | 1 | 1 \* 1 = 1 |
| 1.2 | 1 | 1.2 \* 1 = 1.2 |
| 2 | 1 | 2 \* 1 = 2 |
| 1 | 10 | 1 \* 10 = 10 |
| 1.2 | 10 | 1.2 \* 10 = 12 |
| 2 | 10 | 2 \* 10 = 20 |

#### Fee Information

To display an estimated price of a transaction use the option of `dry-run` on your command.

Example:

```bash
open-attestation deploy document-store "My Name" --network sepolia --dry-run

/!\ Welcome to the fee table. Please read the information below to understand the transaction fee

The table below display information about the cost of the transaction on the mainnet network, depending on the gas price selected. Multiple modes are displayed to help you better help you to choose a gas price depending on your needs:

Information about the network:
Costs based on block number: 4275264
┌─────────┬──────────────┬──────────────────┬─────────────────────────────────┬────────────────────────┐
│ (index) │ block number │ gas price (gwei) │ max priority fee per gas (gwei) │ max fee per gas (gwei) │
├─────────┼──────────────┼──────────────────┼─────────────────────────────────┼────────────────────────┤
│ current │ 4275264 │ '0.629067134''2.5''3.758131382'
└─────────┴──────────────┴──────────────────┴─────────────────────────────────┴────────────────────────┘
Information about the transaction:
Estimated gas required: 869810 gas, which will cost approximately US$0.86837 based on prevailing gas price.
┌──────────┬───────────────────────┬────────────────────┬───────────────────────┐
│ (index) │ gas cost │ priority fee price │ max fee price │
├──────────┼───────────────────────┼────────────────────┼───────────────────────┤
│ GWEI │ '547168.88382454''2174525.0''3268860.25737742'
│ ETH │ '0.00054716888382454''0.002174525''0.00326886025737742'
│ ETHUSD │ 0.86837 │ 3.45105 │ 5.18781 │
│ ETHSGD │ 1.18247 │ 4.69931 │ 7.06426 │
│ MATICUSD │ 0.00027 │ 0.00109 │ 0.00165 │
│ MATICSGD │ 0.00037 │ 0.00149 │ 0.00225 │
└──────────┴───────────────────────┴────────────────────┴───────────────────────┘
Please read the information above to understand the table
```

#### List of features with the required options

| | Private Key | Wallet | Aws Kms |
Expand Down Expand Up @@ -694,6 +751,7 @@ Example - with private key set in `OA_PRIVATE_KEY` environment variable (recomme
open-attestation title-escrow accept-surrendered --token-registry 0x4933e30eF8A083f49d14759b2eafC94E56F0b3A7 --tokenId 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 --network sepolia
✔ success Surrendered transferable record with hash 0x951b39bcaddc0e8882883db48ca258ca35ccb01fee328355f0dfda1ff9be9990 has been accepted.
```
## Help
Expand Down

0 comments on commit 8908f3f

Please sign in to comment.