Skip to content

Commit

Permalink
impl: execution process logic
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Apr 28, 2024
1 parent d720f4f commit e38349e
Show file tree
Hide file tree
Showing 46 changed files with 903 additions and 1,078 deletions.
24 changes: 12 additions & 12 deletions bridge-contract/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bridge-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nacho-bridge-contract",
"version": "0.1.3",
"version": "0.1.4",
"type": "module",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand All @@ -13,8 +13,8 @@
},
"dependencies": {
"nacho-common-o1js": "^0.1.8",
"nacho-proof-generator": "^0.1.5",
"nacho-rollup-contract": "^0.1.4",
"nacho-proof-generator": "^0.1.7",
"nacho-rollup-contract": "^0.1.5",
"nacho-token-contract": "^0.1.1",
"o1js": "^0.17.0"
},
Expand Down
2 changes: 0 additions & 2 deletions bridge-contract/tests/bridge-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ describe("bridge contract", async () => {
depositsList[0].tokenId,
depositsList[0].tokenAmount,
UInt64.from(0),
Bool(true),
)

stateUtil.setBalance(
Expand Down Expand Up @@ -256,7 +255,6 @@ describe("bridge contract", async () => {
depositsList[1].tokenId,
depositsList[1].tokenAmount,
UInt64.from(0),
Bool(true),
)

stateUtil.setBalance(
Expand Down
11 changes: 9 additions & 2 deletions data-structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ pub use sibling::Sibling;
pub use signature::Signature;
pub use single_merkle_witness::SingleMerkleWitness;
pub use state_roots::StateRoots;
pub use stateful_transaction::StatefulTransaction;
pub use transaction::Transaction;
pub use stateful_transaction::{
BurnTokensTransactionState, BuyTokensTransactionState, CreatePoolTransactionState,
DepositTokensTransactionState, ProvideLiquidityTransactionState,
RemoveLiquidityTransactionState, SellTokensTransactionState, StatefulTransaction,
};
pub use transaction::{
BurnTokensTransaction, BuyTokensTransaction, CreatePoolTransaction, DepositTokensTransaction,
ProvideLiquidityTransaction, RemoveLiquidityTransaction, SellTokensTransaction, Transaction,
};
pub use tx_status::TxStatus;
pub use u256::U256;
pub use withdrawal::Withdrawal;
8 changes: 1 addition & 7 deletions data-structures/src/prover_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub enum ProverMethod {
token_id: U256,
user_deposit_token_amount: u64,
user_balance_token_amount: u64,
is_users_first_deposit: bool,
},
BurnTokens {
state_roots: StateRoots,
Expand Down Expand Up @@ -66,7 +65,6 @@ pub enum ProverMethod {
pool_total_liquidity_points: U256,
user_base_token_amount_to_provide: u64,
user_quote_token_amount_limit_to_provide: u64,
is_first_providing: bool,
user_signature: Signature,
},
RemoveLiquidity {
Expand Down Expand Up @@ -144,7 +142,6 @@ impl ByteConversion<3291> for ProverMethod {
token_id,
user_deposit_token_amount,
user_balance_token_amount,
is_users_first_deposit,
} => {
buf[0] = 1;
buf[1..129].copy_from_slice(&state_roots.to_bytes());
Expand All @@ -156,7 +153,6 @@ impl ByteConversion<3291> for ProverMethod {
buf[982..1014].copy_from_slice(&token_id.to_bytes());
buf[1014..1022].copy_from_slice(&user_deposit_token_amount.to_bytes());
buf[1022..1030].copy_from_slice(&user_balance_token_amount.to_bytes());
buf[1030..1031].copy_from_slice(&is_users_first_deposit.to_bytes());
}
ProverMethod::BurnTokens {
state_roots,
Expand Down Expand Up @@ -229,7 +225,6 @@ impl ByteConversion<3291> for ProverMethod {
pool_total_liquidity_points,
user_base_token_amount_to_provide,
user_quote_token_amount_limit_to_provide,
is_first_providing,
user_signature,
} => {
buf[0] = 4;
Expand All @@ -250,8 +245,7 @@ impl ByteConversion<3291> for ProverMethod {
buf[3179..3187].copy_from_slice(&user_base_token_amount_to_provide.to_bytes());
buf[3187..3195]
.copy_from_slice(&user_quote_token_amount_limit_to_provide.to_bytes());
buf[3195..3196].copy_from_slice(&is_first_providing.to_bytes());
buf[3196..3260].copy_from_slice(&user_signature.to_bytes());
buf[3195..3259].copy_from_slice(&user_signature.to_bytes());
}
ProverMethod::RemoveLiquidity {
state_roots,
Expand Down
Loading

0 comments on commit e38349e

Please sign in to comment.