mirror of
https://github.com/arnaucube/miksi-core.git
synced 2026-02-07 11:36:47 +01:00
Add ETH deposit & withdraw
This commit is contained in:
@@ -18,10 +18,10 @@ contract Miksi {
|
||||
|
||||
function deposit(
|
||||
uint256 coinCode,
|
||||
uint256 amount,
|
||||
// uint256 amount,
|
||||
uint256 commitment
|
||||
) public {
|
||||
deposits[commitment] = Deposit(coinCode, amount);
|
||||
) public payable {
|
||||
deposits[commitment] = Deposit(coinCode, msg.value);
|
||||
}
|
||||
|
||||
function getDeposit(
|
||||
@@ -35,18 +35,22 @@ contract Miksi {
|
||||
|
||||
function withdraw(
|
||||
uint256 commitment,
|
||||
address payable _address,
|
||||
uint[2] memory a,
|
||||
uint[2][2] memory b,
|
||||
uint[2] memory c
|
||||
) public {
|
||||
|
||||
uint256[3] memory input = [
|
||||
uint256[4] memory input = [
|
||||
deposits[commitment].coinCode,
|
||||
deposits[commitment].amount,
|
||||
commitment
|
||||
commitment,
|
||||
uint256(_address)
|
||||
];
|
||||
require(verifier.verifyProof(a, b, c, input), "zkProof withdraw could not be verified");
|
||||
|
||||
// zk verification passed, proceed with the withdraw
|
||||
_address.send(deposits[commitment].amount);
|
||||
// _address.call.value(deposits[commitment].amount).gas(20317)();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user