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
68b240cc
Commit
68b240cc
authored
Sep 23, 2020
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Light comments for proxy contracts
parent
b1c90b74
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
21 deletions
+70
-21
Proxy_Forwarder.sol
...s/contracts/optimistic-ethereum/proxy/Proxy_Forwarder.sol
+39
-21
Proxy_Manager.sol
...cts/contracts/optimistic-ethereum/proxy/Proxy_Manager.sol
+13
-0
Proxy_Resolver.sol
...ts/contracts/optimistic-ethereum/proxy/Proxy_Resolver.sol
+18
-0
No files found.
packages/contracts/contracts/optimistic-ethereum/proxy/Proxy_Forwarder.sol
View file @
68b240cc
...
...
@@ -8,49 +8,67 @@ import { Proxy_Manager } from "./Proxy_Manager.sol";
* @title Proxy_Forwarder
*/
contract Proxy_Forwarder {
/*******************************************
* Contract Variables: Contract References *
*******************************************/
Proxy_Manager private proxyManager;
/***************
* Constructor *
***************/
/**
* @param _proxyManager Address of the Proxy_Manager.
*/
constructor(
address _proxyManager
) {
proxyManager = Proxy_Manager(_proxyManager);
}
/********************
* Public Functions *
********************/
/**
* Forwards calls to the appropriate target.
*/
fallback()
external
{
address target = _getTarget();
bytes memory data = msg.data;
require(
target != address(0),
"Proxy does not have a target."
);
assembly {
let success := call(
gas(),
target,
0,
add(data, 0x20),
mload(data),
0,
0
)
let size := returndatasize()
let returndata := mload(0x40)
mstore(0x40, add(returndata, add(size, 0x20)))
returndatacopy(add(returndata, 0x20), 0, size)
if iszero(success) {
revert(add(returndata, 0x20), size)
}
(bool success, bytes memory returndata) = target.call(msg.data);
return(add(returndata, 0x20), size)
if (success == true) {
assembly {
return(add(returndata, 0x20), mload(returndata))
}
} else {
assembly {
revert(add(returndata, 0x20), mload(returndata))
}
}
}
/**********************
* Internal Functions *
**********************/
/**
* Determines the appropriate target.
* @return Target to forward requests to.
*/
function _getTarget()
internal
view
...
...
packages/contracts/contracts/optimistic-ethereum/proxy/Proxy_Manager.sol
View file @
68b240cc
...
...
@@ -5,12 +5,21 @@ pragma solidity ^0.7.0;
* @title Proxy_Manager
*/
contract Proxy_Manager {
/*******************************************
* Contract Variables: Internal Accounting *
*******************************************/
mapping (bytes32 => address) private proxyByName;
mapping (bytes32 => address) private targetByName;
mapping (address => bytes32) private nameByProxy;
mapping (address => bytes32) private nameByTarget;
/********************
* Public Functions *
********************/
function setProxy(
string memory _name,
address _proxy
...
...
@@ -152,6 +161,10 @@ contract Proxy_Manager {
}
/**********************
* Internal Functions *
**********************/
function _getNameHash(
string memory _name
)
...
...
packages/contracts/contracts/optimistic-ethereum/proxy/Proxy_Resolver.sol
View file @
68b240cc
...
...
@@ -8,14 +8,32 @@ import { Proxy_Manager } from "./Proxy_Manager.sol";
* @title Proxy_Resolver
*/
contract Proxy_Resolver {
/*******************************************
* Contract Variables: Contract References *
*******************************************/
Proxy_Manager internal proxyManager;
/***************
* Constructor *
***************/
/**
* @param _proxyManager Address of the Proxy_Manager.
*/
constructor(
address _proxyManager
) {
proxyManager = Proxy_Manager(_proxyManager);
}
/********************
* Public Functions *
********************/
function resolve(
string memory _name
)
...
...
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