mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-07 21:34:05 -05:00
fix contract semver (#410)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "solhint:recommended",
|
"extends": "solhint:recommended",
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"compiler-version": ["error","^0.8.0"],
|
||||||
"func-visibility": ["warn",{"ignoreConstructors":true}],
|
"func-visibility": ["warn",{"ignoreConstructors":true}],
|
||||||
"reason-string": ["warn",{"maxLength":64}],
|
"reason-string": ["warn",{"maxLength":64}],
|
||||||
"no-inline-assembly": "off",
|
"no-inline-assembly": "off",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ func StagenetConfig() *Config {
|
|||||||
Port: 38081,
|
Port: 38081,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SwapCreatorAddr: ethcommon.HexToAddress("0x55D20fF84815795CED5efF61168f5258274A3f87"),
|
SwapCreatorAddr: ethcommon.HexToAddress("0xAFEAB9DBD7977c101A71E57dFA36450F2f1A5E9F"),
|
||||||
ForwarderAddr: ethcommon.HexToAddress("0xa030E074b8398005a454CB7c51E9b7CDb966744a"),
|
ForwarderAddr: ethcommon.HexToAddress("0xa030E074b8398005a454CB7c51E9b7CDb966744a"),
|
||||||
Bootnodes: []string{
|
Bootnodes: []string{
|
||||||
"/ip4/134.122.115.208/tcp/9900/p2p/12D3KooWDqCzbjexHEa8Rut7bzxHFpRMZyDRW1L6TGkL1KY24JH5",
|
"/ip4/134.122.115.208/tcp/9900/p2p/12D3KooWDqCzbjexHEa8Rut7bzxHFpRMZyDRW1L6TGkL1KY24JH5",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity 0.8.19 .0;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Contract comes from here:
|
// Contract comes from here:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
|
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
|
||||||
|
|
||||||
pragma solidity 0.8.19 .0;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Provides information about the current execution context, including the
|
* @dev Provides information about the current execution context, including the
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
|
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
|
||||||
|
|
||||||
pragma solidity ^0.8.0 .0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
import {IERC20} from "./IERC20.sol";
|
import {IERC20} from "./IERC20.sol";
|
||||||
import {IERC20Metadata} from "./IERC20Metadata.sol";
|
import {IERC20Metadata} from "./IERC20Metadata.sol";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol)
|
// OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol)
|
||||||
|
|
||||||
pragma solidity 0.8.19 .0;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
import {Context} from "./Context.sol";
|
import {Context} from "./Context.sol";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
|
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
|
||||||
|
|
||||||
pragma solidity ^0.8.0 .0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Interface of the ERC20 standard as defined in the EIP.
|
* @dev Interface of the ERC20 standard as defined in the EIP.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
|
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
|
||||||
|
|
||||||
pragma solidity ^0.8.0 .0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
import {IERC20} from "./IERC20.sol";
|
import {IERC20} from "./IERC20.sol";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Implemention based on Vitalik's idea:
|
// Implemention based on Vitalik's idea:
|
||||||
// https://ethresear.ch/t/you-can-kinda-abuse-ecrecover-to-do-ecmul-in-secp256k1-today
|
// https://ethresear.ch/t/you-can-kinda-abuse-ecrecover-to-do-ecmul-in-secp256k1-today
|
||||||
|
|
||||||
pragma solidity 0.8.19 .0;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
contract Secp256k1 {
|
contract Secp256k1 {
|
||||||
// solhint-disable-next-line
|
// solhint-disable-next-line
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: LGPLv3
|
// SPDX-License-Identifier: LGPLv3
|
||||||
pragma solidity 0.8.19 .0;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
import {ERC2771Context} from "./ERC2771Context.sol";
|
import {ERC2771Context} from "./ERC2771Context.sol";
|
||||||
import {IERC20} from "./IERC20.sol";
|
import {IERC20} from "./IERC20.sol";
|
||||||
@@ -31,11 +31,11 @@ contract SwapCreator is ERC2771Context, Secp256k1 {
|
|||||||
bytes32 pubKeyRefund;
|
bytes32 pubKeyRefund;
|
||||||
// timestamp before which Alice can call either `setReady` or `refund`
|
// timestamp before which Alice can call either `setReady` or `refund`
|
||||||
uint256 timeout0;
|
uint256 timeout0;
|
||||||
// timestamp after which Bob cannot claim, only Alice can refund.
|
// timestamp after which Bob cannot claim, only Alice can refund
|
||||||
uint256 timeout1;
|
uint256 timeout1;
|
||||||
// the asset being swapped: equal to address(0) for ETH, or an ERC-20 token address
|
// the asset being swapped: equal to address(0) for ETH, or an ERC-20 token address
|
||||||
address asset;
|
address asset;
|
||||||
// the value of this swap.
|
// the value of this swap
|
||||||
uint256 value;
|
uint256 value;
|
||||||
// choose random
|
// choose random
|
||||||
uint256 nonce;
|
uint256 nonce;
|
||||||
@@ -186,7 +186,7 @@ contract SwapCreator is ERC2771Context, Secp256k1 {
|
|||||||
// TODO: this will FAIL for fee-on-transfer or rebasing tokens if the token
|
// TODO: this will FAIL for fee-on-transfer or rebasing tokens if the token
|
||||||
// transfer reverts (i.e. if this contract does not contain _swap.value tokens),
|
// transfer reverts (i.e. if this contract does not contain _swap.value tokens),
|
||||||
// exposing Bob's secret while giving him nothing
|
// exposing Bob's secret while giving him nothing
|
||||||
|
//
|
||||||
// potential solution: wrap tokens into shares instead of absolute values
|
// potential solution: wrap tokens into shares instead of absolute values
|
||||||
// swap.value would then contain the share of the token
|
// swap.value would then contain the share of the token
|
||||||
IERC20(_swap.asset).transfer(_swap.claimer, _swap.value);
|
IERC20(_swap.asset).transfer(_swap.claimer, _swap.value);
|
||||||
@@ -211,7 +211,7 @@ contract SwapCreator is ERC2771Context, Secp256k1 {
|
|||||||
// TODO: this will FAIL for fee-on-transfer or rebasing tokens if the token
|
// TODO: this will FAIL for fee-on-transfer or rebasing tokens if the token
|
||||||
// transfer reverts (i.e. if this contract does not contain _swap.value tokens),
|
// transfer reverts (i.e. if this contract does not contain _swap.value tokens),
|
||||||
// exposing Bob's secret while giving him nothing
|
// exposing Bob's secret while giving him nothing
|
||||||
|
//
|
||||||
// potential solution: wrap tokens into shares instead of absolute values
|
// potential solution: wrap tokens into shares instead of absolute values
|
||||||
// swap.value would then contain the share of the token
|
// swap.value would then contain the share of the token
|
||||||
IERC20(_swap.asset).transfer(_swap.claimer, _swap.value - fee);
|
IERC20(_swap.asset).transfer(_swap.claimer, _swap.value - fee);
|
||||||
@@ -250,7 +250,7 @@ contract SwapCreator is ERC2771Context, Secp256k1 {
|
|||||||
verifySecret(_s, _swap.pubKeyRefund);
|
verifySecret(_s, _swap.pubKeyRefund);
|
||||||
emit Refunded(swapID, _s);
|
emit Refunded(swapID, _s);
|
||||||
|
|
||||||
// send asset back to owner==caller (Alice)
|
// send asset back to swap owner
|
||||||
swaps[swapID] = Stage.COMPLETED;
|
swaps[swapID] = Stage.COMPLETED;
|
||||||
if (_swap.asset == address(0)) {
|
if (_swap.asset == address(0)) {
|
||||||
_swap.owner.transfer(_swap.value);
|
_swap.owner.transfer(_swap.value);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
pragma solidity ^0.8.0 .0;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
import {ERC20} from "./ERC20.sol";
|
import {ERC20} from "./ERC20.sol";
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user