-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add strategies deployment script #658
Closed
+154
−0
Closed
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7fe2333
create DeployBase.sol
0xAustrian 99b62a4
create DeployDirectAllocation.sol
0xAustrian 3a63ee2
create deploy script for strategies
0xAustrian e1798c6
feat: move deployment params to .env
0xAustrian db04f7f
Merge branch 'v2.1' into feat/strategies-deployment-script
0xAustrian 4b207be
docs: add README
0xAustrian ab5aa16
feat: add contract name when deploying
0xAustrian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {Script, console} from "forge-std/Script.sol"; | ||
|
||
abstract contract DeployBase is Script { | ||
function run() public { | ||
vm.startBroadcast(); | ||
address _contract = _deploy(); | ||
vm.stopBroadcast(); | ||
|
||
console.log("Deployed contract at address: %s", _contract); | ||
} | ||
|
||
function _deploy() internal virtual returns (address _contract) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {DirectAllocationStrategy} from "contracts/strategies/examples/direct-allocation/DirectAllocation.sol"; | ||
|
||
contract DeployDirectAllocation is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new DirectAllocationStrategy(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {DonationVotingMerkleDistribution} from | ||
"contracts/strategies/examples/donation-voting/DonationVotingMerkleDistribution.sol"; | ||
|
||
contract DeployDonationVotingMerkleDistribution is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
bool _directTransfer = vm.envBool("DONATION_VOTING_MERKLE_DISTRIBUTION_IS_DIRECT_TRANSFER"); | ||
return address(new DonationVotingMerkleDistribution(_allo, _directTransfer)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {DonationVotingOffchain} from "contracts/strategies/examples/donation-voting/DonationVotingOffchain.sol"; | ||
|
||
contract DeployDonationVotingOffchain is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
bool _directTransfer = vm.envBool("DONATION_VOTING_OFFCHAIN_IS_DIRECT_TRANSFER"); | ||
return address(new DonationVotingOffchain(_allo, _directTransfer)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {DonationVotingOnchain} from "contracts/strategies/examples/donation-voting/DonationVotingOnchain.sol"; | ||
|
||
contract DeployDonationVotingOnchain is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new DonationVotingOnchain(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {EasyRPGF} from "contracts/strategies/examples/easy-rpgf/EasyRPGF.sol"; | ||
|
||
contract DeployEasyRPGF is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new EasyRPGF(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {QVImpactStream} from "contracts/strategies/examples/impact-stream/QVImpactStream.sol"; | ||
|
||
contract DeployQVImpactStream is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new QVImpactStream(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {QVSimple} from "contracts/strategies/examples/quadratic-voting/QVSimple.sol"; | ||
|
||
contract DeployQVSimple is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new QVSimple(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {DeployBase} from "script/DeployBase.sol"; | ||
import {RFPSimple} from "contracts/strategies/examples/rfp/RFPSimple.sol"; | ||
|
||
contract DeployRFPSimple is DeployBase { | ||
function _deploy() internal override returns (address _contract) { | ||
address _allo = vm.envAddress("ALLO_ADDRESS"); | ||
return address(new RFPSimple(_allo)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Deployment scripts | ||
|
||
This folder contains the scripts neccessary to deploy strategies and Allo contracts to the blockchain. | ||
|
||
# Usage | ||
|
||
1. Install dependencies by running `bun install`. | ||
2. Compile contracts by running `bun smock && bun compile`. | ||
3. Fill the necessary environment variables in `.env` file. You can use `.env.example` as a template. | ||
4. Run the deployment script with: | ||
``` | ||
forge script script/${SCRIPT_FILENAME}.sol:${SCRIPT_CONTRACT_NAME} --fork-url ${RPC_URL} --private-key ${PRIVATE_KEY} --broadcast | ||
``` | ||
For example: | ||
``` | ||
forge script script/DeployDirectAllocation.sol:DeployDirectAllocation --fork-url https://eth-sepolia.public.blastapi.io --private-key 0x0000 --broadcast | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to also have a log of the name of the strategy we deploy