Bloc API compile error


#1

I am trying to create contracts with SafeMath(OpenZeppelin).
I am getting following compile error when I upload code.

Error:

HttpError: 400 Bad Request: "(line 60, column 24):
unexpected "u"
expecting "SafeMath"": http://strato_nginx_1/bloc/v2.2/contracts/compile
at /opt/{productName}/node_modules/blockapps-rest/lib/rest_5.js:507:40
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Environment:

  • MacOS High Sierra 10.13.6
  • VScode 1.26.1
  • STRATO 4.0.0
  • Node.js v8.9.1
  • “openzeppelin-solidity”: “^1.12.0”
  • “blockapps-rest”: “git+https://github.com/blockapps/blockapps-rest.git”(latest)

solidity code:

pragma solidity ^0.4.24;

import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";

contract test {
    using SafeMath for uint256;

    mapping(address => uint256) balance;

    function mint(address _to, uint256 _value) public returns (bool) {
        balance[_to] = balance[_to].add(_value);
        return true;
    }
}

simplified nodejs code:

describe('upload contracts', function (){
  it('compile', function* () {
    yield forEach(contractList, function*(contract){
      const searchableArray  = [contract.name];
      yield rest.compileSearch(searchableArray, contract.name, contract.filename);
      txs.push({
        args: {},
        contractName: contract.name
      });
    });
  });

  it('upload', function* () {
    const response = yield rest.uploadContractList(user, txs);
    const addressesAreValid = response.reduce((result, contract) => {
      if(!result) {
        return result;
      }
      return result && util.isAddress(contract.address);
    }, true)
    assert.isOk(addressesAreValid, 'Should get back valid addresses');
  });
});

Thanks for the help.


#2

Hi @mgmg - it would be helpful to schedule a video call to review this collaboratively. Here’s a link to my calendar to schedule.


#3

Hi @eli Sorry. I’m not very used to speaking English.
Is there another way?


#4

@mgmg This is a bug and we are currently investigating. I’ll post again once we’ve solved it.