aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

Add BlockchainRuntime support to get contract balance #334

Closed aionick closed 5 years ago

aionick commented 5 years ago

Something along the lines of: BlockchainRuntime.getContractBalance() that returns the balance of "this" contract. Currently this same, quite common, logic has to be done in this roundabout way: BlockchainRuntime.getBalance(BlockchainRuntime.getAddress()).

aionick commented 5 years ago

This feature is implemented but while implementing it I've come across two bugs. The first is a small one - the ABI was encoding Address[] incorrectly, thinking it was expecting String[] instead at one portion of it, causing an exception to be thrown. This was easily fixed. The second one I am in the middle of investigating, but it seems that child dapp's are inherting the BlockchainRuntime of their parent.

aionick commented 5 years ago

I'm waiting to have #337 wrapped up and the testing I want in place, and once that's done it should also verify that these changes were correct, and I'll be able to add some more meaningful tests for this functionality as well.