-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new Vtransfer module for notifications (#8624)
closes: #8583, closes: #9059, closes: #9256 ## Description This PR adds the vTransfer middleware module which acts as a notification module on the transfer port for contracts that need to act based on it. ### Security Considerations As discussed, this does change how inbound assets are handled. ### Testing Considerations The middleware module has mock unit tests in ibc_middleware_test.go
- Loading branch information
Showing
83 changed files
with
3,013 additions
and
252 deletions.
There are no files selected for viewing
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
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,18 @@ | ||
syntax = "proto3"; | ||
package agoric.vtransfer; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"; | ||
|
||
// The initial and exported module state. | ||
message GenesisState { | ||
option (gogoproto.equal) = false; | ||
|
||
// The list of account addresses that are being watched by the VM. | ||
repeated bytes watched_addresses = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", | ||
(gogoproto.jsontag) = "watched_addresses", | ||
(gogoproto.moretags) = "yaml:\"watched_addresses\"" | ||
]; | ||
} |
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
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,16 @@ | ||
package keeper | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage" | ||
) | ||
|
||
// GetVstorageKeeper returns the vstorage keeper from the swingset keeper | ||
// for testing purposes. | ||
func GetVstorageKeeper(t *testing.T, k Keeper) vstorage.Keeper { | ||
if t == nil { | ||
panic("this function is reserved for testing") | ||
} | ||
return k.vstorageKeeper | ||
} |
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,17 @@ | ||
package testing | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper" | ||
vstoragetesting "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/testing" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// GetActionQueueRecords returns the records in the action queue. | ||
// This is a testing utility function. | ||
func GetActionQueueRecords(t *testing.T, ctx sdk.Context, swingsetKeeper keeper.Keeper) ([]string, error) { | ||
vstorageKeeper := keeper.GetVstorageKeeper(t, swingsetKeeper) | ||
actionQueueName := keeper.StoragePathActionQueue | ||
return vstoragetesting.GetQueueItems(ctx, vstorageKeeper, actionQueueName) | ||
} |
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
package vbank | ||
|
||
import ( | ||
// "fmt" | ||
|
||
"fmt" | ||
|
||
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types" | ||
|
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 |
---|---|---|
@@ -1,15 +1,3 @@ | ||
package types | ||
|
||
const RouterKey = ModuleName // this was defined in your key.go file | ||
|
||
type VbankSingleBalanceUpdate struct { | ||
Address string `json:"address"` | ||
Denom string `json:"denom"` | ||
Amount string `json:"amount"` | ||
} | ||
|
||
type VbankBalanceUpdate struct { | ||
Nonce uint64 `json:"nonce"` | ||
Type string `json:"type"` | ||
Updated []VbankSingleBalanceUpdate `json:"updated"` | ||
} |
Oops, something went wrong.