beamer-bridge/beamer

token_addresses should be immutable in desired state file

Closed this issue · 0 comments

fredo commented

The token_addresses mapping from symbol -> address is auto generated by on-chain data (namely token.symbol()). These mappings are used to convert the key in tokens in the request manager representation from a human readable friendly symbol to the respective address on the chain.

However, since the mapping is auto-generated (similar to checksum and block number) it should not be subject to be changed in the desired state file. In order to make it immutable, we need to do the following things.

  • ensure that token_addresses in state file and desired file are identical
  • Allow that keys in the tokens dictionary can be either symbol or address
  • During write -> If key is in token_addresses mapping then get address from there, if not check if key is address itself, if yes use that, else raise exception
  • During read, if token.symbol() is not available, skip creating an entry in token_addresses