mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
Update CLI for genesis Fix import paths from ethereum/go-ethereum to luxfi/geth - Replace all ethereum/go-ethereum imports with luxfi/geth - Add local rawdb package for unexported constants - Fix build errors in genesis tools - Add comprehensive migration documentation - Create build-all.sh script for building all tools - Clean up duplicate functions and unused imports Fix remaining imports Update CLI Remove symlink Remove local replace directives Update Update old templates
43 lines
931 B
Go
43 lines
931 B
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
package contract
|
|
|
|
import "github.com/ethereum/go-ethereum/common"
|
|
|
|
// GetContractOwner gets owner for https://docs.openzeppelin.com/contracts/2.x/api/ownership#Ownable-owner contracts
|
|
func GetContractOwner(
|
|
rpcURL string,
|
|
contractAddress common.Address,
|
|
) (common.Address, error) {
|
|
out, err := CallToMethod(
|
|
rpcURL,
|
|
contractAddress,
|
|
"owner()->(address)",
|
|
)
|
|
if err != nil {
|
|
return common.Address{}, err
|
|
}
|
|
return GetSmartContractCallResult[common.Address]("owner", out)
|
|
}
|
|
|
|
func TransferOwnership(
|
|
rpcURL string,
|
|
contractAddress common.Address,
|
|
ownerPrivateKey string,
|
|
newOwner common.Address,
|
|
) error {
|
|
_, _, err := TxToMethod(
|
|
rpcURL,
|
|
false,
|
|
common.Address{},
|
|
ownerPrivateKey,
|
|
contractAddress,
|
|
nil,
|
|
"transfer ownership",
|
|
nil,
|
|
"transferOwnership(address)",
|
|
newOwner,
|
|
)
|
|
return err
|
|
}
|