Now, the ABI JSON generator generates the ABI for ContractManager as well, based on the contracts that are loaded on it. Also, we can pass the ContractTypes tuple in the generator now:
Old way (still supported if you just want to generate some ABI instead of all)
#include "contract/customcontracts.h"
int main() {
return ContractReflectionInterface::writeContractsToJson<ERC20, ERC20Wrapper, NativeWrapper>();
}
- New way:
```c++
#include "utils/jsonabi.h"
int main() {
return JsonAbi::writeContractsToJson<ContractTypes>(); //ContractTypes have all the developed dynamic contracts
}
A dynamic contract can call non-view functions from another contract without encoding data.
A dynamic contract can create another dynamic contract. You can have a function that creates another contract and retrieves it address:
...
//just pass the ContractType that you want to create, the caller address, gas value, gas price value, caller value an the contract constructor parameters
Address contract = this->callCreateContract<ERC20>(this->getContractAddress(), 0, 0, 0, "TestToken", "TST", 18, 1000000000000000000);
...
If we want to use a proper C++ return in a dynamic contract view function, we can just return the type, without encoding:
If we want to encode manually the return data, we need to use BytesEncoded type. BytesEncoded it's a wrapper for Bytes, this way, we can return pure Bytes or encoded Bytes:
Tasks
Description:
This PR basically change these points:
Now it's possible to implement functions that returns any ABI supported type;
Calling view functions from another contracts it's more simple now:
Old way (still supported)
New way (just pass address and function parameters)
int main() { return ContractReflectionInterface::writeContractsToJson<ERC20, ERC20Wrapper, NativeWrapper>(); }
Old way (DEPRECATED):
New way (just pass the address, the function that you want to call and its args)
A dynamic contract can create another dynamic contract. You can have a function that creates another contract and retrieves it address:
If we want to use a proper C++ return in a dynamic contract view function, we can just return the type, without encoding: