@btc-vision/btc-runtime
Version:
Bitcoin Smart Contract Runtime
18 lines (15 loc) • 622 B
text/typescript
import { u256 } from '@btc-vision/as-bignum/assembly';
import { BytesWriter } from '../../buffer/BytesWriter';
import { Address } from '../../types/Address';
import { ADDRESS_BYTE_LENGTH, U256_BYTE_LENGTH } from '../../utils/lengths';
import { NetEvent } from '../NetEvent';
@final
export class TransferEvent extends NetEvent {
constructor(from: Address, to: Address, amount: u256) {
const data: BytesWriter = new BytesWriter(ADDRESS_BYTE_LENGTH * 2 + U256_BYTE_LENGTH);
data.writeAddress(from);
data.writeAddress(to);
data.writeU256(amount);
super('Transfer', data);
}
}