syntax = "proto3";
package osmosis.superfluid;

import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "google/protobuf/duration.proto";
import "cosmos/base/v1beta1/coin.proto";
import "osmosis/superfluid/superfluid.proto";

option go_package = "github.com/osmosis-labs/osmosis/v13/x/superfluid/types";

// Msg defines the Msg service.
service Msg {
  // Execute superfluid delegation for a lockup
  rpc SuperfluidDelegate(MsgSuperfluidDelegate)
      returns (MsgSuperfluidDelegateResponse);

  // Execute superfluid undelegation for a lockup
  rpc SuperfluidUndelegate(MsgSuperfluidUndelegate)
      returns (MsgSuperfluidUndelegateResponse);

  // Execute superfluid redelegation for a lockup
  // rpc SuperfluidRedelegate(MsgSuperfluidRedelegate) returns
  // (MsgSuperfluidRedelegateResponse);

  // For a given lock that is being superfluidly undelegated,
  // also unbond the underlying lock.
  rpc SuperfluidUnbondLock(MsgSuperfluidUnbondLock)
      returns (MsgSuperfluidUnbondLockResponse);

  // Execute lockup lock and superfluid delegation in a single msg
  rpc LockAndSuperfluidDelegate(MsgLockAndSuperfluidDelegate)
      returns (MsgLockAndSuperfluidDelegateResponse);

  rpc UnPoolWhitelistedPool(MsgUnPoolWhitelistedPool)
      returns (MsgUnPoolWhitelistedPoolResponse);
}

message MsgSuperfluidDelegate {
  option (amino.name) = "osmosis/superfluid-delegate";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  uint64 lock_id = 2;
  string val_addr = 3;
}
message MsgSuperfluidDelegateResponse {}

message MsgSuperfluidUndelegate {
  option (amino.name) = "osmosis/superfluid-undelegate";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  uint64 lock_id = 2;
}
message MsgSuperfluidUndelegateResponse {}

message MsgSuperfluidUnbondLock {
  option (amino.name) = "osmosis/superfluid-unbond-lock";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  uint64 lock_id = 2;
}
message MsgSuperfluidUnbondLockResponse {}

// message MsgSuperfluidRedelegate {
//   string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
//   uint64 lock_id = 2;
//   string new_val_addr = 3;
// }
// message MsgSuperfluidRedelegateResponse {}

// MsgLockAndSuperfluidDelegate locks coins with the unbonding period duration,
// and then does a superfluid lock from the newly created lockup, to the
// specified validator addr.
message MsgLockAndSuperfluidDelegate {
  option (amino.name) = "osmosis/lock-and-superfluid-delegate";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  repeated cosmos.base.v1beta1.Coin coins = 2 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
  string val_addr = 3;
}
message MsgLockAndSuperfluidDelegateResponse { uint64 ID = 1; }

// MsgUnPoolWhitelistedPool Unpools every lock the sender has, that is
// associated with pool pool_id. If pool_id is not approved for unpooling by
// governance, this is a no-op. Unpooling takes the locked gamm shares, and runs
// "ExitPool" on it, to get the constituent tokens. e.g. z gamm/pool/1 tokens
// ExitPools into constituent tokens x uatom, y uosmo. Then it creates a new
// lock for every constituent token, with the duration associated with the lock.
// If the lock was unbonding, the new lockup durations should be the time left
// until unbond completion.
message MsgUnPoolWhitelistedPool {
  option (amino.name) = "osmosis/unpool-whitelisted-pool";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
}

message MsgUnPoolWhitelistedPoolResponse {
  repeated uint64 exited_lock_ids = 1;
}
