File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
contracts/voting/dao-voting-cosmos-staked/src Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,13 @@ pub fn execute_update_total_staked(
5454 amount : Uint128 ,
5555 height : Option < u64 > ,
5656) -> Result < Response , ContractError > {
57- STAKED_TOTAL . save ( deps. storage , & amount, env. block . height ) ?;
57+ let height = height. unwrap_or ( env. block . height ) ;
58+ STAKED_TOTAL . save ( deps. storage , & amount, height) ?;
5859
5960 Ok ( Response :: new ( )
6061 . add_attribute ( "action" , "update_total_staked" )
6162 . add_attribute ( "amount" , amount)
62- . add_attribute ( "height" , height. unwrap_or ( env . block . height ) . to_string ( ) ) )
63+ . add_attribute ( "height" , height. to_string ( ) ) )
6364}
6465
6566#[ cfg_attr( not( feature = "library" ) , entry_point) ]
Original file line number Diff line number Diff line change @@ -82,8 +82,8 @@ fn test_staked_voting_power_and_update() {
8282 msgs : vec ! [ CosmosMsg :: Stargate {
8383 type_url: "/cosmos.authz.v1beta1.MsgGrant" . to_string( ) ,
8484 value: MsgGrant {
85- granter: dao. contract_addr. to_string ( ) ,
86- grantee: bot. address( ) . to_string ( ) ,
85+ granter: dao. contract_addr. clone ( ) ,
86+ grantee: bot. address( ) ,
8787 grant: Some ( Grant {
8888 authorization: Some (
8989 ContractExecutionAuthorization {
@@ -119,9 +119,6 @@ fn test_staked_voting_power_and_update() {
119119 staker,
120120 )
121121 . unwrap ( ) ;
122-
123- app. increase_time ( 10 ) ;
124-
125122 proposal_single
126123 . execute (
127124 & dao_proposal_single:: msg:: ExecuteMsg :: Execute { proposal_id : 1 } ,
@@ -130,6 +127,9 @@ fn test_staked_voting_power_and_update() {
130127 )
131128 . unwrap ( ) ;
132129
130+ // move chain forward so we can update total staked on a new block
131+ app. increase_time ( 100 ) ;
132+
133133 // Update total power from bot via authz exec on behalf of DAO
134134 authz
135135 . exec (
You can’t perform that action at this time.
0 commit comments