Skip to content

Commit

Permalink
Deployment of Request-Response & VRF for closed alpha release (#244)
Browse files Browse the repository at this point in the history
* feat: Birth of Orakl Network

* feat: Unify VRF & RR initial settings for Baobab

* feat: Update Baobab's default reporter addresses

* feat: localhost deployment config update

* feat: Update VRF deployment

* feat: Use the latest icn-contracts

* feat: Update Request-Response deployment

* feat: Rename packages (remove -CIC) & `icn` -> `orakl`

* feat: Bump up @bisonai/orakl-contracts to 0.4.4

* feat: Prepare GA pipeline for public npm publishing

* fix: ICN -> Orakl

* fix: Uniform apostrophes in GA
  • Loading branch information
martinkersner authored Feb 8, 2023
1 parent 7ea0125 commit ae53cbd
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 44 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/contracts.publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: "18.12"
registry-url: "https://npm.pkg.github.com"
scope: "@bisonai-cic"
registry-url: "https://registry.npmjs.org"
scope: "@bisonai"
always-auth: true
- run: yarn
working-directory: ./contracts
Expand All @@ -25,7 +25,7 @@ jobs:
working-directory: ./contracts
- run: yarn build
working-directory: ./contracts
- run: yarn publish --new-version ${{ github.event.release.tag_name }}
- run: yarn publish --new-version ${{ github.event.release.tag_name }} --access public
working-directory: ./contracts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ICN
# Orakl Network

This repository is split to [on-chain](contracts) and [off-chain](core) oracle implementation.
To read about how to use oracle, go to [docs](docs).
24 changes: 24 additions & 0 deletions contracts/config/baobab/request-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"maxGasLimit": 1000000,
"gasAfterPaymentCalculation": 0,
"feeConfig": {
"fulfillmentFlatFeeKlayPPMTier1": 0,
"fulfillmentFlatFeeKlayPPMTier2": 0,
"fulfillmentFlatFeeKlayPPMTier3": 0,
"fulfillmentFlatFeeKlayPPMTier4": 0,
"fulfillmentFlatFeeKlayPPMTier5": 0,
"reqsForTier2": 0,
"reqsForTier3": 0,
"reqsForTier4": 0,
"reqsForTier5": 0
},
"directPaymentConfig": {
"fulfillmentFee": 0,
"baseFee": 0
},
"oracle": [
{
"address": "0x46B853723c002Ff5c1D0F4a0E6671F31B2C2A480"
}
]
}
10 changes: 5 additions & 5 deletions contracts/config/baobab/vrf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"maxGasLimit": 2500000,
"gasAfterPaymentCalculation": 33285,
"maxGasLimit": 1000000,
"gasAfterPaymentCalculation": 0,
"feeConfig": {
"fulfillmentFlatFeeKlayPPMTier1": 0,
"fulfillmentFlatFeeKlayPPMTier2": 0,
Expand All @@ -13,12 +13,12 @@
"reqsForTier5": 0
},
"directPaymentConfig": {
"fulfillmentFee": "0",
"baseFee": "0"
"fulfillmentFee": 0,
"baseFee": 0
},
"oracle": [
{
"address": "0xdD2FD4581271e230360230F9337D5c0430Bf44C0",
"address": "0x46B853723c002Ff5c1D0F4a0E6671F31B2C2A480",
"publicProvingKey": [
"95162740466861161360090244754314042169116280320223422208903791243647772670481",
"53113177277038648369733569993581365384831203706597936686768754351087979105423"
Expand Down
2 changes: 1 addition & 1 deletion contracts/config/localhost/request-response.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"maxGasLimit": 1000000,
"gasAfterPaymentCalculation": 1000,
"gasAfterPaymentCalculation": 90692,
"feeConfig": {
"fulfillmentFlatFeeKlayPPMTier1": 0,
"fulfillmentFlatFeeKlayPPMTier2": 0,
Expand Down
4 changes: 2 additions & 2 deletions contracts/config/localhost/vrf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"maxGasLimit": 2500000,
"gasAfterPaymentCalculation": 33285,
"maxGasLimit": 1000000,
"gasAfterPaymentCalculation": 90692,
"feeConfig": {
"fulfillmentFlatFeeKlayPPMTier1": 0,
"fulfillmentFlatFeeKlayPPMTier2": 0,
Expand Down
29 changes: 11 additions & 18 deletions contracts/deploy/1-RequestResponseCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

console.log('1-RequestResponseCoordinator.ts')

const requestResponseConfig: IRequestResponseConfig = await loadJson(
const config: IRequestResponseConfig = await loadJson(
`config/${network.name}/request-response.json`
)

if (network.name == 'baobab') {
console.log('Skipping')
return
}

const prepayment = await ethers.getContract('Prepayment')

const requestResponseDeployment = await deploy('RequestResponseCoordinator', {
Expand All @@ -34,27 +29,23 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Register oracle
console.log('Register oracle')
for (const oracle of requestResponseConfig.oracle) {
for (const oracle of config.oracle) {
const tx = await (await requestResponseCoordinator.registerOracle(oracle.address)).wait()
console.log('oracle', tx.events[0].args.oracle)
}

// Configure Request-Resopnse coordinator
// Configure Request-Response coordinator
console.log('Configure Request-Response coordinator')
await (
await requestResponseCoordinator.setConfig(
requestResponseConfig.maxGasLimit,
requestResponseConfig.gasAfterPaymentCalculation,
requestResponseConfig.feeConfig
config.maxGasLimit,
config.gasAfterPaymentCalculation,
config.feeConfig
)
).wait()

// Configure payment for direct Request-Response
await (
await requestResponseCoordinator.setDirectPaymentConfig(
requestResponseConfig.directPaymentConfig
)
).wait()
await (await requestResponseCoordinator.setDirectPaymentConfig(config.directPaymentConfig)).wait()

// Add RequestResponseCoordinator to Prepayment
const prepaymentDeployerSigner = await ethers.getContractAt(
Expand All @@ -64,13 +55,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)
await (await prepaymentDeployerSigner.addCoordinator(requestResponseCoordinator.address)).wait()

// Localhost deployment
if (['localhost', 'hardhat'].includes(network.name)) {
await localhostDeployment({ deploy, requestResponseCoordinator, prepayment, consumer })
await localhostDeployment({ deploy, requestResponseCoordinator, prepayment })
}
}

async function localhostDeployment(args) {
const { deploy, requestResponseCoordinator, prepayment, consumer } = args
const { consumer } = await getNamedAccounts()
const { deploy, requestResponseCoordinator, prepayment } = args

const requestResponseConsumerMockDeployment = await deploy('RequestResponseConsumerMock', {
args: [requestResponseCoordinator.address],
Expand Down
20 changes: 11 additions & 9 deletions contracts/deploy/2-VRFCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { IVrfConfig } from '../scripts/v0.1/types'
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, network } = hre
const { deploy } = deployments
const { deployer, consumer } = await getNamedAccounts()
const { deployer } = await getNamedAccounts()

console.log('2-VRFCoordinator.ts')

const vrfConfig: IVrfConfig = await loadJson(`config/${network.name}/vrf.json`)
const config: IVrfConfig = await loadJson(`config/${network.name}/vrf.json`)

const prepayment = await ethers.getContract('Prepayment')

Expand All @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Register proving key
console.log('Register proving key')
for (const oracle of vrfConfig.oracle) {
for (const oracle of config.oracle) {
const tx = await (
await vrfCoordinator.registerProvingKey(oracle.address, oracle.publicProvingKey)
).wait()
Expand All @@ -39,14 +39,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('Configure VRF coordinator')
await (
await vrfCoordinator.setConfig(
vrfConfig.maxGasLimit,
vrfConfig.gasAfterPaymentCalculation,
vrfConfig.feeConfig
config.maxGasLimit,
config.gasAfterPaymentCalculation,
config.feeConfig
)
).wait()

// Configure payment for direct VRF request
await (await vrfCoordinator.setDirectPaymentConfig(vrfConfig.directPaymentConfig)).wait()
await (await vrfCoordinator.setDirectPaymentConfig(config.directPaymentConfig)).wait()

// Add VRFCoordinator to Prepayment
const prepaymentDeployerSigner = await ethers.getContractAt(
Expand All @@ -56,13 +56,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)
await (await prepaymentDeployerSigner.addCoordinator(vrfCoordinatorDeployment.address)).wait()

// Localhost deployment
if (['localhost', 'hardhat'].includes(network.name)) {
await localhostDeployment({ deploy, vrfCoordinator, consumer, prepayment })
await localhostDeployment({ deploy, vrfCoordinator, prepayment })
}
}

async function localhostDeployment(args) {
const { deploy, vrfCoordinator, prepayment, consumer } = args
const { consumer } = await getNamedAccounts()
const { deploy, vrfCoordinator, prepayment } = args
const vrfConsumerMockDeployment = await deploy('VRFConsumerMock', {
args: [vrfCoordinator.address],
from: consumer,
Expand Down
6 changes: 3 additions & 3 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bisonai-cic/icn-contracts",
"version": "0.4.3",
"name": "@bisonai/orakl-contracts",
"version": "0.4.4",
"description": "",
"files": [
"./dist",
Expand All @@ -12,7 +12,7 @@
"exports": "./dist/typechain-types/index.js",
"types": "./dist/typechain-types/index.js",
"author": "Bisonai",
"homepage": "https://github.com/bisonai-cic/ICN#readme",
"homepage": "https://github.com/bisonai-cic/orakl#readme",
"license": "UNLICENSED",
"scripts": {
"prepare": "cd .. && husky install contracts/.husky",
Expand Down
4 changes: 2 additions & 2 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bisonai-cic/icn-core",
"name": "@bisonai/orakl-core",
"version": "0.2.0",
"type": "module",
"description": "",
Expand Down Expand Up @@ -38,7 +38,7 @@
"eslint": "DEBUG=eslint:cli-engine npx eslint 'src/**/*.ts' 'src/*.ts' 'test/*.ts'"
},
"dependencies": {
"@bisonai-cic/icn-contracts": "^0.3.0",
"@bisonai-cic/icn-contracts": "^0.4.3",
"@slack/webhook": "^6.1.0",
"axios": "^1.2.2",
"bn.js": "^5.2.1",
Expand Down

0 comments on commit ae53cbd

Please sign in to comment.