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

feat(contract): charge fees on unsetting operator #439

Merged
merged 5 commits into from
Dec 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
2,236 changes: 1,120 additions & 1,116 deletions client/cmd/abi/IPTokenStaking.abi.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions client/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func bindSetOperatorFlags(cmd *cobra.Command, cfg *operatorConfig) {

func bindUnsetOperatorFlags(cmd *cobra.Command, cfg *operatorConfig) {
bindValidatorBaseFlags(cmd, &cfg.baseConfig)
cmd.Flags().StringVar(&cfg.Operator, "operator", "", "Unsets an operator from your delegator")
}

func bindSetWithdrawalAddressFlags(cmd *cobra.Command, cfg *withdrawalConfig) {
Expand Down Expand Up @@ -184,9 +183,7 @@ func validateValidatorCreateFlags(ctx context.Context, cmd *cobra.Command, cfg *
}

func validateOperatorFlags(cmd *cobra.Command) error {
return validateFlags(cmd, []string{
"operator",
})
return validateFlags(cmd, []string{})
}

func validateWithdrawalFlags(cmd *cobra.Command) error {
Expand Down
4 changes: 1 addition & 3 deletions client/cmd/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,6 @@ func unsetOperator(ctx context.Context, cfg operatorConfig) error {
return err
}

operatorAddress := common.HexToAddress(cfg.Operator)

result, err := prepareAndReadContract(ctx, &cfg.baseConfig, "fee")
if err != nil {
return err
Expand All @@ -551,7 +549,7 @@ func unsetOperator(ctx context.Context, cfg operatorConfig) error {
return errors.Wrap(err, "failed to unpack unsetOperatorFee")
}

_, err = prepareAndExecuteTransaction(ctx, &cfg.baseConfig, "unsetOperator", unsetOperatorFee, uncompressedPubKey, operatorAddress)
_, err = prepareAndExecuteTransaction(ctx, &cfg.baseConfig, "unsetOperator", unsetOperatorFee, uncompressedPubKey)
if err != nil {
return err
}
Expand Down
56 changes: 54 additions & 2 deletions contracts/bindings/create3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/bindings/create3_more.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

const (
Create3DeployedBytecode = "0x60806040908082526004918236101561001757600080fd5b600091823560e01c90816350f1c4641461027d575063cdcb760a1461003b57600080fd5b807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610279576024359067ffffffffffffffff82116102755736602383011215610275578184013593610090856103ba565b9361009d83519586610379565b8585526020958686019436602483830101116102755781839260248a930188378701015282513360601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016878201908152833560148201529061012c81603484015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610379565b51902093846101396103f4565b888151910184f59073ffffffffffffffffffffffffffffffffffffffff9586831615610219579183929161016d849361042d565b98519134905af1903d15610213573d90610186826103ba565b9161019386519384610379565b8252873d92013e5b80610209575b156101ae57505191168152f35b8460649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601560248201527f494e495449414c495a4154494f4e5f4641494c454400000000000000000000006044820152fd5b50833b15156101a1565b5061019b565b6064858a8851917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601160248201527f4445504c4f594d454e545f4641494c45440000000000000000000000000000006044820152fd5b8280fd5b5080fd5b8284863461027957827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261027957359273ffffffffffffffffffffffffffffffffffffffff91828516850361032b575060609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166020848101918252602435603486015293610323919061031b8160548101610100565b51902061042d565b915191168152f35b80fd5b6040810190811067ffffffffffffffff82111761034a57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761034a57604052565b67ffffffffffffffff811161034a57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b604051906104018261032e565b601082527f67363d3d37363d34f03d5260086018f3000000000000000000000000000000006020830152565b6104356103f4565b602081519101206040519060208201927fff0000000000000000000000000000000000000000000000000000000000000084523060601b602184015260358301526055820152605581526080810181811067ffffffffffffffff82111761034a577f010000000000000000000000000000000000000000000000000000000000000060b673ffffffffffffffffffffffffffffffffffffffff948360405284519020937fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a08201957fd694000000000000000000000000000000000000000000000000000000000000875260601b1660a28201520152601781526105398161032e565b519020169056fea26469706673582212203c3f094c14080645260151fc0973813e7e3e388692d8194b173368b56b8ac64864736f6c63430008170033"
Create3DeployedBytecode = "0x6080604081815260049182361015610015575f80fd5b5f3560e01c90816350f1c464146101f0575080635414dff01461019f5780639881d195146101335763cdcb760a1461004b575f80fd5b807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012f576024359167ffffffffffffffff831161012f5761012773ffffffffffffffffffffffffffffffffffffffff916100af60209536908301610358565b84513360601b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168782019081529235601484015290919061011c81603484015b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018352826102dd565b5190209034916104ea565b915191168152f35b5f80fd5b50807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012f57813567ffffffffffffffff811161012f5761012761019560209473ffffffffffffffffffffffffffffffffffffffff93369101610358565b34906024356104ea565b503461012f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012f5773ffffffffffffffffffffffffffffffffffffffff610127602093356103d7565b82843461012f57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012f57359173ffffffffffffffffffffffffffffffffffffffff90818416840361012f5760609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166020848101918252602435603486015293610127919061028c81605481016100f0565b5190206103d7565b6040810190811067ffffffffffffffff8211176102b057604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176102b057604052565b67ffffffffffffffff81116102b057601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561012f5780359061036f8261031e565b9261037d60405194856102dd565b8284526020838301011161012f57815f926020809301838601378301015290565b604051906103ab82610294565b601082527f67363d3d37363d34f03d5260086018f3000000000000000000000000000000006020830152565b6103df61039e565b602081519101206040519060208201927fff0000000000000000000000000000000000000000000000000000000000000084523060601b602184015260358301526055820152605581526080810181811067ffffffffffffffff8211176102b0577f010000000000000000000000000000000000000000000000000000000000000060b673ffffffffffffffffffffffffffffffffffffffff948360405284519020937fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a08201957fd694000000000000000000000000000000000000000000000000000000000000875260601b1660a28201520152601781526104e381610294565b5190201690565b929192806104f661039e565b6020815191015ff59173ffffffffffffffffffffffffffffffffffffffff8316156105d3575f9261052784936103d7565b95602083519301915af13d156105ce573d6105418161031e565b9061054f60405192836102dd565b81525f60203d92013e5b806105c4575b1561056657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f494e495449414c495a4154494f4e5f4641494c454400000000000000000000006044820152fd5b50813b151561055f565b610559565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4445504c4f594d454e545f4641494c45440000000000000000000000000000006044820152fdfea26469706673582212200cce8f106c69c6e73c95d42197d10a06932ab001439d02d8ab0c49108ccab19964736f6c63430008170033"
)

//go:embed create3_storage_layout.json
Expand Down
10 changes: 5 additions & 5 deletions contracts/bindings/iptokenstaking.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/iptokenstaking_more.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions contracts/bindings/iptokenstaking_storage_layout.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"storage": [
{
"astId": 48741,
"astId": 48774,
"contract": "src/protocol/IPTokenStaking.sol:IPTokenStaking",
"label": "minCommissionRate",
"offset": 0,
"slot": "0",
"type": "t_uint256"
},
{
"astId": 48744,
"astId": 48777,
"contract": "src/protocol/IPTokenStaking.sol:IPTokenStaking",
"label": "minStakeAmount",
"offset": 0,
"slot": "1",
"type": "t_uint256"
},
{
"astId": 48747,
"astId": 48780,
"contract": "src/protocol/IPTokenStaking.sol:IPTokenStaking",
"label": "minUnstakeAmount",
"offset": 0,
"slot": "2",
"type": "t_uint256"
},
{
"astId": 48750,
"astId": 48783,
"contract": "src/protocol/IPTokenStaking.sol:IPTokenStaking",
"label": "_delegationIdCounter",
"offset": 0,
"slot": "3",
"type": "t_uint256"
},
{
"astId": 48753,
"astId": 48786,
"contract": "src/protocol/IPTokenStaking.sol:IPTokenStaking",
"label": "fee",
"offset": 0,
Expand Down
Loading
Loading