Skip to content

Commit

Permalink
feat(solidity): add interface for querying data
Browse files Browse the repository at this point in the history
  • Loading branch information
todd-woko committed Oct 28, 2024
1 parent d2ea753 commit 5fde61f
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 6 deletions.
70 changes: 69 additions & 1 deletion contract/ibridge_fee_quote.sol.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions solidity/contracts/bridge/BridgeFeeQuote.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ contract BridgeFeeQuote is
using ECDSAUpgradeable for bytes32;
using StringsUpgradeable for string;

struct Asset {
bool isActive;
string[] tokenNames;
}

struct Quote {
uint256 id;
uint256 fee;
Expand Down Expand Up @@ -275,6 +270,16 @@ contract BridgeFeeQuote is
});
}

function supportChainNames() external view returns (string[] memory) {
return chainNames;
}

function supportAssets(
string memory _chainName
) external view returns (Asset memory) {
return assets[_chainName];
}

function verifyInput(QuoteInput memory _input) private {
if (!assets[_input.chainName].isActive) {
revert ChainNameInvalid();
Expand Down
11 changes: 11 additions & 0 deletions solidity/contracts/bridge/IBridgeFee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
pragma solidity ^0.8.0;

interface IBridgeFeeQuote {
struct Asset {
bool isActive;
string[] tokenNames;
}

struct QuoteInput {
string chainName;
string tokenName;
Expand Down Expand Up @@ -43,6 +48,12 @@ interface IBridgeFeeQuote {
address _oracle,
uint256 _index
) external view returns (QuoteInfo memory);

function supportChainNames() external view returns (string[] memory);

function supportAssets(
string memory _chainName
) external view returns (Asset memory);
}

interface IBridgeFeeOracle {
Expand Down

0 comments on commit 5fde61f

Please sign in to comment.