Skip to content

Commit

Permalink
fix: add public
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Nov 6, 2024
1 parent 40f32eb commit 1f5760d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions engine/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func (e *Engine) SyncHandler() {
e.init()
latestBlockNum := e.GetLatestFinalizedBlock(4)
lastSyncedTill := e.getLastSyncedTill()
latestBlockNum = 19752044
e.syncedBlock.Store(lastSyncedTill)
//
// only do batch sync if latestblock is far from currently synced block
Expand All @@ -116,7 +115,6 @@ func (e *Engine) SyncHandler() {
}
for {
latestBlockNum = e.GetLatestFinalizedBlock(4)
latestBlockNum = 19752044
e.SyncAndFlush(latestBlockNum)
log.Infof("Synced till %d sleeping for 2 mins", latestBlockNum)
time.Sleep(2 * time.Minute) // on kovan 5 blocks in 1 min , sleep for 5 mins
Expand Down
8 changes: 4 additions & 4 deletions migrations/000016_rankings.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DECLARE
BEGIN
RETURN QUERY
WITH cm_prices AS (SELECT cm.address credit_manager, price FROM
token_current_price tcp JOIN credit_managers cm ON cm.underlying_token = tcp.token WHERE price_source='chainlink')
public.token_current_price tcp JOIN public.credit_managers cm ON cm.underlying_token = tcp.token WHERE price_source='chainlink')
SELECT t1.*, t2.*,

price * t1.old_collateral_underlying old_collateral, price * t1.old_profit_underlying old_profit,
Expand All @@ -57,15 +57,15 @@ BEGIN
(cal_threshold_value_bi::float8 * total_value_usd)/ cal_total_value_bi::float8
end) old_twv_usd,
cal_health_factor old_hf, d.session_id sid
FROM debts d WHERE block_num >= (SELECT min(id) FROM blocks WHERE timestamp > (extract(epoch from now())::bigint - $1))
FROM public.debts d WHERE block_num >= (SELECT min(id) FROM public.blocks WHERE timestamp > (extract(epoch from now())::bigint - $1))
order by d.session_id, block_num) t1
JOIN (SELECT distinct on (d.session_id) d.total_value_usd new_total,
d.collateral_underlying new_collateral_underlying, d.profit_underlying as new_profit_underlying,
d.session_id, block_num current_block
FROM debts d WHERE block_num >= (SELECT min(id) FROM blocks WHERE timestamp > (extract(epoch from now())::bigint - $1))
FROM public.debts d WHERE block_num >= (SELECT min(id) FROM public.blocks WHERE timestamp > (extract(epoch from now())::bigint - $1))
order by d.session_id, block_num DESC) t2
ON t1.sid = t2.session_id
JOIN credit_sessions cs ON cs.id = t2.session_id
JOIN public.credit_sessions cs ON cs.id = t2.session_id
LEFT JOIN cm_prices ON cm_prices.credit_manager = cs.credit_manager;
END $$;

Expand Down

0 comments on commit 1f5760d

Please sign in to comment.