Skip to content
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

Update L2 deployment, MorphToken #584

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions ops/l2-genesis/morph-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ type DeployConfig struct {
RecordNextBatchSubmissionIndex uint64 `json:"recordNextBatchSubmissionIndex"`

// MorphToken configs
MorphTokenOwner common.Address `json:"morphTokenOwner"`
MorphTokenName string `json:"morphTokenName"`
MorphTokenSymbol string `json:"morphTokenSymbol"`
MorphTokenInitialSupply uint64 `json:"morphTokenInitialSupply"`
MorphTokenDailyInflationRate uint64 `json:"morphTokenDailyInflationRate"`
//MorphTokenOwner common.Address `json:"morphTokenOwner"`
//MorphTokenName string `json:"morphTokenName"`
//MorphTokenSymbol string `json:"morphTokenSymbol"`
//MorphTokenInitialSupply uint64 `json:"morphTokenInitialSupply"`
//MorphTokenDailyInflationRate uint64 `json:"morphTokenDailyInflationRate"`

FundDevAccounts bool `json:"fundDevAccounts"`
}
Expand Down Expand Up @@ -378,11 +378,11 @@ func NewL2ImmutableConfig(config *DeployConfig) (immutables.ImmutableConfig, *im
USDCBlackLister: config.FinalSystemOwner,
USDCOwner: config.FinalSystemOwner,
// MorphToken
MorphTokenOwner: config.MorphTokenOwner,
MorphTokenName: config.MorphTokenName,
MorphTokenSymbol: config.MorphTokenSymbol,
MorphTokenInitialSupply: config.MorphTokenInitialSupply,
MorphTokenDailyInflationRate: config.MorphTokenDailyInflationRate,
//MorphTokenOwner: config.MorphTokenOwner,
//MorphTokenName: config.MorphTokenName,
//MorphTokenSymbol: config.MorphTokenSymbol,
//MorphTokenInitialSupply: config.MorphTokenInitialSupply,
//MorphTokenDailyInflationRate: config.MorphTokenDailyInflationRate,
// L2Staking
L2StakingOwner: config.FinalSystemOwner,
L2StakingSequencersMaxSize: config.L2StakingSequencerMaxSize,
Expand Down Expand Up @@ -441,21 +441,21 @@ func (d *DeployConfig) Check() error {
if d.L2StakingUnDelegatedLockEpochs <= 0 {
return fmt.Errorf("L2StakingUnDelegatedLockEpochs must be greater than 0: %w", ErrInvalidDeployConfig)
}
if d.MorphTokenOwner == (common.Address{}) {
return fmt.Errorf("MorphTokenOwner canot be nil: %w", ErrInvalidDeployConfig)
}
if d.MorphTokenName == "" {
return fmt.Errorf("MorphTokenName canot be nil: %w", ErrInvalidDeployConfig)
}
if d.MorphTokenSymbol == "" {
return fmt.Errorf("MorphTokenSymbol canot be nil: %w", ErrInvalidDeployConfig)
}
if d.MorphTokenDailyInflationRate <= 0 {
return fmt.Errorf("MorphTokenDailyInflationRate must be greater than 0: %w", ErrInvalidDeployConfig)
}
if d.MorphTokenInitialSupply <= 0 {
return fmt.Errorf("MorphTokenInitialSupply must be greater than 0: %w", ErrInvalidDeployConfig)
}
//if d.MorphTokenOwner == (common.Address{}) {
// return fmt.Errorf("MorphTokenOwner canot be nil: %w", ErrInvalidDeployConfig)
//}
//if d.MorphTokenName == "" {
// return fmt.Errorf("MorphTokenName canot be nil: %w", ErrInvalidDeployConfig)
//}
//if d.MorphTokenSymbol == "" {
// return fmt.Errorf("MorphTokenSymbol canot be nil: %w", ErrInvalidDeployConfig)
//}
//if d.MorphTokenDailyInflationRate <= 0 {
// return fmt.Errorf("MorphTokenDailyInflationRate must be greater than 0: %w", ErrInvalidDeployConfig)
//}
//if d.MorphTokenInitialSupply <= 0 {
// return fmt.Errorf("MorphTokenInitialSupply must be greater than 0: %w", ErrInvalidDeployConfig)
//}
return nil
}

Expand Down Expand Up @@ -491,10 +491,10 @@ func NewL2StorageConfig(config *DeployConfig, baseFee *big.Int) (state.StorageCo
"counterpart": config.L1CrossDomainMessengerProxy,
"feeVault": l2BridgeFeeVaultRecipient,
}
storage["MorphToken"] = state.StorageValues{
"_initialized": 1,
"_initializing": false,
}
//storage["MorphToken"] = state.StorageValues{
// "_initialized": 1,
// "_initializing": false,
//}
storage["Record"] = state.StorageValues{
"_initialized": 1,
"_initializing": false,
Expand Down
10 changes: 5 additions & 5 deletions ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ func Test_BuildL2DeveloperGenesis(t *testing.T) {
GovBatchTimeout: 100,

// MorphToken
MorphTokenOwner: address1,
MorphTokenName: "Morph Token",
MorphTokenSymbol: "Morph",
MorphTokenInitialSupply: 1000000000,
MorphTokenDailyInflationRate: 1,
//MorphTokenOwner: address1,
//MorphTokenName: "Morph Token",
//MorphTokenSymbol: "Morph",
//MorphTokenInitialSupply: 1000000000,
//MorphTokenDailyInflationRate: 1,

FundDevAccounts: true,
}
Expand Down
3 changes: 3 additions & 0 deletions ops/l2-genesis/morph-chain-ops/genesis/setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func SetImplementations(db vm.StateDB, storage state.StorageConfig, immutable im
return err
}
} else {
if name == "MorphToken" {
continue
}
err = SetTouchable(db, name, *address, storage, deployResults, slotResults)
if err != nil {
return err
Expand Down
58 changes: 29 additions & 29 deletions ops/l2-genesis/morph-chain-ops/immutables/immutables.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func BuildMorph(immutable ImmutableConfig, config *InitConfig) (DeploymentResult
{
Name: "L2ERC1155Gateway",
},
{
Name: "MorphToken",
},
//{
// Name: "MorphToken",
//},
{
Name: "MorphStandardERC20",
},
Expand Down Expand Up @@ -204,29 +204,29 @@ func BuildL2(constructors []deployer.Constructor, config *InitConfig) (Deploymen
if err != nil {
return nil, nil, err
}
case "MorphToken":
if config == nil || config.MorphTokenName == "" {
continue
}
morphToken, err := bindings.NewMorphToken(dep.Address, backend)
if err != nil {
return nil, nil, err
}
initSupply, success := new(big.Int).SetString(strconv.FormatUint(config.MorphTokenInitialSupply, 10)+"000000000000000000", 10)
if !success {
return nil, nil, errors.New("MorphTokenInitialSupply convert failed")
}
lastTx, err = morphToken.Initialize(
opts,
config.MorphTokenName,
config.MorphTokenSymbol,
config.MorphTokenOwner,
initSupply,
new(big.Int).SetUint64(config.MorphTokenDailyInflationRate),
)
if err != nil {
return nil, nil, err
}
//case "MorphToken":
// if config == nil || config.MorphTokenName == "" {
// continue
// }
// morphToken, err := bindings.NewMorphToken(dep.Address, backend)
// if err != nil {
// return nil, nil, err
// }
// initSupply, success := new(big.Int).SetString(strconv.FormatUint(config.MorphTokenInitialSupply, 10)+"000000000000000000", 10)
// if !success {
// return nil, nil, errors.New("MorphTokenInitialSupply convert failed")
// }
// lastTx, err = morphToken.Initialize(
// opts,
// config.MorphTokenName,
// config.MorphTokenSymbol,
// config.MorphTokenOwner,
// initSupply,
// new(big.Int).SetUint64(config.MorphTokenDailyInflationRate),
// )
// if err != nil {
// return nil, nil, err
// }
case "L2USDC":
if config == nil || config.USDCTokenName == "" {
continue
Expand All @@ -249,7 +249,7 @@ func BuildL2(constructors []deployer.Constructor, config *InitConfig) (Deploymen
if err != nil {
return nil, nil, err
}
mintSupply, success := new(big.Int).SetString(strconv.FormatUint(config.MorphTokenInitialSupply, 10)+"000000000000000000", 10)
mintSupply, success := new(big.Int).SetString(strconv.FormatUint(1000000000, 10)+"000000000000000000", 10)
if !success {
return nil, nil, errors.New("USDC token mint Supply convert failed")
}
Expand Down Expand Up @@ -334,8 +334,8 @@ func l2Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
_, tx, _, err = bindings.DeployL2ToL1MessagePasser(opts, backend)
case "L2TxFeeVault":
_, tx, _, err = bindings.DeployL2TxFeeVault(opts, backend, common.BigToAddress(common.Big1), common.BigToAddress(common.Big1), common.Big0)
case "MorphToken":
_, tx, _, err = bindings.DeployMorphToken(opts, backend)
//case "MorphToken":
// _, tx, _, err = bindings.DeployMorphToken(opts, backend)
case "MorphStandardERC20":
_, tx, _, err = bindings.DeployMorphStandardERC20(opts, backend)
case "MorphStandardERC20Factory":
Expand Down
Loading