The @arianee/contracts repository houses the smart contracts that drive the Arianee Protocol—a decentralized, open-source solution for creating tokenized digital product passports. While these contracts are central to the protocol, they represent only part of its broader infrastructure. Built on a multi-EVM foundation, the protocol empowers brands to manage product identities, track lifecycle events, and directly engage with product owners.
- Events Timestamping: Enriching NFT metadata throughout its lifecycle allows the NFT to evolve alongside the customer journey, ideal for applications like e-maintenance booklets.
- Decentralized Messaging: Enabling secure, zero-party data exchanges between brands and consumers through on-chain mechanisms.
- Privacy: Protecting brands off and on-chain data through zero-knowledge proofs and other privacy-enhancing technologies.
- Transfer Permit: A Smart Asset Sharing Token that delegates marketplace rights for seamless digital product passport transfers post-sale, enhancing transaction fluidity for sellers, buyers, and marketplaces alike.
- Arianee Website: https://arianee.com
- Arianee Protocol: https://arianee.org
- Arianee Documentation: https://docs.arianee.org
- Foundry: https://book.getfoundry.sh
In July 2024, a comprehensive audit of the circuits was conducted by Veridise to ensure the security and integrity of our privacy protocol. The full audit report is available in the repository for detailed insights and findings.
You can access the reports by following the links below:
To install the project, run the following commands:
# Install Node dependencies
$ npm install
# Install Forge dependencies
$ forge install
# Install JQ
$ brew install jq
To build the project, run the following command:
$ forge build
To format the code, run the following command:
$ forge fmt
To run the tests, use the following commands:
# Run the tests that end with `.t.sol`
$ npm run test
# Run the tests that end with `.t.p.sol` along with a prover server
$ npm run test:prover
If you want to run the tests against a specific chain fork, you can use the following commands:
$ npm run test -- --fork-url <rpc_url>
$ npm run test:prover -- --fork-url <rpc_url>
To run a script, do the following:
- Change directory to the
scripts
folder - For the script of your choice, create a new
Config/<chain_id>_<script_name>.env
file based on the provided template - Run the command below
$ npm run script <chain_id> <script_name>
For example, to deploy the base contracts of the Arianee Protocol on Etherlink Testnet (chain ID: 128123), use the following commands:
$ cd scripts
$ cp DeployBaseScript.env.example 128123_DeployBaseScript.env
# Update the `128123_DeployBaseScript.env` file with the required values
$ npm run script 128123 DeployBaseScript
# You will find an Arianee convention file generated by the script at `convention/128123.json`
More information about Solidity Scripting can be found here.
Once you have deployed the contracts using a Solidity script, a "run" file will be generated in the broadcast/<script_name>.sol/<chain_id>
directory.
Identify the "run" file for the deployment you want to verify and use the following command:
Only the --file
flag is required. The other flags are optional.
$ npm run verify -- --file <path_to_broadcast_json> [--tx-index <transaction_index>] [--verifier <verifier>] [--verifier-url <verifier-url>] [--compiler-version <compiler-version>] [--optimizer-runs <runs>] [--via-ir <true|false>] [--evm-version <version>] [--debug]
To generate contracts ABIs run the following command:
Be careful when running this command, as it will overwrite the existing ABIs matching the same path.
# npm run gen:abi <path_to_contracts>
$ npm run gen:abi src/V0
It will generate ABIs for contracts matching <path_to_contracts>
under the abi
directory.
To check new ABIs versions compatibility against legacy (or any other) versions, you can use the following command:
# ./abi-diff.sh <legacy_abi_json_path> <new_abi_json_path>
$ ./abi-diff.sh abi/Legacy/ArianeeCreditHistory.json abi/V0/ArianeeStore/ArianeeCreditHistory.json
It will output the differences between the two ABIs.
To run an anvil node (local testnet shipped with Foundry), use the following command:
$ anvil
More information on Anvil can be found here.
Cast is Foundry’s command-line tool for performing Ethereum RPC calls. You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!
To use Cast, run the cast command followed by a subcommand:
$ cast <subcommand>
For example, to call the hasRole
function of the ArianeeSmartAsset
contract, use the following command:
# cast call <contract_address> <function_sig> <function_args> --rpc-url <rpc_url>
$ cast call 0x5DD0E406D5198bad00C3833386a46ED37537d3f0 "hasRole(bytes32,address)(bool)" $(cast keccak ROLE_ARIANEE_STORE) 0x4e3f6D606305c3E057D1B11a347C75A915ab17D1 --rpc-url https://etherlink-testnet-fakeprevrandao.arianee.workers.dev
For example, to send a grantRole
transaction to the ArianeeSmartAsset
contract, use the following command:
# cast send <contract_address> <function_sig> <function_args> --rpc-url <rpc_url> --private-key <private_key>
$ cast send 0x5DD0E406D5198bad00C3833386a46ED37537d3f0 "grantRole(bytes32,address)" $(cast keccak ROLE_ARIANEE_STORE) 0x4e3f6D606305c3E057D1B11a347C75A915ab17D1 --rpc-url https://etherlink-testnet-fakeprevrandao.arianee.workers.dev --private-key 0x123
# cast index-erc7201 <namespace>
$ cast index-erc7201 arianeewhitelist.storage.v0
More information about Cast can be found here.
$ forge --help
$ anvil --help
$ cast --help