Skip to content

Commit

Permalink
Merge pull request #19 from Phala-Network/update-repo
Browse files Browse the repository at this point in the history
Update with latest variables, deploy output and remove patch for viem
  • Loading branch information
HashWarlock committed Jan 30, 2024
2 parents b0418c8 + 0971e14 commit 202c286
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
11 changes: 10 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ POLYGON_CONSUMER_CONTRACT_ADDRESS=0xad5C96e026D4D00c9a6Fcd1AA2E4958a5155AD03
# that address should be set to `MUMBAI_CONSUMER_CONTRACT_ADDRESS` for Mumbai testnet deployment
MUMBAI_CONSUMER_CONTRACT_ADDRESS=0x5462964078808abc96f7F45Ff7f3158B819cD7E3

# *** Phat Contract Dashboard Account Options ***
# Choose 1 of the 4 to define
# AA Metamask variables are PRIVATE_KEY and MNEMONIC
# `PRIVATE_KEY` : EVM wallet private key. It always starts with `0x`. **It only works for PoC6 testnet currently.**
# `MNEMONIC` : The mnemonic (recovery phrase) for the EVM wallet private key can be specified using `EVM_MNEMONIC_ADDRESS_INDEX` to indicate the account index, if desired.
# *We DO NOT RECOMMEND the use mnemonic directly.* **It only works for PoC6 testnet currently.**
PRIVATE_KEY=
# MNEMONIC=
# EVM_MNEMONIC_ADDRESS_INDEX=
# The encypt passphrase for the exported polkadot wallet JSON file.
# Example Video: https://www.youtube.com/watch?v=z1MR48NYtYc
# If you import your polkadot-account.json file then define POLKADOT_WALLET_ACCOUNT_PASSWORD
POLKADOT_WALLET_ACCOUNT_PASSWORD=
# Else define POLKADOT_WALLET_SURI (ex. POLKADOT_WALLET_SURI=//ALICE or POLKADOT_WALLET_SURI="this is a mnemonic phrase")
POLKADOT_WALLET_SURI="raven valley laugh wait grid typical deny output discover situate bleak scare"
POLKADOT_WALLET_SURI=

# When calling the npm run update-function, ensure that you set the WORKFLOW_ID to the Phat Contract function workflow you want to update.
WORKFLOW_ID=
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ The Phat Contract Starter Kit is your one-stop solution to connect any API to yo

This starter kit empowers you to initiate the data request from the smart contract side. The request is then seamlessly sent to your script for processing. You have the liberty to call any APIs to fulfill the request and define the response data structure that will be replied to your smart contract.
## :runner: Quick Start
To kickstart your journey with the Phat Contract Starter Kit, you have 2 options:
1. Create a template from the [`phat-contract-starter-kit`](https://bit.ly/3PVlgHs) template repo. Click on the "**Use this template**" button in the top right corner of the webpage. Then skip the `npx @phala/fn@latest init example` step.
![](./assets/UseThisTemplate.png)
2. Install the `@phala/fn` CLI tool. You can do this using your node package manager (`npm`) or use node package execute (`npx`). For the purpose of this tutorial, we will be using `npx`.
To kickstart your journey with the Phat Contract Starter Kit, you will use the `@phala/fn` CLI tool.

(Option 2) Once you have the CLI tool installed, you can create your first Phala Oracle template with the following command.
Install the `@phala/fn` CLI tool. You can do this using your node package manager (`npm`) or use node package execute (`npx`). For the purpose of this tutorial, we will be using `npx`.

Once you have the CLI tool installed, you can create your first Phala Oracle template with the following command.
```bash
# Skip this step if chose option 1 or cloned this repo
npx @phala/fn@latest init example
Expand All @@ -26,9 +25,12 @@ npx @phala/fn@latest init example
```shell
npx @phala/fn@latest init example
? Please select one of the templates for your "example" project: (Use arrow keys)
❯ phat-contract-starter-kit. The Phat Contract Starter Kit
lensapi-oracle-consumer-contract. Polygon Consumer Contract for LensAPI Oracle
? Please select one of the templates for your "example" project:
❯ phat-contract-starter-kit: Send data from any API to your smart contract with Javascript.
lensapi-oracle-consumer-contract: Send data from Lens API to your smart contract to empower your Web3 Social dApp.
vrf-oracle: TEE-guarded Verifiable Random Function template to bring randomness to your smart contract.
airstack-phat-contract: Request an account’s data from Airstack’s API to compute trust score and send to your Web3 dApp on-chain.
thegraph-phat-contract: Connect your subgraphs from The Graph to your on-chain dApps via Phat Contract.
```
:stop_sign: **Not so fast!** What is it exactly that we are building? :stop_sign:
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"test-deploy-function": "phat-fn upload --coreSettings=https://api-v2-mumbai-live.lens.dev/",
"main-deploy-function": "phat-fn upload --mode=production --coreSettings=https://api-v2.lens.dev/",
"test-update-function": "phat-fn update",
"main-update-function": "phat-fn update --mode=production",
"postinstall": "patch-package"
"main-update-function": "phat-fn update --mode=production"
},
"devDependencies": {
"@ethersproject/abi": "^5.4.7",
Expand Down Expand Up @@ -61,7 +60,6 @@
"@phala/solidity": "^0.0.4",
"dedent": "^1.5.1",
"dotenv": "^16.0.3",
"patch-package": "^8.0.0",
"viem": "^1.19.3"
}
}
17 changes: 0 additions & 17 deletions patches/viem+1.19.15.patch

This file was deleted.

14 changes: 9 additions & 5 deletions scripts/mumbai/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ async function main() {
const consumer = await OracleConsumerContract.deploy(attestor);
await consumer.deployed();
const finalMessage = dedent`
🎉 Your Consumer Contract has been deployed, check it out here: https://mumbai.polygonscan.com/address/${consumer.address}
You also need to set up the consumer contract address in your .env file:
MUMBAI_CONSUMER_CONTRACT_ADDRESS=${consumer.address}
🎉 Your Consumer Contract has been deployed successfully 🎉
address ${consumer.address}
Check it out here: https://mumbai.polygonscan.com/address/${consumer.address}
You can continue deploying the default Phat Contract with the following command:
npx @phala/fn upload -b --mode dev --consumerAddress=${consumer.address} --coreSettings=https://api-v2-mumbai-live.lens.dev/
`
console.log(`\n${finalMessage}\n`);

Expand Down
14 changes: 9 additions & 5 deletions scripts/polygon/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ async function main() {
const consumer = await OracleConsumerContract.deploy(attestor);
await consumer.deployed();
const finalMessage = dedent`
🎉 Your Consumer Contract has been deployed, check it out here: https://polygonscan.com/address/${consumer.address}
You also need to set up the consumer contract address in your .env file:
POLYGON_CONSUMER_CONTRACT_ADDRESS=${consumer.address}
🎉 Your Consumer Contract has been deployed successfully 🎉
address ${consumer.address}
Check it out here: https://polygonscan.com/address/${consumer.address}
You can continue deploying the default Phat Contract with the following command:
npx @phala/fn upload -b --mode=production --consumerAddress=${consumer.address} --coreSettings=https://api-v2.lens.dev/
`
console.log(`\n${finalMessage}\n`);

Expand Down

0 comments on commit 202c286

Please sign in to comment.