diff --git a/script/DeployPullOWRAndSplit.s.sol b/script/DeployPullOWRAndSplit.s.sol index f198392..59924f7 100644 --- a/script/DeployPullOWRAndSplit.s.sol +++ b/script/DeployPullOWRAndSplit.s.sol @@ -18,12 +18,16 @@ contract DeployPullOWRAndSplit is Script, SplitterConfiguration { } /// @param jsonFilePath the data format can be seen in ./data/deploy-pullOWR-sample.json - /// @param splitMain address for 0xsplits splitMain + /// @param split address for 0xsplits PullSplit /// @param pullOwrFactory address for factory - function run(string memory jsonFilePath, address splitMain, address pullOwrFactory, uint256 stakeSize) - // function run() + function run(string memory jsonFilePath, address split, address pullOwrFactory, uint256 stakeSize) external { + // string memory jsonFilePath = "script/data/deploy-pullOwr-sample.json"; + // address pullOwrFactory = 0xcFf568fBD1386f0d7784C174411341C8588d4Ba4; + // address split = 0x2636b017110c4d8977C6a7351D1de09e95fd595a; + // uint256 stakeSize = 32; + uint256 privKey = vm.envUint("PRIVATE_KEY"); bytes memory parsedJson = vm.parseJson(vm.readFile(jsonFilePath)); @@ -34,36 +38,27 @@ contract DeployPullOWRAndSplit is Script, SplitterConfiguration { string memory jsonKey = "pullOwrDeploy"; string memory finalJSON; - uint256 stakeAmount = stakeSize * 1 ether; - for (uint256 i = 0; i < data.length; i++) { - // deploy split - ConfigurationData memory currentConfiguration = data[i]; - - vm.startBroadcast(privKey); - - address split = ISplitMain(splitMain).createSplit( - currentConfiguration.split.accounts, - currentConfiguration.split.percentAllocations, - currentConfiguration.split.distributorFee, - currentConfiguration.split.controller - ); + { + vm.startBroadcast(privKey); - // create obol split - address pullOwrAddress = address( - OptimisticPullWithdrawalRecipientFactory(pullOwrFactory).createOWRecipient( - ETH_ADDRESS, currentConfiguration.recoveryRecipient, currentConfiguration.principalRecipient, split, stakeAmount - ) - ); + ConfigurationData memory currentConfiguration = data[i]; + address pullOwrAddress = address( + OptimisticPullWithdrawalRecipientFactory(pullOwrFactory).createOWRecipient( + ETH_ADDRESS, currentConfiguration.recoveryRecipient, currentConfiguration.principalRecipient, split, stakeSize * 1 ether + ) + ); - vm.stopBroadcast(); + vm.stopBroadcast(); - string memory objKey = vm.toString(i); + string memory objKey = vm.toString(i); - vm.serializeAddress(objKey, "splitAddress", split); - string memory repsonse = vm.serializeAddress(objKey, "pullOWRAddress", pullOwrAddress); + vm.serializeAddress(objKey, "splitAddress", split); + string memory repsonse = vm.serializeAddress(objKey, "pullOWRAddress", pullOwrAddress); - finalJSON = vm.serializeString(jsonKey, objKey, repsonse); + finalJSON = vm.serializeString(jsonKey, objKey, repsonse); + } + } vm.writeJson(finalJSON, "./pullOwr-split.json"); diff --git a/script/DeployPullSplitMock.sol b/script/DeployPullSplitMock.sol new file mode 100644 index 0000000..ad7cff1 --- /dev/null +++ b/script/DeployPullSplitMock.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +import "forge-std/Script.sol"; +import {PullSplitMock} from "src/test/owr/mocks/PullSplitMock.sol"; + +contract DeployPullSplitMock is Script { + function run() external { + uint256 privKey = vm.envUint("PRIVATE_KEY"); + + vm.startBroadcast(privKey); + + new PullSplitMock{salt: keccak256("pullSplitMock.1")}(); + + vm.stopBroadcast(); + } +} \ No newline at end of file diff --git a/script/data/deploy-pullOwr-sample.json b/script/data/deploy-pullOwr-sample.json index 7057c0a..b70bc33 100644 --- a/script/data/deploy-pullOwr-sample.json +++ b/script/data/deploy-pullOwr-sample.json @@ -1,18 +1,6 @@ [ { - "principalRecipient": "0x0000e6203DB925DbFB9e3d650A80a1E2f4A78e94", - "recoveryRecipient": "0x0000e6203DB925DbFB9e3d650A80a1E2f4A78e94", - "split": { - "accounts": [ - "0x0000e6203DB925DbFB9e3d650A80a1E2f4A78e94", - "0x08610E2A424c23169F79108D263Ed04f570A44FC" - ], - "controller": "0x0000e6203DB925DbFB9e3d650A80a1E2f4A78e94", - "distributorFee": 1, - "percentAllocations": [ - 500000, - 500000 - ] - } + "principalRecipient": "0x7712657E5a734fb19E3b6Bbb463dFa92BcDDb2DD", + "recoveryRecipient": "0x0000e6203DB925DbFB9e3d650A80a1E2f4A78e94" } ] \ No newline at end of file diff --git a/src/owr/ObolErc1155Recipient.sol b/src/owr/ObolErc1155Recipient.sol index ea6a837..3658d1e 100644 --- a/src/owr/ObolErc1155Recipient.sol +++ b/src/owr/ObolErc1155Recipient.sol @@ -201,7 +201,6 @@ contract ObolErc1155Recipient is ERC1155, Ownable, IERC1155Receiver { // withdraw from the OWR uint256 pullBalance = _owr.getPullBalance(address(this)); uint256 toWithdraw = pullBalance < ETH_DEPOSIT_AMOUNT ? pullBalance: ETH_DEPOSIT_AMOUNT; - if (toWithdraw < MIN_ETH_EXIT_AMOUNT) revert InvalidBurnAmount(MIN_ETH_EXIT_AMOUNT, toWithdraw); _owr.withdraw(address(this), toWithdraw); _burn(msg.sender, _tokenId, 1);