# Assigned: Chainsight BNT-1 - Asset Rating Oracle

**URL:** <https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038>\
**Category:** Bounties & RFPs\
**Created:** [September 14, 2023, 2:01pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038 "2023-09-14T14:01:31Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 15, 2023, 4:20pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/21 "2023-11-15T16:20:30Z")

</div>

@furkan @timk11 @hude  
Sorry for the delay in getting back to you. And thank you for your development with Chainsight.  
I am one of the development members of Chainsight.

Chainsight is being developed on a daily basis, and there are some major structural changes that we would like to explain.  
The latest Snapshot version of the CLI can be downloaded [here](https://github.com/horizonx-tech/chainsight-cli/releases/tag/snapshot).  
This will be updated each time changes are merged into the main branch.

Currently, the Project package structure via the CLI looks like [this sample](https://github.com/horizonx-tech/chainsight-showcase/tree/main/volatility/volatility_eth).  
The major change is that the user implementation and automatically generated code are separated into different cargo projects:

```auto

- src
  - logics ... User implementation to index/process data (the old `app.rs`)
  - bindings ... Generates interface types to use other canisters that the Component depends on.
  - accessors ... Generates functions for Lens to call other Canisters
  - canisters ... Logic is used to act as a chainsight component casniter on ICP

```

These directories and codes are automatically generated by the csx generate command based on the contents of chainsight manifest (project.yaml and components/\*.yaml).  
`src/logics` generates the implementation template only for the first time, after which the user is responsible for implementation.  
The other directories are always regenerated by the `csx generate` command and synchronized with the manifest definition.

This is the end of the development flow changes. Thereafter, modules are built, deployed, and initialized by `csx build`, `csx deploy`, and `csx exec` as before.  
The process for maintaining and running Cycle on IC has also been updated, but we will not go into that here, so please inquire again when you are ready to deploy on IC.

You may be currently facing problems with the old version, please update to the latest, and ask us if you have any questions.

Good luck with your development!

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 17, 2023, 12:57am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/22 "2023-11-17T00:57:33Z")

</div>

Hi @darroze and thanks for the info!

I downloaded the snapshot and saved the extracted `csx` file in `./.cargo/bin`, then installed it using

```auto
cargo build --bin csx
chmod a+x csx

```

Using `csx generate` I’m now getting this error:

```auto
ERRO [tcumul_28x6hr_usdceth_0_3] Failed: Generate interfaces (.did files) by: Compiling tcumul_28x6hr_usdceth_0_3_canister v0.1.0 (/home/timk/ic/csx/uniswap_edpr/src/canisters/tcumul_28x6hr_usdceth_0_3)
error: proc macro panicked
 --> canisters/tcumul_28x6hr_usdceth_0_3/src/lib.rs:1:66
  |
1 | ... ; def_snapshot_indexer_evm_canister ! ("{\"common\":{\"canister_name\":\"tcumul_28x6hr_usdceth_0_3\"},\"method_identifier\":\"observe(uint32[]):(int56[],uint160[])\",\"method_args\":[[604800,583200,561600,540000,518400,496800,475200,453600,432000,410400,388800,367200,345600,324000,302400,280800,259200,237600,216000,194400,172800,151200,129600,108000,86400,64800,43200,21600,0]],\"abi_file_path\":\"./__interfaces/UniswapV3Pool.json\"}"...
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Failed to parse method identifier: ic_solidity_bindgen::internal::Unimplemented

error: could not compile `tcumul_28x6hr_usdceth_0_3_canister` (lib test) due to previous error

```

The relevant part of the component yaml file looks like this:

```auto
datasource:
  type: contract
  location:
    id: 88e6a0c2ddd26feeb64f039a2c41296fcb3f5640
    args:
      network_id: 1
      rpc_url: https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}
  method:
    identifier: observe(uint32[]):(int56[],uint160[])
    interface: UniswapV3Pool.json
    args: [[604800, 583200, 561600, 540000, 518400, 496800, 475200, 453600, 432000, 410400, 388800, 367200, 345600, 324000, 302400, 280800, 259200, 237600, 216000, 194400, 172800, 151200, 129600, 108000, 86400, 64800, 43200, 21600, 0]]

```

`UniswapV3Pool.json` in my project is copied from the Contract ABI on [this page](https://etherscan.io/address/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640#code) and begins like this:

```auto
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},
...

```

What could be going wrong here?

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 17, 2023, 8:13am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/23 "2023-11-17T08:13:49Z")

</div>

@timk11 Thank you for the update!  
Could you share the entire Chainsight PJ code with us so we can investigate while reproducing it?

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 17, 2023, 10:06am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/24 "2023-11-17T10:06:18Z")

</div>

Sure! I’ve shared the code to [GitHub - timk11/uniswap-edpr](https://github.com/timk11/uniswap-edpr).

---

<div class="post-metadata">

**Author:** ![hokosugi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hokosugi/32/7499_2.png) [@hokosugi](https://forum.dfinity.org/u/hokosugi)\
**Post date:** [November 21, 2023, 7:22am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/25 "2023-11-21T07:22:01Z")

</div>

I am getting an error in deploying  
`chainsight-management-canisters`.

```auto
make local port=8000

```

note: port=${8000} is not reflected, so I add `port := $(or $(port), $(PORT))` to the makefile and run it

Result:

```auto
Failed to invoke the package tool "vessel" "sources"

```

 ![ScShot 2023-11-21 16.05.56](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/6/6f7a5a7dd707a99082323fcec6c61422b2801288.png)

run:

```auto
cargo install vessel
cargo install sources

```

and add the following to `Cargo.toml`

> [dependencies].  
> sources = “0.1.0”  
> Vessel = “0.0.1”

Run `make local port=8000` again.  
Result:

```auto
This virtual manifest specifies a [dependencies] section, which is not allowed.

```

 ![ScShot 2023-11-21 16.19.59](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/f/fd69909b0b0c5c151b0971b160fb11ea32033a0d.png)

How can I resolve this error? Please take into account that I am not at all familiar with this and was asking Chat GPT.

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 21, 2023, 8:06am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/26 "2023-11-21T08:06:27Z")

</div>

Hi @hokosugi, thanks for working on Chainsight!  
You can get vessel, package manager of Motoko, [from here](https://github.com/dfinity/vessel).

By the way, you can start developing chainsight components without management canisters. [Here is getting started](https://github.com/horizonx-tech/chainsight-cli/blob/main/docs/index.md).

---

<div class="post-metadata">

**Author:** ![hokosugi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hokosugi/32/7499_2.png) [@hokosugi](https://forum.dfinity.org/u/hokosugi)\
**Post date:** [November 21, 2023, 10:15am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/27 "2023-11-21T10:15:01Z")

</div>

Does this mean that it is possible to skip Management canister deployment and deploy indexer with just csx CLI commands?

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 21, 2023, 10:37am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/28 "2023-11-21T10:37:38Z")

</div>

Yes, there is no need to care about management canisters when deploying on IC.  
Our CLI/SDK uses the management canisters we have prepared.

Developers use management canisters only when they want to deploy and test in a local environment.  
If you have already developed components and want to run it in a local environment, we will guide you through the details!

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 22, 2023, 9:28am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/29 "2023-11-22T09:28:57Z")

</div>

Hey there @darroze . Did you get a chance to have a look at the code I linked to?

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 22, 2023, 11:59am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/30 "2023-11-22T11:59:10Z")

</div>

Hi @timk11 .  
Thanks to you, we have identified the problem and are currently working on a fix!

Therer are some EVM types that our SDK not supported yet.  
We will get back to you as soon as your manifest is supported!

---

<div class="post-metadata">

**Author:** ![hokosugi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hokosugi/32/7499_2.png) [@hokosugi](https://forum.dfinity.org/u/hokosugi)\
**Post date:** [November 22, 2023, 10:12pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/31 "2023-11-22T22:12:12Z")

</div>

Command, `make local port=8000` with the following error.

```auto
Stderr:.
/Users/myname/dfinity/chainsight-management-canisters/src/canisters/registry/Registry.mo:7.1-7.37: import error [M0010], package "candb".

/Users/myname/dfinity/chainsight-management-canisters/src/canisters/registry/Registry.mo:21.1-21.46: import error [M0010], package " stable-buffer" not define

```

Registry.mo

 ![ScShot 2023-11-23 6.57.34](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/4/4442f878921281904d8ca46bdcfea5b3054644b9.png)

[There are six different ways to import](https://internetcomputer.org/docs/current/motoko/main/modules-and-imports)

- Importing from the Motoko base library
- Importing local files
- Importing from another package or directory
- Importing packages from a package manager
- Importing actor classes
- Importing from another canister smart contract

A note like "import CanDB “mo:candb/CanDB” would be considered “Importing from another package or directory”. There is no `candb` in vessel’s library, and it seems that I need to write to dfx.json. How should I write it?

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 23, 2023, 2:01pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/32 "2023-11-23T14:01:56Z")

</div>

Hi @timk11 ,  
The EVM type issue has been resolved and your Snapshot Indexer EVM code can now be generated in the latest CLI!

However, there is an error when generating the code for Lens, and it seems that your manifest definitions are inconsistent with the latest CLI.

We have added json-schemas for component manifest so that validation will work in the code editor.  
To enable json-schema, add a line as follows.

> <https://github.com/horizonx-tech/chainsight-showcase/blob/main/price_feed/price_eth/components/chainlink_ethusd.yaml#L1>

Json-schemas are defined for each component type:

> <https://github.com/horizonx-tech/chainsight-cli/tree/main/resources/schema>
>
> //github.com/horizonx-tech/chainsight-cli/tree/main/resources/schema

Please update those and then try `csx generate`!

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 23, 2023, 10:51pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/33 "2023-11-23T22:51:00Z")

</div>

Thanks @darroze ! Glad to hear this was helpful for the improvements on your side. I’ll have a thorough look at this and push ahead with it today.

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 24, 2023, 1:12am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/34 "2023-11-24T01:12:17Z")

</div>

That all works now. The algorithm lens manifest that ultimately worked looks like this:

```auto
# yaml-language-server: $schema=https://raw.githubusercontent.com/horizonx-tech/chainsight-cli/main/resources/schema/algorithm_lens.json
version: v1
metadata:
  label: algorithm_lens_usdceth_0_3
  type: algorithm_lens
  description: ''
  tags:
  - Ethereum
  - Account
datasource:
  methods:
  - id: pool_fees_usdceth_0_3
    label: last_snapshot_value
    identifier: 'get_last_snapshot_value : () -> (text)'
  - id: tcumul_28x6hr_usdceth_0_3
    label: last_snapshot_value
    identifier: 'get_last_snapshot_value : () -> (text)'
  - id: tcumul_30_min_usdceth_0_3
    label: last_snapshot_value
    identifier: 'get_last_snapshot_value : () -> (text)'
  - id: v3pool_usdceth_0_3
    label: last_snapshot_value
    identifier: 'get_last_snapshot_value : () -> (text)'
output:
  name: EDPR
  fields:
    address: String
    current_price: f32
    range_top: f32
    range_bottom: f32
    edpr: f32
  type: struct
  type_name: null

```

I did `csx generate` and `csx build` and this was successful. I take it the next step is to modify the `lib.rs`’s in `./src/logics` and then repeat `csx build`?

---

<div class="post-metadata">

**Author:** ![darroze](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/darroze/32/12731_2.png) [@darroze](https://forum.dfinity.org/u/darroze)\
**Post date:** [November 24, 2023, 2:21am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/35 "2023-11-24T02:21:30Z")

</div>

@timk11 Great!

> I take it the next step is to modify the `lib.rs` ’s in `./src/logics` and then repeat `csx build` ?

That’s right. Now comes the time to implement your own logic.  
We’re looking forward to it!

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 27, 2023, 3:36am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/36 "2023-11-27T03:36:44Z")

</div>

Quick question - If I’ve already run `csx build` and then edit some of the Rust files, will `csx build --only-build` replace the existing wasm files with new ones? If not, how is this best done?

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 27, 2023, 10:30am UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/37 "2023-11-27T10:30:33Z")

</div>

This is weird, and not something I’ve seen before today. I don’t know if it’s a csx problem or something to do with the OS or the CLI. I’m using WSL. Here’s what it looks like:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/b/bc8b4fc3298076b4512552b73cb14c9f4fcf696a.png)

So I’m trying the same command (`csx build --only-build` abbreviated as `!!`) every time but each time the output stops somewhere different. In the first example it stopped in the middle of a line in a warning. Lots of camel case warnings, which I’m not too bothered about. The irritating thing is that when the output progresses far enough there are error messages that I’m trying to solve, but most of the time the output doesn’t even get that far. I’ve tried restarting a couple of times - still no different. I can’t find this problem described anywhere online.

Any clues?

---

<div class="post-metadata">

**Author:** ![megared](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/megared/32/11028_2.png) [@megared](https://forum.dfinity.org/u/megared)\
**Post date:** [November 27, 2023, 12:32pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/38 "2023-11-27T12:32:53Z")

</div>

> [@timk11](#):
>
> Quick question - If I’ve already run `csx build` and then edit some of the Rust files, will `csx build --only-build` replace the existing wasm files with new ones? If not, how is this best done?

You are right.  
Your logic will be listed in the logics directory, but to keep it and build again, use build -only-build.  
Normally, generate → (write your logic in logics dir) → build will do the trick.

---

<div class="post-metadata">

**Author:** ![megared](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/megared/32/11028_2.png) [@megared](https://forum.dfinity.org/u/megared)\
**Post date:** [November 27, 2023, 12:34pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/39 "2023-11-27T12:34:52Z")

</div>

This is the first time I saw this too. Also I don’t know as I usually use mac. I will ask the team.  
By the way, does csx generate or csx build (without option) work?

---

<div class="post-metadata">

**Author:** ![timk11](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timk11/32/9489_2.png) [@timk11](https://forum.dfinity.org/u/timk11)\
**Post date:** [November 27, 2023, 1:23pm UTC](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038/40 "2023-11-27T13:23:34Z")

</div>

Not sure. I didn’t try that because I didn’t want to lose my logics.

[Previous page](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038.md?page=1)

[Next page](https://forum.dfinity.org/t/assigned-chainsight-bnt-1-asset-rating-oracle/23038.md?page=3)
