Search in sources :

Example 1 with BoolType

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

the class SolidityTypeTest method testBool.

@Test
public void testBool() throws Exception {
    byte[] params = new BoolType().encode(true);
    System.out.println(Hex.toHexString(params));
    AionTransaction tx = createTransaction(ByteUtil.merge(Hex.decode("e8dde232"), params));
    MiningBlock block = createDummyBlock();
    RepositoryCache repo = createRepository(tx);
    AionTxReceipt receipt = executeTransaction(tx, block, repo).getReceipt();
    System.out.println(receipt);
    assertArrayEquals(params, receipt.getTransactionOutput());
    assertEquals(Boolean.TRUE, new BoolType().decode(receipt.getTransactionOutput()));
}
Also used : BoolType(org.aion.solidity.SolidityType.BoolType) RepositoryCache(org.aion.base.db.RepositoryCache) AionTransaction(org.aion.base.AionTransaction) AionTxReceipt(org.aion.base.AionTxReceipt) 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 BoolType (org.aion.solidity.SolidityType.BoolType)1 MiningBlock (org.aion.zero.impl.types.MiningBlock)1 Test (org.junit.Test)1