MCPcopy Create free account
hub / github.com/CPChain/chain / GetCode

Method GetCode

internal/cpcapi/api.go:682–689  ·  view source on GitHub ↗

GetCode returns the code stored at the given address in the state for the given block number.

(ctx context.Context, address common.Address, blockNr rpc.BlockNumber)

Source from the content-addressed store, hash-verified

680
681// GetCode returns the code stored at the given address in the state for the given block number.
682func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error) {
683 state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr, false)
684 if state == nil || err != nil {
685 return nil, err
686 }
687 code := state.GetCode(address)
688 return code, state.Error()
689}
690
691// GetStorageAt returns the storage from the state at the given address, key and
692// block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block

Callers

nothing calls this directly

Calls 3

GetCodeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected