Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New token precompiles with EIP2612 #55

Merged
merged 3 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion contracts/upgradeable_contracts/modules/factory/TokenProxy.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pragma solidity 0.7.5;

import "@openzeppelin/contracts/utils/Address.sol";
import "../../../upgradeability/Proxy.sol";
import "../../../interfaces/IOwnable.sol";

interface IPermittableTokenVersion {
function version() external pure returns (string memory);
Expand Down Expand Up @@ -77,6 +79,21 @@ contract TokenProxy is Proxy {
}
}

/**
* @dev Updates the implementation contract address.
* Only the bridge and bridge owner can call this method.
* @param _implementation address of the new implementation.
*/
function setImplementation(address _implementation) external {
require(msg.sender == bridgeContractAddr || msg.sender == IOwnable(bridgeContractAddr).owner());
require(Address.isContract(_implementation));
assembly {
// EIP 1967
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
sstore(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, _implementation)
}
}

/**
* @dev Tells the current version of the token proxy interfaces.
*/
Expand All @@ -89,6 +106,6 @@ contract TokenProxy is Proxy {
uint64 patch
)
{
return (1, 0, 0);
return (1, 1, 0);
}
}
Loading