Quick Start

Jump Right Into the Integration

Few easy examples on how to integrate with Aktionariat

External API

An easy and quick way to get all tokens on the Aktionariat platfom is the /token enpoint, which gives you back a lot of details

For all endpoints visit the External API section:

Subgraph

To quickly check out the Subgraph you can go to the The Graph's Explorer Page An first insight full query would be to get all total trading data of the platform:

{
  registry(id: "0xcb3e482df38d62e73a7ae0e15a2605cadcc5ae98"){
    txCount
    tokenCount
    totalVolumeUSD
    totalVolumeXCHF
  }
}

For the full details about visit the Subgraph section:

Ethers

A short node.js script to get the price to buy one share:

import { ethers } from "ethers";

let brokerbotAddress = "0x3A2148cEa2A8A4dAE51487fA28451038c24d2576"
const brokerbotABI = ["function getBuyPrice(uint256 shares) view returns (uint256)"];

async function main () {
  const ethersProvider = new ethers.providers.InfuraProvider();
  const wallet = ethers.Wallet.createRandom().connect(ethersProvider);
  const brokerbotContract = new ethers.Contract(brokerbotAddress, brokerbotABI, wallet);
  const price = await brokerbotContract.getBuyPrice(1);
  console.log(Price to buy 1 share: ${price}`);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

More examples with Ethers:

Solidity

A short contract to show how to buy some shares with XCHF:

contract BuySharesExample {
    //constants
    IERC20 public constant XCHF = 0xB4272071eCAdd69d933AdcD19cA99fe80664fc08;
    address public constant brokerbot = 0x3A2148cEa2A8A4dAE51487fA28451038c24d2576;
    address public constant paymenthub = 0xD5608dEe5F0ed1A09B5cC3FEbB9B3Fc48e68057d;
    
    function buySharesWithBaseToken(uint256 amountShares) external {
    uint256 baseAmount = brokerbot.getPrice(amountShares);
    //approve paymenthub to move base currency (XCHF)
    XCHF.approve(paymenthub, baseAmount)
    paymenthub.payAndNotify(brokerbot, baseAmount, "0x01");
    }

Dive deeper:

Last updated