Skip to content

Commit

Permalink
#5 Batch 27
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-eshghie committed Sep 4, 2024
1 parent 9462223 commit e34e606
Show file tree
Hide file tree
Showing 803 changed files with 491,183 additions and 0 deletions.
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/BOR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length <= 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/DLR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates storage) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/ETR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).call(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/FVR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) public view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/ILR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 31 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/RSD/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("symbol()")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
/* return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
}); */
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
54 changes: 54 additions & 0 deletions contracts/mutants/AmmReader/1/SLR/AmmReader.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;

import { Amm } from "./Amm.sol";
import { Decimal } from "./utils/MixedDecimal.sol";

contract AmmReader {
using Decimal for Decimal.decimal;
struct AmmStates {
uint256 quoteAssetReserve;
uint256 baseAssetReserve;
uint256 tradeLimitRatio;
uint256 fundingPeriod;
string quoteAssetSymbol;
string baseAssetSymbol;
bytes32 priceFeedKey;
address priceFeed;
}

function getAmmStates(address _amm) external view returns (AmmStates memory) {
Amm amm = Amm(_amm);
(bool getSymbolSuccess, bytes memory quoteAssetSymbolData) = address(amm.quoteAsset()).staticcall(
abi.encodeWithSignature("")
);
(Decimal.decimal memory quoteAssetReserve, Decimal.decimal memory baseAssetReserve) = amm.getReserve();

bytes32 priceFeedKey = amm.priceFeedKey();
return
AmmStates({
quoteAssetReserve: quoteAssetReserve.toUint(),
baseAssetReserve: baseAssetReserve.toUint(),
tradeLimitRatio: amm.tradeLimitRatio(),
fundingPeriod: amm.fundingPeriod(),
priceFeed: address(amm.priceFeed()),
priceFeedKey: priceFeedKey,
quoteAssetSymbol: getSymbolSuccess ? abi.decode(quoteAssetSymbolData, (string)) : "",
baseAssetSymbol: bytes32ToString(priceFeedKey)
});
}

// TODO: move to library
function bytes32ToString(bytes32 _key) private pure returns (string memory) {
uint8 length;
while (length < 32 && _key[length] != 0) {
length++;
}
bytes memory bytesArray = new bytes(length);
for (uint256 i = 0; i < 32 && _key[i] != 0; i++) {
bytesArray[i] = _key[i];
}
return string(bytesArray);
}
}
Loading

0 comments on commit e34e606

Please sign in to comment.