MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / lookup_addr

Method lookup_addr

fendermint/eth/api/src/cache.rs:139–159  ·  view source on GitHub ↗

Look up the delegated address of an ID, if any.

(&self, id: &ActorID)

Source from the content-addressed store, hash-verified

137
138 /// Look up the delegated address of an ID, if any.
139 pub async fn lookup_addr(&self, id: &ActorID) -> anyhow::Result<Option<Address>> {
140 if let Some(addr) = self.get_addr(id) {
141 return Ok(Some(addr));
142 }
143
144 let res = self
145 .client
146 .actor_state(&Address::new_id(*id), FvmQueryHeight::Committed)
147 .await
148 .context("failed to lookup actor state")?;
149
150 if let Some((_, actor_state)) = res.value {
151 if let Some(addr) = actor_state.delegated_address {
152 self.set_addr(*id, addr);
153 self.set_id(addr, *id);
154 return Ok(Some(addr));
155 }
156 }
157 tracing::info!(id, height = res.height.value(), "actor not found");
158 Ok(None)
159 }
160
161 fn get_id(&self, addr: &Address) -> Option<ActorID> {
162 self.addr_to_id.get(addr)

Callers

nothing calls this directly

Calls 5

get_addrMethod · 0.80
contextMethod · 0.80
set_addrMethod · 0.80
set_idMethod · 0.80
actor_stateMethod · 0.45

Tested by

no test coverage detected