@@ -15,7 +15,7 @@ func (k msgServer) AllocationUpdate(goCtx context.Context, msg *types.MsgAllocat
1515 // indexer for UI requirements
1616 k .AddressEmitActivity (ctx , msg .Creator )
1717
18- allocation , allocationFound := k .GetAllocation (ctx , msg .AllocationId )
18+ allocation , allocationFound := cc .GetAllocation (msg .AllocationId )
1919 if (! allocationFound ) {
2020 return & types.MsgAllocationUpdateResponse {}, types .NewObjectNotFoundError ("allocation" , msg .AllocationId )
2121 }
@@ -25,33 +25,33 @@ func (k msgServer) AllocationUpdate(goCtx context.Context, msg *types.MsgAllocat
2525 return & types.MsgAllocationUpdateResponse {}, types .NewPlayerRequiredError (msg .Creator , "allocation_update" )
2626 }
2727
28- sourceObjectPermissionId := GetObjectPermissionIDBytes (allocation .SourceObjectId , player .PlayerId )
28+ sourceObjectPermissionId := GetObjectPermissionIDBytes (allocation .GetAllocation (). SourceObjectId , player .GetPlayerId () )
2929 addressPermissionId := GetAddressPermissionIDBytes (msg .Creator )
3030
3131 // Ignore the one case where it's a player creating an allocation on themselves.
3232 // Surely that doesn't need a lookup.
33- if (player .PlayerId != allocation .SourceObjectId ) {
33+ if (player .GetPlayerId () != allocation . GetAllocation () .SourceObjectId ) {
3434 // check that the player has permissions
35- if (! k .PermissionHasOneOf (ctx , sourceObjectPermissionId , types .PermissionAssets )) {
36- return & types.MsgAllocationUpdateResponse {}, types .NewPermissionError ("player" , player .PlayerId , "allocation" , allocation .SourceObjectId , uint64 (types .PermissionAssets ), "allocation_update" )
35+ if (! cc .PermissionHasOneOf (sourceObjectPermissionId , types .PermissionAssets )) {
36+ return & types.MsgAllocationUpdateResponse {}, types .NewPermissionError ("player" , player .GetPlayerId () , "allocation" , allocation . GetAllocation () .SourceObjectId , uint64 (types .PermissionAssets ), "allocation_update" )
3737 }
3838 }
3939
4040 // check that the account has energy management permissions
41- if (! k .PermissionHasOneOf (ctx , addressPermissionId , types .Permission (types .PermissionAssets ))) {
41+ if (! cc .PermissionHasOneOf (addressPermissionId , types .Permission (types .PermissionAssets ))) {
4242 return & types.MsgAllocationUpdateResponse {}, types .NewPermissionError ("address" , msg .Creator , "" , "" , uint64 (types .PermissionAssets ), "energy_management" )
4343 }
4444
4545
46- if (allocation .Type != types .AllocationType_dynamic ) {
47- return & types.MsgAllocationUpdateResponse {}, types .NewAllocationError (allocation .SourceObjectId , "immutable_type" ).WithFieldChange ("type" , allocation .Type .String (), "dynamic" )
46+ if (allocation .GetAllocation (). Type != types .AllocationType_dynamic ) {
47+ return & types.MsgAllocationUpdateResponse {}, types .NewAllocationError (allocation .GetAllocation (). SourceObjectId , "immutable_type" ).WithFieldChange ("type" , allocation . GetAllocation () .Type .String (), "dynamic" )
4848 }
4949
5050 if (msg .Power == 0 ) {
5151 return & types.MsgAllocationUpdateResponse {}, types .NewParameterValidationError ("power" , 0 , "below_minimum" ).WithRange (1 , 0 )
5252 }
5353
54- allocation , _ , err = k . SetAllocation ( ctx , allocation , msg .Power )
54+ allocation . SetDynamicPower ( msg .Power )
5555
5656 return & types.MsgAllocationUpdateResponse {
5757 AllocationId : msg .AllocationId ,
0 commit comments