package Ġpol ka uction . core . service Ċ Ċ import Ġpol ka uction . core . model . Auction Ċ import Ġpol ka uction . core . model . entities . Lease Period Ċ import Ġpol ka uction . core . model . mapper . to Auction Ċ import Ġpol ka uction . core . model . with Ċ import Ġpol ka uction . core . repository . I Par ach ain Repository Ċ import Ġpol ka uction . core . service . side car . IS ide car Client Factory Ċ Ċ class ĠA uction Service ( ĊĠĠĠ Ġprivate Ġval Ġpar ach ain Repository : ĠI Par ach ain Repository , ĊĠĠĠ Ġprivate Ġval Ġside car Client Factory : ĠIS ide car Client Factory , ĊĠĠĠ Ġprivate Ġval Ġlease Period Service : ĠI Lease Period Service , Ċ ) Ġ: ĠI Auction Service Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun ĠgetCurrent Auction ( chain : ĠString ): ĠA uction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġregistered Par ach ains Ġ= Ġpar ach ain Repository . getAll For ( chain . toLowerCase (). capitalize ()) ĊĠĠĠĠĠĠĠ Ġval Ġside car Client Ġ= Ġside car Client Factory . get Side car Client ( chain ) ĊĠĠĠĠĠĠĠ Ġvar Ġauction Raw Ġ= Ġside car Client . get Auction () ĊĠĠĠĠĠĠĠ Ġauction Raw . win ning Ġ= Ġauction Raw . win ning ?. filter Ġ{ Ġit . bid Ġ!= Ġnull Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġauction Lease Period Filter : Ġ( Lease Period ) Ġ-> ĠBoolean Ġ= Ġ{ Ġlp Ġ-> Ġauction Raw . lease Periods ?. any { it Ġ== Ġlp . period . toString () Ġ} ?: Ġfalse } ĊĠĠĠĠĠĠĠ Ġval Ġlease Periods Ġ= Ġlease Period Service . get Filtered For ( chain , Ġauction Lease Period Filter ) ĊĠĠĠĠĠĠĠ Ġ// val Ġmetadata Ġ= Ġside car Client . getMetadata () ĊĠĠĠĠĠĠĠ Ġ// val Ġslots P allet Ġ= Ġmetadata . metadata . v 1 4 . p allet s . single Ġ{ Ġit . name Ġ== Ġ" Slots " Ġ} ĊĠĠĠĠĠĠĠ Ġ// val Ġlease Offset Ġ= Ġslots P allet . constants . single Ġ{ Ġit . name Ġ== Ġ" lease Offset "} ĊĠĠĠĠĠĠĠ Ġ// val Ġlease Period Ġ= Ġslots P allet . constants . single Ġ{ Ġit . name Ġ== Ġ" lease Period "} ĊĠĠĠĠĠĠĠ Ġreturn Ġauction Raw . to Auction (). with ( registered Par ach ains , Ġlease Periods ) ĊĠĠĠ Ġ} ĊĊ Ċ }