Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/subcontexts/contract-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,20 @@ export class ContractContext {
}

private isArc4<T extends BaseContract>(type: IConstructor<T>): boolean {
// TODO: uncomment the following line once version puya-ts 1.0.0 is released
// return (type as DeliberateAny as typeof BaseContract).isArc4 ?? false

const result = (type as DeliberateAny as typeof BaseContract).isArc4
if (result !== undefined && result !== null) {
return result
}
// TODO: uncomment the following line once version puya-ts 1.0.0 is released and delete the rest of the function
// throw new internal.errors.CodeError('Cannot create a contract for class as it does not extend Contract or BaseContract')

const proto = Object.getPrototypeOf(type)
if (proto === BaseContract) {
return false
} else if (proto === Contract) {
return true
} else if (proto === null) {
return false
} else if (proto === Object || proto === null) {
throw new internal.errors.CodeError('Cannot create a contract for class as it does not extend Contract or BaseContract')
}
return this.isArc4(proto)
}
Expand Down
Loading