How to properly read chainlink data feed on Starknet

95 Views Asked by At

On Starknet(testnet), I'd like to read current price of ETH/USD via another contract. However, when calling my contract with starknet cli to see if I can fetch the price, i get following error:

Error message: SimpleReadAccessController: address does not have access

The function I'm calling looks like this:

@view
func chainlink_current_price{syscall_ptr: felt*, range_check_ptr}(token_address: felt) -> (price: felt) {
    alloc_locals;

    with_attr error_message("Failed when getting current price from Chainlink Oracle") {
        let (current_round) = IChainlinkOracle.latest_round_data(token_address);
    }

   return (current_round.answer,);
}

The cli command I used is following:


 ->  starknet call --address $ADDR --function chainlink_current_price --abi ./build/contract_abi.json --input 0x4cbab9f923b368ec7b0551c107e650ad790170851a4daa4ed780c636c6999de

Is there a possibility of obtaining the access?

0

There are 0 best solutions below