ape icon indicating copy to clipboard operation
ape copied to clipboard

Add fee token information to Ecosystem API

Open antazoey opened this issue 3 years ago • 5 comments

Overview

It would be helpful to know information about the base fee currency token for display purposes. Let's say I am building a display app / plugin using ape I want to show balances of accounts. Right now, hard to know what "balance" means (from an abstract perspective). Also want the correct symbol when it is not paid in ETH.

Specification

class FeeTokenAPI:
   symbol: str
   decimals: int
   name: str

class EcosystemAPI:
   fee_token: Optional[FeeTokenAPI] = None

optional in case it is some alpha chain with no fees yet.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

antazoey avatar Jul 09 '22 17:07 antazoey

maybe it should be called native_token

banteg avatar Jul 10 '22 17:07 banteg

maybe it should be called native_token

It is not always native though. In the case of Starknet, it is an ERC20 at the moment

antazoey avatar Jul 10 '22 17:07 antazoey

maybe it should be called native_token

It could be fee_token: Optional[AddressType] = None where None means "use native Ether-like balances", and having one means that it should download and reference the contract address for balance information

fubuloubu avatar Jul 12 '22 14:07 fubuloubu

It could be fee_token: Optional[AddressType] = None where None means "use native Ether-like balances"

What if the native token is not Ether like?

antazoey avatar Jul 18 '22 20:07 antazoey

It could be fee_token: Optional[AddressType] = None where None means "use native Ether-like balances"

What if the native token is not Ether like?

I would say this semantic would mean "fee token is an ERC-like token" at a specific address, or if it is blank it means "the fee token is the native token, using whatever API the chain has natively for working with it's native tokens"

fubuloubu avatar Jul 19 '22 20:07 fubuloubu

Even if it is a native token, how can I know how many decimals it uses? Like say I am building a command that outputs balances in a nicer way, and all I have is a EcosystemAPI, how do I know the symbol and decimal amount?

antazoey avatar Mar 17 '23 14:03 antazoey

Even if it is a native token, how can I know how many decimals it uses? Like say I am building a command that outputs balances in a nicer way, and all I have is a EcosystemAPI, how do I know the symbol and decimal amount?

This might be something ecosystem-specific. For example, I built this converter into ape-ethereum which converts the different ether unit values: https://github.com/ApeWorX/ape/blob/main/src/ape_ethereum/_converters.py

fubuloubu avatar Mar 17 '23 15:03 fubuloubu

this got done!

antazoey avatar Oct 20 '23 14:10 antazoey