This package includes smart contracts required to run the ACP Demo. This builds on smart contracts at the ASM Core Protocol repo.
This will be used as an ASTO faucet on test networks. The Mock ASTO contract allows users to freely mint ERC20 tokens.
This will be used as an ASM Brain faucet on test networks. The Mock Brains contract allows users to freely mint ERC721 tokens. The tokenURI will point to the same metadata location as Gen II Brains.
The Challenge contract will enable users to created paid contests between other users.
- foundry must be installed
Retrieve git submodules:
forge install
Build contracts:
forge build
Generate ABI:
forge inspect MockASTO abi >> abi/MockASTO.json
forge inspect MockBrain abi >> abi/MockBrain.json
forge inspect PongMemoryTree abi >> abi/PongMemoryTree.json
forge inspect PongComputeManager abi >> abi/PongComputeManager.json
forge inspect Challenge abi >> abi/Challenge.json
forge test -vvv
To use the Futuverse's protocol you will need:
- ASTO tokens, to pay for the use of the protocol
- Connectiob to the ROOT blockchain testnet
- XRP tokens to pay gas for transactions
- Your set of (studio) contracts which can connect to the protocol
Copy the .env.example
file to .env
and fill in the required values.
-
Rename
.env.example
to.env
cp .env.example .env
-
Use your wallet to get some XRP from the faucet
-
Add your wallet to the config
.env
, as aDEPLOYER
andDEPLOYER_PK
Note: Dummy values (private key and public address) for all accounts for the local test version have been provided. Do not use them for your real projects.
Check everything works fine by mocking deployment to the local blockchain:
-
Start local node by running
yarn node:local
or anvil in the terminal. -
In another terminal window run command:
yarn deploy:local
This will deploy all contracts.
You can deploy just one contract, by specifying the tag of the contract to deploy (see scripts in the /deploy/
folder), e.g. yarn deploy:local --tags PongMemoryTree
By "prod" we mean Porcini network, which is still a testnet for the Root network.
yarn deploy:porcini
This will deploy all contracts.
You can deploy just one contract, by specifying the tag of the contract to deploy (see scripts in the /deploy/
folder), e.g. yarn deploy:porcini --tags PongMemoryTree
For the following scripts update the --network
param as needed.
We have bunch of scripts for you (see /scripts
folder) to communicate with contracts:
mt-set-signer
- to change the signer addressmt-get-tree
- get details of the specific memory treemt-add-tree
- to add a new tree (requires a signature, see below)mt-add-node
- to add a new node to the tree (also requires a signature)gen-signature -
to generate signature to add a tree or nodecrm-request-compute
- to create a new compute request for a training (for the user)crm-revoke-compute
- to cancel it (for the user)crm-complete-compute
- to mark request as finished (for the studio)crm-view-request
- to get details of the open compute request
To use the script run in the terminal:
yarn ${script_name} --network ${network_name} [--param value]
Here is the list of params for scripts:
- mt-set-signer
signer
- new signer (address)
- mt-get-tree
id
- Tree ID (number)
- mt-add-tree
brain
- Brain contract (address)id
- Brain token ID (number)studio
- Studio ID (name)storage
- Storage URI (string)signature
- Signature (string of bytes, e.g.0x102eb376350ab0166e8be170e7d6abadb282a62a62ca470986b254fb64a20b6066b33722e8892445aefa315fa56e020e20f6a5196629b8c929d487f8f252dedc1b
)
- mt-add-node
id
- Parent node ID (number)studio
- Studio ID (string)storage
- Storage URI (string)signature
- Signature (string of bytes, e.g.0x102eb376350ab0166e8be170e7d6abadb282a62a62ca470986b254fb64a20b6066b33722e8892445aefa315fa56e020e20f6a5196629b8c929d487f8f252dedc1b
)
- gen-signature
type
- Type to add (node
ortree
)brain
- [OPTIONAL] Address of the Brain contractid
- Parent node ID or Brain token id (number)studio
- Studio ID (string)storage
- Storage URI (string)
- crm-request-compute
option
- Option ID (number)units
- Units to spend (number)studio
- Studio identifier (string)
- crm-revoke-compute
id
- Compute request ID (number)
- crm-complete-compute
id
- Compute request ID (number)
- crm-view-request
id
- Compute request ID (number)