From 593d2de548082a8c967df7152548ea269bfc0087 Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Tue, 23 Jan 2024 21:50:41 -0500 Subject: [PATCH 1/4] stats contract --- src/precompiles/ArbMathStats.sol | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/precompiles/ArbMathStats.sol diff --git a/src/precompiles/ArbMathStats.sol b/src/precompiles/ArbMathStats.sol new file mode 100644 index 00000000..f6082685 --- /dev/null +++ b/src/precompiles/ArbMathStats.sol @@ -0,0 +1,16 @@ +// Copyright 2021-2022, Offchain Labs, Inc. +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity >=0.4.21 <0.9.0; + +/// @title Statistics +/// @notice This contract is used to compute statistics. +/// This custom contract will set on 0x000000000000000000000000000000000000011b since we set it in precompile.go. +interface ArbMathStats { + /** + * @notice Returns the standard deviation of input + * @return stddev represented as an int, with the given number of decimals taken + */ + function stdDev(int32[] memory input, uint8 decimals) external returns (int256); +} \ No newline at end of file From e0af289d1ea0cdd045285979156759d5d32f8f5d Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Tue, 23 Jan 2024 21:52:48 -0500 Subject: [PATCH 2/4] name --- src/precompiles/ArbMathStats.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/ArbMathStats.sol b/src/precompiles/ArbMathStats.sol index f6082685..6c00e4b2 100644 --- a/src/precompiles/ArbMathStats.sol +++ b/src/precompiles/ArbMathStats.sol @@ -12,5 +12,5 @@ interface ArbMathStats { * @notice Returns the standard deviation of input * @return stddev represented as an int, with the given number of decimals taken */ - function stdDev(int32[] memory input, uint8 decimals) external returns (int256); + function stdDev(int32[] memory input, uint8 returnDecimals) external returns (int256); } \ No newline at end of file From b79b69eccb156c12de8f1d92b252395d2a5788ad Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Tue, 23 Jan 2024 21:54:11 -0500 Subject: [PATCH 3/4] comment --- src/precompiles/ArbMathStats.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/ArbMathStats.sol b/src/precompiles/ArbMathStats.sol index 6c00e4b2..1aa16a3c 100644 --- a/src/precompiles/ArbMathStats.sol +++ b/src/precompiles/ArbMathStats.sol @@ -10,7 +10,7 @@ pragma solidity >=0.4.21 <0.9.0; interface ArbMathStats { /** * @notice Returns the standard deviation of input - * @return stddev represented as an int, with the given number of decimals taken + * @return stddev floating point number represented as an int, with the given number of decimals taken */ function stdDev(int32[] memory input, uint8 returnDecimals) external returns (int256); } \ No newline at end of file From edaee9fc95101f002b6742ddbae712553cee70b9 Mon Sep 17 00:00:00 2001 From: Adam Balogh Date: Wed, 24 Jan 2024 09:02:01 -0500 Subject: [PATCH 4/4] pure --- src/precompiles/ArbMathStats.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/precompiles/ArbMathStats.sol b/src/precompiles/ArbMathStats.sol index 1aa16a3c..59fbed7b 100644 --- a/src/precompiles/ArbMathStats.sol +++ b/src/precompiles/ArbMathStats.sol @@ -12,5 +12,5 @@ interface ArbMathStats { * @notice Returns the standard deviation of input * @return stddev floating point number represented as an int, with the given number of decimals taken */ - function stdDev(int32[] memory input, uint8 returnDecimals) external returns (int256); + function stdDev(int32[] memory input, uint8 returnDecimals) external pure returns (int256); } \ No newline at end of file