author liangqin.fan gmail import { UInt128 } from "as-scale-codec" ; import { ReturnCode , seal_transfer } from "as-contract-runtime" ; import { WriteBuffer } from "../primitives/writebuffer" ; import { AccountType } from "./AccountType" ; export type BalanceType = UInt128 ; export function SendBalance ( destination , value ) { let destBuffer = new WriteBuffer ( destination ) ; let valBuffer = new WriteBuffer ( value . toU8a ( ) ) ; let ret = seal_transfer ( destBuffer . buffer , destBuffer . size , valBuffer . buffer , valBuffer . size ) ; return ret === ReturnCode . Success ; } export function TransferBalance ( destination , value ) { let status = SendBalance ( destination , value ) ; assert ( status , "Transfer balance reverted." ) ; }