diff --git a/.changeset/slick-baths-teach.md b/.changeset/slick-baths-teach.md new file mode 100644 index 000000000..2149d8c08 --- /dev/null +++ b/.changeset/slick-baths-teach.md @@ -0,0 +1,5 @@ +--- +"@sei-js/precompiles": patch +--- + +Fixed oracle precompile address in @sei-js/precompiles and removed confidential transfers diff --git a/docs/llms-full.txt b/docs/llms-full.txt index e9ddeebc5..3b1e5fab6 100644 --- a/docs/llms-full.txt +++ b/docs/llms-full.txt @@ -46,9 +46,6 @@ Address association between EVM and Cosmos addresses. Allows mapping between the ### Bank (0x1001) Token operations including transfers, balances, and supply queries. Access Sei's native token functionality from EVM. -### Confidential Transfers (0x1010) -Privacy features for confidential transactions. Enables private transfers with selective disclosure. - ### Distribution (0x1007) Reward distribution for staking and governance. Access staking rewards and community pool funds. @@ -61,7 +58,7 @@ Cross-chain transfers using the Inter-Blockchain Communication protocol. Send to ### JSON (0x1003) JSON parsing utilities for smart contracts. Simplifies handling JSON data in EVM contracts. -### Oracle (0x1002) +### Oracle (0x1008) Price feeds and TWAPs for DeFi applications. Access reliable price data for various assets. ### Pointer (0x100B) diff --git a/docs/precompiles/precompiles/oracle.mdx b/docs/precompiles/precompiles/oracle.mdx index c3c7ff1b4..ea5e56381 100644 --- a/docs/precompiles/precompiles/oracle.mdx +++ b/docs/precompiles/precompiles/oracle.mdx @@ -8,7 +8,7 @@ icon: "crystal-ball" The Oracle precompile provides access to Sei's native oracle system, allowing you to query real-time exchange rates and time-weighted average prices (TWAP) for various assets. This precompile bridges EVM contracts with Sei's oracle module for price data. -**Contract Address:** `0x0000000000000000000000000000000000001002` +**Contract Address:** `0x0000000000000000000000000000000000001008` ## Key Features diff --git a/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts b/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts index aaba679d2..b0f55d49c 100644 --- a/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts +++ b/packages/precompiles/src/ethers/__tests__/ethersPrecompiles.spec.ts @@ -3,7 +3,6 @@ import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers'; import { ETHERS_ADDRESS_PRECOMPILE_ABI, ETHERS_BANK_PRECOMPILE_ABI, - ETHERS_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, ETHERS_DISTRIBUTION_PRECOMPILE_ABI, ETHERS_GOVERNANCE_PRECOMPILE_ABI, ETHERS_IBC_PRECOMPILE_ABI, @@ -15,7 +14,6 @@ import { ETHERS_WASM_PRECOMPILE_ABI, getAddressPrecompileEthersV6Contract, getBankPrecompileEthersV6Contract, - getConfidentialTransfersPrecompileEthersV6Contract, getDistributionPrecompileEthersV6Contract, getGovernancePrecompileEthersV6Contract, getIbcPrecompileEthersV6Contract, @@ -32,8 +30,6 @@ import { ADDRESS_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, BANK_PRECOMPILE_ADDRESS, - CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, - CONFIDENTIAL_TRANSFERS_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, DISTRIBUTION_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, @@ -60,13 +56,6 @@ import { ETHERS_SOLO_PRECOMPILE_ABI, getSoloPrecompileEthersV6Contract } from '. const FACTORIES: [string, string, InterfaceAbi, unknown, (runner: ContractRunner) => Contract][] = [ ['ADDRESS', ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI, ETHERS_ADDRESS_PRECOMPILE_ABI, getAddressPrecompileEthersV6Contract], ['BANK', BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, ETHERS_BANK_PRECOMPILE_ABI, getBankPrecompileEthersV6Contract], - [ - 'CONFIDENTIAL_TRANSFERS', - CONFIDENTIAL_TRANSFERS_PRECOMPILE_ADDRESS, - CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, - ETHERS_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, - getConfidentialTransfersPrecompileEthersV6Contract - ], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, ETHERS_DISTRIBUTION_PRECOMPILE_ABI, getDistributionPrecompileEthersV6Contract], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, ETHERS_GOVERNANCE_PRECOMPILE_ABI, getGovernancePrecompileEthersV6Contract], ['IBC', IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI, ETHERS_IBC_PRECOMPILE_ABI, getIbcPrecompileEthersV6Contract], diff --git a/packages/precompiles/src/ethers/confidentialTransfersPrecompile.ts b/packages/precompiles/src/ethers/confidentialTransfersPrecompile.ts deleted file mode 100644 index b13b411be..000000000 --- a/packages/precompiles/src/ethers/confidentialTransfersPrecompile.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Contract, type ContractRunner, type InterfaceAbi } from 'ethers'; -import { CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, CONFIDENTIAL_TRANSFERS_PRECOMPILE_ADDRESS } from '../precompiles'; - -/** - * The ABI for the Confidential Transfers precompile contract, used to create an Ethers contract. - * @category ABI - */ -export const ETHERS_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI = CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI as InterfaceAbi; - -/** - * Creates and returns a typed Ethers v6 contract instance for the Confidential Transfers precompile contract. - * This contract is used for interacting with the Confidential Transfers module while using the EVM. - * - * @example - * ```tsx - * import { getConfidentialTransfersPrecompileEthersV6Contract } from '@sei-js/precompiles/ethers'; - * import { ethers } from 'ethers'; - * - * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider - * const signer = await provider.getSigner(); - * - * const accounts = await provider.send('eth_requestAccounts', []); - * - * const confidentialTransfersPrecompileContract = getConfidentialTransfersPrecompileEthersV6Contract(signer); - * - * const seiAddr = await confidentialTransfersPrecompileContract.initializeAccount(props); - * ``` - * - * @param runner A [Provider](https://docs.ethers.org/v6/api/providers/) (read-only) or ethers.Signer to use with the contract. - * @returns The typed contract instance for interacting with the precompile contract. - * @category Contract Factory - */ -export function getConfidentialTransfersPrecompileEthersV6Contract(runner: ContractRunner) { - return new Contract(CONFIDENTIAL_TRANSFERS_PRECOMPILE_ADDRESS, ETHERS_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, runner); -} diff --git a/packages/precompiles/src/ethers/index.ts b/packages/precompiles/src/ethers/index.ts index d0bde5dc2..fea8ea58e 100644 --- a/packages/precompiles/src/ethers/index.ts +++ b/packages/precompiles/src/ethers/index.ts @@ -1,6 +1,5 @@ export * from './addressPrecompile'; export * from './bankPrecompile'; -export * from './confidentialTransfersPrecompile'; export * from './distributionPrecompile'; export * from './governancePrecompile'; export * from './ibcPrecompile'; diff --git a/packages/precompiles/src/precompiles/confidential_transfers.ts b/packages/precompiles/src/precompiles/confidential_transfers.ts deleted file mode 100644 index eb767ec27..000000000 --- a/packages/precompiles/src/precompiles/confidential_transfers.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * The address of the Confidential Transfers precompile contract. - * This contract facilitates the interaction with the Confidential Transfers module using the EVM. - * @category Address - */ -export const CONFIDENTIAL_TRANSFERS_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001010'; - -/** - * The ABI for the Confidential Transfers precompile contract. - * @category ABI - */ -export const CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI = [ - { - inputs: [ - { internalType: 'string', name: 'fromAddress', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'bytes', name: 'publicKey', type: 'bytes' }, - { internalType: 'string', name: 'decryptableBalance', type: 'string' }, - { internalType: 'bytes', name: 'pendingBalanceLo', type: 'bytes' }, - { internalType: 'bytes', name: 'pendingBalanceHi', type: 'bytes' }, - { internalType: 'bytes', name: 'availableBalance', type: 'bytes' }, - { internalType: 'bytes', name: 'proofs', type: 'bytes' } - ], - name: 'initializeAccount', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'toAddress', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'bytes', name: 'fromAmountLo', type: 'bytes' }, - { internalType: 'bytes', name: 'fromAmountHi', type: 'bytes' }, - { internalType: 'bytes', name: 'toAmountLo', type: 'bytes' }, - { internalType: 'bytes', name: 'toAmountHi', type: 'bytes' }, - { internalType: 'bytes', name: 'remainingBalance', type: 'bytes' }, - { internalType: 'string', name: 'decryptableBalance', type: 'string' }, - { internalType: 'bytes', name: 'proofs', type: 'bytes' } - ], - name: 'transfer', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'toAddress', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'bytes', name: 'fromAmountLo', type: 'bytes' }, - { internalType: 'bytes', name: 'fromAmountHi', type: 'bytes' }, - { internalType: 'bytes', name: 'toAmountLo', type: 'bytes' }, - { internalType: 'bytes', name: 'toAmountHi', type: 'bytes' }, - { internalType: 'bytes', name: 'remainingBalance', type: 'bytes' }, - { internalType: 'string', name: 'decryptableBalance', type: 'string' }, - { internalType: 'bytes', name: 'proofs', type: 'bytes' }, - { - components: [ - { internalType: 'string', name: 'auditorAddress', type: 'string' }, - { - internalType: 'bytes', - name: 'encryptedTransferAmountLo', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'encryptedTransferAmountHi', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'transferAmountLoValidityProof', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'transferAmountHiValidityProof', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'transferAmountLoEqualityProof', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'transferAmountHiEqualityProof', - type: 'bytes' - } - ], - internalType: 'struct ICT.Auditor[]', - name: 'auditors', - type: 'tuple[]' - } - ], - name: 'transferWithAuditors', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'uint64', name: 'amount', type: 'uint64' } - ], - name: 'deposit', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'string', name: 'decryptableBalance', type: 'string' }, - { - internalType: 'uint32', - name: 'pendingBalanceCreditCounter', - type: 'uint32' - }, - { internalType: 'bytes', name: 'availableBalance', type: 'bytes' } - ], - name: 'applyPendingBalance', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'uint256', name: 'amount', type: 'uint256' }, - { internalType: 'string', name: 'decryptableBalance', type: 'string' }, - { - internalType: 'bytes', - name: 'remainingBalanceCommitment', - type: 'bytes' - }, - { internalType: 'bytes', name: 'proofs', type: 'bytes' } - ], - name: 'withdraw', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'denom', type: 'string' }, - { internalType: 'bytes', name: 'proofs', type: 'bytes' } - ], - name: 'closeAccount', - outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { internalType: 'string', name: 'addr', type: 'string' }, - { internalType: 'string', name: 'denom', type: 'string' } - ], - name: 'account', - outputs: [ - { - components: [ - { internalType: 'bytes', name: 'publicKey', type: 'bytes' }, - { internalType: 'bytes', name: 'pendingBalanceLo', type: 'bytes' }, - { internalType: 'bytes', name: 'pendingBalanceHi', type: 'bytes' }, - { - internalType: 'uint32', - name: 'pendingBalanceCreditCounter', - type: 'uint32' - }, - { internalType: 'bytes', name: 'availableBalance', type: 'bytes' }, - { - internalType: 'string', - name: 'decryptableAvailableBalance', - type: 'string' - } - ], - internalType: 'struct CtAccount', - name: 'ctAccount', - type: 'tuple' - } - ], - stateMutability: 'view', - type: 'function' - } -] as const; diff --git a/packages/precompiles/src/precompiles/index.ts b/packages/precompiles/src/precompiles/index.ts index be98a4761..aaef11e4a 100644 --- a/packages/precompiles/src/precompiles/index.ts +++ b/packages/precompiles/src/precompiles/index.ts @@ -1,6 +1,5 @@ export * from './address'; export * from './bank'; -export * from './confidential_transfers'; export * from './distribution'; export * from './governance'; export * from './ibc'; diff --git a/packages/precompiles/src/precompiles/oracle.ts b/packages/precompiles/src/precompiles/oracle.ts index b2f86ee55..4fc3f1d39 100644 --- a/packages/precompiles/src/precompiles/oracle.ts +++ b/packages/precompiles/src/precompiles/oracle.ts @@ -2,7 +2,7 @@ * The address of the Oracle precompile contract. * @category Address */ -export const ORACLE_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001002'; +export const ORACLE_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001008'; /** * The ABI for the Oracle precompile contract. diff --git a/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts b/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts index 6bb1a5ad2..1595ea1ca 100644 --- a/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts +++ b/packages/precompiles/src/viem/__tests__/viemPrecompiles.spec.ts @@ -2,7 +2,6 @@ import type { Abi } from 'viem'; import { ADDRESS_PRECOMPILE_ABI, BANK_PRECOMPILE_ABI, - CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, DISTRIBUTION_PRECOMPILE_ABI, GOVERNANCE_PRECOMPILE_ABI, IBC_PRECOMPILE_ABI, @@ -18,7 +17,6 @@ import { import { VIEM_ADDRESS_PRECOMPILE_ABI, VIEM_BANK_PRECOMPILE_ABI, - VIEM_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, VIEM_DISTRIBUTION_PRECOMPILE_ABI, VIEM_GOVERNANCE_PRECOMPILE_ABI, VIEM_IBC_PRECOMPILE_ABI, @@ -34,7 +32,6 @@ import { const PRECOMPILE_VIEM_ABIS: [string, Abi][] = [ ['ADDRESS', ADDRESS_PRECOMPILE_ABI as Abi], ['BANK', BANK_PRECOMPILE_ABI as Abi], - ['CONFIDENTIAL_TRANSFERS', CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI as Abi], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI as Abi], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI as Abi], ['IBC', IBC_PRECOMPILE_ABI as Abi], @@ -59,7 +56,6 @@ describe('Viem precompile ABIs', () => { const ABI_PAIRS: [string, Abi, Abi][] = [ ['ADDRESS', ADDRESS_PRECOMPILE_ABI, VIEM_ADDRESS_PRECOMPILE_ABI], ['BANK', BANK_PRECOMPILE_ABI, VIEM_BANK_PRECOMPILE_ABI], - ['CONFIDENTIAL_TRANSFERS', CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI, VIEM_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI], ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI, VIEM_DISTRIBUTION_PRECOMPILE_ABI], ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI, VIEM_GOVERNANCE_PRECOMPILE_ABI], ['IBC', IBC_PRECOMPILE_ABI, VIEM_IBC_PRECOMPILE_ABI], diff --git a/packages/precompiles/src/viem/confidentialTransfersPrecompile.ts b/packages/precompiles/src/viem/confidentialTransfersPrecompile.ts deleted file mode 100644 index 2ef7a867d..000000000 --- a/packages/precompiles/src/viem/confidentialTransfersPrecompile.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Abi } from 'viem'; -import { CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI } from '../precompiles'; - -/** - * The Viem ABI for the Confidential Transfers precompile contract. - * @category ABI - */ -export const VIEM_CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI = CONFIDENTIAL_TRANSFERS_PRECOMPILE_ABI as Abi; diff --git a/packages/precompiles/src/viem/index.ts b/packages/precompiles/src/viem/index.ts index 9989b83dd..e392bfad2 100644 --- a/packages/precompiles/src/viem/index.ts +++ b/packages/precompiles/src/viem/index.ts @@ -1,6 +1,5 @@ export * from './addressPrecompile'; export * from './bankPrecompile'; -export * from './confidentialTransfersPrecompile'; export * from './distributionPrecompile'; export * from './governancePrecompile'; export * from './ibcPrecompile';