Sell Shares

The sell process is straight forward. You transfer the share token via transferAndCall to the Brokerbot and the Brokerbot pays you out the according amount in the base currency (XCHF).

contract SellSharesExample {
    //constants
    BrokerbotRegistry public constant BROKERBOT_REGISTRY = 0xcB3e482df38d62E73A7aE0E15a2605caDcc5aE98;
    IERC20 public constant XCHF = 0xB4272071eCAdd69d933AdcD19cA99fe80664fc08;
    // immutables
    IERC20 public immutable share;
    Brokerbot public immutable brokerbot;

    contstructor(IERC20 shareToken){
        share = shareToken;
        brokerbot = BROKERBOT_REGISTRY.getBrokerbot(XCHF,share);
    }  
    
    function SellShares(amountShares) external {
        share.transferAndCall(brokerbot, amountShares, "0x"));
    }

Last updated