Skip to content

Commit

Permalink
Update readme and remove and add consumer hardhat tasks (#26)
Browse files Browse the repository at this point in the history
* explain how to connect consumer to existing payment account

* make contract param optional in add and remove consumer tasks

* remove console log from hardhat config

* fix typos in readme

---------

Co-authored-by: Bisonai <[email protected]>
  • Loading branch information
Intizar-T and Bisonai authored May 3, 2024
1 parent 8efec55 commit 46675ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Executing the script will provide you with the cost associated with a single VRF
There are two types of payments supported by Orakle Network VRF: **Prepayment** and **Direct Payment**.

**Prepayment** requires user to create account and fund it with KLAY before being able to use it.
The script below will create a new account and deposit ` 2.5` KLAY from address corresponding to your mnemonic from `.env` file.
The script below will create a new account and deposit ` 2.5` KLAY from address corresponding to your mnemonic or private key from `.env` file.

If you prefer to use Orakl Network VRF without having a long-lasting account, you can use **Direct Payment** method.
In such case, you can skip the following command and go directly to **Request VRF with Direct Payment**.
Expand All @@ -103,6 +103,9 @@ After successfully executing the command above, set the value of environment var
If you do not do it, the request for VRF using Prepayment won't be working properly.
After setting the `ACC_ID` in `.env` file, you can move to the next step **Request VRF with Prepayment**.

If you'd like to use your existing prepayment account, set your account id in the `.env` file and add your deployed consumer to your account by executing the hardhat `addConsumer` task (described in more detail below). Note that providing `account-id` parameter is optional if your account id is already in the `.env` file and `consumer` parameter is also optional if you've deployed your consumer using hardhat under this repository.


## Request & Read VRF

Before running following scripts, one must deploy `VRFConsumer` smart contract.
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ task('withdraw', 'Withdraw $KLAY from account')
})

task('addConsumer', 'Add consumer')
.addParam('consumer', 'Consumer Address')
.addOptionalParam('consumer', 'Consumer Address')
.addOptionalParam('accountId', 'Account Id')
.setAction(async (taskArgs, hre) => {
const accId = taskArgs.accountId || process.env.ACC_ID
Expand All @@ -163,7 +163,7 @@ task('addConsumer', 'Add consumer')
})

task('removeConsumer', 'Remove consumer')
.addParam('consumer', 'Consumer Address')
.addOptionalParam('consumer', 'Consumer Address')
.addOptionalParam('accountId', 'Account Id')
.setAction(async (taskArgs, hre) => {
const accId = taskArgs.accountId || process.env.ACC_ID
Expand Down

0 comments on commit 46675ae

Please sign in to comment.