Skip to content

Commit

Permalink
chore(all): update to MIT license (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
d1onys1us committed Nov 30, 2022
1 parent 4ef4df4 commit 69e9362
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 431 deletions.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright 2022 Taiko Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 changes: 5 additions & 5 deletions packages/protocol/contracts/libs/LibAnchorSignature.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ╱╱┃┃┃╭╮┃┃╭╮┫╰╯┃┃╰━╯┃╭╮┃╰╯┣━━┃
// ╱╱╰╯╰╯╰┻┻╯╰┻━━╯╰━━━┻╯╰┻━━┻━━╯
pragma solidity ^0.8.9;
import "../thirdparty/LibUint512.sol";
import "./LibUint512Math.sol";

/// @author david <david@taiko.xyz>
library LibAnchorSignature {
Expand All @@ -32,7 +32,7 @@ library LibAnchorSignature {
// (
// uint256 GX_MUL_GOLDEN_TOUCH_PRIVATEKEY_LOW,
// uint256 GX_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH
// ) = Uint512.mul256x256(GX, TAIKO_GOLDEN_TOUCH_PRIVATEKEY);
// ) = LibUint512Math.mul(GX, TAIKO_GOLDEN_TOUCH_PRIVATEKEY);
uint256 public constant GX_MUL_GOLDEN_TOUCH_PRIVATEKEY_LOW =
0xb4a95509ce05fe8d45987859a067780d16a367c0e2cacf79cd301b93fb717940;
uint256 public constant GX_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH =
Expand All @@ -41,7 +41,7 @@ library LibAnchorSignature {
// (
// uint256 GX2_MUL_GOLDEN_TOUCH_PRIVATEKEY_LOW,
// uint256 GX2_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH
// ) = Uint512.mul256x256(GX2, TAIKO_GOLDEN_TOUCH_PRIVATEKEY);
// ) = LibUint512Math.mul(GX2, TAIKO_GOLDEN_TOUCH_PRIVATEKEY);
uint256 public constant GX2_MUL_GOLDEN_TOUCH_PRIVATEKEY_LOW =
0xad77eceea844778cb4376153fc8f06f12f1695df4585bf75bfb17ec19ce90818;
uint256 public constant GX2_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH =
Expand All @@ -67,7 +67,7 @@ library LibAnchorSignature {
? GX_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH
: GX2_MUL_GOLDEN_TOUCH_PRIVATEKEY_HIGH;

(low256, high256) = Uint512.add512x512(
(low256, high256) = LibUint512Math.add(
low256,
high256,
uint256(digest),
Expand All @@ -77,7 +77,7 @@ library LibAnchorSignature {
if (k == 1) {
s = expmod(low256, high256, 1, N);
} else {
(low256, high256) = Uint512.mul256x256(
(low256, high256) = LibUint512Math.mul(
K_2_INVM_N,
expmod(low256, high256, 1, N)
);
Expand Down
58 changes: 58 additions & 0 deletions packages/protocol/contracts/libs/LibUint512Math.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: MIT
// The MIT License (MIT)

// Copyright (c) 2021 Remco Bloemen
// Copyright (c) 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

library LibUint512Math {
/**
* Optimized full 512 bit multiplication in Solidity.
* Taken from: https://xn--2-umb.com/17/full-mul/index.html
*/
function mul(
uint256 a,
uint256 b
) internal pure returns (uint256 r0, uint256 r1) {
assembly {
let mm := mulmod(a, b, not(0))
r0 := mul(a, b)
r1 := sub(sub(mm, r0), lt(mm, r0))
}
}

/**
* Simple 512-bit addition.
* Taken from: https://xn--2-umb.com/17/512-bit-division/#add-subtract-two-512-bit-numbers
*/
function add(
uint256 a0,
uint256 a1,
uint256 b0,
uint256 b1
) internal pure returns (uint256 r0, uint256 r1) {
assembly {
r0 := add(a0, b0)
r1 := add(add(a1, b1), lt(r0, a0))
}
}
}
22 changes: 22 additions & 0 deletions packages/protocol/contracts/thirdparty/AddressManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,29 @@
// - `Ownable.sol` modified to `OwnableUpgradeable.sol`
// - `init()` added to initialize
// - `setAddress` modified to `addAddress` to conform to ABI of `IAddressManager.sol`
// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/* External Imports */
Expand Down
34 changes: 27 additions & 7 deletions packages/protocol/contracts/thirdparty/ERC20Upgradeable.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)

/*
This file is copied from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol" with the following modifications:
1. decimals can be customized
2. `Transfer` events are not emitted from _mint and _burn.
*/
// This file is copied from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"
// with the following modifications:
// - decimals can be customized
// - `Transfer` events are not emitted from _mint and _burn.
// The MIT License (MIT)

// Copyright (c) 2016-2022 zOS Global Limited and contributors
// Copyright (c) 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/privacy-scaling-explorations/zkevm-chain/blob/master/contracts/ZkEvmL2MessageDeliverer.sol#L23
/* solhint-disable */
// NOTE: No MIT license provided at the time, only SPDX-License-Identifier
pragma solidity ^0.8.9;

/**
Expand Down
24 changes: 23 additions & 1 deletion packages/protocol/contracts/thirdparty/LibBytesUtils.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/utils/LibBytesUtils.sol

// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/**
Expand Down
24 changes: 23 additions & 1 deletion packages/protocol/contracts/thirdparty/LibMerkleTrie.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/trie/LibMerkleTrie.sol

// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/* Library Imports */
Expand Down
24 changes: 23 additions & 1 deletion packages/protocol/contracts/thirdparty/LibRLPReader.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/rlp/LibRLPReader.sol

// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/**
Expand Down
24 changes: 23 additions & 1 deletion packages/protocol/contracts/thirdparty/LibRLPWriter.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/rlp/LibRLPWriter.sol
// Modified to support writeBytes32/writeUint64

// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/**
Expand Down
23 changes: 23 additions & 0 deletions packages/protocol/contracts/thirdparty/LibSecureMerkleTrie.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
// SPDX-License-Identifier: MIT
// Taken from https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/trie/LibSecureMerkleTrie.sol
// (The MIT License)

// Copyright 2020-2021 Optimism
// Copyright 2022 Taiko Labs

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:

// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.9;

/* Library Imports */
Expand Down
Loading

0 comments on commit 69e9362

Please sign in to comment.