@@ -407,7 +407,7 @@ public void suicide(DataWord obtainerAddress) {
407407 increaseNonce ();
408408
409409 addInternalTx (null , owner , obtainer , balance , null , "suicide" , nonce ,
410- getContractState ().getAccount (owner ).getAssetMap ());
410+ getContractState ().getAccount (owner ).getAssetV2Map ());
411411
412412 if (FastByteComparisons .compareTo (owner , 0 , 20 , obtainer , 0 , 20 ) == 0 ) {
413413 // if owner == obtainer just zeroing account according to Yellow Paper
@@ -620,6 +620,7 @@ public void callToAddress(MessageCall msg) {
620620 // 2.1 PERFORM THE VALUE (endowment) PART
621621 long endowment = msg .getEndowment ().value ().longValueExact ();
622622 // transfer trx validation
623+ byte [] tokenId = null ;
623624 if (msg .getTokenId () == null ) {
624625 long senderBalance = deposit .getBalance (senderAddress );
625626 if (senderBalance < endowment ) {
@@ -630,7 +631,8 @@ public void callToAddress(MessageCall msg) {
630631 }
631632 // transfer trc10 token validation
632633 else {
633- long senderBalance = deposit .getTokenBalance (senderAddress , msg .getTokenId ().getData ());
634+ tokenId = new DataWord (msg .getTokenId ().getData ()).shortHexWithoutZeroX ().getBytes ();
635+ long senderBalance = deposit .getTokenBalance (senderAddress , tokenId );
634636 if (senderBalance < endowment ) {
635637 stackPushZero ();
636638 refundEnergy (msg .getEnergy ().longValue (), "refund energy from message call" );
@@ -665,20 +667,20 @@ public void callToAddress(MessageCall msg) {
665667 } else {
666668 try {
667669 TransferAssetActuator .validateForSmartContract (deposit , senderAddress , contextAddress ,
668- msg . getTokenId (). getData () , endowment );
670+ tokenId , endowment );
669671 } catch (ContractValidateException e ) {
670672 throw new BytecodeExecutionException ("validateForSmartContract failure" );
671673 }
672- deposit .addTokenBalance (senderAddress , msg . getTokenId (). getData () , -endowment );
673- deposit .addTokenBalance (contextAddress , msg . getTokenId (). getData () , endowment );
674+ deposit .addTokenBalance (senderAddress , tokenId , -endowment );
675+ deposit .addTokenBalance (contextAddress , tokenId , endowment );
674676 }
675677 }
676678
677679 // CREATE CALL INTERNAL TRANSACTION
678680 increaseNonce ();
679681 HashMap <String , Long > tokenInfo = new HashMap <>();
680682 if (msg .getTokenId () != null ) {
681- tokenInfo .put (new String (stripLeadingZeroes (msg . getTokenId (). getData () )), endowment );
683+ tokenInfo .put (new String (stripLeadingZeroes (tokenId )), endowment );
682684 }
683685 InternalTransaction internalTx = addInternalTx (null , senderAddress , contextAddress ,
684686 msg .getTokenId () == null ? endowment : 0 , data , "call" , nonce ,
@@ -1289,13 +1291,15 @@ public void callToPrecompiledAddress(MessageCall msg,
12891291
12901292 long endowment = msg .getEndowment ().value ().longValueExact ();
12911293 long senderBalance = 0 ;
1294+ byte [] tokenId = null ;
12921295 // transfer trx validation
12931296 if (msg .getTokenId () == null ) {
12941297 senderBalance = deposit .getBalance (senderAddress );
12951298 }
12961299 // transfer trc10 token validation
12971300 else {
1298- senderBalance = deposit .getTokenBalance (senderAddress , msg .getTokenId ().getData ());
1301+ tokenId = new DataWord (msg .getTokenId ().getData ()).shortHexWithoutZeroX ().getBytes ();
1302+ senderBalance = deposit .getTokenBalance (senderAddress , tokenId );
12991303 }
13001304 if (senderBalance < endowment ) {
13011305 stackPushZero ();
@@ -1318,12 +1322,12 @@ public void callToPrecompiledAddress(MessageCall msg,
13181322 }
13191323 else {
13201324 try {
1321- TransferAssetActuator .validateForSmartContract (deposit ,senderAddress ,contextAddress , msg . getTokenId (). getData () , endowment );
1325+ TransferAssetActuator .validateForSmartContract (deposit ,senderAddress ,contextAddress , tokenId , endowment );
13221326 } catch (ContractValidateException e ) {
13231327 throw new BytecodeExecutionException ("validateForSmartContract failure" );
13241328 }
1325- deposit .addTokenBalance (senderAddress ,msg . getTokenId (). getData () ,-endowment );
1326- deposit .addTokenBalance (contextAddress , msg . getTokenId (). getData () , endowment );
1329+ deposit .addTokenBalance (senderAddress ,tokenId ,-endowment );
1330+ deposit .addTokenBalance (contextAddress , tokenId , endowment );
13271331 }
13281332 }
13291333
0 commit comments