-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TRA-415] implement market mapper rev share gov msg (#1733)
Signed-off-by: Shrenuj Bansal <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,737 additions
and
191 deletions.
There are no files selected for viewing
296 changes: 150 additions & 146 deletions
296
indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
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
105 changes: 105 additions & 0 deletions
105
indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/params.ts
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,105 @@ | ||
import * as _m0 from "protobufjs/minimal"; | ||
import { DeepPartial } from "../../helpers"; | ||
/** MarketMappeRevenueShareParams represents params for the above message */ | ||
|
||
export interface MarketMapperRevenueShareParams { | ||
/** The address which will receive the revenue share payouts */ | ||
address: string; | ||
/** | ||
* The fraction of the fees which will go to the above mentioned address. | ||
* In parts-per-million | ||
*/ | ||
|
||
revenueSharePpm: number; | ||
/** | ||
* This parameter defines how many days post market initiation will the | ||
* revenue share be applied for. After valid_days from market initiation | ||
* the revenue share goes down to 0 | ||
*/ | ||
|
||
validDays: number; | ||
} | ||
/** MarketMappeRevenueShareParams represents params for the above message */ | ||
|
||
export interface MarketMapperRevenueShareParamsSDKType { | ||
/** The address which will receive the revenue share payouts */ | ||
address: string; | ||
/** | ||
* The fraction of the fees which will go to the above mentioned address. | ||
* In parts-per-million | ||
*/ | ||
|
||
revenue_share_ppm: number; | ||
/** | ||
* This parameter defines how many days post market initiation will the | ||
* revenue share be applied for. After valid_days from market initiation | ||
* the revenue share goes down to 0 | ||
*/ | ||
|
||
valid_days: number; | ||
} | ||
|
||
function createBaseMarketMapperRevenueShareParams(): MarketMapperRevenueShareParams { | ||
return { | ||
address: "", | ||
revenueSharePpm: 0, | ||
validDays: 0 | ||
}; | ||
} | ||
|
||
export const MarketMapperRevenueShareParams = { | ||
encode(message: MarketMapperRevenueShareParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
if (message.address !== "") { | ||
writer.uint32(10).string(message.address); | ||
} | ||
|
||
if (message.revenueSharePpm !== 0) { | ||
writer.uint32(16).uint32(message.revenueSharePpm); | ||
} | ||
|
||
if (message.validDays !== 0) { | ||
writer.uint32(24).uint32(message.validDays); | ||
} | ||
|
||
return writer; | ||
}, | ||
|
||
decode(input: _m0.Reader | Uint8Array, length?: number): MarketMapperRevenueShareParams { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseMarketMapperRevenueShareParams(); | ||
|
||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
|
||
switch (tag >>> 3) { | ||
case 1: | ||
message.address = reader.string(); | ||
break; | ||
|
||
case 2: | ||
message.revenueSharePpm = reader.uint32(); | ||
break; | ||
|
||
case 3: | ||
message.validDays = reader.uint32(); | ||
break; | ||
|
||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
|
||
return message; | ||
}, | ||
|
||
fromPartial(object: DeepPartial<MarketMapperRevenueShareParams>): MarketMapperRevenueShareParams { | ||
const message = createBaseMarketMapperRevenueShareParams(); | ||
message.address = object.address ?? ""; | ||
message.revenueSharePpm = object.revenueSharePpm ?? 0; | ||
message.validDays = object.validDays ?? 0; | ||
return message; | ||
} | ||
|
||
}; |
27 changes: 27 additions & 0 deletions
27
indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.rpc.msg.ts
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,27 @@ | ||
import { Rpc } from "../../helpers"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
import { MsgSetMarketMapperRevenueShare, MsgSetMarketMapperRevenueShareResponse } from "./tx"; | ||
/** Msg defines the Msg service. */ | ||
|
||
export interface Msg { | ||
/** | ||
* SetMarketMapperRevenueShare sets the revenue share for a market | ||
* mapper. | ||
*/ | ||
setMarketMapperRevenueShare(request: MsgSetMarketMapperRevenueShare): Promise<MsgSetMarketMapperRevenueShareResponse>; | ||
} | ||
export class MsgClientImpl implements Msg { | ||
private readonly rpc: Rpc; | ||
|
||
constructor(rpc: Rpc) { | ||
this.rpc = rpc; | ||
this.setMarketMapperRevenueShare = this.setMarketMapperRevenueShare.bind(this); | ||
} | ||
|
||
setMarketMapperRevenueShare(request: MsgSetMarketMapperRevenueShare): Promise<MsgSetMarketMapperRevenueShareResponse> { | ||
const data = MsgSetMarketMapperRevenueShare.encode(request).finish(); | ||
const promise = this.rpc.request("dydxprotocol.revshare.Msg", "SetMarketMapperRevenueShare", data); | ||
return promise.then(data => MsgSetMarketMapperRevenueShareResponse.decode(new _m0.Reader(data))); | ||
} | ||
|
||
} |
115 changes: 114 additions & 1 deletion
115
indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts
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 +1,114 @@ | ||
export {} | ||
import { MarketMapperRevenueShareParams, MarketMapperRevenueShareParamsSDKType } from "./params"; | ||
import * as _m0 from "protobufjs/minimal"; | ||
import { DeepPartial } from "../../helpers"; | ||
/** Message to set the market mapper revenue share */ | ||
|
||
export interface MsgSetMarketMapperRevenueShare { | ||
authority: string; | ||
/** Parameters for the revenue share */ | ||
|
||
params?: MarketMapperRevenueShareParams; | ||
} | ||
/** Message to set the market mapper revenue share */ | ||
|
||
export interface MsgSetMarketMapperRevenueShareSDKType { | ||
authority: string; | ||
/** Parameters for the revenue share */ | ||
|
||
params?: MarketMapperRevenueShareParamsSDKType; | ||
} | ||
/** Response to a MsgSetMarketMapperRevenueShare */ | ||
|
||
export interface MsgSetMarketMapperRevenueShareResponse {} | ||
/** Response to a MsgSetMarketMapperRevenueShare */ | ||
|
||
export interface MsgSetMarketMapperRevenueShareResponseSDKType {} | ||
|
||
function createBaseMsgSetMarketMapperRevenueShare(): MsgSetMarketMapperRevenueShare { | ||
return { | ||
authority: "", | ||
params: undefined | ||
}; | ||
} | ||
|
||
export const MsgSetMarketMapperRevenueShare = { | ||
encode(message: MsgSetMarketMapperRevenueShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
if (message.authority !== "") { | ||
writer.uint32(10).string(message.authority); | ||
} | ||
|
||
if (message.params !== undefined) { | ||
MarketMapperRevenueShareParams.encode(message.params, writer.uint32(18).fork()).ldelim(); | ||
} | ||
|
||
return writer; | ||
}, | ||
|
||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetMarketMapperRevenueShare { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseMsgSetMarketMapperRevenueShare(); | ||
|
||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
|
||
switch (tag >>> 3) { | ||
case 1: | ||
message.authority = reader.string(); | ||
break; | ||
|
||
case 2: | ||
message.params = MarketMapperRevenueShareParams.decode(reader, reader.uint32()); | ||
break; | ||
|
||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
|
||
return message; | ||
}, | ||
|
||
fromPartial(object: DeepPartial<MsgSetMarketMapperRevenueShare>): MsgSetMarketMapperRevenueShare { | ||
const message = createBaseMsgSetMarketMapperRevenueShare(); | ||
message.authority = object.authority ?? ""; | ||
message.params = object.params !== undefined && object.params !== null ? MarketMapperRevenueShareParams.fromPartial(object.params) : undefined; | ||
return message; | ||
} | ||
|
||
}; | ||
|
||
function createBaseMsgSetMarketMapperRevenueShareResponse(): MsgSetMarketMapperRevenueShareResponse { | ||
return {}; | ||
} | ||
|
||
export const MsgSetMarketMapperRevenueShareResponse = { | ||
encode(_: MsgSetMarketMapperRevenueShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
return writer; | ||
}, | ||
|
||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetMarketMapperRevenueShareResponse { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseMsgSetMarketMapperRevenueShareResponse(); | ||
|
||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
|
||
switch (tag >>> 3) { | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
|
||
return message; | ||
}, | ||
|
||
fromPartial(_: DeepPartial<MsgSetMarketMapperRevenueShareResponse>): MsgSetMarketMapperRevenueShareResponse { | ||
const message = createBaseMsgSetMarketMapperRevenueShareResponse(); | ||
return message; | ||
} | ||
|
||
}; |
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,3 +1,3 @@ | ||
import * as _111 from "./gogo"; | ||
export const gogoproto = { ..._111 | ||
import * as _112 from "./gogo"; | ||
export const gogoproto = { ..._112 | ||
}; |
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,16 +1,16 @@ | ||
import * as _112 from "./api/annotations"; | ||
import * as _113 from "./api/http"; | ||
import * as _114 from "./protobuf/descriptor"; | ||
import * as _115 from "./protobuf/duration"; | ||
import * as _116 from "./protobuf/timestamp"; | ||
import * as _117 from "./protobuf/any"; | ||
import * as _113 from "./api/annotations"; | ||
import * as _114 from "./api/http"; | ||
import * as _115 from "./protobuf/descriptor"; | ||
import * as _116 from "./protobuf/duration"; | ||
import * as _117 from "./protobuf/timestamp"; | ||
import * as _118 from "./protobuf/any"; | ||
export namespace google { | ||
export const api = { ..._112, | ||
..._113 | ||
export const api = { ..._113, | ||
..._114 | ||
}; | ||
export const protobuf = { ..._114, | ||
..._115, | ||
export const protobuf = { ..._115, | ||
..._116, | ||
..._117 | ||
..._117, | ||
..._118 | ||
}; | ||
} |
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,7 +1,12 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.revshare; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dydxprotocol/revshare/params.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; | ||
|
||
// GenesisState defines `x/revshare`'s genesis state. | ||
message GenesisState {} | ||
message GenesisState { | ||
MarketMapperRevenueShareParams params = 1 [ (gogoproto.nullable) = false ]; | ||
} |
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,21 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.revshare; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; | ||
|
||
// MarketMappeRevenueShareParams represents params for the above message | ||
message MarketMapperRevenueShareParams { | ||
// The address which will receive the revenue share payouts | ||
string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// The fraction of the fees which will go to the above mentioned address. | ||
// In parts-per-million | ||
uint32 revenue_share_ppm = 2; | ||
|
||
// This parameter defines how many days post market initiation will the | ||
// revenue share be applied for. After valid_days from market initiation | ||
// the revenue share goes down to 0 | ||
uint32 valid_days = 3; | ||
} |
Oops, something went wrong.