mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
removed withdraw from Polygon as you need EOA
This commit is contained in:
parent
1d55aa7615
commit
d6a51b836a
|
@ -39,22 +39,6 @@ abstract contract PolygonBridgeResolver is Events, Helpers {
|
|||
_eventName = "LogDeposit(address,address,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(targetDsa, token, _amt, getId, setId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Withdraw assets from Polygon.
|
||||
* @notice Complete withdraw by submitting burn tx hash.
|
||||
* @param proof The proof generated from burn tx.
|
||||
*/
|
||||
function withdraw(
|
||||
bytes calldata proof
|
||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||
require(proof.length > 0, "invalid-proof");
|
||||
|
||||
migrator.exit(proof);
|
||||
|
||||
_eventName = "LogWithdraw(bytes)";
|
||||
_eventParam = abi.encode(proof);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectPolygonBridge is PolygonBridgeResolver {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
contract Events {
|
||||
event LogWithdraw(
|
||||
address token,
|
||||
uint256 amt,
|
||||
uint256 getId,
|
||||
uint256 setId
|
||||
);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
import { TokenInterface } from "../../common/interfaces.sol";
|
||||
import { Stores } from "../../common/stores.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract MainnetBridgeResolver is Stores, Events {
|
||||
/**
|
||||
* @dev Withdraw assets to mainnet.
|
||||
* @notice Withdraw assets to mainnet by burning the tokens.
|
||||
* @param token The address of the token to withdraw. (For MATIC: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
||||
* @param amt The amount of tokens to withdraw. (For max: `uint256(-1)`)
|
||||
* @param getId ID to retrieve amt.
|
||||
* @param setId ID stores the amount of tokens withdrawn.
|
||||
*/
|
||||
function withdraw(
|
||||
address token,
|
||||
uint256 amt,
|
||||
uint256 getId,
|
||||
uint256 setId
|
||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||
uint _amt = getUint(getId, amt);
|
||||
|
||||
if (token == maticAddr) {
|
||||
_amt = _amt == uint(-1) ? address(this).balance : _amt;
|
||||
TokenInterface(address(0)).withdraw(_amt);
|
||||
} else {
|
||||
TokenInterface _token = TokenInterface(token);
|
||||
_amt = _amt == uint(-1) ? _token.balanceOf(address(this)) : _amt;
|
||||
_token.withdraw(_amt);
|
||||
if (token == wmaticAddr) {
|
||||
TokenInterface(address(0)).withdraw(_amt);
|
||||
}
|
||||
}
|
||||
|
||||
setUint(setId, _amt);
|
||||
|
||||
_eventName = "LogWithdraw(address,address,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user