Search in sources :

Example 1 with EthModuleSolidityEnabled

use of co.rsk.rpc.modules.eth.EthModuleSolidityEnabled in project rskj by rsksmart.

the class Web3ImplTest method eth_compileSolidity.

@Test
@Ignore
public void eth_compileSolidity() throws Exception {
    RskSystemProperties systemProperties = Mockito.mock(RskSystemProperties.class);
    String solc = System.getProperty("solc");
    if (StringUtils.isEmpty(solc))
        solc = "/usr/bin/solc";
    Mockito.when(systemProperties.customSolcPath()).thenReturn(solc);
    Ethereum eth = Mockito.mock(Ethereum.class);
    EthModule ethModule = new EthModule(config, null, null, new ExecutionBlockRetriever(null, null, null), new EthModuleSolidityEnabled(new SolidityCompiler(systemProperties)), null);
    PersonalModule personalModule = new PersonalModuleWalletDisabled();
    TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
    Web3Impl web3 = new Web3RskImpl(eth, null, null, systemProperties, null, null, personalModule, ethModule, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, null, null, null, null, null, null);
    String contract = "pragma solidity ^0.4.1; contract rsk { function multiply(uint a) returns(uint d) {   return a * 7;   } }";
    Map<String, CompilationResultDTO> result = web3.eth_compileSolidity(contract);
    org.junit.Assert.assertNotNull(result);
    CompilationResultDTO dto = result.get("rsk");
    if (dto == null)
        dto = result.get("<stdin>:rsk");
    org.junit.Assert.assertEquals(contract, dto.info.getSource());
}
Also used : Web3RskImpl(co.rsk.rpc.Web3RskImpl) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) PersonalModuleWalletDisabled(co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled) SolidityCompiler(org.ethereum.solidity.compiler.SolidityCompiler) EthModuleSolidityEnabled(co.rsk.rpc.modules.eth.EthModuleSolidityEnabled) CompilationResultDTO(org.ethereum.rpc.dto.CompilationResultDTO) Ethereum(org.ethereum.facade.Ethereum) EthModule(co.rsk.rpc.modules.eth.EthModule) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) RskSystemProperties(co.rsk.config.RskSystemProperties) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

RskSystemProperties (co.rsk.config.RskSystemProperties)1 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)1 Web3RskImpl (co.rsk.rpc.Web3RskImpl)1 EthModule (co.rsk.rpc.modules.eth.EthModule)1 EthModuleSolidityEnabled (co.rsk.rpc.modules.eth.EthModuleSolidityEnabled)1 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)1 PersonalModuleWalletDisabled (co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled)1 TxPoolModule (co.rsk.rpc.modules.txpool.TxPoolModule)1 TxPoolModuleImpl (co.rsk.rpc.modules.txpool.TxPoolModuleImpl)1 Ethereum (org.ethereum.facade.Ethereum)1 CompilationResultDTO (org.ethereum.rpc.dto.CompilationResultDTO)1 SolidityCompiler (org.ethereum.solidity.compiler.SolidityCompiler)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1