Function Reference
Complete Function Documentation
GoldToken
Standard ERC-20 with minting capability.
Read Functions
balanceOf(address)
uint256
GOLD balance
allowance(owner, spender)
uint256
Approved amount
totalSupply()
uint256
Total circulation
name()
string
"OwnaFarm Gold"
symbol()
string
"GOLD"
decimals()
uint8
18
Write Functions
transfer(to, amount)
Public
Transfer GOLD
approve(spender, amount)
Public
Approve spender
transferFrom(from, to, amount)
Public
Delegated transfer
mint(to, amount)
Owner
Mint new GOLD
GoldFaucet
Testnet token distribution.
Read Functions
canClaim(address)
bool
Claim eligibility
timeUntilNextClaim(address)
uint256
Seconds until next claim
claimAmount()
uint256
GOLD per claim
cooldownTime()
uint256
Seconds between claims
Write Functions
claim()
Public
Claim free GOLD
deposit(amount)
Public
Add GOLD to faucet
setClaimAmount(amount)
Admin
Change claim amount
setCooldownTime(seconds)
Admin
Change cooldown
withdraw(amount)
Admin
Withdraw GOLD
OwnaFarmNFT
Core invoice and investment contract.
Submit Invoice
offtakerId
0x4f46...
Buyer identifier hash
targetFund
10000e18
10,000 GOLD
yieldBps
1500
15% yield
duration
2592000
30 days
Invest
Requirements:
Invoice status is Approved
GOLD spending approved
Amount within target
Harvest
Requirements:
Investment exists
Not already claimed
Duration passed
Admin Functions
approveInvoice(tokenId)
Admin
Approve for investment
rejectInvoice(tokenId)
Admin
Reject submission
View Functions
invoices(tokenId)
Get invoice details
getInvestment(investor, id)
Get investment details
investmentCount(investor)
Count investments
getPendingInvoices(offset, limit)
List pending
getAvailableInvoices(offset, limit)
List available
OwnaFarmVault
Yield reserve management.
setFarmNFT(address)
Admin
Set NFT contract (once)
depositYield(amount)
Admin
Add yield reserve
withdrawYield(to, amount)
FarmNFT
Pay investor yield
emergencyWithdraw(token, amount)
Owner
Emergency recovery
Data Structures
Invoice
Investment
Common Patterns
Approve Before Invest
Check Harvest Eligibility
Error Codes
InsufficientBalance
Not enough GOLD
InsufficientAllowance
Need to approve first
InvoiceNotApproved
Wrong invoice status
AlreadyClaimed
Already harvested
NotMature
Duration not passed
ExceedsTarget
Investment too large
Last updated
