BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

RPCs for Insurance/Socialization #491

Closed patrickdugan closed 1 year ago

patrickdugan commented 1 year ago

tl_getinsuranceordersnapshot is the priority, we can get by taking data from this part of insurance.cpp:

Line 54 int64_t InsuranceFund::GetFeesTotal(uint32_t pid) const { auto n1 = get_fees_balance(g_fees->native_fees, pid); auto n2 = get_fees_balance(g_fees->oracle_fees, pid); auto n3 = get_fees_balance(g_fees->spot_fees, pid); return n1 + n2 + n3; }

tl_getinsurancepayouts

Add a level db data save in the function at Line 106, then refer to that history of events. Be able to look up by contract id.

tl_getsocializations

Add a levelDB data save in the function near the end of TradeLayer.cpp that does socializations and be able to refer to the history of these events by contractid.

patrickdugan commented 1 year ago

In case of any doubht the "function at Line 106" is now 108 and can change, the name is: std::tuple<bool, int64_t> InsuranceFund::PayOut(uint32_t pid, int64_t amount)