Quickstart: Setup & First Interaction

This guide explains how to set up and interact with the AetherCycle Protocol in a local development environment. It assumes familiarity with Hardhat and Ethers.js.

1. Prerequisites

Ensure the following are installed on your system:

  • Node.js v20+

  • npm or yarn

  • Git


2. Environment Setup

# Clone the repository
git clone https://github.com/aethercycle/aethercycle-protocol.git
cd aethercycle-protocol

# Install dependencies
npm install

3. Compile the Contracts

npx hardhat compile

4. Run the Test Suite

npx hardhat test

5. First Interaction

Step 1: Start a Local Node

npx hardhat node

Step 2: Deploy Contracts

npx hardhat run scripts/deployment/deploy.js --network localhost

Take note of the PerpetualEndowment contract address printed in the console.

Step 3: Query the Contract

Create a file scripts/checkEndowment.js with the following:

const { ethers } = require("hardhat");

async function main() {
  const endowmentAddress = "0x..."; // Replace with deployment address

  console.log("Querying AetherCycle Perpetual Endowment...");

  const endowment = await ethers.getContractAt("PerpetualEndowment", endowmentAddress);

  const initialAmount = await endowment.initialEndowmentAmount();
  const isSealed = await endowment.isSealed();
  const releaseInterval = await endowment.releaseInterval();

  console.log("---------------------------------");
  console.log("Query Successful!");
  console.log(`Initial Endowment Amount: ${ethers.formatEther(initialAmount)} AEC`);
  console.log(`Is the Endowment Sealed?: ${isSealed}`);
  console.log(`Current Release Interval: ${releaseInterval / 86400n} days`);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Step 4: Run the Script

npx hardhat run scripts/checkEndowment.js --network localhost

Result

If successful, you now have a fully functional local AetherCycle environment for building, testing, and interacting with the protocol.

Last updated