CodeAt returns the code associated with a certain account in the blockchain.
(ctx context.Context, contract common.Address, blockNumber *big.Int)
| 133 | |
| 134 | // CodeAt returns the code associated with a certain account in the blockchain. |
| 135 | func (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. |
| 147 | func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (*big.Int, error) { |