This page will help you get started with Smart Contract API.

When writing data, you are executing smart contracts. You should be working with 3 smart contracts.

  • LiminalMarket
  • aUSD
  • SecurityToken

The addresses are listed below

Buy a stock - flow
When buying stock, the flow is the following

Retrieve the address of the symbol on chain using LiminalMarket.getSecurityToken method
Execute transfer on aUSD token. The to parameter is the contract address of the symbol, the amount is the dollar amount to buy

You can use the standard ERC20 ABI with aUSD

LiminalMarket liminalMarket = LiminalMarket(liminalMarketAddress);
string memory aaplAddress = liminalMarket.getSecurityToken('AAPL');

aUSD aUsdToken = aUSD(aUsdAddress);
aUsdToken.transfer(aaplAddress, amount);

Sell a stock - flow
When selling stock, the flow is the following

Retrieve the address of the contract symbol from the users address (he should have it in his wallet)
Execute transfer on the contract symbol token. The to parameter is the aUSD address, amount is the quantity of symbols to sell

You can use the standard ERC20 ABI with SecurityToken

LiminalMarket liminalMarket = LiminalMarket(liminalMarketAddress);
string memory aaplAddress = liminalMarket.getSecurityToken('AAPL');
  
SecurityToken securityToken = SecurityToken(aaplAddress);
securityToken.transfer(aUSDAddress, quantityToSell);

LiminalMarket - contract

  • Mumbai address: 0x6e9C29e416dc9F7A6A03ffebaB3f02Ef62a1baE4

You need to retrieve the address of the symbol you want to buy. To do this you call the method getSecurityToken(symbol). You send in the symbol you want to buy (e.g. MSFT for Microsoft). The method will return the address of the ERC20 token that represents the stock.

aUSD - contract

  • Mumbai address: 0xe65Fb29C8CeB720755D456233c971DDb11fcbb8d

By calling the transfer method, you are buying a stock. You call the aUSD.transfer(to, amount). The to is the address of the symbol that you got from LiminalMarket.getSecurityToken(symbol)

SecurityToken - contract
The address depends on which stock you are selling. It is only possible to sell stock that the user already owns, so the contract address should be retrieved from the user wallet.

You can download the ABI for LiminalMarket contract here

LiminalMarket liminalMarket = LiminalMarket(liminalMarketAddress);
string memory aaplAddress = liminalMarket.getSecurityToken('AAPL');

When you have retrieved the address, you can initiate the contract as a standard ERC20 contract. You then call

The recipient is always the aUSD address (see above). The amount is the number of shares you want to sell. This is NOT a dollar amount.