diff --git a/package.json b/package.json index fb81990..a7ed188 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@headlessui/vue": "^1.7.3", "@heroicons/vue": "^2.0.12", "crc": "^3.8.0", + "pinia": "^2.0.23", "qrcode": "^1.5.1", "vue": "^3.2.41", "vue-router": "^4.1.5" @@ -32,6 +33,7 @@ "autoprefixer": "^10.4.12", "eslint": "^8.22.0", "eslint-plugin-vue": "^9.3.0", + "ethers": "^5.7.2", "npm-run-all": "^4.1.5", "postcss": "^8.4.18", "prettier": "^2.7.1", diff --git a/src/App.vue b/src/App.vue index d6fbc35..9c31a65 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,91 +1,11 @@ - + diff --git a/src/assets/account.svg b/src/assets/account.svg new file mode 100644 index 0000000..2e0660b --- /dev/null +++ b/src/assets/account.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/bg.svg b/src/assets/bg.svg new file mode 100644 index 0000000..4d68b68 --- /dev/null +++ b/src/assets/bg.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/chevronDown.svg b/src/assets/chevronDown.svg new file mode 100644 index 0000000..655a1c5 --- /dev/null +++ b/src/assets/chevronDown.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/ethereum.svg b/src/assets/ethereum.svg new file mode 100644 index 0000000..362923a --- /dev/null +++ b/src/assets/ethereum.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/logo.svg b/src/assets/logo.svg index bc826fe..ebd8aa2 100644 --- a/src/assets/logo.svg +++ b/src/assets/logo.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + diff --git a/src/assets/main.css b/src/assets/main.css index fd9aa8d..d7b270e 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -4,10 +4,12 @@ @tailwind utilities; #app { - max-width: 1280px; margin: 0 auto; - padding: 2rem; - + padding: 2rem 4rem; + height: fit-content; + min-height: 100vh; + background-image: url( './bg.svg' ); + background-size: cover; font-weight: normal; } @@ -23,16 +25,3 @@ a, background-color: hsla(160, 100%, 37%, 0.2); } } - -@media (min-width: 1024px) { - body { - display: flex; - place-items: center; - } - - #app { - display: grid; - grid-template-columns: 1fr 1fr; - padding: 0 2rem; - } -} diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue deleted file mode 100644 index c201be2..0000000 --- a/src/components/HelloWorld.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/src/components/TheWelcome.vue b/src/components/TheWelcome.vue deleted file mode 100644 index af57c51..0000000 --- a/src/components/TheWelcome.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue new file mode 100644 index 0000000..c43399d --- /dev/null +++ b/src/components/TopBar.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/components/WelcomeItem.vue b/src/components/WelcomeItem.vue deleted file mode 100644 index 6cff194..0000000 --- a/src/components/WelcomeItem.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - diff --git a/src/components/icons/IconCommunity.vue b/src/components/icons/IconCommunity.vue deleted file mode 100644 index ea8ddef..0000000 --- a/src/components/icons/IconCommunity.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/src/components/icons/IconDocumentation.vue b/src/components/icons/IconDocumentation.vue deleted file mode 100644 index 63a8534..0000000 --- a/src/components/icons/IconDocumentation.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/src/components/icons/IconEcosystem.vue b/src/components/icons/IconEcosystem.vue deleted file mode 100644 index 385a202..0000000 --- a/src/components/icons/IconEcosystem.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/src/components/icons/IconSupport.vue b/src/components/icons/IconSupport.vue deleted file mode 100644 index 7db961e..0000000 --- a/src/components/icons/IconSupport.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/src/components/icons/IconTooling.vue b/src/components/icons/IconTooling.vue deleted file mode 100644 index 660598d..0000000 --- a/src/components/icons/IconTooling.vue +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/src/main.ts b/src/main.ts index a198b06..1fa42f8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,13 @@ import { createApp } from "vue"; import App from "./App.vue"; import router from "./router"; +import { createPinia } from "pinia"; import "./assets/main.css"; const app = createApp(App); app.use(router); +app.use(createPinia()); app.mount("#app"); diff --git a/src/model/Pix.ts b/src/model/Pix.ts new file mode 100644 index 0000000..bb96b27 --- /dev/null +++ b/src/model/Pix.ts @@ -0,0 +1,11 @@ +export type Pix = { + pixKey: string; + merchantCity?: string; + merchantName?: string; + value?: number; + transactionId?: string; + message?: string; + cep?: string; + currency?: number; + countryCode?: string; +}; diff --git a/src/router/index.ts b/src/router/index.ts index b53df45..bd6a7af 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,5 +1,6 @@ import { createRouter, createWebHistory } from "vue-router"; import HomeView from "../views/HomeView.vue"; +import QrCodeFormVue from "../views/QrCodeForm.vue"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -9,18 +10,10 @@ const router = createRouter({ name: "home", component: HomeView, }, - { - path: "/about", - name: "about", - // route level code-splitting - // this generates a separate chunk (About.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import("../views/AboutView.vue"), - }, { path: "/pix", name: "pix", - component: () => import("../views/QrCodeForm.vue"), + component: QrCodeFormVue, }, ], }); diff --git a/src/store/ether.ts b/src/store/ether.ts new file mode 100644 index 0000000..b777179 --- /dev/null +++ b/src/store/ether.ts @@ -0,0 +1,16 @@ +import { defineStore } from "pinia"; + +export const useEtherStore = defineStore("ether", { + state: () => ({ + walletAddress: "", + balance: "", + }), + actions: { + setWalletAddress(walletAddress: string) { + this.walletAddress = walletAddress; + }, + setBalance(balance: string) { + this.balance = balance; + }, + }, +}); diff --git a/src/utils/QrCodePix.ts b/src/utils/QrCodePix.ts index 633fa3e..b75b676 100644 --- a/src/utils/QrCodePix.ts +++ b/src/utils/QrCodePix.ts @@ -1,18 +1,7 @@ import qrcode from "qrcode"; import type { QRCodeToDataURLOptions } from "qrcode"; import { crc16ccitt } from "crc"; - -interface PixParams { - pixKey: string; - merchantCity?: string; - merchantName?: string; - value?: number; - transactionId?: string; - message?: string; - cep?: string; - currency?: number; - countryCode?: string; -} +import { type Pix } from "@/model/Pix"; const pix = ({ pixKey, @@ -24,7 +13,7 @@ const pix = ({ transactionId = "***", currency = 986, countryCode = "BR", -}: PixParams) => { +}: Pix) => { const payloadKeyString = generatePixKey(pixKey, message); const payload: string[] = [ @@ -84,4 +73,4 @@ const formatEMV = (id: string, param: string): string => { return `${id}${len}${param}`; }; -export { type PixParams, pix }; +export { pix }; diff --git a/src/utils/blockchain.ts b/src/utils/blockchain.ts new file mode 100644 index 0000000..5a7ad3c --- /dev/null +++ b/src/utils/blockchain.ts @@ -0,0 +1,79 @@ +import { useEtherStore } from "@/store/ether"; +import { ethers } from "ethers"; + +// smart contract imports +import mockToken from "./smart_contract_files/MockToken.json"; +//import p2pix from "./smart_contract_files/P2PIX.json"; +import addresses from "./smart_contract_files/localhost.json"; + +const updateWalletStatus = async (walletAddress: string) => { + const etherStore = useEtherStore(); + const provider = getProvider(); + if (!provider) return; + + const signer = provider.getSigner(); + const contract = new ethers.Contract(addresses.token, mockToken.abi, signer); + + const balance = await contract.balanceOf(walletAddress); + + etherStore.setBalance(String(balance)); + etherStore.setWalletAddress(walletAddress); +}; + +const connectProvider = async () => { + const etherStore = useEtherStore(); + const window_ = window as any; + const connection = window_.ethereum; + let provider: ethers.providers.Web3Provider | null = null; + + if (!connection) return; + provider = new ethers.providers.Web3Provider(connection); + const signer = provider.getSigner(); + const contract = new ethers.Contract(addresses.token, mockToken.abi, signer); + + const walletAddress = await provider.send("eth_requestAccounts", []); + const balance = await contract.balanceOf(walletAddress[0]); + + etherStore.setWalletAddress(walletAddress[0]); + etherStore.setBalance(String(balance)); + + connection.on("accountsChanged", (accounts: string[]) => { + updateWalletStatus(accounts[0]); + }); +}; + +const makeTransaction = async ( + receiverAccountAddress = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", + ammount = "100.0" +) => { + const etherStore = useEtherStore(); + const provider = getProvider(); + if (!provider) return; + + const signer = provider.getSigner(); + const contract = new ethers.Contract(addresses.token, mockToken.abi, signer); + + const tx = await contract.transfer( + receiverAccountAddress, + ethers.utils.parseEther(ammount) + ); + await tx.wait(); + + updateWalletStatus(etherStore.walletAddress); +}; + +const formatEther = (balance: string) => { + const formatted = ethers.utils.formatEther(balance); + return formatted; +}; + +const getProvider = (): ethers.providers.Web3Provider | null => { + const window_ = window as any; + const connection = window_.ethereum; + + if (!connection) return null; + + return new ethers.providers.Web3Provider(connection); +}; + +export default { connectProvider, formatEther, makeTransaction }; diff --git a/src/utils/smart_contract_files/MockToken.json b/src/utils/smart_contract_files/MockToken.json new file mode 100644 index 0000000..086e148 --- /dev/null +++ b/src/utils/smart_contract_files/MockToken.json @@ -0,0 +1,292 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "MockToken", + "sourceName": "contracts/mockToken.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162000b8d38038062000b8d83398101604081905262000034916200021d565b6040805180820182526007815266135bd8dad0949360ca1b6020808301918252835180850190945260048452631350949360e21b9084015281519192916200007f9160039162000177565b5080516200009590600490602084019062000177565b505050620000aa3382620000b160201b60201c565b506200029b565b6001600160a01b0382166200010c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b806002600082825462000120919062000237565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b82805462000185906200025e565b90600052602060002090601f016020900481019282620001a95760008555620001f4565b82601f10620001c457805160ff1916838001178555620001f4565b82800160010185558215620001f4579182015b82811115620001f4578251825591602001919060010190620001d7565b506200020292915062000206565b5090565b5b8082111562000202576000815560010162000207565b6000602082840312156200023057600080fd5b5051919050565b600082198211156200025957634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200027357607f821691505b602082108114156200029557634e487b7160e01b600052602260045260246000fd5b50919050565b6108e280620002ab6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610187578063a9059cbb1461019a578063dd62ed3e146101ad57600080fd5b8063395093511461014357806370a082311461015657806395d89b411461017f57600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101e6565b6040516100e39190610748565b60405180910390f35b6100ff6100fa3660046107b9565b610278565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f3660046107e3565b610290565b604051601281526020016100e3565b6100ff6101513660046107b9565b6102b4565b61011361016436600461081f565b6001600160a01b031660009081526020819052604090205490565b6100d66102f3565b6100ff6101953660046107b9565b610302565b6100ff6101a83660046107b9565b6103b1565b6101136101bb366004610841565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101f590610874565b80601f016020809104026020016040519081016040528092919081815260200182805461022190610874565b801561026e5780601f106102435761010080835404028352916020019161026e565b820191906000526020600020905b81548152906001019060200180831161025157829003601f168201915b5050505050905090565b6000336102868185856103bf565b5060019392505050565b60003361029e8582856104e3565b6102a9858585610575565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061028690829086906102ee9087906108af565b6103bf565b6060600480546101f590610874565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156103a45760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102a982868684036103bf565b600033610286818585610575565b6001600160a01b0383166104215760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161039b565b6001600160a01b0382166104825760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161039b565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461056f57818110156105625760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161039b565b61056f84848484036103bf565b50505050565b6001600160a01b0383166105f15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161039b565b6001600160a01b0382166106535760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161039b565b6001600160a01b038316600090815260208190526040902054818110156106e25760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161039b565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361056f565b600060208083528351808285015260005b8181101561077557858101830151858201604001528201610759565b81811115610787576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146107b457600080fd5b919050565b600080604083850312156107cc57600080fd5b6107d58361079d565b946020939093013593505050565b6000806000606084860312156107f857600080fd5b6108018461079d565b925061080f6020850161079d565b9150604084013590509250925092565b60006020828403121561083157600080fd5b61083a8261079d565b9392505050565b6000806040838503121561085457600080fd5b61085d8361079d565b915061086b6020840161079d565b90509250929050565b600181811c9082168061088857607f821691505b602082108114156108a957634e487b7160e01b600052602260045260246000fd5b50919050565b600082198211156108d057634e487b7160e01b600052601160045260246000fd5b50019056fea164736f6c6343000809000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610187578063a9059cbb1461019a578063dd62ed3e146101ad57600080fd5b8063395093511461014357806370a082311461015657806395d89b411461017f57600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101e6565b6040516100e39190610748565b60405180910390f35b6100ff6100fa3660046107b9565b610278565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f3660046107e3565b610290565b604051601281526020016100e3565b6100ff6101513660046107b9565b6102b4565b61011361016436600461081f565b6001600160a01b031660009081526020819052604090205490565b6100d66102f3565b6100ff6101953660046107b9565b610302565b6100ff6101a83660046107b9565b6103b1565b6101136101bb366004610841565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101f590610874565b80601f016020809104026020016040519081016040528092919081815260200182805461022190610874565b801561026e5780601f106102435761010080835404028352916020019161026e565b820191906000526020600020905b81548152906001019060200180831161025157829003601f168201915b5050505050905090565b6000336102868185856103bf565b5060019392505050565b60003361029e8582856104e3565b6102a9858585610575565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061028690829086906102ee9087906108af565b6103bf565b6060600480546101f590610874565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156103a45760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102a982868684036103bf565b600033610286818585610575565b6001600160a01b0383166104215760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161039b565b6001600160a01b0382166104825760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161039b565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461056f57818110156105625760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161039b565b61056f84848484036103bf565b50505050565b6001600160a01b0383166105f15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161039b565b6001600160a01b0382166106535760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161039b565b6001600160a01b038316600090815260208190526040902054818110156106e25760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161039b565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361056f565b600060208083528351808285015260005b8181101561077557858101830151858201604001528201610759565b81811115610787576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146107b457600080fd5b919050565b600080604083850312156107cc57600080fd5b6107d58361079d565b946020939093013593505050565b6000806000606084860312156107f857600080fd5b6108018461079d565b925061080f6020850161079d565b9150604084013590509250925092565b60006020828403121561083157600080fd5b61083a8261079d565b9392505050565b6000806040838503121561085457600080fd5b61085d8361079d565b915061086b6020840161079d565b90509250929050565b600181811c9082168061088857607f821691505b602082108114156108a957634e487b7160e01b600052602260045260246000fd5b50919050565b600082198211156108d057634e487b7160e01b600052601160045260246000fd5b50019056fea164736f6c6343000809000a", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/utils/smart_contract_files/P2PIX.json b/src/utils/smart_contract_files/P2PIX.json new file mode 100644 index 0000000..aaeaabc --- /dev/null +++ b/src/utils/smart_contract_files/P2PIX.json @@ -0,0 +1,450 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "P2PIX", + "sourceName": "contracts/p2pix.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "defaultBlocks", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "validSigners", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + } + ], + "name": "DepositClosed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "lockID", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "LockAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "lockId", + "type": "bytes32" + } + ], + "name": "LockReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "lockId", + "type": "bytes32" + } + ], + "name": "LockReturned", + "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": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "PremiumsWithdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + } + ], + "name": "cancelDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultLockBlocks", + "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": "pixTarget", + "type": "string" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "depositCount", + "outputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "targetAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "relayerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "relayerPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "expiredLocks", + "type": "bytes32[]" + } + ], + "name": "lock", + "outputs": [ + { + "internalType": "bytes32", + "name": "lockID", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "lockID", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "pixTimestamp", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "name": "release", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "lockIDs", + "type": "bytes32[]" + } + ], + "name": "unlockExpired", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "validBacenSigners", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "depositID", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "expiredLocks", + "type": "bytes32[]" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawPremiums", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b506040516200197238038062001972833981016040819052620000349162000145565b6200003f33620000c2565b600282905560005b81518160ff161015620000b957600160036000848460ff168151811062000072576200007262000225565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000b0816200023b565b91505062000047565b5050506200026a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200014057600080fd5b919050565b600080604083850312156200015957600080fd5b8251602080850151919350906001600160401b03808211156200017b57600080fd5b818601915086601f8301126200019057600080fd5b815181811115620001a557620001a562000112565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000112565b604052918252848201925083810185019189831115620001ec57600080fd5b938501935b828510156200021557620002058562000128565b84529385019392850192620001f1565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff8114156200026157634e487b7160e01b600052601160045260246000fd5b60010192915050565b6116f8806200027a6000396000f3fe6080604052600436106100d25760003560e01c806372fada5c1161007f5780639872dbfe116100595780639872dbfe146101f5578063b93bd7d41461020b578063bfe07da61461024b578063f2fde38b1461025e57600080fd5b806372fada5c1461018d5780638da5cb5b146101ad5780638e2749d6146101d557600080fd5b80634e1389ed116100b05780634e1389ed146101435780636193cdfb14610163578063715018a61461017857600080fd5b806303aaf306146100d75780632dfdf0b51461010a5780633631797214610121575b600080fd5b3480156100e357600080fd5b506100f76100f2366004611345565b61027e565b6040519081526020015b60405180910390f35b34801561011657600080fd5b506001546100f79081565b34801561012d57600080fd5b5061014161013c3660046113c7565b610573565b005b34801561014f57600080fd5b5061014161015e366004611413565b610701565b34801561016f57600080fd5b50610141610b7c565b34801561018457600080fd5b50610141610bf0565b34801561019957600080fd5b506101416101a8366004611466565b610c04565b3480156101b957600080fd5b506000546040516001600160a01b039091168152602001610101565b3480156101e157600080fd5b506101416101f036600461147f565b610ce0565b34801561020157600080fd5b506100f760025481565b34801561021757600080fd5b5061023b6102263660046114c1565b60036020526000908152604090205460ff1681565b6040519015158152602001610101565b6100f76102593660046114e3565b610e62565b34801561026a57600080fd5b506101416102793660046114c1565b6110fd565b600061028a8383610ce0565b60008881526004602081905260409091209081015460ff166102f35760405162461bcd60e51b815260206004820181905260248201527f50325049583a204465706f736974206e6f742076616c696420616e796d6f726560448201526064015b60405180910390fd5b848160020154101561036d5760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204e6f7420656e6f75676820746f6b656e2072656d61696e696e60448201527f67206f6e206465706f736974000000000000000000000000000000000000000060648201526084016102ea565b60408051602081018b9052908101869052606089811b6bffffffffffffffffffffffff1916908201526074016040516020818303038152906040528051906020012091504360056000848152602001908152602001600020600501541061043c5760405162461bcd60e51b815260206004820152603360248201527f50325049583a20416e6f74686572206c6f636b20776974682073616d6520494460448201527f206973206e6f742065787069726564207965740000000000000000000000000060648201526084016102ea565b60006040518060c001604052808b81526020018a6001600160a01b03168152602001896001600160a01b03168152602001888152602001878152602001600254436104879190611580565b9052600084815260056020818152604080842085518155918501516001830180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199182161790915591860151600280850180549290931691909316179055606085015160038301556080850151600483015560a0850151919092015584018054929350889290919061051b908490611598565b9091555050604080518b81526020810188905284916001600160a01b038c16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050979650505050505050565b60008381526004602052604090205483906001600160a01b031633146105f05760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204f6e6c792073656c6c657220636f756c642063616c6c20746860448201526b34b990333ab731ba34b7b71760a11b60648201526084016102ea565b6105fa8383610ce0565b60008481526004602081905260409091209081015460ff16156106205761062085610c04565b60018101548154600283015460405163a9059cbb60e01b81526001600160a01b0392831660048201526024810191909152911690819063a9059cbb90604401602060405180830381600087803b15801561067957600080fd5b505af115801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b191906115af565b506002820180546000909155604080518881526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a250505050505050565b60008581526005602081905260409091209081015443108015610728575060008160040154115b61079a5760405162461bcd60e51b815260206004820152602860248201527f50325049583a204c6f636b20616c72656164792072656c6561736564206f722060448201527f72657475726e656400000000000000000000000000000000000000000000000060648201526084016102ea565b805460009081526004602081815260408084209285015490519293926107c8926005860192918b910161160c565b60405160208183030381529060405280519060200120905060008160405160200161081f91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600690935291205490915060ff16156108bd5760405162461bcd60e51b815260206004820152603160248201527f50325049583a205472616e73616374696f6e20616c726561647920757365642060448201527f746f20756e6c6f636b207061796d656e7400000000000000000000000000000060648201526084016102ea565b6040805160008082526020820180845284905260ff881692820192909252606081018990526080810188905260019060a0016020604051602081039080840390855afa158015610911573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526003602052919091205490925060ff1690506109955760405162461bcd60e51b815260206004820152602360248201527f50325049583a205369676e6572206973206e6f7420612076616c6964207369676044820152623732b960e91b60648201526084016102ea565b60018085015490860154600387015460048801546001600160a01b0393841693849363a9059cbb939116916109ca9190611598565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610a2857600080fd5b505af1158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6091906115af565b50600386015415610afb576002860154600387015460405163a9059cbb60e01b81526001600160a01b03928316600482015260248101919091529082169063a9059cbb90604401602060405180830381600087803b158015610ac157600080fd5b505af1158015610ad5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af991906115af565b505b600060048701819055600587018190558481526006602052604090819020805460ff1916600190811790915587015490516001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d90610b67908e815260200190565b60405180910390a25050505050505050505050565b610b8461118d565b6040514790339082156108fc029083906000818181858888f19350505050158015610bb3573d6000803e3d6000fd5b5060408051338152602081018390527fbf0d92faf65e256806eefa1a0d281d4873cc3c80d1ed25b8ae6f7cc66fc918ef910160405180910390a150565b610bf861118d565b610c0260006111e7565b565b60008181526004602052604090205481906001600160a01b03163314610c815760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204f6e6c792073656c6c657220636f756c642063616c6c20746860448201526b34b990333ab731ba34b7b71760a11b60648201526084016102ea565b600082815260046020818152604092839020918201805460ff19169055905491518481526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a25050565b8060005b818161ffff161015610e5c5760006005600086868561ffff16818110610d0c57610d0c6116b3565b9050602002013581526020019081526020016000209050438160050154108015610d3a575060008160040154115b610dac5760405162461bcd60e51b815260206004820152602b60248201527f50325049583a204c6f636b206e6f742065787069726564206f7220616c72656160448201527f64792072656c656173656400000000000000000000000000000000000000000060648201526084016102ea565b806004015460046000836000015481526020019081526020016000206002016000828254610dda9190611580565b90915550506000600482015560018101546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff868661ffff8616818110610e2b57610e2b6116b3565b90506020020135604051610e4191815260200190565b60405180910390a25080610e54816116c9565b915050610ce4565b50505050565b6000610e6d60015490565b6000818152600460208190526040909120015490915060ff1615610ef95760405162461bcd60e51b815260206004820152603260248201527f50325049583a204465706f73697420616c726561647920657869737420616e6460448201527f206974206973207374696c6c2076616c6964000000000000000000000000000060648201526084016102ea565b6040516323b872dd60e01b81523360048201523060248201526044810185905285906001600160a01b038216906323b872dd90606401602060405180830381600087803b158015610f4957600080fd5b505af1158015610f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8191906115af565b5060006040518060c00160405280336001600160a01b03168152602001886001600160a01b0316815260200187815260200134815260200160011515815260200186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093909452505085815260046020818152604092839020855181546001600160a01b0391821673ffffffffffffffffffffffffffffffffffffffff1991821617835583880151600184018054919093169116179055928501516002840155606085015160038401556080850151918301805492151560ff199093169290921790915560a0840151805194955085949293506110979260058501929190910190611244565b5050600180548101905550604080518481526001600160a01b0389166020820152348183015260608101889052905133917fe0cfbec12278e314697ee34bb7a1ba4d704e84c438680672f7c1175f287e5910919081900360800190a25050949350505050565b61110561118d565b6001600160a01b0381166111815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102ea565b61118a816111e7565b50565b6000546001600160a01b03163314610c025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102ea565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054611250906115d1565b90600052602060002090601f01602090048101928261127257600085556112b8565b82601f1061128b57805160ff19168380011785556112b8565b828001600101855582156112b8579182015b828111156112b857825182559160200191906001019061129d565b506112c49291506112c8565b5090565b5b808211156112c457600081556001016112c9565b80356001600160a01b03811681146112f457600080fd5b919050565b60008083601f84011261130b57600080fd5b50813567ffffffffffffffff81111561132357600080fd5b6020830191508360208260051b850101111561133e57600080fd5b9250929050565b600080600080600080600060c0888a03121561136057600080fd5b87359650611370602089016112dd565b955061137e604089016112dd565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156113a857600080fd5b6113b48a828b016112f9565b989b979a50959850939692959293505050565b6000806000604084860312156113dc57600080fd5b83359250602084013567ffffffffffffffff8111156113fa57600080fd5b611406868287016112f9565b9497909650939450505050565b600080600080600060a0868803121561142b57600080fd5b85359450602086013593506040860135925060608601359150608086013560ff8116811461145857600080fd5b809150509295509295909350565b60006020828403121561147857600080fd5b5035919050565b6000806020838503121561149257600080fd5b823567ffffffffffffffff8111156114a957600080fd5b6114b5858286016112f9565b90969095509350505050565b6000602082840312156114d357600080fd5b6114dc826112dd565b9392505050565b600080600080606085870312156114f957600080fd5b611502856112dd565b935060208501359250604085013567ffffffffffffffff8082111561152657600080fd5b818701915087601f83011261153a57600080fd5b81358181111561154957600080fd5b88602082850101111561155b57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156115935761159361156a565b500190565b6000828210156115aa576115aa61156a565b500390565b6000602082840312156115c157600080fd5b815180151581146114dc57600080fd5b600181811c908216806115e557607f821691505b6020821081141561160657634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061162857607f831692505b602080841082141561164857634e487b7160e01b86526022600452602486fd5b81801561165c576001811461166d5761169a565b60ff1986168952848901965061169a565b60008c81526020902060005b868110156116925781548b820152908501908301611679565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052603260045260246000fd5b600061ffff808316818114156116e1576116e161156a565b600101939250505056fea164736f6c6343000809000a", + "deployedBytecode": "0x6080604052600436106100d25760003560e01c806372fada5c1161007f5780639872dbfe116100595780639872dbfe146101f5578063b93bd7d41461020b578063bfe07da61461024b578063f2fde38b1461025e57600080fd5b806372fada5c1461018d5780638da5cb5b146101ad5780638e2749d6146101d557600080fd5b80634e1389ed116100b05780634e1389ed146101435780636193cdfb14610163578063715018a61461017857600080fd5b806303aaf306146100d75780632dfdf0b51461010a5780633631797214610121575b600080fd5b3480156100e357600080fd5b506100f76100f2366004611345565b61027e565b6040519081526020015b60405180910390f35b34801561011657600080fd5b506001546100f79081565b34801561012d57600080fd5b5061014161013c3660046113c7565b610573565b005b34801561014f57600080fd5b5061014161015e366004611413565b610701565b34801561016f57600080fd5b50610141610b7c565b34801561018457600080fd5b50610141610bf0565b34801561019957600080fd5b506101416101a8366004611466565b610c04565b3480156101b957600080fd5b506000546040516001600160a01b039091168152602001610101565b3480156101e157600080fd5b506101416101f036600461147f565b610ce0565b34801561020157600080fd5b506100f760025481565b34801561021757600080fd5b5061023b6102263660046114c1565b60036020526000908152604090205460ff1681565b6040519015158152602001610101565b6100f76102593660046114e3565b610e62565b34801561026a57600080fd5b506101416102793660046114c1565b6110fd565b600061028a8383610ce0565b60008881526004602081905260409091209081015460ff166102f35760405162461bcd60e51b815260206004820181905260248201527f50325049583a204465706f736974206e6f742076616c696420616e796d6f726560448201526064015b60405180910390fd5b848160020154101561036d5760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204e6f7420656e6f75676820746f6b656e2072656d61696e696e60448201527f67206f6e206465706f736974000000000000000000000000000000000000000060648201526084016102ea565b60408051602081018b9052908101869052606089811b6bffffffffffffffffffffffff1916908201526074016040516020818303038152906040528051906020012091504360056000848152602001908152602001600020600501541061043c5760405162461bcd60e51b815260206004820152603360248201527f50325049583a20416e6f74686572206c6f636b20776974682073616d6520494460448201527f206973206e6f742065787069726564207965740000000000000000000000000060648201526084016102ea565b60006040518060c001604052808b81526020018a6001600160a01b03168152602001896001600160a01b03168152602001888152602001878152602001600254436104879190611580565b9052600084815260056020818152604080842085518155918501516001830180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff199182161790915591860151600280850180549290931691909316179055606085015160038301556080850151600483015560a0850151919092015584018054929350889290919061051b908490611598565b9091555050604080518b81526020810188905284916001600160a01b038c16917f2a28b2ae47b0bd4b104e7cd29b1dfa72846af8c4cfdc009da2ae29db68cb67ea910160405180910390a35050979650505050505050565b60008381526004602052604090205483906001600160a01b031633146105f05760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204f6e6c792073656c6c657220636f756c642063616c6c20746860448201526b34b990333ab731ba34b7b71760a11b60648201526084016102ea565b6105fa8383610ce0565b60008481526004602081905260409091209081015460ff16156106205761062085610c04565b60018101548154600283015460405163a9059cbb60e01b81526001600160a01b0392831660048201526024810191909152911690819063a9059cbb90604401602060405180830381600087803b15801561067957600080fd5b505af115801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b191906115af565b506002820180546000909155604080518881526020810183905233917f7719804546c0185709e60c90d164447ff251a5ba29af0216faa921350f6bebf7910160405180910390a250505050505050565b60008581526005602081905260409091209081015443108015610728575060008160040154115b61079a5760405162461bcd60e51b815260206004820152602860248201527f50325049583a204c6f636b20616c72656164792072656c6561736564206f722060448201527f72657475726e656400000000000000000000000000000000000000000000000060648201526084016102ea565b805460009081526004602081815260408084209285015490519293926107c8926005860192918b910161160c565b60405160208183030381529060405280519060200120905060008160405160200161081f91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051601f1981840301815291815281516020928301206000858152600690935291205490915060ff16156108bd5760405162461bcd60e51b815260206004820152603160248201527f50325049583a205472616e73616374696f6e20616c726561647920757365642060448201527f746f20756e6c6f636b207061796d656e7400000000000000000000000000000060648201526084016102ea565b6040805160008082526020820180845284905260ff881692820192909252606081018990526080810188905260019060a0016020604051602081039080840390855afa158015610911573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526003602052919091205490925060ff1690506109955760405162461bcd60e51b815260206004820152602360248201527f50325049583a205369676e6572206973206e6f7420612076616c6964207369676044820152623732b960e91b60648201526084016102ea565b60018085015490860154600387015460048801546001600160a01b0393841693849363a9059cbb939116916109ca9190611598565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610a2857600080fd5b505af1158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6091906115af565b50600386015415610afb576002860154600387015460405163a9059cbb60e01b81526001600160a01b03928316600482015260248101919091529082169063a9059cbb90604401602060405180830381600087803b158015610ac157600080fd5b505af1158015610ad5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af991906115af565b505b600060048701819055600587018190558481526006602052604090819020805460ff1916600190811790915587015490516001600160a01b03909116907f5e420822d2f7281fdc4b763c62c8b7874bf22108a35efe93144d79296aacc67d90610b67908e815260200190565b60405180910390a25050505050505050505050565b610b8461118d565b6040514790339082156108fc029083906000818181858888f19350505050158015610bb3573d6000803e3d6000fd5b5060408051338152602081018390527fbf0d92faf65e256806eefa1a0d281d4873cc3c80d1ed25b8ae6f7cc66fc918ef910160405180910390a150565b610bf861118d565b610c0260006111e7565b565b60008181526004602052604090205481906001600160a01b03163314610c815760405162461bcd60e51b815260206004820152602c60248201527f50325049583a204f6e6c792073656c6c657220636f756c642063616c6c20746860448201526b34b990333ab731ba34b7b71760a11b60648201526084016102ea565b600082815260046020818152604092839020918201805460ff19169055905491518481526001600160a01b03909216917fb4d98b272597e828d9b172c0d44390d5b267040e918088eac8a0a0fadcb81c70910160405180910390a25050565b8060005b818161ffff161015610e5c5760006005600086868561ffff16818110610d0c57610d0c6116b3565b9050602002013581526020019081526020016000209050438160050154108015610d3a575060008160040154115b610dac5760405162461bcd60e51b815260206004820152602b60248201527f50325049583a204c6f636b206e6f742065787069726564206f7220616c72656160448201527f64792072656c656173656400000000000000000000000000000000000000000060648201526084016102ea565b806004015460046000836000015481526020019081526020016000206002016000828254610dda9190611580565b90915550506000600482015560018101546001600160a01b03167f67e089478e21dd12c98e69331c4152f6c9b2038b91e0f28268ffa01558c0b4ff868661ffff8616818110610e2b57610e2b6116b3565b90506020020135604051610e4191815260200190565b60405180910390a25080610e54816116c9565b915050610ce4565b50505050565b6000610e6d60015490565b6000818152600460208190526040909120015490915060ff1615610ef95760405162461bcd60e51b815260206004820152603260248201527f50325049583a204465706f73697420616c726561647920657869737420616e6460448201527f206974206973207374696c6c2076616c6964000000000000000000000000000060648201526084016102ea565b6040516323b872dd60e01b81523360048201523060248201526044810185905285906001600160a01b038216906323b872dd90606401602060405180830381600087803b158015610f4957600080fd5b505af1158015610f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8191906115af565b5060006040518060c00160405280336001600160a01b03168152602001886001600160a01b0316815260200187815260200134815260200160011515815260200186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093909452505085815260046020818152604092839020855181546001600160a01b0391821673ffffffffffffffffffffffffffffffffffffffff1991821617835583880151600184018054919093169116179055928501516002840155606085015160038401556080850151918301805492151560ff199093169290921790915560a0840151805194955085949293506110979260058501929190910190611244565b5050600180548101905550604080518481526001600160a01b0389166020820152348183015260608101889052905133917fe0cfbec12278e314697ee34bb7a1ba4d704e84c438680672f7c1175f287e5910919081900360800190a25050949350505050565b61110561118d565b6001600160a01b0381166111815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102ea565b61118a816111e7565b50565b6000546001600160a01b03163314610c025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102ea565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054611250906115d1565b90600052602060002090601f01602090048101928261127257600085556112b8565b82601f1061128b57805160ff19168380011785556112b8565b828001600101855582156112b8579182015b828111156112b857825182559160200191906001019061129d565b506112c49291506112c8565b5090565b5b808211156112c457600081556001016112c9565b80356001600160a01b03811681146112f457600080fd5b919050565b60008083601f84011261130b57600080fd5b50813567ffffffffffffffff81111561132357600080fd5b6020830191508360208260051b850101111561133e57600080fd5b9250929050565b600080600080600080600060c0888a03121561136057600080fd5b87359650611370602089016112dd565b955061137e604089016112dd565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156113a857600080fd5b6113b48a828b016112f9565b989b979a50959850939692959293505050565b6000806000604084860312156113dc57600080fd5b83359250602084013567ffffffffffffffff8111156113fa57600080fd5b611406868287016112f9565b9497909650939450505050565b600080600080600060a0868803121561142b57600080fd5b85359450602086013593506040860135925060608601359150608086013560ff8116811461145857600080fd5b809150509295509295909350565b60006020828403121561147857600080fd5b5035919050565b6000806020838503121561149257600080fd5b823567ffffffffffffffff8111156114a957600080fd5b6114b5858286016112f9565b90969095509350505050565b6000602082840312156114d357600080fd5b6114dc826112dd565b9392505050565b600080600080606085870312156114f957600080fd5b611502856112dd565b935060208501359250604085013567ffffffffffffffff8082111561152657600080fd5b818701915087601f83011261153a57600080fd5b81358181111561154957600080fd5b88602082850101111561155b57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156115935761159361156a565b500190565b6000828210156115aa576115aa61156a565b500390565b6000602082840312156115c157600080fd5b815180151581146114dc57600080fd5b600181811c908216806115e557607f821691505b6020821081141561160657634e487b7160e01b600052602260045260246000fd5b50919050565b600080855481600182811c91508083168061162857607f831692505b602080841082141561164857634e487b7160e01b86526022600452602486fd5b81801561165c576001811461166d5761169a565b60ff1986168952848901965061169a565b60008c81526020902060005b868110156116925781548b820152908501908301611679565b505084890196505b5098855250505050938401929092525050604001919050565b634e487b7160e01b600052603260045260246000fd5b600061ffff808316818114156116e1576116e161156a565b600101939250505056fea164736f6c6343000809000a", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/utils/smart_contract_files/localhost.json b/src/utils/smart_contract_files/localhost.json new file mode 100644 index 0000000..cf0e5d8 --- /dev/null +++ b/src/utils/smart_contract_files/localhost.json @@ -0,0 +1,8 @@ +{ + "signers": [ + "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + ], + "p2pix": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "token": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512" +} \ No newline at end of file diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue deleted file mode 100644 index 756ad2a..0000000 --- a/src/views/AboutView.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 23a53cd..20d2bfe 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,9 +1,5 @@ - + diff --git a/src/views/QrCodeForm.vue b/src/views/QrCodeForm.vue index 46e8463..980c4d4 100644 --- a/src/views/QrCodeForm.vue +++ b/src/views/QrCodeForm.vue @@ -29,12 +29,8 @@ const submit = () => { const pixQrCode = pix({ pixKey: pixModel.value.pixKey, - merchantName: pixModel.value.name.trim() - ? pixModel.value.name - : "name", - merchantCity: pixModel.value.city.trim() - ? pixModel.value.city - : "city", + merchantName: pixModel.value.name.trim() ? pixModel.value.name : "name", + merchantCity: pixModel.value.city.trim() ? pixModel.value.city : "city", transactionId: pixModel.value.transactionId.trim() ? pixModel.value.transactionId : "***", @@ -53,145 +49,147 @@ const submit = () => {