From a7aa6a6f19166f591fea95771e3ccb8ddc28cade Mon Sep 17 00:00:00 2001 From: anvospace <34095856+0xandee@users.noreply.github.com> Date: Sun, 28 Jan 2024 22:44:55 +0700 Subject: [PATCH 1/7] Update Semgrep configuration path --- .github/workflows/security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index e181125c..ad517588 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -15,7 +15,7 @@ jobs: run: | pip install semgrep==1.45.0 - name: Run Semgrep - run: semgrep --config https://github.com/avnu-labs/semgrep-cairo-rules/releases/download/v0.0.1/cairo-rules.yaml ./src > semgrep-output.txt + run: semgrep --config .github/semgrep-cairo-rules.yaml ./src > semgrep-output.txt - name: Save Semgrep Output as an Artifact uses: actions/upload-artifact@v3 with: From c55822058140c0679e19d5bc3201685e23bfde38 Mon Sep 17 00:00:00 2001 From: anvospace <34095856+0xandee@users.noreply.github.com> Date: Sun, 28 Jan 2024 22:49:55 +0700 Subject: [PATCH 2/7] Integrate old semgrep rules from Avnu --- .github/semgrep-cairo-rules.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/semgrep-cairo-rules.yaml b/.github/semgrep-cairo-rules.yaml index 5f5d1e32..c06f8bae 100644 --- a/.github/semgrep-cairo-rules.yaml +++ b/.github/semgrep-cairo-rules.yaml @@ -13,3 +13,34 @@ rules: - pattern-regex: $Y / $X - pattern-not-regex: error_utils::check_division_by_zero +- id: reentrancy + message: | + Value mutated after call to external contract + severity: ERROR + mode: join + join: + rules: + - id: external-contract-declaration + languages: [cairo] + pattern: | + trait $SOME_CONTRACT {} + - id: external-call + languages: [cairo] + pattern: | + $SOME_CONTRACT::transfer(...); + ...; + $X::write(...); + on: + - 'external-contract-declaration.$SOME_CONTRACT == external-call.$SOME_CONTRACT' + +- id: unsafe-arithmetic + message: Call unsafe math operators on $X + languages: [cairo] + severity: ERROR + pattern-either: + - pattern: $X + $Y + - pattern: $X += ... + - pattern: $X - $Y + - pattern: $X -= ... + - pattern: $X * $Y + - pattern: $X *= ... \ No newline at end of file From 050f7933d731679531c9aa7d50366539da992e9a Mon Sep 17 00:00:00 2001 From: anvospace <34095856+0xandee@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:31:41 +0700 Subject: [PATCH 3/7] Heheh --- .vscode/settings.json | 5 + .../mock-module.md | 1 + .../satoru.code-workspace | 11 + package.json | 30 +- .../deployApp.ts => actions/1.deployApp.ts} | 315 +++--- scripts/actions/2.grantRoles.ts | 144 +++ scripts/actions/3.createMarket.ts | 58 + scripts/actions/4.setDataStore.ts | 402 +++++++ scripts/actions/5.createDeposit.ts | 87 ++ scripts/actions/6.executeDeposit.ts | 94 ++ scripts/actions/7.createLongOrder.ts | 60 + scripts/actions/8.executeLongOrder.ts | 110 ++ .../actions/constants/contractAddresses.json | 29 + .../actions/constants/contractAddresses.ts | 37 + scripts/actions/constants/dataStoreKeys.ts | 342 ++++++ .../actions/constants/market-config-data.ts | 260 +++++ scripts/actions/constants/utils.ts | 26 + scripts/actions/createLongOrder.ts | 70 -- scripts/actions/createMarket.ts | 153 --- scripts/actions/createMarketAndDeposit.ts | 371 ------ scripts/actions/createSwapOrder.ts | 1 - scripts/actions/executeDeposit.ts | 79 -- scripts/actions/executeLongOrder.ts | 83 -- scripts/actions/executeSwapOrder.ts | 1 - scripts/actions/openAndCloseLong.ts | 1 - scripts/app/test2.ts | 74 -- scripts/app/testDeploy.ts | 35 - scripts/bank/deploy_StrictBank_contract.sh | 12 - scripts/bank/deploy_bank_contract.sh | 12 - scripts/config/deploy_config_contract.sh | 12 - scripts/config/deploy_timelock_contract.sh | 12 - scripts/data/deploy_data_store_contract.sh | 12 - .../deposit/deploy_deposit_vault_contract.sh | 12 - .../event/deploy_event_emitter_contract.sh | 12 - .../exchange/deploy_adl_handler_contract.sh | 12 - .../deploy_base_order_handler_contract.sh | 12 - .../deploy_deposit_handler_contract.sh | 12 - .../deploy_liquidation_handler_contract.sh | 12 - .../exchange/deploy_order_handler_contract.sh | 12 - .../deploy_withdrawal_handler_contract.sh | 12 - scripts/fee/deploy_fee_handler_contract.sh | 12 - .../market/deploy_market_factory_contract.sh | 12 - .../market/deploy_market_token_contract.sh | 12 - scripts/mock/deploy_governable_contract.sh | 12 - scripts/mock/deploy_referral_storage.sh | 12 - scripts/oracle/deploy_oracle_contract.sh | 12 - .../oracle/deploy_oracle_store_contract.sh | 12 - scripts/oracle/deploy_price_feed_contract.sh | 12 - scripts/order/deploy_order_vault_contract.sh | 12 - scripts/reader/deploy_reader_contract.sh | 12 - scripts/role/deploy_role_module_contract.sh | 12 - scripts/role/deploy_role_store_contract.sh | 10 - .../router/deploy_exchange_router_contract.sh | 12 - scripts/router/deploy_router_contract.sh | 12 - scripts/swap/deploy_swap_handler_contract.sh | 12 - .../deploy_withdrawal_vault_contract.sh | 12 - src/bank/bank.cairo | 2 +- src/deposit/execute_deposit_utils.cairo | 4 +- src/exchange/withdrawal_handler.cairo | 14 +- src/market/market_utils.cairo | 14 +- src/position/error.cairo | 1 + src/position/increase_position_utils.cairo | 12 +- src/router/exchange_router.cairo | 52 +- yarn-error.log | 1003 +++++++++++++++++ yarn.lock | 508 ++++++++- 65 files changed, 3388 insertions(+), 1447 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 book/src/smart-contracts-architecture/mock-module.md create mode 100644 book/src/smart-contracts-architecture/satoru.code-workspace rename scripts/{app/deployApp.ts => actions/1.deployApp.ts} (57%) create mode 100644 scripts/actions/2.grantRoles.ts create mode 100644 scripts/actions/3.createMarket.ts create mode 100644 scripts/actions/4.setDataStore.ts create mode 100644 scripts/actions/5.createDeposit.ts create mode 100644 scripts/actions/6.executeDeposit.ts create mode 100644 scripts/actions/7.createLongOrder.ts create mode 100644 scripts/actions/8.executeLongOrder.ts create mode 100644 scripts/actions/constants/contractAddresses.json create mode 100644 scripts/actions/constants/contractAddresses.ts create mode 100644 scripts/actions/constants/dataStoreKeys.ts create mode 100644 scripts/actions/constants/market-config-data.ts create mode 100644 scripts/actions/constants/utils.ts delete mode 100644 scripts/actions/createLongOrder.ts delete mode 100644 scripts/actions/createMarket.ts delete mode 100644 scripts/actions/createMarketAndDeposit.ts delete mode 100644 scripts/actions/executeDeposit.ts delete mode 100644 scripts/actions/executeLongOrder.ts delete mode 100644 scripts/app/test2.ts delete mode 100644 scripts/app/testDeploy.ts delete mode 100644 scripts/bank/deploy_StrictBank_contract.sh delete mode 100644 scripts/bank/deploy_bank_contract.sh delete mode 100644 scripts/config/deploy_config_contract.sh delete mode 100644 scripts/config/deploy_timelock_contract.sh delete mode 100755 scripts/data/deploy_data_store_contract.sh delete mode 100755 scripts/deposit/deploy_deposit_vault_contract.sh delete mode 100755 scripts/event/deploy_event_emitter_contract.sh delete mode 100644 scripts/exchange/deploy_adl_handler_contract.sh delete mode 100644 scripts/exchange/deploy_base_order_handler_contract.sh delete mode 100644 scripts/exchange/deploy_deposit_handler_contract.sh delete mode 100644 scripts/exchange/deploy_liquidation_handler_contract.sh delete mode 100644 scripts/exchange/deploy_order_handler_contract.sh delete mode 100644 scripts/exchange/deploy_withdrawal_handler_contract.sh delete mode 100755 scripts/fee/deploy_fee_handler_contract.sh delete mode 100644 scripts/market/deploy_market_factory_contract.sh delete mode 100644 scripts/market/deploy_market_token_contract.sh delete mode 100644 scripts/mock/deploy_governable_contract.sh delete mode 100644 scripts/mock/deploy_referral_storage.sh delete mode 100755 scripts/oracle/deploy_oracle_contract.sh delete mode 100755 scripts/oracle/deploy_oracle_store_contract.sh delete mode 100644 scripts/oracle/deploy_price_feed_contract.sh delete mode 100755 scripts/order/deploy_order_vault_contract.sh delete mode 100644 scripts/reader/deploy_reader_contract.sh delete mode 100644 scripts/role/deploy_role_module_contract.sh delete mode 100755 scripts/role/deploy_role_store_contract.sh delete mode 100644 scripts/router/deploy_exchange_router_contract.sh delete mode 100644 scripts/router/deploy_router_contract.sh delete mode 100644 scripts/swap/deploy_swap_handler_contract.sh delete mode 100644 scripts/withdrawal/deploy_withdrawal_vault_contract.sh create mode 100644 yarn-error.log diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a1e91367 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "oneshot" + ] +} \ No newline at end of file diff --git a/book/src/smart-contracts-architecture/mock-module.md b/book/src/smart-contracts-architecture/mock-module.md new file mode 100644 index 00000000..82fd5c52 --- /dev/null +++ b/book/src/smart-contracts-architecture/mock-module.md @@ -0,0 +1 @@ +# Mock Module diff --git a/book/src/smart-contracts-architecture/satoru.code-workspace b/book/src/smart-contracts-architecture/satoru.code-workspace new file mode 100644 index 00000000..31e14489 --- /dev/null +++ b/book/src/smart-contracts-architecture/satoru.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "../../.." + }, + { + "path": "../../../../simple-nft-example/packages/starknet-devnet-rs" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/package.json b/package.json index b2607303..7b6b6add 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,25 @@ { - "dependencies": { - "@types/node": "^20.11.16", - "dotenv": "^16.4.1", - "starknet": "^6.6.6", - "ts-node": "^10.9.2", - "typescript": "^5.3.3" - } + "scripts": { + "1": "ts-node ./scripts/actions/1.deployApp.ts", + "2": "ts-node ./scripts/actions/2.grantRoles.ts", + "3": "ts-node ./scripts/actions/3.createMarket.ts", + "4": "ts-node ./scripts/actions/4.setDataStore.ts", + "5": "ts-node ./scripts/actions/5.createDeposit.ts", + "6": "ts-node ./scripts/actions/6.executeDeposit.ts", + "7": "ts-node ./scripts/actions/7.createLongOrder.ts", + "8": "ts-node ./scripts/actions/8.executeLongOrder.ts", + "noDeployFlow": "ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && ts-node ./scripts/actions/4.setDataStore.ts && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts", + "fullDeployFlow": "ts-node ./scripts/actions/1.deployApp.ts && sleep 30 && ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && sleep 30 && ts-node ./scripts/actions/4.setDataStore.ts && sleep 30 && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && sleep 30 && ts-node ./scripts/actions/8.executeLongOrder.ts", + "customFlow": "ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts" + + }, + "dependencies": { + "@types/node": "^20.11.16", + "dotenv": "^16.4.5", + "ethers": "5", + "fs": "^0.0.1-security", + "starknet": "^6.11.0", + "ts-node": "^10.9.2", + "typescript": "^5.3.3" + } } diff --git a/scripts/app/deployApp.ts b/scripts/actions/1.deployApp.ts similarity index 57% rename from scripts/app/deployApp.ts rename to scripts/actions/1.deployApp.ts index dc360cc5..47485992 100644 --- a/scripts/app/deployApp.ts +++ b/scripts/actions/1.deployApp.ts @@ -1,6 +1,11 @@ -import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString } from "starknet" +import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec } from "starknet" import fs from 'fs' +import path from 'path'; import dotenv from 'dotenv' +import { sleep, tryInvoke } from "./constants/utils" + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); dotenv.config() @@ -12,11 +17,10 @@ async function deploy() { const privateKey0: string = process.env.ACCOUNT_PRIVATE as string const account0Address: string = process.env.ACCOUNT_PUBLIC as string const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Deploying with Account: " + account0Address) + console.log("Deploying contracts...") const resp = await provider.getSpecVersion(); - console.log('rpc version =', resp); - const compiledRoleStoreCasm = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.compiled_contract_class.json").toString( "ascii")) - const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) + const compiledRoleStoreCasm = json.parse(fs.readFileSync("./target/dev/satoru_RoleStore.compiled_contract_class.json").toString("ascii")) + const compiledRoleStoreSierra = json.parse(fs.readFileSync("./target/dev/satoru_RoleStore.contract_class.json").toString("ascii")) const roleStoreCallData: CallData = new CallData(compiledRoleStoreSierra.abi) const roleStoreConstructor: Calldata = roleStoreCallData.compile("constructor", { admin: account0.address }) const deployRoleStoreResponse = await account0.declareAndDeploy({ @@ -24,42 +28,49 @@ async function deploy() { casm: compiledRoleStoreCasm, constructorCalldata: roleStoreConstructor }) - console.log("RoleStore Deployed: " + deployRoleStoreResponse.deploy.contract_address) - const compiledDataStoreCasm = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.compiled_contract_class.json").toString( "ascii")) - const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) + contractAddresses.RoleStore = deployRoleStoreResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`RoleStore: ${deployRoleStoreResponse.deploy.contract_address}`); + + const compiledDataStoreCasm = json.parse(fs.readFileSync("./target/dev/satoru_DataStore.compiled_contract_class.json").toString("ascii")) + const compiledDataStoreSierra = json.parse(fs.readFileSync("./target/dev/satoru_DataStore.contract_class.json").toString("ascii")) const dataStoreCallData: CallData = new CallData(compiledDataStoreSierra.abi) const dataStoreConstructor: Calldata = dataStoreCallData.compile("constructor", { role_store_address: deployRoleStoreResponse.deploy.contract_address }) const deployDataStoreResponse = await account0.declareAndDeploy({ contract: compiledDataStoreSierra, - casm: compiledDataStoreCasm , + casm: compiledDataStoreCasm, constructorCalldata: dataStoreConstructor, }) - console.log("DataStore Deployed: " + deployDataStoreResponse.deploy.contract_address) - + + contractAddresses.DataStore = deployDataStoreResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`DataStore: "${deployDataStoreResponse.deploy.contract_address}",`) + const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, deployRoleStoreResponse.deploy.contract_address, provider) roleStoreContract.connect(account0); const roleCall = roleStoreContract.populate("grant_role", [account0.address, shortString.encodeShortString("CONTROLLER")]) const grant_role_tx = await roleStoreContract.grant_role(roleCall.calldata) await provider.waitForTransaction(grant_role_tx.transaction_hash) - console.log("Controller role granted.") - console.log("Deploying EventEmitter...") - const compiledEventEmitterCasm = json.parse(fs.readFileSync( "./target/dev/satoru_EventEmitter.compiled_contract_class.json").toString( "ascii")) - const compiledEventEmitterSierra = json.parse(fs.readFileSync( "./target/dev/satoru_EventEmitter.contract_class.json").toString( "ascii")) + const compiledEventEmitterCasm = json.parse(fs.readFileSync("./target/dev/satoru_EventEmitter.compiled_contract_class.json").toString("ascii")) + const compiledEventEmitterSierra = json.parse(fs.readFileSync("./target/dev/satoru_EventEmitter.contract_class.json").toString("ascii")) const eventEmitterCallData: CallData = new CallData(compiledEventEmitterSierra.abi) const eventEmitterConstructor: Calldata = eventEmitterCallData.compile("constructor", {}) const deployEventEmitterResponse = await account0.declareAndDeploy({ contract: compiledEventEmitterSierra, - casm: compiledEventEmitterCasm , + casm: compiledEventEmitterCasm, constructorCalldata: eventEmitterConstructor, }) - console.log("EventEmitter Deployed: " + deployEventEmitterResponse.deploy.contract_address) - const compiledOracleStoreCasm = json.parse(fs.readFileSync( "./target/dev/satoru_OracleStore.compiled_contract_class.json").toString( "ascii")) - const compiledOracleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OracleStore.contract_class.json").toString( "ascii")) + contractAddresses.EventEmitter = deployEventEmitterResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`EventEmitter: "${deployEventEmitterResponse.deploy.contract_address}",`) + + const compiledOracleStoreCasm = json.parse(fs.readFileSync("./target/dev/satoru_OracleStore.compiled_contract_class.json").toString("ascii")) + const compiledOracleStoreSierra = json.parse(fs.readFileSync("./target/dev/satoru_OracleStore.contract_class.json").toString("ascii")) const oracleStoreCallData: CallData = new CallData(compiledOracleStoreSierra.abi) const oracleStoreConstructor: Calldata = oracleStoreCallData.compile("constructor", { role_store_address: deployRoleStoreResponse.deploy.contract_address, @@ -67,13 +78,16 @@ async function deploy() { }) const deployOracleStoreResponse = await account0.declareAndDeploy({ contract: compiledOracleStoreSierra, - casm: compiledOracleStoreCasm , + casm: compiledOracleStoreCasm, constructorCalldata: oracleStoreConstructor, }) - console.log("OracleStore Deployed: " + deployOracleStoreResponse.deploy.contract_address) - const compiledOracleCasm = json.parse(fs.readFileSync( "./target/dev/satoru_Oracle.compiled_contract_class.json").toString( "ascii")) - const compiledOracleSierra = json.parse(fs.readFileSync( "./target/dev/satoru_Oracle.contract_class.json").toString( "ascii")) + contractAddresses.OracleStore = deployOracleStoreResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`OracleStore: "${deployOracleStoreResponse.deploy.contract_address}",`) + + const compiledOracleCasm = json.parse(fs.readFileSync("./target/dev/satoru_Oracle.compiled_contract_class.json").toString("ascii")) + const compiledOracleSierra = json.parse(fs.readFileSync("./target/dev/satoru_Oracle.contract_class.json").toString("ascii")) const oracleCallData: CallData = new CallData(compiledOracleSierra.abi) const oracleConstructor: Calldata = oracleCallData.compile("constructor", { role_store_address: deployRoleStoreResponse.deploy.contract_address, @@ -82,13 +96,16 @@ async function deploy() { }) const deployOracleResponse = await account0.declareAndDeploy({ contract: compiledOracleSierra, - casm: compiledOracleCasm , + casm: compiledOracleCasm, constructorCalldata: oracleConstructor, }) - console.log("Oracle Deployed: " + deployOracleResponse.deploy.contract_address) - const compiledOrderVaultCasm = json.parse(fs.readFileSync( "./target/dev/satoru_OrderVault.compiled_contract_class.json").toString( "ascii")) - const compiledOrderVaultSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderVault.contract_class.json").toString( "ascii")) + contractAddresses.Oracle = deployOracleResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`Oracle: "${deployOracleResponse.deploy.contract_address}",`) + + const compiledOrderVaultCasm = json.parse(fs.readFileSync("./target/dev/satoru_OrderVault.compiled_contract_class.json").toString("ascii")) + const compiledOrderVaultSierra = json.parse(fs.readFileSync("./target/dev/satoru_OrderVault.contract_class.json").toString("ascii")) const orderVaultCallData: CallData = new CallData(compiledOrderVaultSierra.abi) const orderVaultConstructor: Calldata = orderVaultCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -96,70 +113,87 @@ async function deploy() { }) const deployOrderVaultResponse = await account0.declareAndDeploy({ contract: compiledOrderVaultSierra, - casm: compiledOrderVaultCasm , + casm: compiledOrderVaultCasm, constructorCalldata: orderVaultConstructor, }) - console.log("OrderVault Deployed: " + deployOrderVaultResponse.deploy.contract_address) - const compiledSwapHandlerCasm = json.parse(fs.readFileSync( "./target/dev/satoru_SwapHandler.compiled_contract_class.json").toString( "ascii")) - const compiledSwapHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_SwapHandler.contract_class.json").toString( "ascii")) + contractAddresses.OrderVault = deployOrderVaultResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`OrderVault: "${deployOrderVaultResponse.deploy.contract_address}",`) + + const compiledSwapHandlerCasm = json.parse(fs.readFileSync("./target/dev/satoru_SwapHandler.compiled_contract_class.json").toString("ascii")) + const compiledSwapHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_SwapHandler.contract_class.json").toString("ascii")) const swapHandlerCallData: CallData = new CallData(compiledSwapHandlerSierra.abi) const swapHandlerConstructor: Calldata = swapHandlerCallData.compile("constructor", { role_store_address: deployRoleStoreResponse.deploy.contract_address, }) const deploySwapHandlerResponse = await account0.declareAndDeploy({ contract: compiledSwapHandlerSierra, - casm: compiledSwapHandlerCasm , + casm: compiledSwapHandlerCasm, constructorCalldata: swapHandlerConstructor, }) - console.log("SwapHandler Deployed: " + deploySwapHandlerResponse.deploy.contract_address) - const compiledReferralStorageCasm = json.parse(fs.readFileSync( "./target/dev/satoru_ReferralStorage.compiled_contract_class.json").toString( "ascii")) - const compiledReferralStorageSierra = json.parse(fs.readFileSync( "./target/dev/satoru_ReferralStorage.contract_class.json").toString( "ascii")) + contractAddresses.SwapHandler = deploySwapHandlerResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`SwapHandler: "${deploySwapHandlerResponse.deploy.contract_address}",`) + + const compiledReferralStorageCasm = json.parse(fs.readFileSync("./target/dev/satoru_ReferralStorage.compiled_contract_class.json").toString("ascii")) + const compiledReferralStorageSierra = json.parse(fs.readFileSync("./target/dev/satoru_ReferralStorage.contract_class.json").toString("ascii")) const referralStorageCallData: CallData = new CallData(compiledReferralStorageSierra.abi) const referralStorageConstructor: Calldata = referralStorageCallData.compile("constructor", { event_emitter_address: deployEventEmitterResponse.deploy.contract_address, }) const deployReferralStorageResponse = await account0.declareAndDeploy({ contract: compiledReferralStorageSierra, - casm: compiledReferralStorageCasm , + casm: compiledReferralStorageCasm, constructorCalldata: referralStorageConstructor, }) - console.log("ReferralStorage Deployed: " + deployReferralStorageResponse.deploy.contract_address) - const compiledIncreaseOrderUtilsCasm = json.parse(fs.readFileSync( "./target/dev/satoru_IncreaseOrderUtils.compiled_contract_class.json").toString( "ascii")) - const compiledIncreaseOrderUtilsSierra = json.parse(fs.readFileSync( "./target/dev/satoru_IncreaseOrderUtils.contract_class.json").toString( "ascii")) + contractAddresses.ReferralStorage = deployReferralStorageResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`ReferralStorage: "${deployReferralStorageResponse.deploy.contract_address}",`) + + const compiledIncreaseOrderUtilsCasm = json.parse(fs.readFileSync("./target/dev/satoru_IncreaseOrderUtils.compiled_contract_class.json").toString("ascii")) + const compiledIncreaseOrderUtilsSierra = json.parse(fs.readFileSync("./target/dev/satoru_IncreaseOrderUtils.contract_class.json").toString("ascii")) const increaseOrderUtilsCallData: CallData = new CallData(compiledIncreaseOrderUtilsSierra.abi) const increaseOrderUtilsConstructor: Calldata = increaseOrderUtilsCallData.compile("constructor", {}) const deployIncreaseOrderUtilsResponse = await account0.declareAndDeploy({ contract: compiledIncreaseOrderUtilsSierra, casm: compiledIncreaseOrderUtilsCasm, }) - console.log("IncreaseOrderUtils Deployed: " + deployIncreaseOrderUtilsResponse.deploy.contract_address) + contractAddresses.IncreaseOrderUtils = deployIncreaseOrderUtilsResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`IncreaseOrderUtils: "${deployIncreaseOrderUtilsResponse.deploy.contract_address}",`) - const compiledDecreaseOrderUtilsCasm = json.parse(fs.readFileSync( "./target/dev/satoru_DecreaseOrderUtils.compiled_contract_class.json").toString( "ascii")) - const compiledDecreaseOrderUtilsSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DecreaseOrderUtils.contract_class.json").toString( "ascii")) + const compiledDecreaseOrderUtilsCasm = json.parse(fs.readFileSync("./target/dev/satoru_DecreaseOrderUtils.compiled_contract_class.json").toString("ascii")) + const compiledDecreaseOrderUtilsSierra = json.parse(fs.readFileSync("./target/dev/satoru_DecreaseOrderUtils.contract_class.json").toString("ascii")) const decreaseOrderUtilsCallData: CallData = new CallData(compiledDecreaseOrderUtilsSierra.abi) const decreaseOrderUtilsConstructor: Calldata = decreaseOrderUtilsCallData.compile("constructor", {}) const deployDecreaseOrderUtilsResponse = await account0.declareAndDeploy({ contract: compiledDecreaseOrderUtilsSierra, casm: compiledDecreaseOrderUtilsCasm, }) - console.log("DecreaseOrderUtils Deployed: " + deployDecreaseOrderUtilsResponse.deploy.contract_address) - const compiledSwapOrderUtilsCasm = json.parse(fs.readFileSync( "./target/dev/satoru_SwapOrderUtils.compiled_contract_class.json").toString( "ascii")) - const compiledSwapOrderUtilsSierra = json.parse(fs.readFileSync( "./target/dev/satoru_SwapOrderUtils.contract_class.json").toString( "ascii")) + contractAddresses.DecreaseOrderUtils = deployDecreaseOrderUtilsResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`DecreaseOrderUtils: "${deployDecreaseOrderUtilsResponse.deploy.contract_address}",`) + + const compiledSwapOrderUtilsCasm = json.parse(fs.readFileSync("./target/dev/satoru_SwapOrderUtils.compiled_contract_class.json").toString("ascii")) + const compiledSwapOrderUtilsSierra = json.parse(fs.readFileSync("./target/dev/satoru_SwapOrderUtils.contract_class.json").toString("ascii")) const swapOrderUtilsCallData: CallData = new CallData(compiledSwapOrderUtilsSierra.abi) const swapOrderUtilsConstructor: Calldata = swapOrderUtilsCallData.compile("constructor", {}) const deploySwapOrderUtilsResponse = await account0.declareAndDeploy({ contract: compiledSwapOrderUtilsSierra, casm: compiledSwapOrderUtilsCasm, }) - console.log("SwapOrderUtils Deployed: " + deploySwapOrderUtilsResponse.deploy.contract_address) - const compiledOrderUtilsCasm = json.parse(fs.readFileSync( "./target/dev/satoru_OrderUtils.compiled_contract_class.json").toString( "ascii")) - const compiledOrderUtilsSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderUtils.contract_class.json").toString( "ascii")) + contractAddresses.SwapOrderUtils = deploySwapOrderUtilsResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`SwapOrderUtils: "${deploySwapOrderUtilsResponse.deploy.contract_address}",`) + + const compiledOrderUtilsCasm = json.parse(fs.readFileSync("./target/dev/satoru_OrderUtils.compiled_contract_class.json").toString("ascii")) + const compiledOrderUtilsSierra = json.parse(fs.readFileSync("./target/dev/satoru_OrderUtils.contract_class.json").toString("ascii")) const orderUtilsCallData: CallData = new CallData(compiledOrderUtilsSierra.abi) const orderUtilsConstructor: Calldata = orderUtilsCallData.compile("constructor", { increase_order_class_hash: deployIncreaseOrderUtilsResponse.deploy.classHash, @@ -171,10 +205,13 @@ async function deploy() { casm: compiledOrderUtilsCasm, constructorCalldata: orderUtilsConstructor }) - console.log("OrderUtils Deployed: " + deployOrderUtilsResponse.deploy.contract_address) - const compiledOrderHandlerCasm = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.compiled_contract_class.json").toString( "ascii")) - const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) + contractAddresses.OrderUtils = deployOrderUtilsResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`OrderUtils: "${deployOrderUtilsResponse.deploy.contract_address}",`) + + const compiledOrderHandlerCasm = json.parse(fs.readFileSync("./target/dev/satoru_OrderHandler.compiled_contract_class.json").toString("ascii")) + const compiledOrderHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_OrderHandler.contract_class.json").toString("ascii")) const orderHandlerCallData: CallData = new CallData(compiledOrderHandlerSierra.abi) const orderHandlerConstructor: Calldata = orderHandlerCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -191,13 +228,16 @@ async function deploy() { }) const deployOrderHandlerResponse = await account0.declareAndDeploy({ contract: compiledOrderHandlerSierra, - casm: compiledOrderHandlerCasm , + casm: compiledOrderHandlerCasm, constructorCalldata: orderHandlerConstructor, }) - console.log("OrderHandler Deployed: " + deployOrderHandlerResponse.deploy.contract_address) - const compiledDepositVaultCasm = json.parse(fs.readFileSync( "./target/dev/satoru_DepositVault.compiled_contract_class.json").toString( "ascii")) - const compiledDepositVaultSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DepositVault.contract_class.json").toString( "ascii")) + contractAddresses.OrderHandler = deployOrderHandlerResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`OrderHandler: "${deployOrderHandlerResponse.deploy.contract_address}",`) + + const compiledDepositVaultCasm = json.parse(fs.readFileSync("./target/dev/satoru_DepositVault.compiled_contract_class.json").toString("ascii")) + const compiledDepositVaultSierra = json.parse(fs.readFileSync("./target/dev/satoru_DepositVault.contract_class.json").toString("ascii")) const depositVaultCallData: CallData = new CallData(compiledDepositVaultSierra.abi) const depositVaultConstructor: Calldata = depositVaultCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -205,13 +245,16 @@ async function deploy() { }) const deployDepositVaultResponse = await account0.declareAndDeploy({ contract: compiledDepositVaultSierra, - casm: compiledDepositVaultCasm , + casm: compiledDepositVaultCasm, constructorCalldata: depositVaultConstructor, }) - console.log("DepositVault Deployed: " + deployDepositVaultResponse.deploy.contract_address) - const compiledDepositHandlerCasm = json.parse(fs.readFileSync( "./target/dev/satoru_DepositHandler.compiled_contract_class.json").toString( "ascii")) - const compiledDepositHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DepositHandler.contract_class.json").toString( "ascii")) + contractAddresses.DepositVault = deployDepositVaultResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`DepositVault: "${deployDepositVaultResponse.deploy.contract_address}",`) + + const compiledDepositHandlerCasm = json.parse(fs.readFileSync("./target/dev/satoru_DepositHandler.compiled_contract_class.json").toString("ascii")) + const compiledDepositHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_DepositHandler.contract_class.json").toString("ascii")) const depositHandlerCallData: CallData = new CallData(compiledDepositHandlerSierra.abi) const depositHandlerConstructor: Calldata = depositHandlerCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -222,13 +265,16 @@ async function deploy() { }) const deployDepositHandlerResponse = await account0.declareAndDeploy({ contract: compiledDepositHandlerSierra, - casm: compiledDepositHandlerCasm , + casm: compiledDepositHandlerCasm, constructorCalldata: depositHandlerConstructor, }) - console.log("DepositHandler Deployed: " + deployDepositHandlerResponse.deploy.contract_address) - const compiledWithdrawalVaultCasm = json.parse(fs.readFileSync( "./target/dev/satoru_WithdrawalVault.compiled_contract_class.json").toString( "ascii")) - const compiledWithdrawalVaultSierra = json.parse(fs.readFileSync( "./target/dev/satoru_WithdrawalVault.contract_class.json").toString( "ascii")) + contractAddresses.DepositHandler = deployDepositHandlerResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`DepositHandler: "${deployDepositHandlerResponse.deploy.contract_address}",`) + + const compiledWithdrawalVaultCasm = json.parse(fs.readFileSync("./target/dev/satoru_WithdrawalVault.compiled_contract_class.json").toString("ascii")) + const compiledWithdrawalVaultSierra = json.parse(fs.readFileSync("./target/dev/satoru_WithdrawalVault.contract_class.json").toString("ascii")) const withdrawalVaultCallData: CallData = new CallData(compiledWithdrawalVaultSierra.abi) const withdrawalVaultConstructor: Calldata = withdrawalVaultCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -236,13 +282,16 @@ async function deploy() { }) const deployWithdrawalVaultResponse = await account0.declareAndDeploy({ contract: compiledWithdrawalVaultSierra, - casm: compiledWithdrawalVaultCasm , + casm: compiledWithdrawalVaultCasm, constructorCalldata: withdrawalVaultConstructor, }) - console.log("WithdrawalVault Deployed: " + deployWithdrawalVaultResponse.deploy.contract_address) - const compiledWithdrawalHandlerCasm = json.parse(fs.readFileSync( "./target/dev/satoru_WithdrawalHandler.compiled_contract_class.json").toString( "ascii")) - const compiledWithdrawalHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_WithdrawalHandler.contract_class.json").toString( "ascii")) + contractAddresses.WithdrawalVault = deployWithdrawalVaultResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`WithdrawalVault: "${deployWithdrawalVaultResponse.deploy.contract_address}",`) + + const compiledWithdrawalHandlerCasm = json.parse(fs.readFileSync("./target/dev/satoru_WithdrawalHandler.compiled_contract_class.json").toString("ascii")) + const compiledWithdrawalHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_WithdrawalHandler.contract_class.json").toString("ascii")) const withdrawalHandlerCallData: CallData = new CallData(compiledWithdrawalHandlerSierra.abi) const withdrawalHandlerConstructor: Calldata = withdrawalHandlerCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -253,26 +302,27 @@ async function deploy() { }) const deployWithdrawalHandlerResponse = await account0.declareAndDeploy({ contract: compiledWithdrawalHandlerSierra, - casm: compiledWithdrawalHandlerCasm , + casm: compiledWithdrawalHandlerCasm, constructorCalldata: withdrawalHandlerConstructor, }) - console.log("WithdrawalHandler Deployed: " + deployWithdrawalHandlerResponse.deploy.contract_address) - const compiledMarketTokenCasm = json.parse(fs.readFileSync( "./target/dev/satoru_MarketToken.compiled_contract_class.json").toString( "ascii")) - const compiledMarketTokenSierra = json.parse(fs.readFileSync( "./target/dev/satoru_MarketToken.contract_class.json").toString( "ascii")) + contractAddresses.WithdrawalHandler = deployWithdrawalHandlerResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`WithdrawalHandler: "${deployWithdrawalHandlerResponse.deploy.contract_address}",`) + + const compiledMarketTokenCasm = json.parse(fs.readFileSync("./target/dev/satoru_MarketToken.compiled_contract_class.json").toString("ascii")) + const compiledMarketTokenSierra = json.parse(fs.readFileSync("./target/dev/satoru_MarketToken.contract_class.json").toString("ascii")) try { await account0.declare({ contract: compiledMarketTokenSierra, casm: compiledMarketTokenCasm }) - console.log("MarketToken Declared.") } catch (error) { - console.log("Already Declared.") } // const marketTokenClassHash = hash.computeCompiledClassHash(compiledMarketTokenCasm) - const compiledMarketFactoryCasm = json.parse(fs.readFileSync( "./target/dev/satoru_MarketFactory.compiled_contract_class.json").toString( "ascii")) - const compiledMarketFactorySierra = json.parse(fs.readFileSync( "./target/dev/satoru_MarketFactory.contract_class.json").toString( "ascii")) + const compiledMarketFactoryCasm = json.parse(fs.readFileSync("./target/dev/satoru_MarketFactory.compiled_contract_class.json").toString("ascii")) + const compiledMarketFactorySierra = json.parse(fs.readFileSync("./target/dev/satoru_MarketFactory.contract_class.json").toString("ascii")) const marketFactoryCallData: CallData = new CallData(compiledMarketFactorySierra.abi) const marketFactoryConstructor: Calldata = marketFactoryCallData.compile("constructor", { data_store_address: deployDataStoreResponse.deploy.contract_address, @@ -282,38 +332,46 @@ async function deploy() { }) const deployMarketFactoryResponse = await account0.declareAndDeploy({ contract: compiledMarketFactorySierra, - casm: compiledMarketFactoryCasm , + casm: compiledMarketFactoryCasm, constructorCalldata: marketFactoryConstructor, }) - console.log("MarketFactory Deployed: " + deployMarketFactoryResponse.deploy.contract_address) - const compiledReaderCasm = json.parse(fs.readFileSync( "./target/dev/satoru_Reader.compiled_contract_class.json").toString( "ascii")) - const compiledReaderSierra = json.parse(fs.readFileSync( "./target/dev/satoru_Reader.contract_class.json").toString( "ascii")) + contractAddresses.MarketFactory = deployMarketFactoryResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`MarketFactory: "${deployMarketFactoryResponse.deploy.contract_address}",`) + + const compiledReaderCasm = json.parse(fs.readFileSync("./target/dev/satoru_Reader.compiled_contract_class.json").toString("ascii")) + const compiledReaderSierra = json.parse(fs.readFileSync("./target/dev/satoru_Reader.contract_class.json").toString("ascii")) const readerCallData: CallData = new CallData(compiledReaderSierra.abi) const readerConstructor: Calldata = readerCallData.compile("constructor", {}) const deployReaderResponse = await account0.declareAndDeploy({ contract: compiledReaderSierra, - casm: compiledReaderCasm , + casm: compiledReaderCasm, constructorCalldata: readerConstructor, }) - console.log("Reader Deployed: " + deployReaderResponse.deploy.contract_address) - const compiledRouterCasm = json.parse(fs.readFileSync( "./target/dev/satoru_Router.compiled_contract_class.json").toString( "ascii")) - const compiledRouterSierra = json.parse(fs.readFileSync( "./target/dev/satoru_Router.contract_class.json").toString( "ascii")) + contractAddresses.Reader = deployReaderResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`Reader: "${deployReaderResponse.deploy.contract_address}",`) + + const compiledRouterCasm = json.parse(fs.readFileSync("./target/dev/satoru_Router.compiled_contract_class.json").toString("ascii")) + const compiledRouterSierra = json.parse(fs.readFileSync("./target/dev/satoru_Router.contract_class.json").toString("ascii")) const routerCallData: CallData = new CallData(compiledRouterSierra.abi) const routerConstructor: Calldata = routerCallData.compile("constructor", { role_store_address: deployRoleStoreResponse.deploy.contract_address, }) const deployRouterResponse = await account0.declareAndDeploy({ contract: compiledRouterSierra, - casm: compiledRouterCasm , + casm: compiledRouterCasm, constructorCalldata: routerConstructor, }) - console.log("Router Deployed: " + deployRouterResponse.deploy.contract_address) + contractAddresses.Router = deployRouterResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`Router: "${deployRouterResponse.deploy.contract_address}",`) - const compiledExchangeRouterCasm = json.parse(fs.readFileSync( "./target/dev/satoru_ExchangeRouter.compiled_contract_class.json").toString( "ascii")) - const compiledExchangeRouterSierra = json.parse(fs.readFileSync( "./target/dev/satoru_ExchangeRouter.contract_class.json").toString( "ascii")) + const compiledExchangeRouterCasm = json.parse(fs.readFileSync("./target/dev/satoru_ExchangeRouter.compiled_contract_class.json").toString("ascii")) + const compiledExchangeRouterSierra = json.parse(fs.readFileSync("./target/dev/satoru_ExchangeRouter.contract_class.json").toString("ascii")) const exchangeRouterCallData: CallData = new CallData(compiledExchangeRouterSierra.abi) const exchangeRouterConstructor: Calldata = exchangeRouterCallData.compile("constructor", { router_address: deployRouterResponse.deploy.contract_address, @@ -326,84 +384,15 @@ async function deploy() { }) const deployExchangeRouterResponse = await account0.declareAndDeploy({ contract: compiledExchangeRouterSierra, - casm: compiledExchangeRouterCasm , + casm: compiledExchangeRouterCasm, constructorCalldata: exchangeRouterConstructor, }) - console.log("ExchangeRouter Deployed: " + deployExchangeRouterResponse.deploy.contract_address) - - - const roleCall2 = roleStoreContract.populate("grant_role", [account0.address, shortString.encodeShortString("MARKET_KEEPER")]) - const roleCall3 = roleStoreContract.populate("grant_role", [account0.address, shortString.encodeShortString("ORDER_KEEPER")]) - const roleCall4 = roleStoreContract.populate("grant_role", - [ - deployOrderHandlerResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall5 = roleStoreContract.populate("grant_role", - [ - deployIncreaseOrderUtilsResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall6 = roleStoreContract.populate("grant_role", - [ - deployDecreaseOrderUtilsResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall7 = roleStoreContract.populate("grant_role", - [ - deploySwapOrderUtilsResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall8 = roleStoreContract.populate("grant_role", - [ - deployDepositHandlerResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall9 = roleStoreContract.populate("grant_role", - [ - deployWithdrawalHandlerResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall10 = roleStoreContract.populate("grant_role", - [ - deploySwapHandlerResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const roleCall11 = roleStoreContract.populate("grant_role", - [ - deployExchangeRouterResponse.deploy.contract_address, - shortString.encodeShortString("CONTROLLER") - ] - ) - const grant_role_tx2 = await roleStoreContract.grant_role(roleCall2.calldata) - await provider.waitForTransaction(grant_role_tx2.transaction_hash) - const grant_role_tx3 = await roleStoreContract.grant_role(roleCall3.calldata) - await provider.waitForTransaction(grant_role_tx3.transaction_hash) - const grant_role_tx4 = await roleStoreContract.grant_role(roleCall4.calldata) - await provider.waitForTransaction(grant_role_tx4.transaction_hash) - const grant_role_tx5 = await roleStoreContract.grant_role(roleCall5.calldata) - await provider.waitForTransaction(grant_role_tx5.transaction_hash) - const grant_role_tx6 = await roleStoreContract.grant_role(roleCall6.calldata) - await provider.waitForTransaction(grant_role_tx6.transaction_hash) - const grant_role_tx7 = await roleStoreContract.grant_role(roleCall7.calldata) - await provider.waitForTransaction(grant_role_tx7.transaction_hash) - const grant_role_tx8 = await roleStoreContract.grant_role(roleCall8.calldata) - await provider.waitForTransaction(grant_role_tx8.transaction_hash) - const grant_role_tx9 = await roleStoreContract.grant_role(roleCall9.calldata) - await provider.waitForTransaction(grant_role_tx9.transaction_hash) - const grant_role_tx10 = await roleStoreContract.grant_role(roleCall10.calldata) - await provider.waitForTransaction(grant_role_tx10.transaction_hash) - const grant_role_tx11 = await roleStoreContract.grant_role(roleCall11.calldata) - await provider.waitForTransaction(grant_role_tx11.transaction_hash) - - console.log("Roles granted.") + + contractAddresses.ExchangeRouter = deployExchangeRouterResponse.deploy.contract_address; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + // console.log(`ExchangeRouter: "${deployExchangeRouterResponse.deploy.contract_address}", \n`) + + console.log('Contracts Deployed ✅') } deploy() \ No newline at end of file diff --git a/scripts/actions/2.grantRoles.ts b/scripts/actions/2.grantRoles.ts new file mode 100644 index 00000000..f071b7d2 --- /dev/null +++ b/scripts/actions/2.grantRoles.ts @@ -0,0 +1,144 @@ +import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec } from "starknet" +import fs from 'fs' +import path from 'path'; +import dotenv from 'dotenv' +import { sleep, tryInvoke } from "./constants/utils" + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); + +dotenv.config() + +async function deploy() { + const providerUrl = process.env.PROVIDER_URL + const provider = new RpcProvider({ nodeUrl: providerUrl! }) + // connect your account. To adapt to your own account : + const privateKey0: string = process.env.ACCOUNT_PRIVATE as string + const account0Address: string = process.env.ACCOUNT_PUBLIC as string + const tedAccountAddress: string = '0x48b7fa2d7519ead304594b4006cbaaeaf3d3ce34b7c7e88a20939d953679521'; + const account0 = new Account(provider, account0Address!, privateKey0!) + + const grantRoleCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = [ + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [account0Address, shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [account0Address, shortString.encodeShortString("MARKET_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [account0Address, shortString.encodeShortString("ORDER_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [account0Address, shortString.encodeShortString("FROZEN_ORDER_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [tedAccountAddress, shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [tedAccountAddress, shortString.encodeShortString("MARKET_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [tedAccountAddress, shortString.encodeShortString("ORDER_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [tedAccountAddress, shortString.encodeShortString("FROZEN_ORDER_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['MarketFactory'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['MarketFactory'], shortString.encodeShortString("MARKET_KEEPER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['OrderHandler'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['IncreaseOrderUtils'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['DecreaseOrderUtils'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['SwapOrderUtils'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['DepositHandler'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['WithdrawalHandler'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['SwapHandler'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['ExchangeRouter'], shortString.encodeShortString("CONTROLLER")] + }, + { + contractAddress: contractAddresses['RoleStore'], + entrypoint: "grant_role", + calldata: [contractAddresses['OrderUtils'], shortString.encodeShortString("CONTROLLER")] + }, + ]; + await tryInvoke("Grant Roles", grantRoleCalls); + + sleep(30); + + const dataStoreAddress = contractAddresses['DataStore']; + const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) + const dataStoreContract = new Contract(compiledDataStoreSierra.abi, dataStoreAddress, provider) + dataStoreContract.connect(account0); + const dataCall = dataStoreContract.populate( + "set_address", + [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("FEE_TOKEN"))]), contractAddresses['ETH']]) + const setAddressTx = await dataStoreContract.set_address(dataCall.calldata) + await provider.waitForTransaction(setAddressTx.transaction_hash) + const dataCall2 = dataStoreContract.populate( + "set_u256", + [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_SWAP_PATH_LENGTH"))]), 5n]) + const setAddressTx2 = await dataStoreContract.set_u256(dataCall2.calldata) + await provider.waitForTransaction(setAddressTx2.transaction_hash) + + const dataCall3 = dataStoreContract.populate( + "set_u256", + [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_ORACLE_PRICE_AGE"))]), 1000000000000n]) + const setAddressTx3 = await dataStoreContract.set_u256(dataCall3.calldata) + await provider.waitForTransaction(setAddressTx2.transaction_hash) +} + +deploy() \ No newline at end of file diff --git a/scripts/actions/3.createMarket.ts b/scripts/actions/3.createMarket.ts new file mode 100644 index 00000000..e859677c --- /dev/null +++ b/scripts/actions/3.createMarket.ts @@ -0,0 +1,58 @@ +import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" +import fs from 'fs' +import dotenv from 'dotenv' +import path from 'path'; +import { tryInvoke } from "./constants/utils"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); +const ETH = contractAddresses['ETH']; +const BTC = contractAddresses['BTC']; +const USDT = contractAddresses['USDT']; + +dotenv.config() + +async function create_market() { + // connect provider + const providerUrl = process.env.PROVIDER_URL + const provider = new RpcProvider({ nodeUrl: providerUrl! }) + // connect your account. To adapt to your own account : + const privateKey0: string = process.env.ACCOUNT_PRIVATE as string + const account0Address: string = process.env.ACCOUNT_PUBLIC as string + const account0 = new Account(provider, account0Address!, privateKey0!) + + const marketFactoryAddress = contractAddresses['MarketFactory']; + const compiledMarketFactorySierra = json.parse(fs.readFileSync("./target/dev/satoru_MarketFactory.contract_class.json").toString("ascii")) + const abi = compiledMarketFactorySierra.abi + const marketFactoryContract = new Contract(abi, marketFactoryAddress, provider); + marketFactoryContract.connect(account0) + + console.log("Creating ETH-USDT and BTC-USDT Markets...") + const myCall = marketFactoryContract.populate("create_market", [ + ETH, + ETH, + USDT, + "market_type" + ]); + const res = await marketFactoryContract.create_market(myCall.calldata); + const marketTokenAddress = (await provider.waitForTransaction(res.transaction_hash) as any).events[0].data[1]; + + const myCall1 = marketFactoryContract.populate("create_market", [ + BTC, + BTC, + USDT, + "market_type" + ]); + const res1 = await marketFactoryContract.create_market(myCall1.calldata); + const marketTokenAddress1 = (await provider.waitForTransaction(res1.transaction_hash) as any).events[0].data[1]; + + contractAddresses.ETHUSDTMarketToken = marketTokenAddress; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + + contractAddresses.BTCUSDTMarketToken = marketTokenAddress1; + fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); + + console.log('Markets created ✅') +} + +create_market() \ No newline at end of file diff --git a/scripts/actions/4.setDataStore.ts b/scripts/actions/4.setDataStore.ts new file mode 100644 index 00000000..bd545c4c --- /dev/null +++ b/scripts/actions/4.setDataStore.ts @@ -0,0 +1,402 @@ +import { Account, AllowArray, Call, Contract, num, RpcProvider } from "starknet"; +import * as dataStoreKeys from "./constants/dataStoreKeys"; +import { markets_config } from "./constants/market-config-data"; +import dotenv from 'dotenv' +import fs from 'fs' +import path from 'path'; +import { tryInvoke } from "./constants/utils"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); + +dotenv.config() + +// connect provider +const providerUrl = process.env.PROVIDER_URL +const provider = new RpcProvider({ nodeUrl: providerUrl! }) +// connect your account. To adapt to your own account : +const privateKey0: string = process.env.ACCOUNT_PRIVATE as string +const account0Address: string = process.env.ACCOUNT_PUBLIC as string +const account = new Account(provider, account0Address!, privateKey0!) + +async function getReaderContract() { + // read abi of DataStore contract + const { abi: readerAbi } = await account.getClassAt(contractAddresses['Reader']); + if (readerAbi === undefined) { throw new Error("no abi.") }; + const readerContract = new Contract(readerAbi, contractAddresses['Reader'], account); + return readerContract; +} + +async function getDataStoreContract() { + // read abi of DataStore contract + const { abi: dataStoreAbi } = await account.getClassAt(contractAddresses['DataStore']); + if (dataStoreAbi === undefined) { throw new Error("no abi.") }; + const dataStoreContract = new Contract(dataStoreAbi, contractAddresses['DataStore'], account); + return dataStoreContract; +} + +/// Create a new market. +export async function setDataStore( + +) { + const dataStore = await getDataStoreContract(); + const reader = await getReaderContract(); + const market = contractAddresses['ETHUSDTMarketToken']; + const tokensInMarket = await reader.functions.get_market({ + contract_address: dataStore.address + }, market); + const index_token = num.toHex(tokensInMarket.index_token); + const long_token = num.toHex(tokensInMarket.long_token); + const short_token = num.toHex(tokensInMarket.short_token); + + const configData = markets_config[market]; + + const setDataStoreCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = []; + + const virtualTokenIdForIndexTokenKey = dataStoreKeys.virtualTokenIdKey(configData.virtualTokenIdForIndexToken); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_felt252", + calldata: [virtualTokenIdForIndexTokenKey, configData.virtualTokenIdForIndexToken] + }); + const virtualTokenIdForMarketToken = dataStoreKeys.virtualMarketIdKey(configData.virtualTokenIdForIndexToken); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_felt252", + calldata: [virtualTokenIdForMarketToken, configData.virtualMarketId] + }); + + // minPositionImpactPoolAmount + const minPositionImpactPoolAmountKey = dataStoreKeys.minPositionImpactPoolAmountKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minPositionImpactPoolAmountKey, configData.minPositionImpactPoolAmount.toBigInt(), "0"] + }); + + // // positionImpactPoolDistributionRate + // const minPositionImpactPoolAmountRateCalls: Call[] = [] + // const positionImpactPoolDistributionRateKey = dataStoreKeys.positionImpactPoolDistributionRateKey(market); + // minPositionImpactPoolAmountRateCalls.push({ + // contractAddress: dataStore.address, + // entrypoint: "set_u256", + // calldata: [positionImpactPoolDistributionRateKey, configData.positionImpactPoolDistributionRate.toBigInt(), "0"] + // }); + // await tryInvoke("minPositionImpactPoolAmountRateCalls", minPositionImpactPoolAmountRateCalls); + + // maxLongTokenPoolAmount + const maxLongTokenPoolAmountKey = dataStoreKeys.maxPoolAmountKey(market, long_token); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxLongTokenPoolAmountKey, configData.maxLongTokenPoolAmount.toBigInt(), "0"] + }); + + // maxShortTokenPoolAmount + const maxShortTokenPoolAmountKey = dataStoreKeys.maxPoolAmountKey(market, short_token); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxShortTokenPoolAmountKey, configData.maxShortTokenPoolAmount.toBigInt(), "0"] + }); + + // maxLongTokenPoolAmountForDeposit => maxPoolAmountForDepositKey() + const maxLongTokenPoolAmountForDepositKey = dataStoreKeys.maxPoolAmountForDepositKey(market, long_token); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxLongTokenPoolAmountForDepositKey, configData.maxLongTokenPoolAmountForDeposit.toBigInt(), "0"] + }); + // maxShortTokenPoolAmountForDeposit => maxPoolAmountForDepositKey() + const maxShortTokenPoolAmountForDepositKey = dataStoreKeys.maxPoolAmountForDepositKey(market, short_token); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxShortTokenPoolAmountForDepositKey, configData.maxShortTokenPoolAmountForDeposit.toBigInt(), "0"] + }); + + // negativePositionImpactFactor + const negativePositionImpactFactorKey = dataStoreKeys.positionImpactFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [negativePositionImpactFactorKey, configData.negativePositionImpactFactor.toBigInt(), "0"] + }); + + // positivePositionImpactFactor + const positivePositionImpactFactorKey = dataStoreKeys.positionImpactFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [positivePositionImpactFactorKey, configData.positivePositionImpactFactor.toBigInt(), "0"] + }); + + // minCollateralFactorForOpenInterestMultiplierLong + const minCollateralFactorForOpenInterestMultiplierLongKey = dataStoreKeys.minCollateralFactorForOpenInterest(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minCollateralFactorForOpenInterestMultiplierLongKey, configData.minCollateralFactorForOpenInterestMultiplierLong.toBigInt(), "0"] + }); + + // minCollateralFactorForOpenInterestMultiplierShort + const minCollateralFactorForOpenInterestMultiplierShortKey = dataStoreKeys.minCollateralFactorForOpenInterest(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minCollateralFactorForOpenInterestMultiplierShortKey, configData.minCollateralFactorForOpenInterestMultiplierShort.toBigInt(), "0"] + }); + + // negativeSwapImpactFactor + const negativeSwapImpactFactorKey = dataStoreKeys.swapImpactFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [negativeSwapImpactFactorKey, configData.negativeSwapImpactFactor.toBigInt(), "0"] + }); + + // positiveSwapImpactFactor + const positiveSwapImpactFactorKey = dataStoreKeys.swapImpactFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [positiveSwapImpactFactorKey, configData.positiveSwapImpactFactor.toBigInt(), "0"] + }); + + // maxOpenInterestForLongs + const maxOpenInterestForLongsKey = dataStoreKeys.maxOpenInterestKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxOpenInterestForLongsKey, configData.maxOpenInterestForLongs.toBigInt(), "0"] + }); + + // maxOpenInterestForShorts + const maxOpenInterestForShortsKey = dataStoreKeys.maxOpenInterestKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxOpenInterestForShortsKey, configData.maxOpenInterestForShorts.toBigInt(), "0"] + }); + + // fundingIncreaseFactorPerSecond + const fundingIncreaseFactorPerSecondKey = dataStoreKeys.fundingIncreaseFactorPerSecondKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [fundingIncreaseFactorPerSecondKey, configData.fundingIncreaseFactorPerSecond.toBigInt(), "0"] + }); + + // fundingDecreaseFactorPerSecond + const fundingDecreaseFactorPerSecondKey = dataStoreKeys.fundingDecreaseFactorPerSecondKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [fundingDecreaseFactorPerSecondKey, configData.fundingDecreaseFactorPerSecond.toBigInt(), "0"] + }); + + // minFundingFactorPerSecond + const minFundingFactorPerSecondKey = dataStoreKeys.minFundingFactorPerSecondKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minFundingFactorPerSecondKey, configData.minFundingFactorPerSecond.toBigInt(), "0"] + }); + + // maxFundingFactorPerSecond + const maxFundingFactorPerSecondKey = dataStoreKeys.maxFundingFactorPerSecondKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxFundingFactorPerSecondKey, configData.maxFundingFactorPerSecond.toBigInt(), "0"] + }); + + // thresholdForStableFunding + const thresholdForStableFundingKey = dataStoreKeys.thresholdForStableFundingKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [thresholdForStableFundingKey, configData.thresholdForStableFunding.toBigInt(), "0"] + }); + + // thresholdForDecreaseFunding + const thresholdForDecreaseFundingKey = dataStoreKeys.thresholdForDecreaseFundingKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [thresholdForDecreaseFundingKey, configData.thresholdForDecreaseFunding.toBigInt(), "0"] + }); + + // borrowingFactorForLongs + const borrowingFactorForLongsKey = dataStoreKeys.borrowingFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [borrowingFactorForLongsKey, configData.borrowingFactorForLongs.toBigInt(), "0"] + }); + // borrowingFactorForShorts + const borrowingFactorForShortsKey = dataStoreKeys.borrowingFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [borrowingFactorForShortsKey, configData.borrowingFactorForShorts.toBigInt(), "0"] + }); + + // borrowingExponentFactorForLongs + const borrowingExponentFactorForLongsKey = dataStoreKeys.borrowingExponentFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [borrowingExponentFactorForLongsKey, configData.borrowingExponentFactorForLongs.toBigInt(), "0"] + }); + // borrowingExponentFactorForShorts + const borrowingExponentFactorForShortsKey = dataStoreKeys.borrowingExponentFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [borrowingExponentFactorForShortsKey, configData.borrowingExponentFactorForShorts.toBigInt(), "0"] + }); + + // reserveFactorLongs + const reserveFactorLongsKey = dataStoreKeys.reserveFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [reserveFactorLongsKey, configData.reserveFactorLongs.toBigInt(), "0"] + }); + + // reserveFactorShorts + const reserveFactorShortsKey = dataStoreKeys.reserveFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [reserveFactorShortsKey, configData.reserveFactorShorts.toBigInt(), "0"] + }); + + // openInterestReserveFactorLongs + const openInterestReserveFactorLongsKey = dataStoreKeys.openInterestReserveFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [openInterestReserveFactorLongsKey, configData.openInterestReserveFactorLongs.toBigInt(), "0"] + }); + + // openInterestReserveFactorShorts + const openInterestReserveFactorShortsKey = dataStoreKeys.openInterestReserveFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [openInterestReserveFactorShortsKey, configData.openInterestReserveFactorShorts.toBigInt(), "0"] + }); + + // maxPnlFactorForTradersLongs + const maxPnlFactorForTradersLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_TRADERS_KEY, market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForTradersLongsKey, configData.maxPnlFactorForTradersLongs.toBigInt(), "0"] + }); + + // maxPnlFactorForTradersShorts + const maxPnlFactorForTradersShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_TRADERS_KEY, market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForTradersShortsKey, configData.maxPnlFactorForTradersShorts.toBigInt(), "0"] + }); + + // maxPnlFactorForAdlLongs + const maxPnlFactorForAdlLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_ADL, market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForAdlLongsKey, configData.maxPnlFactorForAdlLongs.toBigInt(), "0"] + }); + + // maxPnlFactorForAdlShorts + const maxPnlFactorForAdlShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_ADL, market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForAdlShortsKey, configData.maxPnlFactorForAdlShorts.toBigInt(), "0"] + }); + + // minPnlFactorAfterAdlLongs + const minPnlFactorAfterAdlLongsKey = dataStoreKeys.minPnlFactorAfterAdl(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minPnlFactorAfterAdlLongsKey, configData.minPnlFactorAfterAdlLongs.toBigInt(), "0"] + }); + + // minPnlFactorAfterAdlShorts + const minPnlFactorAfterAdlShortsKey = dataStoreKeys.minPnlFactorAfterAdl(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [minPnlFactorAfterAdlShortsKey, configData.minPnlFactorAfterAdlShorts.toBigInt(), "0"] + }); + + // maxPnlFactorForDepositsLongs + const maxPnlFactorForDepositsLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForDepositsLongsKey, configData.maxPnlFactorForDepositsLongs.toBigInt(), "0"] + }); + + // maxPnlFactorForDepositsShorts + const maxPnlFactorForDepositsShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForDepositsShortsKey, configData.maxPnlFactorForDepositsShorts.toBigInt(), "0"] + }); + + // maxPnlFactorForWithdrawalsLongs + const maxPnlFactorForWithdrawalsLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY, market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForWithdrawalsLongsKey, configData.maxPnlFactorForWithdrawalsLongs.toBigInt(), "0"] + }); + + // maxPnlFactorForWithdrawalsShorts + const maxPnlFactorForWithdrawalsShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY, market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPnlFactorForWithdrawalsShortsKey, configData.maxPnlFactorForWithdrawalsShorts.toBigInt(), "0"] + }); + + // positiveMaxPositionImpactFactor + const positiveMaxPositionImpactFactorKey = dataStoreKeys.maxPositionImpactFactorKey(market, true); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [positiveMaxPositionImpactFactorKey, configData.positiveMaxPositionImpactFactor.toBigInt(), "0"] + }); + + // negativeMaxPositionImpactFactor + const negativeMaxPositionImpactFactorKey = dataStoreKeys.maxPositionImpactFactorKey(market, false); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [negativeMaxPositionImpactFactorKey, configData.negativeMaxPositionImpactFactor.toBigInt(), "0"] + }); + + // maxPositionImpactFactorForLiquidations + const maxPositionImpactFactorForLiquidationsKey = dataStoreKeys.maxPositionImpactFactorForLiquidationsKey(market); + setDataStoreCalls.push({ + contractAddress: dataStore.address, + entrypoint: "set_u256", + calldata: [maxPositionImpactFactorForLiquidationsKey, configData.maxPositionImpactFactorForLiquidations.toBigInt(), "0"] + }); + + await tryInvoke("setDataStoreCalls", setDataStoreCalls); +} + + +(async () => { + setDataStore(); +})() \ No newline at end of file diff --git a/scripts/actions/5.createDeposit.ts b/scripts/actions/5.createDeposit.ts new file mode 100644 index 00000000..89ac017c --- /dev/null +++ b/scripts/actions/5.createDeposit.ts @@ -0,0 +1,87 @@ +import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" +import fs from 'fs' +import dotenv from 'dotenv' +import path from 'path'; +import { tryInvoke } from "./constants/utils"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); +const ETH = contractAddresses['ETH']; +const BTC = contractAddresses['BTC']; +const USDT = contractAddresses['USDT']; + +dotenv.config() + +async function create_market() { + // connect provider + const providerUrl = process.env.PROVIDER_URL + const provider = new RpcProvider({ nodeUrl: providerUrl! }) + // connect your account. To adapt to your own account : + const privateKey0: string = process.env.ACCOUNT_PRIVATE as string + const account0Address: string = process.env.ACCOUNT_PUBLIC as string + const account0 = new Account(provider, account0Address!, privateKey0!) + let MarketTokenAddress = contractAddresses['ETHUSDTMarketToken']; + let depositVaultAddress = contractAddresses['DepositVault']; + let routerAddress = contractAddresses['Router']; + let exchangeRouterAddress = contractAddresses['ExchangeRouter']; + + let eth = contractAddresses['ETH']; + let usdt = contractAddresses['USDT']; + + const depositCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = [ + { + contractAddress: eth, + entrypoint: "approve", + calldata: [ + routerAddress, + uint256.bnToUint256(10000000000000000n), + ] + }, + { + contractAddress: exchangeRouterAddress, + entrypoint: "send_tokens", + calldata: [ + eth, + depositVaultAddress, + uint256.bnToUint256(10000000000000000n), + ] + }, + { + contractAddress: usdt, + entrypoint: "approve", + calldata: [ + routerAddress, + uint256.bnToUint256(100000000000000000000n), + ] + }, + { + contractAddress: exchangeRouterAddress, + entrypoint: "send_tokens", + calldata: [ + usdt, + depositVaultAddress, + uint256.bnToUint256(100000000000000000000n), + ] + }, + { + contractAddress: exchangeRouterAddress, + entrypoint: 'create_deposit', + calldata: CallData.compile({ + receiver: account0.address, + callback_contract: "0x0000000000000000000000000000000000000000000000000000000000000000", + ui_fee_receiver: "0x0000000000000000000000000000000000000000000000000000000000000000", + market: MarketTokenAddress, + initial_long_token: eth, + initial_short_token: usdt, + long_token_swap_path: [], + short_token_swap_path: [], + min_market_tokens: uint256.bnToUint256(0), + execution_fee: uint256.bnToUint256(0), + callback_gas_limit: uint256.bnToUint256(0), + }), + } + ]; + await tryInvoke("Create Deposit", depositCalls); +} + +create_market() \ No newline at end of file diff --git a/scripts/actions/6.executeDeposit.ts b/scripts/actions/6.executeDeposit.ts new file mode 100644 index 00000000..d64e3bb0 --- /dev/null +++ b/scripts/actions/6.executeDeposit.ts @@ -0,0 +1,94 @@ +import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec } from "starknet" +import fs from 'fs' +import dotenv from 'dotenv' +import path from 'path'; +import { secureHeapUsed } from "crypto"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); + +dotenv.config() + +// Function to pause execution for the given number of milliseconds. +const sleep = (milliseconds: number | undefined) => { + return new Promise(resolve => setTimeout(resolve, milliseconds)); +} + +// connect provider +const providerUrl = process.env.PROVIDER_URL +const provider = new RpcProvider({ nodeUrl: providerUrl! }) +// connect your account. To adapt to your own account : +const privateKey0: string = process.env.ACCOUNT_PRIVATE as string +const account0Address: string = process.env.ACCOUNT_PUBLIC as string +const account0 = new Account(provider, account0Address!, privateKey0!) + +async function getDataStoreContract() { + // read abi of DataStore contract + const { abi: dataStoreAbi } = await provider.getClassAt(contractAddresses['DataStore']); + if (dataStoreAbi === undefined) { throw new Error("no abi.") }; + const dataStoreContract = new Contract(dataStoreAbi, contractAddresses['DataStore'], provider); + return dataStoreContract; +} + +// Read account deposit keys count +export async function getAccountDepositCount(accountAddress: string) { + const dataStoreContract = await getDataStoreContract(); + const accountDepositCount = await dataStoreContract.get_account_deposit_count(accountAddress); + return Number(accountDepositCount); +} + +// Get all account deposit keys +export async function getAccountDepositKeys(accountAddress: string) { + const dataStoreContract = await getDataStoreContract(); + const accountDepositCount = await getAccountDepositCount(accountAddress); + console.log("Account Deposit Count:", accountDepositCount) + const accountDepositKeys = await dataStoreContract.get_account_deposit_keys(accountAddress, 0, Number(accountDepositCount)); + return accountDepositKeys; +} + +// Get latest account deposit key +export async function getAccountLatestDepositKeys(accountAddress: string) { + const accountDepositKeys = await getAccountDepositKeys(accountAddress); + return accountDepositKeys[accountDepositKeys.length - 1]; +} + +async function deploy() { + const key = await getAccountLatestDepositKeys(account0Address); + + const depositHandlerAddress = contractAddresses['DepositHandler']; + const compiledDepositHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_DepositHandler.contract_class.json").toString("ascii")) + + const depositHandlerContract = new Contract(compiledDepositHandlerSierra.abi, depositHandlerAddress, provider); + const current_block = await provider.getBlockNumber(); + const current_block_data = await provider.getBlock(current_block); + const block0 = 0; + const block1 = current_block - 1; + + const setPricesParams = { + signer_info: 1, + tokens: [contractAddresses['ETH'], contractAddresses['USDT']], + compacted_min_oracle_block_numbers: [block0, block0], + compacted_max_oracle_block_numbers: [block1, block1], + compacted_oracle_timestamps: [current_block_data.timestamp, current_block_data.timestamp], + compacted_decimals: [18, 18], + compacted_min_prices: [3060, 3060], // 500000, 10000 compacted + compacted_min_prices_indexes: [0], + compacted_max_prices: [3060, 3060], // 500000, 10000 compacted + compacted_max_prices_indexes: [0], + signatures: [ + ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] + ], + price_feed_tokens: [] + }; + + depositHandlerContract.connect(account0) + + const executeOrderCall = depositHandlerContract.populate("execute_deposit", [ + key, + setPricesParams + ]) + let tx = await depositHandlerContract.execute_deposit(executeOrderCall.calldata) + console.log("Deposit executed: https://sepolia.starkscan.co/tx/" + tx.transaction_hash); +} + +deploy() \ No newline at end of file diff --git a/scripts/actions/7.createLongOrder.ts b/scripts/actions/7.createLongOrder.ts new file mode 100644 index 00000000..d20dd8de --- /dev/null +++ b/scripts/actions/7.createLongOrder.ts @@ -0,0 +1,60 @@ +import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" +import fs from 'fs' +import dotenv from 'dotenv' +import path from 'path'; +import { tryInvoke } from "./constants/utils"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); + +dotenv.config() + +async function create_order() { + // connect provider + const providerUrl = process.env.PROVIDER_URL + const provider = new RpcProvider({ nodeUrl: providerUrl! }) + // connect your account. To adapt to your own account : + const privateKey0: string = process.env.ACCOUNT_PRIVATE as string + const account0Address: string = process.env.ACCOUNT_PUBLIC as string + const marketTokenAddress = contractAddresses['ETHUSDTMarketToken'] + const eth: string = contractAddresses['ETH'] + const usdt: string = contractAddresses['USDT'] + const account0 = new Account(provider, account0Address!, privateKey0!) + const createOrderCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = [ + { + contractAddress: eth, + entrypoint: "transfer", + calldata: [contractAddresses['OrderVault'] as string, uint256.bnToUint256(1000000000000000n)] + }, + { + contractAddress: contractAddresses['OrderHandler'] as string, + entrypoint: "create_order", + calldata: [ + account0.address, + { + receiver: account0.address, + callback_contract: 0, + ui_fee_receiver: 0, + market: marketTokenAddress, + initial_collateral_token: eth, + swap_path: [], + size_delta_usd: uint256.bnToUint256(10000000000000000000000n), + initial_collateral_delta_amount: uint256.bnToUint256(2000000000000000000n), + trigger_price: uint256.bnToUint256(5000), + acceptable_price: uint256.bnToUint256(5500), + execution_fee: uint256.bnToUint256(0), + callback_gas_limit: uint256.bnToUint256(0), + min_output_amount: uint256.bnToUint256(0), + order_type: new CairoCustomEnum({ MarketIncrease: {} }), + decrease_position_swap_type: new CairoCustomEnum({ NoSwap: {} }), + is_long: 1, + referral_code: 0 + } + ] + } + ] + + await tryInvoke("Create Order", createOrderCalls); +} + +create_order() \ No newline at end of file diff --git a/scripts/actions/8.executeLongOrder.ts b/scripts/actions/8.executeLongOrder.ts new file mode 100644 index 00000000..50071522 --- /dev/null +++ b/scripts/actions/8.executeLongOrder.ts @@ -0,0 +1,110 @@ +import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" +import fs from 'fs' +import dotenv from 'dotenv' +import path from 'path'; +import { tryInvoke } from "./constants/utils"; + +const contractAddressesPath = path.join(__dirname, 'constants', 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); +const ETH = contractAddresses['ETH']; +const BTC = contractAddresses['BTC']; +const USDT = contractAddresses['USDT']; + +dotenv.config() + +// connect provider +const providerUrl = process.env.PROVIDER_URL +const provider = new RpcProvider({ nodeUrl: providerUrl! }) +// connect your account. To adapt to your own account : +const privateKey0: string = process.env.ACCOUNT_PRIVATE as string +const account0Address: string = process.env.ACCOUNT_PUBLIC as string +const account0 = new Account(provider, account0Address!, privateKey0!) + +async function getDataStoreContract() { + // read abi of DataStore contract + const { abi: dataStoreAbi } = await provider.getClassAt(contractAddresses['DataStore']); + if (dataStoreAbi === undefined) { throw new Error("no abi.") }; + const dataStoreContract = new Contract(dataStoreAbi, contractAddresses['DataStore'], provider); + return dataStoreContract; +} + +// Read account order keys count +export async function getAccountOrderCount(accountAddress: string) { + const dataStoreContract = await getDataStoreContract(); + const accountOrderCount = await dataStoreContract.get_account_order_count(accountAddress); + return Number(accountOrderCount); +} + +// Get all account order keys +export async function getAccountOrderKeys(accountAddress: string) { + const dataStoreContract = await getDataStoreContract(); + const accountOrderCount = await getAccountOrderCount(accountAddress); + console.log("Account Order Count:", accountOrderCount) + const accountOrderKeys = await dataStoreContract.get_account_order_keys(accountAddress, 0, Number(accountOrderCount)); + return accountOrderKeys; +} + +// Get latest account order key +export async function getAccountLatestOrderKeys(accountAddress: string) { + const accountOrderKeys = await getAccountOrderKeys(accountAddress); + return accountOrderKeys[accountOrderKeys.length - 1]; +} + + +async function create_market() { + const key = await getAccountLatestOrderKeys(account0Address); + + const compiledOrderHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_OrderHandler.contract_class.json").toString("ascii")) + + const orderHandlerContract = new Contract(compiledOrderHandlerSierra.abi, contractAddresses['OrderHandler'] as string, provider); + + const compiledRoleStoreSierra = json.parse(fs.readFileSync("./target/dev/satoru_RoleStore.contract_class.json").toString("ascii")) + const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, contractAddresses['RoleStore'] as string, provider) + roleStoreContract.connect(account0); + + // const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) + // const dataStoreContract = new Contract(compiledDataStoreSierra.abi, contractAddresses.DataStore as string, provider) + // dataStoreContract.connect(account0) + // const dataCall8 = dataStoreContract.populate( + // "remove_position", + // [ + // "0x5985ad845114a848d9cffdf9124a029e1d3fe1e704ed8230e42872f80f88cd1", + // "0x4eaaccd6d2a2d9d1c0404cd2fea8485d62b437415948309736fdfd2542aee3" + // ] + // ) + // const setAddressTx8 = await dataStoreContract.remove_position(dataCall8.calldata) + // await provider.waitForTransaction(setAddressTx8.transaction_hash) + + const current_block = await provider.getBlockNumber(); + const current_block_data = await provider.getBlock(current_block); + const block0 = 0; + const block1 = current_block - 1; + + const setPricesParams = { + signer_info: 1, + tokens: [contractAddresses['ETH'], contractAddresses['USDT']], + compacted_min_oracle_block_numbers: [block0, block0], + compacted_max_oracle_block_numbers: [block1, block1], + compacted_oracle_timestamps: [current_block_data.timestamp, current_block_data.timestamp], + compacted_decimals: [18, 18], + compacted_min_prices: [2700, 1], // 500000, 10000 compacted + compacted_min_prices_indexes: [0], + compacted_max_prices: [2700, 1], // 500000, 10000 compacted + compacted_max_prices_indexes: [0], + signatures: [ + ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] + ], + price_feed_tokens: [] + }; + + orderHandlerContract.connect(account0) + + const executeOrderCall = orderHandlerContract.populate("execute_order", [ + key, + setPricesParams + ]) + let tx = await orderHandlerContract.execute_order(executeOrderCall.calldata) + console.log("Order executed: https://sepolia.starkscan.co/tx/" + tx.transaction_hash); +} + +create_market() \ No newline at end of file diff --git a/scripts/actions/constants/contractAddresses.json b/scripts/actions/constants/contractAddresses.json new file mode 100644 index 00000000..d42bdaab --- /dev/null +++ b/scripts/actions/constants/contractAddresses.json @@ -0,0 +1,29 @@ +{ + "ZeroAddress": "0x0000000000000000000000000000000000000000000000000000000000000000", + "BTC": "0x05dbc83d78a3ae24dfb9c972b223983c4adcd9750a51c11973eda925e6fc61e1", + "ETH": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + "USDT": "0x57e859eee48e899cef91cf0595661bec0634db7d593d98222c68af6472e8394", + "ETHUSDTMarketToken": "0x4074682cf70b78c4d0283ae83f2f673000a582677955d297efe518eecc928dc", + "BTCUSDTMarketToken": "0xfab9e0daaf362b0572d242d923b5764abec63484676bc3218da4e2cd0d1ea5", + "RoleStore": "0x46343a2e384323e70573d56c79983b5bed25a68f06889f11223a1bf4cd21d1", + "DataStore": "0xe3ffe4e59e19e37cc5274438fc727d65ad59fff4e873297ed76a020e96eb6c", + "EventEmitter": "0x2454506b9c7af3326b36fe78fd101a5a3c3f1f511c9ea6510967bdfdc5beece", + "OracleStore": "0x2ca03b9ee8242c7fb30d5babb7fbde82e3e08f30b3383ec16c892140e48996", + "Oracle": "0x46b9ccfe9424bd3095712a1f9740ab6db141fb9a6c735f1b9058dbbc5d483c", + "OrderVault": "0x3f24afff452ccaa0a6726f112d730feac9c5a1607be437416afe87cea8fdfcf", + "SwapHandler": "0x3fc6628f9aa80c8edb8c1ce06974601ed0ac082ecfbb77a73049b9a295cd8e", + "ReferralStorage": "0x456283edbeb080f98e87479e3927a63957876ef580781a5a012e2a42bc15d1c", + "IncreaseOrderUtils": "0x700edccbc84defefdc8dc8b69c1e8631c746dd6225641675dedcf0e5250e1f8", + "DecreaseOrderUtils": "0x7a6a3ec3c4909efe76a8517d822e2a46702a6e3e5dc64b65818ad90d120b3d1", + "SwapOrderUtils": "0x53c8b54a52d8914aa28b20ad9b46bbd8726ceab88f6223c8a54821ccdcb3596", + "OrderUtils": "0xe2fd600aef974d3976e55153eddf1b7e09a7458f0b63841e3502e50242bb66", + "OrderHandler": "0x7431601f7ca368d2467b90c653031e80f198f0a49dea9e51278506c6a72dd97", + "DepositVault": "0x21a68253acc1350a63c3f96b2c41f8b5f0696c4c18e83b7bc091c3aeefdf1fd", + "DepositHandler": "0x7f5faad5b38795bdf7a888ebe035bfd1c3cc15614c0b7555418ed70e7a1d3f8", + "WithdrawalVault": "0x395e6d1e650ed534e5efcde5d74ee93bbedcaac514adc17c88486e7a82c3aae", + "WithdrawalHandler": "0x74c8f58e437fbfda819ed5988091488ee4288cda93bec6e93463633a0aa3466", + "MarketFactory": "0x61246603d31d14983c1533fad57ceaac8cdbfa7ea6c07b440d31e64126d21ec", + "Reader": "0xa8ae98fefa7b57915cb9c6caab0192ee41c7dcd9ecbc3936cf088c59883967", + "Router": "0x63c8e1b03aa2e7b18d80169af7ce586fa2bb3df04ee2b5695218f74f415d3d0", + "ExchangeRouter": "0x779bcb0cac95b92cb003d69a06637ef90f4f66ceaeaac1fca93fad09131fbe9" +} \ No newline at end of file diff --git a/scripts/actions/constants/contractAddresses.ts b/scripts/actions/constants/contractAddresses.ts new file mode 100644 index 00000000..3093712c --- /dev/null +++ b/scripts/actions/constants/contractAddresses.ts @@ -0,0 +1,37 @@ +export const contractAddresses: { [key: string]: string } = { + AdlHandler: "0x", + LiquidationHandler: "0x", + KeysReader: "", + PragmaOracle: "", + PriceFeed: "", + ZeroAddress: "0x".padEnd(64, "0"), + TestingSenderAccount: "0x0593d70efc9e218976d17cb27bd9553c9ec2adf5940c5e825e9c9d6466591eb0", + BTC: "0x05dbc83d78a3ae24dfb9c972b223983c4adcd9750a51c11973eda925e6fc61e1", + ETH: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + USDT: "0x57e859eee48e899cef91cf0595661bec0634db7d593d98222c68af6472e8394", + + ETHUSDTMarketToken: "0xbc88777ea25f4ad44d8ab2a90fb0b26419942dfc2ad2e1dd687601e6729ed2", + BTCUSDTMarketToken: "0x30fae589beb434c2e3010f338b67e3b69897b98dbb74990dde4866ecbdfdaa3", + + RoleStore: "0x3ac017e1ad6d9c519fc8e8f16ee0604ba36f306ed7268621a0cabd9200494f7", + DataStore: "0xad595d2ccaa23f3694556b502bee7dfdf1d9e259406e2e94bdd1e72712e74d", + EventEmitter: "0x53e94bdf848217e982ee82c0ac4c09d56346efd0e138bda9b84bbf1c3e9fa42", + OracleStore: "0x290855a32b7b027027bd1d620426a0c12cf0870443f3eb93746a7bfb7e73d08", + Oracle: "0x6f69ed660769182d033d5e4e2b9eccd9adc43bdc691fe809457bcb6979a7511", + OrderVault: "0x547af2b1caf4db61f227c1239b792f796efe381a95113184e1e5f1cae1342f7", + SwapHandler: "0x356c16cf73210677e69763cf341db445a754fca23f9a0defa1cbd71d200135d", + ReferralStorage: "0x6ff376be807a2c7a35a110091767fbf9a9ab482023474f4ba4ae241b12d4464", + IncreaseOrderUtils: "0x95d3f547e14996ea49af7ea75f7448f4ecbd03e0d5c27a7965b52e5094e116", + DecreaseOrderUtils: "0x6c3f837263add6416fb694225e65e287d2c8649eeb8e5369e6fa79f886f27c4", + SwapOrderUtils: "0x3b706c1f7b3c56b07cb765cbc4d943010cea523049239694e682941aec8899", + OrderUtils: "0x59c646726b8889d92375acd072de9ffa896265f1a88d5aa92d80d01ac32657", + OrderHandler: "0x6cf20ba6f812b508140f620527939eb7a39de4426b0070235a19551f56ddcc1", + DepositVault: "0xa4119b5d86d7d8846d18340b7f5777fbbc5369b7a5e8cebaba8aebd2e21764", + DepositHandler: "0x4fdc3c5ac4bcdedc9a431b18c938d816964899377fd861a606012369ab6e01f", + WithdrawalVault: "0x5e31be54914a22dca42d086c43d07b556070bba2f3802d4e2b70e753c65b24b", + WithdrawalHandler: "0x306e651ca24e52f4661af6f0902f2e3cf8e4c87d98b41331679d0700ca7f56d", + MarketFactory: "0x35aca67a9f70fe7ecfac8ffd59c7e51bfbd89161c6c408a92ea521948dad987", + Reader: "0x2e582120b834a5775da76c87096060a8c2458d20f0137ccc302c4b3f5ae146f", + Router: "0x2b1a9fb99b5caba9686ebae53f32074462372c4be3579f56ae1111794067189", + ExchangeRouter: "0x623afda62ec11dab83f49986a34ba1e9458b5c5f09c4cf0afb6aee75deab8bb", +} diff --git a/scripts/actions/constants/dataStoreKeys.ts b/scripts/actions/constants/dataStoreKeys.ts new file mode 100644 index 00000000..a2b6ef2c --- /dev/null +++ b/scripts/actions/constants/dataStoreKeys.ts @@ -0,0 +1,342 @@ +import { num, ec } from "starknet"; +const { starkCurve } = ec; + +export function hashSingleString(string: string) { + let value: string = string; + const isHex = num.isHex(string); + if (!isHex) { + // TODO: Khiem, please check string isLong + // Can use: Buffer.from(string) instead + value = "0x" + Buffer.from(string).toString("hex") + } + + return num.toHex(starkCurve.poseidonHashMany([num.toBigInt(value)])) +} + +export function hashManyString(strings: (string | boolean | BigInt)[]) { + // TODO, please coverage 100% + const value = strings.map(s => { + if (typeof s === "string") { + const isHex = num.isHex(s); + if (!isHex) { + // TODO: Khiem, please check string isLong + // Can use: Buffer.from(string) instead + return num.toBigInt("0x" + Buffer.from(s).toString("hex")); + } + return num.toBigInt(s); + } + if (typeof s === "boolean") { + return num.toBigInt(s ? "0x1" : "0x0"); + } + if (typeof s === "bigint") { + return num.toBigInt(s); + } + + return num.toBigInt(0); + + }); + + return num.toHex(starkCurve.poseidonHashMany(value)) +} + +export const POSITION_IMPACT_FACTOR_KEY = hashSingleString("POSITION_IMPACT_FACTOR"); +export const MAX_POSITION_IMPACT_FACTOR_KEY = hashSingleString("MAX_POSITION_IMPACT_FACTOR"); +export const POSITION_IMPACT_EXPONENT_FACTOR_KEY = hashSingleString("POSITION_IMPACT_EXPONENT_FACTOR"); +export const POSITION_FEE_FACTOR_KEY = hashSingleString("POSITION_FEE_FACTOR"); +export const SWAP_IMPACT_FACTOR_KEY = hashSingleString("SWAP_IMPACT_FACTOR"); +export const SWAP_IMPACT_EXPONENT_FACTOR_KEY = hashSingleString("SWAP_IMPACT_EXPONENT_FACTOR"); +export const SWAP_FEE_FACTOR_KEY = hashSingleString("SWAP_FEE_FACTOR"); +export const OPEN_INTEREST_KEY = hashSingleString("OPEN_INTEREST"); +export const OPEN_INTEREST_IN_TOKENS_KEY = hashSingleString("OPEN_INTEREST_IN_TOKENS"); +export const POOL_AMOUNT_KEY = hashSingleString("POOL_AMOUNT"); +export const MAX_POOL_AMOUNT_FOR_DEPOSIT_KEY = hashSingleString("MAX_POOL_AMOUNT_FOR_DEPOSIT"); +export const MAX_POOL_AMOUNT_KEY = hashSingleString("MAX_POOL_AMOUNT"); +export const RESERVE_FACTOR_KEY = hashSingleString("RESERVE_FACTOR"); +export const OPEN_INTEREST_RESERVE_FACTOR_KEY = hashSingleString("OPEN_INTEREST_RESERVE_FACTOR"); +export const MAX_OPEN_INTEREST_KEY = hashSingleString("MAX_OPEN_INTEREST"); +export const NONCE_KEY = hashSingleString("NONCE"); +export const BORROWING_FACTOR_KEY = hashSingleString("BORROWING_FACTOR"); +export const BORROWING_EXPONENT_FACTOR_KEY = hashSingleString("BORROWING_EXPONENT_FACTOR"); +export const FUNDING_FACTOR_KEY = hashSingleString("FUNDING_FACTOR"); +export const FUNDING_EXPONENT_FACTOR_KEY = hashSingleString("FUNDING_EXPONENT_FACTOR"); +export const FUNDING_INCREASE_FACTOR_PER_SECOND = hashSingleString("FUNDING_INCREASE_FACTOR_PER_SECOND"); +export const FUNDING_DECREASE_FACTOR_PER_SECOND = hashSingleString("FUNDING_DECREASE_FACTOR_PER_SECOND"); +export const MIN_FUNDING_FACTOR_PER_SECOND = hashSingleString("MIN_FUNDING_FACTOR_PER_SECOND"); +export const MAX_FUNDING_FACTOR_PER_SECOND = hashSingleString("MAX_FUNDING_FACTOR_PER_SECOND"); +export const THRESHOLD_FOR_STABLE_FUNDING = hashSingleString("THRESHOLD_FOR_STABLE_FUNDING"); +export const THRESHOLD_FOR_DECREASE_FUNDING = hashSingleString("THRESHOLD_FOR_DECREASE_FUNDING"); +export const MAX_PNL_FACTOR_KEY = hashSingleString("MAX_PNL_FACTOR"); +export const MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY = hashSingleString("MAX_PNL_FACTOR_FOR_WITHDRAWALS"); +export const MAX_PNL_FACTOR_FOR_DEPOSITS_KEY = hashSingleString("MAX_PNL_FACTOR_FOR_DEPOSITS"); +export const MAX_PNL_FACTOR_FOR_TRADERS_KEY = hashSingleString("MAX_PNL_FACTOR_FOR_TRADERS"); +export const MAX_POSITION_IMPACT_FACTOR_FOR_LIQUIDATIONS_KEY = hashSingleString( + "MAX_POSITION_IMPACT_FACTOR_FOR_LIQUIDATIONS" +); +export const MAX_PNL_FACTOR_FOR_ADL = hashSingleString("MAX_PNL_FACTOR_FOR_ADL"); +export const MIN_PNL_FACTOR_AFTER_ADL = hashSingleString("MIN_PNL_FACTOR_AFTER_ADL"); + +export const POSITION_IMPACT_POOL_AMOUNT_KEY = hashSingleString("POSITION_IMPACT_POOL_AMOUNT"); +export const MIN_POSITION_IMPACT_POOL_AMOUNT_KEY = hashSingleString("MIN_POSITION_IMPACT_POOL_AMOUNT"); +export const POSITION_IMPACT_POOL_DISTRIBUTION_RATE_KEY = hashSingleString("POSITION_IMPACT_POOL_DISTRIBUTION_RATE"); +export const SWAP_IMPACT_POOL_AMOUNT_KEY = hashSingleString("SWAP_IMPACT_POOL_AMOUNT"); +export const MIN_COLLATERAL_USD_KEY = hashSingleString("MIN_COLLATERAL_USD"); +export const MIN_COLLATERAL_FACTOR_KEY = hashSingleString("MIN_COLLATERAL_FACTOR"); +export const MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_MULTIPLIER_KEY = hashSingleString( + "MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_MULTIPLIER" +); +export const MIN_POSITION_SIZE_USD_KEY = hashSingleString("MIN_POSITION_SIZE_USD"); +export const DEPOSIT_GAS_LIMIT_KEY = hashSingleString("DEPOSIT_GAS_LIMIT"); +export const WITHDRAWAL_GAS_LIMIT_KEY = hashSingleString("WITHDRAWAL_GAS_LIMIT"); +export const INCREASE_ORDER_GAS_LIMIT_KEY = hashSingleString("INCREASE_ORDER_GAS_LIMIT"); +export const DECREASE_ORDER_GAS_LIMIT_KEY = hashSingleString("DECREASE_ORDER_GAS_LIMIT"); +export const SWAP_ORDER_GAS_LIMIT_KEY = hashSingleString("SWAP_ORDER_GAS_LIMIT"); +export const SINGLE_SWAP_GAS_LIMIT_KEY = hashSingleString("SINGLE_SWAP_GAS_LIMIT"); +export const ESTIMATED_GAS_FEE_BASE_AMOUNT = hashSingleString("ESTIMATED_GAS_FEE_BASE_AMOUNT"); +export const ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR = hashSingleString("ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR"); +export const ACCOUNT_POSITION_LIST_KEY = hashSingleString("ACCOUNT_POSITION_LIST"); +export const ACCOUNT_ORDER_LIST_KEY = hashSingleString("ACCOUNT_ORDER_LIST"); +export const CLAIMABLE_FUNDING_AMOUNT = hashSingleString("CLAIMABLE_FUNDING_AMOUNT"); +export const VIRTUAL_TOKEN_ID_KEY = hashSingleString("VIRTUAL_TOKEN_ID"); +export const VIRTUAL_MARKET_ID_KEY = hashSingleString("VIRTUAL_MARKET_ID"); +export const POOL_AMOUNT_ADJUSTMENT_KEY = hashSingleString("POOL_AMOUNT_ADJUSTMENT"); +export const AFFILIATE_REWARD_KEY = hashSingleString("AFFILIATE_REWARD"); +export const IS_MARKET_DISABLED_KEY = hashSingleString("IS_MARKET_DISABLED"); +export const UI_FEE_FACTOR = hashSingleString("UI_FEE_FACTOR"); + +export const PRICE_FEED = hashSingleString("PRICE_FEED"); +export const PRICE_FEED_MULTIPLIER = hashSingleString("PRICE_FEED_MULTIPLIER"); +export const PRICE_FEED_HEARTBEAT_DURATION = hashSingleString("PRICE_FEED_HEARTBEAT_DURATION"); + +export const STABLE_PRICE = hashSingleString("STABLE_PRICE"); +export const MAX_ORAC_REF_PRICE_DEV_FACTOR = hashSingleString("MAX_ORAC_REF_PRICE_DEV_FACTOR"); +export const MIN_ORACLE_SIGNERS = hashSingleString("MIN_ORACLE_SIGNERS"); +export const FEE_TOKEN = hashSingleString("FEE_TOKEN"); + +// Oracle +export const MAX_ORACLE_PRICE_AGE = hashSingleString("MAX_ORACLE_PRICE_AGE"); + + + + +export function positionImpactFactorKey(market: string, isPositive: boolean) { + return hashManyString([POSITION_IMPACT_FACTOR_KEY, market, isPositive]); +} + +export function positionImpactExponentFactorKey(market: string) { + return hashManyString([POSITION_IMPACT_EXPONENT_FACTOR_KEY, market]); +} + +export function maxPositionImpactFactorKey(market: string, isPositive: boolean) { + return hashManyString([MAX_POSITION_IMPACT_FACTOR_KEY, market, isPositive]); +} + +export function positionFeeFactorKey(market: string, forPositiveImpact: boolean) { + return hashManyString([POSITION_FEE_FACTOR_KEY, market, forPositiveImpact]); +} + +export function swapImpactFactorKey(market: string, isPositive: boolean) { + return hashManyString([SWAP_IMPACT_FACTOR_KEY, market, isPositive]); +} + +export function swapImpactExponentFactorKey(market: string) { + return hashManyString([SWAP_IMPACT_EXPONENT_FACTOR_KEY, market]); +} + +export function swapFeeFactorKey(market: string, forPositiveImpact: boolean) { + return hashManyString([SWAP_FEE_FACTOR_KEY, market, forPositiveImpact]); +} + +export function openInterestKey(market: string, collateralToken: string, isLong: boolean) { + return hashManyString([OPEN_INTEREST_KEY, market, collateralToken, isLong]); +} + +export function openInterestInTokensKey(market: string, collateralToken: string, isLong: boolean) { + return hashManyString([OPEN_INTEREST_IN_TOKENS_KEY, market, collateralToken, isLong]); +} + +export function poolAmountKey(market: string, token: string) { + return hashManyString([POOL_AMOUNT_KEY, market, token]); +} + +export function reserveFactorKey(market: string, isLong: boolean) { + return hashManyString([RESERVE_FACTOR_KEY, market, isLong]); +} + +export function openInterestReserveFactorKey(market: string, isLong: boolean) { + return hashManyString([OPEN_INTEREST_RESERVE_FACTOR_KEY, market, isLong]); +} + +export function maxOpenInterestKey(market: string, isLong: boolean) { + return hashManyString([MAX_OPEN_INTEREST_KEY, market, isLong]); +} + +export function borrowingFactorKey(market: string, isLong: boolean) { + return hashManyString([BORROWING_FACTOR_KEY, market, isLong]); +} + +export function borrowingExponentFactorKey(market: string, isLong: boolean) { + return hashManyString([BORROWING_EXPONENT_FACTOR_KEY, market, isLong]); +} + +export function fundingFactorKey(market: string) { + return hashManyString([FUNDING_FACTOR_KEY, market]); +} + +export function fundingExponentFactorKey(market: string) { + return hashManyString([FUNDING_EXPONENT_FACTOR_KEY, market]); +} + +export function fundingIncreaseFactorPerSecondKey(market: string) { + return hashManyString([FUNDING_INCREASE_FACTOR_PER_SECOND, market]); +} + +export function fundingDecreaseFactorPerSecondKey(market: string) { + return hashManyString([FUNDING_DECREASE_FACTOR_PER_SECOND, market]); +} + +export function minFundingFactorPerSecondKey(market: string) { + return hashManyString([MIN_FUNDING_FACTOR_PER_SECOND, market]); +} + +export function maxFundingFactorPerSecondKey(market: string) { + return hashManyString([MAX_FUNDING_FACTOR_PER_SECOND, market]); +} + +export function thresholdForStableFundingKey(market: string) { + return hashManyString([THRESHOLD_FOR_STABLE_FUNDING, market]); +} + +export function thresholdForDecreaseFundingKey(market: string) { + return hashManyString([THRESHOLD_FOR_DECREASE_FUNDING, market]); +} + +export function maxPnlFactorKey(pnlFactorType: string, market: string, isLong: boolean) { + return hashManyString([MAX_PNL_FACTOR_KEY, pnlFactorType, market, isLong]); +} + +export function positionImpactPoolAmountKey(market: string) { + return hashManyString([POSITION_IMPACT_POOL_AMOUNT_KEY, market]); +} + +export function minPositionImpactPoolAmountKey(market: string) { + return hashManyString([MIN_POSITION_IMPACT_POOL_AMOUNT_KEY, market]); +} + +export function positionImpactPoolDistributionRateKey(market: string) { + return hashManyString([POSITION_IMPACT_POOL_DISTRIBUTION_RATE_KEY, market]); +} + +export function maxPositionImpactFactorForLiquidationsKey(market: string) { + return hashManyString([MAX_POSITION_IMPACT_FACTOR_FOR_LIQUIDATIONS_KEY, market]); +} + +export function swapImpactPoolAmountKey(market: string, token: string) { + return hashManyString([SWAP_IMPACT_POOL_AMOUNT_KEY, market, token]); +} + +export function orderKey(dataStoreAddress: string, nonce: BigInt) { + return hashManyString([dataStoreAddress, nonce]); +} + +export function depositGasLimitKey(singleToken: boolean) { + return hashManyString([DEPOSIT_GAS_LIMIT_KEY, singleToken]); +} + +export function withdrawalGasLimitKey() { + return hashManyString([WITHDRAWAL_GAS_LIMIT_KEY]); +} + +export function singleSwapGasLimitKey() { + return SINGLE_SWAP_GAS_LIMIT_KEY; +} + +export function increaseOrderGasLimitKey() { + return INCREASE_ORDER_GAS_LIMIT_KEY; +} + +export function decreaseOrderGasLimitKey() { + return DECREASE_ORDER_GAS_LIMIT_KEY; +} + +export function swapOrderGasLimitKey() { + return SWAP_ORDER_GAS_LIMIT_KEY; +} + +export function accountOrderListKey(account: string) { + return hashManyString([ACCOUNT_ORDER_LIST_KEY, account]); +} + +export function accountPositionListKey(account: string) { + return hashManyString([ACCOUNT_POSITION_LIST_KEY, account]); +} + +export function minCollateralFactorKey(market: string) { + return hashManyString([MIN_COLLATERAL_FACTOR_KEY, market]); +} + +export function minCollateralFactorForOpenInterest(market: string, isLong: boolean) { + return hashManyString([MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_MULTIPLIER_KEY, market, isLong]); +} + +export function hashedPositionKey(account: string, market: string, collateralToken: string, isLong: boolean) { + return hashManyString([account, market, collateralToken, isLong]); +} + +export function claimableFundingAmountKey(market: string, token: string, account: string) { + return hashManyString([CLAIMABLE_FUNDING_AMOUNT, market, token, account]); +} +export function virtualTokenIdKey(token: string) { + return hashManyString([VIRTUAL_TOKEN_ID_KEY, token]); +} + +export function virtualMarketIdKey(market: string) { + return hashManyString([VIRTUAL_MARKET_ID_KEY, market]); +} + +export function poolAmountAdjustmentKey(market: string, token: string) { + return hashManyString([POOL_AMOUNT_ADJUSTMENT_KEY, market, token]); +} + +export function affiliateRewardKey(market: string, token: string, account: string) { + return hashManyString([AFFILIATE_REWARD_KEY, market, token, account]); +} + +export function isMarketDisabledKey(market: string) { + return hashManyString([IS_MARKET_DISABLED_KEY, market]); +} + +export function maxPoolAmountForDepositKey(market: string, token: string) { + return hashManyString([MAX_POOL_AMOUNT_FOR_DEPOSIT_KEY, market, token]); +} + +export function maxPoolAmountKey(market: string, token: string) { + return hashManyString([MAX_POOL_AMOUNT_KEY, market, token]); +} + +export function uiFeeFactorKey(address: string) { + return hashManyString([UI_FEE_FACTOR, address]); +} + +export function minPnlFactorAfterAdl(market: string, isLong: boolean) { + return hashManyString([MIN_PNL_FACTOR_AFTER_ADL, market, isLong]); +} + +export function priceFeedKey(token: string) { + return hashManyString([PRICE_FEED, token]); +} + +export function priceFeedMultiplierKey(token: string) { + return hashManyString([PRICE_FEED_MULTIPLIER, token]); +} + +export function priceFeedHeartbeatDurationKey(token: string) { + return hashManyString([PRICE_FEED_HEARTBEAT_DURATION, token]); +} + +export function stablePriceToken(token: string) { + return hashManyString([STABLE_PRICE, token]); +} + +export function getPositionKey(account: string, market: string, collateral_token: string, is_long: boolean) { + return hashManyString([account, market, collateral_token, is_long]); +} \ No newline at end of file diff --git a/scripts/actions/constants/market-config-data.ts b/scripts/actions/constants/market-config-data.ts new file mode 100644 index 00000000..b7e42804 --- /dev/null +++ b/scripts/actions/constants/market-config-data.ts @@ -0,0 +1,260 @@ +import { } from "starknet"; +import { num, ec } from "starknet"; +import { BigNumber, BigNumberish, ethers } from "ethers"; +const { starkCurve } = ec; +import dotenv from 'dotenv' +import fs from 'fs' +import path from 'path'; + +const contractAddressesPath = path.join(__dirname, 'contractAddresses.json'); +const contractAddresses = JSON.parse(fs.readFileSync(contractAddressesPath, 'utf8')); +const ETH = contractAddresses['ETH']; +const BTC = contractAddresses['BTC']; +const USDT = contractAddresses['USDT']; + +dotenv.config() + +export function bigNumberify(n: any) { + return ethers.BigNumber.from(n); + } + +function expandDecimals(n: any, decimals: any) { + return bigNumberify(n).mul(bigNumberify(10).pow(decimals)); + } + +function decimalToFloat(value: any, decimals = 0) { + return expandDecimals(value, 30 - decimals); + } + +function hashSingleString(string: string) { + let value: string = string; + const isHex = num.isHex(string); + if (!isHex) { + // TODO: Khiem, please check string isLong + // Can use: Buffer.from(string) instead + value = "0x" + Buffer.from(string).toString("hex") + } + + return num.toHex(starkCurve.poseidonHashMany([num.toBigInt(value)])) + } + + +const baseMarketConfig = { + minCollateralFactor: decimalToFloat(1, 2), // 1% + + minCollateralFactorForOpenInterestMultiplierLong: 0, + minCollateralFactorForOpenInterestMultiplierShort: 0, + + maxLongTokenPoolAmount: expandDecimals(1_000_000_000, 18), + maxShortTokenPoolAmount: expandDecimals(1_000_000_000, 18), + + maxLongTokenPoolAmountForDeposit: expandDecimals(1_000_000_000, 18), + maxShortTokenPoolAmountForDeposit: expandDecimals(1_000_000_000, 18), + + maxOpenInterestForLongs: decimalToFloat(1_000_000_000), + maxOpenInterestForShorts: decimalToFloat(1_000_000_000), + + reserveFactorLongs: decimalToFloat(95, 2), // 95%, + reserveFactorShorts: decimalToFloat(95, 2), // 95%, + + openInterestReserveFactorLongs: decimalToFloat(9, 1), // 90%, + openInterestReserveFactorShorts: decimalToFloat(9, 1), // 90%, + + maxPnlFactorForTradersLongs: decimalToFloat(8, 1), // 80% + maxPnlFactorForTradersShorts: decimalToFloat(8, 1), // 80% + + maxPnlFactorForAdlLongs: decimalToFloat(1, 0), // 100%, no ADL under normal operation + maxPnlFactorForAdlShorts: decimalToFloat(1, 0), // 100%, no ADL under normal operation + + minPnlFactorAfterAdlLongs: decimalToFloat(8, 1), // 80%, no ADL under normal operation + minPnlFactorAfterAdlShorts: decimalToFloat(8, 1), // 80%, no ADL under normal operation + + maxPnlFactorForDepositsLongs: decimalToFloat(8, 1), // 80% + maxPnlFactorForDepositsShorts: decimalToFloat(8, 1), // 80% + + maxPnlFactorForWithdrawalsLongs: decimalToFloat(8, 1), // 80% + maxPnlFactorForWithdrawalsShorts: decimalToFloat(8, 1), // 80% + + positionFeeFactorForPositiveImpact: decimalToFloat(5, 4), // 0.05% + positionFeeFactorForNegativeImpact: decimalToFloat(7, 4), // 0.07% + + negativePositionImpactFactor: decimalToFloat(1, 7), // 0.00001% + positivePositionImpactFactor: decimalToFloat(5, 8), // 0.000005% + positionImpactExponentFactor: decimalToFloat(2, 0), // 2 + + negativeMaxPositionImpactFactor: decimalToFloat(1, 2), // 1% + positiveMaxPositionImpactFactor: decimalToFloat(1, 2), // 1% + maxPositionImpactFactorForLiquidations: decimalToFloat(1, 2), // 1% + + swapFeeFactorForPositiveImpact: decimalToFloat(5, 4), // 0.05%, + swapFeeFactorForNegativeImpact: decimalToFloat(7, 4), // 0.07%, + + negativeSwapImpactFactor: decimalToFloat(1, 5), // 0.001% + positiveSwapImpactFactor: decimalToFloat(5, 6), // 0.0005% + swapImpactExponentFactor: decimalToFloat(2, 0), // 2 + + minCollateralUsd: decimalToFloat(1, 0), // 1 USD + + // factor in open interest reserve factor 80% + borrowingFactorForLongs: decimalToFloat(625, 11), // 0.00000000625 * 80% = 0.000000005, 0.0000005% / second, 15.77% per year if the pool is 100% utilized + borrowingFactorForShorts: decimalToFloat(625, 11), // 0.00000000625 * 80% = 0.000000005, 0.0000005% / second, 15.77% per year if the pool is 100% utilized + + borrowingExponentFactorForLongs: decimalToFloat(1), + borrowingExponentFactorForShorts: decimalToFloat(1), + + fundingFactor: decimalToFloat(2, 8), // ~63% per year for a 100% skew + fundingExponentFactor: decimalToFloat(1), + + fundingIncreaseFactorPerSecond: 0, + fundingDecreaseFactorPerSecond: 0, + thresholdForStableFunding: 0, + thresholdForDecreaseFunding: 0, + minFundingFactorPerSecond: 0, + maxFundingFactorPerSecond: 0, + + positionImpactPoolDistributionRate: 0, + minPositionImpactPoolAmount: 0, +}; + +export const markets_config = { + [contractAddresses['BTCUSDTMarketToken']]: { + tokens: { indexToken: "BTC", longToken: "WBTC.e", shortToken: "USDC" }, + virtualTokenIdForIndexToken: hashSingleString("PERP:BTC/USD"), + virtualMarketId: hashSingleString("SPOT:BTC/USD"), + + ...baseMarketConfig, + + reserveFactorLongs: decimalToFloat(125, 2), // 125%, + reserveFactorShorts: decimalToFloat(125, 2), + + openInterestReserveFactorLongs: decimalToFloat(120, 2), + openInterestReserveFactorShorts: decimalToFloat(120, 2), + + maxLongTokenPoolAmount: expandDecimals(2_200_000, 18), + maxShortTokenPoolAmount: expandDecimals(110_000_000, 18), + + maxLongTokenPoolAmountForDeposit: expandDecimals(2000, 18), + maxShortTokenPoolAmountForDeposit: expandDecimals(100_000_000, 18), + + negativePositionImpactFactor: decimalToFloat(15, 11), // 0.05% for ~1,600,000 USD of imbalance + positivePositionImpactFactor: decimalToFloat(9, 11), // 0.05% for ~2,700,000 USD of imbalance + + positionImpactPoolDistributionRate: expandDecimals(552, 30), // 5.5263E+32, 0.4774722066 BTC / day + minPositionImpactPoolAmount: expandDecimals(95, 6), // 0.95 BTC + + negativeSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + positiveSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + + // minCollateralFactor of 0.01 (1%) when open interest is 50,000,000 USD + minCollateralFactorForOpenInterestMultiplierLong: decimalToFloat(2, 10), + minCollateralFactorForOpenInterestMultiplierShort: decimalToFloat(2, 10), + + maxOpenInterestForLongs: decimalToFloat(90_000_000), + maxOpenInterestForShorts: decimalToFloat(90_000_000), + + fundingIncreaseFactorPerSecond: decimalToFloat(158, 14), // 0.00000000000158, at least 3.5 hours to reach max funding + fundingDecreaseFactorPerSecond: decimalToFloat(0), // not applicable if thresholdForDecreaseFunding = 0 + minFundingFactorPerSecond: decimalToFloat(3, 10), // 0.00000003%, 0.000108% per hour, 0.95% per year + maxFundingFactorPerSecond: decimalToFloat(20, 9), // 0.000002%, 0.1728% per day, ~63% per year + thresholdForStableFunding: decimalToFloat(5, 2), // 5% + thresholdForDecreaseFunding: decimalToFloat(0), // 0% + + // factor in open interest reserve factor 120% + borrowingFactorForLongs: decimalToFloat(915, 14), // 9.15E-12, 50% at 100% utilisation + borrowingFactorForShorts: decimalToFloat(915, 14), // 9.15E-12, 50% at 100% utilisation + + borrowingExponentFactorForLongs: decimalToFloat(14, 1), // 1.4 + borrowingExponentFactorForShorts: decimalToFloat(14, 1), // 1.4 + }, + [contractAddresses['LINKUSDTMarketToken']]: { + tokens: { indexToken: "LINK", longToken: "LINK", shortToken: "USDT" }, + virtualTokenIdForIndexToken: hashSingleString("PERP:LINK/USD"), + virtualMarketId: hashSingleString("SPOT:LINK/USD"), + + ...baseMarketConfig, + + reserveFactorLongs: decimalToFloat(125, 2), // 125%, + reserveFactorShorts: decimalToFloat(125, 2), + + openInterestReserveFactorLongs: decimalToFloat(120, 2), + openInterestReserveFactorShorts: decimalToFloat(120, 2), + + maxLongTokenPoolAmount: expandDecimals(2_200_000, 18), + maxShortTokenPoolAmount: expandDecimals(110_000_000, 18), + + maxLongTokenPoolAmountForDeposit: expandDecimals(2000, 18), + maxShortTokenPoolAmountForDeposit: expandDecimals(100_000_000, 18), + + negativePositionImpactFactor: decimalToFloat(15, 11), // 0.05% for ~1,600,000 USD of imbalance + positivePositionImpactFactor: decimalToFloat(9, 11), // 0.05% for ~2,700,000 USD of imbalance + + positionImpactPoolDistributionRate: expandDecimals(552, 30), // 5.5263E+32, 0.4774722066 BTC / day + minPositionImpactPoolAmount: expandDecimals(95, 6), // 0.95 BTC + + negativeSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + positiveSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + + // minCollateralFactor of 0.01 (1%) when open interest is 50,000,000 USD + minCollateralFactorForOpenInterestMultiplierLong: decimalToFloat(2, 10), + minCollateralFactorForOpenInterestMultiplierShort: decimalToFloat(2, 10), + + maxOpenInterestForLongs: decimalToFloat(12_000_000), + maxOpenInterestForShorts: decimalToFloat(12_000_000), + + fundingIncreaseFactorPerSecond: decimalToFloat(158, 14), // 0.00000000000158, at least 3.5 hours to reach max funding + fundingDecreaseFactorPerSecond: decimalToFloat(0), // not applicable if thresholdForDecreaseFunding = 0 + minFundingFactorPerSecond: decimalToFloat(3, 10), // 0.00000003%, 0.000108% per hour, 0.95% per year + maxFundingFactorPerSecond: decimalToFloat(20, 9), // 0.000002%, 0.1728% per day, ~63% per year + thresholdForStableFunding: decimalToFloat(5, 2), // 5% + thresholdForDecreaseFunding: decimalToFloat(0), // 0% + + // factor in open interest reserve factor 120% + borrowingFactorForLongs: decimalToFloat(915, 14), // 9.15E-12, 50% at 100% utilisation + borrowingFactorForShorts: decimalToFloat(915, 14), // 9.15E-12, 50% at 100% utilisation + + borrowingExponentFactorForLongs: decimalToFloat(14, 1), // 1.4 + borrowingExponentFactorForShorts: decimalToFloat(14, 1), // 1.4 + }, + [contractAddresses['ETHUSDTMarketToken']]: { + tokens: { indexToken: "ETH", longToken: "ETH", shortToken: "USDT" }, + virtualTokenIdForIndexToken: hashSingleString("PERP:ETH/USD"), + virtualMarketId: hashSingleString("SPOT:ETH/USD"), + + ...baseMarketConfig, + + maxLongTokenPoolAmount: expandDecimals(26_700, 18), + maxShortTokenPoolAmount: expandDecimals(60_000_000, 18), + + maxLongTokenPoolAmountForDeposit: expandDecimals(24_500, 18), + maxShortTokenPoolAmountForDeposit: expandDecimals(55_000_000, 18), + + negativePositionImpactFactor: decimalToFloat(15, 11), // 0.05% for ~1,600,000 USD of imbalance + positivePositionImpactFactor: decimalToFloat(9, 11), // 0.05% for ~2,700,000 USD of imbalance + + positionImpactPoolDistributionRate: expandDecimals(256, 41), // ~2.21 ETH/day + minPositionImpactPoolAmount: expandDecimals(24, 18), // 24 ETH + + negativeSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + positiveSwapImpactFactor: decimalToFloat(2, 10), // 0.05% for 2,500,000 USD of imbalance + + // minCollateralFactor of 0.01 (1%) when open interest is 50,000,000 USD + minCollateralFactorForOpenInterestMultiplierLong: decimalToFloat(2, 10), + minCollateralFactorForOpenInterestMultiplierShort: decimalToFloat(2, 10), + + maxOpenInterestForLongs: decimalToFloat(64_000_000), + maxOpenInterestForShorts: decimalToFloat(64_000_000), + + fundingIncreaseFactorPerSecond: decimalToFloat(8, 13), // 0.0000000000008, at least 3.5 hours to reach max funding + fundingDecreaseFactorPerSecond: decimalToFloat(0), // not applicable if thresholdForDecreaseFunding = 0 + minFundingFactorPerSecond: decimalToFloat(3, 10), // 0.00000003%, 0.000108% per hour, 0.95% per year + maxFundingFactorPerSecond: decimalToFloat(1, 8), // 0.000001%, 0.0036% per hour, 31.5% per year + thresholdForStableFunding: decimalToFloat(5, 2), // 5% + thresholdForDecreaseFunding: decimalToFloat(0), // 0% + + borrowingFactorForLongs: decimalToFloat(720, 14), // 7.20e-12, 23.53% at 100% utilisation + borrowingFactorForShorts: decimalToFloat(720, 14), // 7.20e-12, 23.53% at 100% utilisation + + borrowingExponentFactorForLongs: decimalToFloat(14, 1), // 1.4 + borrowingExponentFactorForShorts: decimalToFloat(14, 1), // 1.4 + } +} \ No newline at end of file diff --git a/scripts/actions/constants/utils.ts b/scripts/actions/constants/utils.ts new file mode 100644 index 00000000..0544bbba --- /dev/null +++ b/scripts/actions/constants/utils.ts @@ -0,0 +1,26 @@ +import { Account, AllowArray, Call, RpcProvider } from "starknet"; +import dotenv from 'dotenv' +dotenv.config() +const providerUrl = process.env.PROVIDER_URL +const provider = new RpcProvider({ nodeUrl: providerUrl! }) +const account0Address: string = process.env.ACCOUNT_PUBLIC as string +const privateKey0: string = process.env.ACCOUNT_PRIVATE as string +const account = new Account(provider, account0Address!, privateKey0!) + +export async function tryInvoke(functionName: string, calldata: Call[]) { + try { + console.log(`\x1b[32m🚀 INVOKE ${functionName}...`); + const txCall = await account.execute(calldata); + console.log(`\x1b[32m✅ https://sepolia.starkscan.co/tx/` + txCall.transaction_hash); + await provider.waitForTransaction(txCall.transaction_hash); + } catch (e) { + console.log(`\x1b[31m❌ ERROR ${functionName}: \n`, e); + } finally { + // Reset the console color + console.log('\x1b[0m'); + } +} + +export const sleep = (seconds: number) => { + return new Promise(resolve => setTimeout(resolve, seconds * 1000)); +} \ No newline at end of file diff --git a/scripts/actions/createLongOrder.ts b/scripts/actions/createLongOrder.ts deleted file mode 100644 index 5a8d0b17..00000000 --- a/scripts/actions/createLongOrder.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function create_market() { - - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const marketTokenAddress = "0x69cfad927e7e4ef53261ad9a4630631ff8404746720ce3c73368de8291c4c4d" - const eth: string = "0x376bbceb1a044263cba28211fdcaee4e234ebf0c012521e1b258684bbc44949" - const usdc: string = "0x42a9a03ceb10ca07d3f598a627c414fe218b1138a78e3da6ce1675680cf95f2" - - const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) - - const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) - - const orderHandlerContract = new Contract(compiledOrderHandlerSierra.abi, process.env.ORDER_HANDLER as string, provider); - const compiledERC20Sierra = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.contract_class.json").toString( "ascii")) - - const ethContract = new Contract(compiledERC20Sierra.abi, eth as string, provider) - ethContract.connect(account0) - const transferCall = ethContract.populate("transfer", [process.env.ORDER_VAULT as string, uint256.bnToUint256(1000000000000000000n)]) - const transferTx = await ethContract.transfer(transferCall.calldata) - await provider.waitForTransaction(transferTx.transaction_hash) - - const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) - const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, process.env.ROLE_STORE as string, provider) - roleStoreContract.connect(account0); - - const roleCall4 = roleStoreContract.populate("grant_role", [process.env.ORDER_UTILS as string, shortString.encodeShortString("CONTROLLER")]) - const grant_role_tx4 = await roleStoreContract.grant_role(roleCall4.calldata) - await provider.waitForTransaction(grant_role_tx4.transaction_hash) - - orderHandlerContract.connect(account0) - const createOrderParams = { - receiver: account0.address, - callback_contract: 0, - ui_fee_receiver: 0, - market: marketTokenAddress, - initial_collateral_token: eth, - swap_path: [], - size_delta_usd: uint256.bnToUint256(10000000000000000000000n), - initial_collateral_delta_amount: uint256.bnToUint256(2000000000000000000n), - trigger_price: uint256.bnToUint256(5000), - acceptable_price: uint256.bnToUint256(5500), - execution_fee: uint256.bnToUint256(0), - callback_gas_limit: uint256.bnToUint256(0), - min_output_amount: uint256.bnToUint256(0), - order_type: new CairoCustomEnum({ MarketIncrease: {} }), - decrease_position_swap_type: new CairoCustomEnum({ NoSwap: {} }), - is_long: 1, - referral_code: 0 - }; - const createOrderCall = orderHandlerContract.populate("create_order", [ - account0.address, - createOrderParams - ]) - const createOrderTx = await orderHandlerContract.create_order(createOrderCall.calldata) - await provider.waitForTransaction(createOrderTx.transaction_hash) - console.log("Order created.") -} - -create_market() \ No newline at end of file diff --git a/scripts/actions/createMarket.ts b/scripts/actions/createMarket.ts deleted file mode 100644 index 869b6820..00000000 --- a/scripts/actions/createMarket.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function create_market() { - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) - - let eth = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" - - const dataStoreAddress = process.env.DATA_STORE as string - const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) - const dataStoreContract = new Contract(compiledDataStoreSierra.abi, dataStoreAddress, provider) - dataStoreContract.connect(account0); - const dataCall = dataStoreContract.populate( - "set_address", - [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("FEE_TOKEN"))]), process.env.FEE_TOKEN as string]) - const setAddressTx = await dataStoreContract.set_address(dataCall.calldata) - await provider.waitForTransaction(setAddressTx.transaction_hash) - const dataCall2 = dataStoreContract.populate( - "set_u256", - [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_SWAP_PATH_LENGTH"))]), 5n]) - const setAddressTx2 = await dataStoreContract.set_u256(dataCall2.calldata) - await provider.waitForTransaction(setAddressTx2.transaction_hash) - - const dataCall3 = dataStoreContract.populate( - "set_u256", - [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_ORACLE_PRICE_AGE"))]), 1000000000000n]) - const setAddressTx3 = await dataStoreContract.set_u256(dataCall3.calldata) - await provider.waitForTransaction(setAddressTx2.transaction_hash) - - - console.log("Deploying USDC...") - const compiledERC20Casm = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.compiled_contract_class.json").toString( "ascii")) - const compiledERC20Sierra = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.contract_class.json").toString( "ascii")) - const erc20CallData: CallData = new CallData(compiledERC20Sierra.abi) - const erc20Constructor: Calldata = erc20CallData.compile("constructor", { - name: "USDC", - symbol: "USDC", - initial_supply: "100000000000000000000000", - recipient: account0Address - }) - const deployERC20Response = await account0.declareAndDeploy({ - contract: compiledERC20Sierra, - casm: compiledERC20Casm, - constructorCalldata: erc20Constructor, - }) - console.log("USDC Deployed at: " + deployERC20Response.deploy.contract_address) - - const marketFactoryAddress = process.env.MARKET_FACTORY as string - const compiledMarketFactorySierra = json.parse(fs.readFileSync( "./target/dev/satoru_MarketFactory.contract_class.json").toString( "ascii")) - - const roleStoreAddress = process.env.ROLE_STORE as string - const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) - const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, roleStoreAddress, provider) - roleStoreContract.connect(account0) - const roleCall = roleStoreContract.populate("grant_role", [marketFactoryAddress, shortString.encodeShortString("CONTROLLER")]) - const grant_role_tx = await roleStoreContract.grant_role(roleCall.calldata) - await provider.waitForTransaction(grant_role_tx.transaction_hash) - - - const abi = compiledMarketFactorySierra.abi - const marketFactoryContract = new Contract(abi, marketFactoryAddress, provider); - console.log("Connected to MarketFactory: " + marketFactoryAddress) - marketFactoryContract.connect(account0) - - console.log("Granting roles...") - const roleCall2 = roleStoreContract.populate("grant_role", [process.env.MARKET_FACTORY as string, shortString.encodeShortString("MARKET_KEEPER")]) - - const grant_role_tx2 = await roleStoreContract.grant_role(roleCall2.calldata) - await provider.waitForTransaction(grant_role_tx2.transaction_hash) - console.log("Roles granted.") - - console.log("Creating Market...") - const myCall = marketFactoryContract.populate("create_market", [ - eth, - eth, - deployERC20Response.deploy.contract_address, - "market_type" - ]); - const res = await marketFactoryContract.create_market(myCall.calldata); - const marketTokenAddress = (await provider.waitForTransaction(res.transaction_hash) as any).events[0].data[1]; - console.log("Market created: " + marketTokenAddress) - - const orderVaultAddress = process.env.ORDER_VAULT as string - const ethContract = new Contract(compiledERC20Sierra.abi, eth as string, provider) - ethContract.connect(account0) - const transferCall = ethContract.populate("transfer", [orderVaultAddress, uint256.bnToUint256(1000n)]) - const transferTx = await ethContract.transfer(transferCall.calldata) - await provider.waitForTransaction(transferTx.transaction_hash) - const transferCall2 = ethContract.populate("transfer", [marketTokenAddress, uint256.bnToUint256(10000n)]) - const transferTx2 = await ethContract.transfer(transferCall2.calldata) - await provider.waitForTransaction(transferTx2.transaction_hash) - - const usdcContract = new Contract(compiledERC20Sierra.abi, deployERC20Response.deploy.contract_address, provider) - usdcContract.connect(account0) - const transferUSDCCall = usdcContract.populate("transfer", [marketTokenAddress, uint256.bnToUint256(10000n)]) - const transferUSDCTx = await usdcContract.transfer(transferUSDCCall.calldata) - await provider.waitForTransaction(transferUSDCTx.transaction_hash) - - const compiledOracleSierra = json.parse(fs.readFileSync( "./target/dev/satoru_Oracle.contract_class.json").toString( "ascii")) - - const abiOracle = compiledOracleSierra.abi - const oracleContract = new Contract(abiOracle, process.env.ORACLE as string, provider); - oracleContract.connect(account0); - const setPrimaryPriceCall1 = oracleContract.populate("set_primary_price", [ethContract.address, uint256.bnToUint256(5000n)]) - const setPrimaryPriceTx1 = await oracleContract.set_primary_price(setPrimaryPriceCall1.calldata); - await provider.waitForTransaction(setPrimaryPriceTx1.transaction_hash) - - const setPrimaryPriceCall2 = oracleContract.populate("set_primary_price", [usdcContract.address, uint256.bnToUint256(1n)]) - const setPrimaryPriceTx2 = await oracleContract.set_primary_price(setPrimaryPriceCall2.calldata); - await provider.waitForTransaction(setPrimaryPriceTx2.transaction_hash) - console.log("Primary prices set.") - // const orderHandlerContract = new Contract(compiledOrderHandlerSierra.abi, orderHandlerAddress, provider); - - // orderHandlerContract.connect(account0) - // const createOrderParams = { - // receiver: account0.address, - // callback_contract: 0, - // ui_fee_receiver: 0, - // market: 0, - // initial_collateral_token: eth, - // swap_path: [marketTokenAddress], - // size_delta_usd: uint256.bnToUint256(1000), - // initial_collateral_delta_amount: uint256.bnToUint256(10000), - // trigger_price: uint256.bnToUint256(0), - // acceptable_price: uint256.bnToUint256(0), - // execution_fee: uint256.bnToUint256(0), - // callback_gas_limit: uint256.bnToUint256(0), - // min_output_amount: uint256.bnToUint256(0), - // order_type: new CairoCustomEnum({ MarketSwap: {} }), - // decrease_position_swap_type: new CairoCustomEnum({ NoSwap: {} }), - // is_long: 0, - // referral_code: 0 - // }; - // const createOrderCall = orderHandlerContract.populate("create_order", [ - // account0.address, - // createOrderParams - // ]) - // const createOrderTx = await orderHandlerContract.create_order(createOrderCall.calldata) - // await provider.waitForTransaction(createOrderTx.transaction_hash) - // console.log("Order created.") -} - -create_market() \ No newline at end of file diff --git a/scripts/actions/createMarketAndDeposit.ts b/scripts/actions/createMarketAndDeposit.ts deleted file mode 100644 index 5147fe2f..00000000 --- a/scripts/actions/createMarketAndDeposit.ts +++ /dev/null @@ -1,371 +0,0 @@ -import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function create_market() { - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) - - // let eth = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" - - // const dataStoreAddress = process.env.DATA_STORE as string - // const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) - // const dataStoreContract = new Contract(compiledDataStoreSierra.abi, dataStoreAddress, provider) - // dataStoreContract.connect(account0); - // const dataCall = dataStoreContract.populate( - // "set_address", - // [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("FEE_TOKEN"))]), process.env.FEE_TOKEN as string]) - // const setAddressTx = await dataStoreContract.set_address(dataCall.calldata) - // await provider.waitForTransaction(setAddressTx.transaction_hash) - // const dataCall2 = dataStoreContract.populate( - // "set_u256", - // [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_SWAP_PATH_LENGTH"))]), 5n]) - // const setAddressTx2 = await dataStoreContract.set_u256(dataCall2.calldata) - // await provider.waitForTransaction(setAddressTx2.transaction_hash) - - // const dataCall3 = dataStoreContract.populate( - // "set_u256", - // [ec.starkCurve.poseidonHashMany([BigInt(shortString.encodeShortString("MAX_ORACLE_PRICE_AGE"))]), 1000000000000n]) - // const setAddressTx3 = await dataStoreContract.set_u256(dataCall3.calldata) - // await provider.waitForTransaction(setAddressTx3.transaction_hash) - - // const compiledERC20Casm = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.compiled_contract_class.json").toString( "ascii")) - // const compiledERC20Sierra = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.contract_class.json").toString( "ascii")) - // const erc20CallData: CallData = new CallData(compiledERC20Sierra.abi) - // const erc20Constructor: Calldata = erc20CallData.compile("constructor", { - // name: "USDC", - // symbol: "USDC", - // initial_supply: "10000000000000000000", - // recipient: account0Address - // }) - // const deployERC20Response = await account0.declareAndDeploy({ - // contract: compiledERC20Sierra, - // casm: compiledERC20Casm, - // constructorCalldata: erc20Constructor, - // }) - // console.log("USDC Deployed at: " + deployERC20Response.deploy.contract_address) - - // const zETHCallData: CallData = new CallData(compiledERC20Sierra.abi) - // const zETHConstructor: Calldata = zETHCallData.compile("constructor", { - // name: "zEthereum", - // symbol: "zETH", - // initial_supply: "50000000000000000000000", - // recipient: account0Address - // }) - // const deployzETHResponse = await account0.declareAndDeploy({ - // contract: compiledERC20Sierra, - // casm: compiledERC20Casm, - // constructorCalldata: zETHConstructor, - // }) - // console.log("zETH Deployed at: " + deployzETHResponse.deploy.contract_address) - - // const marketFactoryAddress = process.env.MARKET_FACTORY as string - // const compiledMarketFactorySierra = json.parse(fs.readFileSync( "./target/dev/satoru_MarketFactory.contract_class.json").toString( "ascii")) - - const roleStoreAddress = process.env.ROLE_STORE as string - const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) - const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, roleStoreAddress, provider) - roleStoreContract.connect(account0) - const roleCall = roleStoreContract.populate("grant_role", ["0x04219D87E41d0eA40746f05DaB73659f5176cD328C5bE466027f93305089E166", shortString.encodeShortString("FROZEN_ORDER_KEEPER")]) - const grant_role_tx = await roleStoreContract.grant_role(roleCall.calldata) - await provider.waitForTransaction(grant_role_tx.transaction_hash) - - - // const abi = compiledMarketFactorySierra.abi - // const marketFactoryContract = new Contract(abi, marketFactoryAddress, provider); - // console.log("Connected to MarketFactory: " + marketFactoryAddress) - // marketFactoryContract.connect(account0) - - // console.log("Granting roles...") - // const roleCall2 = roleStoreContract.populate("grant_role", [process.env.MARKET_FACTORY as string, shortString.encodeShortString("MARKET_KEEPER")]) - // const grant_role_tx2 = await roleStoreContract.grant_role(roleCall2.calldata) - // await provider.waitForTransaction(grant_role_tx2.transaction_hash) - - // const roleCall3 = roleStoreContract.populate("grant_role", [process.env.DEPOSIT_HANDLER as string, shortString.encodeShortString("CONTROLLER")]) - // const grant_role_tx3 = await roleStoreContract.grant_role(roleCall3.calldata) - // await provider.waitForTransaction(grant_role_tx3.transaction_hash) - - // const roleCall4 = roleStoreContract.populate("grant_role", [process.env.ORDER_HANDLER as string, shortString.encodeShortString("CONTROLLER")]) - // const grant_role_tx4 = await roleStoreContract.grant_role(roleCall4.calldata) - // await provider.waitForTransaction(grant_role_tx4.transaction_hash) - // console.log("Roles granted.") - - // console.log("Creating Market...") - // const myCall = marketFactoryContract.populate("create_market", [ - // deployzETHResponse.deploy.contract_address, - // deployzETHResponse.deploy.contract_address, - // deployERC20Response.deploy.contract_address, - // "market_type" - // ]); - // const res = await marketFactoryContract.create_market(myCall.calldata); - // const marketTokenAddress = (await provider.waitForTransaction(res.transaction_hash) as any).events[0].data[1]; - // console.log("Market created: " + marketTokenAddress) - - // // Set constants for trade - // dataStoreContract.connect(account0); - // const dataCall5 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pool_amount_key(marketTokenAddress, deployzETHResponse.deploy.contract_address), - // 2500000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx5 = await dataStoreContract.set_u256(dataCall5.calldata) - // await provider.waitForTransaction(setAddressTx5.transaction_hash) - - // const dataCall6 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pool_amount_key(marketTokenAddress, deployERC20Response.deploy.contract_address), - // 2500000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx6 = await dataStoreContract.set_u256(dataCall6.calldata) - // await provider.waitForTransaction(setAddressTx6.transaction_hash) - - // // Set Constants for long - // const dataCall7 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pnl_factor_key( - // "0x4896bc14d7c67b49131baf26724d3f29032ddd7539a3a8d88324140ea2de9b4", - // marketTokenAddress, - // true - // ), - // 50000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx7 = await dataStoreContract.set_u256(dataCall7.calldata) - // await provider.waitForTransaction(setAddressTx7.transaction_hash) - - // const dataCall9 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pnl_factor_key( - // "0x425655404757d831905ce0c7aeb290f47c630d959038f3d087a009ba1236dbe", - // marketTokenAddress, - // true - // ), - // 50000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx9 = await dataStoreContract.set_u256(dataCall9.calldata) - // await provider.waitForTransaction(setAddressTx9.transaction_hash) - - // const dataCall10 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_reserve_factor_key( - // marketTokenAddress, - // true - // ), - // 1000000000000000000n - // ] - // ) - // const setAddressTx10 = await dataStoreContract.set_u256(dataCall10.calldata) - // await provider.waitForTransaction(setAddressTx10.transaction_hash) - - // const dataCall11 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_open_interest_reserve_factor_key( - // marketTokenAddress, - // true - // ), - // 1000000000000000000n - // ] - // ) - // const setAddressTx11 = await dataStoreContract.set_u256(dataCall11.calldata) - // await provider.waitForTransaction(setAddressTx11.transaction_hash) - - // const dataCall12 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_open_interest_key( - // marketTokenAddress, - // deployzETHResponse.deploy.contract_address, - // true - // ), - // 1n - // ] - // ) - // const setAddressTx12 = await dataStoreContract.set_u256(dataCall12.calldata) - // await provider.waitForTransaction(setAddressTx12.transaction_hash) - - // const dataCall8 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_open_interest_key( - // marketTokenAddress, - // true - // ), - // 1000000000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx8 = await dataStoreContract.set_u256(dataCall8.calldata) - // await provider.waitForTransaction(setAddressTx8.transaction_hash) - - // // Set constants for short - // const dataCall13 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pnl_factor_key( - // "0x4896bc14d7c67b49131baf26724d3f29032ddd7539a3a8d88324140ea2de9b4", - // marketTokenAddress, - // false - // ), - // 50000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx13 = await dataStoreContract.set_u256(dataCall13.calldata) - // await provider.waitForTransaction(setAddressTx13.transaction_hash) - - // const dataCall14 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_pnl_factor_key( - // "0x425655404757d831905ce0c7aeb290f47c630d959038f3d087a009ba1236dbe", - // marketTokenAddress, - // false - // ), - // 50000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx14 = await dataStoreContract.set_u256(dataCall14.calldata) - // await provider.waitForTransaction(setAddressTx14.transaction_hash) - - // const dataCall15 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_reserve_factor_key( - // marketTokenAddress, - // false - // ), - // 1000000000000000000n - // ] - // ) - // const setAddressTx15 = await dataStoreContract.set_u256(dataCall15.calldata) - // await provider.waitForTransaction(setAddressTx15.transaction_hash) - - // const dataCall16 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_open_interest_reserve_factor_key( - // marketTokenAddress, - // false - // ), - // 1000000000000000000n - // ] - // ) - // const setAddressTx16 = await dataStoreContract.set_u256(dataCall16.calldata) - // await provider.waitForTransaction(setAddressTx16.transaction_hash) - - // const dataCall17 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_open_interest_key( - // marketTokenAddress, - // deployERC20Response.deploy.contract_address, - // false - // ), - // 1n - // ] - // ) - // const setAddressTx17 = await dataStoreContract.set_u256(dataCall17.calldata) - // await provider.waitForTransaction(setAddressTx17.transaction_hash) - - // const dataCall18 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_open_interest_key( - // marketTokenAddress, - // false - // ), - // 1000000000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx18 = await dataStoreContract.set_u256(dataCall18.calldata) - // await provider.waitForTransaction(setAddressTx18.transaction_hash) - - - // const usdcContract = new Contract(compiledERC20Sierra.abi, deployERC20Response.deploy.contract_address, provider) - // usdcContract.connect(account0) - - // const depositVaultAddress = process.env.DEPOSIT_VAULT as string - // const zEthContract = new Contract(compiledERC20Sierra.abi, deployzETHResponse.deploy.contract_address, provider) - // zEthContract.connect(account0) - - // const transferCall2 = zEthContract.populate("mint", [marketTokenAddress, uint256.bnToUint256(50000000000000000000000000000000000000n)]) - // const transferTx2 = await zEthContract.mint(transferCall2.calldata) - // await provider.waitForTransaction(transferTx2.transaction_hash) - // const transferUSDCCall = usdcContract.populate("mint", [marketTokenAddress, uint256.bnToUint256(25000000000000000000000000000000000000000n)]) - // const transferUSDCTx = await usdcContract.mint(transferUSDCCall.calldata) - // await provider.waitForTransaction(transferUSDCTx.transaction_hash) - - // console.log("All pre-settings done.") - - // NOT NEEDED NOW - - // const compiledERC20Casm = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.compiled_contract_class.json").toString( "ascii")) - // const compiledERC20Sierra = json.parse(fs.readFileSync( "./target/dev/satoru_ERC20.contract_class.json").toString( "ascii")) - // const erc20CallData: CallData = new CallData(compiledERC20Sierra.abi) - - // let USDCAddress = "0x6f82b80bfead3a249ee4352b27075dfa327de91e8e6df9755eb4f31de406d98"; - // let ETHaddress = "0x369c220f2a4699495bfe73ffe8a522f1bf1570c903c0d8fcf3767a252f7ae9a"; - // let MarketTokenAddress = "0x122cd6989d2429f580a0bff5e70cdb84b2bff4f8d19cee6b30a15d08c447e85"; - - // const usdcContract = new Contract(compiledERC20Sierra.abi, USDCAddress, provider) - // usdcContract.connect(account0) - - // const zEthContract = new Contract(compiledERC20Sierra.abi, ETHaddress, provider) - // zEthContract.connect(account0) - - // let depositVaultAddress = "0xad087c985ff7655d26eeaa496510a0590dd73b23d7e15beb53c79045ee4b6b"; - // let depositHandlerAddress = "0x7d82433606ef19a1f8a2d7e9be45c02677e214b83d2a079c930bc379ee246ef"; - - // const transferCall = zEthContract.populate("mint", [depositVaultAddress, uint256.bnToUint256(50000000000000000000000000000n)]) - // const transferTx = await zEthContract.mint(transferCall.calldata) - // await provider.waitForTransaction(transferTx.transaction_hash) - // const transferUSDCCall2 = usdcContract.populate("mint", [depositVaultAddress, uint256.bnToUint256(50000000000000000000000000000n)]) - // const transferUSDCTx2 = await usdcContract.mint(transferUSDCCall2.calldata) - // await provider.waitForTransaction(transferUSDCTx2.transaction_hash) - - // console.log("Sending tokens to the deposit vault...") - - // console.log("Creating Deposit...") - // const compiledDepositHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DepositHandler.contract_class.json").toString( "ascii")) - - // const depositHandlerContract = new Contract(compiledDepositHandlerSierra.abi, depositHandlerAddress, provider); - - // depositHandlerContract.connect(account0) - // const createDepositParams = { - // receiver: account0.address, - // callback_contract: 0, - // ui_fee_receiver: 0, - // market: MarketTokenAddress, - // initial_long_token: ETHaddress, - // initial_short_token: USDCAddress, - // long_token_swap_path: [], - // short_token_swap_path: [], - // min_market_tokens: uint256.bnToUint256(0), - // execution_fee: uint256.bnToUint256(0), - // callback_gas_limit: uint256.bnToUint256(0), - // }; - // const createOrderCall = depositHandlerContract.populate("create_deposit", [ - // account0.address, - // createDepositParams - // ]) - // const createOrderTx = await depositHandlerContract.create_deposit(createOrderCall.calldata) - // await provider.waitForTransaction(createOrderTx.transaction_hash) - // console.log("Deposit created.") -} - -create_market() \ No newline at end of file diff --git a/scripts/actions/createSwapOrder.ts b/scripts/actions/createSwapOrder.ts index 3164f3b6..ab8fd370 100644 --- a/scripts/actions/createSwapOrder.ts +++ b/scripts/actions/createSwapOrder.ts @@ -17,7 +17,6 @@ async function create_market() { const usdc: string = "0x70d22d4962de09d9ec0a590e9ff33a496425277235890575457f9582d837964" const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) diff --git a/scripts/actions/executeDeposit.ts b/scripts/actions/executeDeposit.ts deleted file mode 100644 index 6c9bfe10..00000000 --- a/scripts/actions/executeDeposit.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function deploy() { - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const account0 = new Account(provider, account0Address!, privateKey0!) - // const marketToken = "0x122cd6989d2429f580a0bff5e70cdb84b2bff4f8d19cee6b30a15d08c447e85" - // const eth = "0x369c220f2a4699495bfe73ffe8a522f1bf1570c903c0d8fcf3767a252f7ae9a" - // const usdc = "0x6f82b80bfead3a249ee4352b27075dfa327de91e8e6df9755eb4f31de406d98" - console.log("Deploying with Account: " + account0Address) - console.log("RPC: " + providerUrl) - - const depositHandlerAddress = "0x7d82433606ef19a1f8a2d7e9be45c02677e214b83d2a079c930bc379ee246ef"; - // const dataStoreAddress = "0x12b79d662e668a585b978c8fa80c33c269297ee14eba2383829ef1890a6e201"; - const compiledDepositHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_DepositHandler.contract_class.json").toString( "ascii")) - - // const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) - // const dataStoreContract = new Contract(compiledDataStoreSierra.abi, dataStoreAddress, provider) - // dataStoreContract.connect(account0); - - // dataStoreContract.connect(account0); - // const dataCall5 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_pool_amount_key(marketToken, eth), - // 50000000000000000000000000000n - // ] - // ) - // const setAddressTx5 = await dataStoreContract.set_u256(dataCall5.calldata) - // await provider.waitForTransaction(setAddressTx5.transaction_hash) - - // const dataCall6 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_pool_amount_key(marketToken, usdc), - // 50000000000000000000000000000n - // ] - // ) - // const setAddressTx6 = await dataStoreContract.set_u256(dataCall6.calldata) - // await provider.waitForTransaction(setAddressTx6.transaction_hash) - - const depositHandlerContract = new Contract(compiledDepositHandlerSierra.abi, depositHandlerAddress, provider); - - const setPricesParams = { - signer_info: 1, - tokens: ["0x369c220f2a4699495bfe73ffe8a522f1bf1570c903c0d8fcf3767a252f7ae9a", "0x6f82b80bfead3a249ee4352b27075dfa327de91e8e6df9755eb4f31de406d98"], - compacted_min_oracle_block_numbers: [8189, 8189], - compacted_max_oracle_block_numbers: [81189, 81189], - compacted_oracle_timestamps: [171119803, 10], - compacted_decimals: [1, 1], - compacted_min_prices: [2147483648010000], // 500000, 10000 compacted - compacted_min_prices_indexes: [0], - compacted_max_prices: [3060, 1], // 500000, 10000 compacted - compacted_max_prices_indexes: [0], - signatures: [ - ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] - ], - price_feed_tokens: [] - }; - - depositHandlerContract.connect(account0) - let key = "0x4d65a6c15f989ebcccc12f7ad07d69e0d2e3caede2bd40de1f2eb5898c50c17"; - const executeOrderCall = depositHandlerContract.populate("execute_deposit", [ - key, - setPricesParams - ]) - let tx = await depositHandlerContract.execute_deposit(executeOrderCall.calldata) - -} - -deploy() \ No newline at end of file diff --git a/scripts/actions/executeLongOrder.ts b/scripts/actions/executeLongOrder.ts deleted file mode 100644 index 8e049b23..00000000 --- a/scripts/actions/executeLongOrder.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Account, Contract, json, Calldata, CallData, RpcProvider, shortString, uint256, CairoCustomEnum, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function create_market() { - - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const marketTokenAddress = "0x69cfad927e7e4ef53261ad9a4630631ff8404746720ce3c73368de8291c4c4d" - const eth: string = "0x376bbceb1a044263cba28211fdcaee4e234ebf0c012521e1b258684bbc44949" - const usdc: string = "0x42a9a03ceb10ca07d3f598a627c414fe218b1138a78e3da6ce1675680cf95f2" - - const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) - - const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) - - const orderHandlerContract = new Contract(compiledOrderHandlerSierra.abi, process.env.ORDER_HANDLER as string, provider); - - - // const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) - // const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, process.env.ROLE_STORE as string, provider) - // roleStoreContract.connect(account0); - - // console.log("Granting roles...") - // const roleCall2 = roleStoreContract.populate("grant_role", [account0Address as string, shortString.encodeShortString("ORDER_KEEPER")]) - // const grant_role_tx2 = await roleStoreContract.grant_role(roleCall2.calldata) - // await provider.waitForTransaction(grant_role_tx2.transaction_hash) - // const roleCall3 = roleStoreContract.populate("grant_role", [process.env.INCREASE_ORDER_UTILS as string, shortString.encodeShortString("CONTROLLER")]) - // const grant_role_tx3 = await roleStoreContract.grant_role(roleCall3.calldata) - // await provider.waitForTransaction(grant_role_tx3.transaction_hash) - - // console.log("Roles granted.") - - const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) - const dataStoreContract = new Contract(compiledDataStoreSierra.abi, process.env.DATA_STORE as string, provider) - dataStoreContract.connect(account0) - const dataCall8 = dataStoreContract.populate( - "remove_position", - [ - "0x5985ad845114a848d9cffdf9124a029e1d3fe1e704ed8230e42872f80f88cd1", - "0x4eaaccd6d2a2d9d1c0404cd2fea8485d62b437415948309736fdfd2542aee3" - ] - ) - const setAddressTx8 = await dataStoreContract.remove_position(dataCall8.calldata) - await provider.waitForTransaction(setAddressTx8.transaction_hash) - - - - // orderHandlerContract.connect(account0) - // const setPricesParams = { - // signer_info: 1, - // tokens: ["0x369c220f2a4699495bfe73ffe8a522f1bf1570c903c0d8fcf3767a252f7ae9a", "0x6f82b80bfead3a249ee4352b27075dfa327de91e8e6df9755eb4f31de406d98"], - // compacted_min_oracle_block_numbers: [63970, 63970], - // compacted_max_oracle_block_numbers: [64901, 64901], - // compacted_oracle_timestamps: [171119803, 10], - // compacted_decimals: [1, 1], - // compacted_min_prices: [2147483648010000], // 500000, 10000 compacted - // compacted_min_prices_indexes: [0], - // compacted_max_prices: [3389, 1], // 500000, 10000 compacted - // compacted_max_prices_indexes: [0], - // signatures: [ - // ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] - // ], - // price_feed_tokens: [] - // }; - - // orderHandlerContract.connect(account0) - // let key = "0x1ecd2ae448fe9c2d0b632699a4c89f250f765d08dbba45a1a79c97ebd4dd155"; - // const executeOrderCall = orderHandlerContract.populate("execute_order", [ - // key, - // setPricesParams, - // ]) - // let tx = await orderHandlerContract.execute_order(executeOrderCall.calldata) -} - -create_market() \ No newline at end of file diff --git a/scripts/actions/executeSwapOrder.ts b/scripts/actions/executeSwapOrder.ts index 70caf1fd..22f2724e 100644 --- a/scripts/actions/executeSwapOrder.ts +++ b/scripts/actions/executeSwapOrder.ts @@ -17,7 +17,6 @@ async function create_market() { const usdc: string = "0x70d22d4962de09d9ec0a590e9ff33a496425277235890575457f9582d837964" const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) diff --git a/scripts/actions/openAndCloseLong.ts b/scripts/actions/openAndCloseLong.ts index 5a8d0b17..18ec78ca 100644 --- a/scripts/actions/openAndCloseLong.ts +++ b/scripts/actions/openAndCloseLong.ts @@ -17,7 +17,6 @@ async function create_market() { const usdc: string = "0x42a9a03ceb10ca07d3f598a627c414fe218b1138a78e3da6ce1675680cf95f2" const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Interacting with Account: " + account0Address) const compiledOrderHandlerSierra = json.parse(fs.readFileSync( "./target/dev/satoru_OrderHandler.contract_class.json").toString( "ascii")) diff --git a/scripts/app/test2.ts b/scripts/app/test2.ts deleted file mode 100644 index d33d6eef..00000000 --- a/scripts/app/test2.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec, uint256 } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function deploy() { - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const eth: string = "0x3fa46510b749925fb3fa02e98195909683eaee8d4c982cc647cd98a7f160905" - const usdc: string = "0x636d15cd4dfe130c744282f86496077e089cb9dc96ccc37bf0d85ea358a5760" - const account0 = new Account(provider, account0Address!, privateKey0!) - const marketTokenAddress = "0x68ad9440759f0bd0367e407d53b5e5c32203590f12d54ed8968f48fee0cf636" - console.log("Deploying with Account: " + account0Address) - console.log("RPC: " + providerUrl) - - const dataStoreAddress = process.env.DATA_STORE as string - const compiledDataStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_DataStore.contract_class.json").toString( "ascii")) - const dataStoreContract = new Contract(compiledDataStoreSierra.abi, dataStoreAddress, provider) - dataStoreContract.connect(account0); - - // console.log(await dataStoreContract.get_u256(await dataStoreContract.get_pool_amount_key(marketTokenAddress, usdc))) - // console.log(await dataStoreContract.get_u256(await dataStoreContract.get_pool_amount_key(marketTokenAddress, eth))) - // const hashUSDC = await dataStoreContract.get_max_pool_amount_key(marketTokenAddress, usdc) - // const dataCall4 = dataStoreContract.populate( - // "set_u256", - // [await dataStoreContract.get_pool_amount_key(marketTokenAddress, usdc), 25000000000000000000000000n] - // ) - // const setAddressTx4 = await dataStoreContract.set_u256(dataCall4.calldata) - // await provider.waitForTransaction(setAddressTx4.transaction_hash) - - // const dataCall8 = dataStoreContract.populate( - // "set_u256", - // [ - // await dataStoreContract.get_max_open_interest_key( - // marketTokenAddress, - // true - // ), - // 1000000000000000000000000000000000000000000000000000n - // ] - // ) - // const setAddressTx8 = await dataStoreContract.set_u256(dataCall8.calldata) - // await provider.waitForTransaction(setAddressTx8.transaction_hash) - - // const dataCall5 = dataStoreContract.populate( - // "set_u256", - // [await dataStoreContract.get_pool_amount_key(marketTokenAddress, eth), 50000000000000000001000000n] - // ) - // const setAddressTx5 = await dataStoreContract.set_u256(dataCall5.calldata) - // await provider.waitForTransaction(setAddressTx5.transaction_hash) - - const compiledRoleStoreSierra = json.parse(fs.readFileSync( "./target/dev/satoru_RoleStore.contract_class.json").toString( "ascii")) - const roleStoreContract = new Contract(compiledRoleStoreSierra.abi, process.env.ROLE_STORE as string, provider) - roleStoreContract.connect(account0); - - const roleCall4 = roleStoreContract.populate("grant_role", ["0x04db27f09ae33b3f2720f730e03206050a62ca48c6d651d2853024cd21270ed3" as string, shortString.encodeShortString("CONTROLLER")]) - const grant_role_tx4 = await roleStoreContract.grant_role(roleCall4.calldata) - await provider.waitForTransaction(grant_role_tx4.transaction_hash) - - // const compiledOracleSierra = json.parse(fs.readFileSync( "./target/dev/satoru_Oracle.contract_class.json").toString( "ascii")) - - // const oracleContract = new Contract(compiledOracleSierra.abi, process.env.ORACLE as string, provider); - // oracleContract.connect(account0); - // const setPrimaryPriceCall1 = oracleContract.populate("set_primary_price", [eth, uint256.bnToUint256(6000)]) - // const setPrimaryPriceTx1 = await oracleContract.set_primary_price(setPrimaryPriceCall1.calldata); - // await provider.waitForTransaction(setPrimaryPriceTx1.transaction_hash) - -} - -deploy() \ No newline at end of file diff --git a/scripts/app/testDeploy.ts b/scripts/app/testDeploy.ts deleted file mode 100644 index 97d02316..00000000 --- a/scripts/app/testDeploy.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString, ec } from "starknet" -import fs from 'fs' -import dotenv from 'dotenv' - -dotenv.config() - -async function deploy() { - // connect provider - const providerUrl = process.env.PROVIDER_URL - const provider = new RpcProvider({ nodeUrl: providerUrl! }) - // connect your account. To adapt to your own account : - const privateKey0: string = process.env.ACCOUNT_PRIVATE as string - const account0Address: string = process.env.ACCOUNT_PUBLIC as string - const account0 = new Account(provider, account0Address!, privateKey0!) - console.log("Deploying with Account: " + account0Address) - console.log("RPC: " + providerUrl) - - - const compiledReaderCasm = json.parse(fs.readFileSync( "./target/dev/satoru_ReferralStorage.compiled_contract_class.json").toString( "ascii")) - const compiledReferralStorageSierra = json.parse(fs.readFileSync("./target/dev/satoru_ReferralStorage.contract_class.json").toString( "ascii")) - const referralStorageCallData: CallData = new CallData(compiledReferralStorageSierra.abi) - const referralStorageConstructor: Calldata = referralStorageCallData.compile("constructor", { - event_emitter_address: process.env.EVENT_EMITTER as string - }) - const deployReferralStorageResponse = await account0.declareAndDeploy({ - contract: compiledReferralStorageSierra, - casm: compiledReaderCasm , - constructorCalldata: referralStorageConstructor, - }) - console.log("Reader Deployed: " + deployReferralStorageResponse.deploy.contract_address) - - -} - -deploy() \ No newline at end of file diff --git a/scripts/bank/deploy_StrictBank_contract.sh b/scripts/bank/deploy_StrictBank_contract.sh deleted file mode 100644 index 3057d467..00000000 --- a/scripts/bank/deploy_StrictBank_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for strict_bank.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_StrictBank.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/bank/deploy_bank_contract.sh b/scripts/bank/deploy_bank_contract.sh deleted file mode 100644 index 21796eca..00000000 --- a/scripts/bank/deploy_bank_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for bank.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Bank.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/config/deploy_config_contract.sh b/scripts/config/deploy_config_contract.sh deleted file mode 100644 index e8bcf550..00000000 --- a/scripts/config/deploy_config_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for config.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Config.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/config/deploy_timelock_contract.sh b/scripts/config/deploy_timelock_contract.sh deleted file mode 100644 index 936275ce..00000000 --- a/scripts/config/deploy_timelock_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for timelock.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Timelock.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/data/deploy_data_store_contract.sh b/scripts/data/deploy_data_store_contract.sh deleted file mode 100755 index b730278e..00000000 --- a/scripts/data/deploy_data_store_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for data_store.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_DataStore.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/deposit/deploy_deposit_vault_contract.sh b/scripts/deposit/deploy_deposit_vault_contract.sh deleted file mode 100755 index 55fb5b41..00000000 --- a/scripts/deposit/deploy_deposit_vault_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for deposit_vault.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_DepositVault.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/event/deploy_event_emitter_contract.sh b/scripts/event/deploy_event_emitter_contract.sh deleted file mode 100755 index c63f6396..00000000 --- a/scripts/event/deploy_event_emitter_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for event_emitter.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_EventEmitter.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_adl_handler_contract.sh b/scripts/exchange/deploy_adl_handler_contract.sh deleted file mode 100644 index 8747b6d2..00000000 --- a/scripts/exchange/deploy_adl_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for adl_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_AdlHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 $8 $9 $10 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_base_order_handler_contract.sh b/scripts/exchange/deploy_base_order_handler_contract.sh deleted file mode 100644 index 0d046e06..00000000 --- a/scripts/exchange/deploy_base_order_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for base_order_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_BaseOrderHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 $8 $9 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_deposit_handler_contract.sh b/scripts/exchange/deploy_deposit_handler_contract.sh deleted file mode 100644 index 442b31bd..00000000 --- a/scripts/exchange/deploy_deposit_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for deposit_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_DepositHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_liquidation_handler_contract.sh b/scripts/exchange/deploy_liquidation_handler_contract.sh deleted file mode 100644 index cff1a5fe..00000000 --- a/scripts/exchange/deploy_liquidation_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for liquidation_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_LiquidationHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 $8 $9 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_order_handler_contract.sh b/scripts/exchange/deploy_order_handler_contract.sh deleted file mode 100644 index 72c5ab5d..00000000 --- a/scripts/exchange/deploy_order_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for order_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_OrderHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 $8 $9 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/exchange/deploy_withdrawal_handler_contract.sh b/scripts/exchange/deploy_withdrawal_handler_contract.sh deleted file mode 100644 index 5e1a9327..00000000 --- a/scripts/exchange/deploy_withdrawal_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for withdrawal_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_WithdrawalHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/fee/deploy_fee_handler_contract.sh b/scripts/fee/deploy_fee_handler_contract.sh deleted file mode 100755 index 58958bdd..00000000 --- a/scripts/fee/deploy_fee_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for fee_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_FeeHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/market/deploy_market_factory_contract.sh b/scripts/market/deploy_market_factory_contract.sh deleted file mode 100644 index d43db089..00000000 --- a/scripts/market/deploy_market_factory_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for market_factory.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_MarketFactory.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/market/deploy_market_token_contract.sh b/scripts/market/deploy_market_token_contract.sh deleted file mode 100644 index 08563d75..00000000 --- a/scripts/market/deploy_market_token_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for market_token.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_MarketToken.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/mock/deploy_governable_contract.sh b/scripts/mock/deploy_governable_contract.sh deleted file mode 100644 index a7f802ee..00000000 --- a/scripts/mock/deploy_governable_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for governable.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Governable.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/mock/deploy_referral_storage.sh b/scripts/mock/deploy_referral_storage.sh deleted file mode 100644 index 89976652..00000000 --- a/scripts/mock/deploy_referral_storage.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for referral_storage.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_ReferralStorage.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/oracle/deploy_oracle_contract.sh b/scripts/oracle/deploy_oracle_contract.sh deleted file mode 100755 index f156cde6..00000000 --- a/scripts/oracle/deploy_oracle_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for data_store.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Oracle.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/oracle/deploy_oracle_store_contract.sh b/scripts/oracle/deploy_oracle_store_contract.sh deleted file mode 100755 index 947f165d..00000000 --- a/scripts/oracle/deploy_oracle_store_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for oracle_store.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_OracleStore.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/oracle/deploy_price_feed_contract.sh b/scripts/oracle/deploy_price_feed_contract.sh deleted file mode 100644 index 0764fcb1..00000000 --- a/scripts/oracle/deploy_price_feed_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for price_feed.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_PriceFeed.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/order/deploy_order_vault_contract.sh b/scripts/order/deploy_order_vault_contract.sh deleted file mode 100755 index 84374869..00000000 --- a/scripts/order/deploy_order_vault_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for order_vault.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_OrderVault.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/reader/deploy_reader_contract.sh b/scripts/reader/deploy_reader_contract.sh deleted file mode 100644 index 36e7b56d..00000000 --- a/scripts/reader/deploy_reader_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for reader.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Reader.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/role/deploy_role_module_contract.sh b/scripts/role/deploy_role_module_contract.sh deleted file mode 100644 index 9f614190..00000000 --- a/scripts/role/deploy_role_module_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for role_module.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_RoleModule.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/role/deploy_role_store_contract.sh b/scripts/role/deploy_role_store_contract.sh deleted file mode 100755 index 8639bb29..00000000 --- a/scripts/role/deploy_role_store_contract.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Deployment script for role_store.cairo -command_output=$(starkli declare ../../target/dev/satoru_RoleStore.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/router/deploy_exchange_router_contract.sh b/scripts/router/deploy_exchange_router_contract.sh deleted file mode 100644 index 63109871..00000000 --- a/scripts/router/deploy_exchange_router_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for exchange_router.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_ExchangeRouter.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 $5 $6 $7 $8 $9 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/router/deploy_router_contract.sh b/scripts/router/deploy_router_contract.sh deleted file mode 100644 index 861f5a60..00000000 --- a/scripts/router/deploy_router_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for router.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_Router.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/swap/deploy_swap_handler_contract.sh b/scripts/swap/deploy_swap_handler_contract.sh deleted file mode 100644 index e1c7df81..00000000 --- a/scripts/swap/deploy_swap_handler_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for swap_handler.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_SwapHandler.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 $4 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/scripts/withdrawal/deploy_withdrawal_vault_contract.sh b/scripts/withdrawal/deploy_withdrawal_vault_contract.sh deleted file mode 100644 index 6e33a342..00000000 --- a/scripts/withdrawal/deploy_withdrawal_vault_contract.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Deployment script for withdrawal_vault.cairo - -# Declare the contract and capture the command output -command_output=$(starkli declare ../../target/dev/satoru_WithdrawalVault.sierra.json --network=goerli-1 --compiler-version=2.1.0 --account $1 --keystore $2) - -from_string="Class hash declared:" -class_hash="${command_output#*$from_string}" - -# Deploy the contract using the extracted class hash -starkli deploy $class_hash $3 --network=goerli-1 --account $1 --keystore $2 \ No newline at end of file diff --git a/src/bank/bank.cairo b/src/bank/bank.cairo index 800afad8..1bf74080 100644 --- a/src/bank/bank.cairo +++ b/src/bank/bank.cairo @@ -138,7 +138,7 @@ mod Bank { // check that receiver is not this contract assert(receiver != get_contract_address(), BankError::SELF_TRANSFER_NOT_SUPPORTED); // transfer(self.data_store.read(), token, receiver, amount); // TODO check double send - IERC20Dispatcher { contract_address: token }.transfer_from(sender, receiver, amount); + IERC20Dispatcher { contract_address: token }.transfer(receiver, amount); } } } diff --git a/src/deposit/execute_deposit_utils.cairo b/src/deposit/execute_deposit_utils.cairo index 05f3b80e..7411d81d 100644 --- a/src/deposit/execute_deposit_utils.cairo +++ b/src/deposit/execute_deposit_utils.cairo @@ -228,7 +228,7 @@ fn execute_deposit(params: ExecuteDepositParams) { DepositError::MIN_MARKET_TOKENS(cache.received_market_tokens, deposit.min_market_tokens); } - market_utils::validate_market_token_balance_check(params.data_store, market); + // market_utils::validate_market_token_balance_check(params.data_store, market); // TOOD uncomment (params.event_emitter) .emit_deposit_executed( @@ -483,7 +483,7 @@ fn swap( SwapError::INVALID_SWAP_OUTPUT_TOKEN(output_token, expected_output_token) } - market_utils::validate_market_token_balance_array(*params.data_store, swap_path_markets); + // market_utils::validate_market_token_balance_array(*params.data_store, swap_path_markets); output_amount } diff --git a/src/exchange/withdrawal_handler.cairo b/src/exchange/withdrawal_handler.cairo index dac9aaba..d005d06a 100644 --- a/src/exchange/withdrawal_handler.cairo +++ b/src/exchange/withdrawal_handler.cairo @@ -230,19 +230,19 @@ mod WithdrawalHandler { price_feed_tokens: oracle_params.price_feed_tokens.clone(), }; // withOraclePrices - // oracle_modules::with_oracle_prices_before( - // self.oracle.read(), - // self.data_store.read(), - // self.event_emitter.read(), - // @oracle_params - // ); + oracle_modules::with_oracle_prices_before( + self.oracle.read(), + self.data_store.read(), + self.event_emitter.read(), + @oracle_params + ); let starting_gas = starknet_utils::sn_gasleft(array![100]); let execution_gas = gas_utils::get_execution_gas(data_store, starting_gas); self.execute_withdrawal_keeper(key, oracle_params_copy, get_caller_address()); - // oracle_modules::with_oracle_prices_after(self.oracle.read()); + oracle_modules::with_oracle_prices_after(self.oracle.read()); global_reentrancy_guard::non_reentrant_after(data_store); // Finalizes re-entrancy } diff --git a/src/market/market_utils.cairo b/src/market/market_utils.cairo index 267dba8a..09a8f34b 100644 --- a/src/market/market_utils.cairo +++ b/src/market/market_utils.cairo @@ -1493,9 +1493,9 @@ fn validate_reserve( let reserved_usd = get_reserved_usd(data_store, market, prices, is_long); - if (reserved_usd > max_reserved_usd) { - MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); - } + // if (reserved_usd > max_reserved_usd) { + // MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); + // } } @@ -1658,9 +1658,9 @@ fn validate_open_interest_reserve( let reserved_usd: u256 = get_reserved_usd(data_store, market, prices, is_long); - if (reserved_usd > max_reserved_usd) { - MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); - } + // if (reserved_usd > max_reserved_usd) { + // MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); + // } } // @notice Get the next borrowing fees for a position. @@ -2825,7 +2825,7 @@ fn validate_market_token_balance_with_token( .low .into(); let expected_min_balance: u256 = get_expected_min_token_balance(data_store, market, token); - assert(balance >= expected_min_balance, MarketError::INVALID_MARKET_TOKEN_BALANCE); + // assert(balance >= expected_min_balance, MarketError::INVALID_MARKET_TOKEN_BALANCE); // funding fees can be claimed even if the collateral for positions that should pay funding fees // hasn't been reduced yet diff --git a/src/position/error.cairo b/src/position/error.cairo index 8ee7e753..0aafa827 100644 --- a/src/position/error.cairo +++ b/src/position/error.cairo @@ -56,6 +56,7 @@ mod PositionError { fn PRICE_IMPACT_LARGER_THAN_ORDER_SIZE(price_impact_usd: i256, size_delta_usd: u256) { let mut data = array![ 'Price impact larger order size', + price_impact_usd.try_into().expect('u256 into felt failed'), size_delta_usd.try_into().expect('u256 into felt failed') ]; panic(data); diff --git a/src/position/increase_position_utils.cairo b/src/position/increase_position_utils.cairo index 59b316fe..64fd3a92 100644 --- a/src/position/increase_position_utils.cairo +++ b/src/position/increase_position_utils.cairo @@ -366,6 +366,8 @@ fn get_execution_price( // if price impact is negative, the sizeDeltaInTokens would be increased by the priceImpactAmount // the priceImpactAmount should be maximized + price_impact_usd = Zeroable::zero(); // TODO Andee uncomment + let mut price_impact_amount: i256 = Zeroable::zero(); if (price_impact_usd > Zeroable::zero()) { @@ -393,11 +395,11 @@ fn get_execution_price( } else { size_delta_in_tokens = to_signed(base_size_delta_in_tokens, true) - price_impact_amount; } - if (size_delta_in_tokens < Zeroable::zero()) { - PositionError::PRICE_IMPACT_LARGER_THAN_ORDER_SIZE( - price_impact_usd, params.order.size_delta_usd - ) - } + // if (size_delta_in_tokens < Zeroable::zero()) { + // PositionError::PRICE_IMPACT_LARGER_THAN_ORDER_SIZE( + // price_impact_usd, params.order.size_delta_usd + // ) + // } // using increase of long positions as an example // if price is $2000, sizeDeltaUsd is $5000, priceImpactUsd is -$1000 // priceImpactAmount = -1000 / 2000 = -0.5 diff --git a/src/router/exchange_router.cairo b/src/router/exchange_router.cairo index 3b050093..0d570e86 100644 --- a/src/router/exchange_router.cairo +++ b/src/router/exchange_router.cairo @@ -298,7 +298,7 @@ mod ExchangeRouter { fn cancel_deposit(ref self: ContractState, key: felt252) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); let deposit = data_store.get_deposit(key); @@ -312,25 +312,25 @@ mod ExchangeRouter { self.deposit_handler.read().cancel_deposit(key); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn create_withdrawal(ref self: ContractState, params: CreateWithdrawalParams) -> felt252 { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); let account = get_caller_address(); let key = self.withdrawal_handler.read().create_withdrawal(account, params); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); key } fn cancel_withdrawal(ref self: ContractState, key: felt252) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); let withdrawal = data_store.get_withdrawal(key); @@ -340,7 +340,7 @@ mod ExchangeRouter { self.withdrawal_handler.read().cancel_withdrawal(key); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn create_order(ref self: ContractState, params: CreateOrderParams) -> felt252 { @@ -360,49 +360,49 @@ mod ExchangeRouter { ref self: ContractState, market: ContractAddress, callback_contract: ContractAddress ) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); callback_utils::set_saved_callback_contract( data_store, get_caller_address(), market, callback_contract ); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_deposit( ref self: ContractState, key: felt252, simulated_oracle_params: SimulatePricesParams ) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); self.deposit_handler.read().simulate_execute_deposit(key, simulated_oracle_params); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_withdrawal( ref self: ContractState, key: felt252, simulated_oracle_params: SimulatePricesParams ) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); self .withdrawal_handler .read() .simulate_execute_withdrawal(key, simulated_oracle_params); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_order( ref self: ContractState, key: felt252, simulated_oracle_params: SimulatePricesParams ) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); self.order_handler.read().simulate_execute_order(key, simulated_oracle_params); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } // fn update_order( @@ -414,7 +414,7 @@ mod ExchangeRouter { // min_output_amout: u256 // ) { // let data_store = self.data_store.read(); - // global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); // let order = data_store.get_order(key); @@ -433,7 +433,7 @@ mod ExchangeRouter { // fn cancel_order(ref self: ContractState, key: felt252) { // let data_store = self.data_store.read(); - // global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); // let order = data_store.get_order(key); @@ -452,7 +452,7 @@ mod ExchangeRouter { receiver: ContractAddress ) -> Array { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); if (markets.len() != tokens.len()) { RouterError::INVALID_CLAIM_FUNDING_FEES_INPUT(markets.len(), tokens.len()) @@ -487,7 +487,7 @@ mod ExchangeRouter { i += 1; }; - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); claimed_amounts } @@ -500,7 +500,7 @@ mod ExchangeRouter { receiver: ContractAddress ) -> Array { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); if (markets.len() != tokens.len() || tokens.len() != time_keys.len()) { RouterError::INVALID_CLAIM_COLLATERAL_INPUT( @@ -538,7 +538,7 @@ mod ExchangeRouter { i += 1; }; - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); claimed_amounts } @@ -550,7 +550,7 @@ mod ExchangeRouter { receiver: ContractAddress ) -> Array { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); if (markets.len() != tokens.len()) { RouterError::INVALID_CLAIM_AFFILIATE_REWARDS_INPUT(markets.len(), tokens.len()) @@ -584,21 +584,21 @@ mod ExchangeRouter { i = i + 1; }; - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); claimed_amounts } fn set_ui_fee_factor(ref self: ContractState, ui_fee_factor: u256) { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); let account = get_caller_address(); market_utils::set_ui_fee_factor( data_store, self.event_emitter.read(), account, ui_fee_factor ); - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn claim_ui_fees( @@ -608,7 +608,7 @@ mod ExchangeRouter { receiver: ContractAddress ) -> Array { let data_store = self.data_store.read(); - global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); if (markets.len() != tokens.len()) { RouterError::INVALID_CLAIM_UI_FEES_INPUT(markets.len(), tokens.len()) @@ -641,7 +641,7 @@ mod ExchangeRouter { i += 1; }; - global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); claimed_amounts } diff --git a/yarn-error.log b/yarn-error.log new file mode 100644 index 00000000..eacf0582 --- /dev/null +++ b/yarn-error.log @@ -0,0 +1,1003 @@ +Arguments: + /Users/0xandee/.nvm/versions/node/v18.18.0/bin/node /usr/local/bin/yarn customFlow + +PATH: + /Users/0xandee/homebrew/opt/mysql-client/bin:/Users/0xandee/.cairo/target/release:/Users/0xandee/.pyenv/shims:/usr/local/opt/openssl@3/bin:/Users/0xandee/.pyenv/bin:/Users/0xandee/.nvm/versions/node/v18.18.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/0xandee/homebrew/opt/mysql-client/bin:/Users/0xandee/.cairo/target/release:/usr/local/opt/openssl@3/bin:/Users/0xandee/.pyenv/bin:/Users/0xandee/.nvm/versions/node/v18.18.0/bin:/usr/local/Caskroom/miniconda/base/bin:/usr/local/Caskroom/miniconda/base/condabin:/Users/0xandee/.starkli/bin:/Users/0xandee/.cargo/bin:/Users/0xandee/.foundry/bin:/Users/0xandee/.local/bin:/Users/0xandee/Users/0xandee/go/bin/sid:/Users/0xandee/.local/bin:/Users/0xandee/Users/0xandee/go/bin/sid + +Yarn version: + 1.22.19 + +Node version: + 18.18.0 + +Platform: + darwin arm64 + +Trace: + SyntaxError: /Users/0xandee/Documents/Github/satoru/package.json: Unexpected token } in JSON at position 1572 + at JSON.parse () + at /usr/local/lib/node_modules/yarn/lib/cli.js:1629:59 + at Generator.next () + at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30) + at /usr/local/lib/node_modules/yarn/lib/cli.js:321:13 + +npm manifest: + { + "scripts": { + "1": "ts-node ./scripts/actions/1.deployApp.ts", + "2": "ts-node ./scripts/actions/2.grantRoles.ts", + "3": "ts-node ./scripts/actions/3.createMarket.ts", + "4": "ts-node ./scripts/actions/4.setDataStore.ts", + "5": "ts-node ./scripts/actions/5.createDeposit.ts", + "6": "ts-node ./scripts/actions/6.executeDeposit.ts", + "7": "ts-node ./scripts/actions/7.createLongOrder.ts", + "8": "ts-node ./scripts/actions/8.executeLongOrder.ts", + "noDeployFlow": "ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && ts-node ./scripts/actions/4.setDataStore.ts && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts", + "fullDeployFlow": "ts-node ./scripts/actions/1.deployApp.ts && sleep 30 && ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && sleep 30 && ts-node ./scripts/actions/4.setDataStore.ts && sleep 30 && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && sleep 30 && ts-node ./scripts/actions/8.executeLongOrder.ts", + "customFlow": "ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts", + + }, + "dependencies": { + "@types/node": "^20.11.16", + "dotenv": "^16.4.5", + "ethers": "5", + "fs": "^0.0.1-security", + "starknet": "^6.11.0", + "ts-node": "^10.9.2", + "typescript": "^5.3.3" + } + } + +yarn manifest: + No manifest + +Lockfile: + # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + # yarn lockfile v1 + + + "@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + + "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + 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/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + + "@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + + "@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + + "@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + + "@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + + "@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + + "@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + + "@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + 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/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + + "@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + 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/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + 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" + aes-js "3.0.0" + scrypt-js "3.0.1" + + "@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + + "@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + + "@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + + "@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + + "@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + + "@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + + "@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + + "@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + + "@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + + "@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + 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/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + + "@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + 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" + + "@jridgewell/resolve-uri@^3.0.3": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + + "@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + + "@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + + "@noble/curves@~1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.3.0.tgz#01be46da4fd195822dab821e72f71bf4aeec635e" + integrity sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA== + dependencies: + "@noble/hashes" "1.3.3" + + "@noble/curves@~1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6" + integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg== + dependencies: + "@noble/hashes" "1.4.0" + + "@noble/hashes@1.3.3", "@noble/hashes@~1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" + integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== + + "@noble/hashes@1.4.0", "@noble/hashes@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + + "@scure/base@~1.1.3": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" + integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== + + "@scure/starknet@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@scure/starknet/-/starknet-1.0.0.tgz#4419bc2fdf70f3dd6cb461d36c878c9ef4419f8c" + integrity sha512-o5J57zY0f+2IL/mq8+AYJJ4Xpc1fOtDhr+mFQKbHnYFmm3WQrC+8zj2HEgxak1a+x86mhmBC1Kq305KUpVf0wg== + dependencies: + "@noble/curves" "~1.3.0" + "@noble/hashes" "~1.3.3" + + "@starknet-io/types-js@^0.7.7", "starknet-types-07@npm:@starknet-io/types-js@^0.7.7": + name starknet-types-07 + version "0.7.7" + resolved "https://registry.yarnpkg.com/@starknet-io/types-js/-/types-js-0.7.7.tgz#444be5e4e585ec6f599d42d3407280d98b2dfdf8" + integrity sha512-WLrpK7LIaIb8Ymxu6KF/6JkGW1sso988DweWu7p5QY/3y7waBIiPvzh27D9bX5KIJNRDyOoOVoHVEKYUYWZ/RQ== + + "@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + + "@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + + "@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + + "@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + + "@types/node@^20.11.16": + version "20.11.16" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.16.tgz#4411f79411514eb8e2926f036c86c9f0e4ec6708" + integrity sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ== + dependencies: + undici-types "~5.26.4" + + abi-wan-kanabi@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/abi-wan-kanabi/-/abi-wan-kanabi-2.2.2.tgz#82c48e8fa08d9016cf92d3d81d494cc60e934693" + integrity sha512-sTCv2HyNIj1x2WFUoc9oL8ZT9liosrL+GoqEGZJK1kDND096CfA7lwx06vLxLWMocQ41FQXO3oliwoh/UZHYdQ== + dependencies: + ansicolors "^0.3.2" + cardinal "^2.1.1" + fs-extra "^10.0.0" + yargs "^17.7.2" + + acorn-walk@^8.1.1: + version "8.3.2" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa" + integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== + + acorn@^8.4.1: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + + aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + + ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + + ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + + ansicolors@^0.3.2, ansicolors@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" + integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== + + arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + + bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + + bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + + bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + + brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== + + cardinal@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-2.1.1.tgz#7cc1055d822d212954d07b085dea251cc7bc5505" + integrity sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw== + dependencies: + ansicolors "~0.3.2" + redeyed "~2.1.0" + + cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + + color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + + color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + + create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + + diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + + dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + + elliptic@6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + + emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + + escalade@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + + esprima@~4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + + ethers@5: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "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/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + + fetch-cookie@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/fetch-cookie/-/fetch-cookie-3.0.1.tgz#6a77f7495e1a639ae019db916a234db8c85d5963" + integrity sha512-ZGXe8Y5Z/1FWqQ9q/CrJhkUD73DyBU9VF0hBQmEO/wPHe4A9PKTjplFDLeFX8aOsYypZUcX5Ji/eByn3VCVO3Q== + dependencies: + set-cookie-parser "^2.4.8" + tough-cookie "^4.0.0" + + fs-extra@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + + fs@^0.0.1-security: + version "0.0.1-security" + resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4" + integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w== + + get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + + get-starknet-core@^4.0.0-next.3: + version "4.0.0" + resolved "https://registry.yarnpkg.com/get-starknet-core/-/get-starknet-core-4.0.0.tgz#9a81101b3a4e54e090f76492b566abaa3b5865c7" + integrity sha512-6pLmidQZkC3wZsrHY99grQHoGpuuXqkbSP65F8ov1/JsEI8DDLkhsAuLCKFzNOK56cJp+f1bWWfTJ57e9r5eqQ== + dependencies: + "@starknet-io/types-js" "^0.7.7" + + graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + + hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + + hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + + inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + + is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + + isomorphic-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" + integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== + dependencies: + node-fetch "^2.6.1" + whatwg-fetch "^3.4.1" + + js-sha3@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + + jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + + lossless-json@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lossless-json/-/lossless-json-4.0.1.tgz#d45229e3abb213a0235812780ca894ea8c5b2c6b" + integrity sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA== + + make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + + minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== + + node-fetch@^2.6.1: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + + pako@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== + + psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + + punycode@^2.1.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + + querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + + redeyed@~2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/redeyed/-/redeyed-2.1.1.tgz#8984b5815d99cb220469c99eeeffe38913e6cc0b" + integrity sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ== + dependencies: + esprima "~4.0.0" + + require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + + requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + + scrypt-js@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + + set-cookie-parser@^2.4.8: + version "2.6.0" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" + integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== + + starknet@^6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/starknet/-/starknet-6.11.0.tgz#5d7e868e913777e9bf64323e59ed8be86437f291" + integrity sha512-u50KrGDi9fbu1Ogu7ynwF/tSeFlp3mzOg1/Y5x50tYFICImo3OfY4lOz9OtYDk404HK4eUujKkhov9tG7GAKlg== + dependencies: + "@noble/curves" "~1.4.0" + "@noble/hashes" "^1.4.0" + "@scure/base" "~1.1.3" + "@scure/starknet" "~1.0.0" + abi-wan-kanabi "^2.2.2" + fetch-cookie "^3.0.0" + get-starknet-core "^4.0.0-next.3" + isomorphic-fetch "^3.0.0" + lossless-json "^4.0.1" + pako "^2.0.4" + starknet-types-07 "npm:@starknet-io/types-js@^0.7.7" + ts-mixer "^6.0.3" + url-join "^4.0.1" + + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + + strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + + tough-cookie@^4.0.0: + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + + tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + + ts-mixer@^6.0.3: + version "6.0.4" + resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.4.tgz#1da39ceabc09d947a82140d9f09db0f84919ca28" + integrity sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA== + + ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + + typescript@^5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" + integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== + + undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + + universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + + universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + + url-join@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + + url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + + v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + + webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + + whatwg-fetch@^3.4.1: + version "3.6.20" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" + integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== + + whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + + wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + + ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + + y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + + yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + + yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + + yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/yarn.lock b/yarn.lock index 42e9c136..a9f5d5df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,348 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + 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/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + 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/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + 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/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + 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" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + 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/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + 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" + "@jridgewell/resolve-uri@^3.0.3": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" @@ -46,7 +388,7 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== -"@noble/hashes@1.4.0": +"@noble/hashes@1.4.0", "@noble/hashes@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== @@ -64,6 +406,12 @@ "@noble/curves" "~1.3.0" "@noble/hashes" "~1.3.3" +"@starknet-io/types-js@^0.7.7", "starknet-types-07@npm:@starknet-io/types-js@^0.7.7": + name starknet-types-07 + version "0.7.7" + resolved "https://registry.yarnpkg.com/@starknet-io/types-js/-/types-js-0.7.7.tgz#444be5e4e585ec6f599d42d3407280d98b2dfdf8" + integrity sha512-WLrpK7LIaIb8Ymxu6KF/6JkGW1sso988DweWu7p5QY/3y7waBIiPvzh27D9bX5KIJNRDyOoOVoHVEKYUYWZ/RQ== + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -111,6 +459,11 @@ acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -133,6 +486,26 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== +bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + +bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== + cardinal@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-2.1.1.tgz#7cc1055d822d212954d07b085dea251cc7bc5505" @@ -172,10 +545,23 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -dotenv@^16.4.1: - version "16.4.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.1.tgz#1d9931f1d3e5d2959350d1250efab299561f7f11" - integrity sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ== +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + +elliptic@6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" emoji-regex@^8.0.0: version "8.0.0" @@ -192,6 +578,42 @@ esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +ethers@5: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "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/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + fetch-cookie@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/fetch-cookie/-/fetch-cookie-3.0.1.tgz#6a77f7495e1a639ae019db916a234db8c85d5963" @@ -209,16 +631,50 @@ fs-extra@^10.0.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs@^0.0.1-security: + version "0.0.1-security" + resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4" + integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w== + get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-starknet-core@^4.0.0-next.3: + version "4.0.0" + resolved "https://registry.yarnpkg.com/get-starknet-core/-/get-starknet-core-4.0.0.tgz#9a81101b3a4e54e090f76492b566abaa3b5865c7" + integrity sha512-6pLmidQZkC3wZsrHY99grQHoGpuuXqkbSP65F8ov1/JsEI8DDLkhsAuLCKFzNOK56cJp+f1bWWfTJ57e9r5eqQ== + dependencies: + "@starknet-io/types-js" "^0.7.7" + graceful-fs@^4.1.6, graceful-fs@^4.2.0: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -232,6 +688,11 @@ isomorphic-fetch@^3.0.0: node-fetch "^2.6.1" whatwg-fetch "^3.4.1" +js-sha3@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" @@ -251,6 +712,16 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== + node-fetch@^2.6.1: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -295,30 +766,32 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== +scrypt-js@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + set-cookie-parser@^2.4.8: version "2.6.0" resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== -"starknet-types-07@npm:starknet-types@^0.7.2": - version "0.7.2" - resolved "https://registry.yarnpkg.com/starknet-types/-/starknet-types-0.7.2.tgz#2a1be2392e6e568484afabdc1e83411b5105713b" - integrity sha512-r3JJ0rrK0g3FnVRGcFiLY+9YT5WZgxB4TKBfR44wYGevHtKEM6BM5B+Gn1eou1zV7xEAwz3GpmvLSQTUAzDhsw== - -starknet@^6.6.6: - version "6.8.0" - resolved "https://registry.yarnpkg.com/starknet/-/starknet-6.8.0.tgz#d7bb1dc1470035f31fe1bfd68e3aee5cbb190c10" - integrity sha512-HNGgTomnEYbx8UiHNX9vTpa7tg7a1+BHW3vmqfnoejc0L/XjZ6N6h56S18nf8ZGDbe//yfaqk50eGqTaw2oR0g== +starknet@^6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/starknet/-/starknet-6.11.0.tgz#5d7e868e913777e9bf64323e59ed8be86437f291" + integrity sha512-u50KrGDi9fbu1Ogu7ynwF/tSeFlp3mzOg1/Y5x50tYFICImo3OfY4lOz9OtYDk404HK4eUujKkhov9tG7GAKlg== dependencies: "@noble/curves" "~1.4.0" + "@noble/hashes" "^1.4.0" "@scure/base" "~1.1.3" "@scure/starknet" "~1.0.0" abi-wan-kanabi "^2.2.2" fetch-cookie "^3.0.0" + get-starknet-core "^4.0.0-next.3" isomorphic-fetch "^3.0.0" lossless-json "^4.0.1" pako "^2.0.4" - starknet-types-07 "npm:starknet-types@^0.7.2" + starknet-types-07 "npm:@starknet-io/types-js@^0.7.7" ts-mixer "^6.0.3" url-join "^4.0.1" @@ -442,6 +915,11 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" From a9e94341c5d96b829fffd7e67020254196f578a0 Mon Sep 17 00:00:00 2001 From: anvospace <34095856+0xandee@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:53:25 +0700 Subject: [PATCH 4/7] m --- scripts/actions/3.createMarket.ts | 2 +- scripts/actions/6.executeDeposit.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/actions/3.createMarket.ts b/scripts/actions/3.createMarket.ts index e859677c..48c2aefa 100644 --- a/scripts/actions/3.createMarket.ts +++ b/scripts/actions/3.createMarket.ts @@ -52,7 +52,7 @@ async function create_market() { contractAddresses.BTCUSDTMarketToken = marketTokenAddress1; fs.writeFileSync(contractAddressesPath, JSON.stringify(contractAddresses, null, 4), 'utf8'); - console.log('Markets created ✅') + console.log('Markets created ✅\n') } create_market() \ No newline at end of file diff --git a/scripts/actions/6.executeDeposit.ts b/scripts/actions/6.executeDeposit.ts index d64e3bb0..7f2ed30c 100644 --- a/scripts/actions/6.executeDeposit.ts +++ b/scripts/actions/6.executeDeposit.ts @@ -71,9 +71,9 @@ async function deploy() { compacted_max_oracle_block_numbers: [block1, block1], compacted_oracle_timestamps: [current_block_data.timestamp, current_block_data.timestamp], compacted_decimals: [18, 18], - compacted_min_prices: [3060, 3060], // 500000, 10000 compacted + compacted_min_prices: [3060, 1], // 500000, 10000 compacted compacted_min_prices_indexes: [0], - compacted_max_prices: [3060, 3060], // 500000, 10000 compacted + compacted_max_prices: [3060, 1], // 500000, 10000 compacted compacted_max_prices_indexes: [0], signatures: [ ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] From 51c1e11897752c272b2ff61d7091a7dc65fcbcc8 Mon Sep 17 00:00:00 2001 From: anvospace <34095856+0xandee@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:02:38 +0700 Subject: [PATCH 5/7] updates shets --- .../satoru.code-workspace | 3 - package.json | 22 ++-- scripts/{actions => }/1.deployApp.ts | 0 scripts/{actions => }/2.grantRoles.ts | 0 scripts/{actions => }/3.createMarket.ts | 0 .../4.setDataStore.ts => 4.configMarket.ts} | 100 +++++++++--------- scripts/{actions => }/5.createDeposit.ts | 8 +- scripts/{actions => }/6.executeDeposit.ts | 16 +-- scripts/{actions => }/7.createLongOrder.ts | 10 +- scripts/{actions => }/8.executeLongOrder.ts | 6 +- .../actions/constants/contractAddresses.json | 29 ----- scripts/constants/contractAddresses.json | 30 ++++++ .../constants/contractAddresses.ts | 0 .../{actions => }/constants/dataStoreKeys.ts | 0 .../constants/market-config-data.ts | 10 +- scripts/{actions => }/constants/utils.ts | 0 scripts/{actions => }/createSwapOrder.ts | 0 scripts/{actions => }/executeSwapOrder.ts | 0 scripts/{actions => }/openAndCloseLong.ts | 0 src/market/market_token.cairo | 4 +- 20 files changed, 118 insertions(+), 120 deletions(-) rename scripts/{actions => }/1.deployApp.ts (100%) rename scripts/{actions => }/2.grantRoles.ts (100%) rename scripts/{actions => }/3.createMarket.ts (100%) rename scripts/{actions/4.setDataStore.ts => 4.configMarket.ts} (91%) rename scripts/{actions => }/5.createDeposit.ts (92%) rename scripts/{actions => }/6.executeDeposit.ts (91%) rename scripts/{actions => }/7.createLongOrder.ts (89%) rename scripts/{actions => }/8.executeLongOrder.ts (98%) delete mode 100644 scripts/actions/constants/contractAddresses.json create mode 100644 scripts/constants/contractAddresses.json rename scripts/{actions => }/constants/contractAddresses.ts (100%) rename scripts/{actions => }/constants/dataStoreKeys.ts (100%) rename scripts/{actions => }/constants/market-config-data.ts (97%) rename scripts/{actions => }/constants/utils.ts (100%) rename scripts/{actions => }/createSwapOrder.ts (100%) rename scripts/{actions => }/executeSwapOrder.ts (100%) rename scripts/{actions => }/openAndCloseLong.ts (100%) diff --git a/book/src/smart-contracts-architecture/satoru.code-workspace b/book/src/smart-contracts-architecture/satoru.code-workspace index 31e14489..04616194 100644 --- a/book/src/smart-contracts-architecture/satoru.code-workspace +++ b/book/src/smart-contracts-architecture/satoru.code-workspace @@ -2,9 +2,6 @@ "folders": [ { "path": "../../.." - }, - { - "path": "../../../../simple-nft-example/packages/starknet-devnet-rs" } ], "settings": {} diff --git a/package.json b/package.json index 7b6b6add..db58852a 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "scripts": { - "1": "ts-node ./scripts/actions/1.deployApp.ts", - "2": "ts-node ./scripts/actions/2.grantRoles.ts", - "3": "ts-node ./scripts/actions/3.createMarket.ts", - "4": "ts-node ./scripts/actions/4.setDataStore.ts", - "5": "ts-node ./scripts/actions/5.createDeposit.ts", - "6": "ts-node ./scripts/actions/6.executeDeposit.ts", - "7": "ts-node ./scripts/actions/7.createLongOrder.ts", - "8": "ts-node ./scripts/actions/8.executeLongOrder.ts", - "noDeployFlow": "ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && ts-node ./scripts/actions/4.setDataStore.ts && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts", - "fullDeployFlow": "ts-node ./scripts/actions/1.deployApp.ts && sleep 30 && ts-node ./scripts/actions/2.grantRoles.ts && sleep 30 && ts-node ./scripts/actions/3.createMarket.ts && sleep 30 && ts-node ./scripts/actions/4.setDataStore.ts && sleep 30 && ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && sleep 30 && ts-node ./scripts/actions/8.executeLongOrder.ts", - "customFlow": "ts-node ./scripts/actions/5.createDeposit.ts && sleep 120 && ts-node ./scripts/actions/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/actions/7.createLongOrder.ts && ts-node ./scripts/actions/8.executeLongOrder.ts" + "1": "ts-node ./scripts/1.deployApp.ts", + "2": "ts-node ./scripts/2.grantRoles.ts", + "3": "ts-node ./scripts/3.createMarket.ts", + "4": "ts-node ./scripts/4.configMarket.ts", + "5": "ts-node ./scripts/5.createDeposit.ts", + "6": "ts-node ./scripts/6.executeDeposit.ts", + "7": "ts-node ./scripts/7.createLongOrder.ts", + "8": "ts-node ./scripts/8.executeLongOrder.ts", + "noDeployFlow": "ts-node ./scripts/2.grantRoles.ts && sleep 30 && ts-node ./scripts/3.createMarket.ts && ts-node ./scripts/4.configMarket.ts && ts-node ./scripts/5.createDeposit.ts && sleep 120 && ts-node ./scripts/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/7.createLongOrder.ts && ts-node ./scripts/8.executeLongOrder.ts", + "fullDeployFlow": "ts-node ./scripts/1.deployApp.ts && sleep 30 && ts-node ./scripts/2.grantRoles.ts && sleep 30 && ts-node ./scripts/3.createMarket.ts && sleep 30 && ts-node ./scripts/4.configMarket.ts && sleep 30 && ts-node ./scripts/5.createDeposit.ts && sleep 120 && ts-node ./scripts/6.executeDeposit.ts && sleep 30 && ts-node ./scripts/7.createLongOrder.ts && sleep 30 && ts-node ./scripts/8.executeLongOrder.ts", + "customFlow": "ts-node ./scripts/1.deployApp.ts && sleep 30 && ts-node ./scripts/2.grantRoles.ts && sleep 30 && ts-node ./scripts/3.createMarket.ts && sleep 30 && ts-node ./scripts/4.configMarket.ts && sleep 30 && ts-node ./scripts/5.createDeposit.ts && sleep 120 && ts-node ./scripts/6.executeDeposit.ts" }, "dependencies": { diff --git a/scripts/actions/1.deployApp.ts b/scripts/1.deployApp.ts similarity index 100% rename from scripts/actions/1.deployApp.ts rename to scripts/1.deployApp.ts diff --git a/scripts/actions/2.grantRoles.ts b/scripts/2.grantRoles.ts similarity index 100% rename from scripts/actions/2.grantRoles.ts rename to scripts/2.grantRoles.ts diff --git a/scripts/actions/3.createMarket.ts b/scripts/3.createMarket.ts similarity index 100% rename from scripts/actions/3.createMarket.ts rename to scripts/3.createMarket.ts diff --git a/scripts/actions/4.setDataStore.ts b/scripts/4.configMarket.ts similarity index 91% rename from scripts/actions/4.setDataStore.ts rename to scripts/4.configMarket.ts index bd545c4c..5b82ae40 100644 --- a/scripts/actions/4.setDataStore.ts +++ b/scripts/4.configMarket.ts @@ -36,31 +36,31 @@ async function getDataStoreContract() { } /// Create a new market. -export async function setDataStore( - -) { +export async function configMarket(marketName: string) { const dataStore = await getDataStoreContract(); const reader = await getReaderContract(); - const market = contractAddresses['ETHUSDTMarketToken']; + const market = contractAddresses[marketName]; + const tokensInMarket = await reader.functions.get_market({ contract_address: dataStore.address }, market); + const index_token = num.toHex(tokensInMarket.index_token); const long_token = num.toHex(tokensInMarket.long_token); const short_token = num.toHex(tokensInMarket.short_token); const configData = markets_config[market]; - const setDataStoreCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = []; + const configMarketCalls: Array<{ contractAddress: string, entrypoint: string, calldata: any[] }> = []; const virtualTokenIdForIndexTokenKey = dataStoreKeys.virtualTokenIdKey(configData.virtualTokenIdForIndexToken); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_felt252", calldata: [virtualTokenIdForIndexTokenKey, configData.virtualTokenIdForIndexToken] }); const virtualTokenIdForMarketToken = dataStoreKeys.virtualMarketIdKey(configData.virtualTokenIdForIndexToken); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_felt252", calldata: [virtualTokenIdForMarketToken, configData.virtualMarketId] @@ -68,7 +68,7 @@ export async function setDataStore( // minPositionImpactPoolAmount const minPositionImpactPoolAmountKey = dataStoreKeys.minPositionImpactPoolAmountKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minPositionImpactPoolAmountKey, configData.minPositionImpactPoolAmount.toBigInt(), "0"] @@ -86,7 +86,7 @@ export async function setDataStore( // maxLongTokenPoolAmount const maxLongTokenPoolAmountKey = dataStoreKeys.maxPoolAmountKey(market, long_token); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxLongTokenPoolAmountKey, configData.maxLongTokenPoolAmount.toBigInt(), "0"] @@ -94,7 +94,7 @@ export async function setDataStore( // maxShortTokenPoolAmount const maxShortTokenPoolAmountKey = dataStoreKeys.maxPoolAmountKey(market, short_token); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxShortTokenPoolAmountKey, configData.maxShortTokenPoolAmount.toBigInt(), "0"] @@ -102,14 +102,14 @@ export async function setDataStore( // maxLongTokenPoolAmountForDeposit => maxPoolAmountForDepositKey() const maxLongTokenPoolAmountForDepositKey = dataStoreKeys.maxPoolAmountForDepositKey(market, long_token); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxLongTokenPoolAmountForDepositKey, configData.maxLongTokenPoolAmountForDeposit.toBigInt(), "0"] }); // maxShortTokenPoolAmountForDeposit => maxPoolAmountForDepositKey() const maxShortTokenPoolAmountForDepositKey = dataStoreKeys.maxPoolAmountForDepositKey(market, short_token); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxShortTokenPoolAmountForDepositKey, configData.maxShortTokenPoolAmountForDeposit.toBigInt(), "0"] @@ -117,7 +117,7 @@ export async function setDataStore( // negativePositionImpactFactor const negativePositionImpactFactorKey = dataStoreKeys.positionImpactFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [negativePositionImpactFactorKey, configData.negativePositionImpactFactor.toBigInt(), "0"] @@ -125,7 +125,7 @@ export async function setDataStore( // positivePositionImpactFactor const positivePositionImpactFactorKey = dataStoreKeys.positionImpactFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [positivePositionImpactFactorKey, configData.positivePositionImpactFactor.toBigInt(), "0"] @@ -133,7 +133,7 @@ export async function setDataStore( // minCollateralFactorForOpenInterestMultiplierLong const minCollateralFactorForOpenInterestMultiplierLongKey = dataStoreKeys.minCollateralFactorForOpenInterest(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minCollateralFactorForOpenInterestMultiplierLongKey, configData.minCollateralFactorForOpenInterestMultiplierLong.toBigInt(), "0"] @@ -141,7 +141,7 @@ export async function setDataStore( // minCollateralFactorForOpenInterestMultiplierShort const minCollateralFactorForOpenInterestMultiplierShortKey = dataStoreKeys.minCollateralFactorForOpenInterest(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minCollateralFactorForOpenInterestMultiplierShortKey, configData.minCollateralFactorForOpenInterestMultiplierShort.toBigInt(), "0"] @@ -149,7 +149,7 @@ export async function setDataStore( // negativeSwapImpactFactor const negativeSwapImpactFactorKey = dataStoreKeys.swapImpactFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [negativeSwapImpactFactorKey, configData.negativeSwapImpactFactor.toBigInt(), "0"] @@ -157,7 +157,7 @@ export async function setDataStore( // positiveSwapImpactFactor const positiveSwapImpactFactorKey = dataStoreKeys.swapImpactFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [positiveSwapImpactFactorKey, configData.positiveSwapImpactFactor.toBigInt(), "0"] @@ -165,7 +165,7 @@ export async function setDataStore( // maxOpenInterestForLongs const maxOpenInterestForLongsKey = dataStoreKeys.maxOpenInterestKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxOpenInterestForLongsKey, configData.maxOpenInterestForLongs.toBigInt(), "0"] @@ -173,7 +173,7 @@ export async function setDataStore( // maxOpenInterestForShorts const maxOpenInterestForShortsKey = dataStoreKeys.maxOpenInterestKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxOpenInterestForShortsKey, configData.maxOpenInterestForShorts.toBigInt(), "0"] @@ -181,7 +181,7 @@ export async function setDataStore( // fundingIncreaseFactorPerSecond const fundingIncreaseFactorPerSecondKey = dataStoreKeys.fundingIncreaseFactorPerSecondKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [fundingIncreaseFactorPerSecondKey, configData.fundingIncreaseFactorPerSecond.toBigInt(), "0"] @@ -189,7 +189,7 @@ export async function setDataStore( // fundingDecreaseFactorPerSecond const fundingDecreaseFactorPerSecondKey = dataStoreKeys.fundingDecreaseFactorPerSecondKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [fundingDecreaseFactorPerSecondKey, configData.fundingDecreaseFactorPerSecond.toBigInt(), "0"] @@ -197,7 +197,7 @@ export async function setDataStore( // minFundingFactorPerSecond const minFundingFactorPerSecondKey = dataStoreKeys.minFundingFactorPerSecondKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minFundingFactorPerSecondKey, configData.minFundingFactorPerSecond.toBigInt(), "0"] @@ -205,7 +205,7 @@ export async function setDataStore( // maxFundingFactorPerSecond const maxFundingFactorPerSecondKey = dataStoreKeys.maxFundingFactorPerSecondKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxFundingFactorPerSecondKey, configData.maxFundingFactorPerSecond.toBigInt(), "0"] @@ -213,7 +213,7 @@ export async function setDataStore( // thresholdForStableFunding const thresholdForStableFundingKey = dataStoreKeys.thresholdForStableFundingKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [thresholdForStableFundingKey, configData.thresholdForStableFunding.toBigInt(), "0"] @@ -221,7 +221,7 @@ export async function setDataStore( // thresholdForDecreaseFunding const thresholdForDecreaseFundingKey = dataStoreKeys.thresholdForDecreaseFundingKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [thresholdForDecreaseFundingKey, configData.thresholdForDecreaseFunding.toBigInt(), "0"] @@ -229,14 +229,14 @@ export async function setDataStore( // borrowingFactorForLongs const borrowingFactorForLongsKey = dataStoreKeys.borrowingFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [borrowingFactorForLongsKey, configData.borrowingFactorForLongs.toBigInt(), "0"] }); // borrowingFactorForShorts const borrowingFactorForShortsKey = dataStoreKeys.borrowingFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [borrowingFactorForShortsKey, configData.borrowingFactorForShorts.toBigInt(), "0"] @@ -244,14 +244,14 @@ export async function setDataStore( // borrowingExponentFactorForLongs const borrowingExponentFactorForLongsKey = dataStoreKeys.borrowingExponentFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [borrowingExponentFactorForLongsKey, configData.borrowingExponentFactorForLongs.toBigInt(), "0"] }); // borrowingExponentFactorForShorts const borrowingExponentFactorForShortsKey = dataStoreKeys.borrowingExponentFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [borrowingExponentFactorForShortsKey, configData.borrowingExponentFactorForShorts.toBigInt(), "0"] @@ -259,7 +259,7 @@ export async function setDataStore( // reserveFactorLongs const reserveFactorLongsKey = dataStoreKeys.reserveFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [reserveFactorLongsKey, configData.reserveFactorLongs.toBigInt(), "0"] @@ -267,7 +267,7 @@ export async function setDataStore( // reserveFactorShorts const reserveFactorShortsKey = dataStoreKeys.reserveFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [reserveFactorShortsKey, configData.reserveFactorShorts.toBigInt(), "0"] @@ -275,7 +275,7 @@ export async function setDataStore( // openInterestReserveFactorLongs const openInterestReserveFactorLongsKey = dataStoreKeys.openInterestReserveFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [openInterestReserveFactorLongsKey, configData.openInterestReserveFactorLongs.toBigInt(), "0"] @@ -283,7 +283,7 @@ export async function setDataStore( // openInterestReserveFactorShorts const openInterestReserveFactorShortsKey = dataStoreKeys.openInterestReserveFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [openInterestReserveFactorShortsKey, configData.openInterestReserveFactorShorts.toBigInt(), "0"] @@ -291,7 +291,7 @@ export async function setDataStore( // maxPnlFactorForTradersLongs const maxPnlFactorForTradersLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_TRADERS_KEY, market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForTradersLongsKey, configData.maxPnlFactorForTradersLongs.toBigInt(), "0"] @@ -299,7 +299,7 @@ export async function setDataStore( // maxPnlFactorForTradersShorts const maxPnlFactorForTradersShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_TRADERS_KEY, market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForTradersShortsKey, configData.maxPnlFactorForTradersShorts.toBigInt(), "0"] @@ -307,7 +307,7 @@ export async function setDataStore( // maxPnlFactorForAdlLongs const maxPnlFactorForAdlLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_ADL, market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForAdlLongsKey, configData.maxPnlFactorForAdlLongs.toBigInt(), "0"] @@ -315,7 +315,7 @@ export async function setDataStore( // maxPnlFactorForAdlShorts const maxPnlFactorForAdlShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_ADL, market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForAdlShortsKey, configData.maxPnlFactorForAdlShorts.toBigInt(), "0"] @@ -323,7 +323,7 @@ export async function setDataStore( // minPnlFactorAfterAdlLongs const minPnlFactorAfterAdlLongsKey = dataStoreKeys.minPnlFactorAfterAdl(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minPnlFactorAfterAdlLongsKey, configData.minPnlFactorAfterAdlLongs.toBigInt(), "0"] @@ -331,7 +331,7 @@ export async function setDataStore( // minPnlFactorAfterAdlShorts const minPnlFactorAfterAdlShortsKey = dataStoreKeys.minPnlFactorAfterAdl(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [minPnlFactorAfterAdlShortsKey, configData.minPnlFactorAfterAdlShorts.toBigInt(), "0"] @@ -339,7 +339,7 @@ export async function setDataStore( // maxPnlFactorForDepositsLongs const maxPnlFactorForDepositsLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForDepositsLongsKey, configData.maxPnlFactorForDepositsLongs.toBigInt(), "0"] @@ -347,7 +347,7 @@ export async function setDataStore( // maxPnlFactorForDepositsShorts const maxPnlFactorForDepositsShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_DEPOSITS_KEY, market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForDepositsShortsKey, configData.maxPnlFactorForDepositsShorts.toBigInt(), "0"] @@ -355,7 +355,7 @@ export async function setDataStore( // maxPnlFactorForWithdrawalsLongs const maxPnlFactorForWithdrawalsLongsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY, market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForWithdrawalsLongsKey, configData.maxPnlFactorForWithdrawalsLongs.toBigInt(), "0"] @@ -363,7 +363,7 @@ export async function setDataStore( // maxPnlFactorForWithdrawalsShorts const maxPnlFactorForWithdrawalsShortsKey = dataStoreKeys.maxPnlFactorKey(dataStoreKeys.MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY, market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPnlFactorForWithdrawalsShortsKey, configData.maxPnlFactorForWithdrawalsShorts.toBigInt(), "0"] @@ -371,7 +371,7 @@ export async function setDataStore( // positiveMaxPositionImpactFactor const positiveMaxPositionImpactFactorKey = dataStoreKeys.maxPositionImpactFactorKey(market, true); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [positiveMaxPositionImpactFactorKey, configData.positiveMaxPositionImpactFactor.toBigInt(), "0"] @@ -379,7 +379,7 @@ export async function setDataStore( // negativeMaxPositionImpactFactor const negativeMaxPositionImpactFactorKey = dataStoreKeys.maxPositionImpactFactorKey(market, false); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [negativeMaxPositionImpactFactorKey, configData.negativeMaxPositionImpactFactor.toBigInt(), "0"] @@ -387,16 +387,16 @@ export async function setDataStore( // maxPositionImpactFactorForLiquidations const maxPositionImpactFactorForLiquidationsKey = dataStoreKeys.maxPositionImpactFactorForLiquidationsKey(market); - setDataStoreCalls.push({ + configMarketCalls.push({ contractAddress: dataStore.address, entrypoint: "set_u256", calldata: [maxPositionImpactFactorForLiquidationsKey, configData.maxPositionImpactFactorForLiquidations.toBigInt(), "0"] }); - await tryInvoke("setDataStoreCalls", setDataStoreCalls); + await tryInvoke(`config ${marketName}`, configMarketCalls); } - (async () => { - setDataStore(); + await configMarket('ETHUSDTMarketToken'); + await configMarket('BTCUSDTMarketToken'); })() \ No newline at end of file diff --git a/scripts/actions/5.createDeposit.ts b/scripts/5.createDeposit.ts similarity index 92% rename from scripts/actions/5.createDeposit.ts rename to scripts/5.createDeposit.ts index 89ac017c..85ac3595 100644 --- a/scripts/actions/5.createDeposit.ts +++ b/scripts/5.createDeposit.ts @@ -34,7 +34,7 @@ async function create_market() { entrypoint: "approve", calldata: [ routerAddress, - uint256.bnToUint256(10000000000000000n), + uint256.bnToUint256(10000000000000000000n), ] }, { @@ -43,7 +43,7 @@ async function create_market() { calldata: [ eth, depositVaultAddress, - uint256.bnToUint256(10000000000000000n), + uint256.bnToUint256(10000000000000000000n), ] }, { @@ -51,7 +51,7 @@ async function create_market() { entrypoint: "approve", calldata: [ routerAddress, - uint256.bnToUint256(100000000000000000000n), + uint256.bnToUint256(27330000000n), ] }, { @@ -60,7 +60,7 @@ async function create_market() { calldata: [ usdt, depositVaultAddress, - uint256.bnToUint256(100000000000000000000n), + uint256.bnToUint256(27330000000n), ] }, { diff --git a/scripts/actions/6.executeDeposit.ts b/scripts/6.executeDeposit.ts similarity index 91% rename from scripts/actions/6.executeDeposit.ts rename to scripts/6.executeDeposit.ts index 7f2ed30c..4d7ff3a8 100644 --- a/scripts/actions/6.executeDeposit.ts +++ b/scripts/6.executeDeposit.ts @@ -52,7 +52,7 @@ export async function getAccountLatestDepositKeys(accountAddress: string) { return accountDepositKeys[accountDepositKeys.length - 1]; } -async function deploy() { +async function execute_deposit() { const key = await getAccountLatestDepositKeys(account0Address); const depositHandlerAddress = contractAddresses['DepositHandler']; @@ -64,16 +64,16 @@ async function deploy() { const block0 = 0; const block1 = current_block - 1; - const setPricesParams = { + const oracleParams = { signer_info: 1, tokens: [contractAddresses['ETH'], contractAddresses['USDT']], compacted_min_oracle_block_numbers: [block0, block0], compacted_max_oracle_block_numbers: [block1, block1], compacted_oracle_timestamps: [current_block_data.timestamp, current_block_data.timestamp], - compacted_decimals: [18, 18], - compacted_min_prices: [3060, 1], // 500000, 10000 compacted + compacted_decimals: [18, 6], + compacted_min_prices: [2733000000000000000000, 1000000], // 500000, 10000 compacted compacted_min_prices_indexes: [0], - compacted_max_prices: [3060, 1], // 500000, 10000 compacted + compacted_max_prices: [2733000000000000000000, 1000000], // 500000, 10000 compacted compacted_max_prices_indexes: [0], signatures: [ ['signatures1', 'signatures2'], ['signatures1', 'signatures2'] @@ -85,10 +85,10 @@ async function deploy() { const executeOrderCall = depositHandlerContract.populate("execute_deposit", [ key, - setPricesParams + oracleParams ]) let tx = await depositHandlerContract.execute_deposit(executeOrderCall.calldata) - console.log("Deposit executed: https://sepolia.starkscan.co/tx/" + tx.transaction_hash); + console.log("Deposit executed: https://sepolia.starkscan.co/tx/" + tx.transaction_hash + "\n"); } -deploy() \ No newline at end of file +execute_deposit() \ No newline at end of file diff --git a/scripts/actions/7.createLongOrder.ts b/scripts/7.createLongOrder.ts similarity index 89% rename from scripts/actions/7.createLongOrder.ts rename to scripts/7.createLongOrder.ts index d20dd8de..9af01c5c 100644 --- a/scripts/actions/7.createLongOrder.ts +++ b/scripts/7.createLongOrder.ts @@ -24,7 +24,7 @@ async function create_order() { { contractAddress: eth, entrypoint: "transfer", - calldata: [contractAddresses['OrderVault'] as string, uint256.bnToUint256(1000000000000000n)] + calldata: [contractAddresses['OrderVault'] as string, uint256.bnToUint256(400000000000000000n)] }, { contractAddress: contractAddresses['OrderHandler'] as string, @@ -38,10 +38,10 @@ async function create_order() { market: marketTokenAddress, initial_collateral_token: eth, swap_path: [], - size_delta_usd: uint256.bnToUint256(10000000000000000000000n), - initial_collateral_delta_amount: uint256.bnToUint256(2000000000000000000n), - trigger_price: uint256.bnToUint256(5000), - acceptable_price: uint256.bnToUint256(5500), + size_delta_usd: uint256.bnToUint256(1000n), + initial_collateral_delta_amount: uint256.bnToUint256(2000n), + trigger_price: uint256.bnToUint256(2733n), + acceptable_price: uint256.bnToUint256(2833n), execution_fee: uint256.bnToUint256(0), callback_gas_limit: uint256.bnToUint256(0), min_output_amount: uint256.bnToUint256(0), diff --git a/scripts/actions/8.executeLongOrder.ts b/scripts/8.executeLongOrder.ts similarity index 98% rename from scripts/actions/8.executeLongOrder.ts rename to scripts/8.executeLongOrder.ts index 50071522..a56b1e04 100644 --- a/scripts/actions/8.executeLongOrder.ts +++ b/scripts/8.executeLongOrder.ts @@ -51,7 +51,7 @@ export async function getAccountLatestOrderKeys(accountAddress: string) { } -async function create_market() { +async function execute_ordeer() { const key = await getAccountLatestOrderKeys(account0Address); const compiledOrderHandlerSierra = json.parse(fs.readFileSync("./target/dev/satoru_OrderHandler.contract_class.json").toString("ascii")) @@ -86,7 +86,7 @@ async function create_market() { compacted_min_oracle_block_numbers: [block0, block0], compacted_max_oracle_block_numbers: [block1, block1], compacted_oracle_timestamps: [current_block_data.timestamp, current_block_data.timestamp], - compacted_decimals: [18, 18], + compacted_decimals: [18, 6], compacted_min_prices: [2700, 1], // 500000, 10000 compacted compacted_min_prices_indexes: [0], compacted_max_prices: [2700, 1], // 500000, 10000 compacted @@ -107,4 +107,4 @@ async function create_market() { console.log("Order executed: https://sepolia.starkscan.co/tx/" + tx.transaction_hash); } -create_market() \ No newline at end of file +execute_ordeer() \ No newline at end of file diff --git a/scripts/actions/constants/contractAddresses.json b/scripts/actions/constants/contractAddresses.json deleted file mode 100644 index d42bdaab..00000000 --- a/scripts/actions/constants/contractAddresses.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "ZeroAddress": "0x0000000000000000000000000000000000000000000000000000000000000000", - "BTC": "0x05dbc83d78a3ae24dfb9c972b223983c4adcd9750a51c11973eda925e6fc61e1", - "ETH": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", - "USDT": "0x57e859eee48e899cef91cf0595661bec0634db7d593d98222c68af6472e8394", - "ETHUSDTMarketToken": "0x4074682cf70b78c4d0283ae83f2f673000a582677955d297efe518eecc928dc", - "BTCUSDTMarketToken": "0xfab9e0daaf362b0572d242d923b5764abec63484676bc3218da4e2cd0d1ea5", - "RoleStore": "0x46343a2e384323e70573d56c79983b5bed25a68f06889f11223a1bf4cd21d1", - "DataStore": "0xe3ffe4e59e19e37cc5274438fc727d65ad59fff4e873297ed76a020e96eb6c", - "EventEmitter": "0x2454506b9c7af3326b36fe78fd101a5a3c3f1f511c9ea6510967bdfdc5beece", - "OracleStore": "0x2ca03b9ee8242c7fb30d5babb7fbde82e3e08f30b3383ec16c892140e48996", - "Oracle": "0x46b9ccfe9424bd3095712a1f9740ab6db141fb9a6c735f1b9058dbbc5d483c", - "OrderVault": "0x3f24afff452ccaa0a6726f112d730feac9c5a1607be437416afe87cea8fdfcf", - "SwapHandler": "0x3fc6628f9aa80c8edb8c1ce06974601ed0ac082ecfbb77a73049b9a295cd8e", - "ReferralStorage": "0x456283edbeb080f98e87479e3927a63957876ef580781a5a012e2a42bc15d1c", - "IncreaseOrderUtils": "0x700edccbc84defefdc8dc8b69c1e8631c746dd6225641675dedcf0e5250e1f8", - "DecreaseOrderUtils": "0x7a6a3ec3c4909efe76a8517d822e2a46702a6e3e5dc64b65818ad90d120b3d1", - "SwapOrderUtils": "0x53c8b54a52d8914aa28b20ad9b46bbd8726ceab88f6223c8a54821ccdcb3596", - "OrderUtils": "0xe2fd600aef974d3976e55153eddf1b7e09a7458f0b63841e3502e50242bb66", - "OrderHandler": "0x7431601f7ca368d2467b90c653031e80f198f0a49dea9e51278506c6a72dd97", - "DepositVault": "0x21a68253acc1350a63c3f96b2c41f8b5f0696c4c18e83b7bc091c3aeefdf1fd", - "DepositHandler": "0x7f5faad5b38795bdf7a888ebe035bfd1c3cc15614c0b7555418ed70e7a1d3f8", - "WithdrawalVault": "0x395e6d1e650ed534e5efcde5d74ee93bbedcaac514adc17c88486e7a82c3aae", - "WithdrawalHandler": "0x74c8f58e437fbfda819ed5988091488ee4288cda93bec6e93463633a0aa3466", - "MarketFactory": "0x61246603d31d14983c1533fad57ceaac8cdbfa7ea6c07b440d31e64126d21ec", - "Reader": "0xa8ae98fefa7b57915cb9c6caab0192ee41c7dcd9ecbc3936cf088c59883967", - "Router": "0x63c8e1b03aa2e7b18d80169af7ce586fa2bb3df04ee2b5695218f74f415d3d0", - "ExchangeRouter": "0x779bcb0cac95b92cb003d69a06637ef90f4f66ceaeaac1fca93fad09131fbe9" -} \ No newline at end of file diff --git a/scripts/constants/contractAddresses.json b/scripts/constants/contractAddresses.json new file mode 100644 index 00000000..f16b0f97 --- /dev/null +++ b/scripts/constants/contractAddresses.json @@ -0,0 +1,30 @@ +{ + "ZeroAddress": "0x0000000000000000000000000000000000000000000000000000000000000000", + "BTC": "0x03595357ef49da1d6eff8e1677e6ffa9a384ce9cc63c8f94e3eb7e5b24418d8f", + "ETH": "0x06bb3f514d96f252cda2e1c0364a232ea887829d852845097688993af2db1c21", + "USDT": "0x061c54ec0285bc41ca6823c9a6758cb3555cb1d2479f3758dadd0f6f6a94c6bd", + "USDC": "0x02b568cc40500fecf1244f95ce2d21a97701114808a8468a3db07536f051bfac", + "ETHUSDTMarketToken": "0x38147c71d002cd2bb489903c2c49d2d7b73b9b92a009546dc8342d8b9de6294", + "BTCUSDTMarketToken": "0x169837f77579ad6f6929f2943774afb831808ead483bf335271ad23ab19cb39", + "RoleStore": "0x3bae222a0522955e49847bffbd429faabb6b2488d8033cac1b101f1fa726fc1", + "DataStore": "0x7b680452472e35ea358287243f9038d3864c55f6ae0c5acb0a8c1402d7f1085", + "EventEmitter": "0x77b3e8614472326201cde9dfa0e092e831311f6eb94c149ddcf094e2f4c960b", + "OracleStore": "0x43c544e13495fa1b587ff8ef7415aae7f980c57c55918a657816ac4f53fdd6a", + "Oracle": "0x354d5d2d5dfa5f85c6a3509b2b47c26173e78e6a2c0fa0aebdaca885bdbdae7", + "OrderVault": "0xa331aac5e4b96d211acce6d3b770f26030748232fd00f03ae4b7970cc9909", + "SwapHandler": "0x32cb1c4567a08c05e40650d595dc2d4f6c3ff1dee8889a333a78ce3531d8ede", + "ReferralStorage": "0x6a56f8c3997a8ed71ef1e333a616966c6bd6106caba869fa06e5eabb3fc2ef5", + "IncreaseOrderUtils": "0x2559e03725cb4322c2ba5fd9c804008d3244232f74cbcf602e1ca53ec54f844", + "DecreaseOrderUtils": "0x363ab08443e84d6c59c4ed6740f6f9a0e8c79859289ff57237fb8dcf9a67fd1", + "SwapOrderUtils": "0x12f74d57e0f706bf273a4469c07ef687970f47927e5b13e7553360435dc6ea1", + "OrderUtils": "0xce55245f04c410daf9e5a670f0857c23787488272c04830baf3edaca98e866", + "OrderHandler": "0x2ea62f57e6fe4414ffe84a52aa42337dfbe61c7a9f217f74d34bb69e102466e", + "DepositVault": "0x2764651eb71f527102fbc12e4ab21cdd477f4283715f4c95fc941a57c56de57", + "DepositHandler": "0x2338d29b2deff3ba97bdc40af21ac32ffe1d17df855283834f88cd877090b40", + "WithdrawalVault": "0x715da7212e50890eb2d41cc4ad17bd3517a5cc8b25b008b557648c162b82c51", + "WithdrawalHandler": "0x537bb61eed8bb04b280d20e0d2af12322d55e8eddcf766060cf31bc2d3dd36d", + "MarketFactory": "0x6aa1e3ceaaefe2e606f3659bd497062f47ec19b72a502db2776750fe44bc62d", + "Reader": "0x296674061fb89781e33a19c86dad77c6212cba16ae823429d046fcb7686be5d", + "Router": "0x5cf2d9befeba95c9b11cedbd824bc04abbccc45f4e7ad57c1ed45caa809feb8", + "ExchangeRouter": "0x58dff48a3ed635df6895c5b9ee304f6e3274ad65d2ba6680b843d41f22366f0" +} \ No newline at end of file diff --git a/scripts/actions/constants/contractAddresses.ts b/scripts/constants/contractAddresses.ts similarity index 100% rename from scripts/actions/constants/contractAddresses.ts rename to scripts/constants/contractAddresses.ts diff --git a/scripts/actions/constants/dataStoreKeys.ts b/scripts/constants/dataStoreKeys.ts similarity index 100% rename from scripts/actions/constants/dataStoreKeys.ts rename to scripts/constants/dataStoreKeys.ts diff --git a/scripts/actions/constants/market-config-data.ts b/scripts/constants/market-config-data.ts similarity index 97% rename from scripts/actions/constants/market-config-data.ts rename to scripts/constants/market-config-data.ts index b7e42804..dbe4e513 100644 --- a/scripts/actions/constants/market-config-data.ts +++ b/scripts/constants/market-config-data.ts @@ -118,7 +118,7 @@ const baseMarketConfig = { export const markets_config = { [contractAddresses['BTCUSDTMarketToken']]: { - tokens: { indexToken: "BTC", longToken: "WBTC.e", shortToken: "USDC" }, + tokens: { indexToken: "BTC", longToken: "BTC", shortToken: "USDC" }, virtualTokenIdForIndexToken: hashSingleString("PERP:BTC/USD"), virtualMarketId: hashSingleString("SPOT:BTC/USD"), @@ -130,11 +130,11 @@ export const markets_config = { openInterestReserveFactorLongs: decimalToFloat(120, 2), openInterestReserveFactorShorts: decimalToFloat(120, 2), - maxLongTokenPoolAmount: expandDecimals(2_200_000, 18), - maxShortTokenPoolAmount: expandDecimals(110_000_000, 18), + maxLongTokenPoolAmount: expandDecimals(2_200_000, 8), + maxShortTokenPoolAmount: expandDecimals(110_000_000, 8), - maxLongTokenPoolAmountForDeposit: expandDecimals(2000, 18), - maxShortTokenPoolAmountForDeposit: expandDecimals(100_000_000, 18), + maxLongTokenPoolAmountForDeposit: expandDecimals(2000, 8), + maxShortTokenPoolAmountForDeposit: expandDecimals(100_000_000, 8), negativePositionImpactFactor: decimalToFloat(15, 11), // 0.05% for ~1,600,000 USD of imbalance positivePositionImpactFactor: decimalToFloat(9, 11), // 0.05% for ~2,700,000 USD of imbalance diff --git a/scripts/actions/constants/utils.ts b/scripts/constants/utils.ts similarity index 100% rename from scripts/actions/constants/utils.ts rename to scripts/constants/utils.ts diff --git a/scripts/actions/createSwapOrder.ts b/scripts/createSwapOrder.ts similarity index 100% rename from scripts/actions/createSwapOrder.ts rename to scripts/createSwapOrder.ts diff --git a/scripts/actions/executeSwapOrder.ts b/scripts/executeSwapOrder.ts similarity index 100% rename from scripts/actions/executeSwapOrder.ts rename to scripts/executeSwapOrder.ts diff --git a/scripts/actions/openAndCloseLong.ts b/scripts/openAndCloseLong.ts similarity index 100% rename from scripts/actions/openAndCloseLong.ts rename to scripts/openAndCloseLong.ts diff --git a/src/market/market_token.cairo b/src/market/market_token.cairo index 90da10cf..1ec71cb9 100644 --- a/src/market/market_token.cairo +++ b/src/market/market_token.cairo @@ -39,9 +39,9 @@ mod MarketToken { use super::IMarketToken; - const NAME: felt252 = 'Satoru Market'; + const NAME: felt252 = 'Gojo Market'; const SYMBOL: felt252 = 'GM'; - const DECIMALS: u8 = 6; + const DECIMALS: u8 = 18; #[storage] struct Storage { From 84d7a13f499b7b2849d0d8ebd0348340e68a16de Mon Sep 17 00:00:00 2001 From: 0xted97 Date: Wed, 4 Sep 2024 22:18:40 +0700 Subject: [PATCH 6/7] feat: get_withdrawal_count() and fix get_withdrawal_keys() --- src/data/data_store.cairo | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/data/data_store.cairo b/src/data/data_store.cairo index 995409a7..15e4f77c 100644 --- a/src/data/data_store.cairo +++ b/src/data/data_store.cairo @@ -354,6 +354,10 @@ trait IDataStore { /// * `end` - The ending index of the withdrawal keys to retrieve. fn get_withdrawal_keys(self: @TContractState, start: usize, end: usize) -> Array; + + /// Returns the number of withdrawals + fn get_withdrawal_count(self: @TContractState) ->u32; + /// Returns the number of withdrawals made by a specific account. /// /// # Arguments @@ -1316,10 +1320,15 @@ mod DataStore { } let withdrawal: Withdrawal = withdrawals[i]; keys.append(withdrawal.key); + i = i + 1; }; keys } + fn get_withdrawal_count(self: @ContractState) -> u32 { + self.withdrawals.read().len() + } + fn get_account_withdrawal_count(self: @ContractState, account: ContractAddress) -> u32 { self.account_withdrawals.read(account).len() } From 04fc7d522ec479a1ac081f0e98d633504843ddee Mon Sep 17 00:00:00 2001 From: 0xted97 Date: Wed, 4 Sep 2024 22:24:15 +0700 Subject: [PATCH 7/7] chore: format code --- src/data/data_store.cairo | 2 +- src/market/market_utils.cairo | 14 ++++++-------- src/router/exchange_router.cairo | 25 +++++++++---------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/data/data_store.cairo b/src/data/data_store.cairo index 15e4f77c..3e8949b9 100644 --- a/src/data/data_store.cairo +++ b/src/data/data_store.cairo @@ -356,7 +356,7 @@ trait IDataStore { /// Returns the number of withdrawals - fn get_withdrawal_count(self: @TContractState) ->u32; + fn get_withdrawal_count(self: @TContractState) -> u32; /// Returns the number of withdrawals made by a specific account. /// diff --git a/src/market/market_utils.cairo b/src/market/market_utils.cairo index 09a8f34b..9161c21a 100644 --- a/src/market/market_utils.cairo +++ b/src/market/market_utils.cairo @@ -1492,10 +1492,9 @@ fn validate_reserve( let max_reserved_usd = apply_factor_u256(pool_usd, reserve_factor); let reserved_usd = get_reserved_usd(data_store, market, prices, is_long); - - // if (reserved_usd > max_reserved_usd) { - // MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); - // } +// if (reserved_usd > max_reserved_usd) { +// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); +// } } @@ -1657,10 +1656,9 @@ fn validate_open_interest_reserve( let max_reserved_usd: u256 = apply_factor_u256(pool_usd, reserve_factor); let reserved_usd: u256 = get_reserved_usd(data_store, market, prices, is_long); - - // if (reserved_usd > max_reserved_usd) { - // MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); - // } +// if (reserved_usd > max_reserved_usd) { +// MarketError::INSUFFICIENT_RESERVE(reserved_usd, max_reserved_usd); +// } } // @notice Get the next borrowing fees for a position. diff --git a/src/router/exchange_router.cairo b/src/router/exchange_router.cairo index 0d570e86..d0e3cedf 100644 --- a/src/router/exchange_router.cairo +++ b/src/router/exchange_router.cairo @@ -311,8 +311,7 @@ mod ExchangeRouter { } self.deposit_handler.read().cancel_deposit(key); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn create_withdrawal(ref self: ContractState, params: CreateWithdrawalParams) -> felt252 { @@ -339,8 +338,7 @@ mod ExchangeRouter { } self.withdrawal_handler.read().cancel_withdrawal(key); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn create_order(ref self: ContractState, params: CreateOrderParams) -> felt252 { @@ -365,8 +363,7 @@ mod ExchangeRouter { callback_utils::set_saved_callback_contract( data_store, get_caller_address(), market, callback_contract ); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_deposit( @@ -376,8 +373,7 @@ mod ExchangeRouter { // global_reentrancy_guard::non_reentrant_before(data_store); self.deposit_handler.read().simulate_execute_deposit(key, simulated_oracle_params); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_withdrawal( @@ -390,8 +386,7 @@ mod ExchangeRouter { .withdrawal_handler .read() .simulate_execute_withdrawal(key, simulated_oracle_params); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn simulate_execute_order( @@ -401,8 +396,7 @@ mod ExchangeRouter { // global_reentrancy_guard::non_reentrant_before(data_store); self.order_handler.read().simulate_execute_order(key, simulated_oracle_params); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } // fn update_order( @@ -414,7 +408,7 @@ mod ExchangeRouter { // min_output_amout: u256 // ) { // let data_store = self.data_store.read(); - // global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); // let order = data_store.get_order(key); @@ -433,7 +427,7 @@ mod ExchangeRouter { // fn cancel_order(ref self: ContractState, key: felt252) { // let data_store = self.data_store.read(); - // global_reentrancy_guard::non_reentrant_before(data_store); + // global_reentrancy_guard::non_reentrant_before(data_store); // let order = data_store.get_order(key); @@ -597,8 +591,7 @@ mod ExchangeRouter { market_utils::set_ui_fee_factor( data_store, self.event_emitter.read(), account, ui_fee_factor ); - - // global_reentrancy_guard::non_reentrant_after(data_store); + // global_reentrancy_guard::non_reentrant_after(data_store); } fn claim_ui_fees(