@@ -18,7 +18,8 @@ use injective_test_tube::{
1818 gov:: v1:: { MsgSubmitProposal , MsgVote } ,
1919 } ,
2020 injective:: exchange:: v1beta1:: {
21- DerivativeOrder , MsgBatchUpdateOrders , MsgBatchUpdateOrdersResponse , MsgCancelDerivativeOrder , MsgCreateDerivativeLimitOrder ,
21+ BatchExchangeModificationProposal , DenomMinNotional , DenomMinNotionalProposal , DerivativeOrder , MsgBatchExchangeModification ,
22+ MsgBatchUpdateOrders , MsgBatchUpdateOrdersResponse , MsgCancelDerivativeOrder , MsgCreateDerivativeLimitOrder ,
2223 MsgCreateDerivativeLimitOrderResponse , MsgCreateSpotLimitOrder , MsgInstantPerpetualMarketLaunch , MsgInstantSpotMarketLaunch ,
2324 MsgUpdateParams , OrderInfo , OrderType , PerpetualMarketFunding , Position , QueryDerivativeMarketsRequest , QueryExchangeParamsRequest ,
2425 QueryExchangeParamsResponse , QuerySpotMarketsRequest , QuerySubaccountDepositsRequest ,
@@ -90,6 +91,78 @@ pub fn add_exchange_admin(app: &InjectiveTestApp, validator: &SigningAccount, ad
9091 . unwrap ( ) ;
9192}
9293
94+ pub fn add_min_notional ( app : & InjectiveTestApp , validator : & SigningAccount , denom : String , min_notional : String ) {
95+ let gov = Gov :: new ( app) ;
96+
97+ // NOTE: this could change int he future
98+ let governance_module_address = "inj10d07y265gmmuvt4z0w9aw880jnsr700jstypyt" ;
99+
100+ let proposal = BatchExchangeModificationProposal {
101+ title : "Update params" . to_string ( ) ,
102+ description : "Basically updating the params" . to_string ( ) ,
103+ spot_market_param_update_proposals : vec ! [ ] ,
104+ derivative_market_param_update_proposals : vec ! [ ] ,
105+ spot_market_launch_proposals : vec ! [ ] ,
106+ perpetual_market_launch_proposals : vec ! [ ] ,
107+ expiry_futures_market_launch_proposals : vec ! [ ] ,
108+ trading_reward_campaign_update_proposal : None ,
109+ binary_options_market_launch_proposals : vec ! [ ] ,
110+ binary_options_param_update_proposals : vec ! [ ] ,
111+ denom_decimals_update_proposal : None ,
112+ fee_discount_proposal : None ,
113+ market_forced_settlement_proposals : vec ! [ ] ,
114+ denom_min_notional_proposal : Some ( DenomMinNotionalProposal {
115+ title : "Update min notional" . to_string ( ) ,
116+ description : "Love it!" . to_string ( ) ,
117+ denom_min_notionals : vec ! [ DenomMinNotional { denom, min_notional } ] ,
118+ } ) ,
119+ } ;
120+
121+ let mut buf = vec ! [ ] ;
122+ MsgBatchExchangeModification :: encode (
123+ & MsgBatchExchangeModification {
124+ sender : governance_module_address. to_string ( ) ,
125+ proposal : Some ( proposal) ,
126+ } ,
127+ & mut buf,
128+ )
129+ . unwrap ( ) ;
130+
131+ let res = gov
132+ . submit_proposal (
133+ MsgSubmitProposal {
134+ messages : vec ! [ Any {
135+ type_url: MsgBatchExchangeModification :: TYPE_URL . to_string( ) ,
136+ value: buf,
137+ } ] ,
138+ initial_deposit : vec ! [ BaseCoin {
139+ amount: "100000000000000000000" . to_string( ) ,
140+ denom: "inj" . to_string( ) ,
141+ } ] ,
142+ proposer : validator. address ( ) ,
143+ metadata : "" . to_string ( ) ,
144+ title : "Update params" . to_string ( ) ,
145+ summary : "Basically updating the params" . to_string ( ) ,
146+ expedited : false ,
147+ } ,
148+ validator,
149+ )
150+ . unwrap ( ) ;
151+
152+ let proposal_id = res. events . iter ( ) . find ( |e| e. ty == "submit_proposal" ) . unwrap ( ) . attributes [ 0 ] . value . clone ( ) ;
153+
154+ gov. vote (
155+ MsgVote {
156+ proposal_id : u64:: from_str ( & proposal_id) . unwrap ( ) ,
157+ voter : validator. address ( ) ,
158+ option : 1i32 ,
159+ metadata : "" . to_string ( ) ,
160+ } ,
161+ validator,
162+ )
163+ . unwrap ( ) ;
164+ }
165+
93166pub fn create_perp_mid_price ( app : & InjectiveTestApp , market_id : & str , base_price : & str , base_quantity : & str , base_margin : & str , spread : f64 ) {
94167 // Calculate adjusted prices for buy and sell based on the spread
95168 let sell_price = format ! ( "{:.1}" , base_price. parse:: <f64 >( ) . unwrap( ) + spread) ;
0 commit comments