Hello
Can you help me please with my problem? I have an idea to index orders from the predicate order book from the chain using an indexer. We decided to use this contract without the state as a proxy
I have deployed this contract, here is the address 0x8924a38ac11879670de1d0898c373beb1e35dca974c4cab8a70819322f6bd9c4
After that, I initialized a new instance of indexer on my laptop using that command
forc index new spark_indexer --namespace compolabs
I added abi of the contract into the indexer’s root directory to be able to use ProxySendFundsToPredicateParams
This is my manifest file
And here is my src/lib.rs
file
Alright, now I want to deploy the indexer and index some data
To do that I need:
0) Switch to version 0.15.0 of indexer, I already have this versions
>>> fuelup show
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
beta-3-aarch64-apple-darwin
latest-aarch64-apple-darwin
forc-0.39-toolchain (default)
active toolchain
-----------------
forc-0.39-toolchain (default)
forc : 0.39.0
- forc-client
- forc-deploy : 0.39.0
- forc-run : 0.39.0
- forc-doc : 0.39.0
- forc-explore - not found
- forc-fmt : 0.39.0
- forc-index : 0.15.0
- forc-lsp : 0.39.0
- forc-tx : 0.39.0
- forc-wallet : 0.2.2
fuel-core : 0.17.11
fuel-indexer : 0.15.0
fuels versions
---------------
forc : 0.39
1) Run Postgres
docker run -d -p 5432:5432 --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword postgres
2) Start my service (connected to beta-3)
fuel-indexer run --run-migrations --fuel-node-host beta-3.fuel.network --fuel-node-port 80 --postgres-host 127.0.0.1 --postgres-port 5432 --postgres-password mysecretpassword --postgres-user postgres
3) Deploy your indexer
cd /path/to/my-indexer
forc index deploy
# and maybe here I need to restart fuel-indexer
So, after all the previous steps I tried to run two different functions in lib.rs where I was logging data with BlockData
tyoes like this
fn my_cool_indexer(b: BlockData) {
Logger::info("👌 Block data from my cool indexer")
}
and where I was trying to log data with ProxySendFundsToPredicateParams
type
fn compolabs_handler(params: ProxySendFundsToPredicateParams) {
Logger::info("Processing a block. (>'.')>");
let p = Params {
id: 1,
predicate_root: params.predicate_root,
asset0: params.asset_0,
asset1: params.asset_1,
maker: params.maker,
min_fulfill_amount0: params.min_fulfill_amount_0,
price: params.price,
asset0_decimals: params.asset_0_decimals.into(),
asset1_decimals: params.asset_1_decimals.into(),
price_decimals: params.price_decimals.into(),
};
// Logger::info("params = {p}");
p.save();
}
For some reason logs in compolabs_handler
function doesn’t give any logs even when making the function call of the contract.
Please help me to understand how it works and what is the difference in compolabs_handler
and my_cool_indexer
implementations.