chore: implement bidding scenarios
Dummy scenarios to choose which bidding
strategy to apply in depending on several
factors.
@@ -12,6 +12,10 @@ export class BiddingEngine {
*/
bidPercentile: number = 0.75
+ // At the beginning, it has never been outbid
+ timesBeenOutbid: number = 0
+ //
+
/**
* Computes the bidding amount for a given SFX. Currently, this is implemented in the simplest way possible, by using the
* minProfitAmount and maxProfitAmount. In the future, we might want to use a more sophisticated bidding strategy.
@@ -27,4 +31,55 @@ export class BiddingEngine {
return bidUsd
}
+
+ /**
+ * Check the scenario the executor+sfx are in
+ * to select which behavior to apply.
+ *
+ * @param sfx The SFX object being outbid
+ * @returns
+ */
+ checkScenario(sfx: SideEffect): Scenario {
+ //
+ const topBid = sfx.isBidder
+
+ // We need a way to check if a bid has been placed
+ const placedBid: boolean = true
+ // We need a way to check if there are other bids
+ const otherBids: boolean = true
+
+ if (placedBid) {
+ if (topBid) {
+ return Scenario.bidAndStillTopBidder
+ } else {
+ return Scenario.beenOutbid
+ }
+ } else {
+ if (otherBids) {
+ return Scenario.noBidYetButCompetition
+ } else {
+ return Scenario.noBidAndNoCompetition
+ }
+ }
+ }
+}
+
+
+/**
+ * There are different scenarios in which the bidding engine
+ * or the SFX can find themselves in.
+ *
+ * Right now, we define several possible scenarios (currently, 4):
+ * - There are no bids on the SFX,
+ * - There are bids from other executors on the SFX,
+ * - You placed a bid on the SFX and are the current
+ * top bidder.
+ * - You placed a bid (that was the top one), but other
+ * executor outbid it.
+ */
+enum Scenario {
+ noBidAndNoCompetition,
+ noBidYetButCompetition,
+ bidAndStillTopBidder,
+ beenOutbid,
}
