Refinery Technical Documentation

Complete guide to the Refinery node network smart contracts and API

Project Overview

Refinery is a decentralized node network built on Binance Smart Chain (BSC) that revolutionizes how users interact with blockchain infrastructure. The platform provides an accessible, secure, and profitable way to participate in network validation and rewards through an innovative node-based staking mechanism.

Key Features

  • Three-Tier Node System: Small, Medium, and Large nodes with different reward structures
  • Automated Rewards: Daily reward distribution based on node ownership
  • Transparent Operations: All transactions and rewards are on-chain and verifiable
  • Scalable Architecture: Built to handle thousands of concurrent users
  • Security First: Audited smart contracts with comprehensive safety measures

System Architecture

The Refinery ecosystem consists of two main smart contracts working in harmony to provide a complete node management and reward distribution system.

Node Manager Contract

Handles node creation, management, and reward distribution logic.

Contract address will be announced upon mainnet deployment.

REF Token Contract

ERC-20 token with advanced features for liquidity and trading.

Contract address will be announced upon mainnet deployment.

Node System

Refinery implements a three-tier node system, each with distinct characteristics, pricing, and reward structures to accommodate different investment levels and risk tolerances.

Tier Name Daily Rewards APR Target Audience
L1 Small Refinery 5 $REF 5% Beginners
L2 Refinery Medium 30 $REF 6% Serious Investors
L3 Refinery Large 75 $REF 7.5% Whales

Node Creation

Creating nodes in Refinery requires a two-step process: token approval followed by node creation. This ensures proper security and prevents unauthorized token usage.

Step 1: Token Approval

function approveNodeL1|2|3(uint256 cnt) PUBLIC

Approves the contract to spend tokens for node creation.

Step 2: Node Creation

function createNodeWithTokensL1|2|3(uint256 cnt) PUBLIC

Creates the specified number of nodes using approved tokens.

Important Notes

  • Always approve tokens before attempting to create nodes
  • Ensure sufficient token balance for the desired number of nodes
  • Node creation is irreversible once confirmed
  • Each user has limits on the number of nodes per tier

Rewards System

The Refinery rewards system operates on a daily distribution cycle, automatically calculating and distributing rewards based on node ownership and tier.

Claiming Rewards

function cashoutAll() PUBLIC

Claims all accumulated rewards for the calling address.

Reward Distribution

function distributeRewards() OWNER

Distributes rewards to all node holders (admin function).

Reward Schedule

Rewards are distributed daily at predetermined intervals. The exact timing can be queried using the getNextRebase() function.

Admin Functions

The contract owner has access to various administrative functions for managing the system parameters and ensuring optimal operation.

Price Management

function changeNodePriceL1|2|3(uint256 newNodePrice) OWNER

Reward Management

function changeRewardPerNodeL1|2|3(uint256 newPrice) OWNER

Limit Management

function changeL1|2|3Limit(uint256 newLimit) OWNER

Query Functions

These functions allow users and applications to query various aspects of the system without modifying the blockchain state.

Node Information

Function Parameters Returns Description
getNodeNumberOf address account uint256 Total nodes owned by address
getNodeNumberOfL1 address account uint256 Small nodes owned by address
getNodeNumberOfL2 address account uint256 Medium nodes owned by address
getNodeNumberOfL3 address account uint256 Large nodes owned by address

Pricing Information

Function Returns Description
getNodePriceL1 uint256 Price of Small nodes in wei
getNodePriceL2 uint256 Price of Medium nodes in wei
getNodePriceL3 uint256 Price of Large nodes in wei

Events

Smart contract events provide a way to track important state changes and can be used for building responsive user interfaces.

Node Creation Events

event CreateL1|2|3(address indexed owner)

Emitted when nodes of the specified tier are created.

Reward Events

event Cashout(address indexed owner)

Emitted when rewards are claimed by a user.

Ownership Events

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Emitted when contract ownership is transferred.

Token Contract

The REF token is an ERC-20 compliant token with advanced features including automatic liquidity provision, tax system, and wallet limits.

Standard ERC-20 Functions

transfer(address recipient, uint256 amount)
transferFrom(address sender, address recipient, uint256 amount)
approve(address spender, uint256 amount)
allowance(address owner, address spender)
balanceOf(address account)
totalSupply()
name() // Returns "REF"
symbol() // Returns "REF"
decimals() // Returns 9

Advanced Features

  • Automatic Liquidity: Built-in liquidity provision mechanism
  • Tax System: Buy/sell taxes for liquidity and marketing
  • Wallet Limits: Maximum wallet and transaction limits
  • Market Pair Management: Automatic market pair detection

Security Features

Refinery implements multiple layers of security to ensure the safety of user funds and the integrity of the system.

Security Measures

  • Ownership Control: Contract ownership can be transferred or renounced
  • Access Control: Admin functions are protected by ownership
  • Migration Support: Built-in migration functionality for upgrades
  • Audit Ready: Comprehensive function set for security audits
  • Transparent Operations: All functions are publicly verifiable

Security Best Practices

  • Wait for official contract address announcements
  • Use official interfaces and avoid direct contract calls
  • Keep private keys secure and never share them
  • Be cautious of phishing attempts and fake websites
  • Only interact with contracts from official sources
  • Verify all contract addresses on BSCScan before interaction

Code Examples

The following examples demonstrate how to interact with the Refinery smart contracts using JavaScript and Web3 libraries.

Creating Nodes

// 1. Approve tokens for node creation const nodePrice = await contract.getNodePriceL1(); const totalCost = nodePrice.mul(5); // 5 nodes await tokenContract.approve(contractAddress, totalCost); // 2. Create nodes await contract.createNodeWithTokensL1(5);

Claiming Rewards

// Claim all pending rewards await contract.cashoutAll();

Querying Information

// Get user's node count const nodeCount = await contract.getNodeNumberOf(userAddress); // Get node prices const l1Price = await contract.getNodePriceL1(); const l2Price = await contract.getNodePriceL2(); const l3Price = await contract.getNodePriceL3(); // Get pending rewards const rewards = await contract.getRewardAmountOf(userAddress);

Deployment Information

The Refinery contracts are deployed on Binance Smart Chain and are fully operational. All contract addresses and ABIs are publicly available for verification.

Deployment Information

  • Network: Binance Smart Chain (BSC)
  • Status: Preparing for mainnet deployment
  • Contract Addresses: Will be announced upon deployment
  • Verification: Contracts will be verified on BSCScan