smartcontractkit / truffle-starter-kit

An example smart contract utilizing Chainlink
MIT License
264 stars 102 forks source link

fund-contract script returns non-zero exit code under truffle exec even when it succeeds #63

Closed galenmarchetti closed 3 years ago

galenmarchetti commented 3 years ago

When running ./scripts/fund-contract.js using truffle exec, the transaction is returned to the callback function where an error is supposed to be returned. This means that the script is reporting an error even under successful execution, example:

/chainlink # truffle exec scripts/fund-contract.js --network cldev
Using network 'cldev'.

Funding contract: 0xa8B323695d987DdE23F63e6B4500FBc84Cd3cd4e
0x3d210eb43710fe4d777a08d871bde9f7bf63b95014c346275a1d203693f2afd9
Truffle v5.2.3 (core: 5.2.3)
Node v10.24.0
/chainlink # echo $?
1

Line 20 here: https://github.com/smartcontractkit/box/blob/master/scripts/fund-contract.js#L20 uses the callback function to return a transaction ID, although according to https://www.trufflesuite.com/docs/truffle/getting-started/writing-external-scripts this should be used for error reporting

PatrickAlphaC commented 3 years ago

Hmmm. Sounds like you're suggesting an if statement in there instead of just reporting the transaction receipt?

PatrickAlphaC commented 3 years ago

Going to close for now