Upd README + changes to Pyteal for calling from deployer

This commit is contained in:
Hernán Di Pietro 2021-11-05 18:06:51 -03:00
parent d9766f6585
commit 1a7343b50a
3 changed files with 53 additions and 5 deletions

View File

@ -1,5 +1,8 @@
# Pricecaster Service
## Introduction
This service consumes prices from "price fetchers" and feeds blockchain publishers. There are two basic flows implemented:
* A basic Algorand publisher class with a TEAL program for messages containing signed price data. The program code validates signature and message validity, and if successful, subsequently stores the price information in the global application information for other contracts to retrieve. For the description of the data format used, see below.
@ -161,9 +164,30 @@ The exponent is stored as a byte array containing a signed, two-complement 64-bi
const val = bufExp.readBigInt64BE()
```
## Installation
Prepare all Node packages with:
```
npm install
```
## Deployment of Applications
Use the deployment tools in `tools` subdirectory.
* To deploy the proof-of-concept "Pricekeeper" system, use the `deploy` tool with proper arguments, and later point the settings file to the deployed Appid.
* To deploy the VAA processor to use with Wormhole, make sure you have Python environment running (preferably >=3.7.0), and `pyteal` installed with `pip3`.
## Backend Configuration
The backend will read configuration from a `settings.ts` file pointed by the `PRICECASTER_SETTINGS` environment variable.
The backend will read configuration from a `settings.ts` file pointed by the `PRICECASTER_SETTINGS` environment variable.
## Running the system
Check the `package.json` file for `npm run tart-xxx` automated commands.
## Tests

View File

@ -241,12 +241,24 @@ def clear_state_program():
if __name__ == "__main__":
with open("teal/wormhole/build/vaa-processor-approval.teal", "w") as f:
approval_outfile = "teal/wormhole/build/vaa-processor-approval.teal"
clear_state_outfile = "teal/wormhole/build/vaa-processor-clear.teal"
print("VAA Processor Program, (c) 2021-22 Randlabs Inc. ")
print("Compiling approval program...")
with open(approval_outfile, "w") as f:
compiled = compileTeal(vaa_processor_program(),
mode=Mode.Application, version=5)
f.write(compiled)
with open("teal/wormhole/build/vaa-processor-clear.teal", "w") as f:
print("Written to " + approval_outfile)
print("Compiling clear state program...")
with open(clear_state_outfile, "w") as f:
compiled = compileTeal(clear_state_program(),
mode=Mode.Application, version=5)
f.write(compiled)
print("Written to " + clear_state_outfile)

View File

@ -20,6 +20,8 @@ from pyteal.compiler import *
from pyteal.ir import *
from globals import get_sig_count_in_step, get_group_size
import sys
@Subroutine(TealType.uint64)
def sig_check(signatures, digest, keys):
@ -79,7 +81,17 @@ def vaa_verify_program(vaa_processor_app_id):
if __name__ == "__main__":
with open("teal/wormhole/build/vaa-verify.teal", "w") as f:
print("VAA Verify Stateless Program, (c) 2021-22 Randlabs Inc. ")
print("Compiling...")
if len(sys.argv) != 2:
print ("No appid argument provided")
exit(1)
outfile = "teal/wormhole/build/vaa-verify.teal"
with open(outfile, "w") as f:
compiled = compileTeal(vaa_verify_program(
333), mode=Mode.Signature, version=5)
int(sys.argv[1])), mode=Mode.Signature, version=5)
f.write(compiled)
print("Written to " + outfile)