Closed fulldecent closed 5 years ago
Call site code and storage were separated out in https://github.com/fulldecent/aion-aip040/commit/b2ae784f0104c43b76d6a8c8c760286cca67312f.
Current code is organized as:
@Callable
s in one file" is enforced. Is this good or should the @Callable
s be separated into the different files?Requesting help: @Jeff-aion @jennijuju
Reviewed with team and agreed that this is the approach to use.
Motivation
Most new contributors to Aion will start directly by copy-pasting the code here or from another real world example reference project. To help these people, this project should be of the highest quality possible and also make references to all relevant areas where somebody might want to learn more.
Issue
Previously this was written as a combined interface + reference implementation + mock + test mock, that's bad. Now it is spread out to multiple files.
Instead, the interface (AIP040) should be separate from the reference implementation (nf-token.java) and the mock (nf-token-test-mock.java).
This is handled beautifully in 0xcert's reference implementation of non-fungible tokens on EVM:
Reference: https://github.com/0xcert/ethereum-erc721/tree/master/src/contracts/tokens https://github.com/0xcert/ethereum-erc721/tree/master/src/tests/mocks
We should decide how to implement this code modularity in a Java-friendly way. Perhaps an interface with default function implementations will be preferred.
Other notes:
isOwnable
anderc721
andpassable
. We should find how to support this extremely common use case. And interfaces may support this.