@ara-web/smartcontracts
v1.0.1
Published
Smart contracts for Ara, a blockchain-based platform for open-source project governance and collaboration. Enables decentralized ownership transfer through star-based tokenomics, where projects (galaxies) distribute stars to contributors, maintainers, and
Maintainers
Readme
Ara SmartContracts
Representing open-source projects as galaxies, while users as stars.
What is Ara?
In Ara, every open-source project is called a galaxy. Once the user's issue is resolved, galaxy distributes the stars to the user, maintainer and contributor. Your goal as the project community is to gather as much stars as possible. Once, star amount exceeds a certain threshold, open-source project in Ara changes it's owner to the star owners: users, collaborators along with the maintainers.
To learn more, and what benefit it has for open-source projects Check the website: https://ara.foundation/
Getting Started
Install the package:
npm install @ara-web/smartcontractsUsing the Contract ABIs
Import the deployed contract ABIs and types in your application:
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';Use Cases
1. Reading Contract Data
import { createReadContract } from '@wagmi/core';
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';
import { baseSepolia } from 'wagmi/chains';
// Read galaxy data
const galaxyData = await createReadContract({
address: '0x70b089840FB3D567C5d618b222503d68A8ad0dAa',
abi: allStarsAbi,
functionName: 'galaxies',
args: [galaxyId],
chainId: baseSepolia.id,
});2. Writing to Contracts
import { createWriteContract } from '@wagmi/core';
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';
// Add a new galaxy (backend only)
await createWriteContract({
address: '0x70b089840FB3D567C5d618b222503d68A8ad0dAa',
abi: allStarsAbi,
functionName: 'addGalaxy',
args: [/* galaxy parameters */],
});3. Listening to Events
import { createWatchContractEvent } from '@wagmi/core';
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';
// Watch for new galaxies
createWatchContractEvent({
address: '0x70b089840FB3D567C5d618b222503d68A8ad0dAa',
abi: allStarsAbi,
eventName: 'GalaxyAdded',
onLogs(logs) {
console.log('New galaxy added:', logs);
},
});4. With React and wagmi
import { useReadContract, useWriteContract } from 'wagmi';
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';
function GalaxyInfo({ galaxyId }: { galaxyId: number }) {
const { data: galaxy } = useReadContract({
address: '0x70b089840FB3D567C5d618b222503d68A8ad0dAa',
abi: allStarsAbi,
functionName: 'galaxies',
args: [galaxyId],
});
return <div>{galaxy?.name}</div>;
}Deployed Contracts
Base Sepolia Network
Smartcontracts to track on blockchain explorers:
For Contributors
Deploy
Firstly, set the .env based on .env.example.
Then deploy the smartcontracts:
npx hardhat run ./scripts/deploy-all-stars.js --network [network_name]Then verify the smartcontracts:
npx hardhat verify --network [network_name] [deployed_contract_address]Generating ABIs
To regenerate the ABIs after contract changes:
- Add the addresses and network in
/wagmi.config.ts - Run
npm run wagmito re-generate the abi files - The updated
./abis.tswill be ready for publishing
