Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OpTransferToTimelock = operations.NewOperation( "solana-transfer-to-timelock", semver.MustParse("1.0.0"), "Transfer ownable Solana contract ownership to the MCMS timelock", func(b operations.Bundle, chain cldfsol.Chain, in OpTransferToTimelockInput) (OpTransferToTimelockOutput, error) { var out OpTransferToTimelockOutput chainSelector := chain.Selector if !in.OnlyAcceptOwnership { if chain.DeployerKey == nil { return OpTransferToTimelockOutput{}, fmt.Errorf("missing deployer key for chain %d", chain.Selector) } transferInstruction, err := transferOwnershipInstruction( in.Contract.ProgramID, in.Contract.Seed, in.TimelockSignerPDA, in.Contract.OwnerPDA, chain.DeployerKey.PublicKey(), ) if err != nil { return out, fmt.Errorf("create transfer ownership instruction: %w", err) } b.Logger.Infow( "confirming solana transfer ownership instruction", "program", in.Contract.ProgramID.String(), "contractType", in.Contract.Type, ) if err = chain.Confirm([]solanago.Instruction{transferInstruction}); err != nil { return out, fmt.Errorf("confirm transfer ownership instruction: %w", err) } owner, err := contractOwner(b.GetContext(), chain, in.Contract) if err != nil { return out, fmt.Errorf("read contract owner after transfer: %w", err) } if owner == in.TimelockSignerPDA { b.Logger.Infof("contract %s already owned by timelock after transfer", in.Contract.Type) return out, nil } } acceptMCMSTx, err := acceptMCMSTransaction(in.Contract, in.TimelockSignerPDA) if err != nil { return out, fmt.Errorf("create accept ownership mcms transaction: %w", err) } out.BatchOps = append(out.BatchOps, mcmstypes.BatchOperation{ ChainSelector: mcmstypes.ChainSelector(chainSelector), Transactions: []mcmstypes.Transaction{acceptMCMSTx}, }) return out, nil }, )
OpTransferToTimelock transfers one ownable Solana contract to the timelock signer PDA.
Functions ¶
func Registration ¶
func Registration() transfertotimelock.Registration
Registration returns the Solana chain-family transfer-to-timelock registration.
Types ¶
type OpTransferToTimelockInput ¶
type OpTransferToTimelockInput struct {
Contract OwnableContract
TimelockSignerPDA solanago.PublicKey
OnlyAcceptOwnership bool
}
OpTransferToTimelockInput is the input for transferring one Solana contract to the timelock.
type OpTransferToTimelockOutput ¶
type OpTransferToTimelockOutput struct {
BatchOps []mcmstypes.BatchOperation
}
OpTransferToTimelockOutput is the output of a single contract transfer operation.
type OwnableContract ¶
type OwnableContract struct {
ProgramID solanago.PublicKey
Seed legacysolana.PDASeed
OwnerPDA solanago.PublicKey
Type cldf.ContractType
}
OwnableContract identifies a Solana ownable program account to transfer.
Click to show internal directories.
Click to hide internal directories.