|
|
@@ -9,16 +9,18 @@ import { ChainName } from "../chains";
|
|
|
/** Withdraw fees from the target chain to the specified address */
|
|
|
export class WithdrawFee extends PythGovernanceActionImpl {
|
|
|
static layout: BufferLayout.Structure<
|
|
|
- Readonly<{ targetAddress: string; amount: bigint }>
|
|
|
+ Readonly<{ targetAddress: string; value: bigint; expo: bigint }>
|
|
|
> = BufferLayout.struct([
|
|
|
BufferLayoutExt.hexBytes(20, "targetAddress"), // Ethereum address as hex string
|
|
|
- BufferLayoutExt.u256be("amount"), // uint256 for amount in wei
|
|
|
+ BufferLayoutExt.u64be("value"), // uint64 for value
|
|
|
+ BufferLayoutExt.u64be("expo"), // uint64 for exponent
|
|
|
]);
|
|
|
|
|
|
constructor(
|
|
|
targetChainId: ChainName,
|
|
|
readonly targetAddress: Buffer,
|
|
|
- readonly amount: bigint,
|
|
|
+ readonly value: bigint,
|
|
|
+ readonly expo: bigint,
|
|
|
) {
|
|
|
super(targetChainId, "WithdrawFee");
|
|
|
}
|
|
|
@@ -34,14 +36,16 @@ export class WithdrawFee extends PythGovernanceActionImpl {
|
|
|
return new WithdrawFee(
|
|
|
decoded[0].targetChainId,
|
|
|
Buffer.from(decoded[1].targetAddress, "hex"),
|
|
|
- decoded[1].amount,
|
|
|
+ decoded[1].value,
|
|
|
+ decoded[1].expo,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
encode(): Buffer {
|
|
|
return super.encodeWithPayload(WithdrawFee.layout, {
|
|
|
targetAddress: this.targetAddress.toString("hex"),
|
|
|
- amount: this.amount,
|
|
|
+ value: this.value,
|
|
|
+ expo: this.expo,
|
|
|
});
|
|
|
}
|
|
|
}
|