From df231685d8d042c027f565bb7634754838033baf Mon Sep 17 00:00:00 2001 From: Tobias Leinss Date: Sun, 9 Feb 2025 09:25:48 +0000 Subject: [PATCH] Move functionality to factory, Improve scripts --- RUNS_1_deployment.md | 74 +++++++ RUNS_2_setup_factory.md | 61 ++++++ RUNS_3_create_quest.md | 72 +++++++ RUNS_4_quest_interaction.md | 8 + .../11155111/run-1739091208.json | 51 +++++ .../11155111/run-latest.json | 51 +++++ .../11155111/run-1739091794.json | 196 ++++++++++++++++++ .../11155111/run-latest.json | 196 ++++++++++++++++++ .../11155111/run-1739092150.json | 91 ++++++++ .../11155111/run-latest.json | 91 ++++++++ foundry.toml | 5 +- ...Quest.s.sol => 1_DeployQuestFactory.s.sol} | 15 +- script/2_SetupQuest.s.sol | 28 --- script/2_SetupQuestFactory.s.sol | 29 +++ script/3_CreateQuestDonation.s.sol | 31 +++ ...onQuest.s.sol => 4_InteractionQuest.s.sol} | 12 +- script/Deploy.s.sol | 23 +- src/QuestDonation.sol | 53 ++--- src/QuestFactory.sol | 79 ++++++- test/QuestDonation.t.sol | 14 +- 20 files changed, 1082 insertions(+), 98 deletions(-) create mode 100644 RUNS_1_deployment.md create mode 100644 RUNS_2_setup_factory.md create mode 100644 RUNS_3_create_quest.md create mode 100644 RUNS_4_quest_interaction.md create mode 100644 broadcast/1_DeployQuestFactory.s.sol/11155111/run-1739091208.json create mode 100644 broadcast/1_DeployQuestFactory.s.sol/11155111/run-latest.json create mode 100644 broadcast/2_SetupQuestFactory.s.sol/11155111/run-1739091794.json create mode 100644 broadcast/2_SetupQuestFactory.s.sol/11155111/run-latest.json create mode 100644 broadcast/3_CreateQuestDonation.s.sol/11155111/run-1739092150.json create mode 100644 broadcast/3_CreateQuestDonation.s.sol/11155111/run-latest.json rename script/{1_DeployQuest.s.sol => 1_DeployQuestFactory.s.sol} (54%) delete mode 100644 script/2_SetupQuest.s.sol create mode 100644 script/2_SetupQuestFactory.s.sol create mode 100644 script/3_CreateQuestDonation.s.sol rename script/{3_InteractionQuest.s.sol => 4_InteractionQuest.s.sol} (88%) diff --git a/RUNS_1_deployment.md b/RUNS_1_deployment.md new file mode 100644 index 0000000..b725c8f --- /dev/null +++ b/RUNS_1_deployment.md @@ -0,0 +1,74 @@ +forge script script/1_DeployQuestFactory.s.sol --chain sepolia --rpc-url x --etherscan-api-key x --verify --broadcast + +[⠊] Compiling... +No files changed, compilation skipped +Script ran successfully. + +== Return == +0: address 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f + +== Logs == + QuestFactory deployed to: 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f + +## Setting up 1 EVM. + +========================== + +Chain 11155111 + +Estimated gas price: 19.637747512 gwei + +Estimated total gas used for script: 1885305 + +Estimated amount required: 0.03702314357311116 ETH + +========================== + +##### sepolia +✅ [Success] Hash: 0x4a3feb0dc27479b8d4e23f229f63175415a97323e3c074adf339f686be645de4 +Contract Address: 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f +Block: 7671360 +Paid: 0.014693441869493135 ETH (1450235 gas * 10.131766141 gwei) + +✅ Sequence #1 on sepolia | Total Paid: 0.014693441869493135 ETH (1450235 gas * avg 10.131766141 gwei) + + +========================== + +ONCHAIN EXECUTION COMPLETE & SUCCESSFUL. +## +Start verification for (1) contracts +Start verifying contract `0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f` deployed on sepolia +Compiler version: 0.8.28 +Optimizations: 200 + +Submitting verification for [src/QuestFactory.sol:QuestFactory] 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (4 tries remaining) + D +Submitting verification for [src/QuestFactory.sol:QuestFactory] 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (3 tries remaining) + +Submitting verification for [src/QuestFactory.sol:QuestFactory] 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (2 tries remaining) + +Submitting verification for [src/QuestFactory.sol:QuestFactory] 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (1 tries remaining) + +Submitting verification for [src/QuestFactory.sol:QuestFactory] 0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f. +Submitted contract for verification: + Response: `OK` + GUID: `htrlj4vzbfruwbx35f4xw2f5s68eb29pvnac8kccxvutfiuqma` + URL: https://sepolia.etherscan.io/address/0x7db2542d15ac68c9958e8d73f32641ed9714fd6f +Contract verification status: +Response: `NOTOK` +Details: `Pending in queue` +Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining) +Contract verification status: +Response: `OK` +Details: `Pass - Verified` +Contract successfully verified +All (1) contracts were verified! + +Transactions saved to: /home/amsel/etherguild-contracts/broadcast/1_DeployQuestFactory.s.sol/11155111/run-latest.json + +Sensitive values saved to: /home/amsel/etherguild-contracts/cache/1_DeployQuestFactory.s.sol/11155111/run-latest.json \ No newline at end of file diff --git a/RUNS_2_setup_factory.md b/RUNS_2_setup_factory.md new file mode 100644 index 0000000..aa95a45 --- /dev/null +++ b/RUNS_2_setup_factory.md @@ -0,0 +1,61 @@ +export FACTORY_ADDRESS="0x0" + +forge script script/2_SetupQuestFactory.s.sol --chain sepolia --rpc-url x --etherscan-api-key x --broadcast --verify +[⠊] Compiling... +No files changed, compilation skipped +Script ran successfully. + +== Logs == + ETH address(0) and USDC set as allowed tokens + Price oracles set for ETH and USDC + +## Setting up 1 EVM. + +========================== + +Chain 11155111 + +Estimated gas price: 17.74240113 gwei + +Estimated total gas used for script: 341975 + +Estimated amount required: 0.00606745762643175 ETH + +========================== + +##### sepolia +✅ [Success] Hash: 0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2 +Block: 7671411 +Paid: 0.000436615685746735 ETH (50359 gas * 8.670062665 gwei) + + +##### sepolia +✅ [Success] Hash: 0xd114d046505cec617634cc62f8e3d9f1a42c6d400c78d553e6a59c2fbc641538 +Block: 7671411 +Paid: 0.0006613523800862 ETH (76280 gas * 8.670062665 gwei) + + +##### sepolia +✅ [Success] Hash: 0x6b314a5c8995fb41012879b6cb8be9a7ceb1d594ddc300fe6df1d54e0db9cdae +Block: 7671411 +Paid: 0.000614091868499285 ETH (70829 gas * 8.670062665 gwei) + + +##### sepolia +✅ [Success] Hash: 0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f +Block: 7671411 +Paid: 0.000434534870707135 ETH (50119 gas * 8.670062665 gwei) + +✅ Sequence #1 on sepolia | Total Paid: 0.002146594805039355 ETH (247587 gas * avg 8.670062665 gwei) + + +========================== + +ONCHAIN EXECUTION COMPLETE & SUCCESSFUL. +## +Start verification for (0) contracts +All (0) contracts were verified! + +Transactions saved to: /home/amsel/etherguild-contracts/broadcast/2_SetupQuestFactory.s.sol/11155111/run-latest.json + +Sensitive values saved to: /home/amsel/etherguild-contracts/cache/2_SetupQuestFactory.s.sol/11155111/run-latest.json \ No newline at end of file diff --git a/RUNS_3_create_quest.md b/RUNS_3_create_quest.md new file mode 100644 index 0000000..9456f7b --- /dev/null +++ b/RUNS_3_create_quest.md @@ -0,0 +1,72 @@ +export FACTORY_ADDRESS="0x0" + +forge script script/3_CreateQuestDonation.s.sol --chain sepolia --rpc-url x --etherscan-api-key x --broadcast --verify +[⠊] Compiling... +No files changed, compilation skipped +Script ran successfully. + +== Return == +questDonationAddress: address 0xFd843f5158401a48a7689BbAe1976689c6582cdf + +== Logs == + QuestDonation deployed to: 0xFd843f5158401a48a7689BbAe1976689c6582cdf + +## Setting up 1 EVM. + +========================== + +Chain 11155111 + +Estimated gas price: 17.488031658 gwei + +Estimated total gas used for script: 1210820 + +Estimated amount required: 0.02117485849213956 ETH + +========================== + +##### sepolia +✅ [Success] Hash: 0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335 +Block: 7671437 +Paid: 0.008521738795657032 ETH (876612 gas * 9.721220786 gwei) + +✅ Sequence #1 on sepolia | Total Paid: 0.008521738795657032 ETH (876612 gas * avg 9.721220786 gwei) + + +========================== + +ONCHAIN EXECUTION COMPLETE & SUCCESSFUL. +## +Start verification for (1) contracts +Start verifying contract `0xFd843f5158401a48a7689BbAe1976689c6582cdf` deployed on sepolia +Compiler version: 0.8.28 +Optimizations: 200 +Constructor args: 0000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000007db2542d15ac68c9958e8d73f32641ed9714fd6f + +Submitting verification for [src/QuestDonation.sol:QuestDonation] 0xFd843f5158401a48a7689BbAe1976689c6582cdf. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (4 tries remaining) + +Submitting verification for [src/QuestDonation.sol:QuestDonation] 0xFd843f5158401a48a7689BbAe1976689c6582cdf. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (3 tries remaining) + +Submitting verification for [src/QuestDonation.sol:QuestDonation] 0xFd843f5158401a48a7689BbAe1976689c6582cdf. +Warning: Etherscan could not detect the deployment.; waiting 5 seconds before trying again (2 tries remaining) + +Submitting verification for [src/QuestDonation.sol:QuestDonation] 0xFd843f5158401a48a7689BbAe1976689c6582cdf. +Submitted contract for verification: + Response: `OK` + GUID: `kkhvfmpkgcskw1ayggsskttl42uznvvgiyl9dmplgxgytx6ij5` + URL: https://sepolia.etherscan.io/address/0xfd843f5158401a48a7689bbae1976689c6582cdf +Contract verification status: +Response: `NOTOK` +Details: `Pending in queue` +Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining) +Contract verification status: +Response: `OK` +Details: `Pass - Verified` +Contract successfully verified +All (1) contracts were verified! + +Transactions saved to: /home/amsel/etherguild-contracts/broadcast/3_CreateQuestDonation.s.sol/11155111/run-latest.json + +Sensitive values saved to: /home/amsel/etherguild-contracts/cache/3_CreateQuestDonation.s.sol/11155111/run-latest.json \ No newline at end of file diff --git a/RUNS_4_quest_interaction.md b/RUNS_4_quest_interaction.md new file mode 100644 index 0000000..aac4eac --- /dev/null +++ b/RUNS_4_quest_interaction.md @@ -0,0 +1,8 @@ +export DONATION_ADDRESS="0x0" + +forge script script/4_InteractionQuest.s.sol --chain sepolia --rpc-url x --etherscan-api-key x +[⠊] Compiling... +No files changed, compilation skipped +Traces: + [635973] → new InteractionQuestScript@0x9f7cF1d1F558E57ef88a59ac3D47214eF25B6A06 + └─ ← [Return] 3066 bytes of code \ No newline at end of file diff --git a/broadcast/1_DeployQuestFactory.s.sol/11155111/run-1739091208.json b/broadcast/1_DeployQuestFactory.s.sol/11155111/run-1739091208.json new file mode 100644 index 0000000..2a4f809 --- /dev/null +++ b/broadcast/1_DeployQuestFactory.s.sol/11155111/run-1739091208.json @@ -0,0 +1,51 @@ +{ + "transactions": [ + { + "hash": "0x4a3feb0dc27479b8d4e23f229f63175415a97323e3c074adf339f686be645de4", + "transactionType": "CREATE", + "contractName": "QuestFactory", + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": null, + "arguments": null, + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "gas": "0x1cc479", + "value": "0x0", + "input": "0x608080604052346026575f80546001600160a01b031916331790556118db908161002b8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c908163013745181461099e57508063024ece89146108d6578063204120bc1461089e5780632b7746f11461085e57806341976e09146106f95780635bc35ae81461051b5780635e5f2e26146104d957806367a74ddc146103e3578063874af0621461030f5780639a39cb37146101a6578063a9a0166e14610189578063e085f9801461011e578063f851a440146100f75763f9eaee0d146100b6575f80fd5b346100f35760203660031901126100f3576001600160a01b036100d76109dd565b165f526004602052602060ff60405f2054166040519015158152f35b5f80fd5b346100f3575f3660031901126100f3575f546040516001600160a01b039091168152602090f35b346100f35760203660031901126100f3576004356005548110156100f35761014590610a1f565b50805460018201546002830154600390930154604080516001600160a01b039485168152602081019390935292909316918101919091526060810191909152608090f35b346100f3575f3660031901126100f3576020600554604051908152f35b346100f35760203660031901126100f3575f54604051600435916001600160a01b0316610d7f80830167ffffffffffffffff8111848210176102f0576080928492610b27843981528460208201523360408201523060608201520301905ff080156103045760018060a01b031660405161021f81610a3b565b81815260208101928352604081019033825260608101428152600554600160401b8110156102f0578060016102579201600555610a1f565b9390936102dd57915183546001600160a01b039182166001600160a01b0319918216178555955160018501559151600284018054919093169516949094179055915160039092019190915560405142815260209190339082907f01d8320e268685ac2181caee70ccf6f0b9a42f977e68559a40838f40b97bd317908590a3604051908152f35b634e487b7160e01b5f525f60045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b6040513d5f823e3d90fd5b346100f35760203660031901126100f35760043560055481101561039e5761033690610a1f565b506040519061034482610a3b565b80546001600160a01b03908116808452600183015460208086018290526002850154909316604080870182905260039095015460609687018190528551938452938301919091529281019290925291810191909152608090f35b60405162461bcd60e51b815260206004820152601960248201527f517565737420696e646578206f7574206f6620626f756e6473000000000000006044820152606490fd5b346100f35760403660031901126100f3576103fc6109dd565b6024356001600160a01b03811691908290036100f35761042660018060a01b035f54163314610ad0565b6001600160a01b03165f818152600460205260409020546104499060ff16610a79565b811561049b575f81815260026020526040812080546001600160a01b0319166001600160a01b0385161790557f78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc9080a3005b60405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206f7261636c65206164647265737360501b6044820152606490fd5b346100f35760203660031901126100f3576004356001548110156100f3576105026020916109f3565b905460405160039290921b1c6001600160a01b03168152f35b346100f35760403660031901126100f3576105346109dd565b60243590811515918281036100f35761055760018060a01b035f54163314610ad0565b15610621576001545f6001600160a01b038316815b8381106105ec575b5050156105a2575b505b60018060a01b03165f52600460205260405f209060ff801983541691161790555f80f35b600160401b8110156102f057816105c28260016105e694016001556109f3565b81546001600160a01b0393841660039290921b91821b9390911b1916919091179055565b8261057c565b816105f6826109f3565b905460039190911b1c6001600160a01b0316146106155760010161056c565b50505060018480610574565b6001600160a01b038116905f5b600154808210156106f05783610643836109f3565b905460039190911b1c6001600160a01b031614610663575060010161062e565b9192505f1982019182116106dc576105c2610680610698936109f3565b905460039190911b1c6001600160a01b0316916109f3565b60015480156106c8575f19016106ad816109f3565b81549060018060a01b039060031b1b1916905560015561057e565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5050905061057e565b346100f35760203660031901126100f3576001600160a01b0361071a6109dd565b16805f52600460205261073360ff60405f205416610a79565b5f9081526002602052604090819020549051633fabe5a360e21b8152906001600160a01b031660a082600481845afa918215610304575f9261080a575b5060206004916040519283809263313ce56760e01b82525afa8015610304575f906107cd575b60ff915016604d81116106dc57600a0a9081156107b95760209160405191048152f35b634e487b7160e01b5f52601260045260245ffd5b506020813d602011610802575b816107e760209383610a57565b810103126100f3575160ff811681036100f35760ff90610796565b3d91506107da565b90915060a0813d60a011610856575b8161082660a09383610a57565b810103126100f35760208161083c600493610ab9565b5061084d6080838301519201610ab9565b50929150610770565b3d9150610819565b346100f35760203660031901126100f3576001600160a01b0361087f6109dd565b165f526002602052602060018060a01b0360405f205416604051908152f35b346100f35760203660031901126100f3576001600160a01b036108bf6109dd565b165f526003602052602060405f2054604051908152f35b346100f3575f3660031901126100f3576040518060206001549283815201809260015f527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6905f5b81811061097f5750505081610934910382610a57565b604051918291602083019060208452518091526040830191905f5b81811061095d575050500390f35b82516001600160a01b031684528594506020938401939092019160010161094f565b82546001600160a01b031684526020909301926001928301920161091e565b346100f35760203660031901126100f3576020906001600160a01b036109c26109dd565b165f9081526002835260409020546001600160a01b03168152f35b600435906001600160a01b03821682036100f357565b600154811015610a0b5760015f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b600554811015610a0b5760055f5260205f209060021b01905f90565b6080810190811067ffffffffffffffff8211176102f057604052565b90601f8019910116810190811067ffffffffffffffff8211176102f057604052565b15610a8057565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b519069ffffffffffffffffffff821682036100f357565b15610ad757565b60405162461bcd60e51b815260206004820152602160248201527f4f6e6c792061646d696e2063616e2063616c6c20746869732066756e6374696f6044820152603760f91b6064820152608490fdfe6080346101ba57601f610d7f38819003918201601f19168301916001600160401b038311848410176101be578084926080946040528339810103126101ba57610047816101d2565b906020810151606061005b604084016101d2565b9201516001600160a01b03811693908490036101ba576001600160a01b03169182156101a7575f80546001600160a01b031981168517825584916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b031691821561016257811561011d5760018060a01b0319600254161760025560035560018060a01b0319600454161760045560018060a01b03196001541617600155604051610b9890816101e78239f35b60405162461bcd60e51b815260206004820152601560248201527f496e76616c69642074617267657420616d6f756e7400000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063726561746f7220616464726573730000000000000000006044820152606490fd5b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101ba5756fe6080806040526004361015610012575f80fd5b5f3560e01c90816302d05d3f1461099a5750806328031cf7146109625780632b0d1cda1461092a5780634857317e14610906578063715018a6146108af57806383914540146108915780638b4c40b01461067d5780638da5cb5b14610656578063953b8fb814610639578063c45a015514610611578063ef99fb02146102ab578063f2fde38b14610226578063f3fef3a3146100e25763f851a440146100b6575f80fd5b346100de575f3660031901126100de576002546040516001600160a01b039091168152602090f35b5f80fd5b346100de5760403660031901126100de576100fb6109bd565b6002546001600160a01b03169060243590338390036101e1576001600160a01b0316918261018457505f8080808460018060a01b036002541682821561017b575bf1156101705760207feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d915b604051908152a2005b6040513d5f823e3d90fd5b506108fc61013c565b7feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d916101dc6020926040519063a9059cbb60e01b858301526024820152826044820152604481526101d66064826109d3565b85610b0a565b610167565b60405162461bcd60e51b815260206004820152601760248201527f4f6e6c792061646d696e2063616e2077697468647261770000000000000000006044820152606490fd5b346100de5760203660031901126100de5761023f6109bd565b610247610ae4565b6001600160a01b03168015610298575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100de5760403660031901126100de576102c46109bd565b6001546040516341976e0960e01b81526001600160a01b03928316600482018190529260248035936020928492918391165afa908115610170575f916105df575b50610311811515610a09565b8261052b576103209082610a45565b335f5260066020526301e1338061033b60405f205442610a58565b1161050a575b335f52600560205261036c69010f0cf064dd592000006103658360405f2054610a65565b1115610a72565b335f52600560205261038360405f20918254610a65565b905560015460405163f9eaee0d60e01b8152600481018490526001600160a01b0390911690602081602481855afa908115610170575f916104cf575b5015610496576020602491604051928380926341976e0960e01b82528760048301525afa8015610170575f90610462575b61042f91506104296040516323b872dd60e01b6020820152336024820152306044820152846064820152606481526101d66084826109d3565b82610a45565b60405191825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b506020813d60201161048e575b8161047c602093836109d3565b810103126100de5761042f90516103f0565b3d915061046f565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b90506020813d602011610502575b816104ea602093836109d3565b810103126100de575180151581036100de57846103bf565b3d91506104dd565b335f5260056020525f6040812055335f5260066020524260405f2055610341565b60405163313ce56760e01b815290602082600481875afa918215610170575f9261059f575b5061055d60ff9184610a45565b9116604d811161058b57600a0a9081156105775704610320565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b9091506020813d6020116105d7575b816105bb602093836109d3565b810103126100de575160ff811681036100de579061055d610550565b3d91506105ae565b90506020813d602011610609575b816105fa602093836109d3565b810103126100de575183610305565b3d91506105ed565b346100de575f3660031901126100de576001546040516001600160a01b039091168152602090f35b346100de575f3660031901126100de576020600354604051908152f35b346100de575f3660031901126100de575f546040516001600160a01b039091168152602090f35b5f3660031901126100de576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa8015610170575f9061085d575b6106d791506106d1811515610a09565b34610a45565b335f5260066020526301e133806106f260405f205442610a58565b1161083c575b335f52600560205261071c69010f0cf064dd592000006103658360405f2054610a65565b335f52600560205261073360405f20918254610a65565b905534156107e8576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa908115610170575f916107b4575b5f6107808334610a45565b6040519034825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b90506020813d6020116107e0575b816107cf602093836109d3565b810103126100de5751610780610775565b3d91506107c2565b60405162461bcd60e51b815260206004820152602660248201527f446f6e6174696f6e20616d6f756e74206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608490fd5b335f5260056020525f6040812055335f5260066020524260405f20556106f8565b506020813d602011610889575b81610877602093836109d3565b810103126100de576106d790516106c1565b3d915061086a565b346100de575f3660031901126100de5760206040516301e133808152f35b346100de575f3660031901126100de576108c7610ae4565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100de575f3660031901126100de57602060405169010f0cf064dd592000008152f35b346100de5760203660031901126100de576001600160a01b0361094b6109bd565b165f526005602052602060405f2054604051908152f35b346100de5760203660031901126100de576001600160a01b036109836109bd565b165f526006602052602060405f2054604051908152f35b346100de575f3660031901126100de576004546001600160a01b03168152602090f35b600435906001600160a01b03821682036100de57565b90601f8019910116810190811067ffffffffffffffff8211176109f557604052565b634e487b7160e01b5f52604160045260245ffd5b15610a1057565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606490fd5b8181029291811591840414171561058b57565b9190820391821161058b57565b9190820180921161058b57565b15610a7957565b60405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e20657863656564732024353030302f796561722e20436f6e60448201527f7461637420696e666f4065746865726775696c642e78797a00000000000000006064820152608490fd5b5f546001600160a01b03163303610af757565b63118cdaa760e01b5f523360045260245ffd5b905f602091828151910182855af115610170575f513d610b5957506001600160a01b0381163b155b610b395750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415610b3256fea26469706673582212206a83203f3e204dec345ff9a9147bafa35a4f8f1a9a548f627cfd562ce8dee66d64736f6c634300081c0033a2646970667358221220aac1165ced417e6e45e1d303602df55f5470583865864e0afb77adb95bfddea464736f6c634300081c0033", + "nonce": "0x8", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x1c30415", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x4a3feb0dc27479b8d4e23f229f63175415a97323e3c074adf339f686be645de4", + "transactionIndex": "0xae", + "blockHash": "0xbca60447ec580b5b7f97008cc11d7f2a93c79418049dfcd3eb607c8efa9388cc", + "blockNumber": "0x750e40", + "gasUsed": "0x1620fb", + "effectiveGasPrice": "0x25be67b7d", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f" + } + ], + "libraries": [], + "pending": [], + "returns": { + "0": { + "internal_type": "address", + "value": "0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f" + } + }, + "timestamp": 1739091208, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/broadcast/1_DeployQuestFactory.s.sol/11155111/run-latest.json b/broadcast/1_DeployQuestFactory.s.sol/11155111/run-latest.json new file mode 100644 index 0000000..2a4f809 --- /dev/null +++ b/broadcast/1_DeployQuestFactory.s.sol/11155111/run-latest.json @@ -0,0 +1,51 @@ +{ + "transactions": [ + { + "hash": "0x4a3feb0dc27479b8d4e23f229f63175415a97323e3c074adf339f686be645de4", + "transactionType": "CREATE", + "contractName": "QuestFactory", + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": null, + "arguments": null, + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "gas": "0x1cc479", + "value": "0x0", + "input": "0x608080604052346026575f80546001600160a01b031916331790556118db908161002b8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c908163013745181461099e57508063024ece89146108d6578063204120bc1461089e5780632b7746f11461085e57806341976e09146106f95780635bc35ae81461051b5780635e5f2e26146104d957806367a74ddc146103e3578063874af0621461030f5780639a39cb37146101a6578063a9a0166e14610189578063e085f9801461011e578063f851a440146100f75763f9eaee0d146100b6575f80fd5b346100f35760203660031901126100f3576001600160a01b036100d76109dd565b165f526004602052602060ff60405f2054166040519015158152f35b5f80fd5b346100f3575f3660031901126100f3575f546040516001600160a01b039091168152602090f35b346100f35760203660031901126100f3576004356005548110156100f35761014590610a1f565b50805460018201546002830154600390930154604080516001600160a01b039485168152602081019390935292909316918101919091526060810191909152608090f35b346100f3575f3660031901126100f3576020600554604051908152f35b346100f35760203660031901126100f3575f54604051600435916001600160a01b0316610d7f80830167ffffffffffffffff8111848210176102f0576080928492610b27843981528460208201523360408201523060608201520301905ff080156103045760018060a01b031660405161021f81610a3b565b81815260208101928352604081019033825260608101428152600554600160401b8110156102f0578060016102579201600555610a1f565b9390936102dd57915183546001600160a01b039182166001600160a01b0319918216178555955160018501559151600284018054919093169516949094179055915160039092019190915560405142815260209190339082907f01d8320e268685ac2181caee70ccf6f0b9a42f977e68559a40838f40b97bd317908590a3604051908152f35b634e487b7160e01b5f525f60045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b6040513d5f823e3d90fd5b346100f35760203660031901126100f35760043560055481101561039e5761033690610a1f565b506040519061034482610a3b565b80546001600160a01b03908116808452600183015460208086018290526002850154909316604080870182905260039095015460609687018190528551938452938301919091529281019290925291810191909152608090f35b60405162461bcd60e51b815260206004820152601960248201527f517565737420696e646578206f7574206f6620626f756e6473000000000000006044820152606490fd5b346100f35760403660031901126100f3576103fc6109dd565b6024356001600160a01b03811691908290036100f35761042660018060a01b035f54163314610ad0565b6001600160a01b03165f818152600460205260409020546104499060ff16610a79565b811561049b575f81815260026020526040812080546001600160a01b0319166001600160a01b0385161790557f78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc9080a3005b60405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206f7261636c65206164647265737360501b6044820152606490fd5b346100f35760203660031901126100f3576004356001548110156100f3576105026020916109f3565b905460405160039290921b1c6001600160a01b03168152f35b346100f35760403660031901126100f3576105346109dd565b60243590811515918281036100f35761055760018060a01b035f54163314610ad0565b15610621576001545f6001600160a01b038316815b8381106105ec575b5050156105a2575b505b60018060a01b03165f52600460205260405f209060ff801983541691161790555f80f35b600160401b8110156102f057816105c28260016105e694016001556109f3565b81546001600160a01b0393841660039290921b91821b9390911b1916919091179055565b8261057c565b816105f6826109f3565b905460039190911b1c6001600160a01b0316146106155760010161056c565b50505060018480610574565b6001600160a01b038116905f5b600154808210156106f05783610643836109f3565b905460039190911b1c6001600160a01b031614610663575060010161062e565b9192505f1982019182116106dc576105c2610680610698936109f3565b905460039190911b1c6001600160a01b0316916109f3565b60015480156106c8575f19016106ad816109f3565b81549060018060a01b039060031b1b1916905560015561057e565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5050905061057e565b346100f35760203660031901126100f3576001600160a01b0361071a6109dd565b16805f52600460205261073360ff60405f205416610a79565b5f9081526002602052604090819020549051633fabe5a360e21b8152906001600160a01b031660a082600481845afa918215610304575f9261080a575b5060206004916040519283809263313ce56760e01b82525afa8015610304575f906107cd575b60ff915016604d81116106dc57600a0a9081156107b95760209160405191048152f35b634e487b7160e01b5f52601260045260245ffd5b506020813d602011610802575b816107e760209383610a57565b810103126100f3575160ff811681036100f35760ff90610796565b3d91506107da565b90915060a0813d60a011610856575b8161082660a09383610a57565b810103126100f35760208161083c600493610ab9565b5061084d6080838301519201610ab9565b50929150610770565b3d9150610819565b346100f35760203660031901126100f3576001600160a01b0361087f6109dd565b165f526002602052602060018060a01b0360405f205416604051908152f35b346100f35760203660031901126100f3576001600160a01b036108bf6109dd565b165f526003602052602060405f2054604051908152f35b346100f3575f3660031901126100f3576040518060206001549283815201809260015f527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6905f5b81811061097f5750505081610934910382610a57565b604051918291602083019060208452518091526040830191905f5b81811061095d575050500390f35b82516001600160a01b031684528594506020938401939092019160010161094f565b82546001600160a01b031684526020909301926001928301920161091e565b346100f35760203660031901126100f3576020906001600160a01b036109c26109dd565b165f9081526002835260409020546001600160a01b03168152f35b600435906001600160a01b03821682036100f357565b600154811015610a0b5760015f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b600554811015610a0b5760055f5260205f209060021b01905f90565b6080810190811067ffffffffffffffff8211176102f057604052565b90601f8019910116810190811067ffffffffffffffff8211176102f057604052565b15610a8057565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b519069ffffffffffffffffffff821682036100f357565b15610ad757565b60405162461bcd60e51b815260206004820152602160248201527f4f6e6c792061646d696e2063616e2063616c6c20746869732066756e6374696f6044820152603760f91b6064820152608490fdfe6080346101ba57601f610d7f38819003918201601f19168301916001600160401b038311848410176101be578084926080946040528339810103126101ba57610047816101d2565b906020810151606061005b604084016101d2565b9201516001600160a01b03811693908490036101ba576001600160a01b03169182156101a7575f80546001600160a01b031981168517825584916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b031691821561016257811561011d5760018060a01b0319600254161760025560035560018060a01b0319600454161760045560018060a01b03196001541617600155604051610b9890816101e78239f35b60405162461bcd60e51b815260206004820152601560248201527f496e76616c69642074617267657420616d6f756e7400000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063726561746f7220616464726573730000000000000000006044820152606490fd5b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101ba5756fe6080806040526004361015610012575f80fd5b5f3560e01c90816302d05d3f1461099a5750806328031cf7146109625780632b0d1cda1461092a5780634857317e14610906578063715018a6146108af57806383914540146108915780638b4c40b01461067d5780638da5cb5b14610656578063953b8fb814610639578063c45a015514610611578063ef99fb02146102ab578063f2fde38b14610226578063f3fef3a3146100e25763f851a440146100b6575f80fd5b346100de575f3660031901126100de576002546040516001600160a01b039091168152602090f35b5f80fd5b346100de5760403660031901126100de576100fb6109bd565b6002546001600160a01b03169060243590338390036101e1576001600160a01b0316918261018457505f8080808460018060a01b036002541682821561017b575bf1156101705760207feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d915b604051908152a2005b6040513d5f823e3d90fd5b506108fc61013c565b7feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d916101dc6020926040519063a9059cbb60e01b858301526024820152826044820152604481526101d66064826109d3565b85610b0a565b610167565b60405162461bcd60e51b815260206004820152601760248201527f4f6e6c792061646d696e2063616e2077697468647261770000000000000000006044820152606490fd5b346100de5760203660031901126100de5761023f6109bd565b610247610ae4565b6001600160a01b03168015610298575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100de5760403660031901126100de576102c46109bd565b6001546040516341976e0960e01b81526001600160a01b03928316600482018190529260248035936020928492918391165afa908115610170575f916105df575b50610311811515610a09565b8261052b576103209082610a45565b335f5260066020526301e1338061033b60405f205442610a58565b1161050a575b335f52600560205261036c69010f0cf064dd592000006103658360405f2054610a65565b1115610a72565b335f52600560205261038360405f20918254610a65565b905560015460405163f9eaee0d60e01b8152600481018490526001600160a01b0390911690602081602481855afa908115610170575f916104cf575b5015610496576020602491604051928380926341976e0960e01b82528760048301525afa8015610170575f90610462575b61042f91506104296040516323b872dd60e01b6020820152336024820152306044820152846064820152606481526101d66084826109d3565b82610a45565b60405191825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b506020813d60201161048e575b8161047c602093836109d3565b810103126100de5761042f90516103f0565b3d915061046f565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b90506020813d602011610502575b816104ea602093836109d3565b810103126100de575180151581036100de57846103bf565b3d91506104dd565b335f5260056020525f6040812055335f5260066020524260405f2055610341565b60405163313ce56760e01b815290602082600481875afa918215610170575f9261059f575b5061055d60ff9184610a45565b9116604d811161058b57600a0a9081156105775704610320565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b9091506020813d6020116105d7575b816105bb602093836109d3565b810103126100de575160ff811681036100de579061055d610550565b3d91506105ae565b90506020813d602011610609575b816105fa602093836109d3565b810103126100de575183610305565b3d91506105ed565b346100de575f3660031901126100de576001546040516001600160a01b039091168152602090f35b346100de575f3660031901126100de576020600354604051908152f35b346100de575f3660031901126100de575f546040516001600160a01b039091168152602090f35b5f3660031901126100de576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa8015610170575f9061085d575b6106d791506106d1811515610a09565b34610a45565b335f5260066020526301e133806106f260405f205442610a58565b1161083c575b335f52600560205261071c69010f0cf064dd592000006103658360405f2054610a65565b335f52600560205261073360405f20918254610a65565b905534156107e8576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa908115610170575f916107b4575b5f6107808334610a45565b6040519034825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b90506020813d6020116107e0575b816107cf602093836109d3565b810103126100de5751610780610775565b3d91506107c2565b60405162461bcd60e51b815260206004820152602660248201527f446f6e6174696f6e20616d6f756e74206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608490fd5b335f5260056020525f6040812055335f5260066020524260405f20556106f8565b506020813d602011610889575b81610877602093836109d3565b810103126100de576106d790516106c1565b3d915061086a565b346100de575f3660031901126100de5760206040516301e133808152f35b346100de575f3660031901126100de576108c7610ae4565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100de575f3660031901126100de57602060405169010f0cf064dd592000008152f35b346100de5760203660031901126100de576001600160a01b0361094b6109bd565b165f526005602052602060405f2054604051908152f35b346100de5760203660031901126100de576001600160a01b036109836109bd565b165f526006602052602060405f2054604051908152f35b346100de575f3660031901126100de576004546001600160a01b03168152602090f35b600435906001600160a01b03821682036100de57565b90601f8019910116810190811067ffffffffffffffff8211176109f557604052565b634e487b7160e01b5f52604160045260245ffd5b15610a1057565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606490fd5b8181029291811591840414171561058b57565b9190820391821161058b57565b9190820180921161058b57565b15610a7957565b60405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e20657863656564732024353030302f796561722e20436f6e60448201527f7461637420696e666f4065746865726775696c642e78797a00000000000000006064820152608490fd5b5f546001600160a01b03163303610af757565b63118cdaa760e01b5f523360045260245ffd5b905f602091828151910182855af115610170575f513d610b5957506001600160a01b0381163b155b610b395750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415610b3256fea26469706673582212206a83203f3e204dec345ff9a9147bafa35a4f8f1a9a548f627cfd562ce8dee66d64736f6c634300081c0033a2646970667358221220aac1165ced417e6e45e1d303602df55f5470583865864e0afb77adb95bfddea464736f6c634300081c0033", + "nonce": "0x8", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x1c30415", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x4a3feb0dc27479b8d4e23f229f63175415a97323e3c074adf339f686be645de4", + "transactionIndex": "0xae", + "blockHash": "0xbca60447ec580b5b7f97008cc11d7f2a93c79418049dfcd3eb607c8efa9388cc", + "blockNumber": "0x750e40", + "gasUsed": "0x1620fb", + "effectiveGasPrice": "0x25be67b7d", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f" + } + ], + "libraries": [], + "pending": [], + "returns": { + "0": { + "internal_type": "address", + "value": "0x7db2542D15AC68C9958E8d73f32641Ed9714Fd6f" + } + }, + "timestamp": 1739091208, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/broadcast/2_SetupQuestFactory.s.sol/11155111/run-1739091794.json b/broadcast/2_SetupQuestFactory.s.sol/11155111/run-1739091794.json new file mode 100644 index 0000000..dab7584 --- /dev/null +++ b/broadcast/2_SetupQuestFactory.s.sol/11155111/run-1739091794.json @@ -0,0 +1,196 @@ +{ + "transactions": [ + { + "hash": "0x6b314a5c8995fb41012879b6cb8be9a7ceb1d594ddc300fe6df1d54e0db9cdae", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "allowToken(address,bool)", + "arguments": [ + "0x0000000000000000000000000000000000000000", + "true" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x17e27", + "value": "0x0", + "input": "0x5bc35ae800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x9", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd114d046505cec617634cc62f8e3d9f1a42c6d400c78d553e6a59c2fbc641538", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "allowToken(address,bool)", + "arguments": [ + "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", + "true" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x19b91", + "value": "0x0", + "input": "0x5bc35ae800000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c80000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0xa", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "setPriceOracle(address,address)", + "arguments": [ + "0x0000000000000000000000000000000000000000", + "0x694AA1769357215DE4FAC081bf1f309aDC325306" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x10e6a", + "value": "0x0", + "input": "0x67a74ddc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000694aa1769357215de4fac081bf1f309adc325306", + "nonce": "0xb", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "setPriceOracle(address,address)", + "arguments": [ + "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", + "0xA2F78ab2355fe2f984D808B5CeE7FD0A93D5270E" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x10fb5", + "value": "0x0", + "input": "0x67a74ddc00000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8000000000000000000000000a2f78ab2355fe2f984d808b5cee7fd0a93d5270e", + "nonce": "0xc", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x8c56ee", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x6b314a5c8995fb41012879b6cb8be9a7ceb1d594ddc300fe6df1d54e0db9cdae", + "transactionIndex": "0x70", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0x114ad", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8d80e6", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd114d046505cec617634cc62f8e3d9f1a42c6d400c78d553e6a59c2fbc641538", + "transactionIndex": "0x71", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0x129f8", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8e44ad", + "logs": [ + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000694aa1769357215de4fac081bf1f309adc325306" + ], + "data": "0x", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "transactionHash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionIndex": "0x72", + "logIndex": "0xa6", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000200000020000000000000008000000000000000000000000000020000000000000000000800000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000002000000", + "type": "0x2", + "transactionHash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionIndex": "0x72", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0xc3c7", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8f0964", + "logs": [ + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc", + "0x00000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8", + "0x000000000000000000000000a2f78ab2355fe2f984d808b5cee7fd0a93d5270e" + ], + "data": "0x", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "transactionHash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionIndex": "0x73", + "logIndex": "0xa7", + "removed": false + } + ], + "logsBloom": "0x00000000000000000200000000000020000000000020000000000000000000000000000000000000000100000000000000000000000000000001000000000000000000000000000000000200000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000020000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionIndex": "0x73", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0xc4b7", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1739091794, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/broadcast/2_SetupQuestFactory.s.sol/11155111/run-latest.json b/broadcast/2_SetupQuestFactory.s.sol/11155111/run-latest.json new file mode 100644 index 0000000..dab7584 --- /dev/null +++ b/broadcast/2_SetupQuestFactory.s.sol/11155111/run-latest.json @@ -0,0 +1,196 @@ +{ + "transactions": [ + { + "hash": "0x6b314a5c8995fb41012879b6cb8be9a7ceb1d594ddc300fe6df1d54e0db9cdae", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "allowToken(address,bool)", + "arguments": [ + "0x0000000000000000000000000000000000000000", + "true" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x17e27", + "value": "0x0", + "input": "0x5bc35ae800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x9", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd114d046505cec617634cc62f8e3d9f1a42c6d400c78d553e6a59c2fbc641538", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "allowToken(address,bool)", + "arguments": [ + "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", + "true" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x19b91", + "value": "0x0", + "input": "0x5bc35ae800000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c80000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0xa", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "setPriceOracle(address,address)", + "arguments": [ + "0x0000000000000000000000000000000000000000", + "0x694AA1769357215DE4FAC081bf1f309aDC325306" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x10e6a", + "value": "0x0", + "input": "0x67a74ddc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000694aa1769357215de4fac081bf1f309adc325306", + "nonce": "0xb", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "setPriceOracle(address,address)", + "arguments": [ + "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8", + "0xA2F78ab2355fe2f984D808B5CeE7FD0A93D5270E" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x10fb5", + "value": "0x0", + "input": "0x67a74ddc00000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8000000000000000000000000a2f78ab2355fe2f984d808b5cee7fd0a93d5270e", + "nonce": "0xc", + "chainId": "0xaa36a7" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x8c56ee", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x6b314a5c8995fb41012879b6cb8be9a7ceb1d594ddc300fe6df1d54e0db9cdae", + "transactionIndex": "0x70", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0x114ad", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8d80e6", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd114d046505cec617634cc62f8e3d9f1a42c6d400c78d553e6a59c2fbc641538", + "transactionIndex": "0x71", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0x129f8", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8e44ad", + "logs": [ + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000694aa1769357215de4fac081bf1f309adc325306" + ], + "data": "0x", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "transactionHash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionIndex": "0x72", + "logIndex": "0xa6", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000200000020000000000000008000000000000000000000000000020000000000000000000800000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000002000000", + "type": "0x2", + "transactionHash": "0x7ee32be31ea2581e0010ed060da99264196a21c75f47d078a5bfe9b78e358e5f", + "transactionIndex": "0x72", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0xc3c7", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x8f0964", + "logs": [ + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x78f66d11c0fe8f0ce8dec169ad57f3438085a89b7371335b6e2b10e9685d7ecc", + "0x00000000000000000000000094a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8", + "0x000000000000000000000000a2f78ab2355fe2f984d808b5cee7fd0a93d5270e" + ], + "data": "0x", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "transactionHash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionIndex": "0x73", + "logIndex": "0xa7", + "removed": false + } + ], + "logsBloom": "0x00000000000000000200000000000020000000000020000000000000000000000000000000000000000100000000000000000000000000000001000000000000000000000000000000000200000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000020000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd114458196fe6b069f87fa6d4dcf641736aea61e2d024be0ae4f53f504ee5db2", + "transactionIndex": "0x73", + "blockHash": "0x7142e250663cf5ba881a1baedf08055b98c796e6269074f5953ce96b1c794ed7", + "blockNumber": "0x750e73", + "gasUsed": "0xc4b7", + "effectiveGasPrice": "0x204c6a849", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1739091794, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/broadcast/3_CreateQuestDonation.s.sol/11155111/run-1739092150.json b/broadcast/3_CreateQuestDonation.s.sol/11155111/run-1739092150.json new file mode 100644 index 0000000..f38e783 --- /dev/null +++ b/broadcast/3_CreateQuestDonation.s.sol/11155111/run-1739092150.json @@ -0,0 +1,91 @@ +{ + "transactions": [ + { + "hash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "createQuest(uint256)", + "arguments": [ + "1000000000000000000" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x1279c4", + "value": "0x0", + "input": "0x9a39cb370000000000000000000000000000000000000000000000000de0b6b3a7640000", + "nonce": "0xd", + "chainId": "0xaa36a7" + }, + "additionalContracts": [ + { + "transactionType": "CREATE", + "address": "0xfd843f5158401a48a7689bbae1976689c6582cdf", + "initCode": "0x6080346101ba57601f610d7f38819003918201601f19168301916001600160401b038311848410176101be578084926080946040528339810103126101ba57610047816101d2565b906020810151606061005b604084016101d2565b9201516001600160a01b03811693908490036101ba576001600160a01b03169182156101a7575f80546001600160a01b031981168517825584916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b031691821561016257811561011d5760018060a01b0319600254161760025560035560018060a01b0319600454161760045560018060a01b03196001541617600155604051610b9890816101e78239f35b60405162461bcd60e51b815260206004820152601560248201527f496e76616c69642074617267657420616d6f756e7400000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063726561746f7220616464726573730000000000000000006044820152606490fd5b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101ba5756fe6080806040526004361015610012575f80fd5b5f3560e01c90816302d05d3f1461099a5750806328031cf7146109625780632b0d1cda1461092a5780634857317e14610906578063715018a6146108af57806383914540146108915780638b4c40b01461067d5780638da5cb5b14610656578063953b8fb814610639578063c45a015514610611578063ef99fb02146102ab578063f2fde38b14610226578063f3fef3a3146100e25763f851a440146100b6575f80fd5b346100de575f3660031901126100de576002546040516001600160a01b039091168152602090f35b5f80fd5b346100de5760403660031901126100de576100fb6109bd565b6002546001600160a01b03169060243590338390036101e1576001600160a01b0316918261018457505f8080808460018060a01b036002541682821561017b575bf1156101705760207feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d915b604051908152a2005b6040513d5f823e3d90fd5b506108fc61013c565b7feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d916101dc6020926040519063a9059cbb60e01b858301526024820152826044820152604481526101d66064826109d3565b85610b0a565b610167565b60405162461bcd60e51b815260206004820152601760248201527f4f6e6c792061646d696e2063616e2077697468647261770000000000000000006044820152606490fd5b346100de5760203660031901126100de5761023f6109bd565b610247610ae4565b6001600160a01b03168015610298575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100de5760403660031901126100de576102c46109bd565b6001546040516341976e0960e01b81526001600160a01b03928316600482018190529260248035936020928492918391165afa908115610170575f916105df575b50610311811515610a09565b8261052b576103209082610a45565b335f5260066020526301e1338061033b60405f205442610a58565b1161050a575b335f52600560205261036c69010f0cf064dd592000006103658360405f2054610a65565b1115610a72565b335f52600560205261038360405f20918254610a65565b905560015460405163f9eaee0d60e01b8152600481018490526001600160a01b0390911690602081602481855afa908115610170575f916104cf575b5015610496576020602491604051928380926341976e0960e01b82528760048301525afa8015610170575f90610462575b61042f91506104296040516323b872dd60e01b6020820152336024820152306044820152846064820152606481526101d66084826109d3565b82610a45565b60405191825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b506020813d60201161048e575b8161047c602093836109d3565b810103126100de5761042f90516103f0565b3d915061046f565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b90506020813d602011610502575b816104ea602093836109d3565b810103126100de575180151581036100de57846103bf565b3d91506104dd565b335f5260056020525f6040812055335f5260066020524260405f2055610341565b60405163313ce56760e01b815290602082600481875afa918215610170575f9261059f575b5061055d60ff9184610a45565b9116604d811161058b57600a0a9081156105775704610320565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b9091506020813d6020116105d7575b816105bb602093836109d3565b810103126100de575160ff811681036100de579061055d610550565b3d91506105ae565b90506020813d602011610609575b816105fa602093836109d3565b810103126100de575183610305565b3d91506105ed565b346100de575f3660031901126100de576001546040516001600160a01b039091168152602090f35b346100de575f3660031901126100de576020600354604051908152f35b346100de575f3660031901126100de575f546040516001600160a01b039091168152602090f35b5f3660031901126100de576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa8015610170575f9061085d575b6106d791506106d1811515610a09565b34610a45565b335f5260066020526301e133806106f260405f205442610a58565b1161083c575b335f52600560205261071c69010f0cf064dd592000006103658360405f2054610a65565b335f52600560205261073360405f20918254610a65565b905534156107e8576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa908115610170575f916107b4575b5f6107808334610a45565b6040519034825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b90506020813d6020116107e0575b816107cf602093836109d3565b810103126100de5751610780610775565b3d91506107c2565b60405162461bcd60e51b815260206004820152602660248201527f446f6e6174696f6e20616d6f756e74206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608490fd5b335f5260056020525f6040812055335f5260066020524260405f20556106f8565b506020813d602011610889575b81610877602093836109d3565b810103126100de576106d790516106c1565b3d915061086a565b346100de575f3660031901126100de5760206040516301e133808152f35b346100de575f3660031901126100de576108c7610ae4565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100de575f3660031901126100de57602060405169010f0cf064dd592000008152f35b346100de5760203660031901126100de576001600160a01b0361094b6109bd565b165f526005602052602060405f2054604051908152f35b346100de5760203660031901126100de576001600160a01b036109836109bd565b165f526006602052602060405f2054604051908152f35b346100de575f3660031901126100de576004546001600160a01b03168152602090f35b600435906001600160a01b03821682036100de57565b90601f8019910116810190811067ffffffffffffffff8211176109f557604052565b634e487b7160e01b5f52604160045260245ffd5b15610a1057565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606490fd5b8181029291811591840414171561058b57565b9190820391821161058b57565b9190820180921161058b57565b15610a7957565b60405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e20657863656564732024353030302f796561722e20436f6e60448201527f7461637420696e666f4065746865726775696c642e78797a00000000000000006064820152608490fd5b5f546001600160a01b03163303610af757565b63118cdaa760e01b5f523360045260245ffd5b905f602091828151910182855af115610170575f513d610b5957506001600160a01b0381163b155b610b395750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415610b3256fea26469706673582212206a83203f3e204dec345ff9a9147bafa35a4f8f1a9a548f627cfd562ce8dee66d64736f6c634300081c00330000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000007db2542d15ac68c9958e8d73f32641ed9714fd6f" + } + ], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x868f3f", + "logs": [ + { + "address": "0xfd843f5158401a48a7689bbae1976689c6582cdf", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f" + ], + "data": "0x", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "logIndex": "0x96", + "removed": false + }, + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x01d8320e268685ac2181caee70ccf6f0b9a42f977e68559a40838f40b97bd317", + "0x000000000000000000000000fd843f5158401a48a7689bbae1976689c6582cdf", + "0x0000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000067a87094", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "logIndex": "0x97", + "removed": false + } + ], + "logsBloom": "0x00002000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000200000020000001000400000020000000000000000000000000020010000000000000008800000000000000000000000400000000400000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000020000000108000000000000000000", + "type": "0x2", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "gasUsed": "0xd6044", + "effectiveGasPrice": "0x2436e0eb2", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": { + "questDonationAddress": { + "internal_type": "address", + "value": "0xFd843f5158401a48a7689BbAe1976689c6582cdf" + } + }, + "timestamp": 1739092150, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/broadcast/3_CreateQuestDonation.s.sol/11155111/run-latest.json b/broadcast/3_CreateQuestDonation.s.sol/11155111/run-latest.json new file mode 100644 index 0000000..f38e783 --- /dev/null +++ b/broadcast/3_CreateQuestDonation.s.sol/11155111/run-latest.json @@ -0,0 +1,91 @@ +{ + "transactions": [ + { + "hash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "function": "createQuest(uint256)", + "arguments": [ + "1000000000000000000" + ], + "transaction": { + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "gas": "0x1279c4", + "value": "0x0", + "input": "0x9a39cb370000000000000000000000000000000000000000000000000de0b6b3a7640000", + "nonce": "0xd", + "chainId": "0xaa36a7" + }, + "additionalContracts": [ + { + "transactionType": "CREATE", + "address": "0xfd843f5158401a48a7689bbae1976689c6582cdf", + "initCode": "0x6080346101ba57601f610d7f38819003918201601f19168301916001600160401b038311848410176101be578084926080946040528339810103126101ba57610047816101d2565b906020810151606061005b604084016101d2565b9201516001600160a01b03811693908490036101ba576001600160a01b03169182156101a7575f80546001600160a01b031981168517825584916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b031691821561016257811561011d5760018060a01b0319600254161760025560035560018060a01b0319600454161760045560018060a01b03196001541617600155604051610b9890816101e78239f35b60405162461bcd60e51b815260206004820152601560248201527f496e76616c69642074617267657420616d6f756e7400000000000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063726561746f7220616464726573730000000000000000006044820152606490fd5b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101ba5756fe6080806040526004361015610012575f80fd5b5f3560e01c90816302d05d3f1461099a5750806328031cf7146109625780632b0d1cda1461092a5780634857317e14610906578063715018a6146108af57806383914540146108915780638b4c40b01461067d5780638da5cb5b14610656578063953b8fb814610639578063c45a015514610611578063ef99fb02146102ab578063f2fde38b14610226578063f3fef3a3146100e25763f851a440146100b6575f80fd5b346100de575f3660031901126100de576002546040516001600160a01b039091168152602090f35b5f80fd5b346100de5760403660031901126100de576100fb6109bd565b6002546001600160a01b03169060243590338390036101e1576001600160a01b0316918261018457505f8080808460018060a01b036002541682821561017b575bf1156101705760207feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d915b604051908152a2005b6040513d5f823e3d90fd5b506108fc61013c565b7feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d916101dc6020926040519063a9059cbb60e01b858301526024820152826044820152604481526101d66064826109d3565b85610b0a565b610167565b60405162461bcd60e51b815260206004820152601760248201527f4f6e6c792061646d696e2063616e2077697468647261770000000000000000006044820152606490fd5b346100de5760203660031901126100de5761023f6109bd565b610247610ae4565b6001600160a01b03168015610298575f80546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b631e4fbdf760e01b5f525f60045260245ffd5b346100de5760403660031901126100de576102c46109bd565b6001546040516341976e0960e01b81526001600160a01b03928316600482018190529260248035936020928492918391165afa908115610170575f916105df575b50610311811515610a09565b8261052b576103209082610a45565b335f5260066020526301e1338061033b60405f205442610a58565b1161050a575b335f52600560205261036c69010f0cf064dd592000006103658360405f2054610a65565b1115610a72565b335f52600560205261038360405f20918254610a65565b905560015460405163f9eaee0d60e01b8152600481018490526001600160a01b0390911690602081602481855afa908115610170575f916104cf575b5015610496576020602491604051928380926341976e0960e01b82528760048301525afa8015610170575f90610462575b61042f91506104296040516323b872dd60e01b6020820152336024820152306044820152846064820152606481526101d66084826109d3565b82610a45565b60405191825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b506020813d60201161048e575b8161047c602093836109d3565b810103126100de5761042f90516103f0565b3d915061046f565b60405162461bcd60e51b8152602060048201526011602482015270151bdad95b881b9bdd08185b1b1bddd959607a1b6044820152606490fd5b90506020813d602011610502575b816104ea602093836109d3565b810103126100de575180151581036100de57846103bf565b3d91506104dd565b335f5260056020525f6040812055335f5260066020524260405f2055610341565b60405163313ce56760e01b815290602082600481875afa918215610170575f9261059f575b5061055d60ff9184610a45565b9116604d811161058b57600a0a9081156105775704610320565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b9091506020813d6020116105d7575b816105bb602093836109d3565b810103126100de575160ff811681036100de579061055d610550565b3d91506105ae565b90506020813d602011610609575b816105fa602093836109d3565b810103126100de575183610305565b3d91506105ed565b346100de575f3660031901126100de576001546040516001600160a01b039091168152602090f35b346100de575f3660031901126100de576020600354604051908152f35b346100de575f3660031901126100de575f546040516001600160a01b039091168152602090f35b5f3660031901126100de576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa8015610170575f9061085d575b6106d791506106d1811515610a09565b34610a45565b335f5260066020526301e133806106f260405f205442610a58565b1161083c575b335f52600560205261071c69010f0cf064dd592000006103658360405f2054610a65565b335f52600560205261073360405f20918254610a65565b905534156107e8576001546040516341976e0960e01b81525f600482015290602090829060249082906001600160a01b03165afa908115610170575f916107b4575b5f6107808334610a45565b6040519034825260208201527fce9409ee3dc10e35de83dda0f830e4a13935452188fe71a956b850ecb839425f60403392a3005b90506020813d6020116107e0575b816107cf602093836109d3565b810103126100de5751610780610775565b3d91506107c2565b60405162461bcd60e51b815260206004820152602660248201527f446f6e6174696f6e20616d6f756e74206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608490fd5b335f5260056020525f6040812055335f5260066020524260405f20556106f8565b506020813d602011610889575b81610877602093836109d3565b810103126100de576106d790516106c1565b3d915061086a565b346100de575f3660031901126100de5760206040516301e133808152f35b346100de575f3660031901126100de576108c7610ae4565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346100de575f3660031901126100de57602060405169010f0cf064dd592000008152f35b346100de5760203660031901126100de576001600160a01b0361094b6109bd565b165f526005602052602060405f2054604051908152f35b346100de5760203660031901126100de576001600160a01b036109836109bd565b165f526006602052602060405f2054604051908152f35b346100de575f3660031901126100de576004546001600160a01b03168152602090f35b600435906001600160a01b03821682036100de57565b90601f8019910116810190811067ffffffffffffffff8211176109f557604052565b634e487b7160e01b5f52604160045260245ffd5b15610a1057565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606490fd5b8181029291811591840414171561058b57565b9190820391821161058b57565b9190820180921161058b57565b15610a7957565b60405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e20657863656564732024353030302f796561722e20436f6e60448201527f7461637420696e666f4065746865726775696c642e78797a00000000000000006064820152608490fd5b5f546001600160a01b03163303610af757565b63118cdaa760e01b5f523360045260245ffd5b905f602091828151910182855af115610170575f513d610b5957506001600160a01b0381163b155b610b395750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b60011415610b3256fea26469706673582212206a83203f3e204dec345ff9a9147bafa35a4f8f1a9a548f627cfd562ce8dee66d64736f6c634300081c00330000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f0000000000000000000000007db2542d15ac68c9958e8d73f32641ed9714fd6f" + } + ], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x868f3f", + "logs": [ + { + "address": "0xfd843f5158401a48a7689bbae1976689c6582cdf", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f" + ], + "data": "0x", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "logIndex": "0x96", + "removed": false + }, + { + "address": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "topics": [ + "0x01d8320e268685ac2181caee70ccf6f0b9a42f977e68559a40838f40b97bd317", + "0x000000000000000000000000fd843f5158401a48a7689bbae1976689c6582cdf", + "0x0000000000000000000000006a439b14f527d8731794b982d785b72f5d245c6f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000067a87094", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "logIndex": "0x97", + "removed": false + } + ], + "logsBloom": "0x00002000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000200000020000001000400000020000000000000000000000000020010000000000000008800000000000000000000000400000000400000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000020000000108000000000000000000", + "type": "0x2", + "transactionHash": "0x105e076c0874f525868697cdb88b71abefad1f63f7b81289f259c55f74234335", + "transactionIndex": "0x5f", + "blockHash": "0x8a7454cbd568003c64e69a3357219d7265128019992c8d5295f2ea8e83cbb8a7", + "blockNumber": "0x750e8d", + "gasUsed": "0xd6044", + "effectiveGasPrice": "0x2436e0eb2", + "from": "0x6a439b14f527d8731794b982d785b72f5d245c6f", + "to": "0x7db2542d15ac68c9958e8d73f32641ed9714fd6f", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": { + "questDonationAddress": { + "internal_type": "address", + "value": "0xFd843f5158401a48a7689BbAe1976689c6582cdf" + } + }, + "timestamp": 1739092150, + "chain": 11155111, + "commit": "7defbcd" +} \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index 52b4115..00b754f 100644 --- a/foundry.toml +++ b/foundry.toml @@ -7,8 +7,7 @@ via_ir = true [rpc_endpoints] sepolia = "${SEPOLIA_RPC_URL}" - +[etherscan.sepolia] +key = "${ETHERSCAN_API_KEY}" # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options - - diff --git a/script/1_DeployQuest.s.sol b/script/1_DeployQuestFactory.s.sol similarity index 54% rename from script/1_DeployQuest.s.sol rename to script/1_DeployQuestFactory.s.sol index b1dd98f..7fe8dfb 100644 --- a/script/1_DeployQuest.s.sol +++ b/script/1_DeployQuestFactory.s.sol @@ -5,25 +5,22 @@ import {Script, console} from "forge-std/Script.sol"; import {Helper} from "./Helper.sol"; import {QuestFactory} from "../src/QuestFactory.sol"; -contract DeployQuestScript is Script, Helper { - function run() external returns (address questFactoryAddress, address questDonationAddress) { +contract DeployQuestFactoryScript is Script, Helper { + function run() external returns (address) { uint256 deployerPrivateKey = getDeployerPrivateKey(); vm.startBroadcast(deployerPrivateKey); // Deploy QuestFactory with constructor parameters // Sets msg.sender as admin for factory and all future quests created QuestFactory questFactory = new QuestFactory(); - questFactoryAddress = address(questFactory); - - // Create a new Quest with a target amount (for example, 1 ether) - // Msg.sender is the creator of the quest, but only admin can withdraw funds - uint256 targetAmount = 1 ether; - questDonationAddress = questFactory.createQuest(targetAmount); + address questFactoryAddress = address(questFactory); // Log deployed addresses console.log("QuestFactory deployed to:", questFactoryAddress); - console.log("QuestDonation deployed to:", questDonationAddress); vm.stopBroadcast(); + + // Return the address of the QuestFactory + return questFactoryAddress; } } diff --git a/script/2_SetupQuest.s.sol b/script/2_SetupQuest.s.sol deleted file mode 100644 index 803d382..0000000 --- a/script/2_SetupQuest.s.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {Script, console} from "forge-std/Script.sol"; -import {Helper} from "./Helper.sol"; -import {QuestDonation} from "../src/QuestDonation.sol"; - -contract SetupQuestScript is Script, Helper { - function run(address questDonationAddress) external { - uint256 deployerPrivateKey = getDeployerPrivateKey(); - vm.startBroadcast(deployerPrivateKey); - - QuestDonation questDonation = QuestDonation(questDonationAddress); - - // Allow tokens - // ETH is not already allowed by default - questDonation.allowToken(address(0), true); - questDonation.allowToken(USDC, true); - console.log("ETH address(0) and USDC set as allowed tokens"); - - // Set price oracles - questDonation.setPriceOracle(address(0), ETH_USD_FEED); // For Native ETH - questDonation.setPriceOracle(USDC, USDC_USD_FEED); // USDC Oracle - console.log("Price oracles set for ETH and USDC"); - - vm.stopBroadcast(); - } -} diff --git a/script/2_SetupQuestFactory.s.sol b/script/2_SetupQuestFactory.s.sol new file mode 100644 index 0000000..f72ed20 --- /dev/null +++ b/script/2_SetupQuestFactory.s.sol @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {Script, console} from "forge-std/Script.sol"; +import {Helper} from "./Helper.sol"; +import {QuestDonation} from "../src/QuestDonation.sol"; +import "../src/QuestFactory.sol"; + +contract SetupQuestFactoryScript is Script, Helper { + function run() external { + // Parse address argument from CLI + // address factoryAddress = vm.parseAddress(vm.argString("factoryAddress")); + address factoryAddress = vm.envAddress("FACTORY_ADDRESS"); + + uint256 deployerPrivateKey = getDeployerPrivateKey(); + vm.startBroadcast(deployerPrivateKey); + + QuestFactory factory = QuestFactory(factoryAddress); + factory.allowToken(address(0), true); + factory.allowToken(USDC, true); + console.log("ETH address(0) and USDC set as allowed tokens"); + + factory.setPriceOracle(address(0), ETH_USD_FEED); // For Native ETH + factory.setPriceOracle(USDC, USDC_USD_FEED); // USDC Oracle + console.log("Price oracles set for ETH and USDC"); + + vm.stopBroadcast(); + } +} diff --git a/script/3_CreateQuestDonation.s.sol b/script/3_CreateQuestDonation.s.sol new file mode 100644 index 0000000..309781e --- /dev/null +++ b/script/3_CreateQuestDonation.s.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {Script, console} from "forge-std/Script.sol"; +import {Helper} from "./Helper.sol"; +import {QuestFactory} from "../src/QuestFactory.sol"; +import {QuestDonation} from "../src/QuestDonation.sol"; + +contract CreateQuestDonationScript is Script, Helper { + function run() external returns (address questDonationAddress) { + address factoryAddress = vm.envAddress("FACTORY_ADDRESS"); + + uint256 deployerPrivateKey = getDeployerPrivateKey(); + vm.startBroadcast(deployerPrivateKey); + + QuestFactory factory = QuestFactory(factoryAddress); + + // Create a new Quest with a target amount (for example, 1 ether) + // Msg.sender is the creator of the quest, but only admin can withdraw funds + uint256 targetAmount = 1 ether; + questDonationAddress = factory.createQuest(targetAmount); + QuestDonation questDonation = QuestDonation(questDonationAddress); + + // Log deployed addresses + console.log("QuestDonation deployed to:", address(questDonation)); + + vm.stopBroadcast(); + + // Return the address of the QuestDonation + } +} diff --git a/script/3_InteractionQuest.s.sol b/script/4_InteractionQuest.s.sol similarity index 88% rename from script/3_InteractionQuest.s.sol rename to script/4_InteractionQuest.s.sol index 026be2a..6f7626e 100644 --- a/script/3_InteractionQuest.s.sol +++ b/script/4_InteractionQuest.s.sol @@ -7,7 +7,9 @@ import {QuestDonation} from "../src/QuestDonation.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract InteractionQuestScript is Script, Helper { - function run(address questDonationAddress) external { + function run() external { + address questDonationAddress = vm.envAddress("DONATION_ADDRESS"); + uint256 deployerPrivateKey = getDeployerPrivateKey(); vm.startBroadcast(deployerPrivateKey); @@ -23,14 +25,14 @@ contract InteractionQuestScript is Script, Helper { // Make donations // ETH donation - questDonation.donateETH{value: 0.1 ether}(); // Donate ETH - console.log("Donated 0.1 ETH"); + questDonation.donateETH{value: 0.01 ether}(); // Donate ETH + console.log("Donated 0.01 ETH"); // USDC donation - uint256 usdcAmount = 100 * 10 ** 6; + uint256 usdcAmount = 1 * 10 ** 6; IERC20(USDC).approve(address(questDonation), usdcAmount); // DONATE USDC questDonation.donateERC20(USDC, usdcAmount); - console.log("Donated 100 USDC"); + console.log("Donated 1 USDC"); // Log balances after donations console.log("===QUEST CONTRACT: Balances after donations ==="); diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index be69ff1..30adab1 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -2,22 +2,29 @@ pragma solidity ^0.8.24; import {Helper} from "./Helper.sol"; -import {DeployQuestScript} from "./1_DeployQuest.s.sol"; -import {SetupQuestScript} from "./2_SetupQuest.s.sol"; -import {InteractionQuestScript} from "./3_InteractionQuest.s.sol"; +import {DeployQuestFactoryScript} from "./1_DeployQuestFactory.s.sol"; +import {SetupQuestFactoryScript} from "./2_SetupQuestFactory.s.sol"; +import {CreateQuestDonationScript} from "./3_CreateQuestDonation.s.sol"; +import {InteractionQuestScript} from "./4_InteractionQuest.s.sol"; contract DeployScript is Helper { function run() external { //DEPLOYS FACTORY AND FIRST EXAMPLE QUEST - DeployQuestScript deployQuest = new DeployQuestScript(); - (, address firstQuest) = deployQuest.run(); + DeployQuestFactoryScript deployQuest = new DeployQuestFactoryScript(); + // address factoryAddress = + deployQuest.run(); // ALLOW TOKENS AND ADD ORACLE - SetupQuestScript setupQuest = new SetupQuestScript(); - setupQuest.run(firstQuest); + SetupQuestFactoryScript setupQuest = new SetupQuestFactoryScript(); + setupQuest.run(); + + // CREATES FIRST QUEST + CreateQuestDonationScript createQuest = new CreateQuestDonationScript(); + // address firstQuest = + createQuest.run(); // INTERACTING WITH FIRST QUEST InteractionQuestScript interactingQuest = new InteractionQuestScript(); - interactingQuest.run(firstQuest); + interactingQuest.run(); } } diff --git a/src/QuestDonation.sol b/src/QuestDonation.sol index a54e489..fb061c0 100644 --- a/src/QuestDonation.sol +++ b/src/QuestDonation.sol @@ -3,12 +3,14 @@ pragma solidity ^0.8.24; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "lib/chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import "./QuestFactory.sol"; contract QuestDonation is Ownable { using SafeERC20 for IERC20; + QuestFactory public factory; + address public admin; uint256 public targetAmount; address public creator; @@ -16,17 +18,13 @@ contract QuestDonation is Ownable { uint256 public constant YEAR = 365 days; // Oracle mappings - mapping(address => AggregatorV3Interface) public priceOracles; // token => price feed mapping(address => uint256) public yearlyDonations; mapping(address => uint256) public lastDonationTimestamp; - mapping(address => bool) public allowedTokens; event DonationReceived(address indexed donor, address indexed token, uint256 amount, uint256 usdValue); - event TokenAllowed(address token, bool status); event FundsWithdrawn(address indexed token, uint256 amount); - event PriceOracleSet(address indexed token, address indexed oracle); - constructor(address _admin, uint256 _targetAmount, address _creator) Ownable(_admin) { + constructor(address _admin, uint256 _targetAmount, address _creator, QuestFactory _factory) Ownable(_admin) { require(_admin != address(0), "Invalid admin address"); require(_creator != address(0), "Invalid creator address"); require(_targetAmount > 0, "Invalid target amount"); @@ -34,25 +32,22 @@ contract QuestDonation is Ownable { admin = _admin; targetAmount = _targetAmount; creator = _creator; + factory = _factory; } modifier withinDonationLimit(address token, uint256 amount) { - require(address(priceOracles[token]) != address(0), "No price oracle set for token"); - AggregatorV3Interface priceFeed = priceOracles[token]; - (, int256 price,,,) = priceFeed.latestRoundData(); - uint8 priceDecimals = priceFeed.decimals(); - + uint256 price = factory.getPrice(token); require(price > 0, "Invalid price"); uint256 usdValue; if (token == address(0)) { // Native token (ETH) has 18 decimals - usdValue = (amount * uint256(price)) / (10 ** priceDecimals); + usdValue = amount * price; } else { // For ERC20 tokens, get their decimals uint8 tokenDecimals = IERC20Metadata(token).decimals(); // Adjust the calculation based on token decimals - usdValue = (amount * uint256(price)) / (10 ** tokenDecimals) / (10 ** priceDecimals); + usdValue = (amount * price) / (10 ** tokenDecimals); } uint256 lastYear = lastDonationTimestamp[msg.sender]; @@ -71,35 +66,15 @@ contract QuestDonation is Ownable { function donateETH() external payable withinDonationLimit(address(0), msg.value) { require(msg.value > 0, "Donation amount must be greater than 0"); - AggregatorV3Interface priceFeed = priceOracles[address(0)]; - (, int256 price,,,) = priceFeed.latestRoundData(); - uint8 priceDecimals = priceFeed.decimals(); - emit DonationReceived(msg.sender, address(0), msg.value, msg.value * uint256(price) / (10 ** priceDecimals)); + uint256 price = factory.getPrice(address(0)); + emit DonationReceived(msg.sender, address(0), msg.value, msg.value * price); } function donateERC20(address token, uint256 amount) external withinDonationLimit(token, amount) { - require(allowedTokens[token], "Token not allowed"); - IERC20(token).safeTransferFrom(msg.sender, address(this), amount); - AggregatorV3Interface priceFeed = priceOracles[token]; - (, int256 price,,,) = priceFeed.latestRoundData(); - uint8 priceDecimals = priceFeed.decimals(); - emit DonationReceived(msg.sender, token, amount, amount * uint256(price) / (10 ** priceDecimals)); - } - - function allowToken(address token, bool status) external onlyOwner { - allowedTokens[token] = status; - emit TokenAllowed(token, status); - } - - // Example - // Data Feed: ETH/USD - // Address token: address(0), oracle: 0xchainlin - function setPriceOracle(address token, address oracle) external onlyOwner { - require(allowedTokens[token], "Token not allowed"); - require(oracle != address(0), "Invalid oracle address"); - - priceOracles[token] = AggregatorV3Interface(oracle); - emit PriceOracleSet(token, oracle); + require(factory.isTokenAllowed(token), "Token not allowed"); + uint256 price = factory.getPrice(token); + SafeERC20.safeTransferFrom(IERC20(token), msg.sender, address(this), amount); + emit DonationReceived(msg.sender, token, amount, amount * price); } function withdraw(address token, uint256 amount) external { diff --git a/src/QuestFactory.sol b/src/QuestFactory.sol index 863f011..12c5639 100644 --- a/src/QuestFactory.sol +++ b/src/QuestFactory.sol @@ -1,11 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import "lib/chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; + import "./QuestDonation.sol"; contract QuestFactory { address public admin; + address[] public allowedTokens; + + // Mapping of token addresses to their corresponding price oracles + mapping(address => AggregatorV3Interface) public priceOracles; // token => price feed + + // Mapping of token addresses to their corresponding prices + mapping(address => uint256) public tokenPrices; + + // Mapping of token addresses to their corresponding allowed status + mapping(address => bool) public isTokenAllowed; + + event TokenAllowed(address token, bool status); + event PriceOracleSet(address indexed token, address indexed oracle); + constructor() { admin = msg.sender; // Set contract deployer as admin } @@ -27,7 +43,7 @@ contract QuestFactory { // Function to create new quest function createQuest(uint256 _targetAmount) external returns (address) { // Deploy new QuestDonation contract - QuestDonation newQuest = new QuestDonation(admin, _targetAmount, msg.sender); + QuestDonation newQuest = new QuestDonation(admin, _targetAmount, msg.sender, this); // Store quest details quests.push( @@ -45,6 +61,41 @@ contract QuestFactory { return address(newQuest); } + function allowToken(address token, bool status) external onlyOwner { + if (status) { + // Check if the token is already in the array + bool tokenAlreadyAllowed = false; + for (uint256 i = 0; i < allowedTokens.length; i++) { + if (allowedTokens[i] == token) { + tokenAlreadyAllowed = true; + break; + } + } + // Add the token only if it is not already in the array + if (!tokenAlreadyAllowed) { + allowedTokens.push(token); + } + } else { + // Remove the token from the array + for (uint256 i = 0; i < allowedTokens.length; i++) { + if (allowedTokens[i] == token) { + allowedTokens[i] = allowedTokens[allowedTokens.length - 1]; + allowedTokens.pop(); + break; + } + } + } + isTokenAllowed[token] = status; + } + + function getPrice(address token) public view returns (uint256) { + require(isTokenAllowed[token], "Token not allowed"); + AggregatorV3Interface priceFeed = priceOracles[token]; + (, int256 price,,,) = priceFeed.latestRoundData(); + uint8 priceDecimals = priceFeed.decimals(); + return uint256(price) / (10 ** priceDecimals); + } + // Get total number of quests function getQuestsCount() external view returns (uint256) { return quests.length; @@ -60,4 +111,30 @@ contract QuestFactory { Quest memory quest = quests[_index]; return (quest.questContract, quest.targetAmount, quest.creator, quest.timestamp); } + + // Example + // Data Feed: ETH/USD + // Address token: address(0), oracle: 0xchainlink + function setPriceOracle(address token, address oracle) external onlyOwner { + require(isTokenAllowed[token], "Token not allowed"); + require(oracle != address(0), "Invalid oracle address"); + + priceOracles[token] = AggregatorV3Interface(oracle); + emit PriceOracleSet(token, oracle); + } + + // Add a function to get allowed tokens + function getAllowedTokens() external view returns (address[] memory) { + return allowedTokens; + } + + // Add a function to get price oracles + function getPriceOracle(address token) external view returns (AggregatorV3Interface) { + return priceOracles[token]; + } + + modifier onlyOwner() { + require(msg.sender == admin, "Only admin can call this function"); + _; + } } diff --git a/test/QuestDonation.t.sol b/test/QuestDonation.t.sol index 92b9f0b..254223c 100644 --- a/test/QuestDonation.t.sol +++ b/test/QuestDonation.t.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.19; import {Test} from "forge-std/Test.sol"; import {QuestDonation} from "../src/QuestDonation.sol"; +import {QuestFactory} from "../src/QuestFactory.sol"; import {MockV3Aggregator} from "./mocks/MockV3Aggregator.sol"; import {MockERC20} from "./mocks/MockERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -39,14 +40,17 @@ contract QuestDonationTest is Test { mockUSDC = new MockERC20("Mock USDC", "USDC", 6); // Deploy QuestDonation contract with mock params - questDonation = new QuestDonation(owner, targetAmount, owner); + QuestFactory questFactory = new QuestFactory(); // Allow ETH, USDC and set oracle - questDonation.allowToken(address(0), true); // Replace address(0) with the actual token address if needed - questDonation.setPriceOracle(address(0), address(mockPriceFeedETH)); // Assuming setPriceOracle is a function in QuestDonation + questFactory.allowToken(address(0), true); // Replace address(0) with the actual token address if needed + questFactory.setPriceOracle(address(0), address(mockPriceFeedETH)); // Assuming setPriceOracle is a function in QuestDonation - questDonation.allowToken(address(mockUSDC), true); - questDonation.setPriceOracle(address(mockUSDC), address(mockPriceFeedUSDC)); + questFactory.allowToken(address(mockUSDC), true); + questFactory.setPriceOracle(address(mockUSDC), address(mockPriceFeedUSDC)); + + questDonation = QuestDonation(questFactory.createQuest(targetAmount)); + // questDonation = new QuestDonation(owner, targetAmount, owner); // Fund test addresses with ETH vm.deal(donor1, 10 ether);