Skip to content

Commit

Permalink
Remove unnecessary type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangoree committed Nov 4, 2024
1 parent dc1c82c commit d224a8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/hyperdrive-js-core/src/factory/ReadFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ReadFactory extends ReadModel {
...modelOptions
}: ReadFactoryOptions) {
super({ debugName, ...modelOptions });
this.address = address as Address;
this.address = address;
this.contract = this.drift.contract({
abi: factoryAbi,
address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
args: { time },
options,
}: ReadWriteParams<{ time: number }>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"checkpoint",
{ _checkpointTime: BigInt(time), _maxIterations: 4n },
{
Expand All @@ -72,7 +72,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand All @@ -85,7 +84,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
}: ReadWriteParams<{
paused: boolean;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"pause",
{ _status: paused },
{
Expand All @@ -96,8 +95,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);

return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -127,7 +124,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"initialize",
{
_apr: apr,
Expand All @@ -146,7 +143,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -177,7 +173,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"openLong",
{
_amount: amount,
Expand All @@ -193,7 +189,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -224,7 +219,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"openShort",
{
_bondAmount: bondAmount,
Expand All @@ -240,7 +235,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -271,7 +265,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"closeLong",
{
_maturityTime: maturityTime,
Expand All @@ -287,7 +281,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -318,7 +311,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"closeShort",
{
_maturityTime: maturityTime,
Expand All @@ -334,7 +327,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -368,7 +360,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"addLiquidity",
{
_contribution: contribution,
Expand All @@ -385,7 +377,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -415,7 +406,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"removeLiquidity",
{
_lpShares: lpSharesIn,
Expand All @@ -430,8 +421,6 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);

return hash as `0x${string}`;
}

/**
Expand Down Expand Up @@ -460,7 +449,7 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
asBase?: boolean;
extraData?: `0x${string}`;
}>): Promise<`0x${string}`> {
const hash = await this.contract.write(
return this.contract.write(
"redeemWithdrawalShares",
{
_withdrawalShares: withdrawalSharesIn,
Expand All @@ -475,6 +464,5 @@ export class ReadWriteHyperdrive extends ReadHyperdrive {
},
},
);
return hash as `0x${string}`;
}
}
2 changes: 1 addition & 1 deletion packages/hyperdrive-js-core/src/token/erc20/ReadErc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ReadErc20 extends ReadModel implements ReadToken {
}

get address(): Address {
return this.contract.address as Address;
return this.contract.address;
}
get namespace(): PropertyKey | undefined {
return this.contract.cacheNamespace;
Expand Down

0 comments on commit d224a8e

Please sign in to comment.