... id: UID
}
/// This type is the witness resource and is intended to be used only once.
struct PEACE has drop {}
/// The first argument of this function is an actual instance of the
/// type T with `drop` ability. It is dropped as soon as rece...
...s(level), bytes32(uint256(5)));
// Call the level's `unlock` function and pass the downcasted bytes16
// value we just took from the private slot
level.unlock(bytes16(data));
// Assert we have unlocked the contract and passed the challenge
assertEq(level.locked(), false);
vm....
...}
```
这是一个完整部署的例子:
[**ZKPs Made Easy: zkWeb and ZoKrates** ](https://learnblockchain.cn/article/19586)
### References
\[1\] Eberhardt, J., & Tai, S. (2018, July). Zokrates-scalable privacy-preserving off-chain computations. In 2018 IEEE International Conference o...
...ls/ReentrancyGuard.sol";
/**
* @notice This code has not been audited and may contain vulnerabilities.
* Never use in the production.
*/
contract Staking is ReentrancyGuard {
MyToken public token;
Rewards public rewards;
mapping(address => uint256) public stakedAmounts;
...
...;
let caller = tx_context::sender(ctx);
// get the input value and assert
let input_value = coin::value(&input);
let output_value = amount * 1000 / 2000; // amount千万不要写成input_value!
assert!(input_value >= amount, EInputNotEnough);
// transection the input ...