Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/indexer-build-and-push-dev-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on: # yamllint disable-line rule:truthy
- main
- 'release/indexer/v[0-9]+.[0-9]+.x' # e.g. release/indexer/v0.1.x
- 'release/indexer/v[0-9]+.x' # e.g. release/indexer/v1.x
- davidli/transfer_governance
# TODO(DEC-837): Customize github build and push to ECR by service with paths

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/protocol-build-and-push-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on: # yamllint disable-line rule:truthy
- main
- 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x
- davidli/transfer_governance

jobs:
build-and-push-snapshot-dev:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/protocol-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on: # yamllint disable-line rule:truthy
- main
- 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x
- davidli/transfer_governance

jobs:
build-and-push-dev:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,42 @@ export interface MsgSendFromModuleToAccountSDKType {

coin?: CoinSDKType;
}
/**
* MsgSendFromAccountToAccount represents a single transfer from one
* `x/bank` account to another `x/bank` account.
* Should only be executed by governance.
*/

export interface MsgSendFromAccountToAccount {
authority: string;
/** The sender account address. */

sender: string;
/** The recipient account address. */

recipient: string;
/** The coin to transfer, which specifies both denom and amount. */

coin?: Coin;
}
/**
* MsgSendFromAccountToAccount represents a single transfer from one
* `x/bank` account to another `x/bank` account.
* Should only be executed by governance.
*/

export interface MsgSendFromAccountToAccountSDKType {
authority: string;
/** The sender account address. */

sender: string;
/** The recipient account address. */

recipient: string;
/** The coin to transfer, which specifies both denom and amount. */

coin?: CoinSDKType;
}

function createBaseTransfer(): Transfer {
return {
Expand Down Expand Up @@ -447,4 +483,79 @@ export const MsgSendFromModuleToAccount = {
return message;
}

};

function createBaseMsgSendFromAccountToAccount(): MsgSendFromAccountToAccount {
return {
authority: "",
sender: "",
recipient: "",
coin: undefined
};
}

export const MsgSendFromAccountToAccount = {
encode(message: MsgSendFromAccountToAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.authority !== "") {
writer.uint32(10).string(message.authority);
}

if (message.sender !== "") {
writer.uint32(18).string(message.sender);
}

if (message.recipient !== "") {
writer.uint32(26).string(message.recipient);
}

if (message.coin !== undefined) {
Coin.encode(message.coin, writer.uint32(34).fork()).ldelim();
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendFromAccountToAccount {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgSendFromAccountToAccount();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.authority = reader.string();
break;

case 2:
message.sender = reader.string();
break;

case 3:
message.recipient = reader.string();
break;

case 4:
message.coin = Coin.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<MsgSendFromAccountToAccount>): MsgSendFromAccountToAccount {
const message = createBaseMsgSendFromAccountToAccount();
message.authority = object.authority ?? "";
message.sender = object.sender ?? "";
message.recipient = object.recipient ?? "";
message.coin = object.coin !== undefined && object.coin !== null ? Coin.fromPartial(object.coin) : undefined;
return message;
}

};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MsgDepositToSubaccount, MsgWithdrawFromSubaccount, MsgSendFromModuleToAccount } from "./transfer";
import { MsgDepositToSubaccount, MsgWithdrawFromSubaccount, MsgSendFromModuleToAccount, MsgSendFromAccountToAccount } from "./transfer";
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { MsgCreateTransfer, MsgCreateTransferResponse, MsgDepositToSubaccountResponse, MsgWithdrawFromSubaccountResponse, MsgSendFromModuleToAccountResponse } from "./tx";
import { MsgCreateTransfer, MsgCreateTransferResponse, MsgDepositToSubaccountResponse, MsgWithdrawFromSubaccountResponse, MsgSendFromModuleToAccountResponse, MsgSendFromAccountToAccountResponse } from "./tx";
/** Msg defines the Msg service. */

export interface Msg {
Expand All @@ -25,6 +25,12 @@ export interface Msg {
*/

sendFromModuleToAccount(request: MsgSendFromModuleToAccount): Promise<MsgSendFromModuleToAccountResponse>;
/**
* SendFromAccountToAccount initiates a new transfer from an `x/bank` account
* to another `x/bank` account (should only be executed by governance).
*/

sendFromAccountToAccount(request: MsgSendFromAccountToAccount): Promise<MsgSendFromAccountToAccountResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
Expand All @@ -35,6 +41,7 @@ export class MsgClientImpl implements Msg {
this.depositToSubaccount = this.depositToSubaccount.bind(this);
this.withdrawFromSubaccount = this.withdrawFromSubaccount.bind(this);
this.sendFromModuleToAccount = this.sendFromModuleToAccount.bind(this);
this.sendFromAccountToAccount = this.sendFromAccountToAccount.bind(this);
}

createTransfer(request: MsgCreateTransfer): Promise<MsgCreateTransferResponse> {
Expand All @@ -61,4 +68,10 @@ export class MsgClientImpl implements Msg {
return promise.then(data => MsgSendFromModuleToAccountResponse.decode(new _m0.Reader(data)));
}

sendFromAccountToAccount(request: MsgSendFromAccountToAccount): Promise<MsgSendFromAccountToAccountResponse> {
const data = MsgSendFromAccountToAccount.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.sending.Msg", "SendFromAccountToAccount", data);
return promise.then(data => MsgSendFromAccountToAccountResponse.decode(new _m0.Reader(data)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ export interface MsgSendFromModuleToAccountResponse {}
*/

export interface MsgSendFromModuleToAccountResponseSDKType {}
/**
* MsgSendFromAccountToAccountResponse is a response type used for new
* account-to-account transfers.
*/

export interface MsgSendFromAccountToAccountResponse {}
/**
* MsgSendFromAccountToAccountResponse is a response type used for new
* account-to-account transfers.
*/

export interface MsgSendFromAccountToAccountResponseSDKType {}

function createBaseMsgCreateTransfer(): MsgCreateTransfer {
return {
Expand Down Expand Up @@ -235,4 +247,38 @@ export const MsgSendFromModuleToAccountResponse = {
return message;
}

};

function createBaseMsgSendFromAccountToAccountResponse(): MsgSendFromAccountToAccountResponse {
return {};
}

export const MsgSendFromAccountToAccountResponse = {
encode(_: MsgSendFromAccountToAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendFromAccountToAccountResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgSendFromAccountToAccountResponse();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(_: DeepPartial<MsgSendFromAccountToAccountResponse>): MsgSendFromAccountToAccountResponse {
const message = createBaseMsgSendFromAccountToAccountResponse();
return message;
}

};
18 changes: 18 additions & 0 deletions proto/dydxprotocol/sending/transfer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,21 @@ message MsgSendFromModuleToAccount {
// The coin to transfer, which specifies both denom and amount.
cosmos.base.v1beta1.Coin coin = 4 [ (gogoproto.nullable) = false ];
}

// MsgSendFromAccountToAccount represents a single transfer from one
// `x/bank` account to another `x/bank` account.
// Should only be executed by governance.
message MsgSendFromAccountToAccount {
// Authority is the address that controls the module.
option (cosmos.msg.v1.signer) = "authority";
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The sender account address.
string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The recipient account address.
string recipient = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The coin to transfer, which specifies both denom and amount.
cosmos.base.v1beta1.Coin coin = 4 [ (gogoproto.nullable) = false ];
}
8 changes: 8 additions & 0 deletions proto/dydxprotocol/sending/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ service Msg {
// `x/bank` account (should only be executed by governance).
rpc SendFromModuleToAccount(MsgSendFromModuleToAccount)
returns (MsgSendFromModuleToAccountResponse);
// SendFromAccountToAccount initiates a new transfer from an `x/bank` account
// to another `x/bank` account (should only be executed by governance).
rpc SendFromAccountToAccount(MsgSendFromAccountToAccount)
returns (MsgSendFromAccountToAccountResponse);
}

// MsgCreateTransfer is a request type used for initiating new transfers.
Expand All @@ -40,3 +44,7 @@ message MsgWithdrawFromSubaccountResponse {}
// MsgSendFromModuleToAccountResponse is a response type used for new
// module-to-account transfers.
message MsgSendFromModuleToAccountResponse {}

// MsgSendFromAccountToAccountResponse is a response type used for new
// account-to-account transfers.
message MsgSendFromAccountToAccountResponse {}
18 changes: 10 additions & 8 deletions protocol/app/msgs/all_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,16 @@ var (
"/dydxprotocol.ratelimit.MsgSetLimitParamsResponse": {},

// sending
"/dydxprotocol.sending.MsgCreateTransfer": {},
"/dydxprotocol.sending.MsgCreateTransferResponse": {},
"/dydxprotocol.sending.MsgDepositToSubaccount": {},
"/dydxprotocol.sending.MsgDepositToSubaccountResponse": {},
"/dydxprotocol.sending.MsgWithdrawFromSubaccount": {},
"/dydxprotocol.sending.MsgWithdrawFromSubaccountResponse": {},
"/dydxprotocol.sending.MsgSendFromModuleToAccount": {},
"/dydxprotocol.sending.MsgSendFromModuleToAccountResponse": {},
"/dydxprotocol.sending.MsgCreateTransfer": {},
"/dydxprotocol.sending.MsgCreateTransferResponse": {},
"/dydxprotocol.sending.MsgDepositToSubaccount": {},
"/dydxprotocol.sending.MsgDepositToSubaccountResponse": {},
"/dydxprotocol.sending.MsgWithdrawFromSubaccount": {},
"/dydxprotocol.sending.MsgWithdrawFromSubaccountResponse": {},
"/dydxprotocol.sending.MsgSendFromModuleToAccount": {},
"/dydxprotocol.sending.MsgSendFromModuleToAccountResponse": {},
"/dydxprotocol.sending.MsgSendFromAccountToAccount": {},
"/dydxprotocol.sending.MsgSendFromAccountToAccountResponse": {},

// stats
"/dydxprotocol.stats.MsgUpdateParams": {},
Expand Down
6 changes: 4 additions & 2 deletions protocol/app/msgs/internal_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ var (
"/dydxprotocol.rewards.MsgUpdateParamsResponse": nil,

// sending
"/dydxprotocol.sending.MsgSendFromModuleToAccount": &sending.MsgSendFromModuleToAccount{},
"/dydxprotocol.sending.MsgSendFromModuleToAccountResponse": nil,
"/dydxprotocol.sending.MsgSendFromModuleToAccount": &sending.MsgSendFromModuleToAccount{},
"/dydxprotocol.sending.MsgSendFromModuleToAccountResponse": nil,
"/dydxprotocol.sending.MsgSendFromAccountToAccount": &sending.MsgSendFromAccountToAccount{},
"/dydxprotocol.sending.MsgSendFromAccountToAccountResponse": nil,

// stats
"/dydxprotocol.stats.MsgUpdateParams": &stats.MsgUpdateParams{},
Expand Down
2 changes: 2 additions & 0 deletions protocol/app/msgs/internal_msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ func TestInternalMsgSamples_Gov_Key(t *testing.T) {
"/dydxprotocol.rewards.MsgUpdateParamsResponse",

// sending
"/dydxprotocol.sending.MsgSendFromAccountToAccount",
"/dydxprotocol.sending.MsgSendFromAccountToAccountResponse",
"/dydxprotocol.sending.MsgSendFromModuleToAccount",
"/dydxprotocol.sending.MsgSendFromModuleToAccountResponse",

Expand Down
1 change: 1 addition & 0 deletions protocol/lib/ante/internal_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func IsInternalMsg(msg sdk.Msg) bool {

// sending
*sending.MsgSendFromModuleToAccount,
*sending.MsgSendFromAccountToAccount,

// stats
*stats.MsgUpdateParams,
Expand Down
1 change: 1 addition & 0 deletions protocol/lib/metrics/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ const (
ProcessDepositToSubaccount = "process_deposit_to_subaccount"
ProcessWithdrawFromSubaccount = "process_withdraw_from_subaccount"
SendFromModuleToAccount = "send_from_module_to_account"
SendFromAccountToAccount = "send_from_account_to_account"
AssetId = "asset_id"
SenderAddress = "sender_address"
SenderModuleName = "sender_module_name"
Expand Down
18 changes: 18 additions & 0 deletions protocol/mocks/SendingKeeper.go

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

Loading
Loading