-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: add ts to rr * chore: add latest vault * chore: no legacy * chore: clean up allocator * chore: dont revert * fix: comments * fix: comments * fix: readme * chore: remove scripts * fix: final edits * fix: role manager comments * fix: github action
- Loading branch information
1 parent
b3e8955
commit 148d4e7
Showing
30 changed files
with
555 additions
and
555 deletions.
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ out/ | |
!/broadcast | ||
/broadcast/*/31337/ | ||
/broadcast/**/dry-run/ | ||
/broadcast/ | ||
|
||
# Docs | ||
docs/ | ||
|
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 |
---|---|---|
|
@@ -6,4 +6,5 @@ venv/ | |
venv/ | ||
lib/ | ||
out/ | ||
cache/ | ||
cache/ | ||
broadcast/ |
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
Submodule forge-std
updated
5 files
+181 −0 | CONTRIBUTING.md | |
+16 −0 | README.md | |
+12 −1 | scripts/vm.py | |
+106 −16 | src/Vm.sol | |
+2 −2 | test/Vm.t.sol |
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,41 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity >=0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
// Deploy a contract to a deterministic address with create2 factory. | ||
contract Deploy is Script { | ||
// Create X address. | ||
Deployer public deployer = | ||
Deployer(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed); | ||
|
||
address public initGov = 0x6f3cBE2ab3483EC4BA7B672fbdCa0E9B33F88db8; | ||
|
||
function run() external { | ||
vm.startBroadcast(); | ||
|
||
// Append constructor args to the bytecode | ||
bytes memory bytecode = abi.encodePacked( | ||
vm.getCode("registry/ReleaseRegistry.sol:ReleaseRegistry"), | ||
abi.encode(initGov) | ||
); | ||
|
||
// Use salt of 0. | ||
bytes32 salt; | ||
|
||
address contractAddress = deployer.deployCreate2(salt, bytecode); | ||
|
||
console.log("Address is ", contractAddress); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} | ||
|
||
contract Deployer { | ||
event ContractCreation(address indexed newContract, bytes32 indexed salt); | ||
|
||
function deployCreate2( | ||
bytes32 salt, | ||
bytes memory initCode | ||
) public payable returns (address newContract) {} | ||
} |
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,65 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity >=0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
///@notice This cheat codes interface is named _CheatCodes so you can use the CheatCodes interface in other testing files without errors | ||
interface _CheatCodes { | ||
function ffi(string[] calldata) external returns (bytes memory); | ||
} | ||
|
||
// Deploy a contract to a deterministic address with create2 factory. | ||
contract DeployVyper is Script { | ||
address constant HEVM_ADDRESS = | ||
address(bytes20(uint160(uint256(keccak256("hevm cheat code"))))); | ||
|
||
/// @notice Initializes cheat codes in order to use ffi to compile Vyper contracts | ||
_CheatCodes cheatCodes = _CheatCodes(HEVM_ADDRESS); | ||
|
||
// Create X address. | ||
Deployer public deployer = | ||
Deployer(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed); | ||
|
||
address public initGov = 0x6f3cBE2ab3483EC4BA7B672fbdCa0E9B33F88db8; | ||
|
||
function run() external { | ||
vm.startBroadcast(); | ||
|
||
///@notice compile the Vyper contract and return the bytecode | ||
bytes memory bytecode = compileVyper( | ||
"src/addressProviders/", | ||
"ProtocolAddressProvider" | ||
); | ||
|
||
bytecode = abi.encodePacked(bytecode, abi.encode(initGov)); | ||
|
||
// Use salt of 0. | ||
bytes32 salt; | ||
|
||
address contractAddress = deployer.deployCreate2(salt, bytecode); | ||
|
||
console.log("Address is ", contractAddress); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
function compileVyper( | ||
string memory path, | ||
string memory fileName | ||
) public returns (bytes memory) { | ||
string[] memory cmds = new string[](2); | ||
cmds[0] = "vyper"; | ||
cmds[1] = string.concat(path, fileName, ".vy"); | ||
|
||
return cheatCodes.ffi(cmds); | ||
} | ||
} | ||
|
||
contract Deployer { | ||
event ContractCreation(address indexed newContract, bytes32 indexed salt); | ||
|
||
function deployCreate2( | ||
bytes32 salt, | ||
bytes memory initCode | ||
) public payable returns (address newContract) {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.