Representing open-source projects as galaxies, while users as stars.
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/
Install the package:
npm install @ara-web/smartcontractsImport the deployed contract ABIs and types in your application:
import { allStarsAbi } from '@ara-web/smartcontracts/deployed';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,
});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 */],
});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);
},
});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>;
}Smartcontracts to track on blockchain explorers:
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]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