order placement working
This commit is contained in:
@@ -53,6 +53,6 @@ export const vaultAbi = [
|
|||||||
'function withdrawTo(address payable,uint256) public',
|
'function withdrawTo(address payable,uint256) public',
|
||||||
'function withdraw(address,uint256) public',
|
'function withdraw(address,uint256) public',
|
||||||
'function withdrawTo(address,address,uint256) public',
|
'function withdrawTo(address,address,uint256) public',
|
||||||
`function placeOrder(${SwapOrder}) public`,
|
'function placeOrder((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint64,(uint8,bytes)[])[])) public',
|
||||||
`function placeOrders(${SwapOrder}[],uint8) public`,
|
'function placeOrders((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint64,(uint8,bytes)[])[])[],uint8) public',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -4,16 +4,10 @@ import {useStore} from "@/store/store.js";
|
|||||||
import {provider} from "@/blockchain/wallet.js";
|
import {provider} from "@/blockchain/wallet.js";
|
||||||
|
|
||||||
|
|
||||||
export function vaultAddress( owner, num ) {
|
export function vaultAddress( owner, num=0) {
|
||||||
const s = useStore()
|
const s = useStore()
|
||||||
if( s.vaultInitCodeHash === null || s.factory === null )
|
const salt = ethers.solidityPackedKeccak256(['address','uint8'],[owner,num])
|
||||||
return null
|
return ethers.getCreate2Address(s.factory, salt, s.vaultInitCodeHash)
|
||||||
const abiCoder = ethers.AbiCoder.defaultAbiCoder();
|
|
||||||
console.log('vaultAddress owner', owner)
|
|
||||||
const salt = ethers.keccak256(abiCoder.encode(['address','uint8'],[owner,num]))
|
|
||||||
const result = ethers.getCreate2Address(s.factory, salt, s.vaultInitCodeHash)
|
|
||||||
console.log('vaultAddress', result, s.factory, salt, s.vaultInitCodeHash)
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,15 @@ export function onChainChanged(chainId) {
|
|||||||
chainId = Number(chainId)
|
chainId = Number(chainId)
|
||||||
// console.log('chain changed', chainId)
|
// console.log('chain changed', chainId)
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
store.chainId = chainId
|
if( chainId !== store.chainId ) {
|
||||||
store.account = null
|
store.chainId = chainId
|
||||||
provider = new ethers.BrowserProvider(window.ethereum, chainId)
|
store.account = null
|
||||||
provider.listAccounts().then(onAccountsChanged)
|
provider = new ethers.BrowserProvider(window.ethereum, chainId)
|
||||||
|
provider.listAccounts().then(onAccountsChanged)
|
||||||
|
new ethers.Interface([
|
||||||
|
// 'event DexorderSwapCreated' // todo
|
||||||
|
])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAccountsChanged(accounts) {
|
function onAccountsChanged(accounts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user