laconicd/tests-solidity/suites/staking/contracts/proxies/StakingProxy.sol
Brett Sun c9639c3860
tests: add solidity test suites (#487)
* tests: add solidity test suite

* tests: remove require strings

* Update tests-solidity/init-test-node.sh

* Update tests-solidity/init-test-node.sh

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-09-01 17:16:28 -04:00

32 lines
1.0 KiB
Solidity

pragma solidity ^0.5.17;
import "../lib/os/ERC20.sol";
import "../Staking.sol";
import "./ThinProxy.sol";
contract StakingProxy is ThinProxy {
// keccak256("aragon.network.staking")
bytes32 internal constant IMPLEMENTATION_SLOT = 0xbd536e2e005accda865e2f0d1827f83ec8824f3ea04ecd6131b7c10058635814;
constructor(Staking _implementation, ERC20 _token) ThinProxy(address(_implementation)) public {
bytes4 selector = _implementation.initialize.selector;
bytes memory initializeData = abi.encodeWithSelector(selector, _token);
(bool success,) = address(_implementation).delegatecall(initializeData);
if (!success) {
assembly {
let output := mload(0x40)
mstore(0x40, add(output, returndatasize))
returndatacopy(output, 0, returndatasize)
revert(output, returndatasize)
}
}
}
function _implementationSlot() internal pure returns (bytes32) {
return IMPLEMENTATION_SLOT;
}
}