Skip to content

Commit

Permalink
chore: remove smock library
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Feb 19, 2024
1 parent 5af14f8 commit 117a23a
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 585 deletions.
9 changes: 9 additions & 0 deletions contracts/Mocks/FallbackContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @dev sample contract used for testing
*/
contract FallbackContract {
fallback() external payable {}
}
11 changes: 11 additions & 0 deletions contracts/Mocks/FallbackExtensions/AgeExtension.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @dev This contract is used only for testing purposes
*/
contract AgeExtension {
function age() public view virtual returns (uint256) {
return 20;
}
}
11 changes: 11 additions & 0 deletions contracts/Mocks/FallbackExtensions/NameExtension.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @dev This contract is used only for testing purposes
*/
contract NameExtension {
function name() public view virtual returns (string memory) {
return "LUKSO";
}
}
30 changes: 30 additions & 0 deletions contracts/Mocks/LSP20Owners/BothCallReturnSuccessValue.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @title sample contract used for testing
*/
contract BothCallReturnSuccessValue {
function lsp20VerifyCall(
address /* requestor */,
address /* targetContract */,
address /* caller */,
uint256 /* value */,
bytes memory /* data */
) external pure returns (bytes4 magicValue) {
return
bytes4(
abi.encodePacked(
bytes3(BothCallReturnSuccessValue.lsp20VerifyCall.selector),
hex"01"
)
);
}

function lsp20VerifyCallResult(
bytes32 /*callHash*/,
bytes memory /*result*/
) external pure returns (bytes4) {
return BothCallReturnSuccessValue.lsp20VerifyCallResult.selector;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
/**
* @title sample contract used for testing
*/
contract FirstCallReturnExpandedFailValue {
contract FirstCallReturnExpandedInvalidValue {
event CallVerified();

address public target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
/**
* @title sample contract used for testing
*/
contract FirstCallReturnFailValue {
contract FirstCallReturnInvalidValue {
event CallVerified();

address public target;

function lsp20VerifyCall(
address,
address,
address,
uint256,
bytes memory
address /* requestor */,
address /* targetContract */,
address /* caller */,
uint256 /* value */,
bytes memory /* data */
) external returns (bytes4) {
emit CallVerified();

Expand Down
35 changes: 35 additions & 0 deletions contracts/Mocks/LSP20Owners/FirstCallReturnSuccessValue.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @title sample contract used for testing
*/
contract FirstCallReturnSuccessValue {
function lsp20VerifyCall(
address /* requestor */,
address /* targetContract */,
address /* caller */,
uint256 /* value */,
bytes memory /* data */
) external pure returns (bytes4 magicValue) {
return
bytes4(
abi.encodePacked(
bytes3(
FirstCallReturnSuccessValue.lsp20VerifyCall.selector
),
hex"00"
)
);
}

/**
* @dev should not be called
*/
function lsp20VerifyCallResult(
bytes32 /*callHash*/,
bytes memory /*result*/
) external pure returns (bytes4) {
revert("This revert will not be triggered");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @title sample contract used for testing
*/
contract SecondCallReturnExpandedSuccessValue {
function lsp20VerifyCall(
address /* requestor */,
address /* targetContract */,
address /* caller */,
uint256 /* value */,
bytes memory /* data */
) external pure returns (bytes4 magicValue) {
return
bytes4(
abi.encodePacked(
bytes3(
SecondCallReturnExpandedSuccessValue
.lsp20VerifyCall
.selector
),
hex"01"
)
);
}

function lsp20VerifyCallResult(
bytes32 /*callHash*/,
bytes memory /*result*/
) external pure returns (bytes32) {
return
bytes32(
bytes.concat(
bytes4(
SecondCallReturnExpandedSuccessValue
.lsp20VerifyCallResult
.selector
)
)
);
}
}
32 changes: 32 additions & 0 deletions contracts/Mocks/LSP20Owners/SecondCallReturnFailureValue.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

/**
* @title sample contract used for testing
*/
contract SecondCallReturnFailureValue {
function lsp20VerifyCall(
address /* requestor */,
address /* targetContract */,
address /* caller */,
uint256 /* value */,
bytes memory /* data */
) external pure returns (bytes4 magicValue) {
return
bytes4(
abi.encodePacked(
bytes3(
SecondCallReturnFailureValue.lsp20VerifyCall.selector
),
hex"01"
)
);
}

function lsp20VerifyCallResult(
bytes32 /*callHash*/,
bytes memory /*result*/
) external pure returns (bytes4) {
return bytes4(0);
}
}
Loading

0 comments on commit 117a23a

Please sign in to comment.