-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hyle-team/feature/native-bridge
Feature/native bridge
- Loading branch information
Showing
36 changed files
with
557 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- +migrate Up | ||
|
||
ALTER TABLE deposits | ||
ADD COLUMN is_wrapped_token boolean DEFAULT false; | ||
|
||
-- +migrate Down | ||
|
||
ALTER TABLE deposits | ||
DROP COLUMN is_wrapped_token; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- +migrate Up | ||
|
||
ALTER TABLE deposits | ||
RENAME COLUMN amount TO deposit_amount; | ||
|
||
ALTER TABLE deposits | ||
ADD COLUMN withdrawal_amount TEXT; | ||
|
||
-- +migrate Down | ||
|
||
ALTER TABLE deposits | ||
RENAME COLUMN deposit_amount to amount; | ||
|
||
ALTER TABLE deposits | ||
DROP COLUMN withdrawal_amount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package core | ||
|
||
import bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" | ||
|
||
func (c *Connector) SubmitDeposits(depositTxs ...bridgetypes.Transaction) error { | ||
if len(depositTxs) == 0 { | ||
return nil | ||
} | ||
|
||
msg := bridgetypes.NewMsgSubmitTransactions(c.settings.Account.CosmosAddress(), depositTxs...) | ||
|
||
return c.submitMsgs(msg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package core | ||
|
||
import ( | ||
"context" | ||
bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func (c *Connector) GetTokenInfo(chainId string, addr string) (bridgetypes.TokenInfo, error) { | ||
req := bridgetypes.QueryGetTokenInfo{ | ||
Chain: chainId, | ||
Address: addr, | ||
} | ||
|
||
resp, err := c.querier.GetTokenInfo(context.Background(), &req) | ||
if err != nil { | ||
if errors.Is(err, bridgetypes.ErrTokenInfoNotFound.GRPCStatus().Err()) { | ||
return bridgetypes.TokenInfo{}, bridgetypes.ErrTokenInfoNotFound | ||
} | ||
|
||
return bridgetypes.TokenInfo{}, errors.Wrap(err, "failed to get token info") | ||
} | ||
|
||
return resp.Info, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package core | ||
|
||
import ( | ||
"context" | ||
"github.com/ethereum/go-ethereum/common" | ||
bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" | ||
"github.com/hyle-team/bridgeless-signer/internal/bridge/types" | ||
"github.com/pkg/errors" | ||
"strings" | ||
) | ||
|
||
func (c *Connector) GetDestinationTokenInfo( | ||
srcChainId string, | ||
srcTokenAddr common.Address, | ||
dstChainId string, | ||
) (bridgetypes.TokenInfo, error) { | ||
req := bridgetypes.QueryGetTokenPair{ | ||
SrcChain: srcChainId, | ||
SrcAddress: strings.ToLower(srcTokenAddr.String()), | ||
DstChain: dstChainId, | ||
} | ||
|
||
resp, err := c.querier.GetTokenPair(context.Background(), &req) | ||
if err != nil { | ||
if errors.Is(err, bridgetypes.ErrTokenPairNotFound.GRPCStatus().Err()) { | ||
return bridgetypes.TokenInfo{}, types.ErrPairNotFound | ||
} | ||
|
||
return bridgetypes.TokenInfo{}, errors.Wrap(err, "failed to get token pair") | ||
} | ||
|
||
return resp.Info, nil | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.