Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the DIA oracle interface #20

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading