Search in sources :

Example 1 with AddressType

use of org.aion.solidity.SolidityType.AddressType in project aion by aionnetwork.

the class SolidityTypeTest method testAddress.

@Test
public void testAddress() throws Exception {
    byte[] x = Hex.decode("1122334455667788112233445566778811223344556677881122334455667788");
    byte[] params = new AddressType().encode(x);
    System.out.println(Hex.toHexString(params));
    AionTransaction tx = createTransaction(ByteUtil.merge(Hex.decode("42f45790"), params));
    MiningBlock block = createDummyBlock();
    RepositoryCache repo = createRepository(tx);
    AionTxReceipt receipt = executeTransaction(tx, block, repo).getReceipt();
    System.out.println(receipt);
    assertArrayEquals(params, receipt.getTransactionOutput());
    assertArrayEquals(x, (byte[]) new AddressType().decode(receipt.getTransactionOutput()));
}
Also used : RepositoryCache(org.aion.base.db.RepositoryCache) AionTransaction(org.aion.base.AionTransaction) AionTxReceipt(org.aion.base.AionTxReceipt) AddressType(org.aion.solidity.SolidityType.AddressType) MiningBlock(org.aion.zero.impl.types.MiningBlock) Test(org.junit.Test)

Aggregations

AionTransaction (org.aion.base.AionTransaction)1 AionTxReceipt (org.aion.base.AionTxReceipt)1 RepositoryCache (org.aion.base.db.RepositoryCache)1 AddressType (org.aion.solidity.SolidityType.AddressType)1 MiningBlock (org.aion.zero.impl.types.MiningBlock)1 Test (org.junit.Test)1