diff --git a/packages/foundry/broadcast/deploy_Notes.s.sol/421614/run-1720870316.json b/packages/foundry/broadcast/deploy_Notes.s.sol/421614/run-1720870316.json new file mode 100644 index 0000000..e2630b3 --- /dev/null +++ b/packages/foundry/broadcast/deploy_Notes.s.sol/421614/run-1720870316.json @@ -0,0 +1,29 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CREATE", + "contractName": "Notes", + "contractAddress": "0xfabb7b73144704bb1873bc69b47e998d7f8fb27d", + "function": null, + "arguments": null, + "transaction": { + "from": "0xf6da1082b2b8952c73ed7220db5df38aec56a1b2", + "gas": "0x17b95b", + "value": "0x0", + "input": "0x6080604052348015600f57600080fd5b5061147a8061001f6000396000f3fe6080604052600436106100c25760003560e01c8063c70e012c1161007f578063d306794d11610059578063d306794d146102b9578063d91c9bad146102e6578063da239bf114610313578063f559b79b1461032857600080fd5b8063c70e012c1461020d578063cead5f7a1461023d578063d1d368e71461029657600080fd5b8063223094e9146100c7578063256e025a1461011b5780633ddbfa0a1461013057806343e1ebf01461017e578063918f8674146101a0578063acc34ed9146101b6575b600080fd5b3480156100d357600080fd5b506101036100e2366004610ccb565b600160209081526000928352604080842090915290825290205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b34801561012757600080fd5b50610103602881565b34801561013c57600080fd5b5061017161014b366004610d10565b600560209081526000938452604080852082529284528284209052825290205460ff1681565b6040516101129190610d7d565b34801561018a57600080fd5b5061019e610199366004610da0565b61037d565b005b3480156101ac57600080fd5b5061010361271081565b3480156101c257600080fd5b506101f86101d1366004610dda565b60036020908152600092835260408084209091529082529020805460019091015460ff1682565b60408051928352901515602083015201610112565b34801561021957600080fd5b5061022d610228366004610e04565b6106de565b6040516101129493929190610e84565b34801561024957600080fd5b50610281610258366004610ec7565b600260209081526000938452604080852082529284528284209052825290205463ffffffff1681565b60405163ffffffff9091168152602001610112565b6102a96102a4366004610f01565b6107c4565b6040519015158152602001610112565b3480156102c557600080fd5b506102d96102d4366004610f2b565b610919565b6040516101129190610f9f565b3480156102f257600080fd5b50610306610301366004611004565b610a7b565b604051610112919061109a565b34801561031f57600080fd5b50610103600a81565b34801561033457600080fd5b506103676103433660046110ad565b600460209081526000928352604080842090915290825290205464ffffffffff1681565b60405164ffffffffff9091168152602001610112565b3360009081526004602052604081209084600281111561039f5761039f610d53565b60028111156103b0576103b0610d53565b815260208101919091526040016000908120805464ffffffffff16916103d5836110ed565b825464ffffffffff9182166101009390930a9283029190920219909116179055503360009081526005602090815260408083206001600160a01b0385168452825280832061ffff861684529091529020805484919060ff1916600183600281111561044257610442610d53565b02179055506001600160a01b038116600090815260026020818152604080842061ffff8716855290915282209190859081111561048157610481610d53565b600281111561049257610492610d53565b815260208101919091526040016000908120805463ffffffff16916104b683611114565b82546101009290920a63ffffffff8181021990931691831602179091556001600160a01b038316600090815260026020818152604080842061ffff8916855282528084206001855290915280832054918352808320548380529083205492945090831692610528929181169116611130565b6105329190611130565b9050600063ffffffff8216156105e7576001600160a01b038316600090815260026020818152604080842061ffff89168552825280842092845291905290205482906105859063ffffffff16602861114c565b6001600160a01b038516600090815260026020908152604080832061ffff8a16845282528083208380529091529020546105c69063ffffffff16605061114c565b6105d09190611130565b6105da9190611172565b63ffffffff1690506105eb565b5060005b60408051808201909152600060208201528181526028821180156106155750600a8363ffffffff16115b156106265760016020820152610656565b806020015180156106375750600a82105b80156106495750600a8363ffffffff16115b1561065657600060208201525b6001600160a01b038416600081815260036020908152604080832061ffff8a16845282529182902084518155908401516001909101805460ff19169115159190911790555133907fc6c17ac9b5234cac54c97de00eef6ce25bdbb704c801bfe650017e716c328e52906106ce9089908b9088906111a8565b60405180910390a3505050505050565b600060205281600052604060002081815481106106fa57600080fd5b6000918252602090912060029091020180546001820180546001600160a01b0383169550600160a01b830460ff169450600160a81b90920461ffff169291610741906111ce565b80601f016020809104026020016040519081016040528092919081815260200182805461076d906111ce565b80156107ba5780601f1061078f576101008083540402835291602001916107ba565b820191906000526020600020905b81548152906001019060200180831161079d57829003601f168201915b5050505050905084565b6001600160a01b0381166000908152602081905260408120805461ffff85169081106107f2576107f2611208565b600091825260208220600290910201546040516001600160a01b039091169134919081818185875af1925050503d806000811461084b576040519150601f19603f3d011682016040523d82523d6000602084013e610850565b606091505b50506001600160a01b03831660008181526020819052604090208054929350909161ffff861690811061088557610885611208565b600091825260208083206002909202909101546001600160a01b0386811684529183905260409092208054919092169133917f57053f48567dea2e75619fde8276ff7c003c914c887670fc4d9b188161df4fdf91349161ffff8a169081106108ef576108ef611208565b906000526020600020906002020160405161090b92919061121e565b60405180910390a492915050565b6001600160a01b038116600090815260208181526040808320805482518185028101850190935280835260609492939192909184015b82821015610a7057600084815260209081902060408051608081019091526002850290910180546001600160a01b03811683529192909190830190600160a01b900460ff1660018111156109a5576109a5610d53565b60018111156109b6576109b6610d53565b81528154600160a81b900461ffff1660208201526001820180546040909201916109df906111ce565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0b906111ce565b8015610a585780601f10610a2d57610100808354040283529160200191610a58565b820191906000526020600020905b815481529060010190602001808311610a3b57829003601f168201915b5050505050815250508152602001906001019061094f565b505050509050919050565b60408051608081018252600080825260208201819052918101919091526060808201526040518060800160405280336001600160a01b03168152602001836001811115610aca57610aca610d53565b8152602001600061ffff16815260200185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250506001600160a01b03888116825260208281526040832080546001808201835591855293829020865160029095020180546001600160a01b03198116959094169485178155918601519596508695919450909284926001600160a81b0319161790600160a01b908490811115610b8957610b89610d53565b02179055506040820151815461ffff909116600160a81b0261ffff60a81b1990911617815560608201516001820190610bc29082611354565b5050506001600160a01b0385166000908152600160208190526040822091908490811115610bf257610bf2610d53565b6001811115610c0357610c03610d53565b815260208101919091526040016000908120805461ffff1691610c2583611413565b825461ffff9182166101009390930a9283029190920219909116179055506001600160a01b0385166000818152602081905260409081902054905133917f708b39c063b29363eb66b5e7aa513c18fdc10c034666e7e1de252ab7f085ee6d91610c909190869061142b565b60405180910390a3949350505050565b80356001600160a01b0381168114610cb757600080fd5b919050565b803560028110610cb757600080fd5b60008060408385031215610cde57600080fd5b610ce783610ca0565b9150610cf560208401610cbc565b90509250929050565b803561ffff81168114610cb757600080fd5b600080600060608486031215610d2557600080fd5b610d2e84610ca0565b9250610d3c60208501610ca0565b9150610d4a60408501610cfe565b90509250925092565b634e487b7160e01b600052602160045260246000fd5b60038110610d7957610d79610d53565b9052565b60208101610d8b8284610d69565b92915050565b803560038110610cb757600080fd5b600080600060608486031215610db557600080fd5b610dbe84610d91565b9250610dcc60208501610cfe565b9150610d4a60408501610ca0565b60008060408385031215610ded57600080fd5b610df683610ca0565b9150610cf560208401610cfe565b60008060408385031215610e1757600080fd5b610e2083610ca0565b946020939093013593505050565b60028110610d7957610d79610d53565b6000815180845260005b81811015610e6457602081850181015186830182015201610e48565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b0385168152610e9d6020820185610e2e565b61ffff83166040820152608060608201526000610ebd6080830184610e3e565b9695505050505050565b600080600060608486031215610edc57600080fd5b610ee584610ca0565b9250610ef360208501610cfe565b9150610d4a60408501610d91565b60008060408385031215610f1457600080fd5b610f1d83610cfe565b9150610cf560208401610ca0565b600060208284031215610f3d57600080fd5b610f4682610ca0565b9392505050565b80516001600160a01b03168252602080820151600091610f6f90850182610e2e565b5061ffff6040830151166040840152606082015160806060850152610f976080850182610e3e565b949350505050565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015610ff857603f19878603018452610fe3858351610f4d565b94506020938401939190910190600101610fc7565b50929695505050505050565b6000806000806060858703121561101a57600080fd5b61102385610ca0565b9350602085013567ffffffffffffffff81111561103f57600080fd5b8501601f8101871361105057600080fd5b803567ffffffffffffffff81111561106757600080fd5b87602082840101111561107957600080fd5b6020919091019350915061108f60408601610cbc565b905092959194509250565b602081526000610f466020830184610f4d565b600080604083850312156110c057600080fd5b6110c983610ca0565b9150610cf560208401610d91565b634e487b7160e01b600052601160045260246000fd5b600064ffffffffff821664ffffffffff810361110b5761110b6110d7565b60010192915050565b600063ffffffff821663ffffffff810361110b5761110b6110d7565b63ffffffff8181168382160190811115610d8b57610d8b6110d7565b63ffffffff818116838216029081169081811461116b5761116b6110d7565b5092915050565b600063ffffffff83168061119657634e487b7160e01b600052601260045260246000fd5b8063ffffffff84160491505092915050565b61ffff84168152606081016111c06020830185610d69565b826040830152949350505050565b600181811c908216806111e257607f821691505b60208210810361120257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b828152604060208201526000825460018060a01b038116604084015261124d6060840160ff8360a01c16610e2e565b61ffff8160a81c1660808401525060018301608060a084015260008154611273816111ce565b8060c0870152600182166000811461129257600181146112ae576112e2565b60ff19831660e088015260e082151560051b88010193506112e2565b84600052602060002060005b838110156112d957815489820160e001526001909101906020016112ba565b880160e0019450505b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b601f82111561134f57806000526020600020601f840160051c8101602085101561132c5750805b601f840160051c820191505b8181101561134c5760008155600101611338565b50505b505050565b815167ffffffffffffffff81111561136e5761136e6112ef565b6113828161137c84546111ce565b84611305565b6020601f8211600181146113b6576000831561139e5750848201515b600019600385901b1c1916600184901b17845561134c565b600084815260208120601f198516915b828110156113e657878501518255602094850194600190920191016113c6565b50848210156114045786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b600061ffff821661ffff810361110b5761110b6110d7565b828152604060208201526000610f976040830184610f4d56fea26469706673582212202cc0a2d759d23b1c986f694bffb4b7f04847ee5931ec5816af3e073690e9657a64736f6c634300081a0033", + "nonce": "0x1", + "chainId": "0x66eee" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1720870316, + "chain": 421614, + "commit": "fd0ba97" +} \ No newline at end of file diff --git a/packages/foundry/broadcast/deploy_Notes.s.sol/59141/run-1720870170.json b/packages/foundry/broadcast/deploy_Notes.s.sol/59141/run-1720870170.json new file mode 100644 index 0000000..3f03e8e --- /dev/null +++ b/packages/foundry/broadcast/deploy_Notes.s.sol/59141/run-1720870170.json @@ -0,0 +1,46 @@ +{ + "transactions": [ + { + "hash": "0x94e5ef4f5d4b8d9b8345e0b9d523d9ba6ec8b2e61cc3b65ca681655b8cd68c20", + "transactionType": "CREATE", + "contractName": "Notes", + "contractAddress": "0x4b9678d7fa125c5dffb553f787f918de4ccfbd34", + "function": null, + "arguments": null, + "transaction": { + "from": "0xf6da1082b2b8952c73ed7220db5df38aec56a1b2", + "gas": "0x1781fa", + "value": "0x0", + "input": "0x6080604052348015600f57600080fd5b5061147a8061001f6000396000f3fe6080604052600436106100c25760003560e01c8063c70e012c1161007f578063d306794d11610059578063d306794d146102b9578063d91c9bad146102e6578063da239bf114610313578063f559b79b1461032857600080fd5b8063c70e012c1461020d578063cead5f7a1461023d578063d1d368e71461029657600080fd5b8063223094e9146100c7578063256e025a1461011b5780633ddbfa0a1461013057806343e1ebf01461017e578063918f8674146101a0578063acc34ed9146101b6575b600080fd5b3480156100d357600080fd5b506101036100e2366004610ccb565b600160209081526000928352604080842090915290825290205461ffff1681565b60405161ffff90911681526020015b60405180910390f35b34801561012757600080fd5b50610103602881565b34801561013c57600080fd5b5061017161014b366004610d10565b600560209081526000938452604080852082529284528284209052825290205460ff1681565b6040516101129190610d7d565b34801561018a57600080fd5b5061019e610199366004610da0565b61037d565b005b3480156101ac57600080fd5b5061010361271081565b3480156101c257600080fd5b506101f86101d1366004610dda565b60036020908152600092835260408084209091529082529020805460019091015460ff1682565b60408051928352901515602083015201610112565b34801561021957600080fd5b5061022d610228366004610e04565b6106de565b6040516101129493929190610e84565b34801561024957600080fd5b50610281610258366004610ec7565b600260209081526000938452604080852082529284528284209052825290205463ffffffff1681565b60405163ffffffff9091168152602001610112565b6102a96102a4366004610f01565b6107c4565b6040519015158152602001610112565b3480156102c557600080fd5b506102d96102d4366004610f2b565b610919565b6040516101129190610f9f565b3480156102f257600080fd5b50610306610301366004611004565b610a7b565b604051610112919061109a565b34801561031f57600080fd5b50610103600a81565b34801561033457600080fd5b506103676103433660046110ad565b600460209081526000928352604080842090915290825290205464ffffffffff1681565b60405164ffffffffff9091168152602001610112565b3360009081526004602052604081209084600281111561039f5761039f610d53565b60028111156103b0576103b0610d53565b815260208101919091526040016000908120805464ffffffffff16916103d5836110ed565b825464ffffffffff9182166101009390930a9283029190920219909116179055503360009081526005602090815260408083206001600160a01b0385168452825280832061ffff861684529091529020805484919060ff1916600183600281111561044257610442610d53565b02179055506001600160a01b038116600090815260026020818152604080842061ffff8716855290915282209190859081111561048157610481610d53565b600281111561049257610492610d53565b815260208101919091526040016000908120805463ffffffff16916104b683611114565b82546101009290920a63ffffffff8181021990931691831602179091556001600160a01b038316600090815260026020818152604080842061ffff8916855282528084206001855290915280832054918352808320548380529083205492945090831692610528929181169116611130565b6105329190611130565b9050600063ffffffff8216156105e7576001600160a01b038316600090815260026020818152604080842061ffff89168552825280842092845291905290205482906105859063ffffffff16602861114c565b6001600160a01b038516600090815260026020908152604080832061ffff8a16845282528083208380529091529020546105c69063ffffffff16605061114c565b6105d09190611130565b6105da9190611172565b63ffffffff1690506105eb565b5060005b60408051808201909152600060208201528181526028821180156106155750600a8363ffffffff16115b156106265760016020820152610656565b806020015180156106375750600a82105b80156106495750600a8363ffffffff16115b1561065657600060208201525b6001600160a01b038416600081815260036020908152604080832061ffff8a16845282529182902084518155908401516001909101805460ff19169115159190911790555133907fc6c17ac9b5234cac54c97de00eef6ce25bdbb704c801bfe650017e716c328e52906106ce9089908b9088906111a8565b60405180910390a3505050505050565b600060205281600052604060002081815481106106fa57600080fd5b6000918252602090912060029091020180546001820180546001600160a01b0383169550600160a01b830460ff169450600160a81b90920461ffff169291610741906111ce565b80601f016020809104026020016040519081016040528092919081815260200182805461076d906111ce565b80156107ba5780601f1061078f576101008083540402835291602001916107ba565b820191906000526020600020905b81548152906001019060200180831161079d57829003601f168201915b5050505050905084565b6001600160a01b0381166000908152602081905260408120805461ffff85169081106107f2576107f2611208565b600091825260208220600290910201546040516001600160a01b039091169134919081818185875af1925050503d806000811461084b576040519150601f19603f3d011682016040523d82523d6000602084013e610850565b606091505b50506001600160a01b03831660008181526020819052604090208054929350909161ffff861690811061088557610885611208565b600091825260208083206002909202909101546001600160a01b0386811684529183905260409092208054919092169133917f57053f48567dea2e75619fde8276ff7c003c914c887670fc4d9b188161df4fdf91349161ffff8a169081106108ef576108ef611208565b906000526020600020906002020160405161090b92919061121e565b60405180910390a492915050565b6001600160a01b038116600090815260208181526040808320805482518185028101850190935280835260609492939192909184015b82821015610a7057600084815260209081902060408051608081019091526002850290910180546001600160a01b03811683529192909190830190600160a01b900460ff1660018111156109a5576109a5610d53565b60018111156109b6576109b6610d53565b81528154600160a81b900461ffff1660208201526001820180546040909201916109df906111ce565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0b906111ce565b8015610a585780601f10610a2d57610100808354040283529160200191610a58565b820191906000526020600020905b815481529060010190602001808311610a3b57829003601f168201915b5050505050815250508152602001906001019061094f565b505050509050919050565b60408051608081018252600080825260208201819052918101919091526060808201526040518060800160405280336001600160a01b03168152602001836001811115610aca57610aca610d53565b8152602001600061ffff16815260200185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250506001600160a01b03888116825260208281526040832080546001808201835591855293829020865160029095020180546001600160a01b03198116959094169485178155918601519596508695919450909284926001600160a81b0319161790600160a01b908490811115610b8957610b89610d53565b02179055506040820151815461ffff909116600160a81b0261ffff60a81b1990911617815560608201516001820190610bc29082611354565b5050506001600160a01b0385166000908152600160208190526040822091908490811115610bf257610bf2610d53565b6001811115610c0357610c03610d53565b815260208101919091526040016000908120805461ffff1691610c2583611413565b825461ffff9182166101009390930a9283029190920219909116179055506001600160a01b0385166000818152602081905260409081902054905133917f708b39c063b29363eb66b5e7aa513c18fdc10c034666e7e1de252ab7f085ee6d91610c909190869061142b565b60405180910390a3949350505050565b80356001600160a01b0381168114610cb757600080fd5b919050565b803560028110610cb757600080fd5b60008060408385031215610cde57600080fd5b610ce783610ca0565b9150610cf560208401610cbc565b90509250929050565b803561ffff81168114610cb757600080fd5b600080600060608486031215610d2557600080fd5b610d2e84610ca0565b9250610d3c60208501610ca0565b9150610d4a60408501610cfe565b90509250925092565b634e487b7160e01b600052602160045260246000fd5b60038110610d7957610d79610d53565b9052565b60208101610d8b8284610d69565b92915050565b803560038110610cb757600080fd5b600080600060608486031215610db557600080fd5b610dbe84610d91565b9250610dcc60208501610cfe565b9150610d4a60408501610ca0565b60008060408385031215610ded57600080fd5b610df683610ca0565b9150610cf560208401610cfe565b60008060408385031215610e1757600080fd5b610e2083610ca0565b946020939093013593505050565b60028110610d7957610d79610d53565b6000815180845260005b81811015610e6457602081850181015186830182015201610e48565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b0385168152610e9d6020820185610e2e565b61ffff83166040820152608060608201526000610ebd6080830184610e3e565b9695505050505050565b600080600060608486031215610edc57600080fd5b610ee584610ca0565b9250610ef360208501610cfe565b9150610d4a60408501610d91565b60008060408385031215610f1457600080fd5b610f1d83610cfe565b9150610cf560208401610ca0565b600060208284031215610f3d57600080fd5b610f4682610ca0565b9392505050565b80516001600160a01b03168252602080820151600091610f6f90850182610e2e565b5061ffff6040830151166040840152606082015160806060850152610f976080850182610e3e565b949350505050565b6000602082016020835280845180835260408501915060408160051b86010192506020860160005b82811015610ff857603f19878603018452610fe3858351610f4d565b94506020938401939190910190600101610fc7565b50929695505050505050565b6000806000806060858703121561101a57600080fd5b61102385610ca0565b9350602085013567ffffffffffffffff81111561103f57600080fd5b8501601f8101871361105057600080fd5b803567ffffffffffffffff81111561106757600080fd5b87602082840101111561107957600080fd5b6020919091019350915061108f60408601610cbc565b905092959194509250565b602081526000610f466020830184610f4d565b600080604083850312156110c057600080fd5b6110c983610ca0565b9150610cf560208401610d91565b634e487b7160e01b600052601160045260246000fd5b600064ffffffffff821664ffffffffff810361110b5761110b6110d7565b60010192915050565b600063ffffffff821663ffffffff810361110b5761110b6110d7565b63ffffffff8181168382160190811115610d8b57610d8b6110d7565b63ffffffff818116838216029081169081811461116b5761116b6110d7565b5092915050565b600063ffffffff83168061119657634e487b7160e01b600052601260045260246000fd5b8063ffffffff84160491505092915050565b61ffff84168152606081016111c06020830185610d69565b826040830152949350505050565b600181811c908216806111e257607f821691505b60208210810361120257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b828152604060208201526000825460018060a01b038116604084015261124d6060840160ff8360a01c16610e2e565b61ffff8160a81c1660808401525060018301608060a084015260008154611273816111ce565b8060c0870152600182166000811461129257600181146112ae576112e2565b60ff19831660e088015260e082151560051b88010193506112e2565b84600052602060002060005b838110156112d957815489820160e001526001909101906020016112ba565b880160e0019450505b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b601f82111561134f57806000526020600020601f840160051c8101602085101561132c5750805b601f840160051c820191505b8181101561134c5760008155600101611338565b50505b505050565b815167ffffffffffffffff81111561136e5761136e6112ef565b6113828161137c84546111ce565b84611305565b6020601f8211600181146113b6576000831561139e5750848201515b600019600385901b1c1916600184901b17845561134c565b600084815260208120601f198516915b828110156113e657878501518255602094850194600190920191016113c6565b50848210156114045786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b600061ffff821661ffff810361110b5761110b6110d7565b828152604060208201526000610f976040830184610f4d56fea26469706673582212202cc0a2d759d23b1c986f694bffb4b7f04847ee5931ec5816af3e073690e9657a64736f6c634300081a0033", + "nonce": "0x0", + "chainId": "0xe705" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x121537", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x0", + "transactionHash": "0x94e5ef4f5d4b8d9b8345e0b9d523d9ba6ec8b2e61cc3b65ca681655b8cd68c20", + "transactionIndex": "0x0", + "blockHash": "0xbebc19deb679ccbc23390826c4a5e0cbedb2293bc46524c6d159b6f801efa713", + "blockNumber": "0x26eab3", + "gasUsed": "0x121537", + "effectiveGasPrice": "0x6ad9bace", + "from": "0xf6da1082b2b8952c73ed7220db5df38aec56a1b2", + "to": null, + "contractAddress": "0x4b9678d7fa125c5dffb553f787f918de4ccfbd34" + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1720870170, + "chain": 59141, + "commit": "fd0ba97" +} \ No newline at end of file diff --git a/packages/foundry/foundry.toml b/packages/foundry/foundry.toml index a98b896..f9e5228 100644 --- a/packages/foundry/foundry.toml +++ b/packages/foundry/foundry.toml @@ -5,7 +5,6 @@ libs = ["lib"] fs_permissions = [{ access = "read-write", path = "./"}] [rpc_endpoints] -#default_network = "${SEPOLIA_RPC}" sepolia = "${SEPOLIA_RPC}" base-sepolia = "${BASE_SEPOLIA_RPC}" arbitrum-sepolia = "${ARBITRUM_SEPOLIA_RPC}" diff --git a/packages/foundry/package.json b/packages/foundry/package.json index 6d1731d..580be4f 100644 --- a/packages/foundry/package.json +++ b/packages/foundry/package.json @@ -5,12 +5,15 @@ "account": "node script/ListAccount.js", "chain": "anvil --config-out localhost.json", "compile": "forge compile", - "deploy": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url ${1:-sepolia} --broadcast --legacy --slow --verify && node script/generateTsAbis.js", - "deploy-test": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url sepolia --broadcast --legacy --slow --verify && node script/generateTsAbis.js", - "deploy-base": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url base-sepolia --broadcast --legacy --slow --verify && node script/generateTsAbis.js", - "deploy-arb": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url arbitrum-sepolia --broadcast --legacy --slow --verify && node script/generateTsAbis.js", - "deploy-scroll": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url scroll-sepolia --broadcast --legacy --slow --verify && node script/generateTsAbis.js", - "deploy-linea": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url linea-sepolia --broadcast --legacy --slow --verify && node script/generateTsAbis.js", + "deploy-test": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url sepolia --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", + "deploy-base": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url base-sepolia --broadcast --legacy --sig "run(bool)" true--slow --verify && node script/generateTsAbis.js", + "deploy-arb": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url arbitrum-sepolia --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", + "deploy-scroll": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url scroll-sepolia --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", + "deploy-linea": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url linea-sepolia --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", + "deploy-morph": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url morph-holesky --broadcast --legacy --sig "run(bool)" false --slow && node script/generateTsAbis.js", + "deploy-zircuit": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url zircuit --broadcast --legacy --sig "run(bool)" false --slow && node script/generateTsAbis.js", + "deploy-apechain": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url apechain --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", + "deploy-zero": "forge build --build-info --build-info-path out/build-info/ && forge script script/deploy_Notes.s.sol --rpc-url zero-sepolia --broadcast --legacy --sig "run(bool)" false --slow --verify && node script/generateTsAbis.js", "deploy:verify": "forge build --build-info --build-info-path out/build-info/ && forge script script/Deploy.s.sol --rpc-url ${1:-sepolia} --broadcast --verify ; node script/generateTsAbis.js", "flatten": "forge flatten", "fork": "anvil --fork-url ${0:-mainnet} --chain-id 31337 --config-out localhost.json", diff --git a/packages/foundry/script/deploy_Notes.s.sol b/packages/foundry/script/deploy_Notes.s.sol index 59a679c..8dd5be6 100644 --- a/packages/foundry/script/deploy_Notes.s.sol +++ b/packages/foundry/script/deploy_Notes.s.sol @@ -9,9 +9,29 @@ contract CounterScript is Script { uint256 deployerKey = vm.envUint("DEPLOYER_KEY"); - function run() external { + string appId = vm.envString("WC_APP_ID"); + string noteId = vm.envString("WC_NOTE_ID"); + string voteId = vm.envString("WC_VOTE_ID"); + + function run(bool _onBase) external { vm.startBroadcast(deployerKey); - notes = new Notes(); + if (_onBase) { + notes = new Notes( + true, + 0x163b09b4fE21177c455D850BD815B6D583732432, + appId, + noteId, + voteId + ); + } else { + notes = new Notes( + false, + address(0), + appId, + noteId, + voteId + ); + } vm.stopBroadcast(); } } diff --git a/packages/foundry/src/Notes.sol b/packages/foundry/src/Notes.sol index 31da9d6..5411926 100644 --- a/packages/foundry/src/Notes.sol +++ b/packages/foundry/src/Notes.sol @@ -4,6 +4,13 @@ pragma solidity 0.8.26; /* ChainNotes Libraries */ import {CNDataTypes} from "src/libraries/CNDataTypes.sol"; import {CNEvents} from "src/libraries/CNEvents.sol"; +import {CNErrors} from "src/libraries/CNErrors.sol"; + +/* WorldID interface */ +import {IWorldID} from "src/interfaces/IWorldID.sol"; + +/* Helpers */ +import {ByteHasher} from "src/helpers/ByteHasher.sol"; /** * @title Notes @@ -12,8 +19,14 @@ import {CNEvents} from "src/libraries/CNEvents.sol"; * */ contract Notes { - /// @dev Denominator used for calculating - uint16 public constant DENOMINATOR = 10_000; + // Helper for worldId proving actions + using ByteHasher for bytes; + + /// @dev Keep track of if we are using worldId + bool useWordlId; + + /// @dev contract instance for worldId prover + IWorldID worldId; /// @dev Threshold for being scored helpful aka .40 uint16 public constant HELPFULNESS_THRESHOLD = 40; @@ -21,6 +34,19 @@ contract Notes { /// @dev Threshold to be removed from being helpful aka .10 uint16 public constant INITIAL_ELIGIBILITY_RATING_THRESHOLD = 10; + /// @dev The contract's external nullifier hash for notes + uint256 internal immutable externalNullifierNote; + + /// @dev The contract's external nullifier hash for votes + uint256 internal immutable externalNullifierVote; + + /// @dev The World ID group ID (always 1) + uint256 internal immutable groupId = 1; + + mapping(address user => mapping(address contractAddress => bool writtenNote)) public userWrittenNoteFor; + + mapping(address user => mapping(address contractAddress => mapping(uint16 index => bool voted))) public userVotedOnNote; + /// @dev Array of notes for a specific contract address mapping(address contractAddress => CNDataTypes.Note[] note) public notesOf; @@ -38,6 +64,30 @@ contract Notes { /// @dev A users rating on a specific note mapping(address user => mapping(address contractAddress => mapping(uint16 index => CNDataTypes.Rating))) public userRatingOfNote; + constructor( + bool _useWorldId, + address _worldId, + string memory _appId, + string memory _noteId, + string memory _voteId + ) { + // Set the status of worldId usage + useWordlId = _useWorldId; + + // Instantiate world Id contract for proving + worldId = IWorldID(_worldId); + + // create nullifier used for notes + externalNullifierNote = abi + .encodePacked(abi.encodePacked(_appId).hashToField(), _noteId) + .hashToField(); + + // create nullifier used for votes + externalNullifierVote = abi + .encodePacked(abi.encodePacked(_appId).hashToField(), _voteId) + .hashToField(); + } + /** * @notice * Allows a user to publish a note for a specific contract @@ -52,8 +102,25 @@ contract Notes { function publishNote( address _contractAddress, string calldata _uri, - CNDataTypes.Sentiment _sentiment + CNDataTypes.Sentiment _sentiment, + CNDataTypes.WorldIdProof memory _proof ) external returns(CNDataTypes.Note memory _note) { + // If user already written note for this contract revert + if (userWrittenNoteFor[msg.sender][_contractAddress]) revert CNErrors.YOU_HAVE_ALREADY(CNDataTypes.Actions.WRITTEN_NOTE); + + // if we are using worldId... + if (useWordlId) { + // verify proof + worldId.verifyProof( + _proof.root, + groupId, + abi.encodePacked(_proof.signal).hashToField(), + _proof.nullifierHash, + externalNullifierNote, + _proof.proof + ); + } + // Create the note _note = CNDataTypes.Note({ noteWriter: msg.sender, @@ -68,6 +135,9 @@ contract Notes { // Increment the specified sentiment for the contract sentimentOf[_contractAddress][_sentiment]++; + // Toggle notes written for contract status + userWrittenNoteFor[msg.sender][_contractAddress] = true; + // Emit the NotePublished event emit CNEvents.NotePublished( msg.sender, @@ -89,8 +159,25 @@ contract Notes { function vote( CNDataTypes.Rating _rating, uint16 _noteIndex, - address _contractAddress + address _contractAddress, + CNDataTypes.WorldIdProof memory _proof ) external { + // Make sure user hasnt already voted on note + if (userVotedOnNote[msg.sender][_contractAddress][_noteIndex]) revert CNErrors.YOU_HAVE_ALREADY(CNDataTypes.Actions.VOTED); + + // if we are using worldId... + if (useWordlId) { + // verify proof + worldId.verifyProof( + _proof.root, + groupId, + abi.encodePacked(_proof.signal).hashToField(), + _proof.nullifierHash, + externalNullifierVote, + _proof.proof + ); + } + // Update rating Weight of user ratingWeightOf[msg.sender][_rating]++; @@ -140,6 +227,9 @@ contract Notes { // Set the score info to the note scoreInfoOf[_contractAddress][_noteIndex] = newScore; + // Toggle the voted on note stattus for user + userVotedOnNote[msg.sender][_contractAddress][_noteIndex] = true; + // Emit Voted event emit CNEvents.Voted( msg.sender, diff --git a/packages/foundry/src/helpers/ByteHasher.sol b/packages/foundry/src/helpers/ByteHasher.sol new file mode 100644 index 0000000..2655adc --- /dev/null +++ b/packages/foundry/src/helpers/ByteHasher.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity 0.8.26; + +library ByteHasher { + /// @dev Creates a keccak256 hash of a bytestring. + /// @param value The bytestring to hash + /// @return The hash of the specified value + /// @dev `>> 8` makes sure that the result is included in our field + function hashToField(bytes memory value) internal pure returns (uint256) { + return uint256(keccak256(abi.encodePacked(value))) >> 8; + } +} \ No newline at end of file diff --git a/packages/foundry/src/interfaces/IWorldID.sol b/packages/foundry/src/interfaces/IWorldID.sol new file mode 100644 index 0000000..ce073e1 --- /dev/null +++ b/packages/foundry/src/interfaces/IWorldID.sol @@ -0,0 +1,21 @@ +//SPDX-License-Identifier: AGPL-3.0 +pragma solidity 0.8.26; + +interface IWorldID { + /// @notice Reverts if the zero-knowledge proof is invalid. + /// @param root The of the Merkle tree + /// @param groupId The id of the Semaphore group + /// @param signalHash A keccak256 hash of the Semaphore signal + /// @param nullifierHash The nullifier hash + /// @param externalNullifierHash A keccak256 hash of the external nullifier + /// @param proof The zero-knowledge proof + /// @dev Note that a double-signaling check is not included here, and should be carried by the caller. + function verifyProof( + uint256 root, + uint256 groupId, + uint256 signalHash, + uint256 nullifierHash, + uint256 externalNullifierHash, + uint256[8] calldata proof + ) external view; +} \ No newline at end of file diff --git a/packages/foundry/src/libraries/CNDataTypes.sol b/packages/foundry/src/libraries/CNDataTypes.sol index 70d2111..ab42746 100644 --- a/packages/foundry/src/libraries/CNDataTypes.sol +++ b/packages/foundry/src/libraries/CNDataTypes.sol @@ -14,6 +14,13 @@ library CNDataTypes { bool consideredHelpful; } + struct WorldIdProof { + uint256 root; + address signal; + uint256 nullifierHash; + uint256[8] proof; + } + enum Rating { HELPFUL, NOT_HELPFUL, @@ -24,4 +31,9 @@ library CNDataTypes { POSITIVE, NEGATIVE } + + enum Actions { + WRITTEN_NOTE, + VOTED + } } \ No newline at end of file diff --git a/packages/foundry/src/libraries/CNErrors.sol b/packages/foundry/src/libraries/CNErrors.sol new file mode 100644 index 0000000..f92910b --- /dev/null +++ b/packages/foundry/src/libraries/CNErrors.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: AGPL-3.0 +pragma solidity 0.8.26; + +import {CNDataTypes} from "src/libraries/CNDataTypes.sol"; + +library CNErrors { + error YOU_HAVE_ALREADY(CNDataTypes.Actions action); +} \ No newline at end of file