update prettier and lint-staged rules

pull/4030/head
Joseph Izang 1 year ago
parent 8379fed940
commit 6afb260305
  1. 2
      .lintstagedrc.json
  2. 9
      .prettierrc.json
  3. 304
      libs/remix-ws-templates/src/script-templates/contract-deployer/create2-factory-deploy.ts

@ -1,3 +1,3 @@
{ {
"*.{tsx,ts,js,jsx,mjs,cjs}": ["prettier --write","eslint --fix"] "**/*.{tsx,ts,js,jsx,mjs,cjs}": ["prettier --write","eslint --fix"]
} }

@ -3,12 +3,5 @@
"useTabs": false, "useTabs": false,
"printWidth": 180, "printWidth": 180,
"semi": false, "semi": false,
"singleQuote": true, "singleQuote": true
"quoteProps": "consistent",
"jsxSingleQuote": false,
"bracketSpacing": false,
"trailingComma": "none",
"jsxBracketSameLine": false,
"arrowParens": "always",
"singleAttributePerLine": false
} }

@ -1,8 +1,7 @@
import { ethers } from 'ethers' import { ethers } from 'ethers'
// https://etherscan.io/address/0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2#code // https://etherscan.io/address/0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2#code
export const CREATE2_DEPLOYER_ADDRESS = export const CREATE2_DEPLOYER_ADDRESS = '0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2'
"0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2";
/** /**
* Deploy the given contract using a factory * Deploy the given contract using a factory
@ -14,13 +13,12 @@ export const CREATE2_DEPLOYER_ADDRESS =
* @return {string} deployed contract address * @return {string} deployed contract address
*/ */
export const deploy = async (contractName: string, args: Array<any>, salt: string, accountIndex?: number): Promise<string> => { export const deploy = async (contractName: string, args: Array<any>, salt: string, accountIndex?: number): Promise<string> => {
console.log(`deploying ${contractName}`) console.log(`deploying ${contractName}`)
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex) const signer = new ethers.providers.Web3Provider(web3Provider).getSigner(accountIndex)
const factory = new ethers.Contract(CREATE2_DEPLOYER_ADDRESS, contractDeployerAbi, signer);
const factory = new ethers.Contract(CREATE2_DEPLOYER_ADDRESS, contractDeployerAbi, signer)
//@ts-ignore
const contract = await ethers.getContractFactory(contractName) const contract = await ethers.getContractFactory(contractName)
const initCode = contract.getDeployTransaction(args) const initCode = contract.getDeployTransaction(args)
@ -40,219 +38,219 @@ export const deploy = async (contractName: string, args: Array<any>, salt: strin
export const contractDeployerAbi = [ export const contractDeployerAbi = [
{ {
"anonymous": false, anonymous: false,
"inputs": [ inputs: [
{ {
"indexed": true, indexed: true,
"internalType": "address", internalType: 'address',
"name": "previousOwner", name: 'previousOwner',
"type": "address" type: 'address',
}, },
{ {
"indexed": true, indexed: true,
"internalType": "address", internalType: 'address',
"name": "newOwner", name: 'newOwner',
"type": "address" type: 'address',
} },
], ],
"name": "OwnershipTransferred", name: 'OwnershipTransferred',
"type": "event" type: 'event',
}, },
{ {
"anonymous": false, anonymous: false,
"inputs": [ inputs: [
{ {
"indexed": false, indexed: false,
"internalType": "address", internalType: 'address',
"name": "account", name: 'account',
"type": "address" type: 'address',
} },
], ],
"name": "Paused", name: 'Paused',
"type": "event" type: 'event',
}, },
{ {
"anonymous": false, anonymous: false,
"inputs": [ inputs: [
{ {
"indexed": false, indexed: false,
"internalType": "address", internalType: 'address',
"name": "account", name: 'account',
"type": "address" type: 'address',
} },
], ],
"name": "Unpaused", name: 'Unpaused',
"type": "event" type: 'event',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "salt", name: 'salt',
"type": "bytes32" type: 'bytes32',
}, },
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "codeHash", name: 'codeHash',
"type": "bytes32" type: 'bytes32',
} },
], ],
"name": "computeAddress", name: 'computeAddress',
"outputs": [ outputs: [
{ {
"internalType": "address", internalType: 'address',
"name": "", name: '',
"type": "address" type: 'address',
} },
], ],
"stateMutability": "view", stateMutability: 'view',
"type": "function" type: 'function',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "salt", name: 'salt',
"type": "bytes32" type: 'bytes32',
}, },
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "codeHash", name: 'codeHash',
"type": "bytes32" type: 'bytes32',
}, },
{ {
"internalType": "address", internalType: 'address',
"name": "deployer", name: 'deployer',
"type": "address" type: 'address',
} },
], ],
"name": "computeAddressWithDeployer", name: 'computeAddressWithDeployer',
"outputs": [ outputs: [
{ {
"internalType": "address", internalType: 'address',
"name": "", name: '',
"type": "address" type: 'address',
} },
], ],
"stateMutability": "pure", stateMutability: 'pure',
"type": "function" type: 'function',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "uint256", internalType: 'uint256',
"name": "value", name: 'value',
"type": "uint256" type: 'uint256',
}, },
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "salt", name: 'salt',
"type": "bytes32" type: 'bytes32',
}, },
{ {
"internalType": "bytes", internalType: 'bytes',
"name": "code", name: 'code',
"type": "bytes" type: 'bytes',
} },
], ],
"name": "deploy", name: 'deploy',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "uint256", internalType: 'uint256',
"name": "value", name: 'value',
"type": "uint256" type: 'uint256',
}, },
{ {
"internalType": "bytes32", internalType: 'bytes32',
"name": "salt", name: 'salt',
"type": "bytes32" type: 'bytes32',
} },
], ],
"name": "deployERC1820Implementer", name: 'deployERC1820Implementer',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "address payable", internalType: 'address payable',
"name": "payoutAddress", name: 'payoutAddress',
"type": "address" type: 'address',
} },
], ],
"name": "killCreate2Deployer", name: 'killCreate2Deployer',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [], inputs: [],
"name": "owner", name: 'owner',
"outputs": [ outputs: [
{ {
"internalType": "address", internalType: 'address',
"name": "", name: '',
"type": "address" type: 'address',
} },
], ],
"stateMutability": "view", stateMutability: 'view',
"type": "function" type: 'function',
}, },
{ {
"inputs": [], inputs: [],
"name": "pause", name: 'pause',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [], inputs: [],
"name": "paused", name: 'paused',
"outputs": [ outputs: [
{ {
"internalType": "bool", internalType: 'bool',
"name": "", name: '',
"type": "bool" type: 'bool',
} },
], ],
"stateMutability": "view", stateMutability: 'view',
"type": "function" type: 'function',
}, },
{ {
"inputs": [], inputs: [],
"name": "renounceOwnership", name: 'renounceOwnership',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [ inputs: [
{ {
"internalType": "address", internalType: 'address',
"name": "newOwner", name: 'newOwner',
"type": "address" type: 'address',
} },
], ],
"name": "transferOwnership", name: 'transferOwnership',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"inputs": [], inputs: [],
"name": "unpause", name: 'unpause',
"outputs": [], outputs: [],
"stateMutability": "nonpayable", stateMutability: 'nonpayable',
"type": "function" type: 'function',
}, },
{ {
"stateMutability": "payable", stateMutability: 'payable',
"type": "receive" type: 'receive',
} },
] ]
Loading…
Cancel
Save