Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
de7d5f6e
Unverified
Commit
de7d5f6e
authored
Jun 24, 2023
by
Mark Tyneway
Committed by
GitHub
Jun 24, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into ctb/optimize-spacer-check
parents
54a3e562
1c00dcbc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
90 deletions
+31
-90
config.yml
.circleci/config.yml
+0
-8
TransferOnion.sol
...s/contracts-bedrock/contracts/periphery/TransferOnion.sol
+16
-29
L1StandardBridge.t.sol
...s/contracts-bedrock/contracts/test/L1StandardBridge.t.sol
+1
-1
TransferOnion.t.sol
...ages/contracts-bedrock/contracts/test/TransferOnion.t.sol
+14
-31
check-op-node.ts
packages/contracts-bedrock/tasks/check-op-node.ts
+0
-20
index.ts
packages/contracts-bedrock/tasks/index.ts
+0
-1
No files found.
.circleci/config.yml
View file @
de7d5f6e
...
@@ -871,10 +871,6 @@ jobs:
...
@@ -871,10 +871,6 @@ jobs:
name
:
Deposit ETH through the bridge
name
:
Deposit ETH through the bridge
command
:
timeout 8m npx hardhat deposit-eth --network devnetL1 --l1-contracts-json-path ../../.devnet/sdk-addresses.json
command
:
timeout 8m npx hardhat deposit-eth --network devnetL1 --l1-contracts-json-path ../../.devnet/sdk-addresses.json
working_directory
:
packages/sdk
working_directory
:
packages/sdk
-
run
:
name
:
Check the status
command
:
npx hardhat check-op-node
working_directory
:
packages/contracts-bedrock
-
run
:
-
run
:
name
:
Dump op-node logs
name
:
Dump op-node logs
command
:
|
command
:
|
...
@@ -926,10 +922,6 @@ jobs:
...
@@ -926,10 +922,6 @@ jobs:
name
:
Deposit ETH through the bridge
name
:
Deposit ETH through the bridge
command
:
timeout 10m npx hardhat deposit-eth --network devnetL1
command
:
timeout 10m npx hardhat deposit-eth --network devnetL1
working_directory
:
packages/sdk
working_directory
:
packages/sdk
-
run
:
name
:
Check the status
command
:
npx hardhat check-op-node
working_directory
:
packages/contracts-bedrock
-
run
:
-
run
:
name
:
Dump op-node logs
name
:
Dump op-node logs
command
:
|
command
:
|
...
...
packages/contracts-bedrock/contracts/periphery/TransferOnion.sol
View file @
de7d5f6e
...
@@ -5,45 +5,34 @@ import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuar
...
@@ -5,45 +5,34 @@ import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuar
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
/// @title TransferOnion
* @title TransferOnion
/// @notice TransferOnion is a hash onion for distributing tokens. The shell commits
* @notice TransferOnion is a hash onion for distributing tokens. The shell commits
/// to an ordered list of the token transfers and can be permissionlessly
* to an ordered list of the token transfers and can be permissionlessly
/// unwrapped in order. The SENDER must `approve` this contract as
* unwrapped in order. The SENDER must `approve` this contract as
/// `transferFrom` is used to move the token balances.
* `transferFrom` is used to move the token balances.
*/
contract TransferOnion is ReentrancyGuard {
contract TransferOnion is ReentrancyGuard {
using SafeERC20 for ERC20;
using SafeERC20 for ERC20;
/**
/// @notice Struct representing a layer of the onion.
* @notice Struct representing a layer of the onion.
*/
struct Layer {
struct Layer {
address recipient;
address recipient;
uint256 amount;
uint256 amount;
bytes32 shell;
bytes32 shell;
}
}
/**
/// @notice Address of the token to distribute.
* @notice Address of the token to distribute.
*/
ERC20 public immutable TOKEN;
ERC20 public immutable TOKEN;
/**
/// @notice Address of the account to distribute tokens from.
* @notice Address of the account to distribute tokens from.
*/
address public immutable SENDER;
address public immutable SENDER;
/**
/// @notice Current shell hash.
* @notice Current shell hash.
*/
bytes32 public shell;
bytes32 public shell;
/**
/// @notice Constructs a new TransferOnion.
* @param _token Address of the token to distribute.
/// @param _token Address of the token to distribute.
* @param _sender Address of the sender to distribute from.
/// @param _sender Address of the sender to distribute from.
* @param _shell Initial shell of the onion.
/// @param _shell Initial shell of the onion.
*/
constructor(
constructor(
ERC20 _token,
ERC20 _token,
address _sender,
address _sender,
...
@@ -54,11 +43,8 @@ contract TransferOnion is ReentrancyGuard {
...
@@ -54,11 +43,8 @@ contract TransferOnion is ReentrancyGuard {
shell = _shell;
shell = _shell;
}
}
/**
/// @notice Peels layers from the onion and distributes tokens.
* @notice Peels layers from the onion and distributes tokens.
/// @param _layers Array of onion layers to peel.
*
* @param _layers Array of onion layers to peel.
*/
function peel(Layer[] memory _layers) public nonReentrant {
function peel(Layer[] memory _layers) public nonReentrant {
bytes32 tempShell = shell;
bytes32 tempShell = shell;
uint256 length = _layers.length;
uint256 length = _layers.length;
...
@@ -75,6 +61,7 @@ contract TransferOnion is ReentrancyGuard {
...
@@ -75,6 +61,7 @@ contract TransferOnion is ReentrancyGuard {
tempShell = layer.shell;
tempShell = layer.shell;
// Transfer the tokens.
// Transfer the tokens.
// slither-disable-next-line arbitrary-send-erc20
TOKEN.safeTransferFrom(SENDER, layer.recipient, layer.amount);
TOKEN.safeTransferFrom(SENDER, layer.recipient, layer.amount);
// Unchecked increment to save some gas.
// Unchecked increment to save some gas.
...
...
packages/contracts-bedrock/contracts/test/L1StandardBridge.t.sol
View file @
de7d5f6e
...
@@ -20,7 +20,7 @@ import { OptimismPortal } from "../L1/OptimismPortal.sol";
...
@@ -20,7 +20,7 @@ import { OptimismPortal } from "../L1/OptimismPortal.sol";
contract L1StandardBridge_Getter_Test is Bridge_Initializer {
contract L1StandardBridge_Getter_Test is Bridge_Initializer {
/// @dev Test that the accessors return the correct initialized values.
/// @dev Test that the accessors return the correct initialized values.
function test_getters_succeeds() external {
function test_getters_succeeds() external
view
{
assert(L1Bridge.l2TokenBridge() == address(L2Bridge));
assert(L1Bridge.l2TokenBridge() == address(L2Bridge));
assert(L1Bridge.OTHER_BRIDGE() == L2Bridge);
assert(L1Bridge.OTHER_BRIDGE() == L2Bridge);
assert(L1Bridge.messenger() == L1Messenger);
assert(L1Bridge.messenger() == L1Messenger);
...
...
packages/contracts-bedrock/contracts/test/TransferOnion.t.sol
View file @
de7d5f6e
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { Test } from "forge-std/Test.sol";
import { Test } from "forge-std/Test.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Target contract
import { TransferOnion } from "../periphery/TransferOnion.sol";
import { TransferOnion } from "../periphery/TransferOnion.sol";
/**
/// @title TransferOnionTest
* @title TransferOnionTest
/// @notice Test coverage of TransferOnion
* @notice Test coverage of TransferOnion
*/
contract TransferOnionTest is Test {
contract TransferOnionTest is Test {
/**
/// @notice TransferOnion
* @notice TransferOnion
*/
TransferOnion internal onion;
TransferOnion internal onion;
/**
/// @notice Token constructor argument
* @notice token constructor arg
*/
address internal _token;
address internal _token;
/**
/// @notice Sender constructor argument
* @notice sender constructor arg
*/
address internal _sender;
address internal _sender;
/**
/// @notice Sets up addresses, deploys contracts and funds the owner.
* @notice Sets up addresses, deploys contracts and funds the owner.
*/
function setUp() public {
function setUp() public {
ERC20 token = new ERC20("Token", "TKN");
ERC20 token = new ERC20("Token", "TKN");
_token = address(token);
_token = address(token);
_sender = makeAddr("sender");
_sender = makeAddr("sender");
}
}
/**
/// @notice Deploy the TransferOnion with a dummy shell.
* @notice Deploy the TransferOnion with a dummy shell
*/
function _deploy() public {
function _deploy() public {
_deploy(bytes32(0));
_deploy(bytes32(0));
}
}
/**
/// @notice Deploy the TransferOnion with a specific shell.
* @notice Deploy the TransferOnion with a specific shell
*/
function _deploy(bytes32 _shell) public {
function _deploy(bytes32 _shell) public {
onion = new TransferOnion({ _token: ERC20(_token), _sender: _sender, _shell: _shell });
onion = new TransferOnion({ _token: ERC20(_token), _sender: _sender, _shell: _shell });
}
}
/**
/// @notice Build the onion data.
* @notice Build the onion data
*/
function _onionize(TransferOnion.Layer[] memory _layers)
function _onionize(TransferOnion.Layer[] memory _layers)
public
public
pure
pure
...
@@ -66,9 +53,7 @@ contract TransferOnionTest is Test {
...
@@ -66,9 +53,7 @@ contract TransferOnionTest is Test {
return (hash, _layers);
return (hash, _layers);
}
}
/**
/// @notice The constructor sets the variables as expected.
* @notice The constructor sets the variables as expected
*/
function test_constructor_succeeds() external {
function test_constructor_succeeds() external {
_deploy();
_deploy();
...
@@ -77,9 +62,7 @@ contract TransferOnionTest is Test {
...
@@ -77,9 +62,7 @@ contract TransferOnionTest is Test {
assertEq(onion.shell(), bytes32(0));
assertEq(onion.shell(), bytes32(0));
}
}
/**
/// @notice Tests unwrapping the onion.
* @notice unwrap
*/
function test_unwrap_succeeds() external {
function test_unwrap_succeeds() external {
// Commit to transferring tiny amounts of tokens
// Commit to transferring tiny amounts of tokens
TransferOnion.Layer[] memory _layers = new TransferOnion.Layer[](2);
TransferOnion.Layer[] memory _layers = new TransferOnion.Layer[](2);
...
...
packages/contracts-bedrock/tasks/check-op-node.ts
deleted
100644 → 0
View file @
54a3e562
import
{
task
,
types
}
from
'
hardhat/config
'
import
{
OpNodeProvider
}
from
'
@eth-optimism/core-utils
'
// TODO(tynes): add in config validation
task
(
'
check-op-node
'
,
'
Validate the config of the op-node
'
)
.
addParam
(
'
opNodeUrl
'
,
'
URL of the OP Node.
'
,
'
http://localhost:7545
'
,
types
.
string
)
.
setAction
(
async
(
args
)
=>
{
const
provider
=
new
OpNodeProvider
(
args
.
opNodeUrl
)
const
syncStatus
=
await
provider
.
syncStatus
()
console
.
log
(
JSON
.
stringify
(
syncStatus
,
null
,
2
))
const
config
=
await
provider
.
rollupConfig
()
console
.
log
(
JSON
.
stringify
(
config
,
null
,
2
))
})
packages/contracts-bedrock/tasks/index.ts
View file @
de7d5f6e
import
'
./check-op-node
'
import
'
./solidity
'
import
'
./solidity
'
import
'
./check-l2
'
import
'
./check-l2
'
import
'
./generate-deploy-config
'
import
'
./generate-deploy-config
'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment