Skip to content

Commit

Permalink
deploy for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TuanHoang committed Sep 18, 2024
1 parent e1e3ed6 commit bdc3fec
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/src/deploy/001_deploy_token.js

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

14 changes: 10 additions & 4 deletions build/src/deploy/006_unlock_token.js

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

2 changes: 1 addition & 1 deletion build/src/deploy/006_unlock_token.js.map

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

21 changes: 21 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@
"feepayerKeyPath": "/Users/sotatek/.cache/zkapp-cli/keys/brd.json",
"feepayerAlias": "brd",
"fee": "0.5"
},
"token_3": {
"url": "https://proxy.devnet.minaexplorer.com/graphql",
"keyPath": "keys/token_3.json",
"feepayerKeyPath": "/Users/sotatek/.cache/zkapp-cli/keys/brd.json",
"feepayerAlias": "brd",
"fee": "0.5"
},
"bridge_3": {
"url": "https://proxy.devnet.minaexplorer.com/graphql",
"keyPath": "keys/bridge_3.json",
"feepayerKeyPath": "/Users/sotatek/.cache/zkapp-cli/keys/brd.json",
"feepayerAlias": "brd",
"fee": "0.5"
},
"admin_3": {
"url": "https://proxy.devnet.minaexplorer.com/graphql",
"keyPath": "keys/admin_3.json",
"feepayerKeyPath": "/Users/sotatek/.cache/zkapp-cli/keys/brd.json",
"feepayerAlias": "brd",
"fee": "0.5"
}
}
}
4 changes: 4 additions & 0 deletions keys/admin_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"privateKey": "EKEYmy9pgwTHazcQQpqJ5e5SEg5QzEbB1tsUBFV9uEoyjqGmR3G4",
"publicKey": "B62qqukWhsT4WFS6P1ZZgBox8cLZwvTdgKidiGaBtCaNp1r7u4mYaWg"
}
4 changes: 4 additions & 0 deletions keys/bridge_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"privateKey": "EKEisyypantx9SuQiXd4nmzZcmc388BXuDYuwkpTGxbj48Qys3vw",
"publicKey": "B62qrVxNbp1NEJaoRjPuGRTPqkidys5u77Q25RwP7EhEessNRKL7hsT"
}
4 changes: 4 additions & 0 deletions keys/token_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"privateKey": "EKENhpXCG5BghvmtTcGUbeiqfaNBc3QcPBo1GcSY1S34KioYKGgv",
"publicKey": "B62qkSirQSX61kjxndoGeKBg2m1RPD9PMwrVkgqKpH6UvPGMTUAC5xE"
}
2 changes: 1 addition & 1 deletion src/deploy/001_deploy_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { FungibleToken, FungibleTokenAdmin, Bridge } from '../index.js';

// check command line arg

let after_fix = "_2";
let after_fix = "_3";

const tokenAlias = "token" + after_fix;
const adminContractAlias = "admin" + after_fix;
Expand Down
31 changes: 28 additions & 3 deletions src/deploy/006_unlock_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
*/
import fs from 'fs/promises';
import { Mina, PrivateKey, AccountUpdate, fetchAccount, PublicKey, UInt64, UInt8, Bool, Field } from 'o1js';
import { FungibleToken, FungibleTokenAdmin, Bridge } from '../index.js';
import { FungibleToken, FungibleTokenAdmin, Bridge, Secp256k1 } from '../index.js';
import { Bytes256, Ecdsa } from '../ecdsa/ecdsa.js';

// check command line arg

let after_fix = "";
let after_fix = "_3";

const tokenAlias = "token" + after_fix;
const adminContractAlias = "admin" + after_fix;
Expand Down Expand Up @@ -99,14 +100,38 @@ const supply = UInt64.from(21_000_000_000_000)
let sentTx;
// compile the contract to create prover keys
await fetchAccount({publicKey: feepayerAddress});
let privateKey = Secp256k1.Scalar.random();
let publicKey = Secp256k1.generator.scale(privateKey);

let amount = UInt64.from(3);

let msg = Bytes256.fromString(`unlock receiver = ${feepayerAddress.toFields} amount = ${amount.toFields} tokenAddr = ${tokenAddress.toFields}`);

let signature = Ecdsa.sign(msg.toBytes(), privateKey.toBigInt());

try {
// call update() and send transaction
console.log('build transaction and create proof...');
let tx = await Mina.transaction(
{ sender: feepayerAddress, fee },
async () => {
await AccountUpdate.fundNewAccount(feepayerAddress, 1);
await bridgeContract.unlock(UInt64.from(2), feepayerAddress , UInt64.from(1), tokenAddress);
await bridgeContract.unlock(
UInt64.from(2_000_000_000_000),
PublicKey.fromBase58("B62qq2TYNeGeUAXsMKzKeJ8wTWnNnTnESfpGGKZXHCw8FRf23uYzqXc"),
UInt64.from(1),
tokenAddress,
signature,
publicKey,
signature,
publicKey,
signature,
publicKey,
signature,
publicKey,
signature,
publicKey,
);
}
);
await tx.prove();
Expand Down

0 comments on commit bdc3fec

Please sign in to comment.