Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,10 @@ dist

# remix compiled file
artifacts/
cache/

artifacts-zk/
cache-zk/

.yarn
.yarnrc.yml
46 changes: 46 additions & 0 deletions contracts/ZksyncOperator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "./base/OperatorBase.sol";
import "./base/FVLiquidityOperator.sol";
import "./base/CBridgeOperator.sol";
import "./base/CBridgeWithdrawer.sol";

contract ZksyncOperator is
OperatorBase,
FVLiquidityOperator,
CBridgeOperator,
CBridgeWithdrawer
{
constructor(
IERC20Upgradeable _usx,
IFlashVault _flashVault,
IVault _vault,
IcBridge _cBridge,
IWithdrawBox _withdrawBox
) public {
initialize(_usx, _flashVault, _vault, _cBridge, _withdrawBox);
}

function initialize(
IERC20Upgradeable _usx,
IFlashVault, /*_flashVault*/
IVault _vault,
IcBridge _cBridge,
IWithdrawBox _withdrawBox
) public initializer {
__OperatorBase_init(_usx);

// Flash Vault and liquidity are not supported when deploy
// __FVLiquidityOperator_init_unchained(_flashVault);

__VaultBase_init_unchained(_vault);
__CBridgeOperator_init_unchained(_cBridge);
__CBridgeWithdrawer_init_unchained(_withdrawBox);
}

function upgrade(IFlashVault _flashVault) external onlyOwner {
__FVLiquidityOperator_init_unchained(_flashVault);
}
}
8 changes: 4 additions & 4 deletions contracts/base/CBridgeWithdrawer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ abstract contract CBridgeWithdrawer is OperatorBase {
}

function requestWithdrawFromCBridge(
address _receiver,
uint64 _toChain,
uint64[] calldata _fromChains,
address[] calldata _tokens,
uint32[] calldata _ratios,
uint32[] calldata _slippages
) external nonReentrant onlyWhitelist(msg.sender) {
uint64 _chainId = uint64(_getChainId());

withdrawBox.withdraw(
withdrawNonce,
address(this),
_chainId,
_receiver,
_toChain,
_fromChains,
_tokens,
_ratios,
Expand Down
4 changes: 4 additions & 0 deletions contracts/base/OperatorBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ abstract contract OperatorBase is Initializable, ReentrancyGuard, Whitelists {
USX = _usx;
}

function approve(address _token) external onlyWhitelist(msg.sender) {
IERC20Upgradeable(_token).approve(msg.sender, uint256(-1));
}

// /**
// * @notice Only for the owner account.
// */
Expand Down
10 changes: 10 additions & 0 deletions contracts/base/VaultBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@ abstract contract VaultBase is OperatorBase {
// will revert if the pendingOwner is not set to this operator
vault._acceptOwner();
}

/**
* @dev Cleanup: repay borrow to the minter/vault. This burns the operator's USX
* AND reduces the minter's `totalMint` accounting in a single call (unlike a
* plain token burn, which leaves totalMint stale). The operator must hold at
* least `_amount` USX. Callable by whitelist users for the wind-down.
*/
function repay(uint256 _amount) external onlyWhitelist(msg.sender) {
vault.repayBorrow(_amount);
}
}
11 changes: 10 additions & 1 deletion deployments/PDLP-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@
"contract": "EthereumOperator",
"address": "0xeb8F955DAC5EDdD52489b1B361F87f6aA8830E10"
},
"ethereumOperatorImpl": {
"ethereumOperatorImpl______": {
"contract": "EthereumOperator",
"address": "0x639120d9C5595573321d34F6ee8B97784f42c734"
},
"ethereumOperatorImpl": {
"contract": "EthereumOperator",
"address": "0x3f9E89ce069C3a5CAD749C9D953E9b57bEcCb236"
},
"ethereumOperatorCleanupImpl": {
"contract": "EthereumOperator",
"path": "contracts/",
"address": "0x53386111A7e32b4079e69550A000eD5B9bA628CA"
}
}
11 changes: 10 additions & 1 deletion deployments/PDLP-10.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
"contract": "OpOperator",
"address": "0x86D9B423172B336bb7A4BA84354a9644EDbC4C4E"
},
"OpOperatorImpl": {
"OpOperatorImpl___": {
"contract": "OpOperator",
"address": "0x8e1d305AB9abDCB40F757b9e28C7782Af2392982"
},
"OpOperatorImpl": {
"contract": "OpOperator",
"address": "0xc132624055A3e6e1EF4457053c528df179B18285"
},
"opOperator": {
"contract": "OpOperator",
"address": "0x70a35414FaD53752C9352401BE211779EC413BD4"
Expand All @@ -24,5 +28,10 @@
"contract": "dForceLendingProvider",
"path": "contracts/base/providers/",
"address": "0x5385bCC7420012BaBd14675A466e24FBE2f9b1D6"
},
"opOperatorCleanupImpl": {
"contract": "OpOperator",
"path": "contracts/",
"address": "0xf972df23d8296d5e14F2B8CafF71Ca94A68Dc069"
}
}
40 changes: 40 additions & 0 deletions deployments/PDLP-1030.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"proxyAdmin": {
"contract": "ProxyAdmin",
"path": "contracts/library/",
"address": "0xD037c36dbc81a8890728D850E080e38F6EeB95EF"
},
"MiniMinterImpl": {
"contract": "MiniMinter",
"address": "0xB474D6F3C3d5E39CA700Da257b61d94D1C2b7D02"
},
"pdlpMiniMinterUSX": {
"contract": "MiniMinter",
"address": "0xB5b3da79789dE012Fd75108138b2315E5645715A"
},
"PolyOperatorImpl_": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x710Ea5d0F596FAdE797d71c41Ba949de48147604"
},
"PolyOperatorImpl": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x8355920d9a95CFcA3a4ed6cEAb379354587d2F98"
},
"polyOperatorUSX": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x8d717271b1A0aE97fcdF7D0a21Fa3DE4334b1EFd"
},
"dForceLendingProviderUSX": {
"contract": "dForceLendingProvider",
"path": "contracts/base/providers/",
"address": "0x149A632d2F147d08Da4cDBe730b486694Fa4Dd80"
},
"polyOperatorUSXCleanupImpl": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x5bB9048C9F4D4C57b0F4243f56EcBBfD45DA2315"
}
}
13 changes: 11 additions & 2 deletions deployments/PDLP-137.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
"contract": "PolyOperator",
"address": "0x0A6941Ef5578FdE91db5C84561eE4B4aE5C20cdd"
},
"PolyOperatorImpl": {
"PolyOperatorImpl__": {
"contract": "PolyOperator",
"address": "0x197CE4142ea7B327fEaafe37827dAfB6041816F7"
},
"PolyOperatorImpl__": {
"PolyOperatorImpl___": {
"contract": "PolyOperator",
"address": "0x037355Fc83F1D9Ca34868488C0414a8a1F43ddD6"
},
"PolyOperatorImpl": {
"contract": "PolyOperator",
"address": "0xD037c36dbc81a8890728D850E080e38F6EeB95EF"
},
"polyOperatorUSX": {
"contract": "PolyOperator",
"address": "0x99E8352D079326Bc431633a61954F713AafE372C"
Expand All @@ -50,5 +54,10 @@
"contract": "dForceLendingProvider",
"path": "contracts/base/providers/",
"address": "0x40F8417d3c98847Eb553785b607EDD64F90A213A"
},
"polyOperatorUSXCleanupImpl": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x0fD11B5ED5B82Ef454BEe2516D1b23d1b07b6c46"
}
}
30 changes: 30 additions & 0 deletions deployments/PDLP-324.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"proxyAdmin": {
"contract": "ProxyAdmin",
"path": "contracts/library/",
"address": "0xA23BbF83847c979C57551EA640e694d770773f8B"
},
"timeLock": {
"contract": "Timelock",
"path": "contracts/library/",
"address": "0x3c20D65EE474d2ce02f92cFd2D810d831b44b7Fe"
},
"MiniMinterImpl": {
"contract": "MiniMinter",
"address": "0xFE38A77B2f1997AB77B2E08a54e53c94836fEbFE"
},
"pdlpMiniMinterUSX": {
"contract": "MiniMinter",
"address": "0x6E4bc9aC9c1432aa790363ddfB29c0b9E42f6Af8"
},
"ZksyncOperatorImpl": {
"contract": "ZksyncOperator",
"path": "contracts/",
"address": "0x4575cc8B2B8eC9627Ea4Ec6fB45A947132070440"
},
"pdlpOperatorUSX": {
"contract": "ZksyncOperator",
"path": "contracts/",
"address": "0x01B2e0875791A616937f2961cFab96e29EAB3549"
}
}
11 changes: 10 additions & 1 deletion deployments/PDLP-42161.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@
"contract": "ArbiOperator",
"address": "0x8e1d305AB9abDCB40F757b9e28C7782Af2392982"
},
"ArbiOperatorImpl": {
"ArbiOperatorImpl____": {
"contract": "ArbiOperator",
"address": "0x990F2A61D4A9BC89ED6a9e823FD24736d763f8d5"
},
"ArbiOperatorImpl": {
"contract": "ArbiOperator",
"address": "0x0fd11b5ed5b82ef454bee2516d1b23d1b07b6c46"
},
"dForceLendingProviderUSX": {
"contract": "dForceLendingProvider",
"path": "contracts/base/providers/",
"address": "0x1De84422D17D7296F656B5307A9736044fEb71FA"
},
"arbiOperatorUSXCleanupImpl": {
"contract": "ArbiOperator",
"path": "contracts/",
"address": "0xf56A6c78f28AC450DB0A4e1367408B78AdD2d02D"
}
}
7 changes: 6 additions & 1 deletion deployments/PDLP-43114.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@
"path": "contracts/",
"address": "0x1EE116B869eCc7cd13C629a8a2Ae39Fa361265CF"
},
"PolyOperatorImpl": {
"PolyOperatorImpl___": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0xC5b1EC605738eF73a4EFc562274c1c0b6609cF59"
},
"PolyOperatorImpl": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0xD037c36dbc81a8890728D850E080e38F6EeB95EF"
},
"polyOperatorUSX": {
"contract": "PolyOperator",
"path": "contracts/",
Expand Down
8 changes: 6 additions & 2 deletions deployments/PDLP-56.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@
"contract": "BSCOperator",
"address": "0x50db54abdba1aacA924D3912DDA5Be6Bf9F3102b"
},
"BSCOperatorImpl": {
"BSCOperatorImpl___": {
"contract": "BSCOperator",
"address": "0x639120d9C5595573321d34F6ee8B97784f42c734"
},
"BSCOperatorImpl___": {
"BSCOperatorImpl____": {
"contract": "BSCOperator",
"address": "0xd8150d333AA9dECbfd4b5Cb535867ED9538aBF26"
},
"BSCOperatorImpl": {
"contract": "BSCOperator",
"address": "0xD037c36dbc81a8890728D850E080e38F6EeB95EF"
},
"bscOperatorEUX": {
"contract": "BSCOperator",
"address": "0xf0D29c81d3ECdf0CeD8f7cB0B77E1907575fD30c"
Expand Down
30 changes: 30 additions & 0 deletions deployments/PDLP-8453.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"proxyAdmin": {
"contract": "ProxyAdmin",
"path": "contracts/library/",
"address": "0x3BbB16351059D7405b2C41D9Fb9B89d71A8A1A4f"
},
"MiniMinterImpl": {
"contract": "MiniMinter",
"address": "0x17b93480Fd3b58091608015eeEC4Dec04f41a444"
},
"pdlpMiniMinterUSX": {
"contract": "MiniMinter",
"address": "0x8355920d9a95CFcA3a4ed6cEAb379354587d2F98"
},
"PolyOperatorImpl": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0xD65Ea2AAe8FCF09C3861F1422F3fB254585b1790"
},
"polyOperatorUSX": {
"contract": "PolyOperator",
"path": "contracts/",
"address": "0x76D853542cc8b70CF74724d7ff007D9a68873fa0"
},
"dForceLendingProviderUSX": {
"contract": "dForceLendingProvider",
"path": "contracts/base/providers/",
"address": "0x6fd7E203D7412A5acF2b1209cB3846370c91B77D"
}
}
Loading