Spring Boot Web3j/EVM interface for the Gnosis Safe contracts.
The Spring Boot web application provides Enterprise-grade User-, Rights- and Rolesmanagement, Authentication & Access Control.
All Gnosis-Safe relevant actions are delegated to the Smart Contract by web3j.
- Java 11+
- Maven 3+
- Build with
mvnw
- Install Hardhat
- Run
npx hardhat node
with mnemonic test test test test test test test test test test test junk (in.env
)
- Start with
mvnw spring-boot:run
For the complete API see ... on the locally running application.
Note: All steps described here are included in the REST test file, see 'Testing the Gnosis Safe API with VSCode'
The setup steps are not necessary for the core functionality.
Gnosis Safe and Token with allowance for the Safe can also be deployed separately.
POST http://localhost:8888/api/deploySafe HTTP/1.1
content-type: application/json
@safeAddress = {{safeDto.response.body.address}}
POST http://localhost:8888/api/deploySampleToken?gnosisSafeAddress={{safeAddress}}&value=100 HTTP/1.1
content-type: application/json
@tokenAddress = {{tokenDto.response.body.address}}
GET http://localhost:8888/api/createKey?seed=seedX HTTP/1.1
@ownerAddressX = {{keyDto.response.body.addressHex}}
PATCH http://localhost:8888/api/setupSafe HTTP/1.1
content-type: application/json
{
"safeAddress": "{{safeAddress}}",
"owners": [
"{{ownerAddress1}}",
"{{ownerAddress2}}",
"{{ownerAddress3}}"
],
"threshold": 2
}
Sign a transfer of 10 Tokens.
GET http://localhost:8888/api/signTransaction?seed=seed1&gnosisSafeAddress={{safeAddress}}&tokenAddress={{tokenAddress}}&to=0x0000000000000000000000000000000000000001&value=10
@signature1 = {{signatureDto1.response.body.signature}}
GET http://localhost:8888/api/sendTransaction?gnosisSafeAddress={{safeAddress}}&tokenAddress={{tokenAddress}}&to=0x0000000000000000000000000000000000000001&value=10&addressAndSignature={{ownerAddress1}};{{signature1}},{{ownerAddress2}};{{signature2}}
All the steps above are included in the safe-script.http
file in root directory.
To execute the tests, VS Code must be installed with the REST plugin.
- Clone gnosis-safe project to folder
${gnosis.git}/contracts
- Install remixd-server
- Start remixd-server with folder
${gnosis.git}/contracts
and URL http://remix.ethereum.org/ - Open remix-ide
- Install Flattener in Remix-IDE, Flatten
GnosisSafe.sol
- Connect to localhost
- Load
GnosisSafe.sol
- Store flattened Solidity file under
/src/main/resources/solidity
- Build with
mvn clean package
- Install Flattener in Remix-IDE, Flatten