From 322676eb3213b404db6316205940b4d86872a727 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:15:43 -0500 Subject: [PATCH 01/22] Add wsteth constants (actual values tbd) --- src/constants/raw/pinto-base.js | 2 ++ .../seeders/20241118003615-silo-tokens-base.js | 4 ++-- src/repository/subgraph/basin-subgraph.js | 3 +-- src/service/exchange-service.js | 10 ---------- src/service/price-service.js | 2 +- src/service/tractor/blueprints/blueprint-constants.js | 3 ++- test/service/exchange-service.test.js | 2 -- test/util/mock-constants.js | 9 ++++++++- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index cd83a28..4962914 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -22,12 +22,14 @@ const contracts = { PINTOCBBTC: ['0x3e11226fe3d85142B734ABCe6e58918d5828d1b4', 18, wellAbi], PINTOWSOL: ['0x3e11444c7650234c748D743D8d374fcE2eE5E6C9', 18, wellAbi], PINTOUSDC: ['0x3e1133aC082716DDC3114bbEFEeD8B1731eA9cb1', 18, wellAbi], + PINTOWSTETH: ['TODO(wsteth)', 18, wellAbi], SPINTO: ['0x00b174d66ada7d63789087f50a9b9e0e48446dc1', 18, wrappedDepositAbi], WETH: ['0x4200000000000000000000000000000000000006', 18, erc20Abi], CBETH: ['0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22', 18, erc20Abi], CBBTC: ['0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', 8, erc20Abi], WSOL: ['0x1C61629598e4a901136a81BC138E5828dc150d67', 9, erc20Abi], USDC: ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', 6, erc20Abi], + WSTETH: ['TODO(wsteth)', 18, erc20Abi], CP2: ['0xBA510C289fD067EBbA41335afa11F0591940d6fe', null, wellFunctionAbi], STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], diff --git a/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js b/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js index e925bb1..0c667a0 100644 --- a/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js +++ b/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js @@ -16,7 +16,7 @@ module.exports = { return; } const c = C('base'); - const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC]; + const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC, c.PINTOWSTETH]; // Add base tokens await AlchemyUtil.ready(c.CHAIN); @@ -83,7 +83,7 @@ module.exports = { async down(queryInterface, Sequelize) { if (EnvUtil.isChainEnabled('base')) { const c = C('base'); - const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC]; + const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC, c.PINTOWSTETH]; // Delete pinto tokens await queryInterface.bulkDelete(TOKEN_TABLE.env, { address: { diff --git a/src/repository/subgraph/basin-subgraph.js b/src/repository/subgraph/basin-subgraph.js index 0285893..ef6cdf0 100644 --- a/src/repository/subgraph/basin-subgraph.js +++ b/src/repository/subgraph/basin-subgraph.js @@ -15,9 +15,8 @@ class BasinSubgraphRepository { } }`, `block: {number: ${blockNumber}}`, - // The exchange subgraph needs to update to indiate isBeanstalk or wasBeanstalk (for dewhitelisted) '', - // 'isBeanstalk: true', + 'isBeanstalk: true', { field: 'symbol', lastValue: ' ', diff --git a/src/service/exchange-service.js b/src/service/exchange-service.js index 70ad104..793b0ba 100644 --- a/src/service/exchange-service.js +++ b/src/service/exchange-service.js @@ -23,16 +23,6 @@ class ExchangeService { BasinSubgraphRepository.getAllWells(block.number), BasinSubgraphRepository.getAllTrades(block.timestamp - ONE_DAY, block.timestamp) ]); - // The exchange subgraph needs to update to indiate isBeanstalk or wasBeanstalk (for dewhitelisted) - // Until then allWells must manually filter out pools - if (C().PROJECT === 'pinto') { - const allWellAddresses = Object.keys(allWells); - for (const wellAddress of allWellAddresses) { - if (![C().PINTOWETH, C().PINTOCBETH, C().PINTOCBBTC, C().PINTOUSDC, C().PINTOWSOL].includes(wellAddress)) { - delete allWells[wellAddress]; - } - } - } const allPriceEvents = ExchangeService.priceEventsByWell(allWells, allTrades); // For each well in the subgraph, construct a formatted response diff --git a/src/service/price-service.js b/src/service/price-service.js index e9e8b3a..4ed5e2e 100644 --- a/src/service/price-service.js +++ b/src/service/price-service.js @@ -46,7 +46,7 @@ class PriceService { static #getPriceFunction(token) { if (token === C().BEAN) { return PriceService.getBeanPrice; - } else if ([C().WETH, C().CBETH, C().CBBTC, C().WSOL, C().USDC].includes(token)) { + } else if ([C().WETH, C().CBETH, C().CBBTC, C().WSOL, C().USDC, C().WSTETH].includes(token)) { return (options) => PriceService.getUsdOracleTokenPrice(token, options); } return () => ({ diff --git a/src/service/tractor/blueprints/blueprint-constants.js b/src/service/tractor/blueprints/blueprint-constants.js index 115156b..ade8bb3 100644 --- a/src/service/tractor/blueprints/blueprint-constants.js +++ b/src/service/tractor/blueprints/blueprint-constants.js @@ -8,7 +8,8 @@ class BlueprintConstants { [C().PINTOCBETH]: 2, [C().PINTOCBBTC]: 3, [C().PINTOUSDC]: 4, - [C().PINTOWSOL]: 5 + [C().PINTOWSOL]: 5, + [C().PINTOWSTETH]: 6 }; } diff --git a/test/service/exchange-service.test.js b/test/service/exchange-service.test.js index 3713cec..7cc1c74 100644 --- a/test/service/exchange-service.test.js +++ b/test/service/exchange-service.test.js @@ -13,8 +13,6 @@ const ERC20Info = require('../../src/datasources/erc20-info'); const BasinSubgraphRepository = require('../../src/repository/subgraph/basin-subgraph'); const TradeDto = require('../../src/repository/dto/TradeDto'); -const testTimestamp = 1715020584; - describe('ExchangeService', () => { beforeEach(() => { mockBeanstalkConstants(); diff --git a/test/util/mock-constants.js b/test/util/mock-constants.js index 4aeaab1..4bfa05e 100644 --- a/test/util/mock-constants.js +++ b/test/util/mock-constants.js @@ -46,12 +46,19 @@ function mockPintoERC20s() { symbol: 'U-PINTOWSOLCP2w', decimals: 18 }, + { + token: C().PINTOWSTETH, + name: 'PINTO:WSTETH Constant Product 2 Upgradeable Well', + symbol: 'U-PINTOWSTETHC2w', + decimals: 18 + }, { token: C().PINTOUSDC, name: 'PINTO:USDC Stable 2 Upgradeable Well', symbol: 'U-PINTOUSDCS2w', decimals: 18 }, { token: C().WETH, name: 'Wrapped Ether', symbol: 'WETH', decimals: 18 }, { token: C().CBETH, name: 'Coinbase Wrapped Staked ETH', symbol: 'cbETH', decimals: 18 }, { token: C().CBBTC, name: 'Coinbase Wrapped BTC', symbol: 'cbBTC', decimals: 8 }, { token: C().WSOL, name: 'Wrapped SOL', symbol: 'SOL', decimals: 9 }, - { token: C().USDC, name: 'USD Coin', symbol: 'USDC', decimals: 6 } + { token: C().USDC, name: 'USD Coin', symbol: 'USDC', decimals: 6 }, + { token: C().WSTETH, name: 'Wrapped Staked ETH', symbol: 'WSTETH', decimals: 18 } ]; jest.spyOn(ERC20Info, 'getTokenInfo').mockImplementation((token) => { From aac9c9f48995e62529df7f3a5e9e11a0241b7297 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:27:26 -0500 Subject: [PATCH 02/22] Fix tests --- src/repository/subgraph/basin-subgraph.js | 1 - test/service/exchange-service.test.js | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/repository/subgraph/basin-subgraph.js b/src/repository/subgraph/basin-subgraph.js index ef6cdf0..e45f08e 100644 --- a/src/repository/subgraph/basin-subgraph.js +++ b/src/repository/subgraph/basin-subgraph.js @@ -15,7 +15,6 @@ class BasinSubgraphRepository { } }`, `block: {number: ${blockNumber}}`, - '', 'isBeanstalk: true', { field: 'symbol', diff --git a/test/service/exchange-service.test.js b/test/service/exchange-service.test.js index 7cc1c74..104fb95 100644 --- a/test/service/exchange-service.test.js +++ b/test/service/exchange-service.test.js @@ -23,12 +23,12 @@ describe('ExchangeService', () => { it('should return all Basin tickers in the expected format', async () => { const wellsResponse = require('../mock-responses/subgraph/basin/wells.json'); - jest.spyOn(mockBasinSG, 'request').mockResolvedValueOnce(wellsResponse); + jest.spyOn(mockBasinSG, 'request').mockResolvedValue(wellsResponse); // In practice these 2 values are not necessary since the subsequent getWellPriceRange is also mocked. - jest.spyOn(BasinSubgraphRepository, 'getAllTrades').mockResolvedValueOnce(undefined); + jest.spyOn(BasinSubgraphRepository, 'getAllTrades').mockResolvedValue(undefined); jest.spyOn(ExchangeService, 'priceEventsByWell').mockReturnValueOnce(undefined); - jest.spyOn(LiquidityUtil, 'calcWellLiquidityUSD').mockResolvedValueOnce(27491579.59267346); - jest.spyOn(LiquidityUtil, 'calcDepth').mockResolvedValueOnce({ + jest.spyOn(LiquidityUtil, 'calcWellLiquidityUSD').mockResolvedValue(27491579.59267346); + jest.spyOn(LiquidityUtil, 'calcDepth').mockResolvedValue({ buy: { float: [135736.220357, 52.83352694098683] }, @@ -79,9 +79,7 @@ describe('ExchangeService', () => { }); test('Returns swap history', async () => { - jest - .spyOn(mockBasinSG, 'request') - .mockResolvedValueOnce(require('../mock-responses/subgraph/basin/swapHistory.json')); + jest.spyOn(mockBasinSG, 'request').mockResolvedValue(require('../mock-responses/subgraph/basin/swapHistory.json')); const options = { ticker_id: `${BEAN}_${WETH}`, From 49f6b4d38d94dce51c3cd7255d10575a67ade383 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:36:58 -0500 Subject: [PATCH 03/22] pintowsteth token seeder --- .../20241118003615-silo-tokens-base.js | 4 +- .../20251110193438-whitelist-wsteth.js | 97 +++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 src/repository/postgres/seeders/20251110193438-whitelist-wsteth.js diff --git a/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js b/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js index 0c667a0..e925bb1 100644 --- a/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js +++ b/src/repository/postgres/seeders/20241118003615-silo-tokens-base.js @@ -16,7 +16,7 @@ module.exports = { return; } const c = C('base'); - const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC, c.PINTOWSTETH]; + const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC]; // Add base tokens await AlchemyUtil.ready(c.CHAIN); @@ -83,7 +83,7 @@ module.exports = { async down(queryInterface, Sequelize) { if (EnvUtil.isChainEnabled('base')) { const c = C('base'); - const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC, c.PINTOWSTETH]; + const tokens = [c.BEAN, c.PINTOWETH, c.PINTOCBETH, c.PINTOCBBTC, c.PINTOWSOL, c.PINTOUSDC]; // Delete pinto tokens await queryInterface.bulkDelete(TOKEN_TABLE.env, { address: { diff --git a/src/repository/postgres/seeders/20251110193438-whitelist-wsteth.js b/src/repository/postgres/seeders/20251110193438-whitelist-wsteth.js new file mode 100644 index 0000000..5d45925 --- /dev/null +++ b/src/repository/postgres/seeders/20251110193438-whitelist-wsteth.js @@ -0,0 +1,97 @@ +'use strict'; + +const db = require('../models'); +const { C } = require('../../../constants/runtime-constants'); +const AlchemyUtil = require('../../../datasources/alchemy'); +const PromiseUtil = require('../../../utils/async/promise'); +const Contracts = require('../../../datasources/contracts/contracts'); +const EnvUtil = require('../../../utils/env'); +const { TOKEN_TABLE } = require('../../../constants/tables'); + +// This was copied from silo-tokens-base.js and modified to include only pintowsteth. + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + if (!EnvUtil.isChainEnabled('base')) { + console.log(`Skipping seeder: chain 'base' is not enabled.`); + return; + } + const c = C('base'); + const tokens = [c.PINTOWSTETH]; + + // Add base tokens + await AlchemyUtil.ready(c.CHAIN); + const beanstalk = Contracts.getBeanstalk(c); + + // Gets tokens that have already been populated + const existingTokens = await db.sequelize.models.Token.findAll({ + where: { + chain: c.CHAIN, + address: { + [Sequelize.Op.in]: tokens + } + }, + attributes: ['address'] + }); + + // Add new tokens only + const newTokens = tokens.filter((token) => !existingTokens.some((t) => t.address === token)); + if (newTokens.length > 0) { + const rows = []; + for (const token of newTokens) { + const erc20 = Contracts.get(token, c); + const [name, symbol, supply, decimals] = await Promise.all([ + erc20.name(), + erc20.symbol(), + erc20.totalSupply(), + (async () => Number(await erc20.decimals()))() + ]); + const [bdv, stalkEarnedPerSeason, stemTip, totalDeposited, totalDepositedBdv] = await Promise.all( + [ + PromiseUtil.defaultOnReject(1n)(beanstalk.bdv(token, BigInt(10 ** decimals))), + (async () => { + const tokenSettings = await beanstalk.tokenSettings(token); + return tokenSettings.stalkEarnedPerSeason; + })(), + beanstalk.stemTipForToken(token), + beanstalk.getTotalDeposited(token), + beanstalk.getTotalDepositedBdv(token) + // If any revert, they return null instead + ].map(PromiseUtil.defaultOnReject(null)) + ); + rows.push({ + address: token, + chain: c.CHAIN, + name, + symbol, + supply, + decimals, + isWhitelisted: true, + bdv, + stalkEarnedPerSeason, + stemTip, + totalDeposited, + totalDepositedBdv, + createdAt: new Date(), + updatedAt: new Date() + }); + } + + await queryInterface.bulkInsert(TOKEN_TABLE.env, rows); + } + }, + + async down(queryInterface, Sequelize) { + if (EnvUtil.isChainEnabled('base')) { + const c = C('base'); + const tokens = [c.PINTOWSTETH]; + // Delete pinto tokens + await queryInterface.bulkDelete(TOKEN_TABLE.env, { + address: { + [Sequelize.Op.in]: tokens + } + }); + } + } +}; From d94298b0f2f6e30bcc84e96e4c98b132ee2662c4 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Wed, 19 Nov 2025 12:26:56 -0500 Subject: [PATCH 04/22] Add wsteth addrs --- src/constants/raw/pinto-base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index 4962914..ee7062f 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -22,14 +22,14 @@ const contracts = { PINTOCBBTC: ['0x3e11226fe3d85142B734ABCe6e58918d5828d1b4', 18, wellAbi], PINTOWSOL: ['0x3e11444c7650234c748D743D8d374fcE2eE5E6C9', 18, wellAbi], PINTOUSDC: ['0x3e1133aC082716DDC3114bbEFEeD8B1731eA9cb1', 18, wellAbi], - PINTOWSTETH: ['TODO(wsteth)', 18, wellAbi], + PINTOWSTETH: ['0x3e1155480Fce43686793dd18E43104A01abCBC92', 18, wellAbi], SPINTO: ['0x00b174d66ada7d63789087f50a9b9e0e48446dc1', 18, wrappedDepositAbi], WETH: ['0x4200000000000000000000000000000000000006', 18, erc20Abi], CBETH: ['0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22', 18, erc20Abi], CBBTC: ['0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', 8, erc20Abi], WSOL: ['0x1C61629598e4a901136a81BC138E5828dc150d67', 9, erc20Abi], USDC: ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', 6, erc20Abi], - WSTETH: ['TODO(wsteth)', 18, erc20Abi], + WSTETH: ['0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452', 18, erc20Abi], CP2: ['0xBA510C289fD067EBbA41335afa11F0591940d6fe', null, wellFunctionAbi], STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], From a8b70ffb77e1e2413bfbd3ddf48899c9e5cd1f43 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:20:17 -0500 Subject: [PATCH 05/22] Update pintowsteth address --- src/constants/raw/pinto-base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index ee7062f..ad41dbc 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -22,7 +22,7 @@ const contracts = { PINTOCBBTC: ['0x3e11226fe3d85142B734ABCe6e58918d5828d1b4', 18, wellAbi], PINTOWSOL: ['0x3e11444c7650234c748D743D8d374fcE2eE5E6C9', 18, wellAbi], PINTOUSDC: ['0x3e1133aC082716DDC3114bbEFEeD8B1731eA9cb1', 18, wellAbi], - PINTOWSTETH: ['0x3e1155480Fce43686793dd18E43104A01abCBC92', 18, wellAbi], + PINTOWSTETH: ['0x3e1155245FF9a6a019Bc35827e801c6ED2CE91b9', 18, wellAbi], SPINTO: ['0x00b174d66ada7d63789087f50a9b9e0e48446dc1', 18, wrappedDepositAbi], WETH: ['0x4200000000000000000000000000000000000006', 18, erc20Abi], CBETH: ['0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22', 18, erc20Abi], From fa7c9830ebed7f359646e17b41c68c1821a90256 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Wed, 14 Jan 2026 14:16:55 -0500 Subject: [PATCH 06/22] Update abi folder structure --- src/constants/raw/pinto-base.js | 18 +- .../v0}/ConvertUpBlueprintV0.json | 0 .../v0}/SiloHelpers.json | 0 .../v0}/TractorHelpers.json | 0 .../abi/tractor/sow/referral/SiloHelpers.json | 712 ++++++++++++++++ .../sow/referral/SowBlueprintReferral.json | 687 ++++++++++++++++ .../tractor/sow/referral/TractorHelpers.json | 775 ++++++++++++++++++ .../{sow-v0 => sow/v0}/SowBlueprintV0.json | 0 .../{sow-v0 => sow/v0}/TractorHelpers.json | 0 src/service/tractor/blueprints/sow-v0.js | 1 + 10 files changed, 2187 insertions(+), 6 deletions(-) rename src/datasources/abi/tractor/{convert-up-v0 => convert-up/v0}/ConvertUpBlueprintV0.json (100%) rename src/datasources/abi/tractor/{convert-up-v0 => convert-up/v0}/SiloHelpers.json (100%) rename src/datasources/abi/tractor/{convert-up-v0 => convert-up/v0}/TractorHelpers.json (100%) create mode 100644 src/datasources/abi/tractor/sow/referral/SiloHelpers.json create mode 100644 src/datasources/abi/tractor/sow/referral/SowBlueprintReferral.json create mode 100644 src/datasources/abi/tractor/sow/referral/TractorHelpers.json rename src/datasources/abi/tractor/{sow-v0 => sow/v0}/SowBlueprintV0.json (100%) rename src/datasources/abi/tractor/{sow-v0 => sow/v0}/TractorHelpers.json (100%) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index cd83a28..6cdecdb 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -8,11 +8,14 @@ const erc20Abi = require('../../datasources/abi/ERC20.json'); const wrappedDepositAbi = require('../../datasources/abi/WrappedDepositERC20.json'); const wellAbi = require('../../datasources/abi/basin/Well.json'); const wellFunctionAbi = require('../../datasources/abi/basin/WellFunction.json'); -const sowBlueprintV0Abi = require('../../datasources/abi/tractor/sow-v0/SowBlueprintV0.json'); -const tractorHelpersAbi = require('../../datasources/abi/tractor/sow-v0/TractorHelpers.json'); -const convertUpBlueprintV0Abi = require('../../datasources/abi/tractor/convert-up-v0/ConvertUpBlueprintV0.json'); -const convertUpTractorHelpersAbi = require('../../datasources/abi/tractor/convert-up-v0/TractorHelpers.json'); -const convertUpSiloHelpersAbi = require('../../datasources/abi/tractor/convert-up-v0/SiloHelpers.json'); +const sowBlueprintV0Abi = require('../../datasources/abi/tractor/sow/v0/SowBlueprintV0.json'); +const sowV0TractorHelpersAbi = require('../../datasources/abi/tractor/sow/v0/TractorHelpers.json'); +const sowReferralAbi = require('../../datasources/abi/tractor/sow/referral/SowBlueprintReferral.json'); +const sowReferralTractorHelpersAbi = require('../../datasources/abi/tractor/sow/referral/TractorHelpers.json'); +const sowReferralSiloHelpersAbi = require('../../datasources/abi/tractor/sow/referral/SiloHelpers.json'); +const convertUpBlueprintV0Abi = require('../../datasources/abi/tractor/convert-up/v0/ConvertUpBlueprintV0.json'); +const convertUpTractorHelpersAbi = require('../../datasources/abi/tractor/convert-up/v0/TractorHelpers.json'); +const convertUpSiloHelpersAbi = require('../../datasources/abi/tractor/convert-up/v0/SiloHelpers.json'); const contracts = { BEANSTALK: ['0xD1A0D188E861ed9d15773a2F3574a2e94134bA8f', null, pintoDiamondAbi], @@ -31,7 +34,10 @@ const contracts = { CP2: ['0xBA510C289fD067EBbA41335afa11F0591940d6fe', null, wellFunctionAbi], STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], - SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, tractorHelpersAbi], + SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, sowV0TractorHelpersAbi], + SOW_REFERRAL: ['tbd', null, sowReferralAbi], + SOW_REFERRAL_TRACTOR_HELPERS: ['tbd', null, sowReferralTractorHelpersAbi], + SOW_REFERRAL_SILO_HELPERS: ['tbd', null, sowReferralSiloHelpersAbi], CONVERT_UP_V0: ['0x5167Ae1fF37bE08D9cc9188C7e64DB228B6F06ca', null, convertUpBlueprintV0Abi], CONVERT_UP_V0_TRACTOR_HELPERS: ['0xBCa2F299602c2a43850c8b2FD19D5275D0F388b6', null, convertUpTractorHelpersAbi], CONVERT_UP_V0_SILO_HELPERS: ['0xE145082A7C5EDd1767f8148A6c29a17488d1eb31', null, convertUpSiloHelpersAbi] diff --git a/src/datasources/abi/tractor/convert-up-v0/ConvertUpBlueprintV0.json b/src/datasources/abi/tractor/convert-up/v0/ConvertUpBlueprintV0.json similarity index 100% rename from src/datasources/abi/tractor/convert-up-v0/ConvertUpBlueprintV0.json rename to src/datasources/abi/tractor/convert-up/v0/ConvertUpBlueprintV0.json diff --git a/src/datasources/abi/tractor/convert-up-v0/SiloHelpers.json b/src/datasources/abi/tractor/convert-up/v0/SiloHelpers.json similarity index 100% rename from src/datasources/abi/tractor/convert-up-v0/SiloHelpers.json rename to src/datasources/abi/tractor/convert-up/v0/SiloHelpers.json diff --git a/src/datasources/abi/tractor/convert-up-v0/TractorHelpers.json b/src/datasources/abi/tractor/convert-up/v0/TractorHelpers.json similarity index 100% rename from src/datasources/abi/tractor/convert-up-v0/TractorHelpers.json rename to src/datasources/abi/tractor/convert-up/v0/TractorHelpers.json diff --git a/src/datasources/abi/tractor/sow/referral/SiloHelpers.json b/src/datasources/abi/tractor/sow/referral/SiloHelpers.json new file mode 100644 index 0000000..b115176 --- /dev/null +++ b/src/datasources/abi/tractor/sow/referral/SiloHelpers.json @@ -0,0 +1,712 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_beanstalk", + "type": "address" + }, + { + "internalType": "address", + "name": "_tractorHelpers", + "type": "address" + }, + { + "internalType": "address", + "name": "_priceManipulation", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getAddressAndStem", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getBeanAmountAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "beanAmountAvailable", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "minStem", + "type": "int96" + } + ], + "name": "getDepositStemsAndAmountsToWithdraw", + "outputs": [ + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "availableAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "minStem", + "type": "int96" + }, + { + "internalType": "bool", + "name": "excludeGerminatingDeposits", + "type": "bool" + }, + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + }, + { + "internalType": "enum LibSiloHelpers.Mode", + "name": "lowStalkDeposits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "lowGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "maxStem", + "type": "int96" + }, + { + "internalType": "int256", + "name": "seedDifference", + "type": "int256" + } + ], + "internalType": "struct LibSiloHelpers.FilterParams", + "name": "filterParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "excludingPlan", + "type": "tuple" + } + ], + "name": "getDepositStemsAndAmountsToWithdraw", + "outputs": [ + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "availableAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getSortedDeposits", + "outputs": [ + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTokenIndex", + "outputs": [ + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getUserDepositedTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "depositedTokens", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistStatusAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256", + "name": "targetAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "minStem", + "type": "int96" + }, + { + "internalType": "bool", + "name": "excludeGerminatingDeposits", + "type": "bool" + }, + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + }, + { + "internalType": "enum LibSiloHelpers.Mode", + "name": "lowStalkDeposits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "lowGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "maxStem", + "type": "int96" + }, + { + "internalType": "int256", + "name": "seedDifference", + "type": "int256" + } + ], + "internalType": "struct LibSiloHelpers.FilterParams", + "name": "filterParams", + "type": "tuple" + } + ], + "name": "getWithdrawalPlan", + "outputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "plan", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256", + "name": "targetAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "minStem", + "type": "int96" + }, + { + "internalType": "bool", + "name": "excludeGerminatingDeposits", + "type": "bool" + }, + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + }, + { + "internalType": "enum LibSiloHelpers.Mode", + "name": "lowStalkDeposits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "lowGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "maxStem", + "type": "int96" + }, + { + "internalType": "int256", + "name": "seedDifference", + "type": "int256" + } + ], + "internalType": "struct LibSiloHelpers.FilterParams", + "name": "filterParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "excludingPlan", + "type": "tuple" + } + ], + "name": "getWithdrawalPlanExcludingPlan", + "outputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "plan", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "slippageRatio", + "type": "uint256" + } + ], + "name": "isValidSlippage", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "sortDeposits", + "outputs": [ + { + "internalType": "address[]", + "name": "updatedTokens", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256", + "name": "targetAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "minStem", + "type": "int96" + }, + { + "internalType": "bool", + "name": "excludeGerminatingDeposits", + "type": "bool" + }, + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + }, + { + "internalType": "enum LibSiloHelpers.Mode", + "name": "lowStalkDeposits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "lowGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "maxStem", + "type": "int96" + }, + { + "internalType": "int256", + "name": "seedDifference", + "type": "int256" + } + ], + "internalType": "struct LibSiloHelpers.FilterParams", + "name": "filterParams", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "slippageRatio", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "plan", + "type": "tuple" + } + ], + "name": "withdrawBeansFromSources", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/datasources/abi/tractor/sow/referral/SowBlueprintReferral.json b/src/datasources/abi/tractor/sow/referral/SowBlueprintReferral.json new file mode 100644 index 0000000..6040c84 --- /dev/null +++ b/src/datasources/abi/tractor/sow/referral/SowBlueprintReferral.json @@ -0,0 +1,687 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_beanstalk", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_tractorHelpers", + "type": "address" + }, + { + "internalType": "address", + "name": "_siloHelpers", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isPaused", + "type": "bool" + } + ], + "name": "FunctionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalAmountSown", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountUnfulfilled", + "type": "uint256" + } + ], + "name": "SowOrderComplete", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "name": "functionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getLastExecutedSeason", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getPintosLeftToSow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "pauseFunction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "siloHelpers", + "outputs": [ + { + "internalType": "contract SiloHelpers", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint8[]", + "name": "sourceTokenIndices", + "type": "uint8[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountToSow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountToSowPerSeason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountToSowPerSeason", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowAmounts", + "name": "sowAmounts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "minTemp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPodlineLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "runBlocksAfterSunrise", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slippageRatio", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowParams", + "name": "sowParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "whitelistedOperators", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tipAddress", + "type": "address" + }, + { + "internalType": "int256", + "name": "operatorTipAmount", + "type": "int256" + } + ], + "internalType": "struct SowBlueprintBase.OperatorParams", + "name": "opParams", + "type": "tuple" + } + ], + "internalType": "struct SowBlueprintBase.SowBlueprintStruct", + "name": "params", + "type": "tuple" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "internalType": "struct SowBlueprintReferral.SowReferralBlueprintStruct", + "name": "params", + "type": "tuple" + } + ], + "name": "sowBlueprintReferral", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "tractorHelpers", + "outputs": [ + { + "internalType": "contract TractorHelpers", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "functionSelector", + "type": "bytes4" + } + ], + "name": "unpauseFunction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint8[]", + "name": "sourceTokenIndices", + "type": "uint8[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountToSow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountToSowPerSeason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountToSowPerSeason", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowAmounts", + "name": "sowAmounts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "minTemp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPodlineLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "runBlocksAfterSunrise", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slippageRatio", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowParams", + "name": "sowParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "whitelistedOperators", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tipAddress", + "type": "address" + }, + { + "internalType": "int256", + "name": "operatorTipAmount", + "type": "int256" + } + ], + "internalType": "struct SowBlueprintBase.OperatorParams", + "name": "opParams", + "type": "tuple" + } + ], + "internalType": "struct SowBlueprintBase.SowBlueprintStruct", + "name": "params", + "type": "tuple" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "internalType": "struct SowBlueprintReferral.SowReferralBlueprintStruct", + "name": "params", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "blueprintPublisher", + "type": "address" + } + ], + "name": "validateParamsAndReturnBeanstalkState", + "outputs": [ + { + "internalType": "uint256", + "name": "availableSoil", + "type": "uint256" + }, + { + "internalType": "address", + "name": "beanToken", + "type": "address" + }, + { + "internalType": "uint32", + "name": "currentSeason", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "pintoLeftToSow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalAmountToSow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBeansNeeded", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "plan", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint8[]", + "name": "sourceTokenIndices", + "type": "uint8[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalAmountToSow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountToSowPerSeason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxAmountToSowPerSeason", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowAmounts", + "name": "sowAmounts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "minTemp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPodlineLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGrownStalkPerBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "runBlocksAfterSunrise", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slippageRatio", + "type": "uint256" + } + ], + "internalType": "struct SowBlueprintBase.SowParams", + "name": "sowParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address[]", + "name": "whitelistedOperators", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tipAddress", + "type": "address" + }, + { + "internalType": "int256", + "name": "operatorTipAmount", + "type": "int256" + } + ], + "internalType": "struct SowBlueprintBase.OperatorParams", + "name": "opParams", + "type": "tuple" + } + ], + "internalType": "struct SowBlueprintBase.SowBlueprintStruct", + "name": "params", + "type": "tuple" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "internalType": "struct SowBlueprintReferral.SowReferralBlueprintStruct[]", + "name": "paramsArray", + "type": "tuple[]" + }, + { + "internalType": "bytes32[]", + "name": "orderHashes", + "type": "bytes32[]" + }, + { + "internalType": "address[]", + "name": "blueprintPublishers", + "type": "address[]" + } + ], + "name": "validateParamsAndReturnBeanstalkStateArray", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "validOrderHashes", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } +] \ No newline at end of file diff --git a/src/datasources/abi/tractor/sow/referral/TractorHelpers.json b/src/datasources/abi/tractor/sow/referral/TractorHelpers.json new file mode 100644 index 0000000..7936716 --- /dev/null +++ b/src/datasources/abi/tractor/sow/referral/TractorHelpers.json @@ -0,0 +1,775 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_beanstalk", + "type": "address" + }, + { + "internalType": "address", + "name": "_beanstalkPrice", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum TractorHelpers.RewardType", + "name": "rewardType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount", + "type": "int256" + } + ], + "name": "OperatorReward", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "add", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "selector", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "options", + "type": "bytes32[]" + } + ], + "name": "bytes32Switch", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "condition", + "type": "bool" + } + ], + "name": "check", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan[]", + "name": "plans", + "type": "tuple[]" + } + ], + "name": "combineWithdrawalPlans", + "outputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "sourceTokens", + "type": "address[]" + }, + { + "internalType": "int96[][]", + "name": "stems", + "type": "int96[][]" + }, + { + "internalType": "uint256[][]", + "name": "amounts", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "availableBeans", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "totalAvailableBeans", + "type": "uint256" + } + ], + "internalType": "struct LibSiloHelpers.WithdrawalPlan", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "div", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "eq", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getAddressAndStem", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanstalkPrice", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getHighestSeedToken", + "outputs": [ + { + "internalType": "address", + "name": "highestSeedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seedAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getLPTokensToWithdrawForBeans", + "outputs": [ + { + "internalType": "uint256", + "name": "lpAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLowestSeedToken", + "outputs": [ + { + "internalType": "address", + "name": "lowestSeedToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "seedAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getSortedDeposits", + "outputs": [ + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSortedWhitelistedTokensBySeeds", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "seeds", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTokenIndex", + "outputs": [ + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + } + ], + "name": "getTokensAscendingPrice", + "outputs": [ + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokensAscendingPrice", + "outputs": [ + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "excludeBean", + "type": "bool" + } + ], + "name": "getTokensAscendingSeeds", + "outputs": [ + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256[]", + "name": "seeds", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokensAscendingSeeds", + "outputs": [ + { + "internalType": "uint8[]", + "name": "tokenIndices", + "type": "uint8[]" + }, + { + "internalType": "uint256[]", + "name": "seeds", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistStatusAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "gt", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "gte", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "whitelistedOperators", + "type": "address[]" + } + ], + "name": "isOperatorWhitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "lt", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "lte", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "mod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "mul", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "c", + "type": "uint256" + } + ], + "name": "mulDiv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "neq", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "sub", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "address", + "name": "tipAddress", + "type": "address" + }, + { + "internalType": "int256", + "name": "tipAmount", + "type": "int256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "from", + "type": "uint8" + }, + { + "internalType": "enum LibTransfer.To", + "name": "to", + "type": "uint8" + } + ], + "name": "tip", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/datasources/abi/tractor/sow-v0/SowBlueprintV0.json b/src/datasources/abi/tractor/sow/v0/SowBlueprintV0.json similarity index 100% rename from src/datasources/abi/tractor/sow-v0/SowBlueprintV0.json rename to src/datasources/abi/tractor/sow/v0/SowBlueprintV0.json diff --git a/src/datasources/abi/tractor/sow-v0/TractorHelpers.json b/src/datasources/abi/tractor/sow/v0/TractorHelpers.json similarity index 100% rename from src/datasources/abi/tractor/sow-v0/TractorHelpers.json rename to src/datasources/abi/tractor/sow/v0/TractorHelpers.json diff --git a/src/service/tractor/blueprints/sow-v0.js b/src/service/tractor/blueprints/sow-v0.js index 5f64587..9933fa4 100644 --- a/src/service/tractor/blueprints/sow-v0.js +++ b/src/service/tractor/blueprints/sow-v0.js @@ -192,6 +192,7 @@ class TractorSowV0Service extends Blueprint { // If possible, decodes blueprint data into the sowBlueprintv0 call static decodeBlueprintData(blueprintData) { const iBeanstalk = Interfaces.getBeanstalk(); + // Could iterate different sowing compatible blueprints here. const iSowV0 = Interfaces.get(C().SOW_V0); const advFarm = Interfaces.safeParseTxn(iBeanstalk, blueprintData); From 0bb85551c52388cae42ba80890d011f5f650d41c Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:05:47 -0500 Subject: [PATCH 07/22] Refactor v0 blueprint files and rename tables --- src/constants/tables.js | 13 ++++++++++ src/constants/tractor.js | 8 +++---- ...ecutionDto.js => ConvertUpExecutionDto.js} | 8 +++---- ...rtUpV0OrderDto.js => ConvertUpOrderDto.js} | 8 +++---- ...vertUpV0Dto.js => SnapshotConvertUpDto.js} | 8 +++---- ...{SnapshotSowV0Dto.js => SnapshotSowDto.js} | 8 +++---- ...owV0ExecutionDto.js => SowExecutionDto.js} | 8 +++---- .../{SowV0OrderDto.js => SowOrderDto.js} | 8 +++---- ...20260114193519-general-blueprint-tables.js | 24 +++++++++++++++++++ ...er.js => snapshot-convert-up-assembler.js} | 8 +++---- ...assembler.js => snapshot-sow-assembler.js} | 8 +++---- ...tractor-execution-convert-up-assembler.js} | 8 +++---- ....js => tractor-execution-sow-assembler.js} | 8 +++---- ... => tractor-order-convert-up-assembler.js} | 8 +++---- ...bler.js => tractor-order-sow-assembler.js} | 8 +++---- ... => tractor-execution-convert-up-model.js} | 18 +++++++------- ...odel.js => tractor-execution-sow-model.js} | 18 +++++++------- ...l.js => tractor-order-convert-up-model.js} | 14 +++++------ ...v0-model.js => tractor-order-sow-model.js} | 14 +++++------ ...s => tractor-snapshot-convert-up-model.js} | 10 ++++---- ...model.js => tractor-snapshot-sow-model.js} | 10 ++++---- src/routes/tractor-routes.js | 12 +++++----- src/scheduled/tasks/tractor.js | 6 ++--- .../{convert-up-v0.js => convert-up.js} | 24 +++++++++---------- .../tractor/blueprints/{sow-v0.js => sow.js} | 24 +++++++++---------- ...vice.js => snapshot-convert-up-service.js} | 24 +++++++++---------- ...-v0-service.js => snapshot-sow-service.js} | 24 +++++++++---------- test/setup/jest.setup.js | 4 ++-- test/tractor/convert.test.js | 14 +++++------ test/tractor/decoding.test.js | 20 ++++++++-------- test/tractor/sow.test.js | 24 +++++++++---------- test/tractor/tractor.test.js | 12 +++++----- 32 files changed, 225 insertions(+), 188 deletions(-) rename src/repository/dto/tractor/{ConvertUpV0ExecutionDto.js => ConvertUpExecutionDto.js} (92%) rename src/repository/dto/tractor/{ConvertUpV0OrderDto.js => ConvertUpOrderDto.js} (95%) rename src/repository/dto/tractor/{SnapshotConvertUpV0Dto.js => SnapshotConvertUpDto.js} (90%) rename src/repository/dto/tractor/{SnapshotSowV0Dto.js => SnapshotSowDto.js} (90%) rename src/repository/dto/tractor/{SowV0ExecutionDto.js => SowExecutionDto.js} (93%) rename src/repository/dto/tractor/{SowV0OrderDto.js => SowOrderDto.js} (94%) create mode 100644 src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js rename src/repository/postgres/models/assemblers/tractor/{snapshot-convert-up-v0-assembler.js => snapshot-convert-up-assembler.js} (79%) rename src/repository/postgres/models/assemblers/tractor/{snapshot-sow-v0-assembler.js => snapshot-sow-assembler.js} (79%) rename src/repository/postgres/models/assemblers/tractor/{tractor-execution-convert-up-v0-assembler.js => tractor-execution-convert-up-assembler.js} (78%) rename src/repository/postgres/models/assemblers/tractor/{tractor-execution-sow-v0-assembler.js => tractor-execution-sow-assembler.js} (75%) rename src/repository/postgres/models/assemblers/tractor/{tractor-order-convert-up-v0-assembler.js => tractor-order-convert-up-assembler.js} (86%) rename src/repository/postgres/models/assemblers/tractor/{tractor-order-sow-v0-assembler.js => tractor-order-sow-assembler.js} (82%) rename src/repository/postgres/models/{tractor-execution-convert-up-v0-model.js => tractor-execution-convert-up-model.js} (78%) rename src/repository/postgres/models/{tractor-execution-sow-v0-model.js => tractor-execution-sow-model.js} (61%) rename src/repository/postgres/models/{tractor-order-convert-up-v0-model.js => tractor-order-convert-up-model.js} (85%) rename src/repository/postgres/models/{tractor-order-sow-v0-model.js => tractor-order-sow-model.js} (83%) rename src/repository/postgres/models/{tractor-snapshot-convert-up-v0-model.js => tractor-snapshot-convert-up-model.js} (89%) rename src/repository/postgres/models/{tractor-snapshot-sow-v0-model.js => tractor-snapshot-sow-model.js} (88%) rename src/service/tractor/blueprints/{convert-up-v0.js => convert-up.js} (91%) rename src/service/tractor/blueprints/{sow-v0.js => sow.js} (91%) rename src/service/tractor/snapshots/{snapshot-convert-up-v0-service.js => snapshot-convert-up-service.js} (81%) rename src/service/tractor/snapshots/{snapshot-sow-v0-service.js => snapshot-sow-service.js} (83%) diff --git a/src/constants/tables.js b/src/constants/tables.js index 56c1c1f..9fffb61 100644 --- a/src/constants/tables.js +++ b/src/constants/tables.js @@ -19,13 +19,20 @@ const SILO_INFLOW_TABLE = envNamed('silo_inflow'); const SILO_INFLOW_SNAPSHOT_TABLE = envNamed('silo_inflow_snapshot'); const TOKEN_TABLE = envNamed('token'); const TRACTOR_EXECUTION_TABLE = envNamed('tractor_execution'); +// TODO: will need to remove the old v0 ones, ok to replace those constants in the migration files that used them const TRACTOR_EXECUTION_SOW_V0_TABLE = envNamed('tractor_execution_sow_v0'); const TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE = envNamed('tractor_execution_convert_up_v0'); +const TRACTOR_EXECUTION_SOW_TABLE = envNamed('tractor_execution_sow'); +const TRACTOR_EXECUTION_CONVERT_UP_TABLE = envNamed('tractor_execution_convert_up'); const TRACTOR_ORDER_TABLE = envNamed('tractor_order'); const TRACTOR_ORDER_SOW_V0_TABLE = envNamed('tractor_order_sow_v0'); const TRACTOR_ORDER_CONVERT_UP_V0_TABLE = envNamed('tractor_order_convert_up_v0'); +const TRACTOR_ORDER_SOW_TABLE = envNamed('tractor_order_sow'); +const TRACTOR_ORDER_CONVERT_UP_TABLE = envNamed('tractor_order_convert_up'); const TRACTOR_SNAPSHOT_SOW_V0_TABLE = envNamed('tractor_snapshot_sow_v0'); const TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE = envNamed('tractor_snapshot_convert_up_v0'); +const TRACTOR_SNAPSHOT_SOW_TABLE = envNamed('tractor_snapshot_sow'); +const TRACTOR_SNAPSHOT_CONVERT_UP_TABLE = envNamed('tractor_snapshot_convert_up'); const YIELD_TABLE = envNamed('yield'); module.exports = { @@ -40,10 +47,16 @@ module.exports = { TRACTOR_EXECUTION_TABLE, TRACTOR_EXECUTION_SOW_V0_TABLE, TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE, + TRACTOR_EXECUTION_SOW_TABLE, + TRACTOR_EXECUTION_CONVERT_UP_TABLE, TRACTOR_ORDER_TABLE, TRACTOR_ORDER_SOW_V0_TABLE, TRACTOR_ORDER_CONVERT_UP_V0_TABLE, + TRACTOR_ORDER_SOW_TABLE, + TRACTOR_ORDER_CONVERT_UP_TABLE, TRACTOR_SNAPSHOT_SOW_V0_TABLE, TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE, + TRACTOR_SNAPSHOT_SOW_TABLE, + TRACTOR_SNAPSHOT_CONVERT_UP_TABLE, YIELD_TABLE }; diff --git a/src/constants/tractor.js b/src/constants/tractor.js index f1f79b6..a2956c1 100644 --- a/src/constants/tractor.js +++ b/src/constants/tractor.js @@ -1,11 +1,11 @@ -const TractorConvertUpV0Service = require('../service/tractor/blueprints/convert-up-v0'); -const TractorSowV0Service = require('../service/tractor/blueprints/sow-v0'); +const TractorConvertUpService = require('../service/tractor/blueprints/convert-up'); +const TractorSowService = require('../service/tractor/blueprints/sow'); class TractorConstants { static knownBlueprints() { return { - [TractorSowV0Service.orderType]: TractorSowV0Service, - [TractorConvertUpV0Service.orderType]: TractorConvertUpV0Service + [TractorSowService.orderType]: TractorSowService, + [TractorConvertUpService.orderType]: TractorConvertUpService }; } } diff --git a/src/repository/dto/tractor/ConvertUpV0ExecutionDto.js b/src/repository/dto/tractor/ConvertUpExecutionDto.js similarity index 92% rename from src/repository/dto/tractor/ConvertUpV0ExecutionDto.js rename to src/repository/dto/tractor/ConvertUpExecutionDto.js index f64572a..e1b3ac8 100644 --- a/src/repository/dto/tractor/ConvertUpV0ExecutionDto.js +++ b/src/repository/dto/tractor/ConvertUpExecutionDto.js @@ -1,7 +1,7 @@ const PriceService = require('../../../service/price-service'); const BlueprintConstants = require('../../../service/tractor/blueprints/blueprint-constants'); -class ConvertUpV0ExecutionDto { +class ConvertUpExecutionDto { constructor(type, d) { if (type === 'data') { const { baseExecutionDto, innerEvents } = d; @@ -52,7 +52,7 @@ class ConvertUpV0ExecutionDto { } static async fromExecutionContext(convertExecutionContext) { - const convertExecutionDto = new ConvertUpV0ExecutionDto('data', convertExecutionContext); + const convertExecutionDto = new ConvertUpExecutionDto('data', convertExecutionContext); // Assign before/after prices const executionBlock = convertExecutionContext.innerEvents[0].rawLog.blockNumber; @@ -65,8 +65,8 @@ class ConvertUpV0ExecutionDto { } static fromModel(dbModel) { - return new ConvertUpV0ExecutionDto('db', dbModel); + return new ConvertUpExecutionDto('db', dbModel); } } -module.exports = ConvertUpV0ExecutionDto; +module.exports = ConvertUpExecutionDto; diff --git a/src/repository/dto/tractor/ConvertUpV0OrderDto.js b/src/repository/dto/tractor/ConvertUpOrderDto.js similarity index 95% rename from src/repository/dto/tractor/ConvertUpV0OrderDto.js rename to src/repository/dto/tractor/ConvertUpOrderDto.js index 8a32d17..425d213 100644 --- a/src/repository/dto/tractor/ConvertUpV0OrderDto.js +++ b/src/repository/dto/tractor/ConvertUpOrderDto.js @@ -1,7 +1,7 @@ const { C } = require('../../../constants/runtime-constants'); const { intToStalkMode } = require('../../postgres/models/types/types'); -class ConvertUpV0OrderDto { +class ConvertUpOrderDto { constructor(type, d) { if (type === 'data') { this.blueprintHash = d.blueprintHash; @@ -51,11 +51,11 @@ class ConvertUpV0OrderDto { } static fromBlueprintCalldata(blueprintData) { - return new ConvertUpV0OrderDto('data', blueprintData); + return new ConvertUpOrderDto('data', blueprintData); } static fromModel(dbModel) { - return new ConvertUpV0OrderDto('db', dbModel); + return new ConvertUpOrderDto('db', dbModel); } async updateFieldsUponExecution(executionEvents) { @@ -82,4 +82,4 @@ class ConvertUpV0OrderDto { } } -module.exports = ConvertUpV0OrderDto; +module.exports = ConvertUpOrderDto; diff --git a/src/repository/dto/tractor/SnapshotConvertUpV0Dto.js b/src/repository/dto/tractor/SnapshotConvertUpDto.js similarity index 90% rename from src/repository/dto/tractor/SnapshotConvertUpV0Dto.js rename to src/repository/dto/tractor/SnapshotConvertUpDto.js index ee36066..8ab9adb 100644 --- a/src/repository/dto/tractor/SnapshotConvertUpV0Dto.js +++ b/src/repository/dto/tractor/SnapshotConvertUpDto.js @@ -1,4 +1,4 @@ -class SnapshotConvertUpV0Dto { +class SnapshotConvertUpDto { constructor(type, d) { if (type === 'init') { const { block, timestamp, season, snapshotData } = d; @@ -36,12 +36,12 @@ class SnapshotConvertUpV0Dto { } static fromLiveSnapshot(liveSnapshot) { - return new SnapshotConvertUpV0Dto('init', liveSnapshot); + return new SnapshotConvertUpDto('init', liveSnapshot); } static fromModel(dbModel) { - return new SnapshotConvertUpV0Dto('model', dbModel); + return new SnapshotConvertUpDto('model', dbModel); } } -module.exports = SnapshotConvertUpV0Dto; +module.exports = SnapshotConvertUpDto; diff --git a/src/repository/dto/tractor/SnapshotSowV0Dto.js b/src/repository/dto/tractor/SnapshotSowDto.js similarity index 90% rename from src/repository/dto/tractor/SnapshotSowV0Dto.js rename to src/repository/dto/tractor/SnapshotSowDto.js index af84069..eb7f5d5 100644 --- a/src/repository/dto/tractor/SnapshotSowV0Dto.js +++ b/src/repository/dto/tractor/SnapshotSowDto.js @@ -1,4 +1,4 @@ -class SnapshotSowV0Dto { +class SnapshotSowDto { constructor(type, d) { if (type === 'init') { const { block, timestamp, season, snapshotData } = d; @@ -32,12 +32,12 @@ class SnapshotSowV0Dto { } static fromLiveSnapshot(liveSnapshot) { - return new SnapshotSowV0Dto('init', liveSnapshot); + return new SnapshotSowDto('init', liveSnapshot); } static fromModel(dbModel) { - return new SnapshotSowV0Dto('model', dbModel); + return new SnapshotSowDto('model', dbModel); } } -module.exports = SnapshotSowV0Dto; +module.exports = SnapshotSowDto; diff --git a/src/repository/dto/tractor/SowV0ExecutionDto.js b/src/repository/dto/tractor/SowExecutionDto.js similarity index 93% rename from src/repository/dto/tractor/SowV0ExecutionDto.js rename to src/repository/dto/tractor/SowExecutionDto.js index c2c1c8c..a9ac21d 100644 --- a/src/repository/dto/tractor/SowV0ExecutionDto.js +++ b/src/repository/dto/tractor/SowExecutionDto.js @@ -2,7 +2,7 @@ const Contracts = require('../../../datasources/contracts/contracts'); const BlueprintConstants = require('../../../service/tractor/blueprints/blueprint-constants'); const { fromBigInt } = require('../../../utils/number'); -class SowV0ExecutionDto { +class SowExecutionDto { constructor(type, d) { if (type === 'data') { const { baseExecutionDto, innerEvents } = d; @@ -32,7 +32,7 @@ class SowV0ExecutionDto { } static async fromExecutionContext(sowExecutionContext) { - const sowExecutionDto = new SowV0ExecutionDto('data', sowExecutionContext); + const sowExecutionDto = new SowExecutionDto('data', sowExecutionContext); // Assign place in line const sowEvt = sowExecutionContext.innerEvents.find((e) => e.name === 'Sow'); @@ -48,7 +48,7 @@ class SowV0ExecutionDto { } static fromModel(dbModel) { - return new SowV0ExecutionDto('db', dbModel); + return new SowExecutionDto('db', dbModel); } async determineWithdrawnTokens(innerEvents) { @@ -78,4 +78,4 @@ class SowV0ExecutionDto { } } -module.exports = SowV0ExecutionDto; +module.exports = SowExecutionDto; diff --git a/src/repository/dto/tractor/SowV0OrderDto.js b/src/repository/dto/tractor/SowOrderDto.js similarity index 94% rename from src/repository/dto/tractor/SowV0OrderDto.js rename to src/repository/dto/tractor/SowOrderDto.js index 9ac4801..9ba0482 100644 --- a/src/repository/dto/tractor/SowV0OrderDto.js +++ b/src/repository/dto/tractor/SowOrderDto.js @@ -1,6 +1,6 @@ const Contracts = require('../../../datasources/contracts/contracts'); -class SowV0OrderDto { +class SowOrderDto { constructor(type, d) { if (type === 'data') { this.blueprintHash = d.blueprintHash; @@ -38,11 +38,11 @@ class SowV0OrderDto { } static fromBlueprintCalldata(blueprintData) { - return new SowV0OrderDto('data', blueprintData); + return new SowOrderDto('data', blueprintData); } static fromModel(dbModel) { - return new SowV0OrderDto('db', dbModel); + return new SowOrderDto('db', dbModel); } async updateFieldsUponExecution(executionEvents) { @@ -62,4 +62,4 @@ class SowV0OrderDto { } } -module.exports = SowV0OrderDto; +module.exports = SowOrderDto; diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js new file mode 100644 index 0000000..18f279a --- /dev/null +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -0,0 +1,24 @@ +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + // Rename tables by removing _v0 suffix + await queryInterface.renameTable('tractor_execution_sow_v0', 'tractor_execution_sow'); + await queryInterface.renameTable('tractor_execution_convert_up_v0', 'tractor_execution_convert_up'); + await queryInterface.renameTable('tractor_order_sow_v0', 'tractor_order_sow'); + await queryInterface.renameTable('tractor_order_convert_up_v0', 'tractor_order_convert_up'); + await queryInterface.renameTable('tractor_snapshot_sow_v0', 'tractor_snapshot_sow'); + await queryInterface.renameTable('tractor_snapshot_convert_up_v0', 'tractor_snapshot_convert_up'); + }, + + async down(queryInterface, Sequelize) { + // Revert table names by adding _v0 suffix back + await queryInterface.renameTable('tractor_execution_sow', 'tractor_execution_sow_v0'); + await queryInterface.renameTable('tractor_execution_convert_up', 'tractor_execution_convert_up_v0'); + await queryInterface.renameTable('tractor_order_sow', 'tractor_order_sow_v0'); + await queryInterface.renameTable('tractor_order_convert_up', 'tractor_order_convert_up_v0'); + await queryInterface.renameTable('tractor_snapshot_sow', 'tractor_snapshot_sow_v0'); + await queryInterface.renameTable('tractor_snapshot_convert_up', 'tractor_snapshot_convert_up_v0'); + } +}; diff --git a/src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-assembler.js similarity index 79% rename from src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-assembler.js index 41e5ed2..3768e70 100644 --- a/src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/snapshot-convert-up-assembler.js @@ -1,6 +1,6 @@ -const SnapshotConvertUpV0Dto = require('../../../../dto/tractor/SnapshotConvertUpV0Dto'); +const SnapshotConvertUpDto = require('../../../../dto/tractor/SnapshotConvertUpDto'); -class SnapshotConvertUpV0Assembler { +class SnapshotConvertUpAssembler { static toModel(snapshotDto) { return { id: snapshotDto.id, @@ -22,7 +22,7 @@ class SnapshotConvertUpV0Assembler { } static fromModel(snapshotModel) { - return SnapshotConvertUpV0Dto.fromModel(snapshotModel); + return SnapshotConvertUpDto.fromModel(snapshotModel); } } -module.exports = SnapshotConvertUpV0Assembler; +module.exports = SnapshotConvertUpAssembler; diff --git a/src/repository/postgres/models/assemblers/tractor/snapshot-sow-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/snapshot-sow-assembler.js similarity index 79% rename from src/repository/postgres/models/assemblers/tractor/snapshot-sow-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/snapshot-sow-assembler.js index a8cd1c0..ee38468 100644 --- a/src/repository/postgres/models/assemblers/tractor/snapshot-sow-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/snapshot-sow-assembler.js @@ -1,6 +1,6 @@ -const SnapshotSowV0Dto = require('../../../../dto/tractor/SnapshotSowV0Dto'); +const SnapshotSowDto = require('../../../../dto/tractor/SnapshotSowDto'); -class SnapshotSowV0Assembler { +class SnapshotSowAssembler { static toModel(snapshotDto) { return { id: snapshotDto.id, @@ -20,7 +20,7 @@ class SnapshotSowV0Assembler { } static fromModel(snapshotModel) { - return SnapshotSowV0Dto.fromModel(snapshotModel); + return SnapshotSowDto.fromModel(snapshotModel); } } -module.exports = SnapshotSowV0Assembler; +module.exports = SnapshotSowAssembler; diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-assembler.js similarity index 78% rename from src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-assembler.js index ec744c7..6804a08 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-assembler.js @@ -1,7 +1,7 @@ const BlueprintConstants = require('../../../../../service/tractor/blueprints/blueprint-constants'); -const ConvertUpV0ExecutionDto = require('../../../../dto/tractor/ConvertUpV0ExecutionDto'); +const ConvertUpExecutionDto = require('../../../../dto/tractor/ConvertUpExecutionDto'); -class ConvertUpV0ExecutionAssembler { +class ConvertUpExecutionAssembler { static toModel(executionDto) { return { id: executionDto.id, @@ -22,7 +22,7 @@ class ConvertUpV0ExecutionAssembler { } static fromModel(executionModel) { - return ConvertUpV0ExecutionDto.fromModel(executionModel); + return ConvertUpExecutionDto.fromModel(executionModel); } } -module.exports = ConvertUpV0ExecutionAssembler; +module.exports = ConvertUpExecutionAssembler; diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js similarity index 75% rename from src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js index 9a7b997..6156f0d 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js @@ -1,7 +1,7 @@ const BlueprintConstants = require('../../../../../service/tractor/blueprints/blueprint-constants'); -const SowV0ExecutionDto = require('../../../../dto/tractor/SowV0ExecutionDto'); +const SowExecutionDto = require('../../../../dto/tractor/SowExecutionDto'); -class SowV0ExecutionAssembler { +class SowExecutionAssembler { static toModel(executionDto) { return { id: executionDto.id, @@ -18,7 +18,7 @@ class SowV0ExecutionAssembler { } static fromModel(executionModel) { - return SowV0ExecutionDto.fromModel(executionModel); + return SowExecutionDto.fromModel(executionModel); } } -module.exports = SowV0ExecutionAssembler; +module.exports = SowExecutionAssembler; diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-assembler.js similarity index 86% rename from src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-assembler.js index b9cec6b..dcc47ae 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-order-convert-up-assembler.js @@ -1,6 +1,6 @@ -const ConvertUpV0OrderDto = require('../../../../dto/tractor/ConvertUpV0OrderDto'); +const ConvertUpOrderDto = require('../../../../dto/tractor/ConvertUpOrderDto'); -class ConvertUpV0OrderAssembler { +class ConvertUpOrderAssembler { static toModel(orderDto) { return { blueprintHash: orderDto.blueprintHash, @@ -28,7 +28,7 @@ class ConvertUpV0OrderAssembler { } static fromModel(orderModel) { - return ConvertUpV0OrderDto.fromModel(orderModel); + return ConvertUpOrderDto.fromModel(orderModel); } } -module.exports = ConvertUpV0OrderAssembler; +module.exports = ConvertUpOrderAssembler; diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-v0-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js similarity index 82% rename from src/repository/postgres/models/assemblers/tractor/tractor-order-sow-v0-assembler.js rename to src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js index 8fa37e0..b46c593 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-v0-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js @@ -1,6 +1,6 @@ -const SowV0OrderDto = require('../../../../dto/tractor/SowV0OrderDto'); +const SowOrderDto = require('../../../../dto/tractor/SowOrderDto'); -class SowV0OrderAssembler { +class SowOrderAssembler { static toModel(orderDto) { return { blueprintHash: orderDto.blueprintHash, @@ -22,7 +22,7 @@ class SowV0OrderAssembler { } static fromModel(orderModel) { - return SowV0OrderDto.fromModel(orderModel); + return SowOrderDto.fromModel(orderModel); } } -module.exports = SowV0OrderAssembler; +module.exports = SowOrderAssembler; diff --git a/src/repository/postgres/models/tractor-execution-convert-up-v0-model.js b/src/repository/postgres/models/tractor-execution-convert-up-model.js similarity index 78% rename from src/repository/postgres/models/tractor-execution-convert-up-v0-model.js rename to src/repository/postgres/models/tractor-execution-convert-up-model.js index 22d3c52..33a1cac 100644 --- a/src/repository/postgres/models/tractor-execution-convert-up-v0-model.js +++ b/src/repository/postgres/models/tractor-execution-convert-up-model.js @@ -1,16 +1,16 @@ -const { TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_EXECUTION_CONVERT_UP_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); module.exports = (sequelize, DataTypes) => { - const TractorExecutionConvertUpV0 = sequelize.define( - 'TractorExecutionConvertUpV0', + const TractorExecutionConvertUp = sequelize.define( + 'TractorExecutionConvertUp', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, - /// TractorOrderConvertUpV0 blueprintHash added via association below /// + /// TractorOrderConvertUp blueprintHash added via association below /// // uint8[], in practice this list will be small so we store as comma separated string rather than ABI encoding usedTokenIndices: { @@ -49,7 +49,7 @@ module.exports = (sequelize, DataTypes) => { ...bigintNumericColumn('gsPenaltyBdv', DataTypes, { allowNull: false }) }, { - tableName: TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.env, + tableName: TRACTOR_EXECUTION_CONVERT_UP_TABLE.env, indexes: [ { fields: ['blueprintHash'] @@ -59,13 +59,13 @@ module.exports = (sequelize, DataTypes) => { ); // Associations here - TractorExecutionConvertUpV0.associate = (models) => { - TractorExecutionConvertUpV0.belongsTo(models.TractorExecution, { foreignKey: 'id', onDelete: 'RESTRICT' }); - TractorExecutionConvertUpV0.belongsTo(models.TractorOrderConvertUpV0, { + TractorExecutionConvertUp.associate = (models) => { + TractorExecutionConvertUp.belongsTo(models.TractorExecution, { foreignKey: 'id', onDelete: 'RESTRICT' }); + TractorExecutionConvertUp.belongsTo(models.TractorOrderConvertUp, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); }; - return TractorExecutionConvertUpV0; + return TractorExecutionConvertUp; }; diff --git a/src/repository/postgres/models/tractor-execution-sow-v0-model.js b/src/repository/postgres/models/tractor-execution-sow-model.js similarity index 61% rename from src/repository/postgres/models/tractor-execution-sow-v0-model.js rename to src/repository/postgres/models/tractor-execution-sow-model.js index 4860a59..8beabbf 100644 --- a/src/repository/postgres/models/tractor-execution-sow-v0-model.js +++ b/src/repository/postgres/models/tractor-execution-sow-model.js @@ -1,16 +1,16 @@ -const { TRACTOR_EXECUTION_SOW_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_EXECUTION_SOW_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); module.exports = (sequelize, DataTypes) => { - const TractorExecutionSowV0 = sequelize.define( - 'TractorExecutionSowV0', + const TractorExecutionSow = sequelize.define( + 'TractorExecutionSow', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, - /// TractorOrderSowV0 blueprintHash added via association below /// + /// TractorOrderSow blueprintHash added via association below /// ...bigintNumericColumn('index', DataTypes, { allowNull: false }), ...bigintNumericColumn('beans', DataTypes, { allowNull: false }), ...bigintNumericColumn('pods', DataTypes, { allowNull: false }), @@ -26,7 +26,7 @@ module.exports = (sequelize, DataTypes) => { } }, { - tableName: TRACTOR_EXECUTION_SOW_V0_TABLE.env, + tableName: TRACTOR_EXECUTION_SOW_TABLE.env, indexes: [ { fields: ['blueprintHash'] @@ -36,10 +36,10 @@ module.exports = (sequelize, DataTypes) => { ); // Associations here - TractorExecutionSowV0.associate = (models) => { - TractorExecutionSowV0.belongsTo(models.TractorExecution, { foreignKey: 'id', onDelete: 'RESTRICT' }); - TractorExecutionSowV0.belongsTo(models.TractorOrderSowV0, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); + TractorExecutionSow.associate = (models) => { + TractorExecutionSow.belongsTo(models.TractorExecution, { foreignKey: 'id', onDelete: 'RESTRICT' }); + TractorExecutionSow.belongsTo(models.TractorOrderSow, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); }; - return TractorExecutionSowV0; + return TractorExecutionSow; }; diff --git a/src/repository/postgres/models/tractor-order-convert-up-v0-model.js b/src/repository/postgres/models/tractor-order-convert-up-model.js similarity index 85% rename from src/repository/postgres/models/tractor-order-convert-up-v0-model.js rename to src/repository/postgres/models/tractor-order-convert-up-model.js index c9f5489..4d18c38 100644 --- a/src/repository/postgres/models/tractor-order-convert-up-v0-model.js +++ b/src/repository/postgres/models/tractor-order-convert-up-model.js @@ -1,10 +1,10 @@ -const { TRACTOR_ORDER_CONVERT_UP_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_ORDER_CONVERT_UP_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); const { StalkMode } = require('./types/types'); module.exports = (sequelize, DataTypes) => { - const TractorOrderConvertUpV0 = sequelize.define( - 'TractorOrderConvertUpV0', + const TractorOrderConvertUp = sequelize.define( + 'TractorOrderConvertUp', { blueprintHash: { type: DataTypes.STRING(66), @@ -53,14 +53,14 @@ module.exports = (sequelize, DataTypes) => { } }, { - tableName: TRACTOR_ORDER_CONVERT_UP_V0_TABLE.env + tableName: TRACTOR_ORDER_CONVERT_UP_TABLE.env } ); // Associations here - TractorOrderConvertUpV0.associate = (models) => { - TractorOrderConvertUpV0.belongsTo(models.TractorOrder, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); + TractorOrderConvertUp.associate = (models) => { + TractorOrderConvertUp.belongsTo(models.TractorOrder, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); }; - return TractorOrderConvertUpV0; + return TractorOrderConvertUp; }; diff --git a/src/repository/postgres/models/tractor-order-sow-v0-model.js b/src/repository/postgres/models/tractor-order-sow-model.js similarity index 83% rename from src/repository/postgres/models/tractor-order-sow-v0-model.js rename to src/repository/postgres/models/tractor-order-sow-model.js index 7d7df30..8cef315 100644 --- a/src/repository/postgres/models/tractor-order-sow-v0-model.js +++ b/src/repository/postgres/models/tractor-order-sow-model.js @@ -1,9 +1,9 @@ -const { TRACTOR_ORDER_SOW_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_ORDER_SOW_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); module.exports = (sequelize, DataTypes) => { - const TractorOrderSowV0 = sequelize.define( - 'TractorOrderSowV0', + const TractorOrderSow = sequelize.define( + 'TractorOrderSow', { blueprintHash: { type: DataTypes.STRING(66), @@ -39,14 +39,14 @@ module.exports = (sequelize, DataTypes) => { ...bigintNumericColumn('slippageRatio', DataTypes, { allowNull: false }) }, { - tableName: TRACTOR_ORDER_SOW_V0_TABLE.env + tableName: TRACTOR_ORDER_SOW_TABLE.env } ); // Associations here - TractorOrderSowV0.associate = (models) => { - TractorOrderSowV0.belongsTo(models.TractorOrder, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); + TractorOrderSow.associate = (models) => { + TractorOrderSow.belongsTo(models.TractorOrder, { foreignKey: 'blueprintHash', onDelete: 'RESTRICT' }); }; - return TractorOrderSowV0; + return TractorOrderSow; }; diff --git a/src/repository/postgres/models/tractor-snapshot-convert-up-v0-model.js b/src/repository/postgres/models/tractor-snapshot-convert-up-model.js similarity index 89% rename from src/repository/postgres/models/tractor-snapshot-convert-up-v0-model.js rename to src/repository/postgres/models/tractor-snapshot-convert-up-model.js index a606261..048f617 100644 --- a/src/repository/postgres/models/tractor-snapshot-convert-up-v0-model.js +++ b/src/repository/postgres/models/tractor-snapshot-convert-up-model.js @@ -1,9 +1,9 @@ -const { TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_SNAPSHOT_CONVERT_UP_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); module.exports = (sequelize, DataTypes) => { - const TractorSnapshotConvertUpV0 = sequelize.define( - 'TractorSnapshotConvertUpV0', + const TractorSnapshotConvertUp = sequelize.define( + 'TractorSnapshotConvertUp', { id: { type: DataTypes.INTEGER, @@ -52,9 +52,9 @@ module.exports = (sequelize, DataTypes) => { } }, { - tableName: TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.env + tableName: TRACTOR_SNAPSHOT_CONVERT_UP_TABLE.env } ); - return TractorSnapshotConvertUpV0; + return TractorSnapshotConvertUp; }; diff --git a/src/repository/postgres/models/tractor-snapshot-sow-v0-model.js b/src/repository/postgres/models/tractor-snapshot-sow-model.js similarity index 88% rename from src/repository/postgres/models/tractor-snapshot-sow-v0-model.js rename to src/repository/postgres/models/tractor-snapshot-sow-model.js index b7b0567..836d238 100644 --- a/src/repository/postgres/models/tractor-snapshot-sow-v0-model.js +++ b/src/repository/postgres/models/tractor-snapshot-sow-model.js @@ -1,9 +1,9 @@ -const { TRACTOR_SNAPSHOT_SOW_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_SNAPSHOT_SOW_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); module.exports = (sequelize, DataTypes) => { - const TractorSnapshotSowV0 = sequelize.define( - 'TractorSnapshotSowV0', + const TractorSnapshotSow = sequelize.define( + 'TractorSnapshotSow', { id: { type: DataTypes.INTEGER, @@ -48,9 +48,9 @@ module.exports = (sequelize, DataTypes) => { } }, { - tableName: TRACTOR_SNAPSHOT_SOW_V0_TABLE.env + tableName: TRACTOR_SNAPSHOT_SOW_TABLE.env } ); - return TractorSnapshotSowV0; + return TractorSnapshotSow; }; diff --git a/src/routes/tractor-routes.js b/src/routes/tractor-routes.js index c626e31..fbafcc6 100644 --- a/src/routes/tractor-routes.js +++ b/src/routes/tractor-routes.js @@ -1,12 +1,12 @@ const TractorConstants = require('../constants/tractor'); const InputError = require('../error/input-error'); const { TractorOrderType } = require('../repository/postgres/models/types/types'); -const SnapshotSowV0Service = require('../service/tractor/snapshots/snapshot-sow-v0-service'); +const SnapshotSowService = require('../service/tractor/snapshots/snapshot-sow-service'); const TractorService = require('../service/tractor/tractor-service'); const Router = require('koa-router'); const RestParsingUtil = require('../utils/rest-parsing'); -const SnapshotConvertUpV0Service = require('../service/tractor/snapshots/snapshot-convert-up-v0-service'); +const SnapshotConvertUpService = require('../service/tractor/snapshots/snapshot-convert-up-service'); const router = new Router({ prefix: '/tractor' }); @@ -120,9 +120,9 @@ router.post('/snapshots', async (ctx) => { let method; if (body.orderType === 'SOW_V0') { - method = SnapshotSowV0Service.getSnapshots.bind(SnapshotSowV0Service); + method = SnapshotSowService.getSnapshots.bind(SnapshotSowService); } else if (body.orderType === 'CONVERT_UP_V0') { - method = SnapshotConvertUpV0Service.getSnapshots.bind(SnapshotConvertUpV0Service); + method = SnapshotConvertUpService.getSnapshots.bind(SnapshotConvertUpService); } /** @type {import('../../types/types').TractorSnapshotsResult} */ @@ -158,9 +158,9 @@ router.post('/v2/snapshots', async (ctx) => { const results = await Promise.all( orderTypes.map(async (type) => { if (type === 'SOW_V0') { - return await SnapshotSowV0Service.getSnapshots(body); + return await SnapshotSowService.getSnapshots(body); } else if (type === 'CONVERT_UP_V0') { - return await SnapshotConvertUpV0Service.getSnapshots(body); + return await SnapshotConvertUpService.getSnapshots(body); } }) ); diff --git a/src/scheduled/tasks/tractor.js b/src/scheduled/tasks/tractor.js index 39f5aee..a8246d7 100644 --- a/src/scheduled/tasks/tractor.js +++ b/src/scheduled/tasks/tractor.js @@ -8,8 +8,8 @@ const TractorExecutionDto = require('../../repository/dto/tractor/TractorExecuti const TractorOrderDto = require('../../repository/dto/tractor/TractorOrderDto'); const AppMetaService = require('../../service/meta-service'); const PriceService = require('../../service/price-service'); -const SnapshotConvertUpV0Service = require('../../service/tractor/snapshots/snapshot-convert-up-v0-service'); -const SnapshotSowV0Service = require('../../service/tractor/snapshots/snapshot-sow-v0-service'); +const SnapshotConvertUpService = require('../../service/tractor/snapshots/snapshot-convert-up-service'); +const SnapshotSowService = require('../../service/tractor/snapshots/snapshot-sow-service'); const TractorService = require('../../service/tractor/tractor-service'); const Concurrent = require('../../utils/async/concurrent'); const AsyncContext = require('../../utils/async/context'); @@ -21,7 +21,7 @@ const IndexingTask = require('./IndexingTask'); // Maximum number of blocks to process in one invocation const MAX_BLOCKS = 10000; -const SNAPSHOT_SERVICES = [SnapshotSowV0Service, SnapshotConvertUpV0Service]; +const SNAPSHOT_SERVICES = [SnapshotSowService, SnapshotConvertUpService]; class TractorTask extends IndexingTask { static async handleLiveEvent(event) { diff --git a/src/service/tractor/blueprints/convert-up-v0.js b/src/service/tractor/blueprints/convert-up.js similarity index 91% rename from src/service/tractor/blueprints/convert-up-v0.js rename to src/service/tractor/blueprints/convert-up.js index 45b5a27..b8ebb61 100644 --- a/src/service/tractor/blueprints/convert-up-v0.js +++ b/src/service/tractor/blueprints/convert-up.js @@ -1,26 +1,26 @@ const { TractorOrderType, stalkModeToInt } = require('../../../repository/postgres/models/types/types'); const Blueprint = require('./blueprint'); const { sequelize, Sequelize } = require('../../../repository/postgres/models'); -const ConvertUpV0ExecutionDto = require('../../../repository/dto/tractor/ConvertUpV0ExecutionDto'); -const ConvertUpV0OrderAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-order-convert-up-v0-assembler'); -const ConvertUpV0ExecutionAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-v0-assembler'); +const ConvertUpExecutionDto = require('../../../repository/dto/tractor/ConvertUpExecutionDto'); +const ConvertUpOrderAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-order-convert-up-assembler'); +const ConvertUpExecutionAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-execution-convert-up-assembler'); const BlueprintConstants = require('./blueprint-constants'); const InputError = require('../../../error/input-error'); const Contracts = require('../../../datasources/contracts/contracts'); const { C } = require('../../../constants/runtime-constants'); const Interfaces = require('../../../datasources/contracts/interfaces'); -const ConvertUpV0OrderDto = require('../../../repository/dto/tractor/ConvertUpV0OrderDto'); +const ConvertUpOrderDto = require('../../../repository/dto/tractor/ConvertUpOrderDto'); const Concurrent = require('../../../utils/async/concurrent'); const BlockUtil = require('../../../utils/block'); const BeanstalkPrice = require('../../../datasources/contracts/upgradeable/beanstalk-price'); -class TractorConvertUpV0Service extends Blueprint { +class TractorConvertUpService extends Blueprint { static orderType = TractorOrderType.CONVERT_UP_V0; - static orderModel = sequelize.models.TractorOrderConvertUpV0; - static orderAssembler = ConvertUpV0OrderAssembler; - static executionModel = sequelize.models.TractorExecutionConvertUpV0; - static executionAssembler = ConvertUpV0ExecutionAssembler; - static executionDto = ConvertUpV0ExecutionDto; + static orderModel = sequelize.models.TractorOrderConvertUp; + static orderAssembler = ConvertUpOrderAssembler; + static executionModel = sequelize.models.TractorExecutionConvertUp; + static executionAssembler = ConvertUpExecutionAssembler; + static executionDto = ConvertUpExecutionDto; /** * Determine how many pinto can be converted in each order, accounting for cascading order execution. @@ -178,7 +178,7 @@ class TractorConvertUpV0Service extends Blueprint { return; } - const dto = ConvertUpV0OrderDto.fromBlueprintCalldata({ + const dto = ConvertUpOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, convertUpParams: convertUpV0Call.args.params.convertUpParams }); @@ -259,4 +259,4 @@ class TractorConvertUpV0Service extends Blueprint { return where; } } -module.exports = TractorConvertUpV0Service; +module.exports = TractorConvertUpService; diff --git a/src/service/tractor/blueprints/sow-v0.js b/src/service/tractor/blueprints/sow.js similarity index 91% rename from src/service/tractor/blueprints/sow-v0.js rename to src/service/tractor/blueprints/sow.js index 9933fa4..c85d176 100644 --- a/src/service/tractor/blueprints/sow-v0.js +++ b/src/service/tractor/blueprints/sow.js @@ -2,24 +2,24 @@ const { C } = require('../../../constants/runtime-constants'); const Contracts = require('../../../datasources/contracts/contracts'); const Interfaces = require('../../../datasources/contracts/interfaces'); const InputError = require('../../../error/input-error'); -const SowV0ExecutionDto = require('../../../repository/dto/tractor/SowV0ExecutionDto'); -const SowV0OrderDto = require('../../../repository/dto/tractor/SowV0OrderDto'); +const SowExecutionDto = require('../../../repository/dto/tractor/SowExecutionDto'); +const SowOrderDto = require('../../../repository/dto/tractor/SowOrderDto'); const { sequelize, Sequelize } = require('../../../repository/postgres/models'); -const SowV0ExecutionAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-execution-sow-v0-assembler'); -const SowV0OrderAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-order-sow-v0-assembler'); +const SowExecutionAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler'); +const SowOrderAssembler = require('../../../repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler'); const { TractorOrderType } = require('../../../repository/postgres/models/types/types'); const Concurrent = require('../../../utils/async/concurrent'); const BlockUtil = require('../../../utils/block'); const Blueprint = require('./blueprint'); const BlueprintConstants = require('./blueprint-constants'); -class TractorSowV0Service extends Blueprint { +class TractorSowService extends Blueprint { static orderType = TractorOrderType.SOW_V0; - static orderModel = sequelize.models.TractorOrderSowV0; - static orderAssembler = SowV0OrderAssembler; - static executionModel = sequelize.models.TractorExecutionSowV0; - static executionAssembler = SowV0ExecutionAssembler; - static executionDto = SowV0ExecutionDto; + static orderModel = sequelize.models.TractorOrderSow; + static orderAssembler = SowOrderAssembler; + static executionModel = sequelize.models.TractorExecutionSow; + static executionAssembler = SowExecutionAssembler; + static executionDto = SowExecutionDto; /** * Determine how many pinto can be sown into each order, accounting for cascading order execution. @@ -169,7 +169,7 @@ class TractorSowV0Service extends Blueprint { return; } - const dto = SowV0OrderDto.fromBlueprintCalldata({ + const dto = SowOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, sowParams: sowV0Call.args.params.sowParams }); @@ -252,4 +252,4 @@ class TractorSowV0Service extends Blueprint { return where; } } -module.exports = TractorSowV0Service; +module.exports = TractorSowService; diff --git a/src/service/tractor/snapshots/snapshot-convert-up-v0-service.js b/src/service/tractor/snapshots/snapshot-convert-up-service.js similarity index 81% rename from src/service/tractor/snapshots/snapshot-convert-up-v0-service.js rename to src/service/tractor/snapshots/snapshot-convert-up-service.js index 9f4057a..b173e79 100644 --- a/src/service/tractor/snapshots/snapshot-convert-up-v0-service.js +++ b/src/service/tractor/snapshots/snapshot-convert-up-service.js @@ -1,14 +1,14 @@ const { C } = require('../../../constants/runtime-constants'); const { - TRACTOR_ORDER_CONVERT_UP_V0_TABLE, + TRACTOR_ORDER_CONVERT_UP_TABLE, TRACTOR_ORDER_TABLE, TRACTOR_EXECUTION_TABLE, - TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE + TRACTOR_EXECUTION_CONVERT_UP_TABLE } = require('../../../constants/tables'); const Contracts = require('../../../datasources/contracts/contracts'); -const SnapshotConvertUpV0Dto = require('../../../repository/dto/tractor/SnapshotConvertUpV0Dto'); +const SnapshotConvertUpDto = require('../../../repository/dto/tractor/SnapshotConvertUpDto'); const { sequelize } = require('../../../repository/postgres/models'); -const SnapshotConvertUpV0Assembler = require('../../../repository/postgres/models/assemblers/tractor/snapshot-convert-up-v0-assembler'); +const SnapshotConvertUpAssembler = require('../../../repository/postgres/models/assemblers/tractor/snapshot-convert-up-assembler'); const SharedRepository = require('../../../repository/postgres/queries/shared-repository'); const TractorSnapshotRepository = require('../../../repository/postgres/queries/tractor-snapshot-repository'); const AsyncContext = require('../../../utils/async/context'); @@ -16,9 +16,9 @@ const BlockUtil = require('../../../utils/block'); const EnvUtil = require('../../../utils/env'); const TractorSnapshotService = require('./tractor-snapshot-service'); -class SnapshotConvertUpV0Service extends TractorSnapshotService { - static snapshotRepository = new TractorSnapshotRepository(sequelize.models.TractorSnapshotConvertUpV0); - static snapshotAssembler = SnapshotConvertUpV0Assembler; +class SnapshotConvertUpService extends TractorSnapshotService { + static snapshotRepository = new TractorSnapshotRepository(sequelize.models.TractorSnapshotConvertUp); + static snapshotAssembler = SnapshotConvertUpAssembler; static initialSnapshotBlock = EnvUtil.getDevTractor().seedBlock ?? 37197727; static async takeSnapshot(snapshotBlock) { @@ -27,8 +27,8 @@ class SnapshotConvertUpV0Service extends TractorSnapshotService { const o = TRACTOR_ORDER_TABLE.env; const e = TRACTOR_EXECUTION_TABLE.env; - const oconv = TRACTOR_ORDER_CONVERT_UP_V0_TABLE.env; - const econv = TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.env; + const oconv = TRACTOR_ORDER_CONVERT_UP_TABLE.env; + const econv = TRACTOR_EXECUTION_CONVERT_UP_TABLE.env; const [[result]] = await sequelize.query( // There should perhaps also be a sum_cascade_below_line_length `SELECT @@ -46,7 +46,7 @@ class SnapshotConvertUpV0Service extends TractorSnapshotService { { transaction: AsyncContext.getOrUndef('transaction') } ); - const dto = SnapshotConvertUpV0Dto.fromLiveSnapshot({ + const dto = SnapshotConvertUpDto.fromLiveSnapshot({ block: snapshotBlock, timestamp: blockTimestamp, season, @@ -54,8 +54,8 @@ class SnapshotConvertUpV0Service extends TractorSnapshotService { }); const model = this.snapshotAssembler.toModel(dto); - await SharedRepository.genericUpsert(sequelize.models.TractorSnapshotConvertUpV0, [model], false); + await SharedRepository.genericUpsert(sequelize.models.TractorSnapshotConvertUp, [model], false); } } -module.exports = SnapshotConvertUpV0Service; +module.exports = SnapshotConvertUpService; diff --git a/src/service/tractor/snapshots/snapshot-sow-v0-service.js b/src/service/tractor/snapshots/snapshot-sow-service.js similarity index 83% rename from src/service/tractor/snapshots/snapshot-sow-v0-service.js rename to src/service/tractor/snapshots/snapshot-sow-service.js index 5d6dc6f..efd2aa6 100644 --- a/src/service/tractor/snapshots/snapshot-sow-v0-service.js +++ b/src/service/tractor/snapshots/snapshot-sow-service.js @@ -1,14 +1,14 @@ const { C } = require('../../../constants/runtime-constants'); const { - TRACTOR_EXECUTION_SOW_V0_TABLE, - TRACTOR_ORDER_SOW_V0_TABLE, + TRACTOR_EXECUTION_SOW_TABLE, + TRACTOR_ORDER_SOW_TABLE, TRACTOR_ORDER_TABLE, TRACTOR_EXECUTION_TABLE } = require('../../../constants/tables'); const Contracts = require('../../../datasources/contracts/contracts'); -const SnapshotSowV0Dto = require('../../../repository/dto/tractor/SnapshotSowV0Dto'); +const SnapshotSowDto = require('../../../repository/dto/tractor/SnapshotSowDto'); const { sequelize } = require('../../../repository/postgres/models'); -const SnapshotSowV0Assembler = require('../../../repository/postgres/models/assemblers/tractor/snapshot-sow-v0-assembler'); +const SnapshotSowAssembler = require('../../../repository/postgres/models/assemblers/tractor/snapshot-sow-assembler'); const SharedRepository = require('../../../repository/postgres/queries/shared-repository'); const TractorSnapshotRepository = require('../../../repository/postgres/queries/tractor-snapshot-repository'); const AsyncContext = require('../../../utils/async/context'); @@ -16,9 +16,9 @@ const BlockUtil = require('../../../utils/block'); const EnvUtil = require('../../../utils/env'); const TractorSnapshotService = require('./tractor-snapshot-service'); -class SnapshotSowV0Service extends TractorSnapshotService { - static snapshotRepository = new TractorSnapshotRepository(sequelize.models.TractorSnapshotSowV0); - static snapshotAssembler = SnapshotSowV0Assembler; +class SnapshotSowService extends TractorSnapshotService { + static snapshotRepository = new TractorSnapshotRepository(sequelize.models.TractorSnapshotSow); + static snapshotAssembler = SnapshotSowAssembler; static initialSnapshotBlock = EnvUtil.getDevTractor().seedBlock ?? 29115727; static async takeSnapshot(snapshotBlock) { @@ -32,8 +32,8 @@ class SnapshotSowV0Service extends TractorSnapshotService { const o = TRACTOR_ORDER_TABLE.env; const e = TRACTOR_EXECUTION_TABLE.env; - const osow = TRACTOR_ORDER_SOW_V0_TABLE.env; - const esow = TRACTOR_EXECUTION_SOW_V0_TABLE.env; + const osow = TRACTOR_ORDER_SOW_TABLE.env; + const esow = TRACTOR_EXECUTION_SOW_TABLE.env; const [[result]] = await sequelize.query( // There should perhaps also be a sum_cascade_below_line_length `SELECT @@ -49,7 +49,7 @@ class SnapshotSowV0Service extends TractorSnapshotService { { transaction: AsyncContext.getOrUndef('transaction') } ); - const dto = SnapshotSowV0Dto.fromLiveSnapshot({ + const dto = SnapshotSowDto.fromLiveSnapshot({ block: snapshotBlock, timestamp: blockTimestamp, season, @@ -57,8 +57,8 @@ class SnapshotSowV0Service extends TractorSnapshotService { }); const model = this.snapshotAssembler.toModel(dto); - await SharedRepository.genericUpsert(sequelize.models.TractorSnapshotSowV0, [model], false); + await SharedRepository.genericUpsert(sequelize.models.TractorSnapshotSow, [model], false); } } -module.exports = SnapshotSowV0Service; +module.exports = SnapshotSowService; diff --git a/test/setup/jest.setup.js b/test/setup/jest.setup.js index 0c699c2..f3e1a2b 100644 --- a/test/setup/jest.setup.js +++ b/test/setup/jest.setup.js @@ -40,8 +40,8 @@ jest.mock('../../src/repository/postgres/models/index', () => { Yield: {}, TractorOrder: {}, TractorExecution: {}, - TractorOrderSowV0: {}, - TractorExecutionSowV0: {} + TractorOrderSow: {}, + TractorExecutionSow: {} } }, Sequelize: { diff --git a/test/tractor/convert.test.js b/test/tractor/convert.test.js index 7bc333c..d94397d 100644 --- a/test/tractor/convert.test.js +++ b/test/tractor/convert.test.js @@ -1,19 +1,19 @@ -const ConvertUpV0OrderDto = require('../../src/repository/dto/tractor/ConvertUpV0OrderDto'); -const TractorConvertUpV0Service = require('../../src/service/tractor/blueprints/convert-up-v0'); +const ConvertUpOrderDto = require('../../src/repository/dto/tractor/ConvertUpOrderDto'); +const TractorConvertUpService = require('../../src/service/tractor/blueprints/convert-up'); -describe('TractorConvertUpV0Service', () => { +describe('TractorConvertUpService', () => { beforeEach(() => { jest.restoreAllMocks(); }); test('Creates additional order data for matching requisition', async () => { jest - .spyOn(TractorConvertUpV0Service, 'decodeBlueprintData') + .spyOn(TractorConvertUpService, 'decodeBlueprintData') .mockReturnValue({ args: { params: { opParams: { operatorTipAmount: 456n } } } }); - jest.spyOn(ConvertUpV0OrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); - const upsertSpy = jest.spyOn(TractorConvertUpV0Service, 'updateOrders').mockImplementation(() => {}); + jest.spyOn(ConvertUpOrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); + const upsertSpy = jest.spyOn(TractorConvertUpService, 'updateOrders').mockImplementation(() => {}); - const result = await TractorConvertUpV0Service.tryAddRequisition({ blueprintHash: 123 }, 'data'); + const result = await TractorConvertUpService.tryAddRequisition({ blueprintHash: 123 }, 'data'); expect(result).toBe(456n); expect(upsertSpy).toHaveBeenCalledWith(['dto']); diff --git a/test/tractor/decoding.test.js b/test/tractor/decoding.test.js index 9236558..6e843c6 100644 --- a/test/tractor/decoding.test.js +++ b/test/tractor/decoding.test.js @@ -1,7 +1,7 @@ -const ConvertUpV0OrderDto = require('../../src/repository/dto/tractor/ConvertUpV0OrderDto'); -const SowV0OrderDto = require('../../src/repository/dto/tractor/SowV0OrderDto'); -const TractorConvertUpV0Service = require('../../src/service/tractor/blueprints/convert-up-v0'); -const TractorSowV0Service = require('../../src/service/tractor/blueprints/sow-v0'); +const ConvertUpOrderDto = require('../../src/repository/dto/tractor/ConvertUpOrderDto'); +const SowOrderDto = require('../../src/repository/dto/tractor/SowOrderDto'); +const TractorConvertUpService = require('../../src/service/tractor/blueprints/convert-up'); +const TractorSowService = require('../../src/service/tractor/blueprints/sow'); const SOW_V0_BLUEPRINT = '0x36bfafbd0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000003a4b452c7ae0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000bb0a41927895F8ca2b4ECCc659ba158735fCF28B000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002443ca8e1b20000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000001dcd6500000000000000000000000000000000000000000000000000000000000ee6b280000000000000000000000000000000000000000000000000000000002faf080000000000000000000000000000000000000000000000000000000000004c4b4000000000000000000000000000000000000000000000000000003bc8b295a6d000000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'; @@ -11,9 +11,9 @@ const CONVERT_UP_V0_BLUEPRINT = describe('Tractor Blueprint Decoding', () => { describe('Sow V0', () => { test('Ignores other requisitions', async () => { - const dtoSpy = jest.spyOn(SowV0OrderDto, 'fromBlueprintCalldata'); + const dtoSpy = jest.spyOn(SowOrderDto, 'fromBlueprintCalldata'); - const result = await TractorSowV0Service.tryAddRequisition({ blueprintHash: 123 }, CONVERT_UP_V0_BLUEPRINT); + const result = await TractorSowService.tryAddRequisition({ blueprintHash: 123 }, CONVERT_UP_V0_BLUEPRINT); expect(result).not.toBeDefined(); expect(dtoSpy).not.toHaveBeenCalled(); @@ -21,7 +21,7 @@ describe('Tractor Blueprint Decoding', () => { test('Successfully decodes matching event', () => { const requisitionBlueprintData = SOW_V0_BLUEPRINT; - const decoded = TractorSowV0Service.decodeBlueprintData(requisitionBlueprintData); + const decoded = TractorSowService.decodeBlueprintData(requisitionBlueprintData); expect(decoded).toBeDefined(); expect(decoded).not.toBeNull(); }); @@ -29,9 +29,9 @@ describe('Tractor Blueprint Decoding', () => { describe('Convert V0', () => { test('Ignores other requisitions', async () => { - const dtoSpy = jest.spyOn(ConvertUpV0OrderDto, 'fromBlueprintCalldata'); + const dtoSpy = jest.spyOn(ConvertUpOrderDto, 'fromBlueprintCalldata'); - const result = await TractorConvertUpV0Service.tryAddRequisition({ blueprintHash: 123 }, SOW_V0_BLUEPRINT); + const result = await TractorConvertUpService.tryAddRequisition({ blueprintHash: 123 }, SOW_V0_BLUEPRINT); expect(result).not.toBeDefined(); expect(dtoSpy).not.toHaveBeenCalled(); @@ -39,7 +39,7 @@ describe('Tractor Blueprint Decoding', () => { test('Successfully decodes matching event', () => { const requisitionBlueprintData = CONVERT_UP_V0_BLUEPRINT; - const decoded = TractorConvertUpV0Service.decodeBlueprintData(requisitionBlueprintData); + const decoded = TractorConvertUpService.decodeBlueprintData(requisitionBlueprintData); expect(decoded).toBeDefined(); expect(decoded).not.toBeNull(); }); diff --git a/test/tractor/sow.test.js b/test/tractor/sow.test.js index 8e5c777..8cdcc23 100644 --- a/test/tractor/sow.test.js +++ b/test/tractor/sow.test.js @@ -1,22 +1,22 @@ const { C } = require('../../src/constants/runtime-constants'); -const SowV0ExecutionDto = require('../../src/repository/dto/tractor/SowV0ExecutionDto'); -const SowV0OrderDto = require('../../src/repository/dto/tractor/SowV0OrderDto'); +const SowExecutionDto = require('../../src/repository/dto/tractor/SowExecutionDto'); +const SowOrderDto = require('../../src/repository/dto/tractor/SowOrderDto'); const PriceService = require('../../src/service/price-service'); -const TractorSowV0Service = require('../../src/service/tractor/blueprints/sow-v0'); +const TractorSowService = require('../../src/service/tractor/blueprints/sow'); -describe('TractorSowV0Service', () => { +describe('TractorSowService', () => { beforeEach(() => { jest.restoreAllMocks(); }); test('Creates additional order data for matching requisition', async () => { jest - .spyOn(TractorSowV0Service, 'decodeBlueprintData') + .spyOn(TractorSowService, 'decodeBlueprintData') .mockReturnValue({ args: { params: { opParams: { operatorTipAmount: 456n } } } }); - jest.spyOn(SowV0OrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); - const upsertSpy = jest.spyOn(TractorSowV0Service, 'updateOrders').mockImplementation(() => {}); + jest.spyOn(SowOrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); + const upsertSpy = jest.spyOn(TractorSowService, 'updateOrders').mockImplementation(() => {}); - const result = await TractorSowV0Service.tryAddRequisition({ blueprintHash: 123 }, 'data'); + const result = await TractorSowService.tryAddRequisition({ blueprintHash: 123 }, 'data'); expect(result).toBe(456n); expect(upsertSpy).toHaveBeenCalledWith(['dto']); @@ -36,12 +36,12 @@ describe('TractorSowV0Service', () => { const mockSowOrder = { updateFieldsUponExecution: jest.fn() }; - const updateOrderSpy = jest.spyOn(TractorSowV0Service, 'updateOrders').mockImplementation(() => {}); - jest.spyOn(SowV0ExecutionDto, 'fromExecutionContext').mockImplementation(() => {}); - const updateExecutionSpy = jest.spyOn(TractorSowV0Service, 'updateExecutions').mockImplementation(() => {}); + const updateOrderSpy = jest.spyOn(TractorSowService, 'updateOrders').mockImplementation(() => {}); + jest.spyOn(SowExecutionDto, 'fromExecutionContext').mockImplementation(() => {}); + const updateExecutionSpy = jest.spyOn(TractorSowService, 'updateExecutions').mockImplementation(() => {}); const priceSpy = jest.spyOn(PriceService, 'getBeanPrice').mockResolvedValue({ usdPrice: 1.5 }); - const result = await TractorSowV0Service.orderExecuted(mockSowOrder, null, mockInnerEvents); + const result = await TractorSowService.orderExecuted(mockSowOrder, null, mockInnerEvents); expect(mockSowOrder.updateFieldsUponExecution).toHaveBeenCalledWith(mockInnerEvents); expect(updateOrderSpy).toHaveBeenCalledWith([mockSowOrder]); diff --git a/test/tractor/tractor.test.js b/test/tractor/tractor.test.js index ca86abb..fbba707 100644 --- a/test/tractor/tractor.test.js +++ b/test/tractor/tractor.test.js @@ -9,8 +9,8 @@ const TractorTask = require('../../src/scheduled/tasks/tractor'); const TaskRangeUtil = require('../../src/scheduled/util/task-range'); const AppMetaService = require('../../src/service/meta-service'); const PriceService = require('../../src/service/price-service'); -const TractorSowV0Service = require('../../src/service/tractor/blueprints/sow-v0'); -const SnapshotSowV0Service = require('../../src/service/tractor/snapshots/snapshot-sow-v0-service'); +const TractorSowService = require('../../src/service/tractor/blueprints/sow'); +const SnapshotSowService = require('../../src/service/tractor/snapshots/snapshot-sow-service'); const TractorService = require('../../src/service/tractor/tractor-service'); describe('TractorTask', () => { @@ -23,7 +23,7 @@ describe('TractorTask', () => { lastUpdate: null }); const filterLogSpy = jest.spyOn(FilterLogs, 'getBeanstalkEvents'); - const snapshotSpy = jest.spyOn(SnapshotSowV0Service, 'nextSnapshotBlock'); + const snapshotSpy = jest.spyOn(SnapshotSowService, 'nextSnapshotBlock'); const taskRangeSpy = jest.spyOn(TaskRangeUtil, 'getUpdateInfo'); const retval = await TractorTask.update(); @@ -44,7 +44,7 @@ describe('TractorTask', () => { jest.spyOn(AppMetaService, 'getTractorMeta').mockResolvedValue({ lastUpdate: 10 }); - jest.spyOn(SnapshotSowV0Service, 'nextSnapshotBlock').mockReturnValue(4000); + jest.spyOn(SnapshotSowService, 'nextSnapshotBlock').mockReturnValue(4000); jest.spyOn(TaskRangeUtil, 'getUpdateInfo').mockResolvedValue({ isInitialized: true, lastUpdate: 2000, @@ -62,7 +62,7 @@ describe('TractorTask', () => { { name: 'Tractor', value: 4 } ]); jest.spyOn(SiloEvents, 'getSiloDepositEvents').mockResolvedValue([{ account: '0xabcd' }]); - jest.spyOn(SnapshotSowV0Service, 'takeSnapshot').mockImplementation(() => {}); + jest.spyOn(SnapshotSowService, 'takeSnapshot').mockImplementation(() => {}); requisitionSpy = jest.spyOn(TractorTask, 'handlePublishRequsition').mockImplementation(() => {}); cancelSpy = jest.spyOn(TractorTask, 'handleCancelBlueprint').mockImplementation(() => {}); tractorSpy = jest.spyOn(TractorTask, 'handleTractor').mockImplementation(() => {}); @@ -223,7 +223,7 @@ describe('TractorTask', () => { jest .spyOn(TractorService, 'getOrders') .mockResolvedValue({ orders: [{ orderType: 'SOW_V0', blueprintData: 'blueprintData' }] }); - const sowExeSpy = jest.spyOn(TractorSowV0Service, 'orderExecuted').mockResolvedValue(1.25); + const sowExeSpy = jest.spyOn(TractorSowService, 'orderExecuted').mockResolvedValue(1.25); const insertedDto = {}; executionDbSpy = jest .spyOn(TractorService, 'updateExecutions') From 983ad04cb153ea55cffd8e05329b6908c19ccc27 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:28:51 -0500 Subject: [PATCH 08/22] Add referral address to table --- src/repository/dto/tractor/SowOrderDto.js | 2 ++ .../20260114193519-general-blueprint-tables.js | 9 +++++++++ .../assemblers/tractor/tractor-order-sow-assembler.js | 3 ++- .../postgres/models/tractor-order-sow-model.js | 7 ++++++- src/service/tractor/blueprints/sow.js | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/repository/dto/tractor/SowOrderDto.js b/src/repository/dto/tractor/SowOrderDto.js index 9ba0482..088005a 100644 --- a/src/repository/dto/tractor/SowOrderDto.js +++ b/src/repository/dto/tractor/SowOrderDto.js @@ -18,6 +18,7 @@ class SowOrderDto { this.maxGrownStalkPerBdv = d.sowParams.maxGrownStalkPerBdv; this.runBlocksAfterSunrise = d.sowParams.runBlocksAfterSunrise; this.slippageRatio = d.sowParams.slippageRatio; + this.referralAddress = d.referral; } else if (type === 'db') { this.blueprintHash = d.blueprintHash; this.pintoSownCounter = d.pintoSownCounter; @@ -34,6 +35,7 @@ class SowOrderDto { this.maxGrownStalkPerBdv = d.maxGrownStalkPerBdv; this.runBlocksAfterSunrise = d.runBlocksAfterSunrise; this.slippageRatio = d.slippageRatio; + this.referralAddress = d.referralAddress; } } diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js index 18f279a..310907c 100644 --- a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -10,9 +10,18 @@ module.exports = { await queryInterface.renameTable('tractor_order_convert_up_v0', 'tractor_order_convert_up'); await queryInterface.renameTable('tractor_snapshot_sow_v0', 'tractor_snapshot_sow'); await queryInterface.renameTable('tractor_snapshot_convert_up_v0', 'tractor_snapshot_convert_up'); + + // Add referralAddress column to tractor_order_sow + await queryInterface.addColumn('tractor_order_sow', 'referralAddress', { + type: Sequelize.STRING, + allowNull: true + }); }, async down(queryInterface, Sequelize) { + // Remove referralAddress column from tractor_order_sow before renaming + await queryInterface.removeColumn('tractor_order_sow', 'referralAddress'); + // Revert table names by adding _v0 suffix back await queryInterface.renameTable('tractor_execution_sow', 'tractor_execution_sow_v0'); await queryInterface.renameTable('tractor_execution_convert_up', 'tractor_execution_convert_up_v0'); diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js index b46c593..b1c0c1b 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js @@ -17,7 +17,8 @@ class SowOrderAssembler { maxPodlineLength: orderDto.maxPodlineLength, maxGrownStalkPerBdv: orderDto.maxGrownStalkPerBdv, runBlocksAfterSunrise: orderDto.runBlocksAfterSunrise, - slippageRatio: orderDto.slippageRatio + slippageRatio: orderDto.slippageRatio, + referralAddress: orderDto.referralAddress }; } diff --git a/src/repository/postgres/models/tractor-order-sow-model.js b/src/repository/postgres/models/tractor-order-sow-model.js index 8cef315..b69644d 100644 --- a/src/repository/postgres/models/tractor-order-sow-model.js +++ b/src/repository/postgres/models/tractor-order-sow-model.js @@ -36,7 +36,12 @@ module.exports = (sequelize, DataTypes) => { ...bigintNumericColumn('maxPodlineLength', DataTypes, { allowNull: false }), ...bigintNumericColumn('maxGrownStalkPerBdv', DataTypes, { allowNull: false }), ...bigintNumericColumn('runBlocksAfterSunrise', DataTypes, { allowNull: false }), - ...bigintNumericColumn('slippageRatio', DataTypes, { allowNull: false }) + ...bigintNumericColumn('slippageRatio', DataTypes, { allowNull: false }), + // Present in SowBlueprintReferral + referralAddress: { + type: DataTypes.STRING, + allowNull: true + } }, { tableName: TRACTOR_ORDER_SOW_TABLE.env diff --git a/src/service/tractor/blueprints/sow.js b/src/service/tractor/blueprints/sow.js index c85d176..4397058 100644 --- a/src/service/tractor/blueprints/sow.js +++ b/src/service/tractor/blueprints/sow.js @@ -171,6 +171,7 @@ class TractorSowService extends Blueprint { const dto = SowOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, + // TODO: will need to pass referral address here (not included in sow params) sowParams: sowV0Call.args.params.sowParams }); From b227ab3cd4006a85891450c16fb251d12715cab2 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:43:44 -0500 Subject: [PATCH 09/22] Update cutover script --- docker/indexing-cutover-queries.sql | 28 +++++++++---------- ...20260114193519-general-blueprint-tables.js | 10 +++++++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docker/indexing-cutover-queries.sql b/docker/indexing-cutover-queries.sql index 11ee669..7160106 100644 --- a/docker/indexing-cutover-queries.sql +++ b/docker/indexing-cutover-queries.sql @@ -20,15 +20,15 @@ commit; -- Tractor migration (indexing_ -> actual) -- Column names need to be explicit if new properties are added (since the order will differ between the env) begin; -truncate table tractor_snapshot_sow_v0, tractor_snapshot_convert_up_v0, tractor_execution_sow_v0, tractor_execution_convert_up_v0, tractor_order_sow_v0, tractor_order_convert_up_v0, tractor_execution, tractor_order; +truncate table tractor_snapshot_sow, tractor_snapshot_convert_up, tractor_execution_sow, tractor_execution_convert_up, tractor_order_sow, tractor_order_convert_up, tractor_execution, tractor_order; insert into tractor_order ("blueprintHash", "orderType", "publisher", "data", "operatorPasteInstrs", "maxNonce", "startTime", "endTime", "signature", "publishedTimestamp", "publishedBlock", "beanTip", "cancelled", "lastExecutableSeason", "createdAt", "updatedAt") select "blueprintHash", "orderType"::text::public."enum_tractor_order_orderType", "publisher", "data", "operatorPasteInstrs", "maxNonce", "startTime", "endTime", "signature", "publishedTimestamp", "publishedBlock", "beanTip", "cancelled", "lastExecutableSeason", "createdAt", "updatedAt" from indexing_tractor_order; insert into tractor_execution select * from indexing_tractor_execution; -insert into tractor_order_sow_v0 select * from indexing_tractor_order_sow_v0; -insert into tractor_order_convert_up_v0 ("blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits", "createdAt", "updatedAt") select "blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits"::text::public."enum_tractor_order_convert_up_v0_lowStalkDeposits", "createdAt", "updatedAt" from indexing_tractor_order_convert_up_v0; -insert into tractor_execution_sow_v0 ("id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt" from indexing_tractor_execution_sow_v0; -insert into tractor_execution_convert_up_v0 ("id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt" from indexing_tractor_execution_convert_up_v0; -insert into tractor_snapshot_sow_v0 ("id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers") select "id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers" from indexing_tractor_snapshot_sow_v0; -insert into tractor_snapshot_convert_up_v0 ("id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt") select "id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt" from indexing_tractor_snapshot_convert_up_v0; +insert into tractor_order_sow select * from indexing_tractor_order_sow; +insert into tractor_order_convert_up ("blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits", "createdAt", "updatedAt") select "blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits"::text::public."enum_tractor_order_convert_up_lowStalkDeposits", "createdAt", "updatedAt" from indexing_tractor_order_convert_up; +insert into tractor_execution_sow ("id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt" from indexing_tractor_execution_sow; +insert into tractor_execution_convert_up ("id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt" from indexing_tractor_execution_convert_up; +insert into tractor_snapshot_sow ("id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers") select "id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers" from indexing_tractor_snapshot_sow; +insert into tractor_snapshot_convert_up ("id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt") select "id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt" from indexing_tractor_snapshot_convert_up; update "ApiMeta" set "lastTractorUpdate" = (select "lastTractorUpdate" from "indexing_ApiMeta"); commit; @@ -62,15 +62,15 @@ commit; -- Tractor cleanup begin; -drop table if exists indexing_tractor_snapshot_sow_v0; -drop table if exists indexing_tractor_snapshot_convert_up_v0; -drop table if exists indexing_tractor_execution_sow_v0; -drop table if exists indexing_tractor_execution_convert_up_v0; -drop table if exists indexing_tractor_order_sow_v0; -drop table if exists indexing_tractor_order_convert_up_v0; +drop table if exists indexing_tractor_snapshot_sow; +drop table if exists indexing_tractor_snapshot_convert_up; +drop table if exists indexing_tractor_execution_sow; +drop table if exists indexing_tractor_execution_convert_up; +drop table if exists indexing_tractor_order_sow; +drop table if exists indexing_tractor_order_convert_up; drop table if exists indexing_tractor_execution; drop table if exists indexing_tractor_order; drop type if exists "enum_indexing_tractor_order_orderType"; -drop type if exists "enum_indexing_tractor_order_convert_up_v0_lowStalkDeposits"; +drop type if exists "enum_indexing_tractor_order_convert_up_lowStalkDeposits"; update "indexing_ApiMeta" set "lastTractorUpdate" = null; commit; diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js index 310907c..c81f2e2 100644 --- a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -11,6 +11,11 @@ module.exports = { await queryInterface.renameTable('tractor_snapshot_sow_v0', 'tractor_snapshot_sow'); await queryInterface.renameTable('tractor_snapshot_convert_up_v0', 'tractor_snapshot_convert_up'); + await queryInterface.sequelize.query(` + ALTER TYPE public."enum_tractor_order_convert_up_v0_lowStalkDeposits" + RENAME TO "enum_tractor_order_convert_up_lowStalkDeposits"; + `); + // Add referralAddress column to tractor_order_sow await queryInterface.addColumn('tractor_order_sow', 'referralAddress', { type: Sequelize.STRING, @@ -29,5 +34,10 @@ module.exports = { await queryInterface.renameTable('tractor_order_convert_up', 'tractor_order_convert_up_v0'); await queryInterface.renameTable('tractor_snapshot_sow', 'tractor_snapshot_sow_v0'); await queryInterface.renameTable('tractor_snapshot_convert_up', 'tractor_snapshot_convert_up_v0'); + + await queryInterface.sequelize.query(` + ALTER TYPE public."enum_tractor_order_convert_up_lowStalkDeposits" + RENAME TO "enum_tractor_order_convert_up_v0_lowStalkDeposits"; + `); } }; From e1ae64c8f705396631cd047b3b3415d8f8ad5302 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:49:21 -0500 Subject: [PATCH 10/22] Add blueprint version columns --- src/repository/dto/tractor/SowExecutionDto.js | 1 + src/repository/dto/tractor/SowOrderDto.js | 2 ++ ...20260114193519-general-blueprint-tables.js | 34 ++++++++++++++++++- .../tractor/tractor-order-sow-assembler.js | 1 + .../models/tractor-order-convert-up-model.js | 7 +++- .../models/tractor-order-sow-model.js | 6 ++++ src/repository/postgres/models/types/types.js | 11 ++++++ src/service/tractor/blueprints/sow.js | 1 + 8 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/repository/dto/tractor/SowExecutionDto.js b/src/repository/dto/tractor/SowExecutionDto.js index a9ac21d..cdc3869 100644 --- a/src/repository/dto/tractor/SowExecutionDto.js +++ b/src/repository/dto/tractor/SowExecutionDto.js @@ -28,6 +28,7 @@ class SowExecutionDto { .map(Number) .map((index) => BlueprintConstants.tokenIndexReverseMap()[index]); this.usedGrownStalkPerBdv = d.usedGrownStalkPerBdv; + // TODO: consider whether this should also have the new property } } diff --git a/src/repository/dto/tractor/SowOrderDto.js b/src/repository/dto/tractor/SowOrderDto.js index 088005a..9f59f83 100644 --- a/src/repository/dto/tractor/SowOrderDto.js +++ b/src/repository/dto/tractor/SowOrderDto.js @@ -4,6 +4,7 @@ class SowOrderDto { constructor(type, d) { if (type === 'data') { this.blueprintHash = d.blueprintHash; + // TODO: this.blueprintVersion = ??; this.pintoSownCounter = 0n; this.lastExecutedSeason = 0; this.orderComplete = false; @@ -21,6 +22,7 @@ class SowOrderDto { this.referralAddress = d.referral; } else if (type === 'db') { this.blueprintHash = d.blueprintHash; + this.blueprintVersion = d.blueprintVersion; this.pintoSownCounter = d.pintoSownCounter; this.lastExecutedSeason = d.lastExecutedSeason; this.orderComplete = d.orderComplete; diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js index c81f2e2..af019ef 100644 --- a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -16,6 +16,28 @@ module.exports = { RENAME TO "enum_tractor_order_convert_up_lowStalkDeposits"; `); + // Create enum type for tractor_order_sow blueprintVersion + await queryInterface.sequelize.query(` + CREATE TYPE "enum_tractor_order_sow_blueprintVersion" AS ENUM ('V0', 'REFERRAL'); + `); + + // Create enum type for tractor_order_convert_up blueprintVersion + await queryInterface.sequelize.query(` + CREATE TYPE "enum_tractor_order_convert_up_blueprintVersion" AS ENUM ('V0'); + `); + + // Add blueprintVersion column to tractor_order_sow + await queryInterface.sequelize.query(` + ALTER TABLE "tractor_order_sow" + ADD COLUMN "blueprintVersion" "enum_tractor_order_sow_blueprintVersion" NOT NULL DEFAULT 'V0'; + `); + + // Add blueprintVersion column to tractor_order_convert_up + await queryInterface.sequelize.query(` + ALTER TABLE "tractor_order_convert_up" + ADD COLUMN "blueprintVersion" "enum_tractor_order_convert_up_blueprintVersion" NOT NULL DEFAULT 'V0'; + `); + // Add referralAddress column to tractor_order_sow await queryInterface.addColumn('tractor_order_sow', 'referralAddress', { type: Sequelize.STRING, @@ -24,8 +46,18 @@ module.exports = { }, async down(queryInterface, Sequelize) { - // Remove referralAddress column from tractor_order_sow before renaming + // Remove columns before renaming await queryInterface.removeColumn('tractor_order_sow', 'referralAddress'); + await queryInterface.removeColumn('tractor_order_sow', 'blueprintVersion'); + await queryInterface.removeColumn('tractor_order_convert_up', 'blueprintVersion'); + + // Drop new enum types + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS "enum_tractor_order_sow_blueprintVersion"; + `); + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS "enum_tractor_order_convert_up_blueprintVersion"; + `); // Revert table names by adding _v0 suffix back await queryInterface.renameTable('tractor_execution_sow', 'tractor_execution_sow_v0'); diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js index b1c0c1b..5cfcb71 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-order-sow-assembler.js @@ -4,6 +4,7 @@ class SowOrderAssembler { static toModel(orderDto) { return { blueprintHash: orderDto.blueprintHash, + blueprintVersion: orderDto.blueprintVersion, pintoSownCounter: orderDto.pintoSownCounter, lastExecutedSeason: orderDto.lastExecutedSeason, orderComplete: orderDto.orderComplete, diff --git a/src/repository/postgres/models/tractor-order-convert-up-model.js b/src/repository/postgres/models/tractor-order-convert-up-model.js index 4d18c38..42c96cd 100644 --- a/src/repository/postgres/models/tractor-order-convert-up-model.js +++ b/src/repository/postgres/models/tractor-order-convert-up-model.js @@ -1,6 +1,6 @@ const { TRACTOR_ORDER_CONVERT_UP_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); -const { StalkMode } = require('./types/types'); +const { StalkMode, TractorOrderConvertUpBlueprintVersion } = require('./types/types'); module.exports = (sequelize, DataTypes) => { const TractorOrderConvertUp = sequelize.define( @@ -10,6 +10,11 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.STRING(66), primaryKey: true }, + blueprintVersion: { + type: DataTypes.ENUM, + values: Object.values(TractorOrderConvertUpBlueprintVersion), + allowNull: false + }, /* Order state */ lastExecutedTimestamp: { type: DataTypes.INTEGER, diff --git a/src/repository/postgres/models/tractor-order-sow-model.js b/src/repository/postgres/models/tractor-order-sow-model.js index b69644d..7810592 100644 --- a/src/repository/postgres/models/tractor-order-sow-model.js +++ b/src/repository/postgres/models/tractor-order-sow-model.js @@ -1,5 +1,6 @@ const { TRACTOR_ORDER_SOW_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn } = require('../util/sequelize-util'); +const { TractorOrderSowBlueprintVersion } = require('./types/types'); module.exports = (sequelize, DataTypes) => { const TractorOrderSow = sequelize.define( @@ -9,6 +10,11 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.STRING(66), primaryKey: true }, + blueprintVersion: { + type: DataTypes.ENUM, + values: Object.values(TractorOrderSowBlueprintVersion), + allowNull: false + }, /* Order state */ ...bigintNumericColumn('pintoSownCounter', DataTypes, { allowNull: false }), lastExecutedSeason: { diff --git a/src/repository/postgres/models/types/types.js b/src/repository/postgres/models/types/types.js index e6790f5..25eb3b3 100644 --- a/src/repository/postgres/models/types/types.js +++ b/src/repository/postgres/models/types/types.js @@ -8,6 +8,15 @@ const TractorOrderType = { CONVERT_UP_V0: 'CONVERT_UP_V0' }; +const TractorOrderSowBlueprintVersion = { + V0: 'V0', + REFERRAL: 'REFERRAL' +}; + +const TractorOrderConvertUpBlueprintVersion = { + V0: 'V0' +}; + const StalkModeArray = ['USE', 'OMIT', 'USE_LAST']; const intToStalkMode = (i) => StalkModeArray[i]; const stalkModeToInt = (stalkMode) => StalkModeArray.indexOf(stalkMode); @@ -20,6 +29,8 @@ const StalkMode = StalkModeArray.reduce((acc, value) => { module.exports = { ApyInitType, TractorOrderType, + TractorOrderSowBlueprintVersion, + TractorOrderConvertUpBlueprintVersion, StalkMode, intToStalkMode, stalkModeToInt diff --git a/src/service/tractor/blueprints/sow.js b/src/service/tractor/blueprints/sow.js index 4397058..5dcec67 100644 --- a/src/service/tractor/blueprints/sow.js +++ b/src/service/tractor/blueprints/sow.js @@ -172,6 +172,7 @@ class TractorSowService extends Blueprint { const dto = SowOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, // TODO: will need to pass referral address here (not included in sow params) + // TODO: how to pass blueprint version here? sowParams: sowV0Call.args.params.sowParams }); From 4e290fbfe8226ca89a216b99ab8bb002fa58d969 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Fri, 16 Jan 2026 14:11:04 -0500 Subject: [PATCH 11/22] npm audit fix --- package-lock.json | 628 +++++++++++++++--- src/repository/dto/tractor/SowExecutionDto.js | 2 +- 2 files changed, 537 insertions(+), 93 deletions(-) diff --git a/package-lock.json b/package-lock.json index 716d71c..ed31c86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -746,6 +746,14 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/runtime": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", + "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.27.2", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", @@ -806,9 +814,9 @@ } }, "node_modules/@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.8.0.tgz", + "integrity": "sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==", "funding": [ { "type": "individual", @@ -820,15 +828,15 @@ } ], "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" } }, "node_modules/@ethersproject/abstract-provider": { @@ -993,9 +1001,9 @@ } }, "node_modules/@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.8.0.tgz", + "integrity": "sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ==", "funding": [ { "type": "individual", @@ -1007,16 +1015,16 @@ } ], "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" + "@ethersproject/abi": "^5.8.0", + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/transactions": "^5.8.0" } }, "node_modules/@ethersproject/hash": { @@ -1046,9 +1054,9 @@ } }, "node_modules/@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.8.0.tgz", + "integrity": "sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA==", "funding": [ { "type": "individual", @@ -1060,24 +1068,24 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/basex": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/pbkdf2": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/sha2": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0", + "@ethersproject/strings": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/wordlists": "^5.8.0" } }, "node_modules/@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz", + "integrity": "sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w==", "funding": [ { "type": "individual", @@ -1089,17 +1097,17 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/hdnode": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/pbkdf2": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/random": "^5.8.0", + "@ethersproject/strings": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } @@ -1157,9 +1165,9 @@ } }, "node_modules/@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz", + "integrity": "sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg==", "funding": [ { "type": "individual", @@ -1171,8 +1179,8 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/sha2": "^5.8.0" } }, "node_modules/@ethersproject/properties": { @@ -1378,9 +1386,9 @@ } }, "node_modules/@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.8.0.tgz", + "integrity": "sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA==", "funding": [ { "type": "individual", @@ -1392,21 +1400,21 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/json-wallets": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/hdnode": "^5.8.0", + "@ethersproject/json-wallets": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/random": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/wordlists": "^5.8.0" } }, "node_modules/@ethersproject/web": { @@ -1432,9 +1440,9 @@ } }, "node_modules/@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.8.0.tgz", + "integrity": "sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg==", "funding": [ { "type": "individual", @@ -1446,11 +1454,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" } }, "node_modules/@graphql-tools/merge": { @@ -2127,6 +2135,143 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/codecs-core": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.3.0.tgz", + "integrity": "sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw==", + "dependencies": { + "@solana/errors": "2.3.0" + }, + "engines": { + "node": ">=20.18.0" + }, + "peerDependencies": { + "typescript": ">=5.3.3" + } + }, + "node_modules/@solana/codecs-numbers": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz", + "integrity": "sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg==", + "dependencies": { + "@solana/codecs-core": "2.3.0", + "@solana/errors": "2.3.0" + }, + "engines": { + "node": ">=20.18.0" + }, + "peerDependencies": { + "typescript": ">=5.3.3" + } + }, + "node_modules/@solana/errors": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@solana/errors/-/errors-2.3.0.tgz", + "integrity": "sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ==", + "dependencies": { + "chalk": "^5.4.1", + "commander": "^14.0.0" + }, + "bin": { + "errors": "bin/cli.mjs" + }, + "engines": { + "node": ">=20.18.0" + }, + "peerDependencies": { + "typescript": ">=5.3.3" + } + }, + "node_modules/@solana/errors/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@solana/errors/node_modules/commander": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.2.tgz", + "integrity": "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ==", + "engines": { + "node": ">=20" + } + }, + "node_modules/@solana/web3.js": { + "version": "1.98.4", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.98.4.tgz", + "integrity": "sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw==", + "dependencies": { + "@babel/runtime": "^7.25.0", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@solana/buffer-layout": "^4.0.1", + "@solana/codecs-numbers": "^2.1.0", + "agentkeepalive": "^4.5.0", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^4.1.1", + "node-fetch": "^2.7.0", + "rpc-websockets": "^9.0.2", + "superstruct": "^2.0.2" + } + }, + "node_modules/@solana/web3.js/node_modules/@noble/curves": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@solana/web3.js/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@swc/helpers": { + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.18.tgz", + "integrity": "sha512-TXTnIcNJQEKwThMMqBXsZ4VGAza6bvN4pa41Rkqoio6QBKMvo+5lexeTMScGCIxtzgQJzElcvIltani+adC5PQ==", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@swc/helpers/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -2347,11 +2492,24 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==" + }, "node_modules/@types/validator": { "version": "13.12.2", "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.2.tgz", "integrity": "sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==" }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -2392,10 +2550,21 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, + "node_modules/agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/alchemy-sdk": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/alchemy-sdk/-/alchemy-sdk-3.5.0.tgz", - "integrity": "sha512-ggY7y+cM6hZKynU7mg6jBUhhAS/68kWn7dPYSyvl9TlCQZnKl3norZKLxbP972NmRDMCqKEDPyYJpvEC6kMj1w==", + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/alchemy-sdk/-/alchemy-sdk-3.6.5.tgz", + "integrity": "sha512-vikvJvExqPoifnOtnIPoANwS2C46Nv44XsEWJz8kd5hrnZrS320GmhKWGyKSgupd8cvudAWv1+76iSr0pjy8DA==", "dependencies": { "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-provider": "^5.7.0", @@ -2408,7 +2577,8 @@ "@ethersproject/units": "^5.7.0", "@ethersproject/wallet": "^5.7.0", "@ethersproject/web": "^5.7.0", - "axios": "^1.7.4", + "@solana/web3.js": "^1.87.6", + "axios": "^1.12.0", "sturdy-websocket": "^0.2.1", "websocket": "^1.0.34" } @@ -2639,6 +2809,33 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/base-x": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -2722,6 +2919,16 @@ "node": ">= 0.8" } }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -2786,6 +2993,14 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -2795,6 +3010,29 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -3263,6 +3501,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3525,6 +3774,19 @@ "es6-symbol": "^3.1.1" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, "node_modules/es6-symbol": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz", @@ -3667,6 +3929,11 @@ "es5-ext": "~0.10.14" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -3828,12 +4095,25 @@ "type": "^2.7.2" } }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -4318,6 +4598,14 @@ "node": ">=10.17.0" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -4329,6 +4617,25 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -4523,6 +4830,14 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -4615,6 +4930,61 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jayson": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.3.0.tgz", + "integrity": "sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ==", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "stream-json": "^1.9.1", + "uuid": "^8.3.2", + "ws": "^7.5.10" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "node_modules/jayson/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/jayson/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -5293,6 +5663,11 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -6286,9 +6661,9 @@ ] }, "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", "dependencies": { "side-channel": "^1.1.0" }, @@ -6440,6 +6815,36 @@ "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-7.0.4.tgz", "integrity": "sha512-XgmCoxKWkDofwH8WddD0w85ZfqYz+ZHlr5yo+3YUCfycWawU56T5ckWXsScsj5B8tqUcIG67DxXByo3VUgiAdA==" }, + "node_modules/rpc-websockets": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.3.2.tgz", + "integrity": "sha512-VuW2xJDnl1k8n8kjbdRSWawPRkwaVqUQNjE1TdeTawf0y0abGhtVJFTXCLfgpgGDBkO/Fj6kny8Dc/nvOW78MA==", + "dependencies": { + "@swc/helpers": "^0.5.11", + "@types/uuid": "^8.3.4", + "@types/ws": "^8.2.2", + "buffer": "^6.0.3", + "eventemitter3": "^5.0.1", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" + }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -6914,6 +7319,19 @@ "node": ">= 0.6" } }, + "node_modules/stream-chain": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/stream-chain/-/stream-chain-2.2.5.tgz", + "integrity": "sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==" + }, + "node_modules/stream-json": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/stream-json/-/stream-json-1.9.1.tgz", + "integrity": "sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==", + "dependencies": { + "stream-chain": "^2.2.5" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -7012,6 +7430,14 @@ "resolved": "https://registry.npmjs.org/sturdy-websocket/-/sturdy-websocket-0.2.1.tgz", "integrity": "sha512-NnzSOEKyv4I83qbuKw9ROtJrrT6Z/Xt7I0HiP/e6H6GnpeTDvzwGIGeJ8slai+VwODSHQDooW2CAilJwT9SpRg==" }, + "node_modules/superstruct": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz", + "integrity": "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -7049,6 +7475,11 @@ "node": ">=8" } }, + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + }, "node_modules/timers-ext": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.8.tgz", @@ -7184,6 +7615,19 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/umzug": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/umzug/-/umzug-2.3.0.tgz", diff --git a/src/repository/dto/tractor/SowExecutionDto.js b/src/repository/dto/tractor/SowExecutionDto.js index cdc3869..7a428e8 100644 --- a/src/repository/dto/tractor/SowExecutionDto.js +++ b/src/repository/dto/tractor/SowExecutionDto.js @@ -28,7 +28,7 @@ class SowExecutionDto { .map(Number) .map((index) => BlueprintConstants.tokenIndexReverseMap()[index]); this.usedGrownStalkPerBdv = d.usedGrownStalkPerBdv; - // TODO: consider whether this should also have the new property + // TODO: consider whether this should also have the new referral address property } } From 296b89f35f5693ce7049156e44d9fc4d9a30e906 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Fri, 16 Jan 2026 14:58:19 -0500 Subject: [PATCH 12/22] Rename order type to remove v0 --- ...20260114193519-general-blueprint-tables.js | 50 +++++++++++++++++++ src/repository/postgres/models/types/types.js | 4 +- .../postgres/startup-seeders/dev-seeder.js | 4 +- src/routes/tractor-routes.js | 8 +-- src/service/tractor/blueprints/convert-up.js | 5 +- src/service/tractor/blueprints/sow.js | 4 +- .../snapshots/snapshot-convert-up-service.js | 4 +- .../tractor/snapshots/snapshot-sow-service.js | 4 +- test/tractor/tractor.test.js | 2 +- 9 files changed, 68 insertions(+), 17 deletions(-) diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js index af019ef..e1b6029 100644 --- a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -16,6 +16,31 @@ module.exports = { RENAME TO "enum_tractor_order_convert_up_lowStalkDeposits"; `); + // Update tractor_order orderType enum: SOW_V0 -> SOW, CONVERT_UP_V0 -> CONVERT_UP + // Create new enum type with updated values + await queryInterface.sequelize.query(` + CREATE TYPE "enum_tractor_order_orderType_new" AS ENUM ('SOW', 'CONVERT_UP'); + `); + + // Change column to use new enum type and convert values + await queryInterface.sequelize.query(` + ALTER TABLE "tractor_order" + ALTER COLUMN "orderType" TYPE "enum_tractor_order_orderType_new" + USING CASE + WHEN "orderType"::text = 'SOW_V0' THEN 'SOW'::"enum_tractor_order_orderType_new" + WHEN "orderType"::text = 'CONVERT_UP_V0' THEN 'CONVERT_UP'::"enum_tractor_order_orderType_new" + ELSE NULL + END; + `); + + // Drop old enum type and rename new one + await queryInterface.sequelize.query(` + DROP TYPE "enum_tractor_order_orderType"; + `); + await queryInterface.sequelize.query(` + ALTER TYPE "enum_tractor_order_orderType_new" RENAME TO "enum_tractor_order_orderType"; + `); + // Create enum type for tractor_order_sow blueprintVersion await queryInterface.sequelize.query(` CREATE TYPE "enum_tractor_order_sow_blueprintVersion" AS ENUM ('V0', 'REFERRAL'); @@ -71,5 +96,30 @@ module.exports = { ALTER TYPE public."enum_tractor_order_convert_up_lowStalkDeposits" RENAME TO "enum_tractor_order_convert_up_v0_lowStalkDeposits"; `); + + // Revert tractor_order orderType enum: SOW -> SOW_V0, CONVERT_UP -> CONVERT_UP_V0 + // Create old enum type + await queryInterface.sequelize.query(` + CREATE TYPE "enum_tractor_order_orderType_old" AS ENUM ('SOW_V0', 'CONVERT_UP_V0'); + `); + + // Change column to use old enum type and convert values + await queryInterface.sequelize.query(` + ALTER TABLE "tractor_order" + ALTER COLUMN "orderType" TYPE "enum_tractor_order_orderType_old" + USING CASE + WHEN "orderType"::text = 'SOW' THEN 'SOW_V0'::"enum_tractor_order_orderType_old" + WHEN "orderType"::text = 'CONVERT_UP' THEN 'CONVERT_UP_V0'::"enum_tractor_order_orderType_old" + ELSE NULL + END; + `); + + // Drop new enum type and rename old one back + await queryInterface.sequelize.query(` + DROP TYPE "enum_tractor_order_orderType"; + `); + await queryInterface.sequelize.query(` + ALTER TYPE "enum_tractor_order_orderType_old" RENAME TO "enum_tractor_order_orderType"; + `); } }; diff --git a/src/repository/postgres/models/types/types.js b/src/repository/postgres/models/types/types.js index 25eb3b3..44d6131 100644 --- a/src/repository/postgres/models/types/types.js +++ b/src/repository/postgres/models/types/types.js @@ -4,8 +4,8 @@ const ApyInitType = { }; const TractorOrderType = { - SOW_V0: 'SOW_V0', - CONVERT_UP_V0: 'CONVERT_UP_V0' + SOW: 'SOW', + CONVERT_UP: 'CONVERT_UP' }; const TractorOrderSowBlueprintVersion = { diff --git a/src/repository/postgres/startup-seeders/dev-seeder.js b/src/repository/postgres/startup-seeders/dev-seeder.js index 7428b7b..ce6ced2 100644 --- a/src/repository/postgres/startup-seeders/dev-seeder.js +++ b/src/repository/postgres/startup-seeders/dev-seeder.js @@ -13,8 +13,8 @@ class DevSeeder { Log.info('Running Tractor dev seeder'); await AsyncContext.sequelizeTransaction(async () => { await sequelize.query('truncate table tractor_order cascade'); - await sequelize.query('truncate table tractor_snapshot_sow_v0 cascade'); - await sequelize.query('truncate table tractor_snapshot_convert_up_v0 cascade'); + await sequelize.query('truncate table tractor_snapshot_sow cascade'); + await sequelize.query('truncate table tractor_snapshot_convert_up cascade'); await sequelize.query( `update "${API_META_TABLE.env}" set "lastTractorUpdate" = ${EnvUtil.getDevTractor().seedBlock};` ); diff --git a/src/routes/tractor-routes.js b/src/routes/tractor-routes.js index fbafcc6..66e5da4 100644 --- a/src/routes/tractor-routes.js +++ b/src/routes/tractor-routes.js @@ -119,9 +119,9 @@ router.post('/snapshots', async (ctx) => { RestParsingUtil.numberRangeValidation(body.betweenSeasons); let method; - if (body.orderType === 'SOW_V0') { + if (body.orderType === TractorOrderType.SOW) { method = SnapshotSowService.getSnapshots.bind(SnapshotSowService); - } else if (body.orderType === 'CONVERT_UP_V0') { + } else if (body.orderType === TractorOrderType.CONVERT_UP) { method = SnapshotConvertUpService.getSnapshots.bind(SnapshotConvertUpService); } @@ -157,9 +157,9 @@ router.post('/v2/snapshots', async (ctx) => { const results = await Promise.all( orderTypes.map(async (type) => { - if (type === 'SOW_V0') { + if (type === TractorOrderType.SOW) { return await SnapshotSowService.getSnapshots(body); - } else if (type === 'CONVERT_UP_V0') { + } else if (type === TractorOrderType.CONVERT_UP) { return await SnapshotConvertUpService.getSnapshots(body); } }) diff --git a/src/service/tractor/blueprints/convert-up.js b/src/service/tractor/blueprints/convert-up.js index b8ebb61..ae858c7 100644 --- a/src/service/tractor/blueprints/convert-up.js +++ b/src/service/tractor/blueprints/convert-up.js @@ -15,7 +15,7 @@ const BlockUtil = require('../../../utils/block'); const BeanstalkPrice = require('../../../datasources/contracts/upgradeable/beanstalk-price'); class TractorConvertUpService extends Blueprint { - static orderType = TractorOrderType.CONVERT_UP_V0; + static orderType = TractorOrderType.CONVERT_UP; static orderModel = sequelize.models.TractorOrderConvertUp; static orderAssembler = ConvertUpOrderAssembler; static executionModel = sequelize.models.TractorExecutionConvertUp; @@ -35,7 +35,7 @@ class TractorConvertUpService extends Blueprint { ) { let orders = ( await TractorService_getOrders({ - orderType: TractorOrderType.CONVERT_UP_V0, + orderType: TractorOrderType.CONVERT_UP, cancelled: false, blueprintParams: { orderComplete: false @@ -173,6 +173,7 @@ class TractorConvertUpService extends Blueprint { static async tryAddRequisition(orderDto, blueprintData) { // Decode data + // TODO: need to loop blueprints here const convertUpV0Call = this.decodeBlueprintData(blueprintData); if (!convertUpV0Call) { return; diff --git a/src/service/tractor/blueprints/sow.js b/src/service/tractor/blueprints/sow.js index 5dcec67..4ba553b 100644 --- a/src/service/tractor/blueprints/sow.js +++ b/src/service/tractor/blueprints/sow.js @@ -14,7 +14,7 @@ const Blueprint = require('./blueprint'); const BlueprintConstants = require('./blueprint-constants'); class TractorSowService extends Blueprint { - static orderType = TractorOrderType.SOW_V0; + static orderType = TractorOrderType.SOW; static orderModel = sequelize.models.TractorOrderSow; static orderAssembler = SowOrderAssembler; static executionModel = sequelize.models.TractorExecutionSow; @@ -34,7 +34,7 @@ class TractorSowService extends Blueprint { ) { let orders = ( await TractorService_getOrders({ - orderType: TractorOrderType.SOW_V0, + orderType: TractorOrderType.SOW, cancelled: false, blueprintParams: { orderComplete: false diff --git a/src/service/tractor/snapshots/snapshot-convert-up-service.js b/src/service/tractor/snapshots/snapshot-convert-up-service.js index b173e79..120c95b 100644 --- a/src/service/tractor/snapshots/snapshot-convert-up-service.js +++ b/src/service/tractor/snapshots/snapshot-convert-up-service.js @@ -39,10 +39,10 @@ class SnapshotConvertUpService extends TractorSnapshotService { (SELECT COALESCE(SUM("gsPenaltyBdv"), 0) FROM ${econv}) AS sum_gs_penalty_bdv, (SELECT COALESCE(SUM(oconv."cascadeAmountFunded"), 0) FROM ${o} o, ${oconv} oconv WHERE o."blueprintHash" = oconv."blueprintHash" AND NOT o.cancelled AND NOT oconv."orderComplete") AS sum_cascade_total, (SELECT COALESCE(SUM(oconv."cascadeAmountFunded"), 0) FROM ${o} o, ${oconv} oconv WHERE o."blueprintHash" = oconv."blueprintHash" AND NOT o.cancelled AND NOT oconv."orderComplete" AND o."lastExecutableSeason" = ${season}) AS sum_cascade_executable, - (SELECT COALESCE(SUM(o."beanTip"), 0) FROM ${o} o JOIN ${e} e ON o."blueprintHash" = e."blueprintHash" WHERE o."orderType" = 'CONVERT_UP_V0') AS sum_paid_tips, + (SELECT COALESCE(SUM(o."beanTip"), 0) FROM ${o} o JOIN ${e} e ON o."blueprintHash" = e."blueprintHash" WHERE o."orderType" = 'CONVERT_UP') AS sum_paid_tips, (SELECT COALESCE(MAX(o."beanTip"), 0) FROM ${o} o, ${oconv} oconv WHERE o."blueprintHash" = oconv."blueprintHash" AND NOT o.cancelled AND NOT oconv."orderComplete" AND oconv."amountFunded" > 0 AND o."lastExecutableSeason" = ${season}) AS max_bean_tip, (SELECT COUNT(*) FROM ${econv}) AS count_executions, - (SELECT COUNT(DISTINCT o."publisher") FROM ${o} o WHERE o."orderType" = 'CONVERT_UP_V0') AS unique_publishers;`, + (SELECT COUNT(DISTINCT o."publisher") FROM ${o} o WHERE o."orderType" = 'CONVERT_UP') AS unique_publishers;`, { transaction: AsyncContext.getOrUndef('transaction') } ); diff --git a/src/service/tractor/snapshots/snapshot-sow-service.js b/src/service/tractor/snapshots/snapshot-sow-service.js index efd2aa6..fe0ede1 100644 --- a/src/service/tractor/snapshots/snapshot-sow-service.js +++ b/src/service/tractor/snapshots/snapshot-sow-service.js @@ -42,10 +42,10 @@ class SnapshotSowService extends TractorSnapshotService { (SELECT COALESCE(SUM(osow."cascadeAmountFunded"), 0) FROM ${o} o, ${osow} osow WHERE osow."minTemp" <= ${Number(temperature)} AND o."blueprintHash" = osow."blueprintHash" AND NOT o.cancelled AND NOT osow."orderComplete") AS sum_cascade_below_temp, (SELECT COALESCE(SUM(osow."cascadeAmountFunded"), 0) FROM ${o} o, ${osow} osow WHERE o."blueprintHash" = osow."blueprintHash" AND NOT o.cancelled AND NOT osow."orderComplete") AS sum_cascade_total, (SELECT COALESCE(SUM(LEAST(osow."cascadeAmountFunded", osow."maxAmountToSowPerSeason")), 0) FROM ${osow} osow WHERE osow."minTemp" <= ${Number(temperature)}) AS max_sow_this_season, - (SELECT COALESCE(SUM(o."beanTip"), 0) FROM ${o} o JOIN ${e} e ON o."blueprintHash" = e."blueprintHash" WHERE o."orderType" = 'SOW_V0') AS sum_paid_tips, + (SELECT COALESCE(SUM(o."beanTip"), 0) FROM ${o} o JOIN ${e} e ON o."blueprintHash" = e."blueprintHash" WHERE o."orderType" = 'SOW') AS sum_paid_tips, (SELECT COALESCE(MAX(o."beanTip"), 0) FROM ${o} o, ${osow} osow WHERE o."blueprintHash" = osow."blueprintHash" AND NOT o.cancelled AND NOT osow."orderComplete" AND osow."amountFunded" > 0 AND o."lastExecutableSeason" = ${season}) AS max_bean_tip, (SELECT COUNT(*) FROM ${esow}) AS count_executions, - (SELECT COUNT(DISTINCT o."publisher") FROM ${o} o WHERE o."orderType" = 'SOW_V0') AS unique_publishers;`, + (SELECT COUNT(DISTINCT o."publisher") FROM ${o} o WHERE o."orderType" = 'SOW') AS unique_publishers;`, { transaction: AsyncContext.getOrUndef('transaction') } ); diff --git a/test/tractor/tractor.test.js b/test/tractor/tractor.test.js index fbba707..9016703 100644 --- a/test/tractor/tractor.test.js +++ b/test/tractor/tractor.test.js @@ -222,7 +222,7 @@ describe('TractorTask', () => { test('Known blueprint', async () => { jest .spyOn(TractorService, 'getOrders') - .mockResolvedValue({ orders: [{ orderType: 'SOW_V0', blueprintData: 'blueprintData' }] }); + .mockResolvedValue({ orders: [{ orderType: 'SOW', blueprintData: 'blueprintData' }] }); const sowExeSpy = jest.spyOn(TractorSowService, 'orderExecuted').mockResolvedValue(1.25); const insertedDto = {}; executionDbSpy = jest From fdde25f46f0056b02ffde23dc87abaf813e0eefe Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:53:49 -0500 Subject: [PATCH 13/22] Parse multiple blueprint types --- src/constants/raw/pinto-base.js | 3 +- src/repository/dto/tractor/SowOrderDto.js | 29 +++++++------ .../tractor/blueprints/blueprint-constants.js | 14 ++++++ src/service/tractor/blueprints/blueprint.js | 43 +++++++++++++++---- src/service/tractor/blueprints/convert-up.js | 33 ++------------ src/service/tractor/blueprints/sow.js | 39 +++-------------- 6 files changed, 79 insertions(+), 82 deletions(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index 6cdecdb..b1b38ab 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -35,7 +35,8 @@ const contracts = { STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, sowV0TractorHelpersAbi], - SOW_REFERRAL: ['tbd', null, sowReferralAbi], + // TODO: Need to get these addresses + SOW_REFERRAL: ['0xd9df9c4c0160401702de1771aaaad886e2375f65', null, sowReferralAbi], SOW_REFERRAL_TRACTOR_HELPERS: ['tbd', null, sowReferralTractorHelpersAbi], SOW_REFERRAL_SILO_HELPERS: ['tbd', null, sowReferralSiloHelpersAbi], CONVERT_UP_V0: ['0x5167Ae1fF37bE08D9cc9188C7e64DB228B6F06ca', null, convertUpBlueprintV0Abi], diff --git a/src/repository/dto/tractor/SowOrderDto.js b/src/repository/dto/tractor/SowOrderDto.js index 9f59f83..ce7d0b6 100644 --- a/src/repository/dto/tractor/SowOrderDto.js +++ b/src/repository/dto/tractor/SowOrderDto.js @@ -3,23 +3,28 @@ const Contracts = require('../../../datasources/contracts/contracts'); class SowOrderDto { constructor(type, d) { if (type === 'data') { - this.blueprintHash = d.blueprintHash; - // TODO: this.blueprintVersion = ??; + const { blueprintHash, blueprintVersion, callArgs } = d; + this.blueprintHash = blueprintHash; + this.blueprintVersion = blueprintVersion; + this.pintoSownCounter = 0n; this.lastExecutedSeason = 0; this.orderComplete = false; this.amountFunded = 0n; this.cascadeAmountFunded = 0n; - this.sourceTokenIndices = Array.from(d.sowParams.sourceTokenIndices); - this.totalAmountToSow = d.sowParams.sowAmounts.totalAmountToSow; - this.minAmountToSowPerSeason = d.sowParams.sowAmounts.minAmountToSowPerSeason; - this.maxAmountToSowPerSeason = d.sowParams.sowAmounts.maxAmountToSowPerSeason; - this.minTemp = d.sowParams.minTemp; - this.maxPodlineLength = d.sowParams.maxPodlineLength; - this.maxGrownStalkPerBdv = d.sowParams.maxGrownStalkPerBdv; - this.runBlocksAfterSunrise = d.sowParams.runBlocksAfterSunrise; - this.slippageRatio = d.sowParams.slippageRatio; - this.referralAddress = d.referral; + + const sowParams = blueprintVersion === 'V0' ? callArgs.params.sowParams : callArgs.params.params.sowParams; + + this.sourceTokenIndices = Array.from(sowParams.sourceTokenIndices); + this.totalAmountToSow = sowParams.sowAmounts.totalAmountToSow; + this.minAmountToSowPerSeason = sowParams.sowAmounts.minAmountToSowPerSeason; + this.maxAmountToSowPerSeason = sowParams.sowAmounts.maxAmountToSowPerSeason; + this.minTemp = sowParams.minTemp; + this.maxPodlineLength = sowParams.maxPodlineLength; + this.maxGrownStalkPerBdv = sowParams.maxGrownStalkPerBdv; + this.runBlocksAfterSunrise = sowParams.runBlocksAfterSunrise; + this.slippageRatio = sowParams.slippageRatio; + this.referralAddress = blueprintVersion === 'REFERRAL' ? callArgs.params.referral : null; } else if (type === 'db') { this.blueprintHash = d.blueprintHash; this.blueprintVersion = d.blueprintVersion; diff --git a/src/service/tractor/blueprints/blueprint-constants.js b/src/service/tractor/blueprints/blueprint-constants.js index 115156b..a9cc950 100644 --- a/src/service/tractor/blueprints/blueprint-constants.js +++ b/src/service/tractor/blueprints/blueprint-constants.js @@ -1,6 +1,20 @@ const { C } = require('../../../constants/runtime-constants'); +const BLUEPRINT_VERSIONS_MAP = { + SOW: { + [C().SOW_V0]: 'V0', + [C().SOW_REFERRAL]: 'REFERRAL' + }, + CONVERT_UP: { + [C().CONVERT_UP_V0]: 'V0' + } +}; + class BlueprintConstants { + static blueprintVersion(orderType, blueprintAddress) { + return BLUEPRINT_VERSIONS_MAP[orderType][blueprintAddress]; + } + static tokenIndexMap() { return { [C().BEAN]: 0, diff --git a/src/service/tractor/blueprints/blueprint.js b/src/service/tractor/blueprints/blueprint.js index d4bad9d..3335054 100644 --- a/src/service/tractor/blueprints/blueprint.js +++ b/src/service/tractor/blueprints/blueprint.js @@ -2,6 +2,8 @@ const SharedService = require('../../shared-service'); const { fromBigInt } = require('../../../utils/number'); const PriceService = require('../../price-service'); const { C } = require('../../../constants/runtime-constants'); +const BlueprintConstants = require('./blueprint-constants'); +const Interfaces = require('../../../datasources/contracts/interfaces'); // Base class for Tractor blueprint services class BlueprintService { @@ -42,14 +44,6 @@ class BlueprintService { throw new Error('orderCancelled must be implemented by subclass'); } - /** - * Attempts to decode blueprint-specific data - * @abstract - */ - static decodeBlueprintData(blueprintData) { - throw new Error('decodeBlueprintData must be implemented by subclass'); - } - // Future work is to put the params/validations in a general location such that blueprints can mix/match // which ones they want to use. This would be helpful if we have many different blueprints. @@ -85,6 +79,39 @@ class BlueprintService { throw new Error('executionRequestParams must be implemented by subclass'); } + /** + * Decodes blueprint-specific data if it matches a known blueprint version + */ + static decodeBlueprintData(blueprintData) { + const unknown = { version: 'UNKNOWN', calldata: null }; + + const iBeanstalk = Interfaces.getBeanstalk(); + const advFarm = Interfaces.safeParseTxn(iBeanstalk, blueprintData); + if (!advFarm || advFarm.name !== 'advancedFarm') { + return unknown; + } + + for (const advFarmData of advFarm.args.data) { + const advFarmCall = Interfaces.safeParseTxn(iBeanstalk, advFarmData.callData); + if (advFarmCall.name !== 'advancedPipe') { + return unknown; + } + + for (const pipeCall of advFarmCall.args.pipes) { + const blueprintVersion = BlueprintConstants.blueprintVersion(this.orderType, pipeCall.target.toLowerCase()); + if (!blueprintVersion) { + return unknown; + } + + const iBlueprint = Interfaces.get(pipeCall.target.toLowerCase()); + return { + version: blueprintVersion, + calldata: Interfaces.safeParseTxn(iBlueprint, pipeCall.callData) + }; + } + } + } + /** * Manages order updates after an execution. Returns amount of tip paid in usd, if any */ diff --git a/src/service/tractor/blueprints/convert-up.js b/src/service/tractor/blueprints/convert-up.js index ae858c7..be3a34b 100644 --- a/src/service/tractor/blueprints/convert-up.js +++ b/src/service/tractor/blueprints/convert-up.js @@ -173,22 +173,21 @@ class TractorConvertUpService extends Blueprint { static async tryAddRequisition(orderDto, blueprintData) { // Decode data - // TODO: need to loop blueprints here - const convertUpV0Call = this.decodeBlueprintData(blueprintData); - if (!convertUpV0Call) { + const { version, calldata } = this.decodeBlueprintData(blueprintData); + if (!calldata) { return; } const dto = ConvertUpOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, - convertUpParams: convertUpV0Call.args.params.convertUpParams + convertUpParams: calldata.args.params.convertUpParams }); // Insert entity await this.updateOrders([dto]); // Return amount of tip offered - return convertUpV0Call.args.params.opParams.operatorTipAmount; + return calldata.args.params.opParams.operatorTipAmount; } static async orderCancelled(orderDto) { @@ -199,30 +198,6 @@ class TractorConvertUpService extends Blueprint { await this.updateOrders([convertOrder]); } - static decodeBlueprintData(blueprintData) { - const iBeanstalk = Interfaces.getBeanstalk(); - const iConvertUpV0 = Interfaces.get(C().CONVERT_UP_V0); - - const advFarm = Interfaces.safeParseTxn(iBeanstalk, blueprintData); - if (!advFarm || advFarm.name !== 'advancedFarm') { - return; - } - - for (const advFarmData of advFarm.args.data) { - const advFarmCall = Interfaces.safeParseTxn(iBeanstalk, advFarmData.callData); - if (advFarmCall.name !== 'advancedPipe') { - return; - } - - for (const pipeCall of advFarmCall.args.pipes) { - if (pipeCall.target.toLowerCase() !== C().CONVERT_UP_V0) { - return; - } - return Interfaces.safeParseTxn(iConvertUpV0, pipeCall.callData); - } - } - } - static validateOrderParams(blueprintParams) { if (blueprintParams.orderComplete !== undefined && typeof blueprintParams.orderComplete !== 'boolean') { throw new InputError('orderComplete must be a boolean'); diff --git a/src/service/tractor/blueprints/sow.js b/src/service/tractor/blueprints/sow.js index 4ba553b..866da99 100644 --- a/src/service/tractor/blueprints/sow.js +++ b/src/service/tractor/blueprints/sow.js @@ -164,23 +164,24 @@ class TractorSowService extends Blueprint { static async tryAddRequisition(orderDto, blueprintData) { // Decode data - const sowV0Call = this.decodeBlueprintData(blueprintData); - if (!sowV0Call) { + const { version, calldata } = this.decodeBlueprintData(blueprintData); + if (!calldata) { return; } const dto = SowOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, - // TODO: will need to pass referral address here (not included in sow params) - // TODO: how to pass blueprint version here? - sowParams: sowV0Call.args.params.sowParams + blueprintVersion: version, + callArgs: calldata.args }); // Insert entity await this.updateOrders([dto]); // Return amount of tip offered - return sowV0Call.args.params.opParams.operatorTipAmount; + return version === 'V0' + ? calldata.args.params.opParams.operatorTipAmount + : calldata.args.params.params.opParams.operatorTipAmount; } static async orderCancelled(orderDto) { @@ -191,32 +192,6 @@ class TractorSowService extends Blueprint { await this.updateOrders([sowOrder]); } - // If possible, decodes blueprint data into the sowBlueprintv0 call - static decodeBlueprintData(blueprintData) { - const iBeanstalk = Interfaces.getBeanstalk(); - // Could iterate different sowing compatible blueprints here. - const iSowV0 = Interfaces.get(C().SOW_V0); - - const advFarm = Interfaces.safeParseTxn(iBeanstalk, blueprintData); - if (!advFarm || advFarm.name !== 'advancedFarm') { - return; - } - - for (const advFarmData of advFarm.args.data) { - const advFarmCall = Interfaces.safeParseTxn(iBeanstalk, advFarmData.callData); - if (advFarmCall.name !== 'advancedPipe') { - return; - } - - for (const pipeCall of advFarmCall.args.pipes) { - if (pipeCall.target.toLowerCase() !== C().SOW_V0) { - return; - } - return Interfaces.safeParseTxn(iSowV0, pipeCall.callData); - } - } - } - static validateOrderParams(blueprintParams) { if (blueprintParams.orderComplete !== undefined && typeof blueprintParams.orderComplete !== 'boolean') { throw new InputError('orderComplete must be a boolean'); From c6addd4a9ae9c6a77846b2f4a5a2a41b27728d4c Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:26:53 -0500 Subject: [PATCH 14/22] checksum address --- src/constants/raw/pinto-base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index b1b38ab..a37ff66 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -36,7 +36,7 @@ const contracts = { SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, sowV0TractorHelpersAbi], // TODO: Need to get these addresses - SOW_REFERRAL: ['0xd9df9c4c0160401702de1771aaaad886e2375f65', null, sowReferralAbi], + SOW_REFERRAL: ['0xD9DF9C4C0160401702de1771AAAaD886e2375F65', null, sowReferralAbi], SOW_REFERRAL_TRACTOR_HELPERS: ['tbd', null, sowReferralTractorHelpersAbi], SOW_REFERRAL_SILO_HELPERS: ['tbd', null, sowReferralSiloHelpersAbi], CONVERT_UP_V0: ['0x5167Ae1fF37bE08D9cc9188C7e64DB228B6F06ca', null, convertUpBlueprintV0Abi], From 52ae85fe223934c9851d6ba1800885adbb20dd42 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:27:52 -0500 Subject: [PATCH 15/22] Track referral recipients in tractor --- src/constants/raw/pinto-base.js | 2 +- src/datasources/abi/beanstalk/Pinto-PI14.json | 11670 ++++++++++++++++ .../contracts/upgradeable/beanstalk.js | 9 +- src/repository/dto/tractor/SowExecutionDto.js | 27 +- ...20260114193519-general-blueprint-tables.js | 28 + .../tractor-execution-sow-assembler.js | 7 +- .../models/tractor-execution-sow-model.js | 10 +- 7 files changed, 11745 insertions(+), 8 deletions(-) create mode 100644 src/datasources/abi/beanstalk/Pinto-PI14.json diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index b65b0bc..bf79a15 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -3,7 +3,7 @@ const EnvUtil = require('../../utils/env'); const SubgraphClients = require('../../datasources/subgraph-client'); -const pintoDiamondAbi = require('../../datasources/abi/beanstalk/Pinto-PI13.json'); +const pintoDiamondAbi = require('../../datasources/abi/beanstalk/Pinto-PI14.json'); const erc20Abi = require('../../datasources/abi/ERC20.json'); const wrappedDepositAbi = require('../../datasources/abi/WrappedDepositERC20.json'); const wellAbi = require('../../datasources/abi/basin/Well.json'); diff --git a/src/datasources/abi/beanstalk/Pinto-PI14.json b/src/datasources/abi/beanstalk/Pinto-PI14.json new file mode 100644 index 0000000..4601c00 --- /dev/null +++ b/src/datasources/abi/beanstalk/Pinto-PI14.json @@ -0,0 +1,11670 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "Pause", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timePassed", + "type": "uint256" + } + ], + "name": "Unpause", + "type": "event" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "claimOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ownerCandidate", + "outputs": [ + { + "internalType": "address", + "name": "ownerCandidate_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "facetFunctionSelectors_", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + } + ], + "name": "CancelBlueprint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "delta", + "type": "int256" + } + ], + "name": "InternalBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "compressedData", + "type": "bytes" + } + ], + "name": "PublishData", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct LibTractor.Requisition", + "name": "requisition", + "type": "tuple" + } + ], + "name": "PublishRequisition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum LibTransfer.From", + "name": "fromMode", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum LibTransfer.To", + "name": "toMode", + "type": "uint8" + } + ], + "name": "TokenTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gasleft", + "type": "uint256" + } + ], + "name": "Tractor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gasleft", + "type": "uint256" + } + ], + "name": "TractorExecutionBegan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "version", + "type": "string" + } + ], + "name": "TractorVersionSet", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct LibTractor.Requisition", + "name": "requisition", + "type": "tuple" + } + ], + "name": "cancelBlueprint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + } + ], + "name": "getBlueprintHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + } + ], + "name": "getBlueprintNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "counterId", + "type": "bytes32" + } + ], + "name": "getCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentBlueprintHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "counterId", + "type": "bytes32" + } + ], + "name": "getPublisherCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "key", + "type": "uint256" + } + ], + "name": "getTractorData", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTractorVersion", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "operator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "compressedData", + "type": "bytes" + } + ], + "name": "publishData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct LibTractor.Requisition", + "name": "requisition", + "type": "tuple" + } + ], + "name": "publishRequisition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "sendTokenToInternalBalance", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct LibTractor.Requisition", + "name": "requisition", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "operatorData", + "type": "bytes" + } + ], + "name": "tractor", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "operatorPasteInstrs", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "maxNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct LibTractor.Blueprint", + "name": "blueprint", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "blueprintHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct LibTractor.Requisition", + "name": "requisition", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "operatorData", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "key", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "internalType": "struct LibTractor.ContractData[]", + "name": "operatorDynamicData", + "type": "tuple[]" + } + ], + "name": "tractorDynamicData", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "tractorUser", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "counterId", + "type": "bytes32" + }, + { + "internalType": "enum LibTractor.CounterUpdateType", + "name": "updateType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "updatePublisherCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "version", + "type": "string" + } + ], + "name": "updateTractorVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC1155", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "batchTransferERC1155", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC1155", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferERC1155", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "transferERC721", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokenApproval", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approveToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseTokenAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "getAllBalance", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "internalBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "externalBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBalance", + "type": "uint256" + } + ], + "internalType": "struct TokenFacet.Balance", + "name": "b", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getAllBalances", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "internalBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "externalBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBalance", + "type": "uint256" + } + ], + "internalType": "struct TokenFacet.Balance[]", + "name": "balances", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "getBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getBalances", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "getExternalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getExternalBalances", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "getInternalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getInternalBalances", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseTokenAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "tokenAllowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "toMode", + "type": "uint8" + } + ], + "name": "transferInternalTokenFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "fromMode", + "type": "uint8" + }, + { + "internalType": "enum LibTransfer.To", + "name": "toMode", + "type": "uint8" + } + ], + "name": "transferToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "unwrapEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "wrapEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "clipboard", + "type": "bytes" + } + ], + "internalType": "struct AdvancedFarmCall[]", + "name": "data", + "type": "tuple[]" + } + ], + "name": "advancedFarm", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "farm", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "clipboard", + "type": "bytes" + } + ], + "internalType": "struct AdvancedPipeCall[]", + "name": "pipes", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "advancedPipe", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct PipeCall", + "name": "p", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "etherPipe", + "outputs": [ + { + "internalType": "bytes", + "name": "result", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct PipeCall[]", + "name": "pipes", + "type": "tuple[]" + } + ], + "name": "multiPipe", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct PipeCall", + "name": "p", + "type": "tuple" + } + ], + "name": "pipe", + "outputs": [ + { + "internalType": "bytes", + "name": "result", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct PipeCall", + "name": "p", + "type": "tuple" + } + ], + "name": "readPipe", + "outputs": [ + { + "internalType": "bytes", + "name": "result", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + } + ], + "name": "PRBMathUD60x18__LogInputTooSmall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + } + ], + "name": "PRBMath__MulDivOverflow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "ActiveFieldSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "FieldAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "plots", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beans", + "type": "uint256" + } + ], + "name": "Harvest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "PodListingCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "secondsSinceStart", + "type": "uint256" + } + ], + "name": "SoilMostlySoldOut", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "secondsSinceStart", + "type": "uint256" + } + ], + "name": "SoilSoldOut", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beans", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "pods", + "type": "uint256" + } + ], + "name": "Sow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "referrerIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "referrerPods", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "referee", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "refereeIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "refereePods", + "type": "uint256" + } + ], + "name": "SowReferral", + "type": "event" + }, + { + "inputs": [], + "name": "activeField", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "addField", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "balanceOfPods", + "outputs": [ + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beanSown", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "delegateReferralRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "fieldCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "floodHarvestablePods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanSownEligibilityThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "getBeansSownForReferral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "getDelegate", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "getPlotIndexesFromAccount", + "outputs": [ + { + "internalType": "uint256[]", + "name": "plotIndexes", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "getPlotsFromAccount", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + } + ], + "internalType": "struct FieldFacet.Plot[]", + "name": "plots", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRefereePercentage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReferrerPercentage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSoilMostlySoldOutThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSoilSoldOutThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "plots", + "type": "uint256[]" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "harvest", + "outputs": [ + { + "internalType": "uint256", + "name": "beansHarvested", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "harvestableIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialSoil", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "isHarvesting", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "isValidReferrer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxTemperature", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "plot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "podIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "remainingPods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "_temperature", + "type": "uint32" + } + ], + "name": "setActiveField", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "beans", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTemperature", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "sow", + "outputs": [ + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "beans", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTemperature", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSoil", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "sowWithMin", + "outputs": [ + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "beans", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTemperature", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSoil", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "sowWithReferral", + "outputs": [ + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "referrerPods", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "refereePods", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "temperature", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "totalHarvestable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalHarvestableForActiveField", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "totalHarvested", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "totalPods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSoil", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "totalUnharvestable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalUnharvestableForActiveField", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PlotTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PodApproval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxHarvestableIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "PodListingCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "filler", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "costInBeans", + "type": "uint256" + } + ], + "name": "PodListingFilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "PodOrderCancelled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "name": "PodOrderCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "filler", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "costInBeans", + "type": "uint256" + } + ], + "name": "PodOrderFilled", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "allowancePods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approvePods", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "cancelPodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "podOrder", + "type": "tuple" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "cancelPodOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxHarvestableIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "internalType": "struct Listing.PodListing", + "name": "podListing", + "type": "tuple" + } + ], + "name": "createPodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "podOrder", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "createPodOrder", + "outputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxHarvestableIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "internalType": "struct Listing.PodListing", + "name": "podListing", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "fillPodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "podOrder", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "fillPodOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "podOrder", + "type": "tuple" + } + ], + "name": "getOrderId", + "outputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getPodListing", + "outputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "getPodOrder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "transferPlot", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "starts", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "ends", + "type": "uint256[]" + } + ], + "name": "transferPlots", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "internalType": "struct MarketplaceBatchFacet.CancelPodListingParams[]", + "name": "params", + "type": "tuple[]" + } + ], + "name": "batchCancelPodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder[]", + "name": "podOrders", + "type": "tuple[]" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "batchCancelPodOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxHarvestableIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "internalType": "struct Listing.PodListing[]", + "name": "podListings", + "type": "tuple[]" + } + ], + "name": "batchCreatePodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "order", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + } + ], + "internalType": "struct MarketplaceBatchFacet.CreatePodOrderParams[]", + "name": "params", + "type": "tuple[]" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "batchCreatePodOrder", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "ids", + "type": "bytes32[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "lister", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podAmount", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxHarvestableIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "internalType": "struct Listing.PodListing", + "name": "listing", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "beanAmount", + "type": "uint256" + } + ], + "internalType": "struct MarketplaceBatchFacet.FillPodListingParams[]", + "name": "params", + "type": "tuple[]" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "batchFillPodListing", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "orderer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + }, + { + "internalType": "uint24", + "name": "pricePerPod", + "type": "uint24" + }, + { + "internalType": "uint256", + "name": "maxPlaceInLine", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minFillAmount", + "type": "uint256" + } + ], + "internalType": "struct Order.PodOrder", + "name": "order", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct MarketplaceBatchFacet.FillPodOrderParams[]", + "name": "params", + "type": "tuple[]" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "batchFillPodOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelistedLp", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelistedWell", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSoppable", + "type": "bool" + } + ], + "name": "AddWhitelistStatus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "DewhitelistToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelistedLp", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelistedWell", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSoppable", + "type": "bool" + } + ], + "name": "UpdateWhitelistStatus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "targetSeasonsToCatchUp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "excessivePriceThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientHigh", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientLow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseReward", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "minAvgGsPerBdv", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "rainingMinBeanMaxLpGpPerBdvRatio", + "type": "uint128" + } + ], + "indexed": false, + "internalType": "struct EvaluationParameters", + "name": "", + "type": "tuple" + } + ], + "name": "UpdatedEvaluationParameters", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Implementation", + "name": "gaugePointImplementation", + "type": "tuple" + } + ], + "name": "UpdatedGaugePointImplementationForToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Implementation", + "name": "liquidityWeightImplementation", + "type": "tuple" + } + ], + "name": "UpdatedLiquidityWeightImplementationForToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "optimalPercentDepositedBdv", + "type": "uint64" + } + ], + "name": "UpdatedOptimalPercentDepositedBdvForToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Implementation", + "name": "oracleImplementation", + "type": "tuple" + } + ], + "name": "UpdatedOracleImplementationForToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint40", + "name": "stalkEarnedPerSeason", + "type": "uint40" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "season", + "type": "uint32" + } + ], + "name": "UpdatedStalkPerBdvPerSeason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "uint40", + "name": "stalkEarnedPerSeason", + "type": "uint40" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stalkIssuedPerBdv", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "gaugePoints", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "optimalPercentDepositedBdv", + "type": "uint64" + } + ], + "name": "WhitelistToken", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "dewhitelistToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGaugePointImplementationForToken", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getLiquidityWeightImplementationForToken", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getOracleImplementationForToken", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSiloTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getWhitelistStatus", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isWhitelistedLp", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isWhitelistedWell", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSoppable", + "type": "bool" + } + ], + "internalType": "struct WhitelistStatus", + "name": "_whitelistStatuses", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistStatuses", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isWhitelistedLp", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isWhitelistedWell", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSoppable", + "type": "bool" + } + ], + "internalType": "struct WhitelistStatus[]", + "name": "_whitelistStatuses", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistedLpTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistedTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistedWellLpTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint64", + "name": "optimalPercentDepositedBdv", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "gpImplementation", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "lwImplementation", + "type": "tuple" + } + ], + "name": "updateGaugeForToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "impl", + "type": "tuple" + } + ], + "name": "updateGaugePointImplementationForToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "impl", + "type": "tuple" + } + ], + "name": "updateLiquidityWeightImplementationForToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "impl", + "type": "tuple" + } + ], + "name": "updateOracleImplementationForToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "targetSeasonsToCatchUp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "excessivePriceThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientHigh", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientLow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseReward", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "minAvgGsPerBdv", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "rainingMinBeanMaxLpGpPerBdvRatio", + "type": "uint128" + } + ], + "internalType": "struct EvaluationParameters", + "name": "updatedSeedGaugeSettings", + "type": "tuple" + } + ], + "name": "updateSeedGaugeSettings", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint40", + "name": "stalkEarnedPerSeason", + "type": "uint40" + } + ], + "name": "updateStalkPerBdvPerSeasonForToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "uint48", + "name": "stalkIssuedPerBdv", + "type": "uint48" + }, + { + "internalType": "uint40", + "name": "stalkEarnedPerSeason", + "type": "uint40" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "uint128", + "name": "gaugePoints", + "type": "uint128" + }, + { + "internalType": "uint64", + "name": "optimalPercentDepositedBdv", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "oracleImplementation", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "gaugePointImplementation", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "liquidityWeightImplementation", + "type": "tuple" + } + ], + "name": "whitelistToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "balanceOfDepositedBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "depositedBdv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfEarnedBeans", + "outputs": [ + { + "internalType": "uint256", + "name": "beans", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfEarnedStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfFinishedGerminatingStalkAndRoots", + "outputs": [ + { + "internalType": "uint256", + "name": "gStalk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gRoots", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfGerminatingStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "balanceOfGrownStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "balanceOfGrownStalkMultiple", + "outputs": [ + { + "internalType": "uint256[]", + "name": "grownStalks", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfPlantableSeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "balanceOfPlenty", + "outputs": [ + { + "internalType": "uint256", + "name": "plenty", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfRainRoots", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfRoots", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfSop", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "lastRain", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastSop", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "roots", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "plentyPerRoot", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "plenty", + "type": "uint256" + }, + { + "internalType": "bytes32[4]", + "name": "_buffer", + "type": "bytes32[4]" + } + ], + "internalType": "struct PerWellPlenty", + "name": "wellsPlenty", + "type": "tuple" + } + ], + "internalType": "struct SiloGettersFacet.FarmerSops[]", + "name": "farmerSops", + "type": "tuple[]" + } + ], + "internalType": "struct SiloGettersFacet.AccountSeasonOfPlenty", + "name": "sop", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOfYoungAndMatureGerminatingStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "matureGerminatingStalk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "youngGerminatingStalk", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "bdv", + "outputs": [ + { + "internalType": "uint256", + "name": "_bdv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "bdvs", + "outputs": [ + { + "internalType": "uint256[]", + "name": "_bdvs", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "grownStalk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bdvOfDeposit", + "type": "uint256" + } + ], + "name": "calculateStemForTokenFromGrownStalk", + "outputs": [ + { + "internalType": "int96", + "name": "stem", + "type": "int96" + }, + { + "internalType": "enum GerminationSide", + "name": "germ", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getAddressAndStem", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getBeanIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "name": "getDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "name": "getDepositId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getDepositsForAccount", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "bdv", + "type": "uint128" + } + ], + "internalType": "struct Deposit[]", + "name": "tokenDeposits", + "type": "tuple[]" + } + ], + "internalType": "struct SiloGettersFacet.TokenDepositId[]", + "name": "deposits", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getDepositsForAccount", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "bdv", + "type": "uint128" + } + ], + "internalType": "struct Deposit[]", + "name": "tokenDeposits", + "type": "tuple[]" + } + ], + "internalType": "struct SiloGettersFacet.TokenDepositId[]", + "name": "deposits", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getEvenGerminating", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "season", + "type": "uint32" + } + ], + "name": "getGerminatingRootsForSeason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "season", + "type": "uint32" + } + ], + "name": "getGerminatingStalkAndRootsForSeason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "season", + "type": "uint32" + } + ], + "name": "getGerminatingStalkForSeason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGerminatingStem", + "outputs": [ + { + "internalType": "int96", + "name": "germinatingStem", + "type": "int96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getGerminatingStems", + "outputs": [ + { + "internalType": "int96[]", + "name": "germinatingStems", + "type": "int96[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGerminatingTotalDeposited", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGerminatingTotalDepositedBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "_bdv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getHighestNonGerminatingStem", + "outputs": [ + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getHighestNonGerminatingStems", + "outputs": [ + { + "internalType": "int96[]", + "name": "highestNonGerminatingStems", + "type": "int96[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getIndexForDepositId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getLastMowedStem", + "outputs": [ + { + "internalType": "int96", + "name": "lastStem", + "type": "int96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getMowStatus", + "outputs": [ + { + "components": [ + { + "internalType": "int96", + "name": "lastStem", + "type": "int96" + }, + { + "internalType": "uint128", + "name": "bdv", + "type": "uint128" + } + ], + "internalType": "struct MowStatus[]", + "name": "mowStatuses", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getMowStatus", + "outputs": [ + { + "components": [ + { + "internalType": "int96", + "name": "lastStem", + "type": "int96" + }, + { + "internalType": "uint128", + "name": "bdv", + "type": "uint128" + } + ], + "internalType": "struct MowStatus", + "name": "mowStatus", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getNonBeanTokenAndIndexFromWell", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getOddGerminating", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getSeedsForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStemTips", + "outputs": [ + { + "internalType": "int96[]", + "name": "_stemTips", + "type": "int96[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTokenDepositIdsForAccount", + "outputs": [ + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTokenDepositsForAccount", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "bdv", + "type": "uint128" + } + ], + "internalType": "struct Deposit[]", + "name": "tokenDeposits", + "type": "tuple[]" + } + ], + "internalType": "struct SiloGettersFacet.TokenDepositId", + "name": "deposits", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTotalDeposited", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTotalDepositedBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTotalGerminatingAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTotalGerminatingBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalGerminatingStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalSiloDeposited", + "outputs": [ + { + "internalType": "uint256[]", + "name": "depositedAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalSiloDepositedBdv", + "outputs": [ + { + "internalType": "uint256[]", + "name": "depositedBdvs", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getYoungAndMatureGerminatingTotalStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "matureGerminatingStalk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "youngGerminatingStalk", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "name": "grownStalkForDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "grownStalk", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastSeasonOfPlenty", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "lastUpdate", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "stalkEarnedPerSeason", + "outputs": [ + { + "internalType": "uint256[]", + "name": "stalkEarnedPerSeasons", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "stemTipForToken", + "outputs": [ + { + "internalType": "int96", + "name": "_stemTip", + "type": "int96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "tokenSettings", + "outputs": [ + { + "components": [ + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "uint40", + "name": "stalkEarnedPerSeason", + "type": "uint40" + }, + { + "internalType": "uint48", + "name": "stalkIssuedPerBdv", + "type": "uint48" + }, + { + "internalType": "uint32", + "name": "milestoneSeason", + "type": "uint32" + }, + { + "internalType": "int96", + "name": "milestoneStem", + "type": "int96" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "int40", + "name": "deltaStalkEarnedPerSeason", + "type": "int40" + }, + { + "internalType": "uint128", + "name": "gaugePoints", + "type": "uint128" + }, + { + "internalType": "uint64", + "name": "optimalPercentDepositedBdv", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "gaugePointImplementation", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes1", + "name": "encodeType", + "type": "bytes1" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Implementation", + "name": "liquidityWeightImplementation", + "type": "tuple" + } + ], + "internalType": "struct AssetSettings", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalEarnedBeans", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalRainRoots", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalRoots", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "delta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "enum GerminationSide", + "name": "germ", + "type": "uint8" + } + ], + "name": "FarmerGerminatingStalkBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int96", + "name": "stem", + "type": "int96" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bdv", + "type": "uint256" + } + ], + "name": "RemoveDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "bdvs", + "type": "uint256[]" + } + ], + "name": "RemoveDeposits", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "delta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaRoots", + "type": "int256" + } + ], + "name": "StalkBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "germinationSeason", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaAmount", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaBdv", + "type": "int256" + } + ], + "name": "TotalGerminatingBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "germinationSeason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaGerminatingStalk", + "type": "int256" + } + ], + "name": "TotalGerminatingStalkChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.From", + "name": "mode", + "type": "uint8" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_bdv", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "depositIds", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "_bdv", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96[]", + "name": "stem", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "transferDeposits", + "outputs": [ + { + "internalType": "uint256[]", + "name": "bdvs", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "sortedDepositIds", + "type": "uint256[]" + } + ], + "name": "updateSortedDepositIds", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "withdrawDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "withdrawDeposits", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "name": "Convert", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "outputToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "clipboard", + "type": "bytes" + } + ], + "internalType": "struct AdvancedPipeCall[]", + "name": "advancedPipeCalls", + "type": "tuple[]" + } + ], + "name": "pipelineConvert", + "outputs": [ + { + "internalType": "int96", + "name": "toStem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "outputToken", + "type": "address" + }, + { + "internalType": "int256", + "name": "grownStalkSlippage", + "type": "int256" + }, + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "clipboard", + "type": "bytes" + } + ], + "internalType": "struct AdvancedPipeCall[]", + "name": "advancedPipeCalls", + "type": "tuple[]" + } + ], + "name": "pipelineConvertWithStalkSlippage", + "outputs": [ + { + "internalType": "int96", + "name": "toStem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "T", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "reserves", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "calculateDeltaBFromReserves", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "int256", + "name": "beforeInputTokenDeltaB", + "type": "int256" + }, + { + "internalType": "int256", + "name": "afterInputTokenDeltaB", + "type": "int256" + }, + { + "internalType": "int256", + "name": "beforeOutputTokenDeltaB", + "type": "int256" + }, + { + "internalType": "int256", + "name": "afterOutputTokenDeltaB", + "type": "int256" + }, + { + "internalType": "int256", + "name": "beforeOverallDeltaB", + "type": "int256" + }, + { + "internalType": "int256", + "name": "afterOverallDeltaB", + "type": "int256" + } + ], + "internalType": "struct LibConvert.DeltaBStorage", + "name": "dbs", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "bdvConverted", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "overallConvertCapacity", + "type": "uint256" + }, + { + "internalType": "address", + "name": "inputToken", + "type": "address" + }, + { + "internalType": "address", + "name": "outputToken", + "type": "address" + } + ], + "name": "calculateStalkPenalty", + "outputs": [ + { + "internalType": "uint256", + "name": "stalkPenaltyBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "overallConvertCapacityUsed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "inputTokenAmountUsed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outputTokenAmountUsed", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "cappedReservesDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "internalType": "uint256", + "name": "bdvToConvert", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "grownStalkToConvert", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountConverted", + "type": "uint256" + } + ], + "name": "downPenalizedGrownStalk", + "outputs": [ + { + "internalType": "uint256", + "name": "newGrownStalk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "grownStalkLost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "name": "getAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCalculatedBonusStalkPerBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getConvertStalkPerBdvBonusAndMaximumCapacity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getConvertStalkPerBdvBonusAndRemainingCapacity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + } + ], + "name": "getMaxAmountIn", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rate", + "type": "uint256" + } + ], + "name": "getMaxAmountInAtRate", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOverallConvertCapacity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getWellConvertCapacity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "overallCappedDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "overallCurrentDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "beforeLpTokenSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "afterLpTokenSupply", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "name": "scaledDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "bdvToConvert", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "grownStalk", + "type": "uint256" + } + ], + "name": "stalkBonus", + "outputs": [ + { + "internalType": "uint256", + "name": "bdvCapacityUsed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "grownStalkGained", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "convertData", + "type": "bytes" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "convert", + "outputs": [ + { + "internalType": "int96", + "name": "toStem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "convertData", + "type": "bytes" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "int256", + "name": "grownStalkSlippage", + "type": "int256" + } + ], + "name": "convertWithStalkSlippage", + "outputs": [ + { + "internalType": "int96", + "name": "toStem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "plenty", + "type": "uint256" + } + ], + "name": "ClaimPlenty", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beans", + "type": "uint256" + } + ], + "name": "Plant", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "enum LibTransfer.To", + "name": "toMode", + "type": "uint8" + } + ], + "name": "claimAllPlenty", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "plenty", + "type": "uint256" + } + ], + "internalType": "struct ClaimFacet.ClaimPlentyData[]", + "name": "allPlenty", + "type": "tuple[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "internalType": "enum LibTransfer.To", + "name": "toMode", + "type": "uint8" + } + ], + "name": "claimPlenty", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "mow", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "mowAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + } + ], + "name": "mowAllMultipleAccounts", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "mowMultiple", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "address[][]", + "name": "tokens", + "type": "address[][]" + } + ], + "name": "mowMultipleAccounts", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "plant", + "outputs": [ + { + "internalType": "uint256", + "name": "beans", + "type": "uint256" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "beanToBDV", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "wellBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositApproval", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approveDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseDepositAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "depositAllowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseDepositAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beans", + "type": "uint256" + } + ], + "name": "Incentivization", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "secondsLate", + "type": "uint256" + } + ], + "name": "determineReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int256", + "name": "deltaStalk", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaRoots", + "type": "int256" + } + ], + "name": "TotalStalkChangedFromGermination", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "season", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "deltaB", + "type": "int256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "cumulativeReserves", + "type": "bytes" + } + ], + "name": "WellOracle", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "check", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int96", + "name": "stem", + "type": "int96" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bdv", + "type": "uint256" + } + ], + "name": "AddDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gaugePoints", + "type": "uint256" + } + ], + "name": "GaugePointChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newStalkPerBdvPerSeason", + "type": "uint256" + } + ], + "name": "UpdateAverageStalkPerBdvPerSeason", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTotalGaugePoints", + "type": "uint256" + } + ], + "name": "UpdateMaxTotalGaugePoints", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum ShipmentRecipient", + "name": "recipient", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receivedAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Receipt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "season", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shipmentAmount", + "type": "uint256" + } + ], + "name": "Shipped", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "shipmentAmounts", + "type": "uint256[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "points", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "internalType": "struct ShipmentPlan[]", + "name": "shipmentPlans", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "totalPoints", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beansToShip", + "type": "uint256" + } + ], + "name": "getBeansFromPoints", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "planContract", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "planSelector", + "type": "bytes4" + }, + { + "internalType": "enum ShipmentRecipient", + "name": "recipient", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ShipmentRoute[]", + "name": "shipmentRoutes", + "type": "tuple[]" + } + ], + "name": "getShipmentPlans", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "points", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "internalType": "struct ShipmentPlan[]", + "name": "shipmentPlans", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "totalPoints", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "deltaPodDemand", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpToSupplyRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "podRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "thisSowTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastSowTime", + "type": "uint256" + } + ], + "name": "SeasonMetrics", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int80", + "name": "absChange", + "type": "int80" + } + ], + "name": "BeanToMaxLpGpPerBdvRatioChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "raining", + "type": "bool" + } + ], + "name": "RainStatus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "toField", + "type": "uint256" + } + ], + "name": "SeasonOfPlentyField", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beans", + "type": "uint256" + } + ], + "name": "SeasonOfPlentyWell", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int32", + "name": "absChange", + "type": "int32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "TemperatureChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "UpdatedGaugeData", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "grownStalkLost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "grownStalkKept", + "type": "uint256" + } + ], + "name": "ConvertDownPenalty", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "grownStalkGained", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newGrownStalk", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bdvCapacityUsed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bdvConverted", + "type": "uint256" + } + ], + "name": "ConvertUpBonus", + "type": "event" + }, + { + "inputs": [], + "name": "abovePeg", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + } + ], + "name": "cumulativeCurrentDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getAbsBeanToMaxLpRatioChangeFromCaseId", + "outputs": [ + { + "internalType": "uint80", + "name": "ml", + "type": "uint80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getAbsTemperatureChangeFromCaseId", + "outputs": [ + { + "internalType": "int32", + "name": "t", + "type": "int32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getCaseData", + "outputs": [ + { + "internalType": "bytes32", + "name": "casesData", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCases", + "outputs": [ + { + "internalType": "bytes32[144]", + "name": "cases", + "type": "bytes32[144]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getChangeFromCaseId", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "int32", + "name": "", + "type": "int32" + }, + { + "internalType": "uint80", + "name": "", + "type": "uint80" + }, + { + "internalType": "int80", + "name": "", + "type": "int80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeltaPodDemandLowerBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeltaPodDemandUpperBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEvaluationParameters", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBeanMaxLpGpPerBdvRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "targetSeasonsToCatchUp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "podRateUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deltaPodDemandUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioUpperBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioOptimal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpToSupplyRatioLowerBound", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "excessivePriceThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientHigh", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientLow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseReward", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "minAvgGsPerBdv", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "rainingMinBeanMaxLpGpPerBdvRatio", + "type": "uint128" + } + ], + "internalType": "struct EvaluationParameters", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getExcessivePriceThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getExtEvaluationParameters", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "belowPegSoilL2SRScalar", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientRelativelyHigh", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilCoefficientRelativelyLow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "abovePegDeltaBSoilScalar", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soilDistributionPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSoilIssuance", + "type": "uint256" + }, + { + "internalType": "bytes32[61]", + "name": "buffer", + "type": "bytes32[61]" + } + ], + "internalType": "struct ExtEvaluationParameters", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLargestLiqWell", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLpToSupplyRatioLowerBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLpToSupplyRatioOptimal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLpToSupplyRatioUpperBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxBeanMaxLpGpPerBdvRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinBeanMaxLpGpPerBdvRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOrderLockedBeans", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPodRateLowerBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPodRateOptimal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPodRateUpperBound", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getRelBeanToMaxLpRatioChangeFromCaseId", + "outputs": [ + { + "internalType": "int80", + "name": "l", + "type": "int80" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "caseId", + "type": "uint256" + } + ], + "name": "getRelTemperatureChangeFromCaseId", + "outputs": [ + { + "internalType": "uint32", + "name": "mt", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSeasonStruct", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "current", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastSop", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastSopSeason", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "rainStart", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "raining", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "sunriseBlock", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "abovePeg", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "period", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "standardMintedBeans", + "type": "uint256" + }, + { + "internalType": "bytes32[8]", + "name": "_buffer", + "type": "bytes32[8]" + } + ], + "internalType": "struct Season", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSeasonTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTargetSeasonsToCatchUp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalUsdLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "totalLiquidity", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalWeightedUsdLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "totalWeightedLiquidity", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getTwaLiquidityForWell", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getWeightedTwaLiquidityForWell", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWellsByDeltaB", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "well", + "type": "address" + }, + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "internalType": "struct LibFlood.WellDeltaB[]", + "name": "wellDeltaBs", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "totalPositiveDeltaB", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalNegativeDeltaB", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positiveDeltaBCount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_season", + "type": "uint32" + }, + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "plentyPerRoot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "poolCurrentDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "poolDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "poolDeltaBNoCap", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rain", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "pods", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "roots", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "floodHarvestablePods", + "type": "uint128" + }, + { + "internalType": "bytes32[3]", + "name": "_buffer", + "type": "bytes32[3]" + } + ], + "internalType": "struct Rain", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "season", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sunriseBlock", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "time", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "current", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastSop", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "lastSopSeason", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "rainStart", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "raining", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "sunriseBlock", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "abovePeg", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "period", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "standardMintedBeans", + "type": "uint256" + }, + { + "internalType": "bytes32[8]", + "name": "_buffer", + "type": "bytes32[8]" + } + ], + "internalType": "struct Season", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalDeltaBNoCap", + "outputs": [ + { + "internalType": "int256", + "name": "deltaB", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalInstantaneousDeltaB", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weather", + "outputs": [ + { + "components": [ + { + "internalType": "uint128", + "name": "lastDeltaSoil", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "lastSowTime", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "thisSowTime", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "temp", + "type": "uint64" + }, + { + "internalType": "uint128", + "name": "morningControl", + "type": "uint128" + }, + { + "internalType": "uint16", + "name": "morningDuration", + "type": "uint16" + }, + { + "internalType": "bytes32[3]", + "name": "_buffer", + "type": "bytes32[3]" + } + ], + "internalType": "struct Weather", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "wellOracleSnapshot", + "outputs": [ + { + "internalType": "bytes", + "name": "snapshot", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MathOverflowedMulDiv", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "Engaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "EngagedData", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "planContract", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "planSelector", + "type": "bytes4" + }, + { + "internalType": "enum ShipmentRecipient", + "name": "recipient", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct ShipmentRoute[]", + "name": "newShipmentRoutes", + "type": "tuple[]" + } + ], + "name": "ShipmentRoutesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "season", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "soil", + "type": "uint256" + } + ], + "name": "Soil", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "season", + "type": "uint256" + } + ], + "name": "Sunrise", + "type": "event" + }, + { + "inputs": [], + "name": "getShipmentRoutes", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "planContract", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "planSelector", + "type": "bytes4" + }, + { + "internalType": "enum ShipmentRecipient", + "name": "recipient", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ShipmentRoute[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "enum LibTransfer.To", + "name": "mode", + "type": "uint8" + } + ], + "name": "gm", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "seasonTime", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "planContract", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "planSelector", + "type": "bytes4" + }, + { + "internalType": "enum ShipmentRecipient", + "name": "recipient", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct ShipmentRoute[]", + "name": "shipmentRoutes", + "type": "tuple[]" + } + ], + "name": "setShipmentRoutes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sunrise", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getMillionUsdPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getRatiosAndBeanIndex", + "outputs": [ + { + "internalType": "uint256[]", + "name": "ratios", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "beanIndex", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getTokenUsdPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getTokenUsdPriceFromExternal", + "outputs": [ + { + "internalType": "uint256", + "name": "tokenUsd", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getTokenUsdTwap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getUsdTokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getUsdTokenPriceFromExternal", + "outputs": [ + { + "internalType": "uint256", + "name": "usdToken", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lookback", + "type": "uint256" + } + ], + "name": "getUsdTokenTwap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "maxWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "noWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "percentOfDepositedBdv", + "type": "uint256" + } + ], + "name": "calcGaugePointsWithParams", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAverageGrownStalkPerBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAverageGrownStalkPerBdvPerSeason", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanGaugePointsPerBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanToMaxLpGpPerBdvRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBeanToMaxLpGpPerBdvRatioScaled", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeltaPodDemand", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGaugePoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGaugePointsPerBdvForToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "well", + "type": "address" + } + ], + "name": "getGaugePointsPerBdvForWell", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getGaugePointsWithParams", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGrownStalkIssuedPerGp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGrownStalkIssuedPerSeason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLargestGpPerBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLiquidityToSupplyRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxTotalGaugePoints", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "fieldId", + "type": "uint256" + } + ], + "name": "getPodRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSeedGauge", + "outputs": [ + { + "components": [ + { + "internalType": "uint128", + "name": "averageGrownStalkPerBdvPerSeason", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "beanToMaxLpGpPerBdvRatio", + "type": "uint128" + }, + { + "internalType": "bool", + "name": "avgGsPerBdvFlag", + "type": "bool" + }, + { + "internalType": "uint128", + "name": "maxTotalGaugePoints", + "type": "uint128" + }, + { + "internalType": "bytes32[4]", + "name": "_buffer", + "type": "bytes32[4]" + } + ], + "internalType": "struct SeedGauge", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBdv", + "outputs": [ + { + "internalType": "uint256", + "name": "totalBdv", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "gaugeData", + "type": "bytes" + } + ], + "name": "convertDownPenaltyGauge", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "gaugeData", + "type": "bytes" + } + ], + "name": "convertUpBonusGauge", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "gaugeData", + "type": "bytes" + } + ], + "name": "cultivationFactor", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentGaugePoints", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "optimalPercentDepositedBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "percentOfDepositedBdv", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "defaultGaugePoints", + "outputs": [ + { + "internalType": "uint256", + "name": "newGaugePoints", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getExtremelyFarAbove", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getExtremelyFarBelow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + } + ], + "name": "getGauge", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Gauge", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + } + ], + "name": "getGaugeData", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + } + ], + "name": "getGaugeIdResult", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Gauge", + "name": "gauge", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + } + ], + "name": "getGaugeResult", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + } + ], + "name": "getGaugeValue", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getRelativelyCloseAbove", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getRelativelyCloseBelow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getRelativelyFarAbove", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "optimalPercentBdv", + "type": "uint256" + } + ], + "name": "getRelativelyFarBelow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "systemData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "gaugeData", + "type": "bytes" + } + ], + "name": "lpDistributionUpdateGauge", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "StringsInsufficientHexLength", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "_uri", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "int96", + "name": "stem", + "type": "int96" + } + ], + "name": "imageURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "convertData", + "type": "bytes" + }, + { + "internalType": "int96[]", + "name": "stems", + "type": "int96[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "int256", + "name": "grownStalkSlippage", + "type": "int256" + } + ], + "internalType": "struct ConvertBatchFacet.ConvertParams[]", + "name": "converts", + "type": "tuple[]" + } + ], + "name": "batchConvert", + "outputs": [ + { + "components": [ + { + "internalType": "enum LibConvertData.ConvertKind", + "name": "convertKind", + "type": "uint8" + }, + { + "internalType": "int96", + "name": "toStem", + "type": "int96" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromBdv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBdv", + "type": "uint256" + } + ], + "internalType": "struct ConvertBatchFacet.ConvertOutput[]", + "name": "convertOutputs", + "type": "tuple[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Gauge", + "name": "gauge", + "type": "tuple" + } + ], + "name": "AddedGauge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Gauge", + "name": "gauge", + "type": "tuple" + } + ], + "name": "AddedStatefulGauge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + } + ], + "name": "RemovedGauge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Gauge", + "name": "gauge", + "type": "tuple" + } + ], + "name": "UpdatedGauge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum GaugeId", + "name": "gaugeId", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "UpdatedGaugeValue", + "type": "event" + } +] \ No newline at end of file diff --git a/src/datasources/contracts/upgradeable/beanstalk.js b/src/datasources/contracts/upgradeable/beanstalk.js index 3036356..ea8c65e 100644 --- a/src/datasources/contracts/upgradeable/beanstalk.js +++ b/src/datasources/contracts/upgradeable/beanstalk.js @@ -20,9 +20,16 @@ const mapping = [ { chain: 'base', start: 37196338, - end: 'latest', + end: 41037288, // TODO: PI14 block goes here address: '0xD1A0D188E861ed9d15773a2F3574a2e94134bA8f', abi: require('../../abi/beanstalk/Pinto-PI13.json') + }, + { + chain: 'base', + start: 41037288, // TODO: PI14 block goes here + end: 'latest', + address: '0xD1A0D188E861ed9d15773a2F3574a2e94134bA8f', + abi: require('../../abi/beanstalk/Pinto-PI14.json') } ]; diff --git a/src/repository/dto/tractor/SowExecutionDto.js b/src/repository/dto/tractor/SowExecutionDto.js index 7a428e8..1ca7b76 100644 --- a/src/repository/dto/tractor/SowExecutionDto.js +++ b/src/repository/dto/tractor/SowExecutionDto.js @@ -7,15 +7,24 @@ class SowExecutionDto { if (type === 'data') { const { baseExecutionDto, innerEvents } = d; const sowEvt = innerEvents.find((e) => e.name === 'Sow'); + const sowReferralEvt = innerEvents.find((e) => e.name === 'SowReferral'); this.id = baseExecutionDto.id; this.blueprintHash = baseExecutionDto.blueprintHash; this.index = BigInt(sowEvt.args.index); this.beans = BigInt(sowEvt.args.beans); this.pods = BigInt(sowEvt.args.pods); - this.placeInLine = null; // Needs async, will be set outside - this.usedTokens = null; // Needs async, will be set outside - this.usedGrownStalkPerBdv = null; // Needs async, will be set outside + // Fields initialized as nulls need async, will be set outside + this.placeInLine = null; + this.usedTokens = null; + this.usedGrownStalkPerBdv = null; + if (sowReferralEvt) { + this.referrer = sowReferralEvt.args.referrer; + this.referrerPods = BigInt(sowReferralEvt.args.referrerPods); + this.referrerPlaceInLine = null; + this.refereePods = BigInt(sowReferralEvt.args.refereePods); + this.refereePlaceInLine = null; + } } else if (type === 'db') { this.id = d.id; this.blueprintHash = d.blueprintHash; @@ -28,7 +37,11 @@ class SowExecutionDto { .map(Number) .map((index) => BlueprintConstants.tokenIndexReverseMap()[index]); this.usedGrownStalkPerBdv = d.usedGrownStalkPerBdv; - // TODO: consider whether this should also have the new referral address property + this.referrer = d.referrer; + this.referrerPods = d.referrerPods; + this.referrerPlaceInLine = d.referrerPlaceInLine; + this.refereePods = d.refereePods; + this.refereePlaceInLine = d.refereePlaceInLine; } } @@ -42,6 +55,12 @@ class SowExecutionDto { }); sowExecutionDto.placeInLine = BigInt(sowEvt.args.index) - BigInt(harvestableIndex); + const sowReferralEvt = sowExecutionContext.innerEvents.find((e) => e.name === 'SowReferral'); + if (sowReferralEvt) { + sowExecutionDto.referrerPlaceInLine = BigInt(sowReferralEvt.args.referrerIndex) - BigInt(harvestableIndex); + sowExecutionDto.refereePlaceInLine = BigInt(sowReferralEvt.args.refereeIndex) - BigInt(harvestableIndex); + } + // Assign usedTokens, usedGrownStalkPerBdv according to withdraw events await sowExecutionDto.determineWithdrawnTokens(sowExecutionContext.innerEvents); diff --git a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js index e1b6029..ba87a87 100644 --- a/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js +++ b/src/repository/postgres/migrations/20260114193519-general-blueprint-tables.js @@ -68,6 +68,28 @@ module.exports = { type: Sequelize.STRING, allowNull: true }); + + // Add columns to tractor_execution_sow + await queryInterface.addColumn('tractor_execution_sow', 'referrer', { + type: Sequelize.STRING(42), + allowNull: true + }); + await queryInterface.addColumn('tractor_execution_sow', 'referrerPods', { + type: Sequelize.NUMERIC(38, 0), + allowNull: true + }); + await queryInterface.addColumn('tractor_execution_sow', 'referrerPlaceInLine', { + type: Sequelize.NUMERIC(38, 0), + allowNull: true + }); + await queryInterface.addColumn('tractor_execution_sow', 'refereePods', { + type: Sequelize.NUMERIC(38, 0), + allowNull: true + }); + await queryInterface.addColumn('tractor_execution_sow', 'refereePlaceInLine', { + type: Sequelize.NUMERIC(38, 0), + allowNull: true + }); }, async down(queryInterface, Sequelize) { @@ -76,6 +98,12 @@ module.exports = { await queryInterface.removeColumn('tractor_order_sow', 'blueprintVersion'); await queryInterface.removeColumn('tractor_order_convert_up', 'blueprintVersion'); + await queryInterface.removeColumn('tractor_execution_sow', 'referrer'); + await queryInterface.removeColumn('tractor_execution_sow', 'referrerPods'); + await queryInterface.removeColumn('tractor_execution_sow', 'referrerPlaceInLine'); + await queryInterface.removeColumn('tractor_execution_sow', 'refereePods'); + await queryInterface.removeColumn('tractor_execution_sow', 'refereePlaceInLine'); + // Drop new enum types await queryInterface.sequelize.query(` DROP TYPE IF EXISTS "enum_tractor_order_sow_blueprintVersion"; diff --git a/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js b/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js index 6156f0d..583740d 100644 --- a/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js +++ b/src/repository/postgres/models/assemblers/tractor/tractor-execution-sow-assembler.js @@ -13,7 +13,12 @@ class SowExecutionAssembler { usedTokenIndices: executionDto.usedTokens .map((token) => BlueprintConstants.tokenIndexMap()[token.toLowerCase()]) .join(','), - usedGrownStalkPerBdv: executionDto.usedGrownStalkPerBdv + usedGrownStalkPerBdv: executionDto.usedGrownStalkPerBdv, + referrer: executionDto.referrer, + referrerPods: executionDto.referrerPods, + referrerPlaceInLine: executionDto.referrerPlaceInLine, + refereePods: executionDto.refereePods, + refereePlaceInLine: executionDto.refereePlaceInLine }; } diff --git a/src/repository/postgres/models/tractor-execution-sow-model.js b/src/repository/postgres/models/tractor-execution-sow-model.js index 8beabbf..5602747 100644 --- a/src/repository/postgres/models/tractor-execution-sow-model.js +++ b/src/repository/postgres/models/tractor-execution-sow-model.js @@ -23,7 +23,15 @@ module.exports = (sequelize, DataTypes) => { usedGrownStalkPerBdv: { type: DataTypes.FLOAT, allowNull: false - } + }, + referrer: { + type: DataTypes.TEXT, + allowNull: true + }, + ...bigintNumericColumn('referrerPods', DataTypes, { allowNull: true }), + ...bigintNumericColumn('referrerPlaceInLine', DataTypes, { allowNull: true }), + ...bigintNumericColumn('refereePods', DataTypes, { allowNull: true }), + ...bigintNumericColumn('refereePlaceInLine', DataTypes, { allowNull: true }) }, { tableName: TRACTOR_EXECUTION_SOW_TABLE.env, From 711601cab5c8b24e0146e2ec12049c0dbda5358e Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:04:37 -0500 Subject: [PATCH 16/22] Update indexing table names --- src/constants/raw/pinto-base.js | 2 +- src/constants/tables.js | 13 ----- ...250408205456-tractor-order-sow-v0-table.js | 6 +- ...08210628-tractor-execution-sow-v0-table.js | 14 ++--- .../20250424012929-tractor-snapshot-sow-v0.js | 5 +- .../20250501203742-snapshot-add-season.js | 6 +- .../20250502214852-snapshot-add-columns.js | 10 ++-- ...60106-tractor-order-convert-up-v0-table.js | 6 +- ...0-tractor-execution-convert-up-v0-table.js | 14 ++--- ...18200103-tractor-snapshot-convert-up-v0.js | 5 +- .../seeders/20000519185341-indexing-tables.js | 56 +++++++++---------- 11 files changed, 55 insertions(+), 82 deletions(-) diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index bf79a15..44f3461 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -37,7 +37,7 @@ const contracts = { STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, sowV0TractorHelpersAbi], - // TODO: Need to get these addresses + // TODO: Might need to update addresses? SOW_REFERRAL: ['0xD9DF9C4C0160401702de1771AAAaD886e2375F65', null, sowReferralAbi], SOW_REFERRAL_TRACTOR_HELPERS: ['tbd', null, sowReferralTractorHelpersAbi], SOW_REFERRAL_SILO_HELPERS: ['tbd', null, sowReferralSiloHelpersAbi], diff --git a/src/constants/tables.js b/src/constants/tables.js index 9fffb61..d7a9bb2 100644 --- a/src/constants/tables.js +++ b/src/constants/tables.js @@ -19,18 +19,11 @@ const SILO_INFLOW_TABLE = envNamed('silo_inflow'); const SILO_INFLOW_SNAPSHOT_TABLE = envNamed('silo_inflow_snapshot'); const TOKEN_TABLE = envNamed('token'); const TRACTOR_EXECUTION_TABLE = envNamed('tractor_execution'); -// TODO: will need to remove the old v0 ones, ok to replace those constants in the migration files that used them -const TRACTOR_EXECUTION_SOW_V0_TABLE = envNamed('tractor_execution_sow_v0'); -const TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE = envNamed('tractor_execution_convert_up_v0'); const TRACTOR_EXECUTION_SOW_TABLE = envNamed('tractor_execution_sow'); const TRACTOR_EXECUTION_CONVERT_UP_TABLE = envNamed('tractor_execution_convert_up'); const TRACTOR_ORDER_TABLE = envNamed('tractor_order'); -const TRACTOR_ORDER_SOW_V0_TABLE = envNamed('tractor_order_sow_v0'); -const TRACTOR_ORDER_CONVERT_UP_V0_TABLE = envNamed('tractor_order_convert_up_v0'); const TRACTOR_ORDER_SOW_TABLE = envNamed('tractor_order_sow'); const TRACTOR_ORDER_CONVERT_UP_TABLE = envNamed('tractor_order_convert_up'); -const TRACTOR_SNAPSHOT_SOW_V0_TABLE = envNamed('tractor_snapshot_sow_v0'); -const TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE = envNamed('tractor_snapshot_convert_up_v0'); const TRACTOR_SNAPSHOT_SOW_TABLE = envNamed('tractor_snapshot_sow'); const TRACTOR_SNAPSHOT_CONVERT_UP_TABLE = envNamed('tractor_snapshot_convert_up'); const YIELD_TABLE = envNamed('yield'); @@ -45,17 +38,11 @@ module.exports = { SILO_INFLOW_SNAPSHOT_TABLE, TOKEN_TABLE, TRACTOR_EXECUTION_TABLE, - TRACTOR_EXECUTION_SOW_V0_TABLE, - TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE, TRACTOR_EXECUTION_SOW_TABLE, TRACTOR_EXECUTION_CONVERT_UP_TABLE, TRACTOR_ORDER_TABLE, - TRACTOR_ORDER_SOW_V0_TABLE, - TRACTOR_ORDER_CONVERT_UP_V0_TABLE, TRACTOR_ORDER_SOW_TABLE, TRACTOR_ORDER_CONVERT_UP_TABLE, - TRACTOR_SNAPSHOT_SOW_V0_TABLE, - TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE, TRACTOR_SNAPSHOT_SOW_TABLE, TRACTOR_SNAPSHOT_CONVERT_UP_TABLE, YIELD_TABLE diff --git a/src/repository/postgres/migrations/20250408205456-tractor-order-sow-v0-table.js b/src/repository/postgres/migrations/20250408205456-tractor-order-sow-v0-table.js index b5def69..d68aaf3 100644 --- a/src/repository/postgres/migrations/20250408205456-tractor-order-sow-v0-table.js +++ b/src/repository/postgres/migrations/20250408205456-tractor-order-sow-v0-table.js @@ -1,12 +1,12 @@ 'use strict'; -const { TRACTOR_ORDER_TABLE, TRACTOR_ORDER_SOW_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_ORDER_TABLE } = require('../../../constants/tables'); const { timestamps, bigintNumericColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_ORDER_SOW_V0_TABLE.prod, { + await queryInterface.createTable('tractor_order_sow_v0', { blueprintHash: { type: Sequelize.STRING(66), primaryKey: true, @@ -45,6 +45,6 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_ORDER_SOW_V0_TABLE.prod); + await queryInterface.dropTable('tractor_order_sow_v0'); } }; diff --git a/src/repository/postgres/migrations/20250408210628-tractor-execution-sow-v0-table.js b/src/repository/postgres/migrations/20250408210628-tractor-execution-sow-v0-table.js index bc8c1d2..66672d1 100644 --- a/src/repository/postgres/migrations/20250408210628-tractor-execution-sow-v0-table.js +++ b/src/repository/postgres/migrations/20250408210628-tractor-execution-sow-v0-table.js @@ -1,16 +1,12 @@ 'use strict'; -const { - TRACTOR_EXECUTION_TABLE, - TRACTOR_EXECUTION_SOW_V0_TABLE, - TRACTOR_ORDER_SOW_V0_TABLE -} = require('../../../constants/tables'); +const { TRACTOR_EXECUTION_TABLE } = require('../../../constants/tables'); const { timestamps, bigintNumericColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_EXECUTION_SOW_V0_TABLE.prod, { + await queryInterface.createTable('tractor_execution_sow_v0', { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -25,7 +21,7 @@ module.exports = { blueprintHash: { type: Sequelize.STRING(66), references: { - model: TRACTOR_ORDER_SOW_V0_TABLE.prod, + model: 'tractor_order_sow_v0', key: 'blueprintHash' }, onDelete: 'RESTRICT', @@ -46,10 +42,10 @@ module.exports = { ...timestamps(Sequelize) }); - await queryInterface.addIndex(TRACTOR_EXECUTION_SOW_V0_TABLE.prod, ['blueprintHash']); + await queryInterface.addIndex('tractor_execution_sow_v0', ['blueprintHash']); }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_EXECUTION_SOW_V0_TABLE.prod); + await queryInterface.dropTable('tractor_execution_sow_v0'); } }; diff --git a/src/repository/postgres/migrations/20250424012929-tractor-snapshot-sow-v0.js b/src/repository/postgres/migrations/20250424012929-tractor-snapshot-sow-v0.js index 36df73b..630ce97 100644 --- a/src/repository/postgres/migrations/20250424012929-tractor-snapshot-sow-v0.js +++ b/src/repository/postgres/migrations/20250424012929-tractor-snapshot-sow-v0.js @@ -1,12 +1,11 @@ 'use strict'; -const { TRACTOR_SNAPSHOT_SOW_V0_TABLE } = require('../../../constants/tables'); const { bigintNumericColumn, timestamps } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, { + await queryInterface.createTable('tractor_snapshot_sow_v0', { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -35,6 +34,6 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod); + await queryInterface.dropTable('tractor_snapshot_sow_v0'); } }; diff --git a/src/repository/postgres/migrations/20250501203742-snapshot-add-season.js b/src/repository/postgres/migrations/20250501203742-snapshot-add-season.js index 5dbde13..5456b94 100644 --- a/src/repository/postgres/migrations/20250501203742-snapshot-add-season.js +++ b/src/repository/postgres/migrations/20250501203742-snapshot-add-season.js @@ -1,17 +1,15 @@ 'use strict'; -const { TRACTOR_SNAPSHOT_SOW_V0_TABLE } = require('../../../constants/tables'); - /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.addColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'season', { + await queryInterface.addColumn('tractor_snapshot_sow_v0', 'season', { type: Sequelize.INTEGER, allowNull: false }); }, async down(queryInterface, Sequelize) { - await queryInterface.removeColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'season'); + await queryInterface.removeColumn('tractor_snapshot_sow_v0', 'season'); } }; diff --git a/src/repository/postgres/migrations/20250502214852-snapshot-add-columns.js b/src/repository/postgres/migrations/20250502214852-snapshot-add-columns.js index 2e68be6..276adbd 100644 --- a/src/repository/postgres/migrations/20250502214852-snapshot-add-columns.js +++ b/src/repository/postgres/migrations/20250502214852-snapshot-add-columns.js @@ -1,22 +1,20 @@ 'use strict'; -const { TRACTOR_SNAPSHOT_SOW_V0_TABLE } = require('../../../constants/tables'); - /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.addColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'maxSowThisSeason', { + await queryInterface.addColumn('tractor_snapshot_sow_v0', 'maxSowThisSeason', { type: Sequelize.NUMERIC(38, 0), allowNull: false }); - await queryInterface.addColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'uniquePublishers', { + await queryInterface.addColumn('tractor_snapshot_sow_v0', 'uniquePublishers', { type: Sequelize.INTEGER, allowNull: false }); }, async down(queryInterface, Sequelize) { - await queryInterface.removeColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'maxSowThisSeason'); - await queryInterface.removeColumn(TRACTOR_SNAPSHOT_SOW_V0_TABLE.prod, 'uniquePublishers'); + await queryInterface.removeColumn('tractor_snapshot_sow_v0', 'maxSowThisSeason'); + await queryInterface.removeColumn('tractor_snapshot_sow_v0', 'uniquePublishers'); } }; diff --git a/src/repository/postgres/migrations/20250912160106-tractor-order-convert-up-v0-table.js b/src/repository/postgres/migrations/20250912160106-tractor-order-convert-up-v0-table.js index b8a70f4..7b696b3 100644 --- a/src/repository/postgres/migrations/20250912160106-tractor-order-convert-up-v0-table.js +++ b/src/repository/postgres/migrations/20250912160106-tractor-order-convert-up-v0-table.js @@ -1,13 +1,13 @@ 'use strict'; -const { TRACTOR_ORDER_TABLE, TRACTOR_ORDER_CONVERT_UP_V0_TABLE } = require('../../../constants/tables'); +const { TRACTOR_ORDER_TABLE } = require('../../../constants/tables'); const { StalkMode } = require('../models/types/types'); const { timestamps, bigintNumericColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_ORDER_CONVERT_UP_V0_TABLE.prod, { + await queryInterface.createTable('tractor_order_convert_up_v0', { blueprintHash: { type: Sequelize.STRING(66), primaryKey: true, @@ -59,6 +59,6 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_ORDER_CONVERT_UP_V0_TABLE.prod); + await queryInterface.dropTable('tractor_order_convert_up_v0'); } }; diff --git a/src/repository/postgres/migrations/20250912160120-tractor-execution-convert-up-v0-table.js b/src/repository/postgres/migrations/20250912160120-tractor-execution-convert-up-v0-table.js index 6e4651b..1e34026 100644 --- a/src/repository/postgres/migrations/20250912160120-tractor-execution-convert-up-v0-table.js +++ b/src/repository/postgres/migrations/20250912160120-tractor-execution-convert-up-v0-table.js @@ -1,16 +1,12 @@ 'use strict'; -const { - TRACTOR_EXECUTION_TABLE, - TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE, - TRACTOR_ORDER_CONVERT_UP_V0_TABLE -} = require('../../../constants/tables'); +const { TRACTOR_EXECUTION_TABLE } = require('../../../constants/tables'); const { timestamps, bigintNumericColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.prod, { + await queryInterface.createTable('tractor_execution_convert_up_v0', { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -25,7 +21,7 @@ module.exports = { blueprintHash: { type: Sequelize.STRING(66), references: { - model: TRACTOR_ORDER_CONVERT_UP_V0_TABLE.prod, + model: 'tractor_order_convert_up_v0', key: 'blueprintHash' }, onDelete: 'RESTRICT', @@ -59,10 +55,10 @@ module.exports = { ...timestamps(Sequelize) }); - await queryInterface.addIndex(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.prod, ['blueprintHash']); + await queryInterface.addIndex('tractor_execution_convert_up_v0', ['blueprintHash']); }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.prod); + await queryInterface.dropTable('tractor_execution_convert_up_v0'); } }; diff --git a/src/repository/postgres/migrations/20250918200103-tractor-snapshot-convert-up-v0.js b/src/repository/postgres/migrations/20250918200103-tractor-snapshot-convert-up-v0.js index f59ef1c..69ea6ca 100644 --- a/src/repository/postgres/migrations/20250918200103-tractor-snapshot-convert-up-v0.js +++ b/src/repository/postgres/migrations/20250918200103-tractor-snapshot-convert-up-v0.js @@ -1,12 +1,11 @@ 'use strict'; -const { TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE } = require('../../../constants/tables'); const { timestamps, bigintNumericColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable(TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.prod, { + await queryInterface.createTable('tractor_snapshot_convert_up_v0', { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -46,6 +45,6 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable(TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.prod); + await queryInterface.dropTable('tractor_snapshot_convert_up_v0'); } }; diff --git a/src/repository/postgres/seeders/20000519185341-indexing-tables.js b/src/repository/postgres/seeders/20000519185341-indexing-tables.js index 45e52ad..ba3466a 100644 --- a/src/repository/postgres/seeders/20000519185341-indexing-tables.js +++ b/src/repository/postgres/seeders/20000519185341-indexing-tables.js @@ -5,9 +5,9 @@ const { DEPOSIT_TABLE, TRACTOR_ORDER_TABLE, TRACTOR_EXECUTION_TABLE, - TRACTOR_EXECUTION_SOW_V0_TABLE, - TRACTOR_SNAPSHOT_SOW_V0_TABLE, - TRACTOR_ORDER_SOW_V0_TABLE, + TRACTOR_EXECUTION_SOW_TABLE, + TRACTOR_SNAPSHOT_SOW_TABLE, + TRACTOR_ORDER_SOW_TABLE, SILO_INFLOW_TABLE, SILO_INFLOW_SNAPSHOT_TABLE, FIELD_INFLOW_SNAPSHOT_TABLE, @@ -15,9 +15,9 @@ const { TOKEN_TABLE, SEASON_TABLE, YIELD_TABLE, - TRACTOR_ORDER_CONVERT_UP_V0_TABLE, - TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE, - TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE + TRACTOR_ORDER_CONVERT_UP_TABLE, + TRACTOR_EXECUTION_CONVERT_UP_TABLE, + TRACTOR_SNAPSHOT_CONVERT_UP_TABLE } = require('../../../constants/tables'); const EnvUtil = require('../../../utils/env'); const { TractorOrderType, ApyInitType, StalkMode } = require('../models/types/types'); @@ -359,8 +359,8 @@ module.exports = { await queryInterface.addIndex(TRACTOR_EXECUTION_TABLE.indexing, ['blueprintHash']); } - if (!existingTables.includes(TRACTOR_ORDER_SOW_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_ORDER_SOW_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_ORDER_SOW_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_ORDER_SOW_TABLE.indexing, { blueprintHash: { type: Sequelize.STRING(66), primaryKey: true, @@ -398,8 +398,8 @@ module.exports = { }); } - if (!existingTables.includes(TRACTOR_EXECUTION_SOW_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_EXECUTION_SOW_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_EXECUTION_SOW_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_EXECUTION_SOW_TABLE.indexing, { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -414,7 +414,7 @@ module.exports = { blueprintHash: { type: Sequelize.STRING(66), references: { - model: TRACTOR_ORDER_SOW_V0_TABLE.indexing, + model: TRACTOR_ORDER_SOW_TABLE.indexing, key: 'blueprintHash' }, onDelete: 'RESTRICT', @@ -435,11 +435,11 @@ module.exports = { }, ...timestamps(Sequelize) }); - await queryInterface.addIndex(TRACTOR_EXECUTION_SOW_V0_TABLE.indexing, ['blueprintHash']); + await queryInterface.addIndex(TRACTOR_EXECUTION_SOW_TABLE.indexing, ['blueprintHash']); } - if (!existingTables.includes(TRACTOR_SNAPSHOT_SOW_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_SNAPSHOT_SOW_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_SNAPSHOT_SOW_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_SNAPSHOT_SOW_TABLE.indexing, { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -476,8 +476,8 @@ module.exports = { }); } - if (!existingTables.includes(TRACTOR_ORDER_CONVERT_UP_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_ORDER_CONVERT_UP_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_ORDER_CONVERT_UP_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_ORDER_CONVERT_UP_TABLE.indexing, { blueprintHash: { type: Sequelize.STRING(66), primaryKey: true, @@ -528,8 +528,8 @@ module.exports = { }); } - if (!existingTables.includes(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_EXECUTION_CONVERT_UP_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_EXECUTION_CONVERT_UP_TABLE.indexing, { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -544,7 +544,7 @@ module.exports = { blueprintHash: { type: Sequelize.STRING(66), references: { - model: TRACTOR_ORDER_CONVERT_UP_V0_TABLE.indexing, + model: TRACTOR_ORDER_CONVERT_UP_TABLE.indexing, key: 'blueprintHash' }, onDelete: 'RESTRICT', @@ -577,11 +577,11 @@ module.exports = { ...bigintNumericColumn('gsPenaltyBdv', Sequelize, { allowNull: false }), ...timestamps(Sequelize) }); - await queryInterface.addIndex(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.indexing, ['blueprintHash']); + await queryInterface.addIndex(TRACTOR_EXECUTION_CONVERT_UP_TABLE.indexing, ['blueprintHash']); } - if (!existingTables.includes(TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.indexing)) { - await queryInterface.createTable(TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.indexing, { + if (!existingTables.includes(TRACTOR_SNAPSHOT_CONVERT_UP_TABLE.indexing)) { + await queryInterface.createTable(TRACTOR_SNAPSHOT_CONVERT_UP_TABLE.indexing, { id: { type: Sequelize.INTEGER, primaryKey: true, @@ -917,12 +917,12 @@ module.exports = { await queryInterface.dropTable(DEPOSIT_TABLE.indexing); await queryInterface.dropTable(TRACTOR_ORDER_TABLE.indexing); await queryInterface.dropTable(TRACTOR_EXECUTION_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_ORDER_SOW_V0_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_EXECUTION_SOW_V0_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_SNAPSHOT_SOW_V0_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_ORDER_CONVERT_UP_V0_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_EXECUTION_CONVERT_UP_V0_TABLE.indexing); - await queryInterface.dropTable(TRACTOR_SNAPSHOT_CONVERT_UP_V0_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_ORDER_SOW_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_EXECUTION_SOW_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_SNAPSHOT_SOW_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_ORDER_CONVERT_UP_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_EXECUTION_CONVERT_UP_TABLE.indexing); + await queryInterface.dropTable(TRACTOR_SNAPSHOT_CONVERT_UP_TABLE.indexing); await queryInterface.dropTable(SILO_INFLOW_TABLE.indexing); await queryInterface.dropTable(SILO_INFLOW_SNAPSHOT_TABLE.indexing); await queryInterface.dropTable(FIELD_INFLOW_TABLE.indexing); From e88dc6af855f87dc00133103ca45f379124c4c6e Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:23:37 -0500 Subject: [PATCH 17/22] Update indexing table schema and cutover scripts --- docker/indexing-cutover-queries.sql | 6 +++--- src/repository/dto/tractor/SowOrderDto.js | 4 +++- .../seeders/20000519185341-indexing-tables.js | 20 ++++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docker/indexing-cutover-queries.sql b/docker/indexing-cutover-queries.sql index 7160106..bd30b9b 100644 --- a/docker/indexing-cutover-queries.sql +++ b/docker/indexing-cutover-queries.sql @@ -22,10 +22,10 @@ commit; begin; truncate table tractor_snapshot_sow, tractor_snapshot_convert_up, tractor_execution_sow, tractor_execution_convert_up, tractor_order_sow, tractor_order_convert_up, tractor_execution, tractor_order; insert into tractor_order ("blueprintHash", "orderType", "publisher", "data", "operatorPasteInstrs", "maxNonce", "startTime", "endTime", "signature", "publishedTimestamp", "publishedBlock", "beanTip", "cancelled", "lastExecutableSeason", "createdAt", "updatedAt") select "blueprintHash", "orderType"::text::public."enum_tractor_order_orderType", "publisher", "data", "operatorPasteInstrs", "maxNonce", "startTime", "endTime", "signature", "publishedTimestamp", "publishedBlock", "beanTip", "cancelled", "lastExecutableSeason", "createdAt", "updatedAt" from indexing_tractor_order; -insert into tractor_execution select * from indexing_tractor_execution; -insert into tractor_order_sow select * from indexing_tractor_order_sow; +insert into tractor_execution ("id", "blueprintHash", "nonce", "operator", "gasCostUsd", "tipUsd", "executedTimestamp", "executedBlock", "executedTxn", "createdAt", "updatedAt") select "id", "blueprintHash", "nonce", "operator", "gasCostUsd", "tipUsd", "executedTimestamp", "executedBlock", "executedTxn", "createdAt", "updatedAt" from indexing_tractor_execution; +insert into tractor_order_sow ("blueprintHash", "pintoSownCounter", "lastExecutedSeason", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalAmountToSow", "minAmountToSowPerSeason", "maxAmountToSowPerSeason", "minTemp", "maxPodlineLength", "maxGrownStalkPerBdv", "runBlocksAfterSunrise", "slippageRatio", "createdAt", "updatedAt", "blueprintVersion", "referralAddress") select "blueprintHash", "pintoSownCounter", "lastExecutedSeason", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalAmountToSow", "minAmountToSowPerSeason", "maxAmountToSowPerSeason", "minTemp", "maxPodlineLength", "maxGrownStalkPerBdv", "runBlocksAfterSunrise", "slippageRatio", "createdAt", "updatedAt", "blueprintVersion", "referralAddress" from indexing_tractor_order_sow; insert into tractor_order_convert_up ("blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits", "createdAt", "updatedAt") select "blueprintHash", "lastExecutedTimestamp", "beansLeftToConvert", "orderComplete", "amountFunded", "cascadeAmountFunded", "sourceTokenIndices", "totalBeanAmountToConvert", "minBeansConvertPerExecution", "maxBeansConvertPerExecution", "capAmountToBonusCapacity", "minTimeBetweenConverts", "minConvertBonusCapacity", "maxGrownStalkPerBdv", "grownStalkPerBdvBonusBid", "maxPriceToConvertUp", "minPriceToConvertUp", "seedDifference", "maxGrownStalkPerBdvPenalty", "slippageRatio", "lowStalkDeposits"::text::public."enum_tractor_order_convert_up_lowStalkDeposits", "createdAt", "updatedAt" from indexing_tractor_order_convert_up; -insert into tractor_execution_sow ("id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "createdAt", "updatedAt" from indexing_tractor_execution_sow; +insert into tractor_execution_sow ("id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "referrer", "referrerPods", "referrerPlaceInLine", "refereePods", "refereePlaceInLine", "createdAt", "updatedAt") select "id", "blueprintHash", "index", "beans", "pods", "placeInLine", "usedTokenIndices", "usedGrownStalkPerBdv", "referrer", "referrerPods", "referrerPlaceInLine", "refereePods", "refereePlaceInLine", "createdAt", "updatedAt" from indexing_tractor_execution_sow; insert into tractor_execution_convert_up ("id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt") select "id", "blueprintHash", "usedTokenIndices", "tokenFromAmounts", "tokenToAmounts", "beansConverted", "beanPriceBefore", "beanPriceAfter", "gsBonusStalk", "gsBonusBdv", "gsPenaltyStalk", "gsPenaltyBdv", "createdAt", "updatedAt" from indexing_tractor_execution_convert_up; insert into tractor_snapshot_sow ("id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers") select "id", "snapshotTimestamp", "snapshotBlock", "totalPintoSown", "totalPodsMinted", "totalCascadeFundedBelowTemp", "totalCascadeFundedAnyTemp", "totalTipsPaid", "currentMaxTip", "totalExecutions", "createdAt", "updatedAt", "season", "maxSowThisSeason", "uniquePublishers" from indexing_tractor_snapshot_sow; insert into tractor_snapshot_convert_up ("id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt") select "id", "snapshotTimestamp", "snapshotBlock", "season", "totalBeansConverted", "totalGsBonusStalk", "totalGsBonusBdv", "totalGsPenaltyStalk", "totalGsPenaltyBdv", "totalCascadeFunded", "totalCascadeFundedExecutable", "totalTipsPaid", "currentMaxTip", "totalExecutions", "uniquePublishers", "createdAt", "updatedAt" from indexing_tractor_snapshot_convert_up; diff --git a/src/repository/dto/tractor/SowOrderDto.js b/src/repository/dto/tractor/SowOrderDto.js index ce7d0b6..aa382d9 100644 --- a/src/repository/dto/tractor/SowOrderDto.js +++ b/src/repository/dto/tractor/SowOrderDto.js @@ -24,7 +24,9 @@ class SowOrderDto { this.maxGrownStalkPerBdv = sowParams.maxGrownStalkPerBdv; this.runBlocksAfterSunrise = sowParams.runBlocksAfterSunrise; this.slippageRatio = sowParams.slippageRatio; - this.referralAddress = blueprintVersion === 'REFERRAL' ? callArgs.params.referral : null; + if (blueprintVersion === 'REFERRAL') { + this.referralAddress = callArgs.params.referral; + } } else if (type === 'db') { this.blueprintHash = d.blueprintHash; this.blueprintVersion = d.blueprintVersion; diff --git a/src/repository/postgres/seeders/20000519185341-indexing-tables.js b/src/repository/postgres/seeders/20000519185341-indexing-tables.js index ba3466a..7356eac 100644 --- a/src/repository/postgres/seeders/20000519185341-indexing-tables.js +++ b/src/repository/postgres/seeders/20000519185341-indexing-tables.js @@ -20,7 +20,7 @@ const { TRACTOR_SNAPSHOT_CONVERT_UP_TABLE } = require('../../../constants/tables'); const EnvUtil = require('../../../utils/env'); -const { TractorOrderType, ApyInitType, StalkMode } = require('../models/types/types'); +const { TractorOrderType, ApyInitType, StalkMode, TractorOrderSowBlueprintVersion } = require('../models/types/types'); const { timestamps, bigintNumericColumn, largeBigintTextColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ @@ -394,6 +394,16 @@ module.exports = { ...bigintNumericColumn('maxGrownStalkPerBdv', Sequelize, { allowNull: false }), ...bigintNumericColumn('runBlocksAfterSunrise', Sequelize, { allowNull: false }), ...bigintNumericColumn('slippageRatio', Sequelize, { allowNull: false }), + blueprintVersion: { + type: Sequelize.ENUM, + values: Object.values(TractorOrderSowBlueprintVersion), + allowNull: false, + defaultValue: 'V0' + }, + referralAddress: { + type: Sequelize.STRING, + allowNull: true + }, ...timestamps(Sequelize) }); } @@ -433,6 +443,14 @@ module.exports = { type: Sequelize.FLOAT, allowNull: false }, + referrer: { + type: Sequelize.STRING(42), + allowNull: true + }, + ...bigintNumericColumn('referrerPods', Sequelize, { allowNull: true }), + ...bigintNumericColumn('referrerPlaceInLine', Sequelize, { allowNull: true }), + ...bigintNumericColumn('refereePods', Sequelize, { allowNull: true }), + ...bigintNumericColumn('refereePlaceInLine', Sequelize, { allowNull: true }), ...timestamps(Sequelize) }); await queryInterface.addIndex(TRACTOR_EXECUTION_SOW_TABLE.indexing, ['blueprintHash']); From fa6edf7c7ff40df4280066b150b916436903bfd4 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:58:56 -0500 Subject: [PATCH 18/22] Update deploy blocks and cleanup abis --- src/constants/raw/pinto-base.js | 8 +- .../abi/tractor/sow/referral/SiloHelpers.json | 712 ---------------- .../tractor/sow/referral/TractorHelpers.json | 775 ------------------ .../contracts/upgradeable/beanstalk.js | 4 +- test/tractor/convert.test.js | 2 +- test/tractor/sow.test.js | 2 +- 6 files changed, 7 insertions(+), 1496 deletions(-) delete mode 100644 src/datasources/abi/tractor/sow/referral/SiloHelpers.json delete mode 100644 src/datasources/abi/tractor/sow/referral/TractorHelpers.json diff --git a/src/constants/raw/pinto-base.js b/src/constants/raw/pinto-base.js index 44f3461..2f76823 100644 --- a/src/constants/raw/pinto-base.js +++ b/src/constants/raw/pinto-base.js @@ -11,8 +11,6 @@ const wellFunctionAbi = require('../../datasources/abi/basin/WellFunction.json') const sowBlueprintV0Abi = require('../../datasources/abi/tractor/sow/v0/SowBlueprintV0.json'); const sowV0TractorHelpersAbi = require('../../datasources/abi/tractor/sow/v0/TractorHelpers.json'); const sowReferralAbi = require('../../datasources/abi/tractor/sow/referral/SowBlueprintReferral.json'); -const sowReferralTractorHelpersAbi = require('../../datasources/abi/tractor/sow/referral/TractorHelpers.json'); -const sowReferralSiloHelpersAbi = require('../../datasources/abi/tractor/sow/referral/SiloHelpers.json'); const convertUpBlueprintV0Abi = require('../../datasources/abi/tractor/convert-up/v0/ConvertUpBlueprintV0.json'); const convertUpTractorHelpersAbi = require('../../datasources/abi/tractor/convert-up/v0/TractorHelpers.json'); const convertUpSiloHelpersAbi = require('../../datasources/abi/tractor/convert-up/v0/SiloHelpers.json'); @@ -37,10 +35,10 @@ const contracts = { STABLE2: ['0xBA51055a97b40d7f41f3F64b57469b5D45B67c87', null, wellFunctionAbi], SOW_V0: ['0xbb0a41927895F8ca2b4ECCc659ba158735fCF28B', null, sowBlueprintV0Abi], SOW_V0_TRACTOR_HELPERS: ['0x2808b14d287F8CA77eb25B16575aF187d5A05119', null, sowV0TractorHelpersAbi], - // TODO: Might need to update addresses? SOW_REFERRAL: ['0xD9DF9C4C0160401702de1771AAAaD886e2375F65', null, sowReferralAbi], - SOW_REFERRAL_TRACTOR_HELPERS: ['tbd', null, sowReferralTractorHelpersAbi], - SOW_REFERRAL_SILO_HELPERS: ['tbd', null, sowReferralSiloHelpersAbi], + // These use the same as the convert up helpers; can consider a better organization later + SOW_REFERRAL_TRACTOR_HELPERS: ['0xBCa2F299602c2a43850c8b2FD19D5275D0F388b6', null, convertUpTractorHelpersAbi], + SOW_REFERRAL_SILO_HELPERS: ['0xE145082A7C5EDd1767f8148A6c29a17488d1eb31', null, convertUpSiloHelpersAbi], CONVERT_UP_V0: ['0x5167Ae1fF37bE08D9cc9188C7e64DB228B6F06ca', null, convertUpBlueprintV0Abi], CONVERT_UP_V0_TRACTOR_HELPERS: ['0xBCa2F299602c2a43850c8b2FD19D5275D0F388b6', null, convertUpTractorHelpersAbi], CONVERT_UP_V0_SILO_HELPERS: ['0xE145082A7C5EDd1767f8148A6c29a17488d1eb31', null, convertUpSiloHelpersAbi] diff --git a/src/datasources/abi/tractor/sow/referral/SiloHelpers.json b/src/datasources/abi/tractor/sow/referral/SiloHelpers.json deleted file mode 100644 index b115176..0000000 --- a/src/datasources/abi/tractor/sow/referral/SiloHelpers.json +++ /dev/null @@ -1,712 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_beanstalk", - "type": "address" - }, - { - "internalType": "address", - "name": "_tractorHelpers", - "type": "address" - }, - { - "internalType": "address", - "name": "_priceManipulation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "depositId", - "type": "uint256" - } - ], - "name": "getAddressAndStem", - "outputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "int96", - "name": "stem", - "type": "int96" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getBeanAmountAvailable", - "outputs": [ - { - "internalType": "uint256", - "name": "beanAmountAvailable", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "minStem", - "type": "int96" - } - ], - "name": "getDepositStemsAndAmountsToWithdraw", - "outputs": [ - { - "internalType": "int96[]", - "name": "stems", - "type": "int96[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "availableAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "maxGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "minStem", - "type": "int96" - }, - { - "internalType": "bool", - "name": "excludeGerminatingDeposits", - "type": "bool" - }, - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - }, - { - "internalType": "enum LibSiloHelpers.Mode", - "name": "lowStalkDeposits", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "lowGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "maxStem", - "type": "int96" - }, - { - "internalType": "int256", - "name": "seedDifference", - "type": "int256" - } - ], - "internalType": "struct LibSiloHelpers.FilterParams", - "name": "filterParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "excludingPlan", - "type": "tuple" - } - ], - "name": "getDepositStemsAndAmountsToWithdraw", - "outputs": [ - { - "internalType": "int96[]", - "name": "stems", - "type": "int96[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "availableAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getSortedDeposits", - "outputs": [ - { - "internalType": "int96[]", - "name": "stems", - "type": "int96[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getTokenIndex", - "outputs": [ - { - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getUserDepositedTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "depositedTokens", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getWhitelistStatusAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256", - "name": "targetAmount", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "maxGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "minStem", - "type": "int96" - }, - { - "internalType": "bool", - "name": "excludeGerminatingDeposits", - "type": "bool" - }, - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - }, - { - "internalType": "enum LibSiloHelpers.Mode", - "name": "lowStalkDeposits", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "lowGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "maxStem", - "type": "int96" - }, - { - "internalType": "int256", - "name": "seedDifference", - "type": "int256" - } - ], - "internalType": "struct LibSiloHelpers.FilterParams", - "name": "filterParams", - "type": "tuple" - } - ], - "name": "getWithdrawalPlan", - "outputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "plan", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256", - "name": "targetAmount", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "maxGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "minStem", - "type": "int96" - }, - { - "internalType": "bool", - "name": "excludeGerminatingDeposits", - "type": "bool" - }, - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - }, - { - "internalType": "enum LibSiloHelpers.Mode", - "name": "lowStalkDeposits", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "lowGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "maxStem", - "type": "int96" - }, - { - "internalType": "int256", - "name": "seedDifference", - "type": "int256" - } - ], - "internalType": "struct LibSiloHelpers.FilterParams", - "name": "filterParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "excludingPlan", - "type": "tuple" - } - ], - "name": "getWithdrawalPlanExcludingPlan", - "outputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "plan", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "slippageRatio", - "type": "uint256" - } - ], - "name": "isValidSlippage", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "sortDeposits", - "outputs": [ - { - "internalType": "address[]", - "name": "updatedTokens", - "type": "address[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256", - "name": "targetAmount", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "maxGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "minStem", - "type": "int96" - }, - { - "internalType": "bool", - "name": "excludeGerminatingDeposits", - "type": "bool" - }, - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - }, - { - "internalType": "enum LibSiloHelpers.Mode", - "name": "lowStalkDeposits", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "lowGrownStalkPerBdv", - "type": "uint256" - }, - { - "internalType": "int96", - "name": "maxStem", - "type": "int96" - }, - { - "internalType": "int256", - "name": "seedDifference", - "type": "int256" - } - ], - "internalType": "struct LibSiloHelpers.FilterParams", - "name": "filterParams", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "slippageRatio", - "type": "uint256" - }, - { - "internalType": "enum LibTransfer.To", - "name": "mode", - "type": "uint8" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "plan", - "type": "tuple" - } - ], - "name": "withdrawBeansFromSources", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/datasources/abi/tractor/sow/referral/TractorHelpers.json b/src/datasources/abi/tractor/sow/referral/TractorHelpers.json deleted file mode 100644 index 7936716..0000000 --- a/src/datasources/abi/tractor/sow/referral/TractorHelpers.json +++ /dev/null @@ -1,775 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_beanstalk", - "type": "address" - }, - { - "internalType": "address", - "name": "_beanstalkPrice", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum TractorHelpers.RewardType", - "name": "rewardType", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "address", - "name": "publisher", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "int256", - "name": "amount", - "type": "int256" - } - ], - "name": "OperatorReward", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "add", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "selector", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "options", - "type": "bytes32[]" - } - ], - "name": "bytes32Switch", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "condition", - "type": "bool" - } - ], - "name": "check", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan[]", - "name": "plans", - "type": "tuple[]" - } - ], - "name": "combineWithdrawalPlans", - "outputs": [ - { - "components": [ - { - "internalType": "address[]", - "name": "sourceTokens", - "type": "address[]" - }, - { - "internalType": "int96[][]", - "name": "stems", - "type": "int96[][]" - }, - { - "internalType": "uint256[][]", - "name": "amounts", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "availableBeans", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "totalAvailableBeans", - "type": "uint256" - } - ], - "internalType": "struct LibSiloHelpers.WithdrawalPlan", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "div", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "eq", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "depositId", - "type": "uint256" - } - ], - "name": "getAddressAndStem", - "outputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "int96", - "name": "stem", - "type": "int96" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "getBeanstalkPrice", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getHighestSeedToken", - "outputs": [ - { - "internalType": "address", - "name": "highestSeedToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "seedAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "beanAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "well", - "type": "address" - } - ], - "name": "getLPTokensToWithdrawForBeans", - "outputs": [ - { - "internalType": "uint256", - "name": "lpAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLowestSeedToken", - "outputs": [ - { - "internalType": "address", - "name": "lowestSeedToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "seedAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getSortedDeposits", - "outputs": [ - { - "internalType": "int96[]", - "name": "stems", - "type": "int96[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSortedWhitelistedTokensBySeeds", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "seeds", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getTokenIndex", - "outputs": [ - { - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - } - ], - "name": "getTokensAscendingPrice", - "outputs": [ - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256[]", - "name": "prices", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokensAscendingPrice", - "outputs": [ - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256[]", - "name": "prices", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "excludeBean", - "type": "bool" - } - ], - "name": "getTokensAscendingSeeds", - "outputs": [ - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256[]", - "name": "seeds", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokensAscendingSeeds", - "outputs": [ - { - "internalType": "uint8[]", - "name": "tokenIndices", - "type": "uint8[]" - }, - { - "internalType": "uint256[]", - "name": "seeds", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getWhitelistStatusAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "gt", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "gte", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "whitelistedOperators", - "type": "address[]" - } - ], - "name": "isOperatorWhitelisted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "lt", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "lte", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "mod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "mul", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "c", - "type": "uint256" - } - ], - "name": "mulDiv", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "neq", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "sub", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "publisher", - "type": "address" - }, - { - "internalType": "address", - "name": "tipAddress", - "type": "address" - }, - { - "internalType": "int256", - "name": "tipAmount", - "type": "int256" - }, - { - "internalType": "enum LibTransfer.From", - "name": "from", - "type": "uint8" - }, - { - "internalType": "enum LibTransfer.To", - "name": "to", - "type": "uint8" - } - ], - "name": "tip", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/datasources/contracts/upgradeable/beanstalk.js b/src/datasources/contracts/upgradeable/beanstalk.js index ea8c65e..2a66554 100644 --- a/src/datasources/contracts/upgradeable/beanstalk.js +++ b/src/datasources/contracts/upgradeable/beanstalk.js @@ -20,13 +20,13 @@ const mapping = [ { chain: 'base', start: 37196338, - end: 41037288, // TODO: PI14 block goes here + end: 41041175, address: '0xD1A0D188E861ed9d15773a2F3574a2e94134bA8f', abi: require('../../abi/beanstalk/Pinto-PI13.json') }, { chain: 'base', - start: 41037288, // TODO: PI14 block goes here + start: 41041175, end: 'latest', address: '0xD1A0D188E861ed9d15773a2F3574a2e94134bA8f', abi: require('../../abi/beanstalk/Pinto-PI14.json') diff --git a/test/tractor/convert.test.js b/test/tractor/convert.test.js index d94397d..3075c43 100644 --- a/test/tractor/convert.test.js +++ b/test/tractor/convert.test.js @@ -9,7 +9,7 @@ describe('TractorConvertUpService', () => { test('Creates additional order data for matching requisition', async () => { jest .spyOn(TractorConvertUpService, 'decodeBlueprintData') - .mockReturnValue({ args: { params: { opParams: { operatorTipAmount: 456n } } } }); + .mockReturnValue({ version: 'V0', calldata: { args: { params: { opParams: { operatorTipAmount: 456n } } } } }); jest.spyOn(ConvertUpOrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); const upsertSpy = jest.spyOn(TractorConvertUpService, 'updateOrders').mockImplementation(() => {}); diff --git a/test/tractor/sow.test.js b/test/tractor/sow.test.js index 8cdcc23..c21ca9d 100644 --- a/test/tractor/sow.test.js +++ b/test/tractor/sow.test.js @@ -12,7 +12,7 @@ describe('TractorSowService', () => { test('Creates additional order data for matching requisition', async () => { jest .spyOn(TractorSowService, 'decodeBlueprintData') - .mockReturnValue({ args: { params: { opParams: { operatorTipAmount: 456n } } } }); + .mockReturnValue({ version: 'V0', calldata: { args: { params: { opParams: { operatorTipAmount: 456n } } } } }); jest.spyOn(SowOrderDto, 'fromBlueprintCalldata').mockReturnValue('dto'); const upsertSpy = jest.spyOn(TractorSowService, 'updateOrders').mockImplementation(() => {}); From f9abf8f081efc47e55cd52ee1ff6cf3b157e6c8c Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Mon, 19 Jan 2026 22:20:35 -0500 Subject: [PATCH 19/22] Fix issue preventing looping task execution --- src/scheduled/cron-schedule.js | 22 +++++++++++++++++++--- src/scheduled/util/task-range.js | 1 - 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/scheduled/cron-schedule.js b/src/scheduled/cron-schedule.js index 456dee2..a2b0f2a 100644 --- a/src/scheduled/cron-schedule.js +++ b/src/scheduled/cron-schedule.js @@ -19,7 +19,14 @@ const ALL_JOBS = { // Updated less frequently because the underlying data is currently unused cron: '0 10 * * * *', function: async () => { - while ((await DepositsTask.queueExecution({ minIntervalMinutes: 55 })).canExecuteAgain) {} + let minIntervalMinutes = 55; + while (true) { + const { canExecuteAgain } = await DepositsTask.queueExecution({ minIntervalMinutes }); + if (!canExecuteAgain) { + break; + } + minIntervalMinutes = 0; + } } }, inflows: { @@ -27,7 +34,14 @@ const ALL_JOBS = { // Updated less frequently because its only used for snapshots (and the ws should invoke it at sunrise) cron: '0 10 * * * *', function: async () => { - while ((await InflowsTask.queueExecution({ minIntervalMinutes: 55 })).canExecuteAgain) {} + let minIntervalMinutes = 55; + while (true) { + const { canExecuteAgain } = await InflowsTask.queueExecution({ minIntervalMinutes }); + if (!canExecuteAgain) { + break; + } + minIntervalMinutes = 0; + } } }, tractor: { @@ -35,9 +49,10 @@ const ALL_JOBS = { cron: '0 */5 * * * *', function: async () => { const isInitialRun = TractorTask.getLastExecutionTime() === null; + let minIntervalMinutes = 4.5; while (true) { const { countEvents, queuedCallersBehind, canExecuteAgain } = await TractorTask.queueExecution({ - minIntervalMinutes: 4.5 + minIntervalMinutes }); if (!canExecuteAgain) { // queuedCallersBehind can be true if the task ran slightly before the websocket got the event, @@ -47,6 +62,7 @@ const ALL_JOBS = { } break; } + minIntervalMinutes = 0; } } }, diff --git a/src/scheduled/util/task-range.js b/src/scheduled/util/task-range.js index d5a7fe2..b38eec7 100644 --- a/src/scheduled/util/task-range.js +++ b/src/scheduled/util/task-range.js @@ -1,6 +1,5 @@ const { C } = require('../../constants/runtime-constants'); const retryable = require('../../utils/async/retryable'); -const ChainUtil = require('../../utils/chain'); const EnvUtil = require('../../utils/env'); class TaskRangeUtil { From 3c173d383bc529d2fc76972b18ca04fa4d4b2940 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:40:20 -0500 Subject: [PATCH 20/22] Convert up order parsing accepts version --- .../dto/tractor/ConvertUpOrderDto.js | 39 +++++++++++-------- src/service/tractor/blueprints/convert-up.js | 3 +- src/service/tractor/blueprints/sow.js | 1 - 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/repository/dto/tractor/ConvertUpOrderDto.js b/src/repository/dto/tractor/ConvertUpOrderDto.js index 425d213..78196ec 100644 --- a/src/repository/dto/tractor/ConvertUpOrderDto.js +++ b/src/repository/dto/tractor/ConvertUpOrderDto.js @@ -4,27 +4,32 @@ const { intToStalkMode } = require('../../postgres/models/types/types'); class ConvertUpOrderDto { constructor(type, d) { if (type === 'data') { - this.blueprintHash = d.blueprintHash; + const { blueprintHash, blueprintVersion, callArgs } = d; + this.blueprintHash = blueprintHash; + this.blueprintVersion = blueprintVersion; + + const convertUpParams = callArgs.params.convertUpParams; + this.lastExecutedTimestamp = new Date(0); - this.beansLeftToConvert = d.convertUpParams.totalBeanAmountToConvert; + this.beansLeftToConvert = convertUpParams.totalBeanAmountToConvert; this.orderComplete = false; this.amountFunded = 0n; this.cascadeAmountFunded = 0n; - this.sourceTokenIndices = Array.from(d.convertUpParams.sourceTokenIndices); - this.totalBeanAmountToConvert = d.convertUpParams.totalBeanAmountToConvert; - this.minBeansConvertPerExecution = d.convertUpParams.minBeansConvertPerExecution; - this.maxBeansConvertPerExecution = d.convertUpParams.maxBeansConvertPerExecution; - this.capAmountToBonusCapacity = d.convertUpParams.capAmountToBonusCapacity; - this.minTimeBetweenConverts = d.convertUpParams.minTimeBetweenConverts; - this.minConvertBonusCapacity = d.convertUpParams.minConvertBonusCapacity; - this.maxGrownStalkPerBdv = d.convertUpParams.maxGrownStalkPerBdv; - this.seedDifference = d.convertUpParams.seedDifference; - this.grownStalkPerBdvBonusBid = d.convertUpParams.grownStalkPerBdvBonusBid; - this.maxPriceToConvertUp = d.convertUpParams.maxPriceToConvertUp; - this.minPriceToConvertUp = d.convertUpParams.minPriceToConvertUp; - this.maxGrownStalkPerBdvPenalty = d.convertUpParams.maxGrownStalkPerBdvPenalty; - this.slippageRatio = d.convertUpParams.slippageRatio; - this.lowStalkDeposits = intToStalkMode(Number(d.convertUpParams.lowStalkDeposits)); + this.sourceTokenIndices = Array.from(convertUpParams.sourceTokenIndices); + this.totalBeanAmountToConvert = convertUpParams.totalBeanAmountToConvert; + this.minBeansConvertPerExecution = convertUpParams.minBeansConvertPerExecution; + this.maxBeansConvertPerExecution = convertUpParams.maxBeansConvertPerExecution; + this.capAmountToBonusCapacity = convertUpParams.capAmountToBonusCapacity; + this.minTimeBetweenConverts = convertUpParams.minTimeBetweenConverts; + this.minConvertBonusCapacity = convertUpParams.minConvertBonusCapacity; + this.maxGrownStalkPerBdv = convertUpParams.maxGrownStalkPerBdv; + this.seedDifference = convertUpParams.seedDifference; + this.grownStalkPerBdvBonusBid = convertUpParams.grownStalkPerBdvBonusBid; + this.maxPriceToConvertUp = convertUpParams.maxPriceToConvertUp; + this.minPriceToConvertUp = convertUpParams.minPriceToConvertUp; + this.maxGrownStalkPerBdvPenalty = convertUpParams.maxGrownStalkPerBdvPenalty; + this.slippageRatio = convertUpParams.slippageRatio; + this.lowStalkDeposits = intToStalkMode(Number(convertUpParams.lowStalkDeposits)); } else if (type === 'db') { this.blueprintHash = d.blueprintHash; this.lastExecutedTimestamp = new Date(d.lastExecutedTimestamp * 1000); diff --git a/src/service/tractor/blueprints/convert-up.js b/src/service/tractor/blueprints/convert-up.js index be3a34b..22d2323 100644 --- a/src/service/tractor/blueprints/convert-up.js +++ b/src/service/tractor/blueprints/convert-up.js @@ -180,7 +180,8 @@ class TractorConvertUpService extends Blueprint { const dto = ConvertUpOrderDto.fromBlueprintCalldata({ blueprintHash: orderDto.blueprintHash, - convertUpParams: calldata.args.params.convertUpParams + blueprintVersion: version, + callArgs: calldata.args }); // Insert entity diff --git a/src/service/tractor/blueprints/sow.js b/src/service/tractor/blueprints/sow.js index 866da99..165e593 100644 --- a/src/service/tractor/blueprints/sow.js +++ b/src/service/tractor/blueprints/sow.js @@ -1,6 +1,5 @@ const { C } = require('../../../constants/runtime-constants'); const Contracts = require('../../../datasources/contracts/contracts'); -const Interfaces = require('../../../datasources/contracts/interfaces'); const InputError = require('../../../error/input-error'); const SowExecutionDto = require('../../../repository/dto/tractor/SowExecutionDto'); const SowOrderDto = require('../../../repository/dto/tractor/SowOrderDto'); From 29142eecd69fe2a918076abf8c6cd05d5fbececb Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:54:10 -0500 Subject: [PATCH 21/22] Add missing column to indexing tables --- .../seeders/20000519185341-indexing-tables.js | 14 +++++++++++++- src/service/tractor/blueprints/convert-up.js | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/repository/postgres/seeders/20000519185341-indexing-tables.js b/src/repository/postgres/seeders/20000519185341-indexing-tables.js index 7356eac..a1f7394 100644 --- a/src/repository/postgres/seeders/20000519185341-indexing-tables.js +++ b/src/repository/postgres/seeders/20000519185341-indexing-tables.js @@ -20,7 +20,13 @@ const { TRACTOR_SNAPSHOT_CONVERT_UP_TABLE } = require('../../../constants/tables'); const EnvUtil = require('../../../utils/env'); -const { TractorOrderType, ApyInitType, StalkMode, TractorOrderSowBlueprintVersion } = require('../models/types/types'); +const { + TractorOrderType, + ApyInitType, + StalkMode, + TractorOrderSowBlueprintVersion, + TractorOrderConvertUpBlueprintVersion +} = require('../models/types/types'); const { timestamps, bigintNumericColumn, largeBigintTextColumn } = require('../util/sequelize-util'); /** @type {import('sequelize-cli').Migration} */ @@ -542,6 +548,12 @@ module.exports = { values: Object.values(StalkMode), allowNull: false }, + blueprintVersion: { + type: Sequelize.ENUM, + values: Object.values(TractorOrderConvertUpBlueprintVersion), + allowNull: false, + defaultValue: 'V0' + }, ...timestamps(Sequelize) }); } diff --git a/src/service/tractor/blueprints/convert-up.js b/src/service/tractor/blueprints/convert-up.js index 22d2323..092fb24 100644 --- a/src/service/tractor/blueprints/convert-up.js +++ b/src/service/tractor/blueprints/convert-up.js @@ -8,7 +8,6 @@ const BlueprintConstants = require('./blueprint-constants'); const InputError = require('../../../error/input-error'); const Contracts = require('../../../datasources/contracts/contracts'); const { C } = require('../../../constants/runtime-constants'); -const Interfaces = require('../../../datasources/contracts/interfaces'); const ConvertUpOrderDto = require('../../../repository/dto/tractor/ConvertUpOrderDto'); const Concurrent = require('../../../utils/async/concurrent'); const BlockUtil = require('../../../utils/block'); From b87eda95ae34003234101f8e44f8e039ba2ec4e3 Mon Sep 17 00:00:00 2001 From: PintoPirate <189064953+PintoPirate@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:44:32 -0500 Subject: [PATCH 22/22] update api doc with new enum --- docs/all.yaml | 61 ++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/docs/all.yaml b/docs/all.yaml index ce72e84..df992a6 100644 --- a/docs/all.yaml +++ b/docs/all.yaml @@ -1023,7 +1023,8 @@ paths: type: string description: Type of the tractor order enum: - - SOW_V0 + - SOW + - CONVERT_UP - KNOWN - UNKNOWN blueprintHash: @@ -1086,7 +1087,7 @@ paths: orderType: type: string description: Type of the order - example: "SOW_V0" + example: "SOW" publisher: type: string description: Address of the publisher @@ -1323,8 +1324,8 @@ paths: type: string description: Type of the tractor order enum: - - SOW_V0 - - CONVERT_UP_V0 + - SOW + - CONVERT_UP betweenTimes: type: array description: Date range for snapshot time filtering @@ -1377,37 +1378,37 @@ paths: description: Season number of this snapshot totalPintoSown: type: string - description: (SOW_V0) Cumulative amount of Pinto sown at snapshot time + description: (SOW) Cumulative amount of Pinto sown at snapshot time totalPodsMinted: type: string - description: (SOW_V0) Cumulative number of pods minted at snapshot time + description: (SOW) Cumulative number of pods minted at snapshot time totalCascadeFundedBelowTemp: type: string - description: (SOW_V0) Total funded amount that can be executed at the current temperature + description: (SOW) Total funded amount that can be executed at the current temperature totalCascadeFundedAnyTemp: type: string - description: (SOW_V0) Total funded amount that can be executed at any temperature + description: (SOW) Total funded amount that can be executed at any temperature totalBeansConverted: type: string - description: (CONVERT_UP_V0) Cumulative amount of Beans converted at snapshot time + description: (CONVERT_UP) Cumulative amount of Beans converted at snapshot time totalGsBonusStalk: type: string - description: (CONVERT_UP_V0) Total Grown Stalk bonus received from conversions + description: (CONVERT_UP) Total Grown Stalk bonus received from conversions totalGsBonusBdv: type: string - description: (CONVERT_UP_V0) Total BDV associated with Grown Stalk bonuses + description: (CONVERT_UP) Total BDV associated with Grown Stalk bonuses totalGsPenaltyStalk: type: string - description: (CONVERT_UP_V0) Total Grown Stalk penalty from conversions + description: (CONVERT_UP) Total Grown Stalk penalty from conversions totalGsPenaltyBdv: type: string - description: (CONVERT_UP_V0) Total BDV associated with Grown Stalk penalties + description: (CONVERT_UP) Total BDV associated with Grown Stalk penalties totalCascadeFunded: type: string - description: (CONVERT_UP_V0) Total amount funded in cascade + description: (CONVERT_UP) Total amount funded in cascade totalCascadeFundedExecutable: type: string - description: (CONVERT_UP_V0) Total funded amount that is currently executable + description: (CONVERT_UP) Total funded amount that is currently executable totalTipsPaid: type: string description: Cumulative tips paid to this order type at snapshot time @@ -1463,8 +1464,8 @@ paths: items: type: string enum: - - SOW_V0 - - CONVERT_UP_V0 + - SOW + - CONVERT_UP betweenTimes: type: array description: Date range for snapshot time filtering @@ -1520,37 +1521,37 @@ paths: description: Season number of this snapshot totalPintoSown: type: string - description: (SOW_V0) Cumulative amount of Pinto sown at snapshot time + description: (SOW) Cumulative amount of Pinto sown at snapshot time totalPodsMinted: type: string - description: (SOW_V0) Cumulative number of pods minted at snapshot time + description: (SOW) Cumulative number of pods minted at snapshot time totalCascadeFundedBelowTemp: type: string - description: (SOW_V0) Total funded amount that can be executed at the current temperature + description: (SOW) Total funded amount that can be executed at the current temperature totalCascadeFundedAnyTemp: type: string - description: (SOW_V0) Total funded amount that can be executed at any temperature + description: (SOW) Total funded amount that can be executed at any temperature totalBeansConverted: type: string - description: (CONVERT_UP_V0) Cumulative amount of Beans converted at snapshot time + description: (CONVERT_UP) Cumulative amount of Beans converted at snapshot time totalGsBonusStalk: type: string - description: (CONVERT_UP_V0) Total Grown Stalk bonus received from conversions + description: (CONVERT_UP) Total Grown Stalk bonus received from conversions totalGsBonusBdv: type: string - description: (CONVERT_UP_V0) Total BDV associated with Grown Stalk bonuses + description: (CONVERT_UP) Total BDV associated with Grown Stalk bonuses totalGsPenaltyStalk: type: string - description: (CONVERT_UP_V0) Total Grown Stalk penalty from conversions + description: (CONVERT_UP) Total Grown Stalk penalty from conversions totalGsPenaltyBdv: type: string - description: (CONVERT_UP_V0) Total BDV associated with Grown Stalk penalties + description: (CONVERT_UP) Total BDV associated with Grown Stalk penalties totalCascadeFunded: type: string - description: (CONVERT_UP_V0) Total amount funded in cascade + description: (CONVERT_UP) Total amount funded in cascade totalCascadeFundedExecutable: type: string - description: (CONVERT_UP_V0) Total funded amount that is currently executable + description: (CONVERT_UP) Total funded amount that is currently executable totalTipsPaid: type: string description: Cumulative tips paid to this order type at snapshot time @@ -1566,7 +1567,7 @@ paths: example: lastUpdated: 29374836 snapshots: - SOW_V0: + SOW: - id: 172 snapshotTimestamp: "2025-04-23T23:00:01.000Z" snapshotBlock: 29329927 @@ -1579,7 +1580,7 @@ paths: currentMaxTip: "910000" totalExecutions: 71 uniquePublishers: 4 - CONVERT_UP_V0: + CONVERT_UP: - snapshotTimestamp: "2025-11-06T09:00:01.000Z" snapshotBlock: 37815127 season: 8426