Skip to Content

API Reference

Smart contract function signatures and parameters


GenesisLaunchAuction (GLA) — IRO

whitelistBuy(uint256 amount)

Purchase RWA tokens during whitelist phase.

ParameterTypeDescription
amountuint256WEUSD amount (6 decimals)

Requirements:

  • Wallet must be on whitelist
  • Must approve WEUSD spending first
  • Must be in whitelist phase

publicOfferingBuy(uint256 amount)

Purchase RWA tokens during public offering phase.

ParameterTypeDescription
amountuint256WEUSD amount (6 decimals)

Requirements:

  • Must approve WEUSD spending first
  • Must be in public offering phase

claim()

Claim purchased RWA tokens after market initialization.

Requirements:

  • Market must be initialized (initialized = true)
  • Must have purchased tokens

withdraw()

Withdraw WEUSD investment during unlock phase.

Requirements:

  • Market must be in unlock phase
  • Soft cap must not be reached

Market Contract — Origin Mincast

mincast(address token, uint256 tokenWorth, uint256 desired) returns (uint256 amount, uint256 fee)

Mint RWA tokens by depositing stablecoins.

ParameterTypeDescription
tokenaddressStablecoin address (WEUSD or USDC)
tokenWorthuint256Amount of stablecoin to spend
desireduint256Minimum RWA tokens expected (slippage protection)
ReturnTypeDescription
amountuint256Actual RWA tokens minted
feeuint256Fee paid

Requirements:

  • Market must be active
  • Contract must not be paused
  • Token must be in approved list
  • Must approve stablecoin spending

melt(address token, uint256 amount, uint256 desired) returns (uint256 worth, uint256 fee)

Burn RWA tokens to withdraw stablecoins.

ParameterTypeDescription
tokenaddressStablecoin address to receive
amountuint256RWA tokens to melt
desireduint256Minimum stablecoin expected (slippage protection)
ReturnTypeDescription
worthuint256Actual stablecoin received
feeuint256Fee paid

Requirements:

  • Market must be active
  • Contract must not be paused
  • Token must be in approved list
  • Must approve RWA token spending

InvestmentManager — Invest Module

invest(uint256 assetId, uint256 amount) returns (uint256 investmentId)

Invest in a structured RWA asset.

ParameterTypeDescription
assetIduint256Asset identifier
amountuint256WEUSD amount (6 decimals)
ReturnTypeDescription
investmentIduint256Unique investment identifier

Requirements:

  • Must approve WEUSD to InvestmentPool
  • Asset must be active
  • Amount must be within min/max limits

redeem(uint256 investmentId) returns (uint256 profit)

Redeem a matured investment.

ParameterTypeDescription
investmentIduint256Investment identifier
ReturnTypeDescription
profituint256Profit amount received

Requirements:

  • Investment must be matured (currentTime >= endTime)
  • Investment status must be Active
  • Caller must be the investor

View Functions

Market Contract

Function/VariableReturnsDescription
cuint256Current RWA price
fuint256Floor RWA price (minimum guaranteed price)
wuint256Total worth (total stablecoins in mincast)
kuint256Slope of the price function
targetuint32Target funding ratio
targetAdjusteduint32Target adjusted funding ratio
RWA.totalSupply()uint256Circulating RWA tokens
currentFundingRatio()(uint256, uint256)Current funding ratio (numerator, denominator)
estimateBuy(address token, uint256 tokenWorth)(uint256, uint256, uint256, uint256)Estimate RWA amount, fee, worth, and new price for buy
estimateSell(uint256 amount, address token)(uint256, uint256, uint256, uint256)Estimate fee, worth, and new price for sell
estimateRaisePrice()(bool, uint256, uint256, uint256, uint256)Estimate next raise price parameters

Important Notes

Token Decimals

TokenDecimalsExample
WEUSD61 WEUSD = 1000000
USDC (BSC)181 USDC = 1e18
USDC (Base/Arb)61 USDC = 1000000
RWA Tokens181 RWA = 1e18

Approval Pattern

Always approve before calling state-changing functions:

// Step 1: Approve IERC20(token).approve(spender, amount); // Step 2: Call function contract.functionName(params);

Slippage Protection

Use desired parameter to protect against price movements:

// Allow 1% slippage uint256 desired = expectedAmount * 99 / 100;

Error Handling

Common revert reasons:

  • Insufficient balance
  • Approval not granted
  • Slippage exceeded
  • Market not active
  • Contract paused
  • Not whitelisted
  • Investment not matured
Last updated on