2016-11-04 5 views
2
내가 그 튜토리얼 블로그 게시물 여기 https://blog.topl.me/how-to-deploy-solidity/

배포 계약 사용 solcjs

다음 solcjs을 사용하여 계약을 구축하기 위해 노력하고있어

내가 실제로 스크립트를 실행할 때, 컴파일러는 저를 보내 지금 내 코드

const web3 = new Web3(); 
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545")); 


async function compileAndDeploy() { 
    let ambrosiaContract; 
    try { 
     let contract = await fs.readFileSync(path.join(__dirname, './Ambrosia.sol')); 
     let Ambrosia = contract.toString(); 
     let input = {}; 
     input[ path.join(__dirname, './Ambrosia.sol')] = Ambrosia; 

     console.log('> Compiling Storage'); 
     let output = solc.compile({sources: input}, 1); 

     console.log(output.contracts, output.formal); 
     ambrosiaContract = output.contracts['Ambrosia']; 
    } 
    catch (e) { 
     console.log(e); 
    } 
    console.log('deploying...') 
    let ambrosiaInstance = await deployStorage(ambrosiaContract) 
    console.log('...deployed at ' + ambrosiaInstance.address) 
} 

compileAndDeploy(); 

입니다 그 오류.

Error: Type "bytes32" not supported for state variable.\n mapping (address => bytes32) restaurants;\n

여기 내 계약 코드입니다.

pragma solidity ^0.4.4; 

contract Ambrosia { 

    mapping (address => bytes32) restaurants; 

    address _owner; 

    event Transfer(address indexed _from, address indexed _to, uint256 _value); // listen to that event whenever a transfer has been made.. 

    event Order(address indexed _from, address indexed _to, uint256 _value); // listen to that event whenever an order is triggered 

    function Ambrosia() { 
     _owner = msg.sender; 
    } 
} 

내가 solcjs 에러 나던 노드 클라이언트에 의존 버전 0.4.4 을 사용하고, 그것은

답변

1

이 오류는 견고 formal verification tool에서입니다 개발 네트워크 geth 및 JS-ETH와 함께 모두 발생합니다. 지금까지는 대부분의 Solidity 기능을 지원하지 않으므로 무시해도됩니다.

실제 컴파일 오류는 output.errors 배열로 반환됩니다. 일부 오타를 추가하여 실행 해보십시오.

const output = solc.compile({sources: input}, 1); 
console.log(output.errors);