From 2354ebdbf5b41e11521b59d5b85a46c6aee2ef7a Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Fri, 5 Jan 2024 12:18:37 +0100 Subject: [PATCH] Add REAMDE --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 27c171a..9276939 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,38 @@ contract Example { } } ``` + +## Forge integration + +In order to use `forge`, you need to have a running `Suave` node and the `suave` binary in your path. + +To run `Suave` in development mode, use the following command: + +```bash +$ suave --suave.dev +``` + +Then, your `forge` scripts/test must import the `SuaveEnabled` contract from the `suave-std/Test.sol` file. + +``` +// SPDX-License-Identifier: Unlicense +pragma solidity ^0.8.13; + +import "forge-std/Test.sol"; +import "suave-std/Test.sol"; +import "suave-std/Suave.sol"; + +contract TestForge is Test, SuaveEnabled { + address[] public addressList = [0xC8df3686b4Afb2BB53e60EAe97EF043FE03Fb829]; + + function testConfidentialStore() public { + Suave.DataRecord memory record = Suave.newDataRecord(0, addressList, addressList, "namespace"); + + bytes memory value = abi.encode("suave works with forge!"); + Suave.confidentialStore(record.id, "key1", value); + + bytes memory found = Suave.confidentialRetrieve(record.id, "key1"); + assertEq(keccak256(found), keccak256(value)); + } +} +```