From b21d0d1e67ef628ae6c6cfa12d71333a3d90bdd3 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 2 Dec 2024 17:48:59 +0400 Subject: [PATCH 01/13] canary description --- .../_strategies/raindex/4-canary/description.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 public/_strategies/raindex/4-canary/description.md diff --git a/public/_strategies/raindex/4-canary/description.md b/public/_strategies/raindex/4-canary/description.md new file mode 100644 index 00000000..a9eab446 --- /dev/null +++ b/public/_strategies/raindex/4-canary/description.md @@ -0,0 +1,16 @@ +The canary order does nothing except run on a cooldown and hand tokens over to +the solver for free (to pay for gas). + +It is useful only to show that orders clear on some network. If the canary is +deployed and does not run, it means that there are no solvers monitoring the +network, or at least not the raindex contract that the canary is deployed on. + +The canary is basically a stripped back version of the sampler. It runs but +doesn't sample anything. + +Anyone can deploy this strat and fund it themselves to convince themselves that +there is at least one solver operational on some network. + +It's somewhat morbidly named after canaries in old coal mines that would quickly +die if there was a gas leak, hopefully alerting everyone else to evacuate to +safety in time, or repair the leak. \ No newline at end of file From 0b5f29e28a32101c4651d54769b87583251d445b Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Mon, 2 Dec 2024 18:19:36 +0400 Subject: [PATCH 02/13] wip on canary --- .../_strategies/raindex/4-canary/canary.rain | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 public/_strategies/raindex/4-canary/canary.rain diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain new file mode 100644 index 00000000..fd1cbdc7 --- /dev/null +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -0,0 +1,120 @@ +raindex-version: 8898591f3bcaa21dc91dc3b8584330fc405eadfa + +networks: + base: + rpc: https://mainnet.base.org + chain-id: 8453 + network-id: 8453 + currency: ETH + +subgraphs: + base: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/ob4-base/0.7/gn + +metaboards: + base: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/mb-base-0x59401C93/0.1/gn + +orderbooks: + base: + address: 0xd2938e7c9fe3597f78832ce780feb61945c377d7 + network: base + subgraph: base + +deployers: + base: + address: 0xC1A14cE2fd58A3A2f99deCb8eDd866204eE07f8D + network: base + +tokens: + base-usdc: + network: base + address: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 + decimals: 6 + base-weth: + network: base + address: 0x4200000000000000000000000000000000000006 + decimals: 18 + +orders: + base: + orderbook: base + inputs: + # Input is irrelevant because we always set the IO ratio to 0. + - token: usdc + outputs: + - token: weth + +scenarios: + base: + deployer: base + orderbook: base + runs: 1 + bindings: + raindex-subparser: 0x662dFd6d5B6DF94E07A60954901D3001c24F856a + +deployments: + base: + order: base + scenario: base + +gui: + name: Canary + description: > + Does nothing except give a bounty to the solver regularly. Useful to test + that there are solvers active on a given network/Raindex deployment. + deployments: + - deployment: base + name: Canary on Base. + description: + A simple strategy that gives a bounty to the solver regularly. + deposits: + - token: base-weth + min: 0 + presets: + - 0.001 + - 0.01 + fields: + - binding: cooldown + name: Cooldown between possible trades in seconds. + min: 120 + presets: + - name: Two minutes (120) + value: 120 + - name: Five minutes (300) + value: 300 + - name: 1 hour (3600) + value: 3600 + +--- +#raindex-subparser !The subparser contract address for Raindex. +#cooldown !The time in seconds between possible trades. +#base-bounty 0.0000003 +#max-bounty 0.00005 +#init-bounty 0.00001 +#increase-bounty-time-sec 15 + +#calculate-io +using-words-from raindex-subparser +last-trade: get(order-hash()), +open-trade-time: add(last-trade cooldown), +:ensure( + greater-than( + block-timestamp() + open-trade-time + ) + "Cooldown" +), +:set(order-hash() block-timestamp()), +open-trade-seconds-passed: sub(block-timestamp() open-trade-time), +factor: add(floor(div(open-trade-seconds-passed increase-bounty-time-sec)) 1), +bounty: if( + last-trade + min(max-bounty mul(base-bounty factor)) + init-bounty +), +_ _: bounty 0; + +#handle-io +:; + +#handle-add-order +:; \ No newline at end of file From ffaa78584e0b3990fcffdfc1f56c3b94dcf34947 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 17:39:51 +0400 Subject: [PATCH 03/13] canary --- package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package-lock.json b/package-lock.json index 6ab39d36..fbd633b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "rain.frame", "version": "0.0.25", + "license": "LicenseRef-DCL-1.0", "dependencies": { "@fontsource/dm-sans": "^5.0.22", "@hookform/resolvers": "^3.9.0", From 757e6ececbb89a0eb04c46a88c4ec7ddb1f53857 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:03:17 +0400 Subject: [PATCH 04/13] lint --- public/_strategies/raindex/4-canary/description.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/_strategies/raindex/4-canary/description.md b/public/_strategies/raindex/4-canary/description.md index a9eab446..fea12beb 100644 --- a/public/_strategies/raindex/4-canary/description.md +++ b/public/_strategies/raindex/4-canary/description.md @@ -13,4 +13,4 @@ there is at least one solver operational on some network. It's somewhat morbidly named after canaries in old coal mines that would quickly die if there was a gas leak, hopefully alerting everyone else to evacuate to -safety in time, or repair the leak. \ No newline at end of file +safety in time, or repair the leak. From e5cc9176d4eaf4da471f9c74a542a09b01d22ce6 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:17:09 +0400 Subject: [PATCH 05/13] debug canary --- public/_strategies/raindex/4-canary/canary.rain | 1 + 1 file changed, 1 insertion(+) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index fd1cbdc7..0809f37e 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -37,6 +37,7 @@ tokens: orders: base: orderbook: base + network: base inputs: # Input is irrelevant because we always set the IO ratio to 0. - token: usdc From 8c88e5bd7ef3ddda05a668d6d132e2fd10b930c1 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:28:28 +0400 Subject: [PATCH 06/13] debug canary --- public/_strategies/raindex/4-canary/canary.rain | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 0809f37e..39fe6054 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -40,9 +40,9 @@ orders: network: base inputs: # Input is irrelevant because we always set the IO ratio to 0. - - token: usdc + - token: base-usdc outputs: - - token: weth + - token: base-weth scenarios: base: From fecb360085fb64d2fe21ca0b1c5193231be1ba73 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:32:49 +0400 Subject: [PATCH 07/13] allow 0 deposit for cnary --- public/_strategies/raindex/4-canary/canary.rain | 1 + 1 file changed, 1 insertion(+) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 39fe6054..8b9e6fc8 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -71,6 +71,7 @@ gui: - token: base-weth min: 0 presets: + - 0 - 0.001 - 0.01 fields: From af64dcc095f5d0493f84c122f34fd06bf0481651 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:48:46 +0400 Subject: [PATCH 08/13] remove init for canary --- public/_strategies/raindex/4-canary/canary.rain | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 8b9e6fc8..9e5e88fc 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -91,7 +91,6 @@ gui: #cooldown !The time in seconds between possible trades. #base-bounty 0.0000003 #max-bounty 0.00005 -#init-bounty 0.00001 #increase-bounty-time-sec 15 #calculate-io @@ -108,15 +107,11 @@ open-trade-time: add(last-trade cooldown), :set(order-hash() block-timestamp()), open-trade-seconds-passed: sub(block-timestamp() open-trade-time), factor: add(floor(div(open-trade-seconds-passed increase-bounty-time-sec)) 1), -bounty: if( - last-trade - min(max-bounty mul(base-bounty factor)) - init-bounty -), +bounty: min(max-bounty mul(base-bounty factor)), _ _: bounty 0; #handle-io :; #handle-add-order -:; \ No newline at end of file +:set(order-hash() block-timestamp()); \ No newline at end of file From 14e2bab8a354aecbbacb8e4f039400ab430faad4 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 18:56:10 +0400 Subject: [PATCH 09/13] allow 0 deposit for cnary --- public/_strategies/raindex/4-canary/canary.rain | 1 + 1 file changed, 1 insertion(+) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 9e5e88fc..5eaeee6f 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -114,4 +114,5 @@ _ _: bounty 0; :; #handle-add-order +using-words-from raindex-subparser :set(order-hash() block-timestamp()); \ No newline at end of file From f522a5c57df329870571b65ef542c54e8224c90a Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 19:01:04 +0400 Subject: [PATCH 10/13] now canary --- public/_strategies/raindex/4-canary/canary.rain | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 5eaeee6f..9697e710 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -99,13 +99,13 @@ last-trade: get(order-hash()), open-trade-time: add(last-trade cooldown), :ensure( greater-than( - block-timestamp() + now() open-trade-time ) "Cooldown" ), -:set(order-hash() block-timestamp()), -open-trade-seconds-passed: sub(block-timestamp() open-trade-time), +:set(order-hash() now()), +open-trade-seconds-passed: sub(now() open-trade-time), factor: add(floor(div(open-trade-seconds-passed increase-bounty-time-sec)) 1), bounty: min(max-bounty mul(base-bounty factor)), _ _: bounty 0; @@ -115,4 +115,4 @@ _ _: bounty 0; #handle-add-order using-words-from raindex-subparser -:set(order-hash() block-timestamp()); \ No newline at end of file +:set(order-hash() now()); \ No newline at end of file From 63be62455fabb6a302023c048ea10f4c55f17e18 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 19:06:49 +0400 Subject: [PATCH 11/13] simplify ccanary --- public/_strategies/raindex/4-canary/canary.rain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 9697e710..9c84b170 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -108,7 +108,7 @@ open-trade-time: add(last-trade cooldown), open-trade-seconds-passed: sub(now() open-trade-time), factor: add(floor(div(open-trade-seconds-passed increase-bounty-time-sec)) 1), bounty: min(max-bounty mul(base-bounty factor)), -_ _: bounty 0; +ratio: 0; #handle-io :; From ebb412080482c6698cfe41e459d19c80410311f5 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 3 Dec 2024 19:19:15 +0400 Subject: [PATCH 12/13] config for canary --- .../_strategies/raindex/4-canary/canary.rain | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/public/_strategies/raindex/4-canary/canary.rain b/public/_strategies/raindex/4-canary/canary.rain index 9c84b170..f3aa33a8 100644 --- a/public/_strategies/raindex/4-canary/canary.rain +++ b/public/_strategies/raindex/4-canary/canary.rain @@ -85,13 +85,34 @@ gui: value: 300 - name: 1 hour (3600) value: 3600 + - binding: min-bounty + name: Minimum bounty to give to the solver (in ETH). + min: 0 + presets: + - value: 0 + - value: 0.0000003 + - binding: max-bounty + name: Maximum bounty to give to the solver (in ETH). + min: 0 + presets: + - value: 0.00005 + - binding: time-per-epoch + name: Total auction duration in seconds. + min: 1 + presets: + - name: 5 minutes + value: 300 + - name: 15 minutes + value: 900 + - name: 1 hour + value: 3600 --- #raindex-subparser !The subparser contract address for Raindex. #cooldown !The time in seconds between possible trades. -#base-bounty 0.0000003 -#max-bounty 0.00005 -#increase-bounty-time-sec 15 +#min-bounty !The minimum bounty to give to the solver. +#max-bounty !The maximum bounty to give to the solver. +#time-per-epoch !The time in seconds for an epoch. There is only one epoch in this strategy. #calculate-io using-words-from raindex-subparser @@ -105,9 +126,10 @@ open-trade-time: add(last-trade cooldown), "Cooldown" ), :set(order-hash() now()), -open-trade-seconds-passed: sub(now() open-trade-time), -factor: add(floor(div(open-trade-seconds-passed increase-bounty-time-sec)) 1), -bounty: min(max-bounty mul(base-bounty factor)), +duration: sub(now() open-trade-time), +epoch: div(duration time-per-epoch), +auction-bounty: linear-growth(min-bounty sub(max-bounty min-bounty) epoch), +bounty: min(max-bounty auction-bounty), ratio: 0; #handle-io From 56c70855e85ce64cd1f14078d77157deb1630349 Mon Sep 17 00:00:00 2001 From: Siddharth2207 Date: Wed, 4 Dec 2024 11:05:58 +0530 Subject: [PATCH 13/13] ioen auction dca setup --- .../raindex/1-auction-dca/auction-dca.rain | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) diff --git a/public/_strategies/raindex/1-auction-dca/auction-dca.rain b/public/_strategies/raindex/1-auction-dca/auction-dca.rain index 6baa0e9a..49142add 100644 --- a/public/_strategies/raindex/1-auction-dca/auction-dca.rain +++ b/public/_strategies/raindex/1-auction-dca/auction-dca.rain @@ -180,6 +180,10 @@ tokens: network: polygon address: 0x3c59798620e5fEC0Ae6dF1A19c6454094572Ab92 decimals: 18 + polygon-ioen: + network: polygon + address: 0xd0e9c8f5Fae381459cf07Ec506C1d2896E8b5df6 + decimals: 18 orders: arbitrum-wbtc-weth: @@ -364,6 +368,20 @@ orders: - token: polygon-mnw outputs: - token: polygon-usdc + polygon-usdc-ioen: + orderbook: polygon + network: polygon + inputs: + - token: polygon-usdc + outputs: + - token: polygon-ioen + polygon-ioen-usdc: + orderbook: polygon + network: polygon + inputs: + - token: polygon-ioen + outputs: + - token: polygon-usdc scenarios: arbitrum: @@ -454,6 +472,12 @@ deployments: polygon-usdc-mnw: order: polygon-usdc-mnw scenario: polygon + polygon-ioen-usdc: + order: polygon-ioen-usdc + scenario: polygon + polygon-usdc-ioen: + order: polygon-usdc-ioen + scenario: polygon bsc-tft-busd: order: bsc-tft-busd scenario: bsc @@ -1380,6 +1404,238 @@ gui: The initial MNW per USDC to kickoff the first auction (e.g. 2.2). min: 0.01 + - deployment: polygon-usdc-ioen + name: Sell IOEN for USDC on Polygon. + description: > + DCA IOEN for USDC on Polygon. + deposits: + - token: polygon-ioen + min: 0 + presets: + - 0 + - 100000 + - 200000 + - 1000000 + - 2000000 + fields: + - binding: time-per-amount-epoch + name: Budget period (in seconds) + description: > + The budget is spent over this time period. + + For example, if the budget is daily then this is 86400 seconds (24 * 60 * 60). + min: 1 + presets: + - name: Per minute (60) + value: 60 + - name: Per hour (3600) + value: 3600 + - name: Per day (86400) + value: 86400 + - name: Per week (604800) + value: 604800 + - name: Per 30 days (2592000) + value: 2592000 + - name: Per 365 days (31536000) + value: 31536000 + - binding: amount-per-epoch + name: Budget (IOEN per period) + description: > + The amount of IOEN to spend each budget period. + + For example, if the budget is daily and this is 10000 then 10000 IOEN will be sold for USDC each day. + min: 0 + - binding: max-trade-amount + name: Maximum trade size (IOEN) + description: > + The maximum amount of IOEN to sell in a single auction. + min: 0 + - binding: min-trade-amount + name: Minimum trade size (IOEN) + description: > + The minimum amount of IOEN to sell in a single auction. + min: 0 + - binding: time-per-trade-epoch + name: Auction period (in seconds) + description: > + The auction period is the time between each auction price halvening. + min: 600 + presets: + - name: Every 20 minutes (1200) + value: 1200 + - name: Every 30 minutes (1800) + value: 1800 + - name: Every hour (3600) + value: 3600 + - name: Every 2 hours (7200) + value: 7200 + - name: Every 3 hours (10800) + value: 10800 + - name: Every 6 hours (21600) + value: 21600 + - name: Every 12 hours (43200) + value: 43200 + - name: Every 24 hours (86400) + value: 86400 + - binding: baseline + name: Baseline USDC per IOEN + description: > + The absolute minimum amount of USDC per IOEN that the auction will trade at (e.g. 0.002942). + min: 0 + - binding: next-trade-multiplier + name: Auction start multiplier + description: > + The multiplier to apply to the last trade to kick off the next auction. + min: 1.01 + presets: + - name: 1.01x + value: 1.01 + - name: 1.02x + value: 1.02 + - name: 1.05x + value: 1.05 + - name: 1.1x + value: 1.1 + - binding: next-trade-baseline-multiplier + name: Auction end multiplier + description: > + The multiplier to apply to the last trade to set the baseline for the next auction. + min: 0 + presets: + - name: Disabled (0) + value: 0 + - name: 0.7x + value: 0.7 + - name: 0.8x + value: 0.8 + - name: 0.9x + value: 0.9 + - name: 0.95x + value: 0.95 + - name: 0.99x + value: 0.99 + - binding: initial-io + name: Kickoff USDC per IOEN + description: > + The initial USDC per IOEN to kickoff the first auction (e.g. 0.002942). + min: 0 + + - deployment: polygon-ioen-usdc + name: Buy IOEN with USDC on Polygon. + description: > + DCA USDC for IOEN on Polygon. + deposits: + - token: polygon-usdc + min: 0 + presets: + - 0 + - 100 + - 1000 + - 5000 + - 10000 + fields: + - binding: time-per-amount-epoch + name: Budget period (in seconds) + description: > + The budget is spent over this time period. + + For example, if the budget is daily then this is 86400 seconds (24 * 60 * 60). + min: 1 + presets: + - name: Per minute (60) + value: 60 + - name: Per hour (3600) + value: 3600 + - name: Per day (86400) + value: 86400 + - name: Per week (604800) + value: 604800 + - name: Per 30 days (2592000) + value: 2592000 + - name: Per 365 days (31536000) + value: 31536000 + - binding: amount-per-epoch + name: Budget (USDC per period) + description: > + The amount of USDC to spend each budget period. + + For example, if the budget is daily and this is 100 then 100 USDC will be sold for IOEN each day. + min: 0 + - binding: max-trade-amount + name: Maximum trade size (USDC) + description: > + The maximum amount of USDC to sell in a single auction. + min: 0 + - binding: min-trade-amount + name: Minimum trade size (USDC) + description: > + The minimum amount of USDC to sell in a single auction. + min: 0 + - binding: time-per-trade-epoch + name: Auction period (in seconds) + description: > + The auction period is the time between each auction price halvening. + min: 600 + presets: + - name: Every 20 minutes (1200) + value: 1200 + - name: Every 30 minutes (1800) + value: 1800 + - name: Every hour (3600) + value: 3600 + - name: Every 2 hours (7200) + value: 7200 + - name: Every 3 hours (10800) + value: 10800 + - name: Every 6 hours (21600) + value: 21600 + - name: Every 12 hours (43200) + value: 43200 + - name: Every 24 hours (86400) + value: 86400 + - binding: baseline + name: Baseline IOEN per USDC + description: > + The absolute minimum amount of IOEN per USDC that the auction will trade at (e.g. 330). + min: 0 + - binding: next-trade-multiplier + name: Auction start multiplier + description: > + The multiplier to apply to the last trade to kick off the next auction. + min: 1.01 + presets: + - name: 1.01x + value: 1.01 + - name: 1.02x + value: 1.02 + - name: 1.05x + value: 1.05 + - name: 1.1x + value: 1.1 + - binding: next-trade-baseline-multiplier + name: Auction end multiplier + description: > + The multiplier to apply to the last trade to set the baseline for the next auction. + min: 0 + presets: + - name: Disabled (0) + value: 0 + - name: 0.7x + value: 0.7 + - name: 0.8x + value: 0.8 + - name: 0.9x + value: 0.9 + - name: 0.95x + value: 0.95 + - name: 0.99x + value: 0.99 + - binding: initial-io + name: Kickoff IOEN per USDC + description: > + The initial IOEN per USDC to kickoff the first auction (e.g. 330). + min: 0 + - deployment: bsc-tft-busd name: Buy TFT with BUSD on BSC. description: >