From aff7e1cd8b6b55e2a08c63b67dc1d939c71ab1ee Mon Sep 17 00:00:00 2001 From: Sebastian Coronel Date: Sun, 9 Oct 2022 08:55:45 -0500 Subject: [PATCH] deploy to optimism --- src/components/AppConfig.tsx | 2 +- src/eth-sdk/abis/optimism/allyu.json | 1 + src/eth-sdk/abis/optimism/dai.json | 1 + src/eth-sdk/config.ts | 6 +++--- src/pages/index.tsx | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 src/eth-sdk/abis/optimism/allyu.json create mode 100644 src/eth-sdk/abis/optimism/dai.json diff --git a/src/components/AppConfig.tsx b/src/components/AppConfig.tsx index 7f5ea1c..100bfbc 100644 --- a/src/components/AppConfig.tsx +++ b/src/components/AppConfig.tsx @@ -7,7 +7,7 @@ import { infuraProvider } from 'wagmi/providers/infura' import { publicProvider } from 'wagmi/providers/public' const { chains, provider } = configureChains( - [chain.goerli, chain.polygonMumbai], + [chain.goerli, chain.polygonMumbai, chain.optimism], [infuraProvider({ apiKey: INFURA_ID }), publicProvider()] ) diff --git a/src/eth-sdk/abis/optimism/allyu.json b/src/eth-sdk/abis/optimism/allyu.json new file mode 100644 index 0000000..924c5df --- /dev/null +++ b/src/eth-sdk/abis/optimism/allyu.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"uint256","name":"feePerBill","type":"uint256"},{"internalType":"address","name":"daiContractAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CryptoMoney__FeeNotMet","type":"error"},{"inputs":[],"name":"CryptoMoney__InvalidCode","type":"error"},{"inputs":[],"name":"CryptoMoney__InvalidWord","type":"error"},{"inputs":[],"name":"CryptoMoney__NoFeesToWithdraw","type":"error"},{"inputs":[],"name":"CryptoMoney__NotApproved","type":"error"},{"inputs":[],"name":"CryptoMoney__TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"billId","type":"uint256"},{"indexed":true,"internalType":"address","name":"funder","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"BillFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"billId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"BillIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"billId","type":"uint256"},{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"BillRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountPerBill","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"billCount","type":"uint256"}],"name":"NewRequest","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"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"billId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"wordHash","type":"bytes"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDaiContract","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeePerBill","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextBillId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"billId","type":"uint256"}],"name":"getOneBillFromBillId","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes32","name":"wordHash","type":"bytes32"},{"internalType":"bytes32","name":"codeHash","type":"bytes32"},{"internalType":"bool","name":"isFunded","type":"bool"},{"internalType":"bool","name":"isRedeemed","type":"bool"}],"internalType":"struct CryptoMoney.Bill","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"getOneRequest","outputs":[{"components":[{"internalType":"uint256","name":"amountPerBill","type":"uint256"},{"internalType":"uint256","name":"billCount","type":"uint256"},{"internalType":"bool","name":"isIssued","type":"bool"},{"internalType":"address","name":"requester","type":"address"}],"internalType":"struct CryptoMoney.Request","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"bytes[]","name":"codeHash","type":"bytes[]"}],"name":"issueBills","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"billId","type":"uint256"},{"internalType":"string","name":"code","type":"string"},{"internalType":"string","name":"word","type":"string"},{"internalType":"address","name":"redeemAddress","type":"address"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountPerBill","type":"uint256"},{"internalType":"uint256","name":"billCount","type":"uint256"}],"name":"requestBills","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"updatedFee","type":"uint256"}],"name":"updateFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"billId","type":"uint256"},{"internalType":"string","name":"word","type":"string"}],"name":"verifyWord","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/src/eth-sdk/abis/optimism/dai.json b/src/eth-sdk/abis/optimism/dai.json new file mode 100644 index 0000000..65708c7 --- /dev/null +++ b/src/eth-sdk/abis/optimism/dai.json @@ -0,0 +1 @@ +[{"inputs":[],"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":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","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":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","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":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deploymentChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"stateMutability":"nonpayable","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":"value","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":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/src/eth-sdk/config.ts b/src/eth-sdk/config.ts index 1f9ce3b..9666297 100644 --- a/src/eth-sdk/config.ts +++ b/src/eth-sdk/config.ts @@ -10,9 +10,9 @@ export default defineConfig({ dai: '0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F', allyu: '0x12c2c185f8B14006aadE9f8914508C49CE019A84' }, - optimismGoerli: { - dai: '0xd0B806F06E77157c3f39182A2C0b4C05A33D84a5', - allyu: '0xdbf20E8AaA24660fb4e566d5D6FF47E726E5B13b' + optimism: { + dai: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', + allyu: '0x8710b2Ae18233383ABBA6AfC17aD6177BDc958a1' } } }) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index b6acba4..8349a01 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -34,13 +34,13 @@ const Home: NextPage = () => { in crypto-backed cash - + ) } -const BillsGrid = ({ count }: { count: number }) => { +const BillsGrid = () => { const [randomBills, setRandomBills] = useState([]) const rows = 6 const columns = 6