Skip to content

Instantly share code, notes, and snippets.

View rizary's full-sized avatar
🎯
Focusing

rizary rizary

🎯
Focusing
View GitHub Profile
fn visit_while(&mut self, condition: &JasmExpression, body: &Block) -> () {
// // we count the length of instruction sequence before adding condition.
// let curr_seq_len = self.function_builder.get_mut().func_body().instrs().len();
// self.visit(condition);
// // TODO: Find the easiest way to split the wasm sequences.
// //
@rizary
rizary / wallet_test.go
Created August 26, 2021 10:37
Test wasm wallet
package wasm_test
import (
// "fmt"
// "math"
"encoding/json"
"syscall/js"
"testing"
"net/http"
pub async fn run_core(
connection_pool: ConnectionPool,
config: &ZkSyncConfig,
eth_gateway: EthereumGateway,
) -> anyhow::Result<Vec<JoinHandle<()>>> {
let (proposed_blocks_sender, proposed_blocks_receiver) =
mpsc::channel(DEFAULT_CHANNEL_CAPACITY);
let (state_keeper_req_sender, state_keeper_req_receiver) =
mpsc::channel(DEFAULT_CHANNEL_CAPACITY);
let (eth_watch_req_sender, eth_watch_req_receiver) = mpsc::channel(DEFAULT_CHANNEL_CAPACITY);
@rizary
rizary / deposit.sol
Created March 28, 2022 23:26
RollupNC review
// Deposits ETH or ERC20 tokens onto L2
function deposit(
uint[2] memory pubkey,
uint amount,
uint tokenType
) public payable {
if ( tokenType == 0 ) {
// reserved the token type if sender is same as coordinator
require(
msg.sender == coordinator,
// Andika: this is the recursive proof system
@proofSystem
class RollupProof extends ProofWithInput<RollupStateTransition> {
// Andika: first, it has to process the deposit from L1
@branch static processDeposit(
pending: MerkleStack<RollupDeposit>, // deposit queue
accountDb: AccountDb // L2 account
): RollupProof {
let before = new RollupState(pending.commitment, accountDb.commitment()); // current L2 state
let deposit = pending.pop(); // get deposit from queue
pragma solidity >= 0.5.0 <0.7.0;
import "@aztec/protocol/contracts/ERC1724/ZkAssetMintable.sol";
import "@aztec/protocol/contracts/libs/NoteUtils.sol";
import "@aztec/protocol/contracts/interfaces/IZkAsset.sol";
import "./LoanUtilities.sol";
// Loan is inherit from ZkAssetMintable.sol from AZTEC protocol.
// each Loan contract represent a loan in the network.
contract Loan is ZkAssetMintable {
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8;
import "./AdminControlled.sol";
import "./INearBridge.sol";
import "./NearDecoder.sol";
import "./Ed25519.sol";
/// Rizary: it is part of NearBridge interface and deployed on ethereum
///
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "./EthereumParser.sol";
import "./lib/EthUtils.sol";
import "./ethash/ethash.sol";
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-153429808-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts@4.7.3/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.7.3/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts@4.7.3/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts@4.7.3/security/Pausable.sol";
import "@openzeppelin/contracts@4.7.3/access/Ownable.sol";
import "@openzeppelin/contracts@4.7.3/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts@4.7.3/utils/Counters.sol";