Greetings Hans,
So far My progress looks like this:
I found the regexp that matches and sends back the contract code to further send it to the compiler server aeproject/aeproject-utils.js at 2c015c5c23205ee0fd90e180bf649cb71f79b8a9 · aeternity/aeproject · GitHub
let rgx = /^include\s+\"([\d\w\/\.\-\_]+)\"/gmi;
let dependencyPathRgx = /"([\d\w\/\.\-\_]+)\"/gmi;
const mainContractsPathRgx = /.*\//g;
let match;
it looks like the file system misses its above two contracts declaration OracleConnector
and OracleAddressResolver
when logging the result of MyContract
Below is the body of my contract aeproject/aeproject-utils.js at 2c015c5c23205ee0fd90e180bf649cb71f79b8a9 · aeternity/aeproject · GitHub
the options part is at line 215
(Above the assigning body) formed by getDependencies
aeproject/aeproject-utils.js at 2c015c5c23205ee0fd90e180bf649cb71f79b8a9 · aeternity/aeproject · GitHub
{
code: 'include "./libs/Say.aes"\n' +
'contract MyContract =\n' +
' public entrypoint plus() : address =\n' +
' Say.getOracleAddress()\n' +
' ',
options: {
file_system: {
'./libs/Say.aes': 'namespace Say =\n' +
' public function getOracleAddress() : address =\n' +
' let ar : OracleAddressResolver = ct_xRAL2ZaqffbTAeQrAunrR8jxdg9YbJvuEnFFJC8g8oW4LJ7Um\n' +
' ar.getAddress()\n' +
' \n' +
'\n' +
'contract Boolean =\n' +
' record boolean = {\n' +
' ok: bool\n' +
' }'
}
}
}
While trying, I guessed that if it was reading dependency (from getDependencies
) it start from the word namespace
instead of the file beginning, (Why ? I am sorry but due to hackathon period I am in hurry to complete my submission so will not investigate further on, maybe later if I get some time). So i created a dummy namespace on top of the file so it can work inside the aeproject till we find the fix.
Before ====>
dependencies ===>>
{
'./libs/Say.aes': 'namespace Say =\n' +
' public function getOracleAddress() : address =\n' +
' let ar : OracleAddressResolver = ct_xRAL2ZaqffbTAeQrAunrR8jxdg9YbJvuEnFFJC8g8oW4LJ7Um\n' +
' ar.getAddress()\n' +
' \n' +
'\n' +
'contract Boolean =\n' +
' record boolean = {\n' +
' ok: bool\n' +
' }'
}
After ====>
dependencies ===>>
{
'./libs/Say.aes': 'namespace Saydummy =\n' +
' public function dummy() : bool =\n' +
' true\n' +
'contract OracleConnector =\n' +
' entrypoint createOracle : (bytes(32), int, int) => bool\n' +
' entrypoint query: (string) => bytes(32)\n' +
' entrypoint canCallBack: () => bool\n' +
'\n' +
'contract OracleAddressResolver =\n' +
' entrypoint getAddress : () => address\n' +
'namespace Say =\n' +
' public function getOracleAddress() : address =\n' +
' let ar : OracleAddressResolver = ct_xRAL2ZaqffbTAeQrAunrR8jxdg9YbJvuEnFFJC8g8oW4LJ7Um\n' +
' ar.getAddress()\n' +
' \n' +
'\n' +
'contract Boolean =\n' +
' record boolean = {\n' +
' ok: bool\n' +
' }'
}
Thank you @hanssv.chain for helping it giving the idea of possible cause and @ae-omar for bringing it in the session and @nikitafuchs.chain for giving an idea of possible cause as regex.
Compiled MyContract.aes
from aeproject
Contract '/home/ubuntu/aeternity-projects/oracles/contracts/MyContract.aes has been successfully compiled'
Contract bytecode: "cb_+MVGA6C9SmcMAIbrlS39WZddoIu1//P1XLfHgvB0jLrRDQYBO8C4mLhh/kTWRB8ANwA3ABoOgj8BAz/+Zy/fMgA3AEcABAMR0EeEMP7QR4QwAjcARwAMAwAMA58CoH3UgO91P+ZiM+Nw/pkFWa+cPpOCMuFYIloQKNBCk1iJAwD8ES3nTmI3AEcAALEvAxFE1kQfEWluaXQRZy/fMhFwbHVzEdBHhDBVLlNheS5nZXRPcmFjbGVBZGRyZXNzgi8AhTQuMS4wAObWR5M="