Governance Vote + Useful dApp Features on Helios (Chronos + Oracle)
Helios enables building powerful modular smart contracts using Move — including governance tools, time-based logic with Chronos, and external data fetch via Oracles. Here’s how to build a basic governance voting system+ ideas for useful dApps.
What You’ll Build
- A simple voting system (For/Against)
- Use Chronos for proposal expiry
- Optional: Call external data via Helios Oracle
- Extendable to any dApp logic (faucet, triggers, automation)
Step-by-Step Guide
Create Your Governance Module
Basic voting contract using Move
module governance::VoteModule {
struct Proposal has key {
id: u64,
title: vector,
for_votes: u64,
against_votes: u64,
end_time: u64,
executed: bool,
}
public fun create_proposal(sender: &signer, id: u64, title: vector, end_time: u64) {
move_to(sender, Proposal {
id,
title,
for_votes: 0,
against_votes: 0,
end_time,
executed: false,
});
}
public fun vote(sender: &signer, id: u64, support: bool) {
let proposal = borrow_global_mut(signer::address_of(sender));
if (support) {
proposal.for_votes = proposal.for_votes + 1;
} else {
proposal.against_votes = proposal.against_votes + 1;
}
}
public fun execute(sender: &signer, id: u64) {
let proposal = borrow_global_mut(signer::address_of(sender));
assert(!proposal.executed, 1);
assert(proposal.end_time < chrono::now(), 2);
if (proposal.for_votes > proposal.against_votes) {
// EXECUTE LOGIC HERE
}
proposal.executed = true;
}
}
Add Chronos Support (Time Automation)
Helios Chronos gives you block timestamp access:
use chrono::now;
public fun get_current_time(): u64 {
now()
}
Use this to:
- Automatically end proposals
- Limit token claims
- Reset contract behavior
Tutorial: Build & Run a Chronos Smart Contract with External Oracle Data (Helios Testnet)
Prerequisites
- Node.js + npm installed
- Git installed
- A Helios wallet (MetaMask or Leap)
- Testnet tokens from Helios faucet
- Basic understanding of smart contracts (Rust/Move/Solidity-like syntax)
Clone the Example Repo
git clone GitHub - helios-network/smart-contract-examples: This repository contains examples contracts that can be executed on the Helios blockchain, like Chronos schedules or External chain data reader
cd smart-contract-examples/helios-hyperion-oracle
Explore the Project Structure
contracts/oracle_consumer.move: Smart contract using oracle datascripts/deploy.ts: Script to deploy the contracthelios.config.ts: Configuration file for testnet setup
Install Dependencies
npm install
Configure the Environment
Update helios.config.ts with your wallet private key and RPC URL:
export const config = {
privateKey: ‘YOUR_WALLET_PRIVATE_KEY’,
rpcUrl: ‘https://rpc.testnet.helios.com’, // Example
network: ‘testnet’,
};
Deploy the Oracle-Integrated Contract
Run the deploy script:
npx ts-node scripts/deploy.ts
This will:
Deploy your contract
Register it with the Chronos oracle
Log the deployed contract address
Interact with Your Contract
Example: Call a function to get cross-chain data (e.g. ETH price)
npx ts-node scripts/interact.ts
Use-Case Example: Display Live ETH Price
Create a simple frontend using React + ethers.js to:
- Connect wallet
- Call your deployed contract
- Show real-time ETH price from the oracle
Optional: Governance Vote Sample
Extend your contract with governance module:
public fun propose_change(sender: address, new_val: u64) {
// add vote logic
}
thanks for this oppourunity