@@ -925,7 +925,7 @@ func TestERC721NFTs(t *testing.T) {
925
925
tx := blockTxs [0 ]
926
926
receipt := env .evmChain .TransactionReceipt (tx .Hash ())
927
927
require .Len (t , receipt .Logs , 1 )
928
- checkTransferEvent (
928
+ checkTransferEventERC721 (
929
929
t ,
930
930
receipt .Logs [0 ],
931
931
iscmagic .ERC721NFTsAddress ,
@@ -1054,7 +1054,7 @@ func TestERC721NFTCollection(t *testing.T) {
1054
1054
tx := blockTxs [0 ]
1055
1055
receipt := env .evmChain .TransactionReceipt (tx .Hash ())
1056
1056
require .Len (t , receipt .Logs , 1 )
1057
- checkTransferEvent (
1057
+ checkTransferEventERC721 (
1058
1058
t ,
1059
1059
receipt .Logs [0 ],
1060
1060
iscmagic .ERC721NFTCollectionAddress (collection .ID ),
@@ -1371,22 +1371,27 @@ func TestERC20BaseTokens(t *testing.T) {
1371
1371
}
1372
1372
}
1373
1373
1374
- func checkTransferEvent (
1374
+ func checkTransferEventERC721 (
1375
1375
t * testing.T ,
1376
1376
log * types.Log ,
1377
1377
contractAddress , to common.Address ,
1378
1378
uint256Data * big.Int ,
1379
1379
) {
1380
1380
require .Equal (t , contractAddress , log .Address )
1381
1381
1382
- require .Len (t , log .Topics , 3 )
1382
+ require .Len (t , log .Topics , 4 )
1383
1383
require .Equal (t , crypto .Keccak256Hash ([]byte ("Transfer(address,address,uint256)" )), log .Topics [0 ])
1384
1384
var addrTopic common.Hash
1385
1385
copy (addrTopic [len (addrTopic )- len (to ):], to [:])
1386
1386
require .Equal (t , addrTopic , log .Topics [2 ])
1387
1387
1388
- data := lo .Must ((abi.Arguments {{Type : lo .Must (abi .NewType ("uint256" , "" , nil ))}}).Unpack (log .Data ))[0 ].(* big.Int )
1389
- require .Zero (t , uint256Data .Cmp (data ))
1388
+ tokenIDTopicBytes := make ([]byte , common .HashLength )
1389
+ copy (tokenIDTopicBytes , log .Topics [3 ][:])
1390
+
1391
+ tokenID := lo .Must ((abi.Arguments {{Type : lo .Must (abi .NewType ("uint256" , "" , nil ))}}).Unpack (tokenIDTopicBytes ))[0 ].(* big.Int )
1392
+ require .Zero (t , uint256Data .Cmp (tokenID ))
1393
+
1394
+ require .Empty (t , log .Data )
1390
1395
}
1391
1396
1392
1397
func TestERC20NativeTokens (t * testing.T ) {
@@ -1432,7 +1437,7 @@ func TestERC20NativeTokens(t *testing.T) {
1432
1437
tx := blockTxs [0 ]
1433
1438
receipt := env .evmChain .TransactionReceipt (tx .Hash ())
1434
1439
require .Len (t , receipt .Logs , 1 )
1435
- checkTransferEvent (
1440
+ checkTransferEventERC20 (
1436
1441
t ,
1437
1442
receipt .Logs [0 ],
1438
1443
iscmagic .ERC20NativeTokensAddress (foundrySN ),
@@ -1461,6 +1466,24 @@ func TestERC20NativeTokens(t *testing.T) {
1461
1466
)
1462
1467
}
1463
1468
1469
+ func checkTransferEventERC20 (
1470
+ t * testing.T ,
1471
+ log * types.Log ,
1472
+ contractAddress , to common.Address ,
1473
+ uint256Data * big.Int ,
1474
+ ) {
1475
+ require .Equal (t , contractAddress , log .Address )
1476
+
1477
+ require .Len (t , log .Topics , 3 )
1478
+ require .Equal (t , crypto .Keccak256Hash ([]byte ("Transfer(address,address,uint256)" )), log .Topics [0 ])
1479
+ var addrTopic common.Hash
1480
+ copy (addrTopic [len (addrTopic )- len (to ):], to [:])
1481
+ require .Equal (t , addrTopic , log .Topics [2 ])
1482
+
1483
+ data := lo .Must ((abi.Arguments {{Type : lo .Must (abi .NewType ("uint256" , "" , nil ))}}).Unpack (log .Data ))[0 ].(* big.Int )
1484
+ require .Zero (t , uint256Data .Cmp (data ))
1485
+ }
1486
+
1464
1487
// helper to make sandbox calls via EVM in a more readable way
1465
1488
func sandboxCall (t * testing.T , wallet * ecdsa.PrivateKey , sandboxContract * IscContractInstance , contract isc.Hname , entrypoint isc.Hname , params dict.Dict , allowance uint64 ) {
1466
1489
evmParams := & iscmagic.ISCDict {}
0 commit comments