Skip to content

Commit

Permalink
added x/bridge module proto contracts (osmosis-labs#7688)
Browse files Browse the repository at this point in the history
  • Loading branch information
keruch authored Mar 8, 2024
1 parent fb84df2 commit 6993f20
Show file tree
Hide file tree
Showing 11 changed files with 5,715 additions and 0 deletions.
45 changes: 45 additions & 0 deletions proto/osmosis/bridge/v1beta1/bridge.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";

option go_package = "github.com/osmosis-labs/osmosis/v23/x/bridge/types";

// Params defines params for x/bridge module.
message Params {
// Signers used to sign inbound and release outbound transactions
repeated string signers = 1 [ (gogoproto.moretags) = "yaml:\"signers\"" ];
// Assets is a list used to create tokenfactory denoms
// for corresponding trading pairs
repeated AssetWithStatus assets = 2 [
(gogoproto.moretags) = "yaml:\"assets\"",
(gogoproto.nullable) = false
];
}

enum AssetStatus {
ASSET_STATUS_UNSPECIFIED = 0;
ASSET_STATUS_OK = 1;
ASSET_STATUS_BLOCKED_INBOUND = 2;
ASSET_STATUS_BLOCKED_OUTBOUND = 3;
ASSET_STATUS_BLOCKED_BOTH = 4;
}

// AssetWithStatus defines a pair of the asset and its current status.
message AssetWithStatus {
Asset asset = 1
[ (gogoproto.moretags) = "yaml:\"asset\"", (gogoproto.nullable) = false ];
AssetStatus asset_status = 2
[ (gogoproto.moretags) = "yaml:\"asset_status\"" ];
}

// Asset defines a pair of the source chain name and its Osmosis representation
// denoted by denom. It also includes a precision used for coins representation.
message Asset {
// SourceChain is a source chain name
string source_chain = 1 [ (gogoproto.moretags) = "yaml:\"source_chain\"" ];
// Denom is the Osmosis representation of the SourceChain
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
// Precision used for coins representation
uint64 precision = 3 [ (gogoproto.moretags) = "yaml:\"precision\"" ];
}
53 changes: 53 additions & 0 deletions proto/osmosis/bridge/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v23/x/bridge/types";

message EventInboundTransfer {
// Sender is a sender's address
string sender = 1;
// DestAddr is a destination Osmosis address
string dest_addr = 2;
// Asset contains a source chain and a target denom
Asset asset = 3 [ (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message EventOutboundTransfer {
// Sender is a sender's address
string sender = 1;
// DestAddr is a destination Osmosis address
string dest_addr = 2;
// Asset contains a source chain and a target denom
Asset asset = 3 [ (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message EventUpdateParams {
repeated string new_signers = 1;
repeated string created_signers = 2;
repeated string deleted_signers = 3;

repeated AssetWithStatus new_assets = 4 [ (gogoproto.nullable) = false ];
repeated AssetWithStatus created_assets = 5 [ (gogoproto.nullable) = false ];
repeated AssetWithStatus deleted_assets = 6 [ (gogoproto.nullable) = false ];
}

message EventChangeAssetStatus {
// Sender is a sender's address
string sender = 1;
// NewAssetStatus is a pair of the asset and its new status
AssetWithStatus old_asset_status = 2 [ (gogoproto.nullable) = false ];
AssetWithStatus new_asset_status = 3 [ (gogoproto.nullable) = false ];
}
13 changes: 13 additions & 0 deletions proto/osmosis/bridge/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v23/x/bridge/types";

// GenesisState defines the mint module's genesis state.
message GenesisState {
// Params defines params for x/bridge module.
Params params = 1 [ (gogoproto.nullable) = false ];
}
27 changes: 27 additions & 0 deletions proto/osmosis/bridge/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v23/x/bridge/types";

// Query provides defines the gRPC querier service.
service Query {
// Params returns x/bridge module params.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/osmosis/bridge/v1beta1/params";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
Params params = 1 [
(gogoproto.moretags) = "yaml:\"params\"",
(gogoproto.nullable) = false
];
}
111 changes: 111 additions & 0 deletions proto/osmosis/bridge/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
syntax = "proto3";
package osmosis.bridge.v1beta1;

import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "osmosis/bridge/v1beta1/bridge.proto";

option go_package = "github.com/osmosis-labs/osmosis/v23/x/bridge/types";

// Msg defines the bridge module's gRPC message service.
service Msg {
// InboundTransfer is used for inbound transfers (<other_chain> -> OSMO).
rpc InboundTransfer(MsgInboundTransfer) returns (MsgInboundTransferResponse);

// OutboundTransfer is used for outbound transfers (OSMO -> <other_chain>).
rpc OutboundTransfer(MsgOutboundTransfer)
returns (MsgOutboundTransferResponse);

// UpdateParams is used for updating module params.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

// ChangeAssetStatus will change the provided asset's status.
rpc ChangeAssetStatus(MsgChangeAssetStatus)
returns (MsgChangeAssetStatusResponse);
}

// MsgInboundTransfer defines the message structure for the InboundTransfer gRPC
// service method. It allows a sender to perform an inbound cross-chain
// transfer, i.e., to transfer their tokens from the source chain to Osmosis and
// get the equivalent amount of the corresponding token (specified in subdenom)
// on Osmosis in return. The tokens are minted through the x/tokenfactory module
// to the destination address.
message MsgInboundTransfer {
option (amino.name) = "osmosis/bridge/inbound-transfer";

// Sender is a sender's address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// DestAddr is a destination Osmosis address
string dest_addr = 2 [ (gogoproto.moretags) = "yaml:\"dest_addr\"" ];
// Asset contains a source chain and a target denom
Asset asset = 3
[ (gogoproto.moretags) = "yaml:\"asset\"", (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message MsgInboundTransferResponse {}

// MsgOutboundTransfer defines the message structure for the OutboundTransfer
// gRPC service method. It allows a sender to perform an outbound cross-chain
// transfer, i.e., to transfer their tokens from Osmosis to the destination
// chain. The tokens are burned through the x/tokenfactory module from the
// sender's address.
message MsgOutboundTransfer {
option (amino.name) = "osmosis/bridge/outbound-transfer";

// Sender is a sender's Osmosis address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// DestAddr is a destination address
string dest_addr = 2 [ (gogoproto.moretags) = "yaml:\"dest_addr\"" ];
// Asset contains a target chain and a source denom
Asset asset = 3
[ (gogoproto.moretags) = "yaml:\"asset\"", (gogoproto.nullable) = false ];
// Amount of coins to transfer
string amount = 4 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}

message MsgOutboundTransferResponse {}

// MsgUpdateParams allows to update module params. It contains UpdateParams
// instead of just Params to forbid status updating using this method.
// All new assets introduced with this method have ASSET_STATUS_BLOCKED_BOTH
// status by default.
message MsgUpdateParams {
option (amino.name) = "osmosis/bridge/update-params";

// Sender is a sender's address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// NewParams should be fully populated
Params new_params = 2 [
(gogoproto.moretags) = "yaml:\"new_params\"",
(gogoproto.nullable) = false
];
}

message MsgUpdateParamsResponse {}

// MsgChangeAssetStatus changes the status of the provided asset.
message MsgChangeAssetStatus {
option (amino.name) = "osmosis/bridge/change-asset-status";

// Sender is a sender's address
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// NewAssetStatus is a pair of the asset and its new status.
// The asset should be known; otherwise, the method will failed.
AssetWithStatus new_asset_status = 2 [
(gogoproto.moretags) = "yaml:\"new_asset_status\"",
(gogoproto.nullable) = false
];
}

message MsgChangeAssetStatusResponse {}
Loading

0 comments on commit 6993f20

Please sign in to comment.