Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bank abi is different with Polaris Bank abi #4

Closed
zsystm opened this issue Feb 7, 2024 · 1 comment
Closed

Bank abi is different with Polaris Bank abi #4

zsystm opened this issue Feb 7, 2024 · 1 comment

Comments

@zsystm
Copy link

zsystm commented Feb 7, 2024

Bank abi in this repo missing some methods(getDenomMetadata, getSendEnabled) provided by Polaris.
Are Bera is using different stateful precompiled implementation with Polaris?

interface IBankModule {
  function getAllBalances ( address accountAddress ) external view returns ( tuple[] );
  function getAllSpendableBalances ( address accountAddress ) external view returns ( tuple[] );
  function getAllSupply (  ) external view returns ( tuple[] );
  function getBalance ( address accountAddress, string denom ) external view returns ( uint256 );
  function getSpendableBalance ( address accountAddress, string denom ) external view returns ( uint256 );
  function getSupply ( string denom ) external view returns ( uint256 );
  function send ( address toAddress, tuple[] amount ) external returns ( bool );
}

FYI
Stateful precompiled bank contract implementation in Polaris (ref: code)

// GetBalance implements `getBalance(address,string)` method.
func (c *Contract) GetBalance(
	ctx context.Context,
	accountAddress common.Address,
	denom string,
) (*big.Int, error) {
	// ...
}

// GetAllBalances implements `getAllBalances(address)` method.
func (c *Contract) GetAllBalances(
	ctx context.Context,
	accountAddress common.Address,
) ([]lib.CosmosCoin, error) {
	// ...
}

// GetSpendableBalanceByDenom implements `getSpendableBalanceByDenom(address,string)` method.
func (c *Contract) GetSpendableBalance(
	ctx context.Context,
	accountAddress common.Address,
	denom string,
) (*big.Int, error) {
	// ...
}

// GetSpendableBalances implements `getAllSpendableBalances(address)` method.
func (c *Contract) GetAllSpendableBalances(
	ctx context.Context,
	accountAddress common.Address,
) ([]lib.CosmosCoin, error) {
	// ...
}

// GetSupplyOf implements `getSupply(string)` method.
func (c *Contract) GetSupply(
	ctx context.Context,
	denom string,
) (*big.Int, error) {
	// ...
}

// GetTotalSupply implements `getAllSupply()` method.
func (c *Contract) GetAllSupply(
	ctx context.Context,
) ([]lib.CosmosCoin, error) {
	// ...
}

// GetDenomMetadata implements `getDenomMetadata(string)` method.
func (c *Contract) GetDenomMetadata(
	ctx context.Context,
	denom string,
) (bankgenerated.IBankModuleDenomMetadata, error) {
	// ...
}

// GetSendEnabled implements `getSendEnabled(string)` method.
func (c *Contract) GetSendEnabled(
	ctx context.Context,
	denom string,
) (bool, error) {
	// ...
}

// Send implements `send(address,(uint256,string)[])` method.
func (c *Contract) Send(
	ctx context.Context,
	toAddress common.Address,
	coins any,
) (bool, error) {
	// ...
}
@zsystm
Copy link
Author

zsystm commented Feb 7, 2024

My miss.
I was looking at old repo.

@zsystm zsystm closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant