diff --git a/.github/ISSUE_TEMPLATE/--questions-and-others.md b/.github/ISSUE_TEMPLATE/--questions-and-others.md
index c30bc7f..87a40e2 100644
--- a/.github/ISSUE_TEMPLATE/--questions-and-others.md
+++ b/.github/ISSUE_TEMPLATE/--questions-and-others.md
@@ -1,6 +1,6 @@
---
name: "❓ Questions and Others"
-about: Questions regarding Klaytn Developer SDK or other issues not related to bug nor feature request
+about: Questions regarding Klaytn Service SDK or other issues not related to bug nor feature request
title: ''
labels: ''
assignees: ''
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index ffea314..d807efe 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -15,7 +15,7 @@ Please put an x in the boxes related to your change.
*Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.*
-- [ ] I have read the [CONTRIBUTING GUIDELINES](https://github.com/klaytn/klaytn-developer-sdk/blob/main/CONTRIBUTING.md) doc
+- [ ] I have read the [CONTRIBUTING GUIDELINES](https://github.com/klaytn/klaytn-service-sdk/blob/main/CONTRIBUTING.md) doc
- [ ] I have signed the CLA by posting "I have read the CLA Document and I hereby sign the CLA" in the comment
- [ ] Lint and unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 9fcdcb1..1d7f654 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -26,12 +26,12 @@ jobs:
- name: testing
run: npm run test
- name: Publish package on NPM 📦
- run: npx pnpm --filter "@klaytn/kds-*" --filter !"@klaytn/kds-cli" -r publish --no-git-check --access public
+ run: npx pnpm --filter "@klaytn/kss-*" --filter !"@klaytn/kss-cli" -r publish --no-git-check --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- - name: Install kds-cli dependencies
- run: cd packages/kds-cli && npm install --force
- - name: Publish kds-cli package on NPM 📦
- run: npx pnpm --filter "@klaytn/kds-cli" -r publish --no-git-check --access public
+ - name: Install kss-cli dependencies
+ run: cd packages/kss-cli && npm install --force
+ - name: Publish kss-cli package on NPM 📦
+ run: npx pnpm --filter "@klaytn/kss-cli" -r publish --no-git-check --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index b481b60..9bf5503 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,3 +101,4 @@ lint/tmp/
gas-report.txt
contracts/test/fuzzing/crytic-export!
+deployedContracts.json
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0b1e689..8bd2ed5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -22,10 +22,10 @@ There are various ways to contribute and participate. Please read the guidelines
### Issues and Bugs
-If you find a bug or other issues in Klaytn, please [submit an issue](https://github.com/klaytn/klaytn-developer-sdk/issues). Before submitting an issue, please invest some extra time to figure out that:
+If you find a bug or other issues in Klaytn, please [submit an issue](https://github.com/klaytn/klaytn-service-sdk/issues). Before submitting an issue, please invest some extra time to figure out that:
- The issue is not a duplicate issue.
-- The issue has not been fixed in the latest release of klaytn-developer-sdk.
+- The issue has not been fixed in the latest release of klaytn-service-sdk.
Please do not use the issue tracker for personal support requests. Use developer@klaytn.foundation for the personal support requests.
When you report a bug, please make sure that your report has the following information.
@@ -33,11 +33,11 @@ When you report a bug, please make sure that your report has the following infor
- A clear and complete description of the issue.
- Code and/or screen captures are highly recommended.
-After confirming your report meets the above criteria, [submit the issue](https://github.com/klaytn/klaytn-developer-sdk/issues). Please use [labels](#usage-of-labels) to categorize your issue.
+After confirming your report meets the above criteria, [submit the issue](https://github.com/klaytn/klaytn-service-sdk/issues). Please use [labels](#usage-of-labels) to categorize your issue.
### Feature Requests
-You can also use the [issue tracker](https://github.com/klaytn/klaytn-developer-sdk/issues) to request a new feature or enhancement. Note that any code contribution without an issue link will not be accepted.
+You can also use the [issue tracker](https://github.com/klaytn/klaytn-service-sdk/issues) to request a new feature or enhancement. Note that any code contribution without an issue link will not be accepted.
Please submit an issue explaining your proposal first so that the Klaytn developer community can fully understand and discuss the idea. Please use [labels](#usage-of-labels) for your feature request as well.
diff --git a/README.md b/README.md
index 46609e2..fb89dd5 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
![Logo](./KlaytnLogo.png)
-- [Klaytn Developer SDK](#klaytn-developer-sdk)
+- [Klaytn Service SDK](#klaytn-service-sdk)
- [Oracles Module](#oracles-module)
- - [Chainlink](#chainlink)
- [Witnet](#witnet)
- [Bridges Module](#bridges-module)
- [Celer Bridge](#celer-bridge)
@@ -13,22 +12,16 @@
- [Requirement](#requirement)
- [Quickstart](#quickstart)
- [Usage](#usage)
- - [Want to Contribute to Klaytn Developer SDK? ](#want-to-contribute-to-klaytn-developer-sdk-)
+ - [Want to Contribute to Klaytn Service SDK? ](#want-to-contribute-to-klaytn-service-sdk-)
-# Klaytn Developer SDK
-
Klaytn Developer SDK is a monorepo of all the ecosystem tools. It has all the packages necessary to build on Klaytn ecosystem
+# Klaytn Service SDK
+Klaytn Service SDK is a monorepo of all the ecosystem tools. It has all the packages necessary to build on Klaytn ecosystem
## Oracles Module
-### Chainlink
-Implementation of the following 4 Chainlink features using the [Hardhat](https://hardhat.org/) development environment:
-- [Chainlink Data Feeds on Klaytn](/packages/oracles-starter-kit/README.md#chainlink-price-feeds)
-- [Chainlink VRF on Klaytn](/packages/oracles-starter-kit/README.md#chainlink-vrf-get-a-random-number)
-- [Chainlink Keepers on Klaytn](/packages/oracles-starter-kit/README.md#chainlink-keepers)
-- [Request & Receive data on Klaytn](/packages/oracles-starter-kit/README.md#chainlink-request--receive-data)
-
### Witnet
+Implementation of the following features using the [Hardhat](https://hardhat.org/) development environment:
- [Witnet Data Feeds on Klaytn](/packages/oracles-starter-kit/README.md#witnet-price-feeds)
- [Witnet Randomness on Klaytn](/packages/oracles-starter-kit/README.md#witnet-randomness)
@@ -72,10 +65,10 @@ Integration of the following 5 DEX contracts:
### Quickstart
-After installing all the requirements, run the following:
+After installing all the requirements, run the following to setup locally:
```bash
-git clone https://github.com/klaytn/klaytn-developer-sdk
-cd klaytn-developer-sdk
+git clone https://github.com/klaytn/klaytn-service-sdk
+cd klaytn-service-sdk
```
then
```bash
@@ -90,12 +83,12 @@ npm i
# Usage
-You can run the scripts in root or in respective packages by `cd` into the packages.
+You can run the scripts from respective packages by `cd` into the packages.
-## Want to Contribute to Klaytn Developer SDK?
+## Want to Contribute to Klaytn Service SDK?
In line with our commitment to decentralization, all Klaytn codebase and its documentations are completely open source. Klaytn always welcomes your contribution. Anyone can view, edit, fix its contents and make suggestions. You can either create a pull request on GitHub or create a enhancement request. Make sure to check our [Contributor License Agreement (CLA)](https://gist.github.com/e78f99e1c527225637e269cff1bc7e49) first and there are also a few guidelines our contributors would check out before contributing:
- [Contribution Guide](./CONTRIBUTING.md)
- [License](./LICENSE)
-- [Code of Conducts](./code-of-conduct.md)
+- [Code of Conducts](./code-of-conduct.md)
\ No newline at end of file
diff --git a/package.json b/package.json
index a799db1..ed81666 100644
--- a/package.json
+++ b/package.json
@@ -1,33 +1,21 @@
{
- "name": "@klaytn/kds",
- "version": "0.0.5",
+ "name": "@klaytn/kss",
+ "version": "0.0.6",
"author": "Klaytn Community ",
"license": "GPL-3.0",
"repository": {
"type": "git",
- "url": "https://github.com/klaytn/klaytn-developer-sdk.git"
+ "url": "https://github.com/klaytn/klaytn-service-sdk.git"
},
"private": true,
"scripts": {
"build": "wsrun -m build",
"lint": "wsrun -m lint",
- "test": "wsrun -m test",
- "oracle:help": "yarn workspace oracles-starter-kit help",
- "oracle:compile": "yarn workspace oracles-starter-kit compile",
- "oracle:deploy": "yarn workspace oracles-starter-kit deploy",
- "oracle:test": "yarn workspace oracles-starter-kit test",
- "celer:test-transfer": "yarn workspace cbridge-starter-kit test-transfer",
- "celer:test-transfer-refund": "yarn workspace cbridge-starter-kit test-transfer-refund",
- "celer:test-mint": "yarn workspace cbridge-starter-kit test-mint",
- "celer:test-mint-refund": "yarn workspace cbridge-starter-kit test-mint-refund",
- "celer:test-burn": "yarn workspace cbridge-starter-kit test-burn",
- "celer:test-burn-refund": "yarn workspace cbridge-starter-kit test-burn-refund",
- "wormhole:test-attest": "yarn workspace wormhole-starter-kit test-attest",
- "wormhole:test-transfer-basic": "yarn workspace wormhole-starter-kit test-transfer-basic"
+ "test": "wsrun -m test"
},
"workspaces": {
"packages": [
- "packages/!(kds-cli)/**"
+ "packages/!(kss-cli)/**"
],
"nohoist": [
"**/witnet-solidity-bridge"
@@ -39,12 +27,12 @@
},
"keywords": [
"klaytn",
- "klaytn-developer-sdk",
- "kds",
- "@klaytn/kds-cli",
- "@klayt/kds-bridges-celer",
- "@klaytn/kds-bridges-wormhole",
- "@klaytn/kds-dexs",
- "@klaytn/kds-oracles"
+ "klaytn-service-sdk",
+ "kss",
+ "@klaytn/kss-cli",
+ "@klayt/kss-bridges-celer",
+ "@klaytn/kss-bridges-wormhole",
+ "@klaytn/kss-dexs",
+ "@klaytn/kss-oracles"
]
-}
+}
\ No newline at end of file
diff --git a/packages/bridges-starter-kit/celer/README.md b/packages/bridges-starter-kit/celer/README.md
index f3ce6a7..b61ff3b 100644
--- a/packages/bridges-starter-kit/celer/README.md
+++ b/packages/bridges-starter-kit/celer/README.md
@@ -28,13 +28,13 @@ npm install
## Overview
For details information & documentation of each module of this package please refer to the docs linked below.
-- ### [Overview](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/bridges-starter-kit/celer/docs/Overview.md)
-- ### [ParamsExplanation](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/bridges-starter-kit/celer/docs/ParamsExplanation.md)
-- ### [Prerequisites.md](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/bridges-starter-kit/celer/docs/Prerequisites.md)
+- ### [Overview](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/bridges-starter-kit/celer/docs/Overview.md)
+- ### [ParamsExplanation](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/bridges-starter-kit/celer/docs/ParamsExplanation.md)
+- ### [Prerequisites.md](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/bridges-starter-kit/celer/docs/Prerequisites.md)
## Reference Docs:
- https://cbridge-docs.celer.network/developer/cbridge-sdk
- https://github.com/celer-network/cBridge-typescript-client
- https://test-cbridge-v2.celer.network/ (Testnet Website URL)
-- https://cbridge.celer.network (Mainnet Website URL)
+- https://cbridge.celer.network (Mainnet Website URL)
\ No newline at end of file
diff --git a/packages/bridges-starter-kit/celer/docs/Overview.md b/packages/bridges-starter-kit/celer/docs/Overview.md
index c9a9d7d..0d748c5 100644
--- a/packages/bridges-starter-kit/celer/docs/Overview.md
+++ b/packages/bridges-starter-kit/celer/docs/Overview.md
@@ -19,7 +19,7 @@ method. It's a liquidity based transfer in which your assets are locked at sourc
destination_chain (receiving chain) from a pool of liquidity available on the destination chain.
Thanos snap 🫰 for this is:
```
-import { poolTransfer } from "@klaytn/kds-bridges-celer"
+import { poolTransfer } from "@klaytn/kss-bridges-celer"
poolTransfer(transferObj)
```
@@ -43,7 +43,7 @@ Promise `transferId` - `string` Transfer ID for tracking the transaction. To tra
#### Example
```typescript
-const BridgeSDK = require('@klaytn/kds-bridges-celer')
+const BridgeSDK = require('@klaytn/kss-bridges-celer')
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let WALLET_ADDRESS = "0x5Bc0635a264B94A8662e0F2887d76F8E5925F837"
@@ -108,7 +108,7 @@ source_chain by submitting refund request.
🫰 of it:
```
-import{ poolTransferRefund } from "@klaytn/kds-bridges-celer"
+import{ poolTransferRefund } from "@klaytn/kss-bridges-celer"
poolTransferRefund(transferObj)
```
@@ -132,7 +132,7 @@ Promise `transactionReceipt` - `object` blockchain transaction receipt
#### Example
```typescript
-let BridgeSDK = require("@klaytn/kds-bridges-celer");
+let BridgeSDK = require("@klaytn/kss-bridges-celer");
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let WALLET_ADDRESS = "0x5Bc0635a264B94A8662e0F2887d76F8E5925F837"
@@ -167,7 +167,7 @@ method. It's a traditional method in which your assets are locked at source_chai
destination_chain (receiving chain).
Thanos snap 🫰 for this is:
```
-import { mintCanonicalToken } from "@klaytn/kds-bridges-celer"
+import { mintCanonicalToken } from "@klaytn/kss-bridges-celer"
mintCanonicalToken(transferObj)
```
@@ -189,7 +189,7 @@ Promise `depositId` - `string` deposit id
#### Example
```typescript
-let BridgeSDK = require("@klaytn/kds-bridges-celer");
+let BridgeSDK = require("@klaytn/kss-bridges-celer");
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let WALLET_ADDRESS = "0x5Bc0635a264B94A8662e0F2887d76F8E5925F837"
@@ -252,7 +252,7 @@ source_chain by submitting refund request.
🫰 of it:
```
-import{ mintCanonicalTokenRefund } from "@klaytn/kds-bridges-celer"
+import{ mintCanonicalTokenRefund } from "@klaytn/kss-bridges-celer"
mintCanonicalTokenRefund(transferObj)
```
@@ -278,7 +278,7 @@ Promise `transactionReceipt` - `object` blockchain transaction receipt
#### Example
```typescript
-let BridgeSDK = require("@klaytn/kds-bridges-celer");
+let BridgeSDK = require("@klaytn/kss-bridges-celer");
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let WALLET_ADDRESS = "0x5Bc0635a264B94A8662e0F2887d76F8E5925F837"
@@ -316,7 +316,7 @@ destination_chain (the chain on which you want to receive you withdrawn assets).
Thanos snap 🫰 for this is:
```
-import { burnCanonicalToken } from "@klaytn/kds-bridges-celer"
+import { burnCanonicalToken } from "@klaytn/kss-bridges-celer"
burnCanonicalToken(transferObj)
```
@@ -344,7 +344,7 @@ Promise `burnId` - `string` burn id to track the status or refund transaction if
#### Example
```typescript
-let BridgeSDK = require("@klaytn/kds-bridges-celer");
+let BridgeSDK = require("@klaytn/kss-bridges-celer");
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let SRC_CHAIN_RPC= "https://godwoken-testnet-v1.ckbapp.dev"
@@ -406,7 +406,7 @@ source_chain by submitting refund request.
🫰 of it:
```
-import{ burnCanonicalTokenRefund } from "@klaytn/kds-bridges-celer"
+import{ burnCanonicalTokenRefund } from "@klaytn/kss-bridges-celer"
burnCanonicalTokenRefund(transferObj)
```
@@ -431,7 +431,7 @@ Promise `transactionReceipt` - `object` blockchain transaction receipt
#### Example
```typescript
-let BridgeSDK = require("@klaytn/kds-bridges-celer");
+let BridgeSDK = require("@klaytn/kss-bridges-celer");
let CBRIDGE_GATEWAY_URL = "https://cbridge-v2-test.celer.network"
let WALLET_ADDRESS = "0x5Bc0635a264B94A8662e0F2887d76F8E5925F837"
@@ -461,4 +461,3 @@ BridgeSDK.burnCanonicalTokenRefund(
console.log("Transaction Hash: "+contractReceipt.transactionHash)
});
```
-
diff --git a/packages/bridges-starter-kit/celer/package.json b/packages/bridges-starter-kit/celer/package.json
index a4c7d5c..38f94e5 100644
--- a/packages/bridges-starter-kit/celer/package.json
+++ b/packages/bridges-starter-kit/celer/package.json
@@ -1,6 +1,6 @@
{
- "name": "@klaytn/kds-bridges-celer",
- "version": "0.0.5",
+ "name": "@klaytn/kss-bridges-celer",
+ "version": "0.0.6",
"description": "TypeScript client and use-cases for cBridge",
"exports": {
".": "./dist/use-cases/index.js",
@@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/klaytn/klaytn-developer-sdk.git"
+ "url": "https://github.com/klaytn/klaytn-service-sdk.git"
},
"scripts": {
"test-transfer": "mocha -r ts-node/register test/poolTransfer-test.ts -t 2400000",
@@ -27,14 +27,15 @@
"celer",
"bridge",
"pooltransfer",
- "mintcanonicaltoken"
+ "mintcanonicaltoken",
+ "kss-bridges-celer"
],
"author": "Klaytn Community ",
"license": "GPL-3.0",
"bugs": {
- "url": "https://github.com/klaytn/klaytn-developer-sdk/issues"
+ "url": "https://github.com/klaytn/klaytn-service-sdk/issues"
},
- "homepage": "https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/bridges-starter-kit/celer/README.md",
+ "homepage": "https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/bridges-starter-kit/celer/README.md",
"dependencies": {
"axios": "^0.26.1",
"celer-web-utils": "^1.0.9",
@@ -54,4 +55,4 @@
"ts-node": "^10.7.0",
"typescript": "^4.9.4"
}
-}
+}
\ No newline at end of file
diff --git a/packages/bridges-starter-kit/celer/tsconfig.json b/packages/bridges-starter-kit/celer/tsconfig.json
index 74209a2..c32d1cf 100644
--- a/packages/bridges-starter-kit/celer/tsconfig.json
+++ b/packages/bridges-starter-kit/celer/tsconfig.json
@@ -27,6 +27,7 @@
"exclude": ["node_modules/**/*"],
"include": [
"use-cases/**/*",
- "test/*.ts"
-, "test/staging/burnCanonicalToken-test.ts" ]
-}
+ "test/*.ts",
+ "test/staging/burnCanonicalToken-test.ts"
+ ]
+}
\ No newline at end of file
diff --git a/packages/bridges-starter-kit/wormhole/README.md b/packages/bridges-starter-kit/wormhole/README.md
index 7797ce6..df17c7f 100644
--- a/packages/bridges-starter-kit/wormhole/README.md
+++ b/packages/bridges-starter-kit/wormhole/README.md
@@ -23,20 +23,20 @@ Wormhole is a communication bridge between Klaytn and other top decentralized fi
- [use-cases](./use-cases): Ready-to-run code of some use-cases to call the Wormhole Rest APIs.
## Installation
-`npm install @klaytn/kds-bridges-wormhole --save`
+`npm install @klaytn/kss-bridges-wormhole --save`
## Quick Start
BridgeSDK contains the implementation of the bridge use-cases.
CoreBridgeSDK exposes methods of `@certusone/wormhole-sdk` to write custom methods.
```typescript
-import BridgeSDK from '@klaytn/kds-bridges-wormhole';
-import CoreBridgeSDK from '@klaytn/kds-bridges-wormhole/core';
+import BridgeSDK from '@klaytn/kss-bridges-wormhole';
+import CoreBridgeSDK from '@klaytn/kss-bridges-wormhole/core';
or
-const BridgeSDK = require('@klaytn/kds-bridges-wormhole');
-const CoreBridgeSDK = require('@klaytn/kds-bridges-wormhole/core');
+const BridgeSDK = require('@klaytn/kss-bridges-wormhole');
+const CoreBridgeSDK = require('@klaytn/kss-bridges-wormhole/core');
```
You can run following ready-made use-cases to test
@@ -70,8 +70,8 @@ BridgeSDK.attest(config, source, destination)
### Example
```typescript
-const BridgeSDK = require('@klaytn/kds-bridges-wormhole');
-const CoreBridgeSDK = require('@klaytn/kds-bridges-wormhole/core');
+const BridgeSDK = require('@klaytn/kss-bridges-wormhole');
+const CoreBridgeSDK = require('@klaytn/kss-bridges-wormhole/core');
const config = { restAddress: "https://wormhole-v2-testnet-api.certus.one" };
const source = {
@@ -129,8 +129,8 @@ BridgeSDK.transferBasic(config, source, destination, AMOUNT, IS_NATIVE)
### Example
```typescript
-const BridgeSDK = require('@klaytn/kds-bridges-wormhole');
-const CoreBridgeSDK = require('@klaytn/kds-bridges-wormhole/core');
+const BridgeSDK = require('@klaytn/kss-bridges-wormhole');
+const CoreBridgeSDK = require('@klaytn/kss-bridges-wormhole/core');
const config = { restAddress: "https://wormhole-v2-testnet-api.certus.one" };
const source = {
@@ -164,4 +164,4 @@ console.log(result.hash);
- [https://www.npmjs.com/package/@certusone/wormhole-sdk](https://www.npmjs.com/package/@certusone/wormhole-sdk)
- [https://book.wormhole.com/technical/typescript/attestingToken.html](https://book.wormhole.com/technical/typescript/attestingToken.html)
- [Testnet Website URL](https://wormhole-foundation.github.io/example-token-bridge-ui/#/transfer)
-- [Mainnet Website URL](https://www.portalbridge.com/#/transfer)
+- [Mainnet Website URL](https://www.portalbridge.com/#/transfer)
\ No newline at end of file
diff --git a/packages/bridges-starter-kit/wormhole/package.json b/packages/bridges-starter-kit/wormhole/package.json
index ce32717..5a67ffd 100644
--- a/packages/bridges-starter-kit/wormhole/package.json
+++ b/packages/bridges-starter-kit/wormhole/package.json
@@ -1,6 +1,6 @@
{
- "name": "@klaytn/kds-bridges-wormhole",
- "version": "0.0.5",
+ "name": "@klaytn/kss-bridges-wormhole",
+ "version": "0.0.6",
"description": "Typescript and Javascript client and use-cases for wormhole",
"exports": {
".": "./dist/use-cases/index.js",
@@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/klaytn/klaytn-developer-sdk.git"
+ "url": "https://github.com/klaytn/klaytn-service-sdk.git"
},
"scripts": {
"test-attest": "ts-node use-cases/attest.ts",
@@ -23,7 +23,8 @@
"wormhole",
"bridge",
"attest",
- "transfer"
+ "transfer",
+ "kss-bridges-wormhole"
],
"author": "Klaytn Community ",
"license": "GPL-3.0",
@@ -45,4 +46,4 @@
"ts-node": "^10.7.0",
"typescript": "^4.9.4"
}
-}
+}
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/README.md b/packages/dexs-starter-kit/README.md
index b959885..fd4a5ea 100644
--- a/packages/dexs-starter-kit/README.md
+++ b/packages/dexs-starter-kit/README.md
@@ -1,12 +1,11 @@
# DEX Starter Kit
-This module of Klaytn-SDK includes the integration of [@klaytn/dex-contracts](https://github.com/klaytn/klaytn-dex-contracts).
+This module includes the integration of [@klaytn/dex-contracts](https://github.com/klaytn/klaytn-dex-contracts).
# How to setup locally
`npm install`
# Overview
For details information & documentation of each module of this package please refer to the docs linked below.
-- #### [Folder Structure of the package](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/dexs-starter-kit/docs/FolderStructure.md)
-- #### [Prerequisites](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/dexs-starter-kit/docs/Prerequisites.md)
-- #### [How To use](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/dexs-starter-kit/docs/HowToUse.md)
-
+- #### [Folder Structure of the package](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/dexs-starter-kit/docs/FolderStructure.md)
+- #### [Prerequisites](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/dexs-starter-kit/docs/Prerequisites.md)
+- #### [How To use](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/dexs-starter-kit/docs/HowToUse.md)
diff --git a/packages/dexs-starter-kit/docs/HowToUse.md b/packages/dexs-starter-kit/docs/HowToUse.md
index 0070d86..0e5944b 100644
--- a/packages/dexs-starter-kit/docs/HowToUse.md
+++ b/packages/dexs-starter-kit/docs/HowToUse.md
@@ -6,30 +6,30 @@ Make sure you've read the [Prerequisites](./Prerequisites.md) section to ensure
## Liquidity
```js
-import { Liquidity } from '@klaytn/kds-dexs'
+import { Liquidity } from '@klaytn/kss-dexs'
```
## Swap
```js
-import { Swap } from '@klaytn/kds-dexs'
+import { Swap } from '@klaytn/kss-dexs'
```
## Farming
```js
-import { Farming } from '@klaytn/kds-dexs'
+import { Farming } from '@klaytn/kss-dexs'
```
## Staking
```js
-import { Staking } from '@klaytn/kds-dexs'
+import { Staking } from '@klaytn/kss-dexs'
```
## Multisig
```js
-import { Multisig } from '@klaytn/kds-dexs'
+import { Multisig } from '@klaytn/kss-dexs'
```
## Config
```js
-import { Config } from '@klaytn/kds-dexs'
+import { Config } from '@klaytn/kss-dexs'
```
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/README.md b/packages/dexs-starter-kit/docs/typedoc/README.md
index 969af53..2998bcb 100644
--- a/packages/dexs-starter-kit/docs/typedoc/README.md
+++ b/packages/dexs-starter-kit/docs/typedoc/README.md
@@ -1,4 +1,4 @@
-@klaytn/kds-dexs / [Modules](modules.md)
+@klaytn/kss-dexs / [Modules](modules.md)
# DEX Starter Kit
This module of Klaytn-SDK includes the integration of [@klaytn/dex-contracts](https://github.com/klaytn/klaytn-dex-contracts).
@@ -10,4 +10,4 @@ This module of Klaytn-SDK includes the integration of [@klaytn/dex-contracts](ht
For details information & documentation of each module of this package please refer to the docs linked below.
- #### [Folder Structure of the package](./docs/FolderStructure.md)
- #### [Prerequisites](./docs/Prerequisites.md)
-- #### [How To use](./docs/HowToUse.md)
+- #### [How To use](./docs/HowToUse.md)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/Config.md b/packages/dexs-starter-kit/docs/typedoc/classes/Config.md
index 5374604..455b2d6 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/Config.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/Config.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / Config
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / Config
# Class: Config
@@ -40,7 +40,7 @@
#### Defined in
-[Config.ts:12](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L12)
+[Config.ts:12](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L12)
___
@@ -50,7 +50,7 @@ ___
#### Defined in
-[Config.ts:13](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L13)
+[Config.ts:13](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L13)
___
@@ -60,7 +60,7 @@ ___
#### Defined in
-[Config.ts:15](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L15)
+[Config.ts:15](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L15)
___
@@ -70,7 +70,7 @@ ___
#### Defined in
-[Config.ts:11](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L11)
+[Config.ts:11](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L11)
___
@@ -80,7 +80,7 @@ ___
#### Defined in
-[Config.ts:14](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L14)
+[Config.ts:14](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L14)
## Methods
@@ -104,7 +104,7 @@ A getter function to get WKLAY contract's address
#### Defined in
-[Config.ts:59](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L59)
+[Config.ts:59](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L59)
___
@@ -129,7 +129,7 @@ A function to initialize instance of DexPair contract.
#### Defined in
-[Config.ts:50](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L50)
+[Config.ts:50](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L50)
___
@@ -157,7 +157,7 @@ A getter function to fetch instance of DexPair contract.
#### Defined in
-[Config.ts:39](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L39)
+[Config.ts:39](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L39)
___
@@ -184,7 +184,7 @@ A function to initialize the DEX contracts
#### Defined in
-[Config.ts:24](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L24)
+[Config.ts:24](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L24)
___
@@ -210,7 +210,7 @@ A function to initialize instance of Farming contract.
#### Defined in
-[Config.ts:70](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L70)
+[Config.ts:70](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L70)
___
@@ -236,7 +236,7 @@ A function to initialize instance of MultiSigWallet contract.
#### Defined in
-[Config.ts:92](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L92)
+[Config.ts:92](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L92)
___
@@ -262,4 +262,4 @@ A function to initialize instance of Farming contract.
#### Defined in
-[Config.ts:81](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L81)
+[Config.ts:81](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Config.ts#L81)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/Farming.md b/packages/dexs-starter-kit/docs/typedoc/classes/Farming.md
index 0b1fa23..832e807 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/Farming.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/Farming.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / Farming
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / Farming
# Class: Farming
@@ -41,7 +41,7 @@
#### Defined in
-[Farming.ts:7](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L7)
+[Farming.ts:7](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L7)
## Properties
@@ -51,7 +51,7 @@
#### Defined in
-[Farming.ts:5](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L5)
+[Farming.ts:5](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L5)
## Methods
@@ -82,7 +82,7 @@ A function that encodes all the details required to create a new LP farming pool
#### Defined in
-[Farming.ts:88](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L88)
+[Farming.ts:88](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L88)
___
@@ -107,7 +107,7 @@ A function to deposit given amount of LP token in given LP Farming pool.
#### Defined in
-[Farming.ts:17](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L17)
+[Farming.ts:17](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L17)
___
@@ -131,7 +131,7 @@ A function to emergency withdraw funds from given LP farming pool.
#### Defined in
-[Farming.ts:47](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L47)
+[Farming.ts:47](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L47)
___
@@ -149,7 +149,7 @@ A getter function for Farming contract's insstance
#### Defined in
-[Farming.ts:122](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L122)
+[Farming.ts:122](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L122)
___
@@ -175,7 +175,7 @@ A getter function to fetch instance of DexPair contract.
#### Defined in
-[Farming.ts:133](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L133)
+[Farming.ts:133](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L133)
___
@@ -203,7 +203,7 @@ A function that encodes all the details required to grant minter role to Farming
#### Defined in
-[Farming.ts:110](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L110)
+[Farming.ts:110](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L110)
___
@@ -232,7 +232,7 @@ A function that encodes all the details required to update / set LP farming pool
#### Defined in
-[Farming.ts:99](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L99)
+[Farming.ts:99](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L99)
___
@@ -261,7 +261,7 @@ A function that encodes all the details required to update bonusMultiplier of gi
#### Defined in
-[Farming.ts:65](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L65)
+[Farming.ts:65](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L65)
___
@@ -289,7 +289,7 @@ A function that encodes all the details required to update rewardPerBlock of Far
#### Defined in
-[Farming.ts:75](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L75)
+[Farming.ts:75](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L75)
___
@@ -314,4 +314,4 @@ A function to withdraw LP tokens from given LP farming pool
#### Defined in
-[Farming.ts:33](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L33)
+[Farming.ts:33](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Farming.ts#L33)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/Liquidity.md b/packages/dexs-starter-kit/docs/typedoc/classes/Liquidity.md
index 105c9b6..60e50bb 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/Liquidity.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/Liquidity.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / Liquidity
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / Liquidity
# Class: Liquidity
@@ -40,7 +40,7 @@
#### Defined in
-[Liquidity.ts:8](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L8)
+[Liquidity.ts:8](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L8)
## Properties
@@ -50,7 +50,7 @@
#### Defined in
-[Liquidity.ts:6](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L6)
+[Liquidity.ts:6](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L6)
___
@@ -60,7 +60,7 @@ ___
#### Defined in
-[Liquidity.ts:5](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L5)
+[Liquidity.ts:5](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L5)
## Methods
@@ -90,7 +90,7 @@ A function to add liquidity to a given pair of tokens (token0 & token1).
#### Defined in
-[Liquidity.ts:30](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L30)
+[Liquidity.ts:30](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L30)
___
@@ -119,7 +119,7 @@ A function to add liquidity with Klay to a given pair of tokens (token & Klay).
#### Defined in
-[Liquidity.ts:54](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L54)
+[Liquidity.ts:54](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L54)
___
@@ -137,7 +137,7 @@ A getter function to get WKLAY contract's address
#### Defined in
-[Liquidity.ts:134](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L134)
+[Liquidity.ts:134](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L134)
___
@@ -164,7 +164,7 @@ A getter function to fetch instance of DexPair contract.
#### Defined in
-[Liquidity.ts:125](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L125)
+[Liquidity.ts:125](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L125)
___
@@ -182,7 +182,7 @@ A getter function for DEX's Router contract's instance
#### Defined in
-[Liquidity.ts:17](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L17)
+[Liquidity.ts:17](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L17)
___
@@ -210,7 +210,7 @@ A function to remove liquidity from a given pair of tokens (token0 & token1).
#### Defined in
-[Liquidity.ts:76](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L76)
+[Liquidity.ts:76](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L76)
___
@@ -238,4 +238,4 @@ A function to remove liquidity from a given pair of tokens (token & klay).
#### Defined in
-[Liquidity.ts:101](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L101)
+[Liquidity.ts:101](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Liquidity.ts#L101)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/MultiSig.md b/packages/dexs-starter-kit/docs/typedoc/classes/MultiSig.md
index 4d0a758..3fe3e5c 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/MultiSig.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/MultiSig.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / MultiSig
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / MultiSig
# Class: MultiSig
@@ -37,7 +37,7 @@
#### Defined in
-[MultiSig.ts:7](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L7)
+[MultiSig.ts:7](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L7)
## Properties
@@ -47,7 +47,7 @@
#### Defined in
-[MultiSig.ts:5](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L5)
+[MultiSig.ts:5](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L5)
## Methods
@@ -75,7 +75,7 @@ only registered owner on MULTISIG contract can execute this function
#### Defined in
-[MultiSig.ts:34](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L34)
+[MultiSig.ts:34](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L34)
___
@@ -103,7 +103,7 @@ only registered owner on MULTISIG contract can execute this function
#### Defined in
-[MultiSig.ts:58](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L58)
+[MultiSig.ts:58](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L58)
___
@@ -121,7 +121,7 @@ A getter function to return Multisig contract's instance
#### Defined in
-[MultiSig.ts:79](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L79)
+[MultiSig.ts:79](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L79)
___
@@ -145,7 +145,7 @@ A function to check if given transactionId has got enought votes or not
#### Defined in
-[MultiSig.ts:68](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L68)
+[MultiSig.ts:68](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L68)
___
@@ -173,7 +173,7 @@ only registered owner on MULTISIG contract & who has already voted the given tra
#### Defined in
-[MultiSig.ts:46](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L46)
+[MultiSig.ts:46](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L46)
___
@@ -203,4 +203,4 @@ only registered owner on MULTISIG contract & who has already voted the given tra
#### Defined in
-[MultiSig.ts:19](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L19)
+[MultiSig.ts:19](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/MultiSig.ts#L19)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/Staking.md b/packages/dexs-starter-kit/docs/typedoc/classes/Staking.md
index 519531d..d7c505b 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/Staking.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/Staking.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / Staking
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / Staking
# Class: Staking
@@ -43,7 +43,7 @@
#### Defined in
-[Staking.ts:7](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L7)
+[Staking.ts:7](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L7)
## Properties
@@ -53,7 +53,7 @@
#### Defined in
-[Staking.ts:5](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L5)
+[Staking.ts:5](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L5)
## Methods
@@ -77,7 +77,7 @@ A function to deposit given amount of Staked Token in given Staking Pool contrac
#### Defined in
-[Staking.ts:26](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L26)
+[Staking.ts:26](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L26)
___
@@ -106,7 +106,7 @@ A function that encodes all the details required to emergency withdraw funds fro
#### Defined in
-[Staking.ts:113](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L113)
+[Staking.ts:113](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L113)
___
@@ -124,7 +124,7 @@ A function to emergency withdraw funds from given Staking Pool contract.
#### Defined in
-[Staking.ts:56](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L56)
+[Staking.ts:56](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L56)
___
@@ -142,7 +142,7 @@ A getter function to return Staking contract's instance
#### Defined in
-[Staking.ts:174](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L174)
+[Staking.ts:174](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L174)
___
@@ -171,7 +171,7 @@ A function that encodes all the details required to recover token (unintentional
#### Defined in
-[Staking.ts:124](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L124)
+[Staking.ts:124](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L124)
___
@@ -193,7 +193,7 @@ A function that encodes all the details required to stop reward distribution in
#### Defined in
-[Staking.ts:133](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L133)
+[Staking.ts:133](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L133)
___
@@ -222,7 +222,7 @@ A function that encodes all the details required to update pool limit in given s
#### Defined in
-[Staking.ts:144](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L144)
+[Staking.ts:144](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L144)
___
@@ -250,7 +250,7 @@ A function that encodes all the details required to update reward per block in g
#### Defined in
-[Staking.ts:154](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L154)
+[Staking.ts:154](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L154)
___
@@ -279,7 +279,7 @@ A function that encodes all the details required to update start and end blocks
#### Defined in
-[Staking.ts:165](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L165)
+[Staking.ts:165](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L165)
___
@@ -303,7 +303,7 @@ A function to withdraw Staked tokens from given Staking pool contract
#### Defined in
-[Staking.ts:42](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L42)
+[Staking.ts:42](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L42)
___
@@ -329,7 +329,7 @@ A function to initiate Staking Factory contract instance
#### Defined in
-[Staking.ts:17](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L17)
+[Staking.ts:17](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L17)
___
@@ -365,4 +365,4 @@ A function that encodes all the details required to deploy a new Staking Pool.
#### Defined in
-[Staking.ts:82](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L82)
+[Staking.ts:82](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Staking.ts#L82)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/classes/Swap.md b/packages/dexs-starter-kit/docs/typedoc/classes/Swap.md
index 712ab0c..381504c 100644
--- a/packages/dexs-starter-kit/docs/typedoc/classes/Swap.md
+++ b/packages/dexs-starter-kit/docs/typedoc/classes/Swap.md
@@ -1,4 +1,4 @@
-[@klaytn/kds-dexs](../README.md) / [Modules](../modules.md) / Swap
+[@klaytn/kss-dexs](../README.md) / [Modules](../modules.md) / Swap
# Class: Swap
@@ -42,7 +42,7 @@
#### Defined in
-[Swap.ts:8](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L8)
+[Swap.ts:8](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L8)
## Properties
@@ -52,7 +52,7 @@
#### Defined in
-[Swap.ts:6](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L6)
+[Swap.ts:6](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L6)
___
@@ -62,7 +62,7 @@ ___
#### Defined in
-[Swap.ts:5](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L5)
+[Swap.ts:5](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L5)
## Methods
@@ -89,7 +89,7 @@ A function to swap exact amount of KLAY for a given amount of Tokens.
#### Defined in
-[Swap.ts:59](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L59)
+[Swap.ts:59](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L59)
___
@@ -116,7 +116,7 @@ A function to swap exact amount of Tokens for a given amount of KLAY.
#### Defined in
-[Swap.ts:98](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L98)
+[Swap.ts:98](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L98)
___
@@ -143,7 +143,7 @@ A function to swap exact amount of Tokens for a given amount of Tokens.
#### Defined in
-[Swap.ts:21](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L21)
+[Swap.ts:21](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L21)
___
@@ -161,7 +161,7 @@ A getter function to get WKLAY contract's address
#### Defined in
-[Swap.ts:152](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L152)
+[Swap.ts:152](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L152)
___
@@ -188,7 +188,7 @@ A getter function to fetch instance of DexPair contract.
#### Defined in
-[Swap.ts:143](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L143)
+[Swap.ts:143](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L143)
___
@@ -206,7 +206,7 @@ A getter function to return DexRouter contract's instance
#### Defined in
-[Swap.ts:133](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L133)
+[Swap.ts:133](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L133)
___
@@ -233,7 +233,7 @@ A function to swap KLAYs for a given exact amount of Tokens.
#### Defined in
-[Swap.ts:117](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L117)
+[Swap.ts:117](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L117)
___
@@ -260,7 +260,7 @@ A function to swap given amount of Tokens for exact amount of KLAYs.
#### Defined in
-[Swap.ts:78](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L78)
+[Swap.ts:78](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L78)
___
@@ -287,4 +287,4 @@ A function to swap given amount of Tokens for exact amount of KLAYs.
#### Defined in
-[Swap.ts:40](https://github.com/klaytn/klaytn-developer-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L40)
+[Swap.ts:40](https://github.com/klaytn/klaytn-service-sdk/blob/d936278/packages/dexs-starter-kit/core/Swap.ts#L40)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/docs/typedoc/modules.md b/packages/dexs-starter-kit/docs/typedoc/modules.md
index 566ab5c..c940630 100644
--- a/packages/dexs-starter-kit/docs/typedoc/modules.md
+++ b/packages/dexs-starter-kit/docs/typedoc/modules.md
@@ -1,6 +1,6 @@
-[@klaytn/kds-dexs](README.md) / Modules
+[@klaytn/kss-dexs](README.md) / Modules
-# @klaytn/kds-dexs
+# @klaytn/kss-dexs
## Table of contents
@@ -11,4 +11,4 @@
- [Liquidity](classes/Liquidity.md)
- [MultiSig](classes/MultiSig.md)
- [Staking](classes/Staking.md)
-- [Swap](classes/Swap.md)
+- [Swap](classes/Swap.md)
\ No newline at end of file
diff --git a/packages/dexs-starter-kit/package.json b/packages/dexs-starter-kit/package.json
index 74ba614..27d2d0c 100644
--- a/packages/dexs-starter-kit/package.json
+++ b/packages/dexs-starter-kit/package.json
@@ -1,13 +1,13 @@
{
- "name": "@klaytn/kds-dexs",
- "version": "0.0.5",
+ "name": "@klaytn/kss-dexs",
+ "version": "0.0.6",
"description": "Includes dex-contracts integration & use-cases",
"exports": {
".": "./dist/core/index.js"
},
"repository": {
"type": "git",
- "url": "https://github.com/klaytn/klaytn-developer-sdk.git"
+ "url": "https://github.com/klaytn/klaytn-service-sdk.git"
},
"scripts": {
"build": "npx tsc",
@@ -23,7 +23,8 @@
"swap",
"trade",
"farming",
- "pool"
+ "pool",
+ "kss-dexs"
],
"author": "Klaytn Community ",
"license": "MIT",
@@ -48,4 +49,4 @@
"typedoc-plugin-markdown": "^3.14.0",
"typescript": "^4.9.4"
}
-}
+}
\ No newline at end of file
diff --git a/packages/kds-cli/LICENSE.md b/packages/kss-cli/LICENSE.md
similarity index 100%
rename from packages/kds-cli/LICENSE.md
rename to packages/kss-cli/LICENSE.md
diff --git a/packages/kds-cli/README.md b/packages/kss-cli/README.md
similarity index 50%
rename from packages/kds-cli/README.md
rename to packages/kss-cli/README.md
index f07b213..d6308c3 100644
--- a/packages/kds-cli/README.md
+++ b/packages/kss-cli/README.md
@@ -1,13 +1,13 @@
-# Klaytn Developer SDK CLI
+# Klaytn Service SDK CLI
-kds-cli is a command line utility for klaytn developer sdk.
-kds-cli supports below features.
-* `Oracles` - Hardhat project containing Chainlink, Witnet integrations with klaytn.
+kss-cli is a command line utility for klaytn service sdk.
+kss-cli supports below features.
+* `Oracles` - Hardhat project containing Witnet integrations with klaytn.
## Install
```typescript
-npm install -g @klaytn/kds-cli --force
+npm install -g @klaytn/kss-cli --force
```
## Quick Usage
@@ -15,24 +15,24 @@ npm install -g @klaytn/kds-cli --force
### Version
```bash
-> kds-cli --version
+> kss-cli --version
0.0.1
```
### Help
```typescript
-> kds-cli --help
-> kds-cli help oracle
+> kss-cli --help
+> kss-cli help oracle
```
### Setup
#### Oracles
-To download the Klaytn's integration with Chainlink, witnet oracle hardhat project, please follow below steps
+To download the Klaytn's integration with witnet oracle hardhat project, please follow below steps
```typescript
-> kds-cli oracle init
+> kss-cli oracle init
> cd oracle-starter-kit
> npm install --force
diff --git a/packages/kds-cli/bin/commands/helper/index.js b/packages/kss-cli/bin/commands/helper/index.js
similarity index 100%
rename from packages/kds-cli/bin/commands/helper/index.js
rename to packages/kss-cli/bin/commands/helper/index.js
diff --git a/packages/kds-cli/bin/commands/oracle/index.js b/packages/kss-cli/bin/commands/oracle/index.js
similarity index 86%
rename from packages/kds-cli/bin/commands/oracle/index.js
rename to packages/kss-cli/bin/commands/oracle/index.js
index 9e74813..e309651 100644
--- a/packages/kds-cli/bin/commands/oracle/index.js
+++ b/packages/kss-cli/bin/commands/oracle/index.js
@@ -4,7 +4,7 @@ const path = require('path')
let exec = (program) => {
program
.command('oracle')
- .description('klaytn developer sdk oracle')
+ .description('klaytn service sdk oracle')
.usage('[options] ')
.command('init')
.description('initialize the oracle hardhat project')
@@ -14,7 +14,7 @@ let exec = (program) => {
async function init() {
console.log("Initializing the oracle setup")
- copyDir(path.join(__dirname, '..', '..', '..', 'node_modules', '@klaytn', 'kds-oracles'), path.join(process.cwd(), "oracle-starter-kit"), (err) => {
+ copyDir(path.join(__dirname, '..', '..', '..', 'node_modules', '@klaytn', 'kss-oracles'), path.join(process.cwd(), "oracle-starter-kit"), (err) => {
if(err) {
console.log(err);
return;
diff --git a/packages/kds-cli/bin/kds-cli.js b/packages/kss-cli/bin/kss-cli.js
similarity index 85%
rename from packages/kds-cli/bin/kds-cli.js
rename to packages/kss-cli/bin/kss-cli.js
index 4595e54..d85bad4 100644
--- a/packages/kds-cli/bin/kds-cli.js
+++ b/packages/kss-cli/bin/kss-cli.js
@@ -10,7 +10,7 @@ program.version(packageData.version)
// Commands
program
-.name('kds-cli')
+.name('kss-cli')
.usage('[options] ')
.helpOption(false)
@@ -19,7 +19,7 @@ require('./commands/oracle')(program)
if(process.argv.slice(2).length == 0) {
console.log(
chalk.yellow(
- figlet.textSync('kds-cli', { horizontalLayout: 'full' })
+ figlet.textSync('kss-cli', { horizontalLayout: 'full' })
)
);
}
diff --git a/packages/kds-cli/package.json b/packages/kss-cli/package.json
similarity index 56%
rename from packages/kds-cli/package.json
rename to packages/kss-cli/package.json
index c8d5d2f..beb0d09 100644
--- a/packages/kds-cli/package.json
+++ b/packages/kss-cli/package.json
@@ -1,26 +1,26 @@
{
- "name": "@klaytn/kds-cli",
- "version": "0.0.5",
- "description": "klaytn developer sdk command line",
+ "name": "@klaytn/kss-cli",
+ "version": "0.0.6",
+ "description": "klaytn service sdk command line",
"bin": {
- "kds-cli": "./bin/kds-cli.js"
+ "kss-cli": "./bin/kss-cli.js"
},
"repository": {
"type": "git",
- "url": "https://github.com/klaytn/klaytn-developer-sdk.git"
+ "url": "https://github.com/klaytn/klaytn-service-sdk.git"
},
"preferGlobal": true,
"keywords": [
"klaytn",
- "kds-cli"
+ "kss-cli"
],
"author": "Klaytn Community ",
"license": "MIT",
"dependencies": {
- "@klaytn/kds-oracles": "^0.0.5",
+ "@klaytn/kss-oracles": "^0.0.6",
"chalk": "^4.1.1",
"commander": "^10.0.0",
"figlet": "^1.5.2",
"fs-extra": "^11.1.0"
}
-}
+}
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/.env.example b/packages/oracles-starter-kit/.env.example
index fae5627..d1e1117 100644
--- a/packages/oracles-starter-kit/.env.example
+++ b/packages/oracles-starter-kit/.env.example
@@ -1,4 +1,2 @@
BAOBAB_RPC_URL='https://api.baobab.klaytn.net:8651'
-PRIVATE_KEY='abcdefg'
-AUTO_FUND=true
-VRF_SUBSCRIPTION_ID=YOUR_SUBSCRIPTION_ID
\ No newline at end of file
+PRIVATE_KEY='private key here'
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/README.md b/packages/oracles-starter-kit/README.md
index a8cd249..23d15ef 100644
--- a/packages/oracles-starter-kit/README.md
+++ b/packages/oracles-starter-kit/README.md
@@ -7,64 +7,33 @@
- [2. Environment Variables](#2-environment-variables)
- [Deploy contracts](#deploy-contracts)
- [Interacting with Deployed Contracts](#interacting-with-deployed-contracts)
- - [Chainlink Price Feeds](#chainlink-price-feeds)
+ - [Witnet Price Feeds](#witnet-price-feeds)
- [Parameters](#parameters)
- [Returns](#returns)
- [Example](#example)
- - [Change Chainlink price feed address](#change-chainlink-price-feed-address)
+ - [Witnet Randomness](#witnet-randomness)
+ - [1. Request new randomness](#1-request-new-randomness)
- [Parameters](#parameters-1)
- - [Returns](#returns-1)
- - [Example](#example-1)
- - [Chainlink Request \& Receive Data](#chainlink-request--receive-data)
- - [Fund ChainLinkAPI contract](#fund-chainlinkapi-contract)
+ - [Returns](#returns-1)
+ - [Example](#example-1)
+ - [2. Fetch Witnet random number](#2-fetch-witnet-random-number)
- [Parameters](#parameters-2)
- [Returns](#returns-2)
- - [Request ChainLinkAPI Data](#request-chainlinkapi-data)
- - [Parameters](#parameters-3)
- - [Returns](#returns-3)
- [Example](#example-2)
- - [Request ChainLinkAPI Data](#request-chainlinkapi-data-1)
- - [Parameters](#parameters-4)
- - [Returns](#returns-4)
- - [Example](#example-3)
- - [Chainlink VRF Get a random number](#chainlink-vrf-get-a-random-number)
- - [Prerequisite](#prerequisite)
- - [Request Chainlink Random number](#request-chainlink-random-number)
- - [Parameters](#parameters-5)
- - [Returns](#returns-5)
- - [Example](#example-4)
- - [Read Chainlink Random number](#read-chainlink-random-number)
- - [Parameters](#parameters-6)
- - [Returns](#returns-6)
- - [Example](#example-5)
- - [Chainlink Keepers](#chainlink-keepers)
- - [Witnet Price Feeds](#witnet-price-feeds)
- - [Parameters](#parameters-7)
- - [Returns](#returns-7)
- - [Example](#example-6)
- - [Witnet Randomness](#witnet-randomness)
- - [1. Request new randomness](#1-request-new-randomness)
- - [Parameters](#parameters-8)
- - [Returns](#returns-8)
- - [Example](#example-7)
- - [2. Fetch Witnet random number](#2-fetch-witnet-random-number)
- - [Parameters](#parameters-9)
- - [Returns](#returns-9)
- - [Example](#example-8)
- [3. Get the latest randomizing block](#3-get-the-latest-randomizing-block)
- - [Parameters](#parameters-10)
- - [Returns](#returns-10)
- - [Example](#example-9)
+ - [Parameters](#parameters-3)
+ - [Returns](#returns-3)
+ - [Example](#example-3)
- [4. Get the generated random number](#4-get-the-generated-random-number)
- - [Parameters](#parameters-11)
- - [Returns](#returns-11)
- - [Example](#example-10)
+ - [Parameters](#parameters-4)
+ - [Returns](#returns-4)
+ - [Example](#example-4)
- [Witnet Web Oracle Request](#witnet-web-oracle-request)
- [Compile the Witnet queries into Solidity contracts](#compile-the-witnet-queries-into-solidity-contracts)
- - [Example](#example-11)
+ - [Example](#example-5)
- [Execute Witnet Queries](#execute-witnet-queries)
- - [Parameters](#parameters-12)
- - [Returns](#returns-12)
+ - [Parameters](#parameters-5)
+ - [Returns](#returns-5)
- [Example 1 - Fetch Coinprice](#example-1---fetch-coinprice)
- [Example 2 - Post Request](#example-2---post-request)
- [Resources](#resources)
@@ -72,19 +41,19 @@
Oracles take data from the outside world and put it into the blockchain for other smart contracts to consume.
-This is a hardhat project containing contracts and scripts for `Chainlink` and `Witnet` integrations.
+This is a hardhat project containing contracts and scripts for `Witnet` integrations.
## Install
```typescript
-npm install -g @klaytn/kds-cli --force
+npm install -g @klaytn/kss-cli --force
```
## Quick Usage
For a default set of contracts and tests, run the following within the required project directory:
```typescript
-> kds-cli oracle init
+> kss-cli oracle init
> cd oracle-starter-kit
> npm install --force
@@ -104,16 +73,8 @@ Default configurations of baobab network `1001` are already using [Klaytn vrf co
Hardhat configuration variables can be found in `helper-hardhat-config.json` in the root directory. Below is the configuration explaination for `1001` network.
* `name` - hardhat network name Ex: `baobab`
- * `linkToken` - chainlink linktoken address. see [Link Token Address](https://docs.chain.link/vrf/v2/subscription/supported-networks/) for reference.
- * `keyHash` - chainlink keyHash. see [KeyHash Configurations](https://docs.chain.link/vrf/v2/subscription/supported-networks/) for reference.
- * `chainLinkPriceFeed` - chainlink pricefeed address for contract deployment. Ex: `0xf49f81b3d2F2a79b706621FA2D5934136352140c`. see [Chainlink Pricefeed Addresses](https://docs.chain.link/data-feeds/price-feeds/addresses/?network=klaytn) for reference.
- * `oracle` - chainlink oracle contract address. see [Klaytn Operator Contracts](https://docs.chain.link/any-api/testnet-oracles/#examples) for reference.
- * `jobId` - chainlink jobId. Ex: `ca98366cc7314957b8c012c72f05aeeb`. see [Chainlink JobID's](https://docs.chain.link/any-api/testnet-oracles/#jobs) for reference.
- * `vrfCoordinator` - vrfCoordinator. see [VRF Coordinator](https://docs.chain.link/vrf/v2/subscription/supported-networks/) for reference.
* `witnetPriceRouter` - witnetPriceRouter Address Ex: `0xeD074DA2A76FD2Ca90C1508930b4FB4420e413B0` for Klaytn Testnet. See [WitnetPriceRouter](https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds#klaytn-baobab) for reference.
* `witnetRandomness` - witnetRandomness Address. Ex: `0xb4b2e2e00e9d6e5490d55623e4f403ec84c6d33f` for Klaytn Testnet. See [WitnetRandomness Contract Addresses](https://docs.witnet.io/smart-contracts/witnet-randomness-oracle/contract-addresses#klaytn) for reference.
- * `fee` - fee
- * `fundAmount` - fundAmount
### 2. Environment Variables
We will need to set environment variables by following below steps
@@ -121,8 +82,6 @@ We will need to set environment variables by following below steps
2. Modify environment variables. Below is the explaination of each variable
* `BAOBAB_RPC_URL` - `string` https://api.baobab.klaytn.net:8651/ can be used. its the rpc url of blockchain.
* `PRIVATE_KEY` - `string` This is private key from wallet, ie [MetaMask](https://metamask.io/). This is required for deploying contracts to public networks.
- * `AUTO_FUND` - `boolean` provide true, if needs to autofund
- * `VRF_SUBSCRIPTION_ID` - `number` VRF Subscription id. Head over to [VRF Subscription Page](https://vrf.chain.link/klaytn-testnet) and create the new subscription.
> IMPORTANT: MAKE SURE YOU DON'T EXPOSE THE KEYS YOU PUT IN THIS `.env` FILE saved in the package node_modules. By that, I mean don't push them to a public repo, and please try to keep them keys you use in development not associated with any real funds.
@@ -130,7 +89,6 @@ Don't commit and push any changes to .env files that may contain sensitive infor
> Get some Baobab Testnet KLAY and LINK
Go to the [Klaytn faucets](https://baobab.wallet.klaytn.foundation/faucet) to get some KLAY to configured private key account.
-Head over to the [Chainlink faucets](https://faucets.chain.link/) and get some LINK to configured private key account. Please follow [the chainlink documentation](https://docs.chain.link/docs/acquire-link/) if unfamiliar.
## Deploy contracts
@@ -155,199 +113,6 @@ npm run test
After deploying your contracts, the deployment output will give you the contract addresses as they are deployed.You can then use these contract addresses in conjunction with Hardhat tasks to perform operations on each contract.
-### Chainlink Price Feeds
-The Price Feeds consumer contract has one task, to read the latest price of a specified price feed contract
-
-```bash
-npx hardhat read-price-feed --contract --network baobab
-```
-
-#### Parameters
-`deployedContractAddress` - `string` Deployed Price feed consumer contract.
-
-#### Returns
- * `price` - price
-
-#### Example
-```
- npx hardhat read-price-feed --contract 0x6883956A235f8b823d547575812B08F4a720D76A --network baobab
-
- // By default it returns LINK/KLAY price feed value. 1 LINK = 32.9 KLAY
- /*
- Price is: 32915338976573950000
- */
-```
-
-### Change Chainlink price feed address
-The price feed address used while deployment can be changed using below method.
-
-```bash
-npx hardhat change-price-feed --contract --pricefeedaddress --network baobab
-```
-
-#### Parameters
-`deployedContractAddress` - `string` Deployed Price feed consumer contract.
-`pricefeedAddress` - `string` pricefeed address. see [Klaytn Pricefeed Addresses](https://docs.chain.link/data-feeds/price-feeds/addresses/?network=klaytn) for reference.
-
-#### Returns
- * `transaction hash` - `string` transaction hash
-
-#### Example
-```typescript
- // Change pricefeedaddress to WEMIX/USD 0x76Aa17dCda9E8529149E76e9ffaE4aD1C4AD701B price feed contract. 1 WEMIX = 0.8 USD
- npx hardhat change-price-feed --contract 0x6883956A235f8b823d547575812B08F4a720D76A --pricefeedaddress 0x76Aa17dCda9E8529149E76e9ffaE4aD1C4AD701B --network baobab
- /*
- Transaction Hash: 0x0741df94b257a29f73ff4b94d2f0d5cd91dae20f2bc9946dd00a954905d85936
- */
-
- npx hardhat read-price-feed --contract 0x6883956A235f8b823d547575812B08F4a720D76A --network baobab
- /*
- Price is: 800625678041836600
- */
-```
-
-### Chainlink Request & Receive Data
-The APIConsumer contract has two tasks, one to request external data based on a set of parameters, and one to check to see what the result of the data request is.
-Currently fetches the volume24hour data from https://min-api.cryptocompare.com/data/pricemultifull?fsyms=KLAY&tsyms=USD.
-
-#### Fund ChainLinkAPI contract
-This chainLinkApiData contract needs to be funded with `link` tokens first.
-
-```bash
-npx hardhat fund-link --contract --network baobab
-```
-
-#### Parameters
-`deployedContractAddress` - `string` Deployed API consumer contract.
-
-##### Returns
- * `transaction hash` - `string` transaction hash
-
-> **WARNING**: `chainlink-plugin-fund-link` have not supported `baobab network`. You have to fund `link` tokens manually to the deployed chainLinkApiData contract. Get deployed contracts list using `console.log(OracleSDK.readDeployedContracts())` method.
-
-#### Request ChainLinkAPI Data
-Once the deployed chainlinkAPI contract it's funded with `link` tokens, you can request external data by passing in a number of parameters to the request-data task.
-
-```bash
-npx hardhat request-data --contract --coinsymbol --coindecimals --network baobab
-```
-##### Parameters
-1. `deployedContractAddress` - `string` Deployed API consumer contract.
-2. `coinsymbol` - `string` coinsymbol. see [Coin Symbols](https://min-api.cryptocompare.com) for reference.
-3. `coindecimals` - `number` coin supported decimals. Ex: 18 for KLAY
-
-##### Returns
- * `transaction hash` - `string` transaction hash
-
-##### Example
-```typescript
- npx hardhat request-data --contract 0xddDC43f1ae46757C94Ec6dCDAa7E9b6738e0db0b --coinsymbol KLAY --coindecimals 18 --network baobab
-
- /*
- Transaction Hash: 0xe8f3d600a4789d16b0a0a9a739d67bbefcb088aebbc038687c4c9e7b1d56373a
- */
-```
-#### Request ChainLinkAPI Data
-Once you have successfully made a request for external data, you can see the result via the read-data task. it retrives VOLUME24 from https://min-api.cryptocompare.com/data/pricemultifull?fsyms=KLAY&tsyms=USD from the contract
-
-```bash
-npx hardhat read-data --contract --network baobab
-```
-
-##### Parameters
-1. `deployedContractAddress` - `string` Deployed API consumer contract.
-
-##### Returns
- * `data` - `string` Receives `volume24` data without decimals
-
-##### Example
-```typescript
- // Receives volume24 from RAW.KLAY.USD.VOLUME24HOUR in "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=KLAY&tsyms=USD" result without decimals
- npx hardhat read-data --contract 0xddDC43f1ae46757C94Ec6dCDAa7E9b6738e0db0b --network baobab
-
- /*
- Data is: 76993244391264860000000000
- */
-```
-
-### Chainlink VRF Get a random number
-The VRFConsumer contract has two tasks, one to request a random number, and one to read the result of the random number request.
-
-#### Prerequisite
-To start, go to [VRF Subscription Page](https://vrf.chain.link/klaytn-testnet) and create the new subscription. Save your subscription ID and put it in `.env` file as `VRF_SUBSCRIPTION_ID`:
-
-```bash
- VRF_SUBSCRIPTION_ID=subscription_id
-```
-
-Then, deploy your VRF V2 contract consumer(if its not deployed already with the subscription id) to the network with your recent subscription using subscription id as constructor argument.
-
-```bash
-npx hardhat deploy --network baobab
-```
-
-Finally, you need to go to your subscription page one more time and add the address of deployed contract as a new consumer (https://vrf.chain.link/klaytn-testnet/). Once that's done, you can perform a VRF request with the request-random-number task.
-> **_NOTE:_** Make sure to add LINK funds to the subscription from the chainlink UI screen:
-
-#### Request Chainlink Random number
-
-```bash
-npx hardhat request-random-number --contract --numwords --network baobab
-```
-
-##### Parameters
-`deployedContractAddress` - `string` Deployed RandomNumberConsumer contract address
-`randomNumbersCount` - `number` No of random numbers to be generated
-
-##### Returns
- * `transaction hash` - `string` Transaction hash
-
-##### Example
-```typescript
- npx hardhat request-random-number --contract 0x3AFb1Ce6B16EcB1e367cCC23d99Ea4D9Ef497BE3 --numwords 3 --network baobab
- /*
- Transaction Hash: 0x770892fb09f00fbc25aa4118c4e59bae8f106e550d9295ddab62db79d708821a
- */
-```
-
-#### Read Chainlink Random number
-Once you have successfully made a request for a random number, you can see the result via the read-random-number task:
-
-```bash
- npx hardhat read-random-number --contract --network baobab
-```
-
-##### Parameters
-`deployedContractAddress` - `string` Deployed RandomNumberConsumer contract address
-
-##### Returns
- * `randomNumbers` - random numbers
-
-##### Example
-```typescript
- npx hardhat read-random-number --contract 0x3AFb1Ce6B16EcB1e367cCC23d99Ea4D9Ef497BE3 --network baobab
- /*
- Random Numbers are: 25039093979060057973217505519617231457599792522931877947740225763662111327605,66221833599132925893563674221180186695699650058371972286077266023247996014608,62169596737219453842215058746401741770368274717351892705020984286494216685598
- */
-```
-
-### Chainlink Keepers
-
-> **WARNING**:
-The Baobab network is not supported by Chainlink Automation (aka Chainlink Keepers) yet. Because of that, the response of the Keeper will always be 0. You can ignore this feature in the current version.
-
-
-
### Witnet Price Feeds
The Witnet Price Feeds consumer contract has one task, to read the latest price of a specified price feed contract
@@ -357,18 +122,19 @@ The Witnet Price Feeds consumer contract has one task, to read the latest price
#### Parameters
`deployedContractAddress` - `string` Deployed WitnetPriceFeed contract address
-`id` - `string` id4 is the witnet pricefeed ID. Ex: `0x6cc828d1` for Price-KLAY/USD-6. See [Klaytn Witnet PriceFeeds](https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds#klaytn-baobab) for reference.
+`id` - `string` id is the witnet pricefeed ID. Ex: `0x6cc828d1` for Price-KLAY/USD-6. See [Klaytn Witnet PriceFeeds](https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds#klaytn-baobab) for reference.
#### Returns
* `price` - price of KLAY/USD.
#### Example
```typescript
- // 1 KLAY = 0.20 USD
- npx hardhat read-witnet-price-feed --contract 0x37291E5036db32DFe714823dE7A96253676e6487 --id 0x6cc828d1 --network baobab
+ // 1 KLAY = 0.23 USD
+ npx hardhat read-witnet-price-feed --contract 0x573AAAdF4Cf117586e74AE3845473fc65cd59C4c --id 0x6cc828d1 --network baobab
/*
- Last price is: 209744
+ Last price is: 237467
+ Last timestamp is: 1678713345
*/
```
@@ -385,18 +151,19 @@ Requesting the new randomness.
Once the the request to new randomness is performed successfully. The other tasks can be performed after transaction submission.
```bash
- npx hardhat request-witnet-randomness --contract --network baobab
+ npx hardhat request-witnet-randomness --contract --value --network baobab
```
#### Parameters
`deployedContractAddress` - `string` Deployed Deployed Witnet RandomNumber contract address
+`value` - `number` Value for transaction cost when requesting random numbers. Ex: 500000000000000000 i.e, 0.5 KLAY
##### Returns
* `transaction hash` - Transaction hash
##### Example
```typescript
- npx hardhat request-witnet-randomness --contract 0x8937C127F3060fF8a23E9a0fb5AEA10bc30e28be --network baobab
+ npx hardhat request-witnet-randomness --contract 0x8937C127F3060fF8a23E9a0fb5AEA10bc30e28be --value 500000000000000000 --network baobab
/*
Transaction Hash: 0x809addb235dc953c90a563c396c11978a359b574336564c7ec890514c961e050
*/
@@ -445,7 +212,6 @@ Calling `fetch-witnet-random-number` right after `request-witnet-randomness` wil
*/
```
-
#### 4. Get the generated random number
fetches the generated random number
@@ -519,10 +285,9 @@ npx witnet-toolkit try-query --from-solidity ./contracts/witnet-requests/ **_NOTE:_** If above tryWitnetQueries is stuck, please try to run command shown in below snapshot `npx witnet-toolkit`, install the binary once in the machine and retry above method
-![WitnetToolkitBinary](https://github.com/klaytn/klaytn-developer-sdk/blob/main/packages/oracles-starter-kit/WitnetToolkitBinary.png)
+![WitnetToolkitBinary](https://github.com/klaytn/klaytn-service-sdk/blob/main/packages/oracles-starter-kit/WitnetToolkitBinary.png)
## Resources
-- [Chainlink Documentation](https://docs.chain.link/)
- [Witnet Documentation](https://docs.witnet.io/)
- [Hardhat Documentation](https://hardhat.org/getting-started/)
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/contracts/APIConsumer.sol b/packages/oracles-starter-kit/contracts/APIConsumer.sol
deleted file mode 100644
index 9490263..0000000
--- a/packages/oracles-starter-kit/contracts/APIConsumer.sol
+++ /dev/null
@@ -1,109 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.7;
-
-import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
-
-/**
- * @title The APIConsumer contract
- * @notice An API Consumer contract that makes GET requests to obtain 24h trading volume of ETH in USD
- */
-contract APIConsumer is ChainlinkClient {
- using Chainlink for Chainlink.Request;
-
- uint256 public volume;
- address private immutable oracle;
- bytes32 private immutable jobId;
- uint256 private immutable fee;
-
- event DataFullfilled(uint256 volume);
-
- /**
- * @notice Executes once when a contract is created to initialize state variables
- *
- * @param _oracle - address of the specific Chainlink node that a contract makes an API call from
- * @param _jobId - specific job for :_oracle: to run; each job is unique and returns different types of data
- * @param _fee - node operator price per API call / data request
- * @param _link - LINK token address on the corresponding network
- *
- * Network: Baobab
- * Oracle: 0xfC3BdAbD8a6A73B40010350E2a61716a21c87610
- * Job ID: ca98366cc7314957b8c012c72f05aeeb
- * Fee: 0.1 LINK
- * Link: 0x04c5046A1f4E3fFf094c26dFCAA75eF293932f18
- */
- constructor(
- address _oracle,
- bytes32 _jobId,
- uint256 _fee,
- address _link
- ) {
- if (_link == address(0)) {
- setPublicChainlinkToken();
- } else {
- setChainlinkToken(_link);
- }
- oracle = _oracle;
- jobId = _jobId;
- fee = _fee;
- }
-
- /**
- * @notice Creates a Chainlink request to retrieve API response, find the target
- * data, then multiply by 10*_coinDecimals (to remove decimal places from data).
- *
- * @return requestId - id of the request
- */
- function requestVolumeData(string memory _coinSymbol, uint8 _coinDecimals) public returns (bytes32 requestId) {
- Chainlink.Request memory request = buildChainlinkRequest(
- jobId,
- address(this),
- this.fulfill.selector
- );
-
- // Set the URL to perform the GET request on
- request.add(
- "get",
- string(abi.encodePacked("https://min-api.cryptocompare.com/data/pricemultifull?fsyms=", _coinSymbol, "&tsyms=USD"))
- );
-
- // Set the path to find the desired data in the API response, where the response format is:
- // {"RAW":
- // {"KLAY":
- // {"USD":
- // {
- // "VOLUME24HOUR": xxx.xxx,
- // }
- // }
- // }
- // }
- // request.add("path", "RAW.KLAY.USD.VOLUME24HOUR"); // Chainlink nodes prior to 1.0.0 support this format
- request.add("path", "RAW,KLAY,USD,VOLUME24HOUR"); // Chainlink nodes 1.0.0 and later support this format
-
- // Multiply the result by 10**_coinDecimals to remove decimals
- int256 timesAmount = int256(10**_coinDecimals);
- request.addInt("times", timesAmount);
-
- // Sends the request
- return sendChainlinkRequestTo(oracle, request, fee);
- }
-
- /**
- * @notice Receives the response in the form of uint256
- *
- * @param _requestId - id of the request
- * @param _volume - response; requested 24h trading volume of ETH in USD
- */
- function fulfill(bytes32 _requestId, uint256 _volume)
- public
- recordChainlinkFulfillment(_requestId)
- {
- volume = _volume;
- emit DataFullfilled(volume);
- }
-
- /**
- * @notice Witdraws LINK from the contract
- * @dev Implement a withdraw function to avoid locking your LINK in the contract
- */
- function withdrawLink() external {}
-}
diff --git a/packages/oracles-starter-kit/contracts/KeepersCounter.sol b/packages/oracles-starter-kit/contracts/KeepersCounter.sol
deleted file mode 100644
index 013b039..0000000
--- a/packages/oracles-starter-kit/contracts/KeepersCounter.sol
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.7;
-
-import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol";
-
-/**
- * @title The Counter contract
- * @notice A keeper-compatible contract that increments counter variable at fixed time intervals
- */
-contract KeepersCounter is KeeperCompatibleInterface {
- /**
- * Public counter variable
- */
- uint256 public counter;
-
- /**
- * Use an interval in seconds and a timestamp to slow execution of Upkeep
- */
- uint256 public immutable interval;
- uint256 public lastTimeStamp;
-
- /**
- * @notice Executes once when a contract is created to initialize state variables
- *
- * @param updateInterval - Period of time between two counter increments expressed as UNIX timestamp value
- */
- constructor(uint256 updateInterval) {
- interval = updateInterval;
- lastTimeStamp = block.timestamp;
-
- counter = 0;
- }
-
- /**
- * @notice Checks if the contract requires work to be done
- */
- function checkUpkeep(
- bytes memory /* checkData */
- )
- public
- view
- override
- returns (
- bool upkeepNeeded,
- bytes memory /* performData */
- )
- {
- upkeepNeeded = (block.timestamp - lastTimeStamp) > interval;
- // We don't use the checkData in this example. The checkData is defined when the Upkeep was registered.
- }
-
- /**
- * @notice Performs the work on the contract, if instructed by :checkUpkeep():
- */
- function performUpkeep(
- bytes calldata /* performData */
- ) external override {
- // add some verification
- (bool upkeepNeeded, ) = checkUpkeep("");
- require(upkeepNeeded, "Time interval not met");
-
- lastTimeStamp = block.timestamp;
- counter = counter + 1;
- // We don't use the performData in this example. The performData is generated by the Keeper's call to your checkUpkeep function
- }
-}
diff --git a/packages/oracles-starter-kit/contracts/PriceConsumerV3.sol b/packages/oracles-starter-kit/contracts/PriceConsumerV3.sol
deleted file mode 100644
index c51af4c..0000000
--- a/packages/oracles-starter-kit/contracts/PriceConsumerV3.sol
+++ /dev/null
@@ -1,62 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.7;
-
-import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
-
-/**
- * @title The PriceConsumerV3 contract
- * @notice Acontract that returns latest price from Chainlink Price Feeds
- */
-contract PriceConsumerV3 {
- AggregatorV3Interface internal priceFeed;
-
- /**
- * @notice Executes once when a contract is created to initialize state variables
- *
- * @param _priceFeed - Price Feed Address. Refer here https://docs.chain.link/data-feeds/price-feeds/addresses/?network=klaytn
- *
- * Network: Baobab
- * Aggregator: LINK/KLAY
- * Address: 0xf49f81b3d2F2a79b706621FA2D5934136352140c
- */
- constructor(address _priceFeed) {
- priceFeed = AggregatorV3Interface(_priceFeed);
- }
-
- /**
- * @notice Changes price feed address
- *
- * @param _priceFeed - Price Feed Address. Refer here https://docs.chain.link/data-feeds/price-feeds/addresses/?network=klaytn
- *
- *
- */
- function changePriceFeed(address _priceFeed) public {
- priceFeed = AggregatorV3Interface(_priceFeed);
- }
-
- /**
- * @notice Returns the latest price
- *
- * @return latest price
- */
- function getLatestPrice() public view returns (int256) {
- (
- uint80 roundID,
- int256 price,
- uint256 startedAt,
- uint256 timeStamp,
- uint80 answeredInRound
- ) = priceFeed.latestRoundData();
- return price;
- }
-
-
- /**
- * @notice Returns the Price Feed address
- *
- * @return Price Feed address
- */
- function getPriceFeed() public view returns (AggregatorV3Interface) {
- return priceFeed;
- }
-}
diff --git a/packages/oracles-starter-kit/contracts/RandomNumberConsumerV2.sol b/packages/oracles-starter-kit/contracts/RandomNumberConsumerV2.sol
deleted file mode 100644
index 3a4da06..0000000
--- a/packages/oracles-starter-kit/contracts/RandomNumberConsumerV2.sol
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: MIT
-// An example of a consumer contract that relies on a subscription for funding.
-pragma solidity ^0.8.7;
-
-import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
-import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
-
-/**
- * @title The RandomNumberConsumerV2 contract
- * @notice A contract that gets random values from Chainlink VRF V2
- */
-contract RandomNumberConsumerV2 is VRFConsumerBaseV2 {
- VRFCoordinatorV2Interface immutable COORDINATOR;
-
- // Your subscription ID.
- uint64 immutable s_subscriptionId;
-
- // The gas lane to use, which specifies the maximum gas price to bump to.
- // For a list of available gas lanes on each network,
- // see https://docs.chain.link/docs/vrf-contracts/#configurations
- bytes32 immutable s_keyHash;
-
- // Depends on the number of requested values that you want sent to the
- // fulfillRandomWords() function. Storing each word costs about 20,000 gas,
- // so 100,000 is a safe default for this example contract. Test and adjust
- // this limit based on the network that you select, the size of the request,
- // and the processing of the callback request in the fulfillRandomWords()
- // function.
- uint32 constant CALLBACK_GAS_LIMIT = 100000;
-
- // The default is 3, but you can set this higher.
- uint16 constant REQUEST_CONFIRMATIONS = 3;
-
- uint256[] public s_randomWords;
- uint256 public s_requestId;
- address s_owner;
-
- event ReturnedRandomness(uint256[] randomWords);
-
- /**
- * @notice Constructor inherits VRFConsumerBaseV2
- *
- * @param subscriptionId - the subscription ID that this contract uses for funding requests
- * @param vrfCoordinator - coordinator, check https://docs.chain.link/docs/vrf-contracts/#configurations
- * @param keyHash - the gas lane to use, which specifies the maximum gas price to bump to
- */
- constructor(
- uint64 subscriptionId,
- address vrfCoordinator,
- bytes32 keyHash
- ) VRFConsumerBaseV2(vrfCoordinator) {
- COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
- s_keyHash = keyHash;
- s_owner = msg.sender;
- s_subscriptionId = subscriptionId;
- }
-
- /**
- * @return Length of random words array
- */
- function getRandomWordsCount() view external returns(uint256){
- return s_randomWords.length;
- }
-
- /**
- * @notice Requests randomness
- * @param _numWords - retrieve no of random values in one request. Cannot exceed VRFCoordinatorV2.MAX_NUM_WORDS.
- * Assumes the subscription is funded sufficiently; "Words" refers to unit of data in Computer Science
- */
- function requestRandomWords(uint32 _numWords) external onlyOwner {
- // Will revert if subscription is not set and funded.
- s_requestId = COORDINATOR.requestRandomWords(
- s_keyHash,
- s_subscriptionId,
- REQUEST_CONFIRMATIONS,
- CALLBACK_GAS_LIMIT,
- _numWords
- );
- }
-
- /**
- * @notice Callback function used by VRF Coordinator
- *
- * @param requestId - id of the request
- * @param randomWords - array of random results from VRF Coordinator
- */
- function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
- s_randomWords = randomWords;
- emit ReturnedRandomness(randomWords);
- }
-
- modifier onlyOwner() {
- require(msg.sender == s_owner);
- _;
- }
-}
diff --git a/packages/oracles-starter-kit/contracts/test/LinkToken.sol b/packages/oracles-starter-kit/contracts/test/LinkToken.sol
deleted file mode 100644
index 4742b88..0000000
--- a/packages/oracles-starter-kit/contracts/test/LinkToken.sol
+++ /dev/null
@@ -1,4 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.4.24;
-
-import "@chainlink/token/contracts/v0.4/LinkToken.sol";
diff --git a/packages/oracles-starter-kit/contracts/test/MockOracle.sol b/packages/oracles-starter-kit/contracts/test/MockOracle.sol
deleted file mode 100644
index 28cb07d..0000000
--- a/packages/oracles-starter-kit/contracts/test/MockOracle.sol
+++ /dev/null
@@ -1,172 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.6.6;
-
-import "@chainlink/contracts/src/v0.6/LinkTokenReceiver.sol";
-import "@chainlink/contracts/src/v0.6/interfaces/ChainlinkRequestInterface.sol";
-import "@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol";
-import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
-
-/**
- * @title The Chainlink Mock Oracle contract
- * @notice Chainlink smart contract developers can use this to test their contracts
- */
-contract MockOracle is ChainlinkRequestInterface, LinkTokenReceiver {
- using SafeMathChainlink for uint256;
-
- uint256 public constant EXPIRY_TIME = 5 minutes;
- uint256 private constant MINIMUM_CONSUMER_GAS_LIMIT = 400000;
-
- struct Request {
- address callbackAddr;
- bytes4 callbackFunctionId;
- }
-
- LinkTokenInterface internal LinkToken;
- mapping(bytes32 => Request) private commitments;
-
- event OracleRequest(
- bytes32 indexed specId,
- address requester,
- bytes32 requestId,
- uint256 payment,
- address callbackAddr,
- bytes4 callbackFunctionId,
- uint256 cancelExpiration,
- uint256 dataVersion,
- bytes data
- );
-
- event CancelOracleRequest(bytes32 indexed requestId);
-
- /**
- * @notice Deploy with the address of the LINK token
- * @dev Sets the LinkToken address for the imported LinkTokenInterface
- * @param _link The address of the LINK token
- */
- constructor(address _link) public {
- LinkToken = LinkTokenInterface(_link); // external but already deployed and unalterable
- }
-
- /**
- * @notice Creates the Chainlink request
- * @dev Stores the hash of the params as the on-chain commitment for the request.
- * Emits OracleRequest event for the Chainlink node to detect.
- * @param _sender The sender of the request
- * @param _payment The amount of payment given (specified in wei)
- * @param _specId The Job Specification ID
- * @param _callbackAddress The callback address for the response
- * @param _callbackFunctionId The callback function ID for the response
- * @param _nonce The nonce sent by the requester
- * @param _dataVersion The specified data version
- * @param _data The CBOR payload of the request
- */
- function oracleRequest(
- address _sender,
- uint256 _payment,
- bytes32 _specId,
- address _callbackAddress,
- bytes4 _callbackFunctionId,
- uint256 _nonce,
- uint256 _dataVersion,
- bytes calldata _data
- ) external override onlyLINK checkCallbackAddress(_callbackAddress) {
- bytes32 requestId = keccak256(abi.encodePacked(_sender, _nonce));
- require(commitments[requestId].callbackAddr == address(0), "Must use a unique ID");
- // solhint-disable-next-line not-rely-on-time
- uint256 expiration = now.add(EXPIRY_TIME);
-
- commitments[requestId] = Request(_callbackAddress, _callbackFunctionId);
-
- emit OracleRequest(
- _specId,
- _sender,
- requestId,
- _payment,
- _callbackAddress,
- _callbackFunctionId,
- expiration,
- _dataVersion,
- _data
- );
- }
-
- /**
- * @notice Called by the Chainlink node to fulfill requests
- * @dev Given params must hash back to the commitment stored from `oracleRequest`.
- * Will call the callback address' callback function without bubbling up error
- * checking in a `require` so that the node can get paid.
- * @param _requestId The fulfillment request ID that must match the requester's
- * @param _data The data to return to the consuming contract
- * @return Status if the external call was successful
- */
- function fulfillOracleRequest(bytes32 _requestId, bytes32 _data)
- external
- isValidRequest(_requestId)
- returns (bool)
- {
- Request memory req = commitments[_requestId];
- delete commitments[_requestId];
- require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, "Must provide consumer enough gas");
- // All updates to the oracle's fulfillment should come before calling the
- // callback(addr+functionId) as it is untrusted.
- // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern
- (bool success, ) = req.callbackAddr.call(
- abi.encodeWithSelector(req.callbackFunctionId, _requestId, _data)
- ); // solhint-disable-line avoid-low-level-calls
- return success;
- }
-
- /**
- * @notice Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK
- * sent for the request back to the requester's address.
- * @dev Given params must hash to a commitment stored on the contract in order for the request to be valid
- * Emits CancelOracleRequest event.
- * @param _requestId The request ID
- * @param _payment The amount of payment given (specified in wei)
- * @param _expiration The time of the expiration for the request
- */
- function cancelOracleRequest(
- bytes32 _requestId,
- uint256 _payment,
- bytes4,
- uint256 _expiration
- ) external override {
- require(commitments[_requestId].callbackAddr != address(0), "Must use a unique ID");
- // solhint-disable-next-line not-rely-on-time
- require(_expiration <= now, "Request is not expired");
-
- delete commitments[_requestId];
- emit CancelOracleRequest(_requestId);
-
- assert(LinkToken.transfer(msg.sender, _payment));
- }
-
- /**
- * @notice Returns the address of the LINK token
- * @dev This is the public implementation for chainlinkTokenAddress, which is
- * an internal method of the ChainlinkClient contract
- */
- function getChainlinkToken() public view override returns (address) {
- return address(LinkToken);
- }
-
- // MODIFIERS
-
- /**
- * @dev Reverts if request ID does not exist
- * @param _requestId The given request ID to check in stored `commitments`
- */
- modifier isValidRequest(bytes32 _requestId) {
- require(commitments[_requestId].callbackAddr != address(0), "Must have a valid requestId");
- _;
- }
-
- /**
- * @dev Reverts if the callback address is the LINK token
- * @param _to The callback address
- */
- modifier checkCallbackAddress(address _to) {
- require(_to != address(LinkToken), "Cannot callback to LINK");
- _;
- }
-}
diff --git a/packages/oracles-starter-kit/contracts/test/MockV3Aggregator.sol b/packages/oracles-starter-kit/contracts/test/MockV3Aggregator.sol
deleted file mode 100644
index 572712f..0000000
--- a/packages/oracles-starter-kit/contracts/test/MockV3Aggregator.sol
+++ /dev/null
@@ -1,4 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.6.0;
-
-import "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";
diff --git a/packages/oracles-starter-kit/contracts/test/VRFCoordinatorV2Mock.sol b/packages/oracles-starter-kit/contracts/test/VRFCoordinatorV2Mock.sol
deleted file mode 100644
index 11c46e9..0000000
--- a/packages/oracles-starter-kit/contracts/test/VRFCoordinatorV2Mock.sol
+++ /dev/null
@@ -1,4 +0,0 @@
-//SPDX-License-Identifier: MIT
-pragma solidity ^0.8.0;
-
-import "@chainlink/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol";
diff --git a/packages/oracles-starter-kit/contracts/test/fuzzing/KeepersCounterEchidnaTest.sol b/packages/oracles-starter-kit/contracts/test/fuzzing/KeepersCounterEchidnaTest.sol
deleted file mode 100644
index 57467bc..0000000
--- a/packages/oracles-starter-kit/contracts/test/fuzzing/KeepersCounterEchidnaTest.sol
+++ /dev/null
@@ -1,12 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.7;
-
-import "../../KeepersCounter.sol";
-
-contract KeepersCounterEchidnaTest is KeepersCounter {
- constructor() KeepersCounter(8 days) {}
-
- function echidna_test_perform_upkeep_gate() public view returns (bool) {
- return counter == 0;
- }
-}
diff --git a/packages/oracles-starter-kit/contracts/test/fuzzing/config.yaml b/packages/oracles-starter-kit/contracts/test/fuzzing/config.yaml
deleted file mode 100644
index d4f9417..0000000
--- a/packages/oracles-starter-kit/contracts/test/fuzzing/config.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-# testLimit is the number of test sequences to run; default is 50000
-testLimit: 10000
-# maximum time between generated txs; default is one week
-maxTimeDelay: 0
-# maximum number of blocks elapsed between generated txs; default is expected increment in one week
-maxBlockDelay: 60480
-# additional arguments to use in crytic-compile for the compilation of the contract to test.
-cryticArgs:
- [
- "--solc-remaps",
- "@chainlink/contracts=/src/node_modules/@chainlink/contracts",
- "--solc-args",
- "--allow-paths /src/contracts",
- ]
diff --git a/packages/oracles-starter-kit/deploy/00_Deploy_Mocks.js b/packages/oracles-starter-kit/deploy/00_Deploy_Mocks.js
index 25c12ea..28617b2 100644
--- a/packages/oracles-starter-kit/deploy/00_Deploy_Mocks.js
+++ b/packages/oracles-starter-kit/deploy/00_Deploy_Mocks.js
@@ -1,13 +1,6 @@
const { network } = require('hardhat')
-const DECIMALS = '18'
-const INITIAL_PRICE = '200000000000000000000'
-
-/**
- * @dev Read more at https://docs.chain.link/docs/chainlink-vrf/
- */
const BASE_FEE = '100000000000000000'
-const GAS_PRICE_LINK = '1000000000' // 0.000000001 LINK per gas
module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
const { deploy, log } = deployments
@@ -16,26 +9,6 @@ module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
// If we are on a local development network, we need to deploy mocks!
if (chainId === 31337) {
log('Local network detected! Deploying mocks...')
- const linkToken = await deploy('LinkToken', { from: deployer, log: true })
- await deploy('MockV3Aggregator', {
- contract: 'MockV3Aggregator',
- from: deployer,
- log: true,
- args: [DECIMALS, INITIAL_PRICE]
- })
- await deploy('VRFCoordinatorV2Mock', {
- from: deployer,
- log: true,
- args: [
- BASE_FEE,
- GAS_PRICE_LINK
- ]
- })
- await deploy('MockOracle', {
- from: deployer,
- log: true,
- args: [linkToken.address]
- })
await deploy('WitnetRandomnessMock', {
from: deployer,
log: true,
@@ -52,4 +25,4 @@ module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
log('----------------------------------------------------')
}
}
-module.exports.tags = ['all', 'mocks', 'main']
+module.exports.tags = ['all', 'mocks', 'main']
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/deploy/01_Deploy_PriceConsumerV3.js b/packages/oracles-starter-kit/deploy/01_Deploy_PriceConsumerV3.js
deleted file mode 100644
index 98e9e71..0000000
--- a/packages/oracles-starter-kit/deploy/01_Deploy_PriceConsumerV3.js
+++ /dev/null
@@ -1,68 +0,0 @@
-const { network } = require('hardhat')
-const {
- networkConfig,
- developmentChains,
- VERIFICATION_BLOCK_CONFIRMATIONS
-} = require('../helper-hardhat-config')
-const { networks } = require('../hardhat.config')
-const fs = require('fs')
-
-module.exports = async ({ getNamedAccounts, deployments }) => {
- const { deploy, log } = deployments
- const { deployer } = await getNamedAccounts()
- const chainId = network.config.chainId
-
- let priceFeedAddress
- if (chainId === 31337) {
- const EthUsdAggregator = await deployments.get('MockV3Aggregator')
- priceFeedAddress = EthUsdAggregator.address
- } else if (chainId === networks.baobab.chainId) {
- priceFeedAddress = networkConfig[chainId].chainLinkPriceFeed
- } else {
- priceFeedAddress = networkConfig[chainId].klayUsdPriceFeed
- }
- // Price Feed Address, values can be obtained at https://docs.chain.link/docs/reference-contracts
- // Default one below is ETH/USD contract on Goerli
- const waitBlockConfirmations = developmentChains.includes(network.name)
- ? 1
- : VERIFICATION_BLOCK_CONFIRMATIONS
- log('----------------------------------------------------')
- const priceConsumerV3 = await deploy('PriceConsumerV3', {
- from: deployer,
- args: [priceFeedAddress],
- log: true,
- waitConfirmations: waitBlockConfirmations
- })
-
- // TODO: implement verify
- // Verify the deployment
- // if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
- // log("Verifying...")
- // await verify(priceConsumerV3.address, [priceFeedAddress])
- // }
-
- log('Run Price Feed contract with command:')
-
- const sourcePath = './deployedContracts.json'
- let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
- witnetPriceFeed: '',
- witnetRandomNumber: '',
- network: ''
- }
- if (fs.existsSync(sourcePath)) {
- jsonData = JSON.parse(fs.readFileSync(sourcePath))
- }
- const networkName = network.name === 'hardhat' ? 'localhost' : network.name
- // log(`yarn hardhat read-price-feed --contract ${priceConsumerV3.address} --network ${networkName}`)
- log('Execute readChainLinkPriceFeed method')
- jsonData.chainLinkPriceFeed = priceConsumerV3.address
- jsonData.network = networkName
- fs.writeFileSync(sourcePath, JSON.stringify(jsonData))
- log('----------------------------------------------------')
-}
-
-module.exports.tags = ['all', 'feed', 'main']
diff --git a/packages/oracles-starter-kit/deploy/05_Deploy_Witnet_PriceFeed.js b/packages/oracles-starter-kit/deploy/01_Deploy_Witnet_PriceFeed.js
similarity index 95%
rename from packages/oracles-starter-kit/deploy/05_Deploy_Witnet_PriceFeed.js
rename to packages/oracles-starter-kit/deploy/01_Deploy_Witnet_PriceFeed.js
index 8aaa393..7a93f2f 100644
--- a/packages/oracles-starter-kit/deploy/05_Deploy_Witnet_PriceFeed.js
+++ b/packages/oracles-starter-kit/deploy/01_Deploy_Witnet_PriceFeed.js
@@ -41,10 +41,6 @@ module.exports = async ({ getNamedAccounts, deployments }) => {
const sourcePath = './deployedContracts.json'
let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
witnetPriceFeed: '',
witnetRandomNumber: '',
network: ''
diff --git a/packages/oracles-starter-kit/deploy/02_Deploy_APIConsumer.js b/packages/oracles-starter-kit/deploy/02_Deploy_APIConsumer.js
deleted file mode 100644
index 409365c..0000000
--- a/packages/oracles-starter-kit/deploy/02_Deploy_APIConsumer.js
+++ /dev/null
@@ -1,88 +0,0 @@
-const hre = require('hardhat')
-const { network, ethers } = hre
-const {
- networkConfig,
- developmentChains,
- VERIFICATION_BLOCK_CONFIRMATIONS
-} = require('../helper-hardhat-config')
-const { autoFundCheck } = require('../helper-functions')
-const fs = require('fs')
-
-module.exports = async ({ getNamedAccounts, deployments }) => {
- const { deploy, log, get } = deployments
- const { deployer } = await getNamedAccounts()
- const chainId = network.config.chainId
- let linkTokenAddress
- let oracle
- let additionalMessage = ''
- // set log level to ignore non errors
- ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.ERROR)
-
- if (chainId === 31337) {
- const linkToken = await get('LinkToken')
- const MockOracle = await get('MockOracle')
- linkTokenAddress = linkToken.address
- oracle = MockOracle.address
- additionalMessage = ' --linkaddress ' + linkTokenAddress
- } else {
- linkTokenAddress = networkConfig[chainId].linkToken
- oracle = networkConfig[chainId].oracle
- }
- const jobId = ethers.utils.toUtf8Bytes(networkConfig[chainId].jobId)
- const fee = networkConfig[chainId].fee
-
- const waitBlockConfirmations = developmentChains.includes(network.name)
- ? 1
- : VERIFICATION_BLOCK_CONFIRMATIONS
- const args = [oracle, jobId, fee, linkTokenAddress]
- const apiConsumer = await deploy('APIConsumer', {
- from: deployer,
- args,
- log: true,
- waitConfirmations: waitBlockConfirmations
- })
-
- // TODO: implement verify
- // if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
- // log("Verifying...")
- // await verify(apiConsumer.address, args)
- // }
-
- // Checking for funding...
- if (networkConfig.fundAmount && networkConfig.fundAmount > 0) {
- log('Funding with LINK...')
- if (
- await autoFundCheck(apiConsumer.address, network.name, linkTokenAddress, additionalMessage)
- ) {
- await hre.run('fund-link', {
- contract: apiConsumer.address,
- linkaddress: linkTokenAddress
- })
- } else {
- log('Contract already has LINK!')
- }
- }
-
- const sourcePath = './deployedContracts.json'
- let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
- witnetPriceFeed: '',
- witnetRandomNumber: '',
- network: ''
- }
- if (fs.existsSync(sourcePath)) {
- jsonData = JSON.parse(fs.readFileSync(sourcePath))
- }
- log('Run API Consumer contract with following command:')
- const networkName = network.name === 'hardhat' ? 'localhost' : network.name
- // log(`yarn hardhat request-data --contract ${apiConsumer.address} --network ${networkName}`)
- log('Execute fundChainLinkApiData, requestChainLinkApiData, readChainLinkApiData methods')
- jsonData.chainLinkApiData = apiConsumer.address
- jsonData.network = networkName
- fs.writeFileSync(sourcePath, JSON.stringify(jsonData))
- log('----------------------------------------------------')
-}
-module.exports.tags = ['all', 'api', 'main']
diff --git a/packages/oracles-starter-kit/deploy/06_Deploy_Witnet_Random.js b/packages/oracles-starter-kit/deploy/02_Deploy_Witnet_Random.js
similarity index 95%
rename from packages/oracles-starter-kit/deploy/06_Deploy_Witnet_Random.js
rename to packages/oracles-starter-kit/deploy/02_Deploy_Witnet_Random.js
index ed796db..d163cd7 100644
--- a/packages/oracles-starter-kit/deploy/06_Deploy_Witnet_Random.js
+++ b/packages/oracles-starter-kit/deploy/02_Deploy_Witnet_Random.js
@@ -40,10 +40,6 @@ module.exports = async ({ getNamedAccounts, deployments }) => {
const sourcePath = './deployedContracts.json'
let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
witnetPriceFeed: '',
witnetRandomNumber: '',
network: ''
diff --git a/packages/oracles-starter-kit/deploy/03_Deploy_RandomNumberConsumer.js b/packages/oracles-starter-kit/deploy/03_Deploy_RandomNumberConsumer.js
deleted file mode 100644
index 2b5020a..0000000
--- a/packages/oracles-starter-kit/deploy/03_Deploy_RandomNumberConsumer.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const { network, ethers } = require('hardhat')
-const {
- networkConfig,
- developmentChains,
- VERIFICATION_BLOCK_CONFIRMATIONS
-} = require('../helper-hardhat-config')
-const fs = require('fs')
-
-module.exports = async ({ getNamedAccounts, deployments }) => {
- const { deploy, log } = deployments
- const { deployer } = await getNamedAccounts()
- const chainId = network.config.chainId
- let vrfCoordinatorAddress
- let subscriptionId
-
- if (chainId === 31337) {
- const VRFCoordinatorV2Mock = await ethers.getContract('VRFCoordinatorV2Mock')
-
- vrfCoordinatorAddress = VRFCoordinatorV2Mock.address
-
- const fundAmount = networkConfig[chainId].fundAmount
- const transaction = await VRFCoordinatorV2Mock.createSubscription()
- const transactionReceipt = await transaction.wait(1)
- subscriptionId = ethers.BigNumber.from(transactionReceipt.events[0].topics[1])
- await VRFCoordinatorV2Mock.fundSubscription(subscriptionId, fundAmount)
- } else {
- subscriptionId = process.env.VRF_SUBSCRIPTION_ID
- vrfCoordinatorAddress = networkConfig[chainId].vrfCoordinator
- }
- const keyHash = networkConfig[chainId].keyHash
- const waitBlockConfirmations = developmentChains.includes(network.name)
- ? 1
- : VERIFICATION_BLOCK_CONFIRMATIONS
- const args = [subscriptionId, vrfCoordinatorAddress, keyHash]
- const randomNumberConsumerV2 = await deploy('RandomNumberConsumerV2', {
- from: deployer,
- args,
- log: true,
- waitConfirmations: waitBlockConfirmations
- })
- // TODO: implement verify
- // if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
- // log("Verifying...")
- // await verify(randomNumberConsumerV2.address, args)
- // }
-
- const sourcePath = './deployedContracts.json'
- let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
- witnetPriceFeed: '',
- witnetRandomNumber: '',
- network: ''
- }
- if (fs.existsSync(sourcePath)) {
- jsonData = JSON.parse(fs.readFileSync(sourcePath))
- }
- log('Then run RandomNumberConsumer contract with the following command')
- const networkName = network.name === 'hardhat' ? 'localhost' : network.name
- // log(
- // `yarn hardhat request-random-number --contract ${randomNumberConsumerV2.address} --network ${networkName}`
- // )
- log('Execute requestChainLinkRandomNumber, readChainLinkRandomNumber methods')
- jsonData.chainLinkRandomNumber = randomNumberConsumerV2.address
- jsonData.network = networkName
- fs.writeFileSync(sourcePath, JSON.stringify(jsonData))
- log('----------------------------------------------------')
-}
-
-module.exports.tags = ['all', 'vrf']
diff --git a/packages/oracles-starter-kit/deploy/04_Deploy_KeepersCounter.js b/packages/oracles-starter-kit/deploy/04_Deploy_KeepersCounter.js
deleted file mode 100644
index 836c993..0000000
--- a/packages/oracles-starter-kit/deploy/04_Deploy_KeepersCounter.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const { network } = require('hardhat')
-const {
- networkConfig,
- developmentChains,
- VERIFICATION_BLOCK_CONFIRMATIONS
-} = require('../helper-hardhat-config')
-const fs = require('fs')
-
-module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
- const { deploy, log } = deployments
- const { deployer } = await getNamedAccounts()
- const chainId = network.config.chainId
- const keepersUpdateInterval = networkConfig[chainId].keepersUpdateInterval || '30'
- const waitBlockConfirmations = developmentChains.includes(network.name)
- ? 1
- : VERIFICATION_BLOCK_CONFIRMATIONS
- const args = [keepersUpdateInterval]
- const keepersCounter = await deploy('KeepersCounter', {
- from: deployer,
- args,
- log: true,
- waitConfirmations: waitBlockConfirmations
- })
- // TODO: implement verify
- // if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
- // log("Verifying...")
- // await verify(keepersCounter.address, args)
- // }
-
- const sourcePath = './deployedContracts.json'
- let jsonData = {
- chainLinkPriceFeed: '',
- chainLinkApiData: '',
- chainLinkRandomNumber: '',
- keepersCounter: '',
- witnetPriceFeed: '',
- witnetRandomNumber: '',
- network: ''
- }
- if (fs.existsSync(sourcePath)) {
- jsonData = JSON.parse(fs.readFileSync(sourcePath))
- }
- log(
- 'Head to https://keepers.chain.link/ to register your contract for upkeeps. Then run the following command to track the counter updates: '
- )
- const networkName = network.name === 'hardhat' ? 'localhost' : network.name
- // log(
- // `yarn hardhat read-keepers-counter --contract ${keepersCounter.address} --network ${networkName}`
- // )
- log('Execute readChainLinkKeepersCounter method')
- jsonData.keepersCounter = keepersCounter.address
- jsonData.network = networkName
- fs.writeFileSync(sourcePath, JSON.stringify(jsonData))
- log('----------------------------------------------------')
-}
-
-module.exports.tags = ['all', 'keepers']
diff --git a/packages/oracles-starter-kit/hardhat.config.js b/packages/oracles-starter-kit/hardhat.config.js
index e797646..46dc757 100644
--- a/packages/oracles-starter-kit/hardhat.config.js
+++ b/packages/oracles-starter-kit/hardhat.config.js
@@ -2,7 +2,6 @@ require('@nomiclabs/hardhat-waffle')
require('@nomiclabs/hardhat-etherscan')
require('hardhat-deploy')
require('./tasks')
-require('@appliedblockchain/chainlink-plugins-fund-link')
require('dotenv').config()
/**
diff --git a/packages/oracles-starter-kit/helper-functions.js b/packages/oracles-starter-kit/helper-functions.js
index a17a865..e2fd849 100644
--- a/packages/oracles-starter-kit/helper-functions.js
+++ b/packages/oracles-starter-kit/helper-functions.js
@@ -4,38 +4,6 @@
const { run, network, ethers } = require('hardhat')
const { networkConfig } = require('./helper-hardhat-config')
-const autoFundCheck = async (contractAddr, networkName, linkTokenAddress, additionalMessage) => {
- const chainId = network.config.chainId
- console.log('Checking to see if contract can be auto-funded with LINK:')
- const amount = networkConfig[chainId].fundAmount
- // check to see if user has enough LINK
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
- const LinkToken = await ethers.getContractFactory('LinkToken')
- const linkTokenContract = new ethers.Contract(linkTokenAddress, LinkToken.interface, signer)
- const balanceBN = await linkTokenContract.balanceOf(signer.address)
- const balance = balanceBN.toString()
- const contractBalanceBN = await linkTokenContract.balanceOf(contractAddr)
- const contractBalance = await contractBalanceBN.toString()
- if (balance > amount && amount > 0 && contractBalance < amount) {
- // user has enough LINK to auto-fund
- // and the contract isn't already funded
- return true
- } else {
- // user doesn't have enough LINK, print a warning
- console.log(
- "Account doesn't have enough LINK to fund contracts, you're deploying to a network where auto funding isnt' done by default, the contract is already funded, or you set AUTO_FUND to false."
- )
- console.log(
- `Please obtain LINK via the faucet at https://faucets.chain.link/${networkName} then run the following command to fund contract with LINK:`
- )
- console.log(
- `yarn hardhat fund-link --contract ${contractAddr} --network ${networkName} ${additionalMessage}`
- )
- return false
- }
-}
-
const verify = async (contractAddress, args) => {
console.log('Verifying contract...')
try {
@@ -53,6 +21,5 @@ const verify = async (contractAddress, args) => {
}
module.exports = {
- autoFundCheck,
verify
-}
+}
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/helper-hardhat-config.json b/packages/oracles-starter-kit/helper-hardhat-config.json
index 77e22f1..fd388c3 100644
--- a/packages/oracles-starter-kit/helper-hardhat-config.json
+++ b/packages/oracles-starter-kit/helper-hardhat-config.json
@@ -1,39 +1,20 @@
{
- "networkConfig": {
- "1001": {
- "name": "baobab",
- "linkToken": "0x04c5046A1f4E3fFf094c26dFCAA75eF293932f18",
- "keyHash": "0x9be50e2346ee6abe000e6d3a34245e1d232c669703efc44660a413854427027c",
- "chainLinkPriceFeed": "0xf49f81b3d2F2a79b706621FA2D5934136352140c",
- "oracle": "0xfC3BdAbD8a6A73B40010350E2a61716a21c87610",
- "jobId": "ca98366cc7314957b8c012c72f05aeeb",
- "vrfCoordinator": "0x771143FcB645128b07E41D79D82BE707ad8bDa1C",
- "witnetPriceRouter": "0xeD074DA2A76FD2Ca90C1508930b4FB4420e413B0",
- "witnetRandomness": "0xb4b2e2e00e9d6e5490d55623e4f403ec84c6d33f",
- "fee": "100000000000000",
- "fundAmount": "100000000000000"
- },
- "31337": {
- "name": "localhost",
- "fee": "100000000000000000",
- "keyHash": "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
- "jobId": "29fa9aa13bf1468788b7cc4a500a45b8",
- "fundAmount": "1000000000000000000",
- "keepersUpdateInterval": "30",
- "klayUsdPriceFeed": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419"
- },
- "default": {
- "name": "hardhat",
- "fee": "100000000000000000",
- "keyHash": "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
- "jobId": "29fa9aa13bf1468788b7cc4a500a45b8",
- "fundAmount": "1000000000000000000",
- "keepersUpdateInterval": "30"
- }
+ "networkConfig": {
+ "1001": {
+ "name": "baobab",
+ "witnetPriceRouter": "0xeD074DA2A76FD2Ca90C1508930b4FB4420e413B0",
+ "witnetRandomness": "0xb4b2e2e00e9d6e5490d55623e4f403ec84c6d33f"
},
- "developmentChains": [
- "hardhat",
- "localhost"
- ],
- "VERIFICATION_BLOCK_CONFIRMATIONS": 6
- }
\ No newline at end of file
+ "31337": {
+ "name": "localhost"
+ },
+ "default": {
+ "name": "hardhat"
+ }
+ },
+ "developmentChains": [
+ "hardhat",
+ "localhost"
+ ],
+ "VERIFICATION_BLOCK_CONFIRMATIONS": 6
+}
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/package.json b/packages/oracles-starter-kit/package.json
index bd74a68..9f0c13a 100644
--- a/packages/oracles-starter-kit/package.json
+++ b/packages/oracles-starter-kit/package.json
@@ -1,6 +1,6 @@
{
- "name": "@klaytn/kds-oracles",
- "version": "0.0.5",
+ "name": "@klaytn/kss-oracles",
+ "version": "0.0.6",
"description": "Hardhat Klaytn Oracles starter kit",
"scripts": {
"help": "hardhat --help",
@@ -16,16 +16,10 @@
"keywords": [
"klaytn",
"oracles",
- "chainlink",
"witnet",
- "klaytn-developer-sdk"
+ "klaytn-service-sdk"
],
"dependencies": {
- "@appliedblockchain/chainlink-contracts": "0.0.4",
- "@appliedblockchain/chainlink-plugins-fund-link": "0.0.1",
- "@chainlink/contracts": "^0.4.0",
- "@chainlink/test-helpers": "^0.0.7-alpha",
- "@chainlink/token": "^1.1.0",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.1",
@@ -50,4 +44,4 @@
"eslint-plugin-promise": "^6.1.1",
"mocha": "^10.2.0"
}
-}
+}
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/tasks/api-consumer/index.js b/packages/oracles-starter-kit/tasks/api-consumer/index.js
deleted file mode 100644
index c5bddec..0000000
--- a/packages/oracles-starter-kit/tasks/api-consumer/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.readData = require('./read-data.js')
-exports.requestData = require('./request-data.js')
diff --git a/packages/oracles-starter-kit/tasks/api-consumer/read-data.js b/packages/oracles-starter-kit/tasks/api-consumer/read-data.js
deleted file mode 100644
index 591f0e8..0000000
--- a/packages/oracles-starter-kit/tasks/api-consumer/read-data.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* eslint-disable no-undef */
-task('read-data', 'Calls an API Consumer Contract to read data obtained from an external API')
- .addParam('contract', 'The address of the API Consumer contract that you want to call')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
- console.log('Reading data from API Consumer contract ', contractAddr, ' on network ', networkId)
- const APIConsumer = await ethers.getContractFactory('APIConsumer')
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
-
- // Create connection to API Consumer Contract and call the createRequestTo function
- const apiConsumerContract = new ethers.Contract(contractAddr, APIConsumer.interface, signer)
- const result = BigInt(await apiConsumerContract.volume()).toString()
- console.log('Data is: ', result)
- if (result === 0 && ['hardhat', 'localhost', 'ganache'].indexOf(network.name) === 0) {
- console.log("You'll either need to wait another minute, or fix something!")
- }
- if (['hardhat', 'localhost', 'ganache'].indexOf(network.name) >= 0) {
- console.log("You'll have to manually update the value since you're on a local chain!")
- }
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/api-consumer/request-data.js b/packages/oracles-starter-kit/tasks/api-consumer/request-data.js
deleted file mode 100644
index 60ce229..0000000
--- a/packages/oracles-starter-kit/tasks/api-consumer/request-data.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* eslint-disable no-undef */
-
-task('request-data', 'Calls an API Consumer Contract to request external data')
- .addParam('contract', 'The address of the API Consumer contract that you want to call')
- .addParam('coinsymbol', 'coin symbol (valid fsyms) from https://min-api.cryptocompare.com ex: KLAY')
- .addParam('coindecimals', 'coin decimals ex: 18')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const coinsymbol = taskArgs.coinsymbol || 'KLAY'
- const coindecimals = parseInt(taskArgs.coindecimals || '18')
- console.log('Calling API Consumer contract ', contractAddr, ' on network ', network.name)
- const APIConsumer = await ethers.getContractFactory('APIConsumer')
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
-
- // Create connection to API Consumer Contract and call the createRequestTo function
- const apiConsumerContract = new ethers.Contract(contractAddr, APIConsumer.interface, signer)
- const result = await apiConsumerContract.requestVolumeData(coinsymbol, coindecimals, { gasLimit: 200000 })
- console.log(
- 'Contract ',
- contractAddr,
- ' external data request successfully called. '
- )
- console.log('Transaction Hash: ' + result.hash)
- })
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/keepers/index.js b/packages/oracles-starter-kit/tasks/keepers/index.js
deleted file mode 100644
index 7613670..0000000
--- a/packages/oracles-starter-kit/tasks/keepers/index.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.readCounter = require('./read-keepers-counter.js')
diff --git a/packages/oracles-starter-kit/tasks/keepers/read-keepers-counter.js b/packages/oracles-starter-kit/tasks/keepers/read-keepers-counter.js
deleted file mode 100644
index e2b5686..0000000
--- a/packages/oracles-starter-kit/tasks/keepers/read-keepers-counter.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* eslint-disable no-undef */
-task(
- 'read-keepers-counter',
- 'Gets the value of the counter from the Counter contract used to demo Chainlink Keepers'
-)
- .addParam('contract', 'The address of the Price Feed consumer contract that you want to read')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
-
- const KeepersCounterContract = await ethers.getContractFactory('KeepersCounter')
- console.log('Reading counter from Keepers contract ', contractAddr, ' on network ', networkId)
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
- const keepersCounterContract = await new ethers.Contract(
- contractAddr,
- KeepersCounterContract.interface,
- signer
- )
- await keepersCounterContract.counter().then((data) => {
- console.log('Counter is: ', BigInt(data).toString())
- })
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/price-consumer/change-price-feed.js b/packages/oracles-starter-kit/tasks/price-consumer/change-price-feed.js
deleted file mode 100644
index ff7e609..0000000
--- a/packages/oracles-starter-kit/tasks/price-consumer/change-price-feed.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* eslint-disable no-undef */
-task('change-price-feed', 'Change Chainlink Price Feed Address')
- .addParam('contract', 'The address of the Price Feed consumer contract that you want to read')
- .addParam('pricefeedaddress', 'Pricefeed address(https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds)')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
- const pricefeedaddress = taskArgs.pricefeedaddress
-
- const PriceFeedConsumerContract = await ethers.getContractFactory('PriceConsumerV3')
- console.log(
- 'Change Price Feed address ',
- contractAddr,
- ' on network ',
- networkId
- )
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
- const priceFeedConsumerContract = await new ethers.Contract(
- contractAddr,
- PriceFeedConsumerContract.interface,
- signer
- )
- const transaction = await priceFeedConsumerContract.changePriceFeed(pricefeedaddress, { gasLimit: 200000 })
- console.log(
- 'Contract ',
- contractAddr,
- ' random number request successfully called.'
- )
- console.log('Transaction Hash: ' + transaction.hash)
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/price-consumer/index.js b/packages/oracles-starter-kit/tasks/price-consumer/index.js
deleted file mode 100644
index 3c436c0..0000000
--- a/packages/oracles-starter-kit/tasks/price-consumer/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.readPriceFeedEns = require('./read-price-feed-ens.js')
-exports.readPriceFeed = require('./read-price-feed.js')
-exports.changePriceFeed = require('./change-price-feed.js')
diff --git a/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed-ens.js b/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed-ens.js
deleted file mode 100644
index 49359a7..0000000
--- a/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed-ens.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* eslint-disable no-undef */
-// This script only works with --network 'mainnet', or 'hardhat' when running a fork of mainnet
-task('read-price-feed-ens', 'Gets the latest price from a Chainlink Price Feed')
- .addParam('pair', "The token pair that you want to read, ie 'btc-usd'")
- .setAction(async (taskArgs) => {
- const ensAddress = taskArgs.pair + '.data.eth'
- console.log(ensAddress)
-
- const V3Aggregator = await ethers.getContractFactory('MockV3Aggregator')
- console.log('Reading data from Price Feed consumer contract ', ensAddress)
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
- const priceFeedConsumerContract = await new ethers.Contract(
- ensAddress,
- V3Aggregator.interface,
- signer
- )
- await priceFeedConsumerContract.latestRoundData().then((data) => {
- console.log('Price is: ', BigInt(data.answer).toString())
- })
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed.js b/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed.js
deleted file mode 100644
index f850f38..0000000
--- a/packages/oracles-starter-kit/tasks/price-consumer/read-price-feed.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* eslint-disable no-undef */
-task('read-price-feed', 'Gets the latest price from a Chainlink Price Feed')
- .addParam('contract', 'The address of the Price Feed consumer contract that you want to read')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
-
- const PriceFeedConsumerContract = await ethers.getContractFactory('PriceConsumerV3')
- console.log(
- 'Reading data from Price Feed consumer contract ',
- contractAddr,
- ' on network ',
- networkId
- )
-
- // Get signer information
- const accounts = await ethers.getSigners()
- const signer = accounts[0]
- const priceFeedConsumerContract = await new ethers.Contract(
- contractAddr,
- PriceFeedConsumerContract.interface,
- signer
- )
- await priceFeedConsumerContract.getLatestPrice().then((data) => {
- console.log('Price is: ', BigInt(data).toString())
- })
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/random-number-consumer/index.js b/packages/oracles-starter-kit/tasks/random-number-consumer/index.js
deleted file mode 100644
index ddb656b..0000000
--- a/packages/oracles-starter-kit/tasks/random-number-consumer/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.readRandomNumber = require('./read-random-number.js')
-exports.requestRandomNumber = require('./request-random-number.js')
diff --git a/packages/oracles-starter-kit/tasks/random-number-consumer/read-random-number.js b/packages/oracles-starter-kit/tasks/random-number-consumer/read-random-number.js
deleted file mode 100644
index 9f0e452..0000000
--- a/packages/oracles-starter-kit/tasks/random-number-consumer/read-random-number.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* eslint-disable no-undef */
-task('read-random-number', 'Reads the random number returned to a contract by Chainlink VRF')
- .addParam('contract', 'The address of the VRF contract that you want to read')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
- console.log('Reading data from VRF contract ', contractAddr, ' on network ', networkId)
- const RandomNumberConsumerV2 = await ethers.getContractFactory('RandomNumberConsumerV2')
-
- // Get signer information
- const accounts = await hre.ethers.getSigners()
- const signer = accounts[0]
-
- // Create connection to API Consumer Contract and call the createRequestTo function
- const vrfConsumerContractV2 = new ethers.Contract(
- contractAddr,
- RandomNumberConsumerV2.interface,
- signer
- )
-
- try {
- const randomWordsCount = (await vrfConsumerContractV2.getRandomWordsCount()).toNumber()
- const randomWords = []
- for (let i = 0; i < randomWordsCount; i++) {
- randomWords.push(await vrfConsumerContractV2.s_randomWords(i))
- }
- console.log(
- `Random Numbers are: ${randomWords.join(',')}`
- )
- } catch (error) {
- if (['hardhat', 'localhost', 'ganache'].includes(network.name)) {
- console.log("You'll have to manually update the value since you're on a local chain!")
- } else {
- console.log(
- `Visit https://vrf.chain.link/klaytn-testnet/${process.env.VRF_SUBSCRIPTION_ID} and make sure that your last request fulfillment is there`
- )
- }
- }
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/random-number-consumer/request-random-number.js b/packages/oracles-starter-kit/tasks/random-number-consumer/request-random-number.js
deleted file mode 100644
index 1afd61f..0000000
--- a/packages/oracles-starter-kit/tasks/random-number-consumer/request-random-number.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* eslint-disable no-undef */
-task('request-random-number', 'Requests a random number for a Chainlink VRF enabled smart contract')
- .addParam('contract', 'The address of the API Consumer contract that you want to call')
- .addParam('numwords', 'No of random words to be requested')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.name
- const numWords = parseInt(taskArgs.numwords || '0')
- console.log(
- 'Requesting a random number using VRF consumer contract ',
- contractAddr,
- ' on network ',
- networkId
- )
- const RandomNumberConsumerV2 = await ethers.getContractFactory('RandomNumberConsumerV2')
-
- // Get signer information
- const accounts = await hre.ethers.getSigners()
- const signer = accounts[0]
-
- // Create connection to VRF Contract and call the getRandomNumber function
- const vrfConsumerContractV2 = new ethers.Contract(
- contractAddr,
- RandomNumberConsumerV2.interface,
- signer
- )
- const transaction = await vrfConsumerContractV2.requestRandomWords(numWords, { gasLimit: 200000 })
- console.log(
- 'Contract ',
- contractAddr,
- ' random number request successfully called.'
- )
- console.log('Transaction Hash: ' + transaction.hash)
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/tasks/withdraw-link.js b/packages/oracles-starter-kit/tasks/withdraw-link.js
deleted file mode 100644
index bb660ca..0000000
--- a/packages/oracles-starter-kit/tasks/withdraw-link.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* eslint-disable no-undef */
-const { networkConfig } = require('../helper-hardhat-config')
-
-task('withdraw-link', 'Returns any LINK left in deployed contract')
- .addParam('contract', 'The address of the contract')
- .addOptionalParam('linkaddress', 'Set the LINK token address')
- .setAction(async (taskArgs) => {
- const contractAddr = taskArgs.contract
- const networkId = network.config.chainId
-
- // Get signer information
- const accounts = await hre.ethers.getSigners()
- const signer = accounts[0]
-
- // First, lets see if there is any LINK to withdraw
- const linkTokenAddress = networkConfig[networkId].linkToken || taskArgs.linkaddress
- const LinkToken = await ethers.getContractFactory('LinkToken')
- const linkTokenContract = new ethers.Contract(linkTokenAddress, LinkToken.interface, signer)
- const balanceHex = await linkTokenContract.balanceOf(contractAddr)
- const balance = await ethers.BigNumber.from(balanceHex._hex).toString()
- console.log('LINK balance of contract: ' + contractAddr + ' is ' + balance / Math.pow(10, 18))
-
- if (balance > 0) {
- // Could also be Any-API contract, but in either case the function signature is the same, so we just need to use one
- const RandomNumberConsumer = await ethers.getContractFactory('RandomNumberConsumer')
-
- // Create connection to Consumer Contract and call the withdraw function
- const ConsumerContract = new ethers.Contract(
- contractAddr,
- RandomNumberConsumer.interface,
- signer
- )
- const result = await ConsumerContract.withdrawLink()
- console.log(
- 'All LINK withdrew from contract ' + contractAddr
- )
- console.log('Transaction Hash: ' + result.hash)
- } else {
- console.log("Contract doesn't have any LINK to withdraw")
- }
- })
-
-module.exports = {}
diff --git a/packages/oracles-starter-kit/test/unit/APIConsumer_unit_test.js b/packages/oracles-starter-kit/test/unit/APIConsumer_unit_test.js
deleted file mode 100755
index 04478ac..0000000
--- a/packages/oracles-starter-kit/test/unit/APIConsumer_unit_test.js
+++ /dev/null
@@ -1,77 +0,0 @@
-const { assert, expect } = require('chai')
-const { network, waffle } = require('hardhat')
-const { developmentChains } = require('../../helper-hardhat-config')
-const { numToBytes32, toBytes32String } = require('@chainlink/test-helpers/dist/src/helpers')
-const { deployMockContract, provider } = waffle
-
-!developmentChains.includes(network.name)
- ? describe.skip
- : describe('Unit Tests - APIConsumer', async function () {
- let apiConsumer, mockOracle
-
- beforeEach(async () => {
- const [deployerOfContract] = provider.getWallets()
- // deploy the contract to Mock
- const APIConsumerABI = require('../../artifacts/contracts/APIConsumer.sol/APIConsumer.json')
- apiConsumer = await deployMockContract(deployerOfContract, APIConsumerABI.abi)
-
- const MockOracleABI = require('../../artifacts/contracts/test/MockOracle.sol/MockOracle.json')
- mockOracle = await deployMockContract(deployerOfContract, MockOracleABI.abi)
- })
-
- it('Should successfully make an API request', async () => {
- await apiConsumer.mock.requestVolumeData.withArgs('KLAY', 18).returns(toBytes32String('123'))
- const transaction = await apiConsumer.requestVolumeData('KLAY', 18)
- const transactionReceipt = await transaction.wait(1)
- const requestId = transactionReceipt?.events[0]?.topics[1]
- expect(requestId).to.not.be.null
- })
-
- it('Should successfully make an API request and get a result', async () => {
- const callbackValue = 777
- await apiConsumer.mock.requestVolumeData.returns(toBytes32String('123'))
- await apiConsumer.mock.volume.returns(callbackValue)
- const transaction = await apiConsumer.requestVolumeData('KLAY', 18)
- const transactionReceipt = await transaction.wait(1)
- const requestId = transactionReceipt?.events[0]?.topics[1]
-
- await mockOracle.mock.fulfillOracleRequest.withArgs(toBytes32String(requestId || '1234'), numToBytes32(callbackValue)).returns(true)
- await mockOracle.fulfillOracleRequest(toBytes32String(requestId || '1234'), numToBytes32(callbackValue))
- const volume = await apiConsumer.volume()
- assert.equal(volume.toString(), callbackValue.toString())
- })
-
- it('Our event should successfully fire event on callback', async () => {
- const callbackValue = 777
- await apiConsumer.mock.requestVolumeData.withArgs('KLAY', 18).returns(toBytes32String('123'))
- await apiConsumer.mock.volume.returns(callbackValue)
- apiConsumer.once = (a, b) => {
- b()
- }
- await mockOracle.mock.fulfillOracleRequest.withArgs(toBytes32String('1234'), numToBytes32(callbackValue)).returns(true)
-
- // we setup a promise so we can wait for our callback from the `once` function
- await new Promise(async (resolve, reject) => {
- const transaction = await apiConsumer.requestVolumeData('KLAY', 18)
- const transactionReceipt = await transaction.wait(1)
- const requestId = transactionReceipt?.events[0]?.topics[1]
-
- await mockOracle.fulfillOracleRequest(requestId || toBytes32String('1234'), numToBytes32(callbackValue))
-
- // setup listener for our event
- apiConsumer.once('DataFullfilled', async () => {
- console.log('DataFullfilled event fired!')
- const volume = await apiConsumer.volume()
- // assert throws an error if it fails, so we need to wrap
- // it in a try/catch so that the promise returns event
- // if it fails.
- try {
- assert.equal(volume.toString(), callbackValue.toString())
- resolve()
- } catch (e) {
- reject(e)
- }
- })
- })
- })
- })
diff --git a/packages/oracles-starter-kit/test/unit/KeepersCounter_unit_test.js b/packages/oracles-starter-kit/test/unit/KeepersCounter_unit_test.js
deleted file mode 100644
index a000d56..0000000
--- a/packages/oracles-starter-kit/test/unit/KeepersCounter_unit_test.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const { assert, expect } = require('chai')
-const { network, ethers, waffle } = require('hardhat')
-const { developmentChains } = require('../../helper-hardhat-config')
-const { deployMockContract, provider } = waffle
-
-!developmentChains.includes(network.name)
- ? describe.skip
- : describe('Unit Tests - Keepers Counter', async function () {
- let counter
- beforeEach(async () => {
- const [deployerOfContract] = provider.getWallets()
- // deploy the contract to Mock
- const KeepersCounterABI = require('../../artifacts/contracts/KeepersCounter.sol/KeepersCounter.json')
- counter = await deployMockContract(deployerOfContract, KeepersCounterABI.abi)
- })
-
- it('should be able to call checkUpkeep', async () => {
- const checkData = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(''))
- await counter.mock.checkUpkeep.withArgs(checkData).returns(false, ethers.utils.toUtf8Bytes(''))
- const { upkeepNeeded } = await counter.callStatic.checkUpkeep(checkData)
- assert.equal(upkeepNeeded, false)
- })
-
- it('should not be able to call perform upkeep without the time passed interval', async () => {
- const checkData = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(''))
- await counter.mock.performUpkeep.withArgs(checkData).revertsWithReason('Time interval not met')
- await expect(counter.performUpkeep(checkData)).to.be.revertedWith('Time interval not met')
- })
-
- it('should be able to call performUpkeep after time passes', async () => {
- await counter.mock.counter.returns(1)
- const startingCount = await counter.counter()
- const checkData = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(''))
- await counter.mock.interval.returns(0)
- const interval = await counter.interval()
- await network.provider.send('evm_increaseTime', [interval.toNumber() + 1])
- await network.provider.send('evm_mine')
- await counter.mock.performUpkeep.withArgs(checkData).returns()
- await counter.performUpkeep(checkData)
- await counter.mock.counter.returns(2)
- assert.equal(parseInt(startingCount) + 1, (await counter.counter()).toNumber())
- })
- })
diff --git a/packages/oracles-starter-kit/test/unit/PriceConsumerV3_unit_test.js b/packages/oracles-starter-kit/test/unit/PriceConsumerV3_unit_test.js
deleted file mode 100755
index 0e61b2f..0000000
--- a/packages/oracles-starter-kit/test/unit/PriceConsumerV3_unit_test.js
+++ /dev/null
@@ -1,39 +0,0 @@
-const { assert } = require('chai')
-const { network, waffle } = require('hardhat')
-const { developmentChains } = require('../../helper-hardhat-config')
-const { deployMockContract, provider } = waffle
-
-!developmentChains.includes(network.name)
- ? describe.skip
- : describe('Unit Tests - PriceConsumer', async function () {
- // Price Feed Address, values can be obtained at https://docs.chain.link/docs/reference-contracts
- let priceConsumerV3, mockV3Aggregator
-
- beforeEach(async () => {
- const [deployerOfContract] = provider.getWallets()
- // deploy the contract to Mock
- const PriceConsumerV3ABI = require('../../artifacts/contracts/PriceConsumerV3.sol/PriceConsumerV3.json')
- priceConsumerV3 = await deployMockContract(deployerOfContract, PriceConsumerV3ABI.abi)
-
- const MockV3AggregatorABI = require('../../artifacts/@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol/MockV3Aggregator.json')
- mockV3Aggregator = await deployMockContract(deployerOfContract, MockV3AggregatorABI.abi)
- })
-
- describe('constructor', () => {
- it('sets the aggregator addresses correctly', async () => {
- await priceConsumerV3.mock.getPriceFeed.returns(mockV3Aggregator.address)
- const response = await priceConsumerV3.getPriceFeed()
- assert.equal(response, mockV3Aggregator.address)
- })
- })
-
- describe('getLatestPrice', () => {
- it('should return the same value as the mock', async () => {
- await priceConsumerV3.mock.getLatestPrice.returns(123)
- await mockV3Aggregator.mock.latestRoundData.returns(1, 123, 1, 1, 1)
- const priceConsumerResult = await priceConsumerV3.getLatestPrice()
- const priceFeedResult = (await mockV3Aggregator.latestRoundData()).answer
- assert.equal(priceConsumerResult.toString(), priceFeedResult.toString())
- })
- })
- })
diff --git a/packages/oracles-starter-kit/test/unit/RandomNumberConsumerV2_unit_test.js b/packages/oracles-starter-kit/test/unit/RandomNumberConsumerV2_unit_test.js
deleted file mode 100755
index c69dbc0..0000000
--- a/packages/oracles-starter-kit/test/unit/RandomNumberConsumerV2_unit_test.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const { assert } = require('chai')
-const { network, ethers, waffle } = require('hardhat')
-const { developmentChains } = require('../../helper-hardhat-config')
-const { deployMockContract, provider } = waffle
-
-!developmentChains.includes(network.name)
- ? describe.skip
- : describe('Unit Tests - RandomNumberConsumer', async function () {
- let randomNumberConsumerV2, vrfCoordinatorV2Mock
-
- beforeEach(async () => {
- const [deployerOfContract] = provider.getWallets()
- // deploy the contract to Mock
- const VrfCoordinatorV2MockABI = require('../../artifacts/@chainlink/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol/VRFCoordinatorV2Mock.json')
- vrfCoordinatorV2Mock = await deployMockContract(deployerOfContract, VrfCoordinatorV2MockABI.abi)
-
- const RandomNumberConsumerV2ABI = require('../../artifacts/contracts/RandomNumberConsumerV2.sol/RandomNumberConsumerV2.json')
- randomNumberConsumerV2 = await deployMockContract(deployerOfContract, RandomNumberConsumerV2ABI.abi)
- })
-
- it('Should successfully request a random number and get a result', async () => {
- await randomNumberConsumerV2.mock.requestRandomWords.withArgs(2).returns()
- await randomNumberConsumerV2.mock.s_requestId.returns(123)
- await randomNumberConsumerV2.mock.s_randomWords.returns([1, 1])
- await vrfCoordinatorV2Mock.mock.fulfillRandomWords.withArgs(123, randomNumberConsumerV2.address).returns()
-
- await randomNumberConsumerV2.requestRandomWords(2)
- const requestId = await randomNumberConsumerV2.s_requestId()
-
- await vrfCoordinatorV2Mock.fulfillRandomWords(requestId, randomNumberConsumerV2.address)
- const firstRandomNumber = await randomNumberConsumerV2.s_randomWords(0)
- const secondRandomNumber = await randomNumberConsumerV2.s_randomWords(1)
-
- assert(
- firstRandomNumber.gt(ethers.constants.Zero),
- 'First random number is greather than zero'
- )
-
- assert(
- secondRandomNumber.gt(ethers.constants.Zero),
- 'Second random number is greather than zero'
- )
- })
-
- it('Should successfully fire event on callback', async function () {
- randomNumberConsumerV2.once = (a, b) => {
- b()
- }
- await randomNumberConsumerV2.mock.s_randomWords.returns([1, 1])
- await randomNumberConsumerV2.mock.requestRandomWords.withArgs(2).returns()
- await randomNumberConsumerV2.mock.s_requestId.returns(123)
-
- await randomNumberConsumerV2.requestRandomWords(2)
- const requestId = await randomNumberConsumerV2.s_requestId()
- vrfCoordinatorV2Mock.fulfillRandomWords(requestId, randomNumberConsumerV2.address)
-
- await new Promise(async (resolve, reject) => {
- randomNumberConsumerV2.once('ReturnedRandomness', async () => {
- console.log('ReturnedRandomness event fired!')
- const firstRandomNumber = await randomNumberConsumerV2.s_randomWords(0)
- const secondRandomNumber = await randomNumberConsumerV2.s_randomWords(1)
- // assert throws an error if it fails, so we need to wrap
- // it in a try/catch so that the promise returns event
- // if it fails.
- try {
- assert(firstRandomNumber.gt(ethers.constants.Zero))
- assert(secondRandomNumber.gt(ethers.constants.Zero))
- resolve()
- } catch (e) {
- reject(e)
- }
- })
- })
- })
- })
diff --git a/packages/oracles-starter-kit/test/unit/WitnetPriceFeed_unit_test.js b/packages/oracles-starter-kit/test/unit/WitnetPriceFeed_unit_test.js
index 5c8fdd0..9eac5fb 100644
--- a/packages/oracles-starter-kit/test/unit/WitnetPriceFeed_unit_test.js
+++ b/packages/oracles-starter-kit/test/unit/WitnetPriceFeed_unit_test.js
@@ -9,7 +9,7 @@ const { deployMockContract, provider } = waffle
// Price Feed Address, values can be obtained at https://docs.witnet.io/smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds
let witnetPriceFeed
- this.beforeEach(async () => {
+ beforeEach(async () => {
const [deployerOfContract] = provider.getWallets()
// deploy the contract to Mock
const WitnetPriceFeedABI = require('../../artifacts/contracts/WitnetPriceFeed.sol/WitnetPriceFeed.json')
@@ -24,4 +24,4 @@ const { deployMockContract, provider } = waffle
assert.equal(priceConsumerResult.toString(), '10,10')
})
})
- })
+ })
\ No newline at end of file
diff --git a/packages/oracles-starter-kit/test/unit/WinetRandom_unit_test.js b/packages/oracles-starter-kit/test/unit/WitnetRandom_unit_test.js
similarity index 60%
rename from packages/oracles-starter-kit/test/unit/WinetRandom_unit_test.js
rename to packages/oracles-starter-kit/test/unit/WitnetRandom_unit_test.js
index 9948f82..157c26d 100644
--- a/packages/oracles-starter-kit/test/unit/WinetRandom_unit_test.js
+++ b/packages/oracles-starter-kit/test/unit/WitnetRandom_unit_test.js
@@ -1,22 +1,25 @@
const { assert } = require('chai')
-const { network, ethers } = require('hardhat')
+const { network, ethers, waffle } = require('hardhat')
const { developmentChains } = require('../../helper-hardhat-config')
+const { deployMockContract, provider } = waffle
!developmentChains.includes(network.name)
? describe.skip
- : describe('WitnetRandom Unit Tests', async function () {
+ : describe('Unit Tests - WitnetRandom', async function () {
let witnetRandomContract
beforeEach(async () => {
- await deployments.fixture(['mocks', 'witnet-random'])
- witnetRandomContract = await ethers.getContract('WitnetRandom')
+ const [deployerOfContract] = provider.getWallets()
+ // deploy the contract to Mock
+ const WitnetRandomABI = require('../../artifacts/contracts/WitnetRandom.sol/WitnetRandom.json')
+ witnetRandomContract = await deployMockContract(deployerOfContract, WitnetRandomABI.abi)
})
it('Should successfully request a random number', async () => {
- await witnetRandomContract.mock.requestRandomness.withArgs({ value: '1000000000000000000' }).returns()
+ await witnetRandomContract.mock.requestRandomness.returns()
await witnetRandomContract.mock.latestRandomizingBlock.returns(123)
- await witnetRandomContract.requestRandomness({ value: '1000000000000000000' })
+ await witnetRandomContract.requestRandomness()
const latestRandomizingBlock = await witnetRandomContract.latestRandomizingBlock()
@@ -27,11 +30,11 @@ const { developmentChains } = require('../../helper-hardhat-config')
})
it('Should successfully fetch a random number', async () => {
- await witnetRandomContract.mock.requestRandomness.withArgs({ value: '1000000000000000000' }).returns()
+ await witnetRandomContract.mock.requestRandomness.returns()
await witnetRandomContract.mock.fetchRandomNumber.returns()
await witnetRandomContract.mock.randomness.returns(123)
- await witnetRandomContract.requestRandomness({ value: '1000000000000000000' })
+ await witnetRandomContract.requestRandomness()
await witnetRandomContract.fetchRandomNumber()
@@ -40,4 +43,4 @@ const { developmentChains } = require('../../helper-hardhat-config')
assert.typeOf(randomNumber, 'number')
assert.isAtLeast(randomNumber, 0, 'random number is greater than or equal zero')
})
- })
+ })
\ No newline at end of file