use of org.aion.solidity.Compiler.Result in project aion by aionnetwork.
the class SolidityTypeTest method createRepository.
private RepositoryCache createRepository(AionTransaction tx) throws IOException {
Result r = Compiler.getInstance().compile(ContractUtils.readContract("SolidityType.sol"), Options.BIN);
CompilationResult cr = CompilationResult.parse(r.output);
String deployer = cr.contracts.get("SolidityType").bin;
String contract = deployer.substring(deployer.indexOf("60506040", 1));
AionRepositoryImpl repo = blockchain.getRepository();
RepositoryCache track = repo.startTracking();
track.addBalance(tx.getSenderAddress(), BigInteger.valueOf(tx.getEnergyPrice()).multiply(BigInteger.valueOf(500_000L)));
track.createAccount(tx.getDestinationAddress());
track.saveCode(tx.getDestinationAddress(), Hex.decode(contract));
track.saveVmType(tx.getDestinationAddress(), InternalVmType.FVM);
track.flushTo(repo, true);
return track;
}
Aggregations