diff --git a/package-lock.json b/package-lock.json index 33e9a2f0..d6c473d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@lighthouse-web3/kavach": "^0.1.6", "@peculiar/webcrypto": "^1.4.0", + "@pythnetwork/pyth-evm-js": "^1.48.0", "axios": "^1.6.8", "bls-eth-wasm": "^1.0.4", "cli-spinner": "^0.2.10", @@ -1752,7 +1753,6 @@ "version": "7.23.4", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.4.tgz", "integrity": "sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==", - "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -2861,6 +2861,57 @@ "node": ">=10.12.0" } }, + "node_modules/@pythnetwork/price-service-client": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.9.0.tgz", + "integrity": "sha512-SLm3IFcfmy9iMqHeT4Ih6qMNZhJEefY14T9yTlpsH2D/FE5+BaGGnfcexUifVlfH6M7mwRC4hEFdNvZ6ebZjJg==", + "dependencies": { + "@pythnetwork/price-service-sdk": "*", + "@types/ws": "^8.5.3", + "axios": "^1.5.1", + "axios-retry": "^3.8.0", + "isomorphic-ws": "^4.0.1", + "ts-log": "^2.2.4", + "ws": "^8.6.0" + } + }, + "node_modules/@pythnetwork/price-service-client/node_modules/ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@pythnetwork/price-service-sdk": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.7.1.tgz", + "integrity": "sha512-xr2boVXTyv1KUt/c6llUTfbv2jpud99pWlMJbFaHGUBoygQsByuy7WbjIJKZ+0Blg1itLZl0Lp/pJGGg8SdJoQ==", + "dependencies": { + "bn.js": "^5.2.1" + } + }, + "node_modules/@pythnetwork/pyth-evm-js": { + "version": "1.48.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-evm-js/-/pyth-evm-js-1.48.0.tgz", + "integrity": "sha512-tEst3nEPnzzogP/ip6yA0X4OZmf9Aak78RIrfuOhIvl4Yjzvv2+//hcfyaTRbmNyPAfY96M+z2MLjFQ0nqrSNw==", + "dependencies": { + "@pythnetwork/price-service-client": "*", + "buffer": "^6.0.3" + } + }, "node_modules/@sideway/address": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", @@ -3055,7 +3106,6 @@ "version": "20.9.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.4.tgz", "integrity": "sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==", - "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -3078,6 +3128,14 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -3561,6 +3619,15 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/axios-retry": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.9.1.tgz", + "integrity": "sha512-8PJDLJv7qTTMMwdnbMvrLYuvB47M81wRtxQmEdV5w4rgbTXTt+vtPkXwajOfOdSyv/wZICJOC+/UhXH4aQ/R+w==", + "dependencies": { + "@babel/runtime": "^7.15.4", + "is-retry-allowed": "^2.2.0" + } + }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -3767,11 +3834,35 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bls-eth-wasm": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/bls-eth-wasm/-/bls-eth-wasm-1.2.1.tgz", "integrity": "sha512-hl4oBzZQmPGNb9Wt5GI+oEuHM6twGc5HzXCzNZMVLMMg+dltsOuvuioRyLolpDFbncC0BJbGPzP1ZTysUGkksw==" }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -3835,6 +3926,29 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -5209,6 +5323,25 @@ "node": ">=10.17.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", @@ -5370,6 +5503,17 @@ "node": ">=8" } }, + "node_modules/is-retry-allowed": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", + "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -5388,6 +5532,14 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -7881,8 +8033,7 @@ "node_modules/regenerator-runtime": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", - "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", - "dev": true + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" }, "node_modules/regenerator-transform": { "version": "0.15.2", @@ -8280,6 +8431,11 @@ "node": ">=8.0" } }, + "node_modules/ts-log": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.5.tgz", + "integrity": "sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==" + }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -8398,8 +8554,7 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", diff --git a/package.json b/package.json index 2af22b27..0ffc58d8 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "dependencies": { "@lighthouse-web3/kavach": "^0.1.6", "@peculiar/webcrypto": "^1.4.0", + "@pythnetwork/pyth-evm-js": "^1.48.0", "axios": "^1.6.8", "bls-eth-wasm": "^1.0.4", "cli-spinner": "^0.2.10", diff --git a/src/Lighthouse/payPerDeal/fund/abi/crosschain.ts b/src/Lighthouse/payPerDeal/fund/abi/crosschain.ts new file mode 100644 index 00000000..44f8adbd --- /dev/null +++ b/src/Lighthouse/payPerDeal/fund/abi/crosschain.ts @@ -0,0 +1,293 @@ +export default [ + { + inputs: [ + { + internalType: 'address', + name: '_gateway', + type: 'address', + }, + { + internalType: 'address', + name: '_gasReceiver', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'OwnableInvalidOwner', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'OwnableUnauthorizedAccount', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'string', + name: 'destinationChain', + type: 'string', + }, + { + indexed: false, + internalType: 'string', + name: 'destinationContract', + type: 'string', + }, + { + indexed: false, + internalType: 'bytes', + name: 'payload', + type: 'bytes', + }, + ], + name: 'CrossChainDepositInitiated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + inputs: [], + name: 'gasReceiver', + outputs: [ + { + internalType: 'contract IAxelarGasService', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'gateway', + outputs: [ + { + internalType: 'contract IAxelarGateway', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + ], + name: 'getTokenBalance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'string', + name: '_destinationChain', + type: 'string', + }, + { + internalType: 'string', + name: '_destinationContract', + type: 'string', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + ], + name: 'initiateCrossChainDeposit', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'tokenStatus', + outputs: [ + { + internalType: 'bool', + name: 'status', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'decimal', + type: 'uint256', + }, + { + internalType: 'string', + name: 'symbol', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'address', + name: '_receiver', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'transferTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'bool', + name: '_status', + type: 'bool', + }, + { + internalType: 'uint256', + name: '_decimal', + type: 'uint256', + }, + { + internalType: 'string', + name: '_symbol', + type: 'string', + }, + ], + name: 'updateTokenStatus', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] diff --git a/src/Lighthouse/payPerDeal/fund/abi/lighthouseContract.ts b/src/Lighthouse/payPerDeal/fund/abi/lighthouseContract.ts deleted file mode 100644 index 9504c888..00000000 --- a/src/Lighthouse/payPerDeal/fund/abi/lighthouseContract.ts +++ /dev/null @@ -1,393 +0,0 @@ -export default [ - { - inputs: [ - { - internalType: "address", - name: "initialOwner", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - inputs: [], - name: "ENDOWMENT_TRANSFER_FAILED", - type: "error", - }, - { - inputs: [], - name: "INSUFFICIENT_CONTRACT_BALANCE", - type: "error", - }, - { - inputs: [], - name: "INSUFFICIENT_USER_BALANCE", - type: "error", - }, - { - inputs: [], - name: "INVALID_ZERO_ADDRESS", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], - name: "OwnableInvalidOwner", - type: "error", - }, - { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "OwnableUnauthorizedAccount", - type: "error", - }, - { - inputs: [], - name: "TOKEN_APPROVAL_FAILED", - type: "error", - }, - { - inputs: [], - name: "TOKEN_NOT_SUPPORTED", - type: "error", - }, - { - inputs: [], - name: "TOKEN_PAYMENT_FAILED", - type: "error", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "sender", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "tokenAddress", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "txId", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "timestamp", - type: "uint256", - }, - { - indexed: false, - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "ReceivedPayment", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "receiver", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "tokenAddress", - type: "address", - }, - { - indexed: true, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "TokenTransferred", - type: "event", - }, - { - stateMutability: "payable", - type: "fallback", - }, - { - inputs: [], - name: "endowment", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "filForwarder", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_token", - type: "address", - }, - ], - name: "getERC20Balance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getNativeBalance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_token", - type: "address", - }, - ], - name: "getTokenStatus", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - { - internalType: "address", - name: "_token", - type: "address", - }, - ], - name: "receiveToken", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_endowmentAddress", - type: "address", - }, - ], - name: "setEndowment", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_filForwarder", - type: "address", - }, - ], - name: "setFilForwarder", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "tokenStatus", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_token", - type: "address", - }, - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - ], - name: "transferToEndowment", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes", - name: "_destination", - type: "bytes", - }, - { - internalType: "uint256", - name: "_amount", - type: "uint256", - }, - ], - name: "transferToOldAddress", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_tokenAddress", - type: "address", - }, - { - internalType: "bool", - name: "_status", - type: "bool", - }, - ], - name: "updateERC20Token", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, - ]; - \ No newline at end of file diff --git a/src/Lighthouse/payPerDeal/fund/abi/lighthouseEndowment.ts b/src/Lighthouse/payPerDeal/fund/abi/lighthouseEndowment.ts new file mode 100644 index 00000000..e8658118 --- /dev/null +++ b/src/Lighthouse/payPerDeal/fund/abi/lighthouseEndowment.ts @@ -0,0 +1,886 @@ +export default [ + { + inputs: [], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'InvalidInitialization', + type: 'error', + }, + { + inputs: [], + name: 'NotInitializing', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'OwnableInvalidOwner', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'OwnableUnauthorizedAccount', + type: 'error', + }, + { + inputs: [], + name: 'ReentrancyGuardReentrantCall', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint64', + name: 'version', + type: 'uint64', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnerChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bool', + name: 'purchase', + type: 'bool', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + ], + name: 'ReceivedToken', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: true, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'TokenTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'updateBy', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newImplementation', + type: 'address', + }, + ], + name: 'UpdatedContract', + type: 'event', + }, + { + stateMutability: 'payable', + type: 'fallback', + }, + { + inputs: [], + name: 'DEAL_ENGINE_ADDRESS', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'costDecimal', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'bool', + name: '_purchase', + type: 'bool', + }, + { + internalType: 'bytes[]', + name: '_offchainPriceUpdate', + type: 'bytes[]', + }, + ], + name: 'depositFund', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_user', + type: 'address', + }, + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'bool', + name: '_purchase', + type: 'bool', + }, + { + internalType: 'bytes[]', + name: '_offchainPriceUpdate', + type: 'bytes[]', + }, + ], + name: 'depositFund', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'depositToDefi', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'description', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'endowmentFee', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'feeManager', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'feeWallet', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + ], + name: 'getContractBalance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getCost', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + ], + name: 'getPoolBalance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getPoolOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_token', + type: 'address', + }, + ], + name: 'getTokenStatus', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + ], + name: 'getVaultBalance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'id', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_id', + type: 'uint256', + }, + { + internalType: 'string', + name: '_name', + type: 'string', + }, + { + internalType: 'string', + name: '_description', + type: 'string', + }, + { + internalType: 'address', + name: '_initialOwner', + type: 'address', + }, + { + internalType: 'address', + name: '_manager', + type: 'address', + }, + { + internalType: 'address', + name: '_feeManager', + type: 'address', + }, + { + internalType: 'address', + name: '_feeWallet', + type: 'address', + }, + { + internalType: 'uint256', + name: '_endowmentFee', + type: 'uint256', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'manager', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'managerAllowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_user', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'recordUsage', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_manager', + type: 'address', + }, + ], + name: 'setManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_priceFeed', + type: 'address', + }, + ], + name: 'setPriceFeed', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_swap', + type: 'address', + }, + { + internalType: 'address', + name: '_tokenIn', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_amoutOutMin', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_route', + type: 'bytes', + }, + ], + name: 'swapERC20', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_swap', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amountIn', + type: 'uint256', + }, + { + internalType: 'address', + name: '_tokenOut', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amoutOutMin', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_route', + type: 'bytes', + }, + ], + name: 'swapNative', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_receiver', + type: 'address', + }, + { + internalType: 'address', + name: '_token', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'transferTo', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_filTransfer', + type: 'address', + }, + { + internalType: 'bytes', + name: '_dealPayer', + type: 'bytes', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'transferToDealEngine', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_cost', + type: 'uint256', + }, + ], + name: 'updateCost', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_fee', + type: 'uint256', + }, + ], + name: 'updateEndowmentFee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_feeManager', + type: 'address', + }, + ], + name: 'updateFeeManager', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_feeWallet', + type: 'address', + }, + ], + name: 'updateFeeWallet', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'updateManagerAllowance', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'updatePoolOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_tokenAddress', + type: 'address', + }, + { + internalType: 'bool', + name: '_status', + type: 'bool', + }, + { + internalType: 'uint256', + name: '_decimal', + type: 'uint256', + }, + ], + name: 'updateTokenStatus', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userDeposit', + outputs: [ + { + internalType: 'uint256', + name: 'amountPurchased', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountSpent', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_strategy', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'withdrawFromDefi', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + stateMutability: 'payable', + type: 'receive', + }, +] diff --git a/src/Lighthouse/payPerDeal/fund/browser.ts b/src/Lighthouse/payPerDeal/fund/browser.ts index 44319628..92061692 100644 --- a/src/Lighthouse/payPerDeal/fund/browser.ts +++ b/src/Lighthouse/payPerDeal/fund/browser.ts @@ -1,59 +1,115 @@ /* istanbul ignore file */ -import { ethers } from "ethers" -import erc20 from "./abi/erc20" -import lighthuseContract from "./abi/lighthouseContract" -import { lighthouseConfig } from "../../../lighthouse.config" +import { ethers } from 'ethers' +import { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js' +import erc20ABI from './abi/erc20' +import lighthouseEndowmentABI from './abi/lighthouseEndowment' +import crosschainABI from './abi/crosschain' +import { lighthouseConfig } from '../../../lighthouse.config' export default async (amount: number, network: string, token: string) => { try { const config = lighthouseConfig[network] - if(!config) { - throw new Error("Unsupported Network!!!") + if (!config) { + throw new Error('Unsupported Network!!!') } //@ts-ignore const provider = new ethers.BrowserProvider((window as any).ethereum) - const getFeeData=await provider.getFeeData() + const feeData = await provider.getFeeData() const signer = await provider.getSigner() - if(token.toLowerCase()==="native") { - const gasEstimate = await signer.estimateGas({ - to: config.lighthouse_contract_address, - value: amount, - }) - const tx = await signer.sendTransaction({ - to: config.lighthouse_contract_address, - value: amount, - gasLimit: gasEstimate, - gasPrice: getFeeData.gasPrice, - }) + if (network == 'filecoin' || network == 'calibration') { + const endowmentContract = new ethers.Contract( + config.lighthouse_endowment_address, + lighthouseEndowmentABI, + signer + ) + if (token.toLowerCase() === 'native') { + // for pyth offchain price update data + const connection = new EvmPriceServiceConnection( + 'https://hermes.pyth.network' + ) + const priceIds = [ + '0x150ac9b959aee0051e4091f0ef5216d941f590e1c5e7f91cf7635b5c11628c0e', + ] + const offchainPriceUpdate = await connection.getPriceFeedsUpdateData( + priceIds + ) + + const tx = await endowmentContract.depositFund( + ethers.ZeroAddress, + amount, + true, + offchainPriceUpdate, + { + value: amount, + gasPrice: feeData.gasPrice, + } + ) await tx.wait() return tx - } else{ + } else { const tokenAddress = config[`${token.toLowerCase()}_contract_address`] - const paymentContract = new ethers.Contract(config.lighthouse_contract_address, lighthuseContract, signer) - const erc20Contract = new ethers.Contract(tokenAddress, erc20, signer) - const approvalData = erc20Contract.interface.encodeFunctionData("approve", [config.lighthouse_contract_address, amount]); - const approvalTxObject = { - to: tokenAddress, - data: approvalData, - } - const gasEstimateForApproval = await signer.estimateGas(approvalTxObject); - const approvalTx = await erc20Contract.approve(config.lighthouse_contract_address, amount, { - gasLimit: gasEstimateForApproval, - gasPrice: getFeeData.gasPrice, - }) + const erc20Contract = new ethers.Contract( + tokenAddress, + erc20ABI, + signer + ) + + const approvalTx = await erc20Contract.approve( + config.lighthouse_endowment_address, + amount, + { + gasPrice: feeData.gasPrice, + } + ) await approvalTx.wait() - const transferData = paymentContract.interface.encodeFunctionData("receiveToken", [amount, tokenAddress]) - const transferTxObject = { - to: config.lighthouse_contract_address, - data: transferData, - } - const gasEstimateForTransfer = await signer.estimateGas(transferTxObject) - const tx = await paymentContract.receiveToken(amount, tokenAddress, { - gasLimit: gasEstimateForTransfer, - gasPrice: getFeeData.gasPrice, - }) + const tx = await endowmentContract.depositFund( + tokenAddress, + amount, + true, + [], + { + gasPrice: feeData.gasPrice, + } + ) await tx.wait() return tx + } + } else { + const depositContract = new ethers.Contract( + config.crosschain_deposit_initializer, + crosschainABI, + signer + ) + const tokenAddress = config[`${token.toLowerCase()}_contract_address`] + const erc20Contract = new ethers.Contract(tokenAddress, erc20ABI, signer) + + const approvalTx = await erc20Contract.approve( + config.crosschain_deposit_initializer, + amount, + { + gasPrice: feeData.gasPrice, + } + ) + await approvalTx.wait() + const encoder = ethers.AbiCoder.defaultAbiCoder() + const payload = encoder.encode( + ['address', 'address', 'uint256', 'bool'], + [signer.getAddress(), tokenAddress, amount, true] + ) + + const tx = await depositContract.initiateCrossChainDeposit( + tokenAddress, + amount, + 'Filecoin', + lighthouseConfig.filecoin, + payload, + { + value: ethers.parseEther('1'), // Pass gas payment for FVM transaction + gasPrice: feeData.gasPrice, + } + ) + await tx.wait() + return tx } } catch (error: any) { throw new Error(error.message) diff --git a/src/Lighthouse/payPerDeal/fund/node.ts b/src/Lighthouse/payPerDeal/fund/node.ts index 842cb266..61ed77ea 100644 --- a/src/Lighthouse/payPerDeal/fund/node.ts +++ b/src/Lighthouse/payPerDeal/fund/node.ts @@ -1,61 +1,122 @@ /* istanbul ignore file */ -import { ethers } from "ethers" -import erc20 from "./abi/erc20" -import lighthuseContract from "./abi/lighthouseContract" -import { lighthouseConfig } from "../../../lighthouse.config" +import { ethers } from 'ethers' +import { EvmPriceServiceConnection } from '@pythnetwork/pyth-evm-js' +import erc20ABI from './abi/erc20' +import lighthouseEndowmentABI from './abi/lighthouseEndowment' +import crosschainABI from './abi/crosschain' +import { lighthouseConfig } from '../../../lighthouse.config' -export default async (amount: number, network: string, token: string, privateKey: string|undefined) => { +export default async ( + amount: number, + network: string, + token: string, + privateKey: string | undefined +) => { try { - if(!privateKey) { - throw new Error("Private Key not found!!!") + if (!privateKey) { + throw new Error('Private Key not found!!!') } const config = lighthouseConfig[network] - if(!config) { - throw new Error("Unsupported Network!!!") + if (!config) { + throw new Error('Unsupported Network!!!') } const provider = new ethers.JsonRpcProvider(config.rpc) - const getFeeData=await provider.getFeeData() + const feeData = await provider.getFeeData() const signer = new ethers.Wallet(privateKey, provider) - if(token.toLowerCase()==="native") { - const gasEstimate = await signer.estimateGas({ - to: config.lighthouse_contract_address, - value: amount, - }) - const tx = await signer.sendTransaction({ - to: config.lighthouse_contract_address, + if (network == 'filecoin' || network == 'calibration') { + const endowmentContract = new ethers.Contract( + config.lighthouse_endowment_address, + lighthouseEndowmentABI, + signer + ) + if (token.toLowerCase() === 'native') { + // for pyth offchain price update data + const connection = new EvmPriceServiceConnection( + 'https://hermes.pyth.network' + ) + const priceIds = [ + '0x150ac9b959aee0051e4091f0ef5216d941f590e1c5e7f91cf7635b5c11628c0e', + ] + const offchainPriceUpdate = await connection.getPriceFeedsUpdateData( + priceIds + ) + + const tx = await endowmentContract.depositFund( + ethers.ZeroAddress, + amount, + true, + offchainPriceUpdate, + { value: amount, - gasLimit: gasEstimate, - gasPrice: getFeeData.gasPrice, - }) + gasPrice: feeData.gasPrice, + } + ) await tx.wait() return tx - } else{ + } else { const tokenAddress = config[`${token.toLowerCase()}_contract_address`] - const paymentContract = new ethers.Contract(config.lighthouse_contract_address, lighthuseContract, signer) - const erc20Contract = new ethers.Contract(tokenAddress, erc20, signer) - const approvalData = erc20Contract.interface.encodeFunctionData("approve", [config.lighthouse_contract_address, amount]) - const approvalTxObject = { - to: tokenAddress, - data: approvalData, - } - const gasEstimateForApproval = await signer.estimateGas(approvalTxObject) - const approvalTx = await erc20Contract.approve(config.lighthouse_contract_address, amount, { - gasLimit: gasEstimateForApproval, - gasPrice: getFeeData.gasPrice, - }) + const erc20Contract = new ethers.Contract( + tokenAddress, + erc20ABI, + signer + ) + + const approvalTx = await erc20Contract.approve( + config.lighthouse_endowment_address, + amount, + { + gasPrice: feeData.gasPrice, + } + ) await approvalTx.wait() - const transferData = paymentContract.interface.encodeFunctionData("receiveToken", [amount, tokenAddress]) - const transferTxObject = { - to: config.lighthouse_contract_address, - data: transferData, - } - const gasEstimateForTransfer = await signer.estimateGas(transferTxObject) - const tx = await paymentContract.receiveToken(amount, tokenAddress, { - gasLimit: gasEstimateForTransfer, - gasPrice: getFeeData.gasPrice, - }) + const tx = await endowmentContract.depositFund( + tokenAddress, + amount, + true, + [], + { + gasPrice: feeData.gasPrice, + } + ) await tx.wait() return tx + } + } else { + const depositContract = new ethers.Contract( + config.crosschain_deposit_initializer, + crosschainABI, + signer + ) + const tokenAddress = config[`${token.toLowerCase()}_contract_address`] + const erc20Contract = new ethers.Contract(tokenAddress, erc20ABI, signer) + + const approvalTx = await erc20Contract.approve( + config.crosschain_deposit_initializer, + amount, + { + gasPrice: feeData.gasPrice, + } + ) + await approvalTx.wait() + const encoder = ethers.AbiCoder.defaultAbiCoder() + const payload = encoder.encode( + ['address', 'address', 'uint256', 'bool'], + [signer.getAddress(), tokenAddress, amount, true] + ) + + const tx = await depositContract.initiateCrossChainDeposit( + tokenAddress, + amount, + 'Filecoin', + lighthouseConfig.filecoin, + payload, + { + value: ethers.parseEther('1'), // Pass gas payment for FVM transaction + gasPrice: feeData.gasPrice, + } + ) + await tx.wait() + return tx } } catch (error: any) { throw new Error(error.message) diff --git a/src/lighthouse.config.ts b/src/lighthouse.config.ts index 26d50cd2..f247b1b4 100644 --- a/src/lighthouse.config.ts +++ b/src/lighthouse.config.ts @@ -22,13 +22,17 @@ const defaultConfig = { scan: 'https://polygonscan.com/tx/', chain_id: '137', lighthouse_contract_address: '0xaD13C488b01DbcE976B67e552Bd352e824E53E1D', + crosschain_deposit_initializer: + '0x9478202353e3b3e653719b792dCdb5BA675A476d', + axlusdc_contract_address: '0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed', usdt_contract_address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', usdc_contract_address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', dai_contract_address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + axlusdc_contract_decimal: 6, usdt_contract_decimal: 6, usdc_contract_decimal: 6, dai_contract_decimal: 18, - native_decimal: 18 + native_decimal: 18, }, binance: { symbol: 'BNB', @@ -59,20 +63,21 @@ const defaultConfig = { rpc: 'https://api.node.glif.io', scan: 'https://filfox.info/en/message/', chain_id: '314', - lighthouse_contract_address: '0x1ed0f8B8736c7835a1ee54D791cda7ADA3cd5e94', - usdc_contract_address: '0xEB466342C4d449BC9f53A865D5Cb90586f405215', - usdc_contract_decimal: 6, + lighthouse_endowment_address: '0xa8f5F980937D2638F9B08CE4261B041F9f9C9557', + crosschain_deposit_receiver: '0x7a2aAf1b3FbF1daB38C00A42f19D25f528E4957d', + axlusdc_contract_address: '0xEB466342C4d449BC9f53A865D5Cb90586f405215', // axlUSDC + axlusdc_contract_decimal: 6, native_decimal: 18, }, - 'calibration': { + calibration: { symbol: 'FIL', rpc: 'https://api.calibration.node.glif.io/rpc/v1', scan: 'https://calibration.filfox.info/en/message/', chain_id: '314159', - lighthouse_contract_address: '0x808a85bbFD82369A3B0c6eFFd4Be1d475F05a6a0', - usdt_contract_address: '0xA471B7936906fF810865e52AF86C12B9865C850A', - usdt_contract_decimal: 18, - native_decimal: 18 + lighthouse_endowment_address: '0xa4DC368C2b8A3b4c94433F6D49330bC92941F270', + axlusdc_contract_address: '0xCb7996d51Ff923b2C6076d42C065a6ca000D32A1', //aUSDC + axlusdc_contract_decimal: 6, + native_decimal: 18, }, 'fantom-testnet': { symbol: 'FTM',