Skip to content

Commit

Permalink
Merge pull request #20 from alephium/update-call-oracle-example
Browse files Browse the repository at this point in the history
Update the DIA oracle interface
  • Loading branch information
polarker authored Aug 13, 2024
2 parents 0dbd5eb + a531aad commit 3cd8f06
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions call-oracle/.project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"fullNodeVersion": "v3.3.1",
"fullNodeVersion": "v3.5.0",
"compilerOptionsUsed": {
"ignoreUnusedConstantsWarnings": false,
"ignoreUnusedVariablesWarnings": false,
Expand All @@ -9,23 +9,23 @@
"ignoreCheckExternalCallerWarnings": false
},
"infos": {
"IOracle": {
"DIAOracleValue": {
"sourceFile": "price_fetcher.ral",
"sourceCodeHash": "2d69637edba7d73038d6c408b7a2be3f72554193c6d915f532c1822c1e00cea2",
"sourceCodeHash": "0b4cfa86cb15cee0dbfb5d7f31800b82025f6b44aea7439558d6912f2bb84bc3",
"bytecodeDebugPatch": "",
"codeHashDebug": "",
"warnings": []
},
"OracleValue": {
"IDIAOracle": {
"sourceFile": "price_fetcher.ral",
"sourceCodeHash": "2d69637edba7d73038d6c408b7a2be3f72554193c6d915f532c1822c1e00cea2",
"sourceCodeHash": "0b4cfa86cb15cee0dbfb5d7f31800b82025f6b44aea7439558d6912f2bb84bc3",
"bytecodeDebugPatch": "",
"codeHashDebug": "",
"warnings": []
},
"PriceFetcher": {
"sourceFile": "price_fetcher.ral",
"sourceCodeHash": "2d69637edba7d73038d6c408b7a2be3f72554193c6d915f532c1822c1e00cea2",
"sourceCodeHash": "0b4cfa86cb15cee0dbfb5d7f31800b82025f6b44aea7439558d6912f2bb84bc3",
"bytecodeDebugPatch": "",
"codeHashDebug": "234c356f92e0e441323a14f31234857df46285aba20dc9423bccba90b0f3714e",
"warnings": []
Expand Down
4 changes: 2 additions & 2 deletions call-oracle/artifacts/PriceFetcher.ral.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v3.3.1",
"version": "v3.3.0",
"name": "PriceFetcher",
"bytecode": "060140910100000a00402ed3948fae9514074254432f5553440d0ece00d4a0e6c231170117001600a10014074554482f5553440d0ece00d4a0e6c231170317021602a1011408555344432f5553440d0ece00d4a0e6c231170517041604a1021408414c50482f5553440d0ece00d4a0e6c231170717061606a10314084159494e2f5553440d0ece00d4a0e6c231170917081608a104",
"codeHash": "234c356f92e0e441323a14f31234857df46285aba20dc9423bccba90b0f3714e",
Expand All @@ -13,7 +13,7 @@
"ayinPrice"
],
"types": [
"IOracle",
"IDIAOracle",
"U256",
"U256",
"U256",
Expand Down
6 changes: 3 additions & 3 deletions call-oracle/artifacts/structs.ral.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"name": "OracleValue",
"name": "DIAOracleValue",
"fieldNames": [
"value",
"timestamp"
Expand All @@ -10,8 +10,8 @@
"U256"
],
"isMutable": [
false,
false
true,
true
]
}
]
2 changes: 1 addition & 1 deletion call-oracle/artifacts/ts/PriceFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from "@alephium/web3";
import { default as PriceFetcherContractJson } from "../PriceFetcher.ral.json";
import { getContractByCodeHash } from "./contracts";
import { OracleValue, AllStructs } from "./types";
import { DIAOracleValue, AllStructs } from "./types";

// Custom types for the contract
export namespace PriceFetcherTypes {
Expand Down
2 changes: 1 addition & 1 deletion call-oracle/artifacts/ts/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import {
} from "@alephium/web3";
import { getContractByCodeHash } from "./contracts";

import { OracleValue, AllStructs } from "./types";
import { DIAOracleValue, AllStructs } from "./types";
2 changes: 1 addition & 1 deletion call-oracle/artifacts/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Address, HexString, Val, Struct } from "@alephium/web3";
import { default as allStructsJson } from "../structs.ral.json";
export const AllStructs = allStructsJson.map((json) => Struct.fromJson(json));
export interface OracleValue extends Record<string, Val> {
export interface DIAOracleValue extends Record<string, Val> {
value: bigint;
timestamp: bigint;
}
12 changes: 6 additions & 6 deletions call-oracle/contracts/price_fetcher.ral
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
struct OracleValue {
value: U256,
timestamp: U256
struct DIAOracleValue {
mut value: U256,
mut timestamp: U256
}

Interface IOracle {
pub fn getValue(key: ByteVec) -> OracleValue
Interface IDIAOracle {
pub fn getValue(key: ByteVec) -> DIAOracleValue
}

Contract PriceFetcher(
oracle: IOracle,
oracle: IDIAOracle,
mut btcPrice: U256,
mut ethPrice: U256,
mut usdcPrice: U256,
Expand Down
2 changes: 1 addition & 1 deletion call-oracle/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.3"

services:
alephium:
image: alephium/alephium:v3.3.0
image: alephium/alephium:v3.5.0
restart: "no"
ports:
- 19973:19973/tcp
Expand Down

0 comments on commit 3cd8f06

Please sign in to comment.