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

Method CodeAt

accounts/abi/bind/backends/simulated.go:135–144  ·  view source on GitHub ↗

CodeAt returns the code associated with a certain account in the blockchain.

(ctx context.Context, contract common.Address, blockNumber *big.Int)

Source from the content-addressed store, hash-verified

133
134// CodeAt returns the code associated with a certain account in the blockchain.
135func (b *SimulatedBackend) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) {
136 b.mu.Lock()
137 defer b.mu.Unlock()
138
139 if blockNumber != nil && blockNumber.Cmp(b.blockchain.CurrentBlock().Number()) != 0 {
140 return nil, errBlockNumberUnsupported
141 }
142 statedb, _ := b.blockchain.State()
143 return statedb.GetCode(contract), nil
144}
145
146// BalanceAt returns the wei balance of a certain account in the blockchain.
147func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (*big.Int, error) {

Callers

nothing calls this directly

Calls 7

LockMethod · 0.80
UnlockMethod · 0.80
CmpMethod · 0.80
CurrentBlockMethod · 0.65
StateMethod · 0.65
GetCodeMethod · 0.65
NumberMethod · 0.45

Tested by

no test coverage detected