Skip to content

Commit

Permalink
update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tburm committed Aug 15, 2023
1 parent a9d4d4d commit b95e9d8
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,44 @@ export class OrderCommitted__Params {
}
}

export class PreviousOrderExpired extends ethereum.Event {
get params(): PreviousOrderExpired__Params {
return new PreviousOrderExpired__Params(this);
}
}

export class PreviousOrderExpired__Params {
_event: PreviousOrderExpired;

constructor(event: PreviousOrderExpired) {
this._event = event;
}

get marketId(): BigInt {
return this._event.parameters[0].value.toBigInt();
}

get accountId(): BigInt {
return this._event.parameters[1].value.toBigInt();
}

get sizeDelta(): BigInt {
return this._event.parameters[2].value.toBigInt();
}

get acceptablePrice(): BigInt {
return this._event.parameters[3].value.toBigInt();
}

get settlementTime(): BigInt {
return this._event.parameters[4].value.toBigInt();
}

get trackingCode(): Bytes {
return this._event.parameters[5].value.toBytes();
}
}

export class MarketUpdated extends ethereum.Event {
get params(): MarketUpdated__Params {
return new MarketUpdated__Params(this);
Expand Down Expand Up @@ -379,36 +417,40 @@ export class OrderSettled__Params {
return this._event.parameters[3].value.toBigInt();
}

get sizeDelta(): BigInt {
get accruedFunding(): BigInt {
return this._event.parameters[4].value.toBigInt();
}

get newSize(): BigInt {
get sizeDelta(): BigInt {
return this._event.parameters[5].value.toBigInt();
}

get totalFees(): BigInt {
get newSize(): BigInt {
return this._event.parameters[6].value.toBigInt();
}

get referralFees(): BigInt {
get totalFees(): BigInt {
return this._event.parameters[7].value.toBigInt();
}

get collectedFees(): BigInt {
get referralFees(): BigInt {
return this._event.parameters[8].value.toBigInt();
}

get settlementReward(): BigInt {
get collectedFees(): BigInt {
return this._event.parameters[9].value.toBigInt();
}

get settlementReward(): BigInt {
return this._event.parameters[10].value.toBigInt();
}

get trackingCode(): Bytes {
return this._event.parameters[10].value.toBytes();
return this._event.parameters[11].value.toBytes();
}

get settler(): Address {
return this._event.parameters[11].value.toAddress();
return this._event.parameters[12].value.toAddress();
}
}

Expand Down Expand Up @@ -1010,16 +1052,22 @@ export class PerpsMarketProxy__getOpenPositionResult {
export class PerpsMarketProxy__getRequiredMarginsResult {
value0: BigInt;
value1: BigInt;
value2: BigInt;
value3: BigInt;

constructor(value0: BigInt, value1: BigInt) {
constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
this.value3 = value3;
}

toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0));
map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1));
map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2));
map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3));
return map;
}

Expand All @@ -1030,6 +1078,14 @@ export class PerpsMarketProxy__getRequiredMarginsResult {
getRequiredMaintenanceMargin(): BigInt {
return this.value1;
}

getTotalAccumulatedLiquidationRewards(): BigInt {
return this.value2;
}

getMaxLiquidationReward(): BigInt {
return this.value3;
}
}

export class PerpsMarketProxy__getMarketSummaryResultSummaryStruct extends ethereum.Tuple {
Expand Down Expand Up @@ -1178,6 +1234,31 @@ export class PerpsMarketProxy__commitOrderInputCommitmentStruct extends ethereum
}
}

export class PerpsMarketProxy__computeOrderFeesResult {
value0: BigInt;
value1: BigInt;

constructor(value0: BigInt, value1: BigInt) {
this.value0 = value0;
this.value1 = value1;
}

toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0));
map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1));
return map;
}

getOrderFees(): BigInt {
return this.value0;
}

getFillPrice(): BigInt {
return this.value1;
}
}

export class PerpsMarketProxy__getOrderResultOrderStruct extends ethereum.Tuple {
get settlementTime(): BigInt {
return this[0].toBigInt();
Expand Down Expand Up @@ -1883,13 +1964,17 @@ export class PerpsMarketProxy extends ethereum.SmartContract {
}

getRequiredMargins(accountId: BigInt): PerpsMarketProxy__getRequiredMarginsResult {
let result = super.call('getRequiredMargins', 'getRequiredMargins(uint128):(uint256,uint256)', [
ethereum.Value.fromUnsignedBigInt(accountId),
]);
let result = super.call(
'getRequiredMargins',
'getRequiredMargins(uint128):(uint256,uint256,uint256,uint256)',
[ethereum.Value.fromUnsignedBigInt(accountId)]
);

return new PerpsMarketProxy__getRequiredMarginsResult(
result[0].toBigInt(),
result[1].toBigInt()
result[1].toBigInt(),
result[2].toBigInt(),
result[3].toBigInt()
);
}

Expand All @@ -1898,15 +1983,20 @@ export class PerpsMarketProxy extends ethereum.SmartContract {
): ethereum.CallResult<PerpsMarketProxy__getRequiredMarginsResult> {
let result = super.tryCall(
'getRequiredMargins',
'getRequiredMargins(uint128):(uint256,uint256)',
'getRequiredMargins(uint128):(uint256,uint256,uint256,uint256)',
[ethereum.Value.fromUnsignedBigInt(accountId)]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(
new PerpsMarketProxy__getRequiredMarginsResult(value[0].toBigInt(), value[1].toBigInt())
new PerpsMarketProxy__getRequiredMarginsResult(
value[0].toBigInt(),
value[1].toBigInt(),
value[2].toBigInt(),
value[3].toBigInt()
)
);
}

Expand Down Expand Up @@ -2197,25 +2287,32 @@ export class PerpsMarketProxy extends ethereum.SmartContract {
);
}

computeOrderFees(marketId: BigInt, sizeDelta: BigInt): BigInt {
let result = super.call('computeOrderFees', 'computeOrderFees(uint128,int128):(uint256)', [
ethereum.Value.fromUnsignedBigInt(marketId),
ethereum.Value.fromSignedBigInt(sizeDelta),
]);
computeOrderFees(marketId: BigInt, sizeDelta: BigInt): PerpsMarketProxy__computeOrderFeesResult {
let result = super.call(
'computeOrderFees',
'computeOrderFees(uint128,int128):(uint256,uint256)',
[ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromSignedBigInt(sizeDelta)]
);

return result[0].toBigInt();
return new PerpsMarketProxy__computeOrderFeesResult(result[0].toBigInt(), result[1].toBigInt());
}

try_computeOrderFees(marketId: BigInt, sizeDelta: BigInt): ethereum.CallResult<BigInt> {
let result = super.tryCall('computeOrderFees', 'computeOrderFees(uint128,int128):(uint256)', [
ethereum.Value.fromUnsignedBigInt(marketId),
ethereum.Value.fromSignedBigInt(sizeDelta),
]);
try_computeOrderFees(
marketId: BigInt,
sizeDelta: BigInt
): ethereum.CallResult<PerpsMarketProxy__computeOrderFeesResult> {
let result = super.tryCall(
'computeOrderFees',
'computeOrderFees(uint128,int128):(uint256,uint256)',
[ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromSignedBigInt(sizeDelta)]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
return ethereum.CallResult.fromValue(
new PerpsMarketProxy__computeOrderFeesResult(value[0].toBigInt(), value[1].toBigInt())
);
}

getOrder(accountId: BigInt): PerpsMarketProxy__getOrderResultOrderStruct {
Expand Down Expand Up @@ -2245,6 +2342,41 @@ export class PerpsMarketProxy extends ethereum.SmartContract {
);
}

requiredMarginForOrder(accountId: BigInt, marketId: BigInt, sizeDelta: BigInt): BigInt {
let result = super.call(
'requiredMarginForOrder',
'requiredMarginForOrder(uint128,uint128,int128):(uint256)',
[
ethereum.Value.fromUnsignedBigInt(accountId),
ethereum.Value.fromUnsignedBigInt(marketId),
ethereum.Value.fromSignedBigInt(sizeDelta),
]
);

return result[0].toBigInt();
}

try_requiredMarginForOrder(
accountId: BigInt,
marketId: BigInt,
sizeDelta: BigInt
): ethereum.CallResult<BigInt> {
let result = super.tryCall(
'requiredMarginForOrder',
'requiredMarginForOrder(uint128,uint128,int128):(uint256)',
[
ethereum.Value.fromUnsignedBigInt(accountId),
ethereum.Value.fromUnsignedBigInt(marketId),
ethereum.Value.fromSignedBigInt(sizeDelta),
]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

PRECISION(): BigInt {
let result = super.call('PRECISION', 'PRECISION():(int256)', []);

Expand Down Expand Up @@ -2603,6 +2735,21 @@ export class PerpsMarketProxy extends ethereum.SmartContract {
);
}

getMarkets(): Array<BigInt> {
let result = super.call('getMarkets', 'getMarkets():(uint256[])', []);

return result[0].toBigIntArray();
}

try_getMarkets(): ethereum.CallResult<Array<BigInt>> {
let result = super.tryCall('getMarkets', 'getMarkets():(uint256[])', []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigIntArray());
}

getMaxCollateralAmount(synthMarketId: BigInt): BigInt {
let result = super.call('getMaxCollateralAmount', 'getMaxCollateralAmount(uint128):(uint256)', [
ethereum.Value.fromUnsignedBigInt(synthMarketId),
Expand Down
Loading

0 comments on commit b95e9d8

Please sign in to comment.