diff --git a/Forc.lock b/Forc.lock index b5cdbf67..4ac189a6 100644 --- a/Forc.lock +++ b/Forc.lock @@ -1,6 +1,14 @@ +[[package]] +name = "change_market_owner" +source = "member" +dependencies = [ + "market_abi", + "std", +] + [[package]] name = "core" -source = "path+from-root-F64B6E1A883A7E7B" +source = "path+from-root-6A8836696D55BC6E" [[package]] name = "market" @@ -63,7 +71,7 @@ dependencies = ["std"] [[package]] name = "std" -source = "git+https://github.com/fuellabs/sway?tag=v0.66.4#d7dd104dac4394aa7af56f05b720c975744db853" +source = "git+https://github.com/fuellabs/sway?tag=v0.66.5#94a066652468b4afa3bd396dacef482ed590976b" dependencies = ["core"] [[package]] @@ -81,3 +89,27 @@ dependencies = [ "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.6.1#792639cdf391565e6e6a02482ea8a46d9604a6f5", "std", ] + +[[package]] +name = "update_collaterals" +source = "member" +dependencies = [ + "market_abi", + "std", +] + +[[package]] +name = "update_market" +source = "member" +dependencies = [ + "market_abi", + "std", +] + +[[package]] +name = "withdraw_reserves" +source = "member" +dependencies = [ + "market_abi", + "std", +] diff --git a/Forc.toml b/Forc.toml index c7e84b10..055dec9e 100644 --- a/Forc.toml +++ b/Forc.toml @@ -7,4 +7,8 @@ members = [ "contracts/src-20", "contracts/token", "contracts/pyth-mock", + "scripts/bako/withdraw_reserves", + "scripts/bako/update_collaterals", + "scripts/bako/update_market", + "scripts/bako/change_market_owner", ] diff --git a/contracts/market/Forc.toml b/contracts/market/Forc.toml index c66c7a6f..4417125e 100644 --- a/contracts/market/Forc.toml +++ b/contracts/market/Forc.toml @@ -6,7 +6,7 @@ name = "market" # address will be the addres of the proxy contract [proxy] enabled = true -address = "0x657ab45a6eb98a4893a99fd104347179151e8b3828fd8f2a108cc09770d1ebae" +# address = "0x657ab45a6eb98a4893a99fd104347179151e8b3828fd8f2a108cc09770d1ebae" [dependencies] market_abi = { path = "../../abis/market_abi" } diff --git a/fuel-toolchain.toml b/fuel-toolchain.toml index f6ef15e3..a02eac8a 100644 --- a/fuel-toolchain.toml +++ b/fuel-toolchain.toml @@ -2,5 +2,5 @@ channel = "latest-aarch64-apple-darwin" [components] -forc = "0.66.4" -fuel-core = "0.40.0" +forc = "0.66.5" +fuel-core = "0.40.2" diff --git a/package.json b/package.json index 6131e585..86334ac5 100644 --- a/package.json +++ b/package.json @@ -21,20 +21,20 @@ }, "pnpm": { "overrides": { - "fuels": "0.96.1", - "@fuel-ts/contract": "0.96.1", - "@fuel-ts/account": "0.96.1", - "@fuel-ts/abi-coder": "0.96.1", - "@fuel-ts/address": "0.96.1", - "@fuel-ts/crypto": "0.96.1", - "@fuel-ts/errors": "0.96.1", - "@fuel-ts/hasher": "0.96.1", - "@fuel-ts/interfaces": "0.96.1", - "@fuel-ts/math": "0.96.1", - "@fuel-ts/transactions": "0.96.1", - "@fuel-ts/utils": "0.96.1", - "@fuel-ts/versions": "0.96.1", - "@fuel-ts/program": "0.96.1" + "fuels": "0.97.1", + "@fuel-ts/contract": "0.97.1", + "@fuel-ts/account": "0.97.1", + "@fuel-ts/abi-coder": "0.97.1", + "@fuel-ts/address": "0.97.1", + "@fuel-ts/crypto": "0.97.1", + "@fuel-ts/errors": "0.97.1", + "@fuel-ts/hasher": "0.97.1", + "@fuel-ts/interfaces": "0.97.1", + "@fuel-ts/math": "0.97.1", + "@fuel-ts/transactions": "0.97.1", + "@fuel-ts/utils": "0.97.1", + "@fuel-ts/versions": "0.97.1", + "@fuel-ts/program": "0.97.1" } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b555e2f..0143f369 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,20 +5,20 @@ settings: excludeLinksFromLockfile: false overrides: - fuels: 0.96.1 - '@fuel-ts/contract': 0.96.1 - '@fuel-ts/account': 0.96.1 - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/address': 0.96.1 - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuel-ts/versions': 0.96.1 - '@fuel-ts/program': 0.96.1 + fuels: 0.97.1 + '@fuel-ts/contract': 0.97.1 + '@fuel-ts/account': 0.97.1 + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/address': 0.97.1 + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuel-ts/versions': 0.97.1 + '@fuel-ts/program': 0.97.1 importers: @@ -37,14 +37,14 @@ importers: apps/frontend: dependencies: '@fuel-ts/contract': - specifier: 0.96.1 - version: 0.96.1(encoding@0.1.13) + specifier: 0.97.1 + version: 0.97.1(encoding@0.1.13) '@fuels/connectors': specifier: 0.36.0 - version: 0.36.0(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(@wagmi/connectors@5.1.14(@types/react@18.3.12)(@wagmi/core@2.13.4(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.27.3)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))(bufferutil@4.0.8)(encoding@0.1.13)(fuels@0.96.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) + version: 0.36.0(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(@wagmi/connectors@5.1.14(@types/react@18.3.12)(@wagmi/core@2.13.4(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.27.3)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))(bufferutil@4.0.8)(encoding@0.1.13)(fuels@0.97.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) '@fuels/react': specifier: 0.35.1 - version: 0.35.1(@tanstack/react-query@5.61.0(react@18.3.1))(@types/react-dom@18.3.1)(@types/react@18.3.12)(fuels@0.96.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 0.35.1(@tanstack/react-query@5.61.0(react@18.3.1))(@types/react-dom@18.3.1)(@types/react@18.3.12)(fuels@0.97.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@pythnetwork/hermes-client': specifier: ^1.2.0 version: 1.2.0(axios@1.7.4) @@ -106,8 +106,8 @@ importers: specifier: ^0.1.13 version: 0.1.13 fuels: - specifier: 0.96.1 - version: 0.96.1(encoding@0.1.13) + specifier: 0.97.1 + version: 0.97.1(encoding@0.1.13) lucide-react: specifier: ^0.460.0 version: 0.460.0(react@18.3.1) @@ -246,8 +246,8 @@ importers: specifier: ^1.11.13 version: 1.11.13 fuels: - specifier: 0.96.1 - version: 0.96.1(encoding@0.1.13) + specifier: 0.97.1 + version: 0.97.1(encoding@0.1.13) zod: specifier: ^3.23.8 version: 3.23.8 @@ -259,6 +259,19 @@ importers: specifier: ^5.6.3 version: 5.6.3 + scripts/bako: + dependencies: + bakosafe: + specifier: 0.0.94-beta + version: 0.0.94-beta(fuels@0.97.1(encoding@0.1.13)) + fuels: + specifier: 0.97.1 + version: 0.97.1(encoding@0.1.13) + devDependencies: + tsx: + specifier: 4.19.2 + version: 4.19.2 + packages: '@0no-co/graphql.web@1.0.11': @@ -1918,86 +1931,90 @@ packages: '@floating-ui/utils@0.2.8': resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==} - '@fuel-ts/abi-coder@0.96.1': - resolution: {integrity: sha512-czJxFPirhSO6ayshu9Cr5AmED/IprQ8h1igwlcSHFr5jR+l46bLdlsXsWiUwe7vyvZCpOnxkN/XZYkmQyNxKNg==} + '@fuel-ts/abi-coder@0.97.1': + resolution: {integrity: sha512-ZuBnx8hJi3BDs12tlnBrvF/G9ciHncIkekMjJYWUkM745fKCQfhud5d6RiP9PyqugKY3luXgF2uNBZshXLHN5w==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/abi-typegen@0.96.1': - resolution: {integrity: sha512-vRJnAQ9sxkKuUQ2fkxntPm/679grxgwSf54O7vgDeXuXqQx/4XeylpExjH0/nZzEM5al+muw4rg9WwmKulkcZA==} + '@fuel-ts/abi-typegen@0.97.1': + resolution: {integrity: sha512-aNW/WbWXTQfJYZn6BN4Hw2X77somkWZN6DlM9KbsLpzpx0tQU/FHtM+6LGQdiuWzzMzyehGNZv/M6hjuZ/jlUg==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} hasBin: true - '@fuel-ts/account@0.96.1': - resolution: {integrity: sha512-i9InTebg3/buKXNJZpKBhxGMBC3MKpk905Uiv2CvTmldyPVgnZV/jY/b63jlfdEWyP5yVkr5/tzo7QaPKpfnMA==} + '@fuel-ts/account@0.97.1': + resolution: {integrity: sha512-aOvLQ0oppuRug7P25o6GkcXjy0+l3quWQWruQGYEUW9PYg7LvRx4PGvGmcEObC8JeOHJ76U1DVPz3wzNqYVqPA==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/address@0.96.1': - resolution: {integrity: sha512-PCuC8oojoWLhh0+boitaP90/Z3iSfEXZR8v1JCEfoLZIkvCq6EGKtiY0KvcNkPozHOHmmT34w/1CS6qHOoCBNA==} + '@fuel-ts/address@0.97.1': + resolution: {integrity: sha512-QjDexGzawpDXsDqhMYE8jGzWlz9nvzJavxe3ItEdHLySEIDB30hWOabwQkeBf1urDUs3YjdnNK3GSjk6bWIhrw==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/contract@0.96.1': - resolution: {integrity: sha512-shwNMHFZ7vr5QJsfVQ6aLd1ms88f3ZagrsNLqNz1Txhz/5KVgYyJaxfp7tUc4WZFpR67+W1zeIqx8ZNHVhck3g==} + '@fuel-ts/contract@0.97.1': + resolution: {integrity: sha512-3oxE/ybqWEfY0P/JCqGlXBYCKHmDPJNk0ArtTDRe6tPHM2UyuNCj8RXxQUGSNh6HTGsIWKwIA0udmpLNZSd1ag==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/crypto@0.96.1': - resolution: {integrity: sha512-OrAZPZtm8HQouzip621/ci47PeTS06QegGdz7MeN6wK4yeCbJmlRQ1WE9S3iclb3p+VLF0RtbecEbHQfsNgsnA==} + '@fuel-ts/crypto@0.97.1': + resolution: {integrity: sha512-AWnjVzLdK03R+Zb/qDMMwPMkDIBj191Vm3H1zAxGM8hUEP3wH8FUQ3383pkvA9MgJZ/zgiOjQ43gGCnra0IP/Q==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/errors@0.96.1': - resolution: {integrity: sha512-Xtso5v4a3UUvnMaOSDhMRlkb9LxLyCyC/1/RY7fZZ035ttscy6dNMuiD/iSptJ5pHklJ5R4rCPdOL5EKpgOaMA==} + '@fuel-ts/errors@0.97.1': + resolution: {integrity: sha512-8eO4EV7k1Y4SsVRLjClTqCyxKB47psIo+qyVk6XObGMiOswjAjzapSdQfwZSlo59BGns3aNAA34V2SJiTu1fwg==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/hasher@0.96.1': - resolution: {integrity: sha512-7z4cah+5TOcCBA2Wgvje1L7wVTahiFLb9IUpRXRMVGXwaqsbV/wUNcyuc1mhPh/JKLgcOe+OqsrpcYD2dg2rpg==} + '@fuel-ts/hasher@0.97.1': + resolution: {integrity: sha512-8f3qU7SZs3GceYYyB6bIzLH4pnkfYg8PTnhjqfXYEJw6QXpGKXDIE1pMyGz/FceShrFNP1ixNO7v9tcrdZG5og==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/interfaces@0.96.1': - resolution: {integrity: sha512-mZ3sDHJml5AtLRSmGWo5rbU9//3oKDhAeiFealajcPaVztAAnaKnA5a19dd4ITbjZb2q3e2lQ7zX8iAXgHUwYA==} + '@fuel-ts/interfaces@0.97.1': + resolution: {integrity: sha512-zjzQPIUT9ZKSakwSbJ4A6mvnG+jrZgabTLCTL+7jiFQT5lBb60lhSdMXW5vbzVhWWvcTxaU8rej9CrjuXXCwkQ==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/math@0.96.1': - resolution: {integrity: sha512-AZUChguQmE1ILYbcc6SOTjFJIUkGzD3Z6yHgvO4tszn2QS/jVTSAZKVx653J5u9m/Xn/WthwR35l1GbwXMwB4g==} + '@fuel-ts/math@0.97.1': + resolution: {integrity: sha512-tnql9KnXrhRV7p/HUx52EUTO7VsR0m590b621HyB+6jonhLWWBu7yla538g40Zt+Oto/0yYnAyGMN93joIqcbQ==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/merkle@0.96.1': - resolution: {integrity: sha512-7cLbxYG5berKSK+wPKrkbB9dZ6akOm7C1Ij4iwYXOxQWlmXY62mjSY5Tl1PPyDBSdRqBtqxW0xYUGIzZl2A/3g==} + '@fuel-ts/merkle@0.97.1': + resolution: {integrity: sha512-rqiSSb4AUk9yf8FCzVniW5fiCkBliRnQDsLi+A8/E5gFuCc/bTN7Ws1J5ERTOMSly7ScCRRTUgYt+BSf7wzl2A==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/program@0.96.1': - resolution: {integrity: sha512-tA2YvcIdlDQLKeOOfoTyfI3LRQZiqsHi5rFaGbOsjEQvyNQBdXa92vMMFW0dFNWXqOPLjTmYNWqp0xsMuikbsA==} + '@fuel-ts/program@0.97.1': + resolution: {integrity: sha512-y1AT8H2jFVTnnfObQqtmb38xLpQn7KRZ7lsAUJZk1Pe2P61dolv6e0sGax7dOjC8uzOFq+ygwEhDZzXqZ1WJOQ==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/script@0.96.1': - resolution: {integrity: sha512-N/N3I3xjDI1+9XcCrYTWapF0iBbdvtBxUUUZxn5S5GuIXuTCK6UfQLrRciuCHK5QiHVwFmQjlki+ozJfI+4UbQ==} + '@fuel-ts/recipes@0.97.1': + resolution: {integrity: sha512-dQB29TZ4H1BOM+gfahojR5Vgcblj7HkaUrfFqhHZ4tImrwOVz/vb0cmz/8wSDT2bk017sDV1D59BB3BA752hUw==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/transactions@0.96.1': - resolution: {integrity: sha512-yPQBzMeFIzNBLUZigaf4q0hETO8AH8Evt6ZvpWrYhjYz2WfEpfNDpuhIHRwsMfJRbxz2vhQ51AzkRqpH0b2GMQ==} + '@fuel-ts/script@0.97.1': + resolution: {integrity: sha512-B86EBGNL8TL5TE8KmOcKb4LoA2v2XcQMsk0VEBuFTMyLLrOE+Yf96N509lsIhu2p1d/mBDbIf8yb/N1KZ7Zr6Q==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/utils@0.96.1': - resolution: {integrity: sha512-XXZNEUPf7qtKpVO3ak2CSroBYEKh1Gne1zlmVSNUoVPqQvglcu0I2pu/QmVnZBN4m3yVSyHUoWR2Kbo8/Dh7sA==} + '@fuel-ts/transactions@0.97.1': + resolution: {integrity: sha512-aehrq8clj3MBo+ssg9QEesrNdbzmxiWSo8YqWU/cf7D+331CjRo5PIht3evsp9rDWPFtK5h7e3NzJzaV2wopDA==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} - '@fuel-ts/versions@0.96.1': - resolution: {integrity: sha512-C//ZT7U68Gksz9PzUJVzdzUARK7mfXf3MsF5ZqZaMegkE2tCy+twjy8PBdeVserY0uX6mEHRJyZJwcspk34ixg==} + '@fuel-ts/utils@0.97.1': + resolution: {integrity: sha512-RTm55rmfY55DI8P8XOQq5sEvRfE5XT1K15lLzRjSNvEB6QxO6Mv2D7pSBOcmczZIdcajLvBII40tAaaGxY16ww==} + engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} + + '@fuel-ts/versions@0.97.1': + resolution: {integrity: sha512-rKHBLolZpsaTEFHMshDmMT8BxwQnukOHPCMbb91QXD9qBBbOffCyMIfkljY8teBtxcvgWkF9d96GO+V9UAaL6w==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} hasBin: true '@fuels/connectors@0.36.0': resolution: {integrity: sha512-6oWdItssawXNnWwsnb4LbmSxDLfvaCdw187gPKTPTGO59b7CIZKvdT19xOpOtgPgJ3LyKZn3VcrRcAZHlInaZg==} peerDependencies: - fuels: 0.96.1 + fuels: 0.97.1 '@fuels/react@0.35.1': resolution: {integrity: sha512-duFT5oh/vEIf0CJ16afIjIhvO7eCxaR3WapubLxA8YtS/czHNPkcURITH427T95ViJEGKPJVCYnWNkMSW4iA8g==} peerDependencies: '@tanstack/react-query': '>=5.0.0' - fuels: 0.96.1 + fuels: 0.97.1 react: '>=18.0.0' - '@fuels/vm-asm@0.58.0': - resolution: {integrity: sha512-tfarairW3IAtyoAIL3I5EJiUQzKAsY4J+eLgZg58B7+itDxqF+CUEpKanmiUnt1mBgry5GwtZsPIrUJ7OgTcDA==} + '@fuels/vm-asm@0.58.2': + resolution: {integrity: sha512-1/5azTzKJP508BXbZvM6Y0V5bCCX5JgEnd/8mXdBFmFvNLOhiYbwb25yk26auqOokfBXvthSkdkrvipEFft6jQ==} '@gql.tada/cli-utils@1.6.3': resolution: {integrity: sha512-jFFSY8OxYeBxdKi58UzeMXG1tdm4FVjXa8WHIi66Gzu9JWtCE6mqom3a8xkmSw+mVaybFW5EN2WXf1WztJVNyQ==} @@ -4658,6 +4675,11 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + bakosafe@0.0.94-beta: + resolution: {integrity: sha512-Sozdo2EJDIvsRtaMYhSzGJMOwWxgZFzYiu/OJ8ZkMzty5FlQ1i61neSYJMncWM/j+IF2/4sMGEM1jeDtp/1a3Q==} + peerDependencies: + fuels: 0.97.1 + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -5817,10 +5839,6 @@ packages: resolution: {integrity: sha512-FuoE1qtbJ4bBVvv94CC7s0oTnKUGvQs+Rjf1L2SJFfS+HTVVjhPFtehPdQ0JiGPqVNfSSZvL5yzHHQq2Z4WNhQ==} engines: {node: ^12.20 || >= 14.13} - extract-files@9.0.0: - resolution: {integrity: sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==} - engines: {node: ^10.17.0 || ^12.0.0 || >= 13.7.0} - eyes@0.1.8: resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} engines: {node: '> 0.1.90'} @@ -5978,10 +5996,6 @@ packages: resolution: {integrity: sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q==} engines: {node: '>= 0.12'} - form-data@3.0.1: - resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} - engines: {node: '>= 6'} - form-data@4.0.1: resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} @@ -6028,8 +6042,8 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - fuels@0.96.1: - resolution: {integrity: sha512-BquRIJ0qHNKwhqBTNa6X4aghqhCj1Qz0jM+P0bziXAEk7gVJJZWRz10jCcAgZVeEb4AMdZLDsnNzKJ51GH8IvQ==} + fuels@0.97.1: + resolution: {integrity: sha512-k+J2w7MU5XMEOoSz2O53TI1NPIblz0uwaZ9PHPpNlH1So2+i+ZCiy83wWNYWnJr/HTB+kbvVFXY21RR3on24Cw==} engines: {node: ^18.20.3 || ^20.0.0 || ^22.0.0} hasBin: true @@ -6165,11 +6179,6 @@ packages: peerDependencies: graphql: '*' - graphql-request@5.0.0: - resolution: {integrity: sha512-SpVEnIo2J5k2+Zf76cUkdvIRaq5FMZvGQYnA4lUWYbc99m+fHh4CZYRRO/Ff4tCLQ613fzCm3SiDT64ubW5Gyw==} - peerDependencies: - graphql: 14 - 16 - graphql-request@6.1.0: resolution: {integrity: sha512-p+XPfS4q7aIpKVcgmnZKhMNqhltk20hfXtkaIkTfjjmiKMJ5xrt5c743cL03y/K7y1rg3WrIC49xGiEQ4mxdNw==} peerDependencies: @@ -11922,22 +11931,22 @@ snapshots: '@floating-ui/utils@0.2.8': {} - '@fuel-ts/abi-coder@0.96.1': + '@fuel-ts/abi-coder@0.97.1': dependencies: - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/utils': 0.97.1 type-fest: 4.26.1 - '@fuel-ts/abi-typegen@0.96.1': + '@fuel-ts/abi-typegen@0.97.1': dependencies: - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuel-ts/versions': 0.96.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuel-ts/versions': 0.97.1 commander: 12.1.0 glob: 10.4.5 handlebars: 4.7.8 @@ -11945,142 +11954,155 @@ snapshots: ramda: 0.30.1 rimraf: 5.0.10 - '@fuel-ts/account@0.96.1(encoding@0.1.13)': - dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/address': 0.96.1 - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/merkle': 0.96.1 - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuel-ts/versions': 0.96.1 - '@fuels/vm-asm': 0.58.0 + '@fuel-ts/account@0.97.1(encoding@0.1.13)': + dependencies: + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/address': 0.97.1 + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/merkle': 0.97.1 + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuel-ts/versions': 0.97.1 + '@fuels/vm-asm': 0.58.2 '@noble/curves': 1.6.0 events: 3.3.0 graphql: 16.9.0 - graphql-request: 5.0.0(encoding@0.1.13)(graphql@16.9.0) + graphql-request: 6.1.0(encoding@0.1.13)(graphql@16.9.0) graphql-tag: 2.12.6(graphql@16.9.0) ramda: 0.30.1 transitivePeerDependencies: - encoding - '@fuel-ts/address@0.96.1': + '@fuel-ts/address@0.97.1': dependencies: - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/utils': 0.97.1 '@noble/hashes': 1.5.0 bech32: 2.0.0 - '@fuel-ts/contract@0.96.1(encoding@0.1.13)': - dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/account': 0.96.1(encoding@0.1.13) - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/merkle': 0.96.1 - '@fuel-ts/program': 0.96.1(encoding@0.1.13) - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuel-ts/versions': 0.96.1 - '@fuels/vm-asm': 0.58.0 + '@fuel-ts/contract@0.97.1(encoding@0.1.13)': + dependencies: + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/account': 0.97.1(encoding@0.1.13) + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/merkle': 0.97.1 + '@fuel-ts/program': 0.97.1(encoding@0.1.13) + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuel-ts/versions': 0.97.1 + '@fuels/vm-asm': 0.58.2 ramda: 0.30.1 transitivePeerDependencies: - encoding - '@fuel-ts/crypto@0.96.1': + '@fuel-ts/crypto@0.97.1': dependencies: - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/utils': 0.97.1 '@noble/hashes': 1.5.0 - '@fuel-ts/errors@0.96.1': + '@fuel-ts/errors@0.97.1': dependencies: - '@fuel-ts/versions': 0.96.1 + '@fuel-ts/versions': 0.97.1 - '@fuel-ts/hasher@0.96.1': + '@fuel-ts/hasher@0.97.1': dependencies: - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/utils': 0.97.1 '@noble/hashes': 1.5.0 - '@fuel-ts/interfaces@0.96.1': {} + '@fuel-ts/interfaces@0.97.1': {} - '@fuel-ts/math@0.96.1': + '@fuel-ts/math@0.97.1': dependencies: - '@fuel-ts/errors': 0.96.1 + '@fuel-ts/errors': 0.97.1 '@types/bn.js': 5.1.6 bn.js: 5.2.1 - '@fuel-ts/merkle@0.96.1': + '@fuel-ts/merkle@0.97.1': dependencies: - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/math': 0.96.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/math': 0.97.1 - '@fuel-ts/program@0.96.1(encoding@0.1.13)': + '@fuel-ts/program@0.97.1(encoding@0.1.13)': dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/account': 0.96.1(encoding@0.1.13) - '@fuel-ts/address': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuels/vm-asm': 0.58.0 + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/account': 0.97.1(encoding@0.1.13) + '@fuel-ts/address': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuels/vm-asm': 0.58.2 ramda: 0.30.1 transitivePeerDependencies: - encoding - '@fuel-ts/script@0.96.1(encoding@0.1.13)': + '@fuel-ts/recipes@0.97.1(encoding@0.1.13)': dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/account': 0.96.1(encoding@0.1.13) - '@fuel-ts/address': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/program': 0.96.1(encoding@0.1.13) - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/abi-typegen': 0.97.1 + '@fuel-ts/account': 0.97.1(encoding@0.1.13) + '@fuel-ts/contract': 0.97.1(encoding@0.1.13) + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/program': 0.97.1(encoding@0.1.13) + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 transitivePeerDependencies: - encoding - '@fuel-ts/transactions@0.96.1': + '@fuel-ts/script@0.97.1(encoding@0.1.13)': dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/address': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/utils': 0.96.1 + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/account': 0.97.1(encoding@0.1.13) + '@fuel-ts/address': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/program': 0.97.1(encoding@0.1.13) + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + transitivePeerDependencies: + - encoding - '@fuel-ts/utils@0.96.1': + '@fuel-ts/transactions@0.97.1': dependencies: - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/versions': 0.96.1 + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/address': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/utils': 0.97.1 + + '@fuel-ts/utils@0.97.1': + dependencies: + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/versions': 0.97.1 fflate: 0.8.2 - '@fuel-ts/versions@0.96.1': + '@fuel-ts/versions@0.97.1': dependencies: chalk: 4.1.2 cli-table: 0.3.11 - '@fuels/connectors@0.36.0(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(@wagmi/connectors@5.1.14(@types/react@18.3.12)(@wagmi/core@2.13.4(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.27.3)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))(bufferutil@4.0.8)(encoding@0.1.13)(fuels@0.96.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)': + '@fuels/connectors@0.36.0(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(@wagmi/connectors@5.1.14(@types/react@18.3.12)(@wagmi/core@2.13.4(@tanstack/query-core@5.60.6)(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.27.3)(typescript@5.6.3)(utf-8-validate@5.0.10)(viem@2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))(bufferutil@4.0.8)(encoding@0.1.13)(fuels@0.97.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8)': dependencies: '@ethereumjs/util': 9.0.3 '@ethersproject/bytes': 5.7.0 @@ -12090,7 +12112,7 @@ snapshots: '@web3modal/scaffold': 5.0.0(@types/react@18.3.12)(react@18.3.1) '@web3modal/solana': 5.0.0(@types/react@18.3.12)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10) '@web3modal/wagmi': 5.0.0(m5tzegwttv7ye5y6v6enpuw3ni) - fuels: 0.96.1(encoding@0.1.13) + fuels: 0.97.1(encoding@0.1.13) rpc-websockets: 7.11.0 socket.io-client: 4.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) viem: 2.20.1(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.23.8) @@ -12122,19 +12144,19 @@ snapshots: - vue - zod - '@fuels/react@0.35.1(@tanstack/react-query@5.61.0(react@18.3.1))(@types/react-dom@18.3.1)(@types/react@18.3.12)(fuels@0.96.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@fuels/react@0.35.1(@tanstack/react-query@5.61.0(react@18.3.1))(@types/react-dom@18.3.1)(@types/react@18.3.12)(fuels@0.97.1(encoding@0.1.13))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@radix-ui/react-dialog': 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/react-query': 5.61.0(react@18.3.1) events: 3.3.0 - fuels: 0.96.1(encoding@0.1.13) + fuels: 0.97.1(encoding@0.1.13) react: 18.3.1 transitivePeerDependencies: - '@types/react' - '@types/react-dom' - react-dom - '@fuels/vm-asm@0.58.0': {} + '@fuels/vm-asm@0.58.2': {} '@gql.tada/cli-utils@1.6.3(@0no-co/graphqlsp@1.12.16(graphql@16.9.0)(typescript@5.6.3))(graphql@16.9.0)(typescript@5.6.3)': dependencies: @@ -13424,7 +13446,7 @@ snapshots: '@pythnetwork/pyth-fuel-js@1.0.7(encoding@0.1.13)': dependencies: - fuels: 0.96.1(encoding@0.1.13) + fuels: 0.97.1(encoding@0.1.13) transitivePeerDependencies: - encoding - supports-color @@ -14365,7 +14387,7 @@ snapshots: dependencies: '@aptos-labs/ts-sdk': 1.33.1 '@coral-xyz/borsh': 0.30.1(@solana/web3.js@1.91.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)) - '@fuel-ts/program': 0.96.1(encoding@0.1.13) + '@fuel-ts/program': 0.97.1(encoding@0.1.13) '@mysten/sui': 1.15.1(typescript@5.6.3) '@prettier/sync': 0.5.2(prettier@3.3.3) '@project-serum/anchor': 0.26.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) @@ -14384,7 +14406,7 @@ snapshots: chalk: 5.3.0 csv-parse: 5.5.6 ethers: '@sentio/ethers@6.13.1-patch.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)' - fuels: 0.96.1(encoding@0.1.13) + fuels: 0.97.1(encoding@0.1.13) graphql: 16.9.0 js-sha3: 0.9.3 lru-cache: 11.0.2 @@ -16702,6 +16724,15 @@ snapshots: transitivePeerDependencies: - supports-color + bakosafe@0.0.94-beta(fuels@0.97.1(encoding@0.1.13)): + dependencies: + '@noble/curves': 1.6.0 + axios: 1.7.4 + fuels: 0.97.1(encoding@0.1.13) + uuid: 9.0.1 + transitivePeerDependencies: + - debug + balanced-match@1.0.2: {} base-x@3.0.10: @@ -18032,8 +18063,6 @@ snapshots: extract-files@11.0.0: {} - extract-files@9.0.0: {} - eyes@0.1.8: {} fast-copy@3.0.2: {} @@ -18186,7 +18215,7 @@ snapshots: foreground-child@3.3.0: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 form-data@2.5.2: @@ -18196,12 +18225,6 @@ snapshots: mime-types: 2.1.35 safe-buffer: 5.2.1 - form-data@3.0.1: - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - form-data@4.0.1: dependencies: asynckit: 0.4.0 @@ -18255,24 +18278,25 @@ snapshots: fsevents@2.3.3: optional: true - fuels@0.96.1(encoding@0.1.13): - dependencies: - '@fuel-ts/abi-coder': 0.96.1 - '@fuel-ts/abi-typegen': 0.96.1 - '@fuel-ts/account': 0.96.1(encoding@0.1.13) - '@fuel-ts/address': 0.96.1 - '@fuel-ts/contract': 0.96.1(encoding@0.1.13) - '@fuel-ts/crypto': 0.96.1 - '@fuel-ts/errors': 0.96.1 - '@fuel-ts/hasher': 0.96.1 - '@fuel-ts/interfaces': 0.96.1 - '@fuel-ts/math': 0.96.1 - '@fuel-ts/merkle': 0.96.1 - '@fuel-ts/program': 0.96.1(encoding@0.1.13) - '@fuel-ts/script': 0.96.1(encoding@0.1.13) - '@fuel-ts/transactions': 0.96.1 - '@fuel-ts/utils': 0.96.1 - '@fuel-ts/versions': 0.96.1 + fuels@0.97.1(encoding@0.1.13): + dependencies: + '@fuel-ts/abi-coder': 0.97.1 + '@fuel-ts/abi-typegen': 0.97.1 + '@fuel-ts/account': 0.97.1(encoding@0.1.13) + '@fuel-ts/address': 0.97.1 + '@fuel-ts/contract': 0.97.1(encoding@0.1.13) + '@fuel-ts/crypto': 0.97.1 + '@fuel-ts/errors': 0.97.1 + '@fuel-ts/hasher': 0.97.1 + '@fuel-ts/interfaces': 0.97.1 + '@fuel-ts/math': 0.97.1 + '@fuel-ts/merkle': 0.97.1 + '@fuel-ts/program': 0.97.1(encoding@0.1.13) + '@fuel-ts/recipes': 0.97.1(encoding@0.1.13) + '@fuel-ts/script': 0.97.1(encoding@0.1.13) + '@fuel-ts/transactions': 0.97.1 + '@fuel-ts/utils': 0.97.1 + '@fuel-ts/versions': 0.97.1 bundle-require: 5.0.0(esbuild@0.24.0) chalk: 4.1.2 chokidar: 3.6.0 @@ -18490,16 +18514,6 @@ snapshots: dependencies: graphql: 16.9.0 - graphql-request@5.0.0(encoding@0.1.13)(graphql@16.9.0): - dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) - cross-fetch: 3.1.8(encoding@0.1.13) - extract-files: 9.0.0 - form-data: 3.0.1 - graphql: 16.9.0 - transitivePeerDependencies: - - encoding - graphql-request@6.1.0(encoding@0.1.13)(graphql@16.9.0): dependencies: '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a8ae6071..629726c7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,3 @@ packages: - "apps/**" + - "scripts/bako" diff --git a/scripts/Cargo.toml b/scripts/Cargo.toml index c872c9a6..178387bb 100644 --- a/scripts/Cargo.toml +++ b/scripts/Cargo.toml @@ -44,6 +44,14 @@ path = "src/deploy_pyth.rs" name = "fill_reserves" path = "src/fill_reserves.rs" +[[bin]] +name = "get_market_owner" +path = "src/get_market_owner.rs" + +[[bin]] +name = "get_proxy_owner" +path = "src/get_proxy_owner.rs" + [dependencies] fuels = { workspace = true } clap = { workspace = true } diff --git a/scripts/README.md b/scripts/README.md index e12ac7b3..efa30b12 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,7 +4,7 @@ This folder contains all scrips and necessary files for deployments of Swaylend If you are interested in testing on local devnet, checkout the `devnet` folder. -## Scripts +## Scripts for EOA Before we begin, you need to do a few things: @@ -61,6 +61,8 @@ cd ../contracts/market && /home/vid/Documents/Company/fuel/sway/target/debug/for This script will change proxy owner. +**Note:** Bako vaults are considered accounts, NOT contracts, so you should provider the argument as contract:0x0... + ```bash cargo run --bin change_proxy_owner -- --new-owner contract:0x546403add23accc66d96e853245db1398fb8d0ffbea184395f04ae3d26fd516f ``` @@ -69,6 +71,8 @@ cargo run --bin change_proxy_owner -- --new-owner contract:0x546403add23accc66d9 This script will change market owner. +**Note:** Bako vaults are considered accounts, NOT contracts, so you should provider the argument as contract:0x0... + ```bash cargo run --bin change_market_owner -- --new-owner address:0x2968d3dd71d8b517fdb57e837c419c58f7404744fb51c16e0e0a2dc18892b1f8 ``` @@ -120,3 +124,23 @@ This script will mint tokens provided in the config file (base asset and collate ```bash cargo run --bin mint_tokens -- --config-path ./configs/testnet_usdc_config.json --token-contract-id 0xb55fa4f5c9d10d64b272b046e133eac9beab496587e0ed02d5620a69b77b9028 --recipient contract:0x0e5e4311f2ab9bd5dc6ac5d39a363b1488eed59e178367d1702126948951245f --amount 10000000000 ``` + +## Bako multisig scripts + +For changing the ownership using `bakosafe-proxy-cli` see [their guide](https://github.com/Bako-Labs/bako-safe-proxy-cli/blob/main/.github/doc/dev-guide.md#how-to-secure-your-contracts-using-bako-vaults). + +### add_collateral_asset + +### pause_collateral_asset + +### resume_collateral_asset + +### update_collateral_asset + +### pause + +### set_pyth_contract_id + +### update_market_configuration + +### withdraw_reserves diff --git a/scripts/bako/change_market_owner/.gitignore b/scripts/bako/change_market_owner/.gitignore new file mode 100644 index 00000000..77d3844f --- /dev/null +++ b/scripts/bako/change_market_owner/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/scripts/bako/change_market_owner/Forc.lock b/scripts/bako/change_market_owner/Forc.lock new file mode 100644 index 00000000..73801038 --- /dev/null +++ b/scripts/bako/change_market_owner/Forc.lock @@ -0,0 +1,51 @@ +[[package]] +name = "change_market_owner" +source = "member" +dependencies = [ + "market_abi", + "std", +] + +[[package]] +name = "core" +source = "path+from-root-6A8836696D55BC6E" + +[[package]] +name = "market_abi" +source = "path+from-root-6D871E789488F811" +dependencies = [ + "pyth_interface", + "std", + "sway_libs", +] + +[[package]] +name = "pyth_interface" +source = "git+https://github.com/pyth-network/pyth-crosschain?rev#7de4ce3ec8defd97641c1d25302abe117bf5092b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae", + "std", +] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae" +dependencies = ["std"] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c" +dependencies = ["std"] + +[[package]] +name = "std" +source = "git+https://github.com/fuellabs/sway?tag=v0.66.5#94a066652468b4afa3bd396dacef482ed590976b" +dependencies = ["core"] + +[[package]] +name = "sway_libs" +source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.24.0#e19f96f85ae12426d20adc176b70aa38fd9a2a5b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c", + "std", +] diff --git a/scripts/bako/change_market_owner/Forc.toml b/scripts/bako/change_market_owner/Forc.toml new file mode 100644 index 00000000..1e22ea6a --- /dev/null +++ b/scripts/bako/change_market_owner/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Urban Vidovič"] +entry = "main.sw" +license = "Apache-2.0" +name = "change_market_owner" + +[dependencies] +market_abi = { path = "../../../abis/market_abi" } diff --git a/scripts/bako/change_market_owner/src/main.sw b/scripts/bako/change_market_owner/src/main.sw new file mode 100644 index 00000000..482dfe83 --- /dev/null +++ b/scripts/bako/change_market_owner/src/main.sw @@ -0,0 +1,13 @@ +script; + +use market_abi::Market; + +configurable { + MARKET_CONTRACT_ID: ContractId = ContractId::zero(), +} + + +fn main(new_owner: Identity) { + let market = abi(Market, MARKET_CONTRACT_ID.into()); + market.transfer_ownership(new_owner); +} \ No newline at end of file diff --git a/scripts/bako/fuels.config.ts b/scripts/bako/fuels.config.ts new file mode 100644 index 00000000..8917c2a3 --- /dev/null +++ b/scripts/bako/fuels.config.ts @@ -0,0 +1,12 @@ +import { createConfig } from 'fuels'; + +export default createConfig({ + scripts: [ + './withdraw_reserves', + './update_collaterals', + './update_market', + './change_market_owner', + ], + contracts: ['../../contracts/market'], + output: './src/types', +}); diff --git a/scripts/bako/package.json b/scripts/bako/package.json new file mode 100644 index 00000000..afa0fe26 --- /dev/null +++ b/scripts/bako/package.json @@ -0,0 +1,23 @@ +{ + "name": "bako-scripts", + "version": "1.0.0", + "description": "Scripts for managing Bako multisig for Swaylend", + "scripts": { + "withdrawReserves": "tsx src/withdrawReserves.ts", + "updateCollateral": "tsx src/updateCollaterals.ts", + "updateMarket": "tsx src/updateMarket.ts", + "changeMarketOwner": "tsx src/changeMarketOwner.ts", + "postinstall": "pnpm build", + "build": "pnpm fuels build" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "bakosafe": "0.0.94-beta", + "fuels": "0.97.1" + }, + "devDependencies": { + "tsx": "4.19.2" + } +} diff --git a/scripts/bako/src/changeMarketOwner.ts b/scripts/bako/src/changeMarketOwner.ts new file mode 100644 index 00000000..e2ab76db --- /dev/null +++ b/scripts/bako/src/changeMarketOwner.ts @@ -0,0 +1,77 @@ +import { Wallet } from 'fuels'; +import { BakoProvider, Vault } from 'bakosafe'; +import { ChangeMarketOwner, Market } from './types'; + +require('dotenv').config({ path: '../.env' }); + +const PROVIDER_URL = + process.env.PROVIDER_URL || 'https://testnet.fuel.network/v1/graphql'; +const PRIVATE_KEY = process.env.SIGNING_KEY!; +const VAULT_ADDRESS = process.env.VAULT_ADDRESS!; +const PROXY_CONTRACT_ID = process.env.PROXY_CONTRACT_ID!; +// const TARGET_CONTRACT_ID = process.env.TARGET_CONTRACT_ID!; + +const main = async () => { + const args = process.argv.slice(2); + if (args.length < 1) { + console.error( + 'Please provide the new owner as a command-line argument: pnpm changeMarketOwner 0x00000...' + ); + process.exit(1); + } + const newOwner = process.argv[2]; + const wallet = Wallet.fromPrivateKey(PRIVATE_KEY); + + console.log('Sanity check'); + console.log('Provider URL:', PROVIDER_URL); + console.log('Vault Address:', VAULT_ADDRESS); + console.log('Proxy contract: ', PROXY_CONTRACT_ID); + // console.log('Target contract: ', TARGET_CONTRACT_ID); + + // Create a challenge to authenticate in BakoProvider + const challenge = await BakoProvider.setup({ + address: wallet.address.toB256(), + provider: PROVIDER_URL, + }); + const token = await wallet.signMessage(challenge); + const provider = await BakoProvider.authenticate(PROVIDER_URL, { + token, + challenge, + address: wallet.address.toB256(), + }); + + const vault = await Vault.fromAddress(VAULT_ADDRESS, provider); + + const script = new ChangeMarketOwner(vault); + const proxyId = { bits: PROXY_CONTRACT_ID }; + + const configurableConstants = { + MARKET_CONTRACT_ID: proxyId, + }; + + script.setConfigurableConstants(configurableConstants); + const newOwnerIdentity = { bits: newOwner }; + const newOwnerIdentityInput = { Address: newOwnerIdentity }; + const market = new Market(PROXY_CONTRACT_ID, provider); + + const currOwnerObj = (await market.functions.owner().get()).value; + const currOwner = currOwnerObj.Initialized?.Address?.bits; + if (currOwner === newOwner) { + console.log('The owner is the same'); + process.exit(0); + } + + console.log(`owner: ${currOwner} -> ${newOwner}`); + + const request = await script.functions + .main(newOwnerIdentityInput) + .addContracts([market]) + .getTransactionRequest(); + + const { hashTxId } = await vault.BakoTransfer(request, { + name: `New owner: ${newOwner}`, + }); + console.log('Transaction ID:', hashTxId); +}; + +main(); diff --git a/scripts/bako/src/updateCollaterals.ts b/scripts/bako/src/updateCollaterals.ts new file mode 100644 index 00000000..f778b35f --- /dev/null +++ b/scripts/bako/src/updateCollaterals.ts @@ -0,0 +1,141 @@ +import { Wallet } from 'fuels'; +import { BakoProvider, Vault } from 'bakosafe'; +import { Market, UpdateCollaterals } from './types'; +import dotenv from 'dotenv'; +import { readFileSync } from 'node:fs'; +import type { CollateralConfigurationInput } from './types/contracts/Market'; + +dotenv.config({ path: '../.env' }); +type CollateralAssetConfig = { + asset_id: string; + price_feed_id: string; + name: string; + symbol: string; + decimals: number; + borrow_collateral_factor: number; + liquidate_collateral_factor: number; + liquidation_penalty: number; + supply_cap: number; + is_active: boolean; +}; + +function castConfigInto( + asset: CollateralAssetConfig +): CollateralConfigurationInput { + return { + asset_id: { bits: asset.asset_id }, + price_feed_id: asset.price_feed_id, + decimals: asset.decimals, + borrow_collateral_factor: asset.borrow_collateral_factor.toString(), + liquidate_collateral_factor: asset.liquidate_collateral_factor.toString(), + liquidation_penalty: asset.liquidation_penalty.toString(), + supply_cap: asset.supply_cap.toString(), + paused: !asset.is_active, + }; +} + +const PROVIDER_URL = + process.env.PROVIDER_URL || 'https://testnet.fuel.network/v1/graphql'; +const PRIVATE_KEY = process.env.SIGNING_KEY!; +const VAULT_ADDRESS = process.env.VAULT_ADDRESS!; +const PROXY_CONTRACT_ID = process.env.PROXY_CONTRACT_ID!; +const TARGET_CONTRACT_ID = process.env.TARGET_CONTRACT_ID!; + +const main = async () => { + const configPath = process.argv[2]; + if (!configPath) { + console.error( + 'Please provide the config path as a command-line argument: pnpm updateCollateral ../config/testnet_usdc_config.json' + ); + process.exit(1); + } + + const wallet = Wallet.fromPrivateKey(PRIVATE_KEY); + const challenge = await BakoProvider.setup({ + address: wallet.address.toB256(), + provider: PROVIDER_URL, + }); + const token = await wallet.signMessage(challenge); + const provider = await BakoProvider.authenticate(PROVIDER_URL, { + token, + challenge, + address: wallet.address.toB256(), + }); + const market = new Market(PROXY_CONTRACT_ID, provider); + + const newCollateralConfig: CollateralAssetConfig[] = JSON.parse( + readFileSync(configPath, 'utf8') + ).collateral_assets; + + const currCollateralConfig = ( + await market.functions.get_collateral_configurations().get() + ).value; + + const collateralsToUpdate: CollateralConfigurationInput[] = []; + const collateralsToAdd: CollateralConfigurationInput[] = []; + for (const newAsset of newCollateralConfig) { + const currAsset = currCollateralConfig.find( + (asset) => asset.asset_id.bits === newAsset.asset_id + ); + const normalizedNewAsset = castConfigInto(newAsset); + + if (!currAsset) { + console.log( + `New asset will be added: ${newAsset.name} - ${normalizedNewAsset.asset_id.bits}` + ); + collateralsToAdd.push(normalizedNewAsset); + continue; + } + + const changes: string[] = []; + + for (const key in normalizedNewAsset) { + // biome-ignore lint/suspicious/noPrototypeBuiltins: need this here + if (currAsset.hasOwnProperty(key)) { + let newValue = normalizedNewAsset[key]; + let currValue = currAsset[key]; + + if (key === 'asset_id') { + newValue = normalizedNewAsset.asset_id.bits; + currValue = currAsset.asset_id.bits; + } + if (newValue.toString() !== currValue.toString()) { + changes.push(`${key}: ${currValue} -> ${newValue}`); + } + } + } + + if (changes.length > 0) { + console.log( + `New params for ${newAsset.name} - ${normalizedNewAsset.asset_id.bits}` + ); + changes.forEach((change) => console.log(change)); + collateralsToUpdate.push(normalizedNewAsset); + } + } + console.log('Changes below will be pushed'); + console.log(collateralsToUpdate); + + const vault = await Vault.fromAddress(VAULT_ADDRESS, provider); + const script = new UpdateCollaterals(vault); + const proxyId = { bits: PROXY_CONTRACT_ID }; + + const configurableConstants = { + MARKET_CONTRACT_ID: proxyId, + }; + + script.setConfigurableConstants(configurableConstants); + const request = await script.functions + .main(collateralsToUpdate, collateralsToAdd) + .addContracts([market]) + .getTransactionRequest(); + + const { hashTxId } = await vault.BakoTransfer(request, { + name: `Update ${collateralsToUpdate.length} collateral assets`, + }); + console.log('Transaction ID:', hashTxId); +}; + +main().catch((err) => { + console.error('Error updating collateral assets:', err); +}); diff --git a/scripts/bako/src/updateMarket.ts b/scripts/bako/src/updateMarket.ts new file mode 100644 index 00000000..a2e02d04 --- /dev/null +++ b/scripts/bako/src/updateMarket.ts @@ -0,0 +1,198 @@ +import { Wallet } from 'fuels'; +import { BakoProvider, Vault } from 'bakosafe'; +import { Market, UpdateMarket } from './types'; +import dotenv from 'dotenv'; +import { readFileSync } from 'node:fs'; +import type { MarketConfigurationInput } from './types/contracts/Market'; + +dotenv.config({ path: '../.env' }); + +type MarketConfigJSON = { + supply_paused: boolean; + withdraw_paused: boolean; + absorb_paused: boolean; + buy_paused: boolean; + supply_kink: string; + borrow_kink: string; + supply_per_second_interest_rate_slope_low: number; + supply_per_second_interest_rate_slope_high: number; + supply_per_second_interest_rate_base: number; + borrow_per_second_interest_rate_slope_low: number; + borrow_per_second_interest_rate_slope_high: number; + borrow_per_second_interest_rate_base: number; + store_front_price_factor: string; + base_tracking_index_scale: string; + base_tracking_supply_speed: string; + base_tracking_borrow_speed: string; + base_min_for_rewards: string; + base_borrow_min: string; + target_reserves: string; + pyth_contract_id: string; + base_asset: { + asset_id: string; + price_feed_id: string; + name: string; + symbol: string; + decimals: number; + }; + collateral_assets: CollateralAssetConfig[]; +}; + +type CollateralAssetConfig = { + asset_id: string; + price_feed_id: string; + name: string; + symbol: string; + decimals: number; + borrow_collateral_factor: number; + liquidate_collateral_factor: number; + liquidation_penalty: number; + supply_cap: number; + is_active: boolean; +}; + +function castConfigInto( + config: Omit +): MarketConfigurationInput { + return { + base_token: { bits: config.base_asset.asset_id }, + base_token_decimals: config.base_asset.decimals.toString(), + base_token_price_feed_id: config.base_asset.price_feed_id, + supply_kink: config.supply_kink.toString(), + borrow_kink: config.borrow_kink.toString(), + supply_per_second_interest_rate_slope_low: + config.supply_per_second_interest_rate_slope_low.toString(), + supply_per_second_interest_rate_slope_high: + config.supply_per_second_interest_rate_slope_high.toString(), + supply_per_second_interest_rate_base: + config.supply_per_second_interest_rate_base.toString(), + borrow_per_second_interest_rate_slope_low: + config.borrow_per_second_interest_rate_slope_low.toString(), + borrow_per_second_interest_rate_slope_high: + config.borrow_per_second_interest_rate_slope_high.toString(), + borrow_per_second_interest_rate_base: + config.borrow_per_second_interest_rate_base.toString(), + store_front_price_factor: config.store_front_price_factor.toString(), + base_tracking_index_scale: config.base_tracking_index_scale.toString(), + base_tracking_supply_speed: config.base_tracking_supply_speed.toString(), + base_tracking_borrow_speed: config.base_tracking_borrow_speed.toString(), + base_min_for_rewards: config.base_min_for_rewards.toString(), + base_borrow_min: config.base_borrow_min.toString(), + target_reserves: config.target_reserves.toString(), + }; +} + +const PROVIDER_URL = + process.env.PROVIDER_URL || 'https://testnet.fuel.network/v1/graphql'; +const PRIVATE_KEY = process.env.SIGNING_KEY!; +const VAULT_ADDRESS = process.env.VAULT_ADDRESS!; +const PROXY_CONTRACT_ID = process.env.PROXY_CONTRACT_ID!; +const TARGET_CONTRACT_ID = process.env.TARGET_CONTRACT_ID!; + +const main = async () => { + const configPath = process.argv[2]; + if (!configPath) { + console.error( + 'Please provide the config path as a command-line argument: pnpm updateMarket ../config/testnet_usdc_config.json' + ); + process.exit(1); + } + + const wallet = Wallet.fromPrivateKey(PRIVATE_KEY); + const challenge = await BakoProvider.setup({ + address: wallet.address.toB256(), + provider: PROVIDER_URL, + }); + const token = await wallet.signMessage(challenge); + const provider = await BakoProvider.authenticate(PROVIDER_URL, { + token, + challenge, + address: wallet.address.toB256(), + }); + const market = new Market(PROXY_CONTRACT_ID, provider); + + const newMarketConfigObj: MarketConfigJSON = JSON.parse( + readFileSync(configPath, 'utf8') + ); + const { collateral_assets, ...newMarketConfig } = newMarketConfigObj; + const normalizedNewMarketConfig = castConfigInto(newMarketConfig); + + const currMarketConfig = ( + await market.functions.get_market_configuration().get() + ).value; + + let modifyFields = 0; + for (const key of Object.keys(currMarketConfig)) { + const currVal = + key === 'base_token' + ? currMarketConfig[key].bits + : currMarketConfig[key].toString(); + const nextVal = + key === 'base_token' + ? normalizedNewMarketConfig[key].bits + : normalizedNewMarketConfig[key].toString(); + + if (currVal !== nextVal) { + console.log(`${key}: ${currVal} -> ${nextVal}`); + modifyFields++; + } + } + + const currPythId = await market.functions.get_pyth_contract_id().get(); + if (currPythId.value.bits !== newMarketConfig.pyth_contract_id) { + console.log( + `pyth_contract_id: ${currPythId.value.bits} -> ${newMarketConfig.pyth_contract_id}` + ); + modifyFields++; + } + + const currPauseConfig = await market.functions + .get_pause_configuration() + .get(); + const newPauseConfig = { + supply_paused: newMarketConfig.supply_paused, + withdraw_paused: newMarketConfig.withdraw_paused, + absorb_paused: newMarketConfig.absorb_paused, + buy_paused: newMarketConfig.buy_paused, + }; + for (const key of Object.keys(newPauseConfig)) { + if (currPauseConfig.value[key] !== newPauseConfig[key]) { + modifyFields++; + console.log( + `${key}: ${currPauseConfig.value[key]} -> ${newPauseConfig[key]}` + ); + } + } + + const vault = await Vault.fromAddress(VAULT_ADDRESS, provider); + const script = new UpdateMarket(vault); + const proxyId = { bits: PROXY_CONTRACT_ID }; + + const configurableConstants = { + MARKET_CONTRACT_ID: proxyId, + }; + + if (modifyFields === 0) { + console.log('Nothing to update'); + process.exit(0); + } + + script.setConfigurableConstants(configurableConstants); + const request = await script.functions + .main( + normalizedNewMarketConfig, + { bits: newMarketConfig.pyth_contract_id }, + newPauseConfig + ) + .addContracts([market]) + .getTransactionRequest(); + + const { hashTxId } = await vault.BakoTransfer(request, { + name: `Update ${modifyFields} market configs`, + }); + console.log('Transaction ID:', hashTxId); +}; + +main().catch((err) => { + console.error('Error updating market config:', err); +}); diff --git a/scripts/bako/src/withdrawReserves.ts b/scripts/bako/src/withdrawReserves.ts new file mode 100644 index 00000000..7bfcb2b1 --- /dev/null +++ b/scripts/bako/src/withdrawReserves.ts @@ -0,0 +1,69 @@ +import { Wallet } from 'fuels'; +import { BakoProvider, Vault } from 'bakosafe'; +import { WithdrawReserves, Market } from './types'; + +require('dotenv').config({ path: '../.env' }); + +const PROVIDER_URL = + process.env.PROVIDER_URL || 'https://testnet.fuel.network/v1/graphql'; +const PRIVATE_KEY = process.env.SIGNING_KEY!; +const VAULT_ADDRESS = process.env.VAULT_ADDRESS!; +const PROXY_CONTRACT_ID = process.env.PROXY_CONTRACT_ID!; +const TARGET_CONTRACT_ID = process.env.TARGET_CONTRACT_ID!; + +const main = async () => { + const args = process.argv.slice(2); + if (args.length < 1) { + console.error( + 'Please provide the amount as a command-line argument: pnpm withdrawReserves ' + ); + process.exit(1); + } + const amount = Number.parseInt(args[0], 10); + const wallet = Wallet.fromPrivateKey(PRIVATE_KEY); + + console.log('Sanity check'); + console.log('Provider URL:', PROVIDER_URL); + console.log('Vault Address:', VAULT_ADDRESS); + console.log('Proxy contract: ', PROXY_CONTRACT_ID); + console.log('Target contract: ', TARGET_CONTRACT_ID); + console.log(`Send ${amount} units of reserves to ${VAULT_ADDRESS}`); + + // Create a challenge to authenticate in BakoProvider + const challenge = await BakoProvider.setup({ + address: wallet.address.toB256(), + provider: PROVIDER_URL, + }); + const token = await wallet.signMessage(challenge); + const provider = await BakoProvider.authenticate(PROVIDER_URL, { + token, + challenge, + address: wallet.address.toB256(), + }); + + const vault = await Vault.fromAddress(VAULT_ADDRESS, provider); + + const script = new WithdrawReserves(vault); + const proxyId = { bits: PROXY_CONTRACT_ID }; + + const configurableConstants = { + MARKET_CONTRACT_ID: proxyId, + }; + + script.setConfigurableConstants(configurableConstants); + + const receiverId = { bits: VAULT_ADDRESS.toString() }; + const receiverIdentityInput = { Address: receiverId }; + const market = new Market(PROXY_CONTRACT_ID, provider); + const request = await script.functions + .main(receiverIdentityInput, amount) + .addContracts([market]) + .getTransactionRequest(); + + const { hashTxId } = await vault.BakoTransfer(request, { + name: `Withdraw Reserves: ${amount}`, + }); + console.log('Transaction ID:', hashTxId); +}; + +main(); diff --git a/scripts/bako/update_collaterals/.gitignore b/scripts/bako/update_collaterals/.gitignore new file mode 100644 index 00000000..77d3844f --- /dev/null +++ b/scripts/bako/update_collaterals/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/scripts/bako/update_collaterals/Forc.lock b/scripts/bako/update_collaterals/Forc.lock new file mode 100644 index 00000000..8c800a7e --- /dev/null +++ b/scripts/bako/update_collaterals/Forc.lock @@ -0,0 +1,51 @@ +[[package]] +name = "core" +source = "path+from-root-6A8836696D55BC6E" + +[[package]] +name = "market_abi" +source = "path+from-root-DB6CEE9608F8267A" +dependencies = [ + "pyth_interface", + "std", + "sway_libs", +] + +[[package]] +name = "pyth_interface" +source = "git+https://github.com/pyth-network/pyth-crosschain?rev#7de4ce3ec8defd97641c1d25302abe117bf5092b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae", + "std", +] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae" +dependencies = ["std"] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c" +dependencies = ["std"] + +[[package]] +name = "std" +source = "git+https://github.com/fuellabs/sway?tag=v0.66.5#94a066652468b4afa3bd396dacef482ed590976b" +dependencies = ["core"] + +[[package]] +name = "sway_libs" +source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.24.0#e19f96f85ae12426d20adc176b70aa38fd9a2a5b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c", + "std", +] + +[[package]] +name = "update_collaterals" +source = "member" +dependencies = [ + "market_abi", + "std", +] diff --git a/scripts/bako/update_collaterals/Forc.toml b/scripts/bako/update_collaterals/Forc.toml new file mode 100644 index 00000000..cfb698bb --- /dev/null +++ b/scripts/bako/update_collaterals/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Urban Vidovič"] +entry = "main.sw" +license = "Apache-2.0" +name = "update_collaterals" + +[dependencies] +market_abi = { path = "../../../abis/market_abi" } diff --git a/scripts/bako/update_collaterals/src/main.sw b/scripts/bako/update_collaterals/src/main.sw new file mode 100644 index 00000000..8f94ee26 --- /dev/null +++ b/scripts/bako/update_collaterals/src/main.sw @@ -0,0 +1,25 @@ +script; + +use market_abi::Market; +use market_abi::structs::CollateralConfiguration; + +configurable { + MARKET_CONTRACT_ID: ContractId = ContractId::zero(), +} + + +fn main(to_update: Vec, to_add: Vec) { + require( + !to_update.is_empty() || !to_add.is_empty(), + "At least one of the arguments must contain collateral assets." + ); + let market = abi(Market, MARKET_CONTRACT_ID.into()); + + for collateral in to_update.iter() { + market.update_collateral_asset(collateral.asset_id, collateral); + } + + for collateral in to_add.iter() { + market.add_collateral_asset(collateral); + } +} \ No newline at end of file diff --git a/scripts/bako/update_market/.gitignore b/scripts/bako/update_market/.gitignore new file mode 100644 index 00000000..77d3844f --- /dev/null +++ b/scripts/bako/update_market/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/scripts/bako/update_market/Forc.lock b/scripts/bako/update_market/Forc.lock new file mode 100644 index 00000000..fe45dc82 --- /dev/null +++ b/scripts/bako/update_market/Forc.lock @@ -0,0 +1,51 @@ +[[package]] +name = "core" +source = "path+from-root-6A8836696D55BC6E" + +[[package]] +name = "market_abi" +source = "path+from-root-3F142FBEEB8A255D" +dependencies = [ + "pyth_interface", + "std", + "sway_libs", +] + +[[package]] +name = "pyth_interface" +source = "git+https://github.com/pyth-network/pyth-crosschain?rev#7de4ce3ec8defd97641c1d25302abe117bf5092b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae", + "std", +] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.4#a001d3c248595112aae67e5633a06ef9bc0536ae" +dependencies = ["std"] + +[[package]] +name = "standards" +source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c" +dependencies = ["std"] + +[[package]] +name = "std" +source = "git+https://github.com/fuellabs/sway?tag=v0.66.5#94a066652468b4afa3bd396dacef482ed590976b" +dependencies = ["core"] + +[[package]] +name = "sway_libs" +source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.24.0#e19f96f85ae12426d20adc176b70aa38fd9a2a5b" +dependencies = [ + "standards git+https://github.com/FuelLabs/sway-standards?tag=v0.6.0#65e09f95ea8b9476b171a66c8a47108f352fa32c", + "std", +] + +[[package]] +name = "update_market" +source = "member" +dependencies = [ + "market_abi", + "std", +] diff --git a/scripts/bako/update_market/Forc.toml b/scripts/bako/update_market/Forc.toml new file mode 100644 index 00000000..dbce84b2 --- /dev/null +++ b/scripts/bako/update_market/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Urban Vidovič"] +entry = "main.sw" +license = "Apache-2.0" +name = "update_market" + +[dependencies] +market_abi = { path = "../../../abis/market_abi" } diff --git a/scripts/bako/update_market/src/main.sw b/scripts/bako/update_market/src/main.sw new file mode 100644 index 00000000..1468f0ac --- /dev/null +++ b/scripts/bako/update_market/src/main.sw @@ -0,0 +1,30 @@ +script; + +use market_abi::Market; +use market_abi::structs::{MarketConfiguration, PauseConfiguration}; + +configurable { + MARKET_CONTRACT_ID: ContractId = ContractId::zero(), +} + +fn main( + config: MarketConfiguration, + pyth_id: ContractId, + pause_config: PauseConfiguration, +) { + let market = abi(Market, MARKET_CONTRACT_ID.into()); + market.update_market_configuration(config); + let curr_pyth = market.get_pyth_contract_id(); + let curr_pause = market.get_pause_configuration(); + if curr_pyth != pyth_id { + market.set_pyth_contract_id(pyth_id); + } + + if curr_pause.absorb_paused != pause_config.absorb_paused + || curr_pause.buy_paused != pause_config.buy_paused + || curr_pause.supply_paused != pause_config.supply_paused + || curr_pause.withdraw_paused != pause_config.withdraw_paused + { + market.pause(pause_config); + } +} diff --git a/scripts/bako/withdraw_reserves/.gitignore b/scripts/bako/withdraw_reserves/.gitignore new file mode 100644 index 00000000..77d3844f --- /dev/null +++ b/scripts/bako/withdraw_reserves/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/scripts/bako/withdraw_reserves/Forc.toml b/scripts/bako/withdraw_reserves/Forc.toml new file mode 100644 index 00000000..ee84dcaf --- /dev/null +++ b/scripts/bako/withdraw_reserves/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Urban Vidovič"] +entry = "main.sw" +license = "Apache-2.0" +name = "withdraw_reserves" + +[dependencies] +market_abi = { path = "../../../abis/market_abi" } diff --git a/scripts/bako/withdraw_reserves/src/main.sw b/scripts/bako/withdraw_reserves/src/main.sw new file mode 100644 index 00000000..8701f80b --- /dev/null +++ b/scripts/bako/withdraw_reserves/src/main.sw @@ -0,0 +1,12 @@ +script; + +use market_abi::Market; + +configurable { + MARKET_CONTRACT_ID: ContractId = ContractId::zero(), +} + +fn main(to: Identity, amount: u64) { + let market = abi(Market, MARKET_CONTRACT_ID.into()); + market.withdraw_reserves(to, amount); +} diff --git a/scripts/configs/testnet_usdc_config.json b/scripts/configs/testnet_usdc_config.json index 2a2b8d13..acded532 100644 --- a/scripts/configs/testnet_usdc_config.json +++ b/scripts/configs/testnet_usdc_config.json @@ -48,7 +48,7 @@ "borrow_collateral_factor": 600000000000000000, "liquidate_collateral_factor": 750000000000000000, "liquidation_penalty": 850000000000000000, - "supply_cap": 300000000000, + "supply_cap": 500000000000, "is_active": true }, {