0.0.1 • Published 4 months ago
@skynetxbt/contracts v0.0.1
Skynet Contracts
A decentralized agent framework powered by smart contracts that interfaces with the Spheron Network. The framework enables the creation and management of autonomous agents with built-in governance, token management, and plugin capabilities.
Project Structure
src/
├── abis/ # Contract ABIs
├── agent/ # Agent-related contracts
├── escrow/ # Escrow system contracts
├── interfaces/ # Contract interfaces
├── library/ # Utility libraries
├── plugins/ # Plugin system contracts // Will be separated into different packages
├── proposals/ # Governance proposal contracts
└── token/ # Token-related contracts
Key Components
Agent System
AgentCore
: Central contract managing agent creation and lifecycleAgent
: Individual agent contract with plugin supportAgentTraitRegistry
: Manages agent characteristics and capabilities
Token System
TokenFactory
: Creates and manages agent tokensSpon
: Native token of the ecosystemTokenStorage
: Persistent storage for token-related data
Plugin System
ComputeDeposit
: Handles compute resource allocationHealthManager
: Monitors and manages agent healthTokenLaunchPlugin
: Manages token launchesNFTMintPlugin
: Handles NFT minting operationsAeroDromeSwap
: DEX integration for token swaps
Governance
ProposalManager
: Handles governance proposals and voting- Various proposal types for different agent operations
Prerequisites
- Foundry
- Node.js & npm
- Git
Installation
- Clone the repository:
git clone https://github.com/spheronFdn/skynet-contracts.git
cd skynet-contracts
- Install dependencies:
forge install
Development Commands
# Build contracts
forge build
# Run tests
forge test
# Format code
forge fmt
# Generate gas report
forge snapshot
# Run local node
anvil
Deployment
The project uses Foundry for deployment. The main deployment script is DeployAll.s.sol
which deploys all core contracts in the correct order.
Environment Setup
Create a .env
file with the following variables:
PRIVATE_KEY=your_private_key
RPC_URL=your_rpc_url
AGENT_CORE_ADDRESS=deployed_agent_core_address
PROPOSAL_MANAGER_ADDRESS=deployed_proposal_manager_address
SPON_TOKEN_ADDRESS=deployed_spon_token_address
SPHERON_ESCROW_ADDRESS=spheron_escrow_address
Deployment Steps
- Deploy core contracts:
forge script script/DeployAll.s.sol:DeployAll --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
- Deploy plugins (after core deployment):
forge script script/DeployTokenPlugin.s.sol:DeployTokenPlugin --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
forge script script/DeployNFTPlugin.s.sol:DeployNFTPlugin --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
forge script script/DeployCompute.s.sol:DeployCompute --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
- Create and configure agents:
forge script script/DeployAgent.s.sol:DeployAgent --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
Testing
The project includes comprehensive tests for all components:
# Run all tests
forge test
# Run specific test file
forge test --match-path test/TestHealthManager.sol
# Run tests with gas reporting
forge test --gas-report
Security
- All contracts use OpenZeppelin's secure contract implementations
- Access control mechanisms are in place for critical functions
- Escrow system for secure token and asset management
- Plugin system with security checks and validations
License
MIT License
0.0.1
4 months ago