import_code("/home/me/fund/libs/listLib.src") get_offers_list = function(wallet, coin_name) raw_offers = wallet.get_global_offers(coin_name) list = [] for offer in Lst.to_list(raw_offers) wallet_id = offer[0] order = offer[1] type = order[0] amount = order[1] price = order[2] new_offer = {} new_offer["wallet_id"] = wallet_id new_offer["type"] = type new_offer["amount"] = amount new_offer["price"] = price list.push(new_offer) end for return list end function Fund = {} Fund.init = function(coin, coin_name, owner_wallet, owner_name) self.coin = coin self.coin_name = coin_name self.owner_wallet = owner_wallet self.owner_name = owner_name end function // so we dont have a dead lock in case some one lock it and exit the program Fund.date_last_sell_lock = function() end function Fund.pending_transactions = function() pending_transactions = self.owner_wallet.get_pending_trade(self.coin_name) if pending_transactions == "No pending trades found" then return [] end function Fund.sell_lock = function() f = function(o) return o[0] == "Sell" end function sell = Lst.select(self.pending_transactions, @f) if sell.len > 0 then return true return false end function Fund.buy_lock = function() f = function(o) return o[0] == "Buy" end function sell = Lst.select(self.pending_transactions, @f) if sell.len > 0 then return true return false end function Fund.money_in_bank = function() // if tranction is locked unlock it // if there is a open sell order in this coin store its values(value, wallet) // delete all open sell orders // delete the coins of every user // run the function to get_balance // add a coin to the user that had a sell order // open the sell order again // lock transactions end function Fund.open_deposit_transaction = function(client_wallet, value) // if transaction in locked open a loop and wait // once its unlocked create a buy order with client_wallet_and value end function Fund.money_stored_by_clients = function() end function blockchain = include_lib("/lib/blockchain.so") coin_name = "coin729" coin = blockchain.get_coin(coin_name, "lol", "lol") owner_wallet = blockchain.login_wallet("dead", "dead") coin.create_subwallet("dead", owner_wallet.get_pin, "dead", "dead") owner_sub = coin.get_subwallet("dead") Fund.init(coin, coin_name, owner_wallet, "dead") print(Fund.sell_lock) print(owner_sub) print(owner_sub.get_user) owner_sub.add_coins(1) owner_wallet.sell_coin(coin_name, 1, 1, "dead") print(Fund.sell_lock)