Skip to content

Commit

Permalink
Add oracle approval script
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmarshall committed Sep 5, 2024
1 parent f102df3 commit 14f1bdb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pondo-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"watchDevnet": "tmux attach-session -t devnet",
"cleanDevnet": "rm -rf .history-* .ledger-* .logs-* .current-proposal-cache-*",
"stopDevnetAtHeight": "./utils/stop-devnet-at-height.sh",
"buildLedger": "node ./dist/buildLedger.js"
"buildLedger": "node ./dist/buildLedger.js",
"runOracleApproval": "node ./dist/runOracleApproval.js"
},
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions pondo-bot/src/tests/scripts/runOracleApproval.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as Aleo from '@demox-labs/aleo-sdk';
import { NETWORK } from '../../constants';

const [privateKey, requestId, programAddress] = process.argv.slice(2);

const addressHash = Aleo.Plaintext.fromString(NETWORK!, programAddress).hashBhp256();
const plaintextString = `{
arg: ${addressHash},
op_type: 4u8,
request_id: ${requestId}u64
}`;
const hashedField = Aleo.Plaintext.fromString(NETWORK!, plaintextString).hashBhp256();

// Sign the hash with the oracle private keys
const signature0 = Aleo.Signature.sign_plaintext(NETWORK!, privateKey, hashedField).to_string();
2 changes: 2 additions & 0 deletions pondo-bot/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ const testConfig = {
path.resolve(__dirname, "src") + "/tests/scripts/getTokenOwnerHash.ts",
runTokenActions:
path.resolve(__dirname, "src") + "/tests/scripts/runTokenActions.ts",
runOracleApproval:
path.resolve(__dirname, "src") + "/tests/scripts/runOracleApproval.ts",
testProgramCalls:
path.resolve(__dirname, "src") + "/tests/scripts/testProgramCalls.ts",
estimateFees:
Expand Down

0 comments on commit 14f1bdb

Please sign in to comment.