Skip to content

Commit 2e185df

Browse files
committed
cleanup
1 parent c102fc0 commit 2e185df

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Diff for: packages/client/src/contract/instances.deployed.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"gateway": "0x1Ab49D53d0BfF0202ec4b330349B427155BBA7ac",
3-
"erc20": "0xa751b62893867D0608a2ADa5D17D0c43e3433040"
2+
"gateway": "0x3cDF223ED88e5489C8409538f95Bb7F93316D462",
3+
"erc20": "0x225FD9C5677E7B066cD723DFD07438687B805d52"
44
}

Diff for: packages/client/src/contract/payment-gateway.abi.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@
7878
"outputs": [],
7979
"stateMutability": "nonpayable",
8080
"type": "function"
81+
},
82+
{
83+
"inputs": [],
84+
"name": "withdrawSupplies",
85+
"outputs": [],
86+
"stateMutability": "nonpayable",
87+
"type": "function"
8188
}
82-
]
89+
]

Diff for: packages/truffle/contracts/PaymentGatewayContract.sol

+17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ contract PaymentGatewayContract {
2626
deployBlock = block.number;
2727
}
2828

29+
function sendValue(address payable recipient, uint256 amount) private {
30+
require(address(this).balance >= amount, "Insufficient balance");
31+
(bool success, ) = recipient.call{value: amount}("");
32+
require(success, "Unable to send value");
33+
}
34+
35+
function withdrawSupplies() public {
36+
uint256 balance = erc20.balanceOf(address(this));
37+
if (balance >= 0) {
38+
erc20.transfer(owner, balance);
39+
}
40+
balance = address(this).balance;
41+
if (balance >= 0) {
42+
sendValue(payable(owner), balance);
43+
}
44+
}
45+
2946
function sendUSDT(uint256 _amount, bytes32 _data) public {
3047
uint256 allowance = erc20.allowance(msg.sender, address(this));
3148

0 commit comments

Comments
 (0)