-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'iliad' into feat/add-unjail-cli-subcommand
- Loading branch information
Showing
17 changed files
with
226 additions
and
66 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//nolint:revive,stylecheck // version underscores | ||
package v0_11_0 | ||
|
||
import ( | ||
storetypes "cosmossdk.io/store/types" | ||
|
||
"github.com/piplabs/story/client/app/upgrades" | ||
) | ||
|
||
const UpgradeName = "v0.11.0" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
StoreUpgrades: storetypes.StoreUpgrades{}, | ||
} |
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,33 @@ | ||
//nolint:revive,stylecheck // version underscores | ||
package v0_11_0 | ||
|
||
import ( | ||
"context" | ||
|
||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/types/module" | ||
|
||
"github.com/piplabs/story/client/app/keepers" | ||
"github.com/piplabs/story/lib/errors" | ||
clog "github.com/piplabs/story/lib/log" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
keepers *keepers.Keepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
clog.Info(ctx, "Starting module migrations...") | ||
|
||
vm, err := mm.RunMigrations(ctx, configurator, vm) | ||
if err != nil { | ||
return vm, errors.Wrap(err, "run migrations") | ||
} | ||
|
||
clog.Info(ctx, "Upgrade v0.11.0 complete") | ||
|
||
return vm, nil | ||
} | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,72 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.23; | ||
/* solhint-disable no-console */ | ||
/* solhint-disable max-line-length */ | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { console2 } from "forge-std/console2.sol"; | ||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
import { IPTokenSlashing } from "../src/protocol/IPTokenSlashing.sol"; | ||
import { ICreate3Deployer } from "../src/deploy/ICreate3Deployer.sol"; | ||
|
||
/** | ||
* @title DeployIPTokenSlashing | ||
* @dev A script to deploy IPTokenSlashing for Illiad | ||
*/ | ||
contract DeployIPTokenSlashing is Script { | ||
// To run the script: | ||
// - Dry run | ||
// forge script script/DeployIPTokenSlashing.s.sol --fork-url <fork-url> | ||
// | ||
// - Deploy (OK for devnet) | ||
// forge script script/DeployIPTokenSlashing.s.sol --fork-url <fork-url> --broadcast | ||
// | ||
// - Deploy and Verify (for testnet) | ||
// forge script script/DeployIPTokenSlashing.s.sol --fork-url https://testnet.storyrpc.io --broadcast --verify --verifier blockscout --verifier-url https://testnet.storyscan.xyz/api\? | ||
function run() public { | ||
// Read env for admin address | ||
address protocolAccessManagerAddr = vm.envAddress("ADMIN_ADDRESS"); | ||
require(protocolAccessManagerAddr != address(0), "address not set"); | ||
// Read env for deployer private key | ||
uint256 deployerKey = vm.envUint("IPTOKENSTAKING_DEPLOYER_KEY"); | ||
address deployer = vm.addr(deployerKey); | ||
require(deployer != protocolAccessManagerAddr, "Deployer wallet can't be admin address"); | ||
console2.log("deployer", deployer); | ||
vm.startBroadcast(deployerKey); | ||
|
||
ICreate3Deployer c3Deployer = ICreate3Deployer(0x384a891dFDE8180b054f04D66379f16B7a678Ad6); | ||
console2.log("Create3 deployer:", address(c3Deployer)); | ||
|
||
address ipTokenStaking = 0xCCcCcC0000000000000000000000000000000001; | ||
|
||
address impl = address(new IPTokenSlashing(ipTokenStaking)); | ||
bytes memory initializationData = abi.encodeCall( | ||
IPTokenSlashing.initialize, | ||
( | ||
protocolAccessManagerAddr, | ||
1 ether // unjailFee | ||
) | ||
); | ||
bytes memory creationCode = | ||
abi.encodePacked(type(ERC1967Proxy).creationCode, abi.encode(impl, initializationData)); | ||
|
||
bytes32 salt = keccak256(abi.encode("STORY", type(IPTokenSlashing).name)); | ||
address predicted = c3Deployer.getDeployed(salt); | ||
console2.log("IPTokenSlashing will be deployed at:", predicted); | ||
IPTokenSlashing ipTokenSlashing = IPTokenSlashing(c3Deployer.deploy(salt, creationCode)); | ||
|
||
console2.log("IP_TOKEN_STAKING", address(ipTokenSlashing.IP_TOKEN_STAKING())); | ||
console2.log("owner:", ipTokenSlashing.owner()); | ||
console2.log("unjailFee:", ipTokenSlashing.unjailFee()); | ||
|
||
if (address(ipTokenSlashing) != predicted) { | ||
revert("IPTokenSlashing mismatch"); | ||
} | ||
console2.log("IPTokenSlashing deployed at:", address(ipTokenSlashing)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
|
||
} |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.23; | ||
|
||
interface ICreate3Deployer { | ||
/// @notice Deploys a contract using CREATE3 | ||
/// @param salt The salt to use for deployment | ||
/// @param creationCode The contract creation code | ||
/// @return deployed The address of the deployed contract | ||
function deploy(bytes32 salt, bytes calldata creationCode) external payable returns (address); | ||
|
||
/// @notice Predicts the address of a deployed contract | ||
/// @param salt The salt to use for deployment | ||
/// @return deployed The address of the contract that will be deployed | ||
function getDeployed(bytes32 salt) external view returns (address); | ||
} |
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
Oops, something went wrong.