Skip to content

Commit

Permalink
Update artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Jan 21, 2025
1 parent a6e9dea commit 3388ea7
Show file tree
Hide file tree
Showing 13 changed files with 491 additions and 120 deletions.
5 changes: 3 additions & 2 deletions .project.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"fullNodeVersion": "v3.5.0",
"fullNodeVersion": "v3.11.2",
"compilerOptionsUsed": {
"ignoreUnusedConstantsWarnings": true,
"ignoreUnusedVariablesWarnings": false,
"ignoreUnusedFieldsWarnings": false,
"ignoreUnusedPrivateFunctionsWarnings": false,
"ignoreUpdateFieldsCheckWarnings": false,
"ignoreCheckExternalCallerWarnings": false,
"ignoreUnusedFunctionReturnWarnings": true
"ignoreUnusedFunctionReturnWarnings": true,
"skipAbstractContractCheck": false
},
"infos": {
"AddLiquidity": {
Expand Down
71 changes: 62 additions & 9 deletions artifacts/ts/ExampleOracleSimple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
callMethod,
multicallMethods,
fetchContractState,
Asset,
ContractInstance,
getContractEventsCurrentCount,
TestContractParamsWithoutMaps,
Expand All @@ -30,9 +31,10 @@ import {
signExecuteMethod,
addStdIdToFields,
encodeContractFields,
Narrow,
} from "@alephium/web3";
import { default as ExampleOracleSimpleContractJson } from "../examples/ExampleOracleSimple.ral.json";
import { getContractByCodeHash } from "./contracts";
import { getContractByCodeHash, registerContract } from "./contracts";

// Custom types for the contract
export namespace ExampleOracleSimpleTypes {
Expand Down Expand Up @@ -60,6 +62,10 @@ export namespace ExampleOracleSimpleTypes {
params: CallContractParams<{ numerator: bigint; denominator: bigint }>;
result: CallContractResult<bigint>;
};
currentCumulativePrices: {
params: CallContractParams<{ currentBlockTimeStamp: bigint }>;
result: CallContractResult<[bigint, bigint]>;
};
update: {
params: Omit<CallContractParams<{}>, "args">;
result: CallContractResult<null>;
Expand All @@ -81,10 +87,9 @@ export namespace ExampleOracleSimpleTypes {
? CallMethodTable[MaybeName]["result"]
: undefined;
};
export type MulticallReturnType<Callss extends MultiCallParams[]> =
Callss["length"] extends 1
? MultiCallResults<Callss[0]>
: { [index in keyof Callss]: MultiCallResults<Callss[index]> };
export type MulticallReturnType<Callss extends MultiCallParams[]> = {
[index in keyof Callss]: MultiCallResults<Callss[index]>;
};

export interface SignExecuteMethodTable {
fullMul: {
Expand All @@ -106,6 +111,12 @@ export namespace ExampleOracleSimpleTypes {
}>;
result: SignExecuteScriptTxResult;
};
currentCumulativePrices: {
params: SignExecuteContractMethodParams<{
currentBlockTimeStamp: bigint;
}>;
result: SignExecuteScriptTxResult;
};
update: {
params: Omit<SignExecuteContractMethodParams<{}>, "args">;
result: SignExecuteScriptTxResult;
Expand Down Expand Up @@ -207,6 +218,14 @@ class Factory extends ContractFactory<
return testMethod(this, "consult", params, getContractByCodeHash);
},
};

stateForTest(
initFields: ExampleOracleSimpleTypes.Fields,
asset?: Asset,
address?: string
) {
return this.stateForTest_(initFields, asset, address, undefined);
}
}

// Use this object to test and deploy the contract
Expand All @@ -218,6 +237,7 @@ export const ExampleOracleSimple = new Factory(
[]
)
);
registerContract(ExampleOracleSimple);

// Use this class to interact with the blockchain
export class ExampleOracleSimpleInstance extends ContractInstance {
Expand Down Expand Up @@ -263,6 +283,19 @@ export class ExampleOracleSimpleInstance extends ContractInstance {
getContractByCodeHash
);
},
currentCumulativePrices: async (
params: ExampleOracleSimpleTypes.CallMethodParams<"currentCumulativePrices">
): Promise<
ExampleOracleSimpleTypes.CallMethodResult<"currentCumulativePrices">
> => {
return callMethod(
ExampleOracleSimple,
this,
"currentCumulativePrices",
params,
getContractByCodeHash
);
},
update: async (
params?: ExampleOracleSimpleTypes.CallMethodParams<"update">
): Promise<ExampleOracleSimpleTypes.CallMethodResult<"update">> => {
Expand Down Expand Up @@ -305,6 +338,18 @@ export class ExampleOracleSimpleInstance extends ContractInstance {
> => {
return signExecuteMethod(ExampleOracleSimple, this, "fraction", params);
},
currentCumulativePrices: async (
params: ExampleOracleSimpleTypes.SignExecuteMethodParams<"currentCumulativePrices">
): Promise<
ExampleOracleSimpleTypes.SignExecuteMethodResult<"currentCumulativePrices">
> => {
return signExecuteMethod(
ExampleOracleSimple,
this,
"currentCumulativePrices",
params
);
},
update: async (
params: ExampleOracleSimpleTypes.SignExecuteMethodParams<"update">
): Promise<ExampleOracleSimpleTypes.SignExecuteMethodResult<"update">> => {
Expand All @@ -317,14 +362,22 @@ export class ExampleOracleSimpleInstance extends ContractInstance {
},
};

async multicall<Calls extends ExampleOracleSimpleTypes.MultiCallParams>(
calls: Calls
): Promise<ExampleOracleSimpleTypes.MultiCallResults<Calls>>;
async multicall<Callss extends ExampleOracleSimpleTypes.MultiCallParams[]>(
...callss: Callss
): Promise<ExampleOracleSimpleTypes.MulticallReturnType<Callss>> {
return (await multicallMethods(
callss: Narrow<Callss>
): Promise<ExampleOracleSimpleTypes.MulticallReturnType<Callss>>;
async multicall<
Callss extends
| ExampleOracleSimpleTypes.MultiCallParams
| ExampleOracleSimpleTypes.MultiCallParams[]
>(callss: Callss): Promise<unknown> {
return await multicallMethods(
ExampleOracleSimple,
this,
callss,
getContractByCodeHash
)) as ExampleOracleSimpleTypes.MulticallReturnType<Callss>;
);
}
}
36 changes: 27 additions & 9 deletions artifacts/ts/FeeCollectorFactoryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
callMethod,
multicallMethods,
fetchContractState,
Asset,
ContractInstance,
getContractEventsCurrentCount,
TestContractParamsWithoutMaps,
Expand All @@ -30,9 +31,10 @@ import {
signExecuteMethod,
addStdIdToFields,
encodeContractFields,
Narrow,
} from "@alephium/web3";
import { default as FeeCollectorFactoryImplContractJson } from "../examples/FeeCollectorFactoryImpl.ral.json";
import { getContractByCodeHash } from "./contracts";
import { getContractByCodeHash, registerContract } from "./contracts";

// Custom types for the contract
export namespace FeeCollectorFactoryImplTypes {
Expand Down Expand Up @@ -65,10 +67,9 @@ export namespace FeeCollectorFactoryImplTypes {
? CallMethodTable[MaybeName]["result"]
: undefined;
};
export type MulticallReturnType<Callss extends MultiCallParams[]> =
Callss["length"] extends 1
? MultiCallResults<Callss[0]>
: { [index in keyof Callss]: MultiCallResults<Callss[index]> };
export type MulticallReturnType<Callss extends MultiCallParams[]> = {
[index in keyof Callss]: MultiCallResults<Callss[index]>;
};

export interface SignExecuteMethodTable {
createFeeCollector: {
Expand Down Expand Up @@ -140,6 +141,14 @@ class Factory extends ContractFactory<
);
},
};

stateForTest(
initFields: FeeCollectorFactoryImplTypes.Fields,
asset?: Asset,
address?: string
) {
return this.stateForTest_(initFields, asset, address, undefined);
}
}

// Use this object to test and deploy the contract
Expand All @@ -151,6 +160,7 @@ export const FeeCollectorFactoryImpl = new Factory(
[]
)
);
registerContract(FeeCollectorFactoryImpl);

// Use this class to interact with the blockchain
export class FeeCollectorFactoryImplInstance extends ContractInstance {
Expand Down Expand Up @@ -193,16 +203,24 @@ export class FeeCollectorFactoryImplInstance extends ContractInstance {
},
};

async multicall<Calls extends FeeCollectorFactoryImplTypes.MultiCallParams>(
calls: Calls
): Promise<FeeCollectorFactoryImplTypes.MultiCallResults<Calls>>;
async multicall<
Callss extends FeeCollectorFactoryImplTypes.MultiCallParams[]
>(
...callss: Callss
): Promise<FeeCollectorFactoryImplTypes.MulticallReturnType<Callss>> {
return (await multicallMethods(
callss: Narrow<Callss>
): Promise<FeeCollectorFactoryImplTypes.MulticallReturnType<Callss>>;
async multicall<
Callss extends
| FeeCollectorFactoryImplTypes.MultiCallParams
| FeeCollectorFactoryImplTypes.MultiCallParams[]
>(callss: Callss): Promise<unknown> {
return await multicallMethods(
FeeCollectorFactoryImpl,
this,
callss,
getContractByCodeHash
)) as FeeCollectorFactoryImplTypes.MulticallReturnType<Callss>;
);
}
}
20 changes: 15 additions & 5 deletions artifacts/ts/FeeCollectorPerTokenPairImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
callMethod,
multicallMethods,
fetchContractState,
Asset,
ContractInstance,
getContractEventsCurrentCount,
TestContractParamsWithoutMaps,
Expand All @@ -30,9 +31,10 @@ import {
signExecuteMethod,
addStdIdToFields,
encodeContractFields,
Narrow,
} from "@alephium/web3";
import { default as FeeCollectorPerTokenPairImplContractJson } from "../examples/FeeCollectorPerTokenPairImpl.ral.json";
import { getContractByCodeHash } from "./contracts";
import { getContractByCodeHash, registerContract } from "./contracts";

// Custom types for the contract
export namespace FeeCollectorPerTokenPairImplTypes {
Expand Down Expand Up @@ -73,10 +75,9 @@ export namespace FeeCollectorPerTokenPairImplTypes {
? CallMethodTable[MaybeName]["result"]
: undefined;
};
export type MulticallReturnType<Callss extends MultiCallParams[]> =
Callss["length"] extends 1
? MultiCallResults<Callss[0]>
: { [index in keyof Callss]: MultiCallResults<Callss[index]> };
export type MulticallReturnType<Callss extends MultiCallParams[]> = {
[index in keyof Callss]: MultiCallResults<Callss[index]>;
};

export interface SignExecuteMethodTable {
collectFee: {
Expand Down Expand Up @@ -186,6 +187,14 @@ class Factory extends ContractFactory<
);
},
};

stateForTest(
initFields: FeeCollectorPerTokenPairImplTypes.Fields,
asset?: Asset,
address?: string
) {
return this.stateForTest_(initFields, asset, address, undefined);
}
}

// Use this object to test and deploy the contract
Expand All @@ -197,6 +206,7 @@ export const FeeCollectorPerTokenPairImpl = new Factory(
[]
)
);
registerContract(FeeCollectorPerTokenPairImpl);

// Use this class to interact with the blockchain
export class FeeCollectorPerTokenPairImplInstance extends ContractInstance {
Expand Down
32 changes: 23 additions & 9 deletions artifacts/ts/FullMathTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
callMethod,
multicallMethods,
fetchContractState,
Asset,
ContractInstance,
getContractEventsCurrentCount,
TestContractParamsWithoutMaps,
Expand All @@ -30,9 +31,10 @@ import {
signExecuteMethod,
addStdIdToFields,
encodeContractFields,
Narrow,
} from "@alephium/web3";
import { default as FullMathTestContractJson } from "../examples/FullMathTest.ral.json";
import { getContractByCodeHash } from "./contracts";
import { getContractByCodeHash, registerContract } from "./contracts";

// Custom types for the contract
export namespace FullMathTestTypes {
Expand Down Expand Up @@ -64,10 +66,9 @@ export namespace FullMathTestTypes {
? CallMethodTable[MaybeName]["result"]
: undefined;
};
export type MulticallReturnType<Callss extends MultiCallParams[]> =
Callss["length"] extends 1
? MultiCallResults<Callss[0]>
: { [index in keyof Callss]: MultiCallResults<Callss[index]> };
export type MulticallReturnType<Callss extends MultiCallParams[]> = {
[index in keyof Callss]: MultiCallResults<Callss[index]>;
};

export interface SignExecuteMethodTable {
fullMul: {
Expand Down Expand Up @@ -148,6 +149,10 @@ class Factory extends ContractFactory<FullMathTestInstance, {}> {
return testMethod(this, "fraction", params, getContractByCodeHash);
},
};

stateForTest(initFields: {}, asset?: Asset, address?: string) {
return this.stateForTest_(initFields, asset, address, undefined);
}
}

// Use this object to test and deploy the contract
Expand All @@ -159,6 +164,7 @@ export const FullMathTest = new Factory(
[]
)
);
registerContract(FullMathTest);

// Use this class to interact with the blockchain
export class FullMathTestInstance extends ContractInstance {
Expand Down Expand Up @@ -224,14 +230,22 @@ export class FullMathTestInstance extends ContractInstance {
},
};

async multicall<Calls extends FullMathTestTypes.MultiCallParams>(
calls: Calls
): Promise<FullMathTestTypes.MultiCallResults<Calls>>;
async multicall<Callss extends FullMathTestTypes.MultiCallParams[]>(
...callss: Callss
): Promise<FullMathTestTypes.MulticallReturnType<Callss>> {
return (await multicallMethods(
callss: Narrow<Callss>
): Promise<FullMathTestTypes.MulticallReturnType<Callss>>;
async multicall<
Callss extends
| FullMathTestTypes.MultiCallParams
| FullMathTestTypes.MultiCallParams[]
>(callss: Callss): Promise<unknown> {
return await multicallMethods(
FullMathTest,
this,
callss,
getContractByCodeHash
)) as FullMathTestTypes.MulticallReturnType<Callss>;
);
}
}
Loading

0 comments on commit 3388ea7

Please sign in to comment.