How do I upload contract that is importing another contract in Strato


#1

I am trying to figure out how will I go about uploading a contract that is importing two other contracts from different folders in Strato.


Linking libraries to contracts
#2

Hi Suchit, are you trying to upload this via the bloc api or with the management GUI?


#3

Strato management GUI


#4

I tried adding all contracts in one file but then Strato GUI won’t recognize that file.


#5

Hmmm, I think that should work. Trying it now


#6

@suchit, do you have an example for us that we can test?


#7

It won’t recognize it.

here is the link to the contract that I am trying to compile:
Token contract

This same contract works when I compile it on Remix using Web3


#8

The issue is that your contracts fail to compile. The two issues I found were

  1. The events are declared twice. Once in the interface and then again in the DKYToken contract
  2. The code is using require, which is defined in solidity 0.4.10 I think. Strato supports solidity 0.4.8.

The best way to check if your contract will compile or not is to use remix, with the compiler version set to solidity 0.4.8. You can find this at https://remix.ethereum.org/#version=soljson-v0.4.8+commit.60cc1668.js

We are working on improving the dashboard, so that it gives you better feedback when you have errors in your contract.


#9

Thanks for clarifying the versioning part. When I uploaded this contract https://github.com/suchitgupta60/temp/blob/master/MultipleContracts.sol

Strato GUI recognized it but after I submit the contract…there is nowhere I can see it.

This is after create contract, as you can see there no contract published in the background.

I am uploading same contract using Bloc API and compiles successfully but management dashboard doesn’t reflect anything.

Here is the link to the dashboard
http://example.eastus.cloudapp.azure.com/dashboard/


#10

Try uploading without the pragma directive


#11

It did not work…What else you suggest?


#12

I was able to download https://raw.githubusercontent.com/suchitgupta60/temp/master/MultipleContracts.sol, save it to a file called Caller.sol and then upload it successfully to a local instance after removing the pragma statement.


#13

It worked! I had to recreated a new instance in azure and the same contract compiled successfully. If the two contracts were in two different files and not one…how do I go about compiling them?


#14

If there are dependencies, they all need to be part of the same file.


#15

@samrit how did you make it work with the supply chain demo app, which creates all separate contracts? thanks.


#16

@samrit I would also be curious to know more about the restrictions

E.g., is it possible that “dependencies” you mean abstract types. I tried to upload two files were one was an abstract definition and the other was the actual implementation, but the upload did not work, since the smart contract could not be compiled.