77import static org .tron .protos .contract .Common .ResourceCode .BANDWIDTH ;
88import static org .tron .protos .contract .Common .ResourceCode .ENERGY ;
99
10+ import java .util .HashMap ;
11+ import java .util .Map ;
1012import java .util .Objects ;
1113import lombok .extern .slf4j .Slf4j ;
1214import org .tron .common .utils .DecodeUtil ;
1315import org .tron .common .utils .StringUtil ;
1416import org .tron .core .capsule .AccountCapsule ;
1517import org .tron .core .exception .ContractExeException ;
1618import org .tron .core .exception .ContractValidateException ;
19+ import org .tron .core .vm .VMConstant ;
1720import org .tron .core .vm .nativecontract .param .CancelAllUnfreezeV2Param ;
1821import org .tron .core .vm .repository .Repository ;
1922import org .tron .protos .Protocol ;
@@ -38,13 +41,17 @@ public void validate(CancelAllUnfreezeV2Param param, Repository repo) throws Con
3841 }
3942 }
4043
41- public long execute (CancelAllUnfreezeV2Param param , Repository repo ) throws ContractExeException {
44+ public Map <String , Long > execute (CancelAllUnfreezeV2Param param , Repository repo ) throws ContractExeException {
45+ Map <String , Long > result = new HashMap <>();
4246 byte [] ownerAddress = param .getOwnerAddress ();
4347 AccountCapsule ownerCapsule = repo .getAccount (ownerAddress );
4448 long now = repo .getDynamicPropertiesStore ().getLatestBlockHeaderTimestamp ();
4549 long withdrawExpireBalance = 0L ;
4650 for (Protocol .Account .UnFreezeV2 unFreezeV2 : ownerCapsule .getUnfrozenV2List ()) {
4751 if (unFreezeV2 .getUnfreezeExpireTime () > now ) {
52+ String resourceName = unFreezeV2 .getType ().name ();
53+ result .put (resourceName , result .getOrDefault (resourceName , 0L ) + unFreezeV2 .getUnfreezeAmount ());
54+
4855 updateFrozenInfoAndTotalResourceWeight (ownerCapsule , unFreezeV2 , repo );
4956 } else {
5057 // withdraw
@@ -57,7 +64,9 @@ public long execute(CancelAllUnfreezeV2Param param, Repository repo) throws Cont
5764 ownerCapsule .clearUnfrozenV2 ();
5865
5966 repo .updateAccount (ownerCapsule .createDbKey (), ownerCapsule );
60- return withdrawExpireBalance ;
67+
68+ result .put (VMConstant .WITHDRAW_EXPIRE_BALANCE , withdrawExpireBalance );
69+ return result ;
6170 }
6271
6372 public void updateFrozenInfoAndTotalResourceWeight (
0 commit comments