Skip to content

Commit

Permalink
devnet: use real account and nonce for send-lockups.js
Browse files Browse the repository at this point in the history
ghstack-source-id: fb233fa7275fc52d96edc6dfa1f08a7bf26b8736
Pull Request resolved: #61
  • Loading branch information
Leo committed Oct 28, 2020
1 parent bdd9d96 commit 13f79a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ethereum/migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const WrappedAsset = artifacts.require("WrappedAsset");
const Wormhole = artifacts.require("Wormhole");
const ERC20 = artifacts.require("ERC20PresetMinterPauser");

module.exports = async function (deployer) {
await deployer.deploy(WrappedAsset);
await deployer.deploy(Wormhole, {
keys: ["0xbeFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe"],
expiration_time: 0
}, WrappedAsset.address, 1000);
await deployer.deploy(ERC20, "Test Token","TKN");
};
23 changes: 15 additions & 8 deletions ethereum/src/send-lockups.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ function sleep(ms) {
module.exports = function(callback) {
const fn = async () => {
let bridge = await Wormhole.deployed();

let token = await ERC20.new("Test Token", "TKN");
let token = await ERC20.deployed();
console.log("Token:", token.address);
await token.mint("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1", "1000000000000000000");
await token.approve(bridge.address, "1000000000000000000");

while (true) {
let ev = await bridge.lockAssets(
token.address, /* asset address */
"1000000005", /* amount */
"0x1230000000000000000000000000000000000000000000000000000000000000", /* recipient */
1, /* target chain: solana */
0, /* nonce */
false /* refund dust? */
/* asset address */
token.address,
/* amount */
"1000000005",
/* recipient
* 7EFk3VrWeb29SWJPQs5cUyqcY3fQd33S9gELkGybRzeu base58 -> hex) */
"0x5c8b574eced4dbea1bbf23d5149564791900129ede419a6860e3e706b426b2ba",
/* target chain: solana */
1,
/* nonce */
Math.floor(Math.random() * 65535),
/* refund dust? */
false
);

let block = await web3.eth.getBlock('latest');
Expand Down
8 changes: 8 additions & 0 deletions solana/devnet_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ echo "Created token account $account"
# Mint new tokens owned by our CLI account
cli mint "$token" 10000000000 "$account"

# Create wrapped asset for the token we mint in send-lockups.js (2 = Ethereum, 9 decimals)
wrapped_token=$(cli create-wrapped "$bridge_address" 2 9 000000000000000000000000CfEB869F69431e42cdB54A4F4f105C19C080A601 | grep 'Wrapped Mint address' | awk '{ print $4 }')
echo "Created wrapped token $token"

# Create token account to receive wrapped assets from send-lockups.js
wrapped_account=$(cli create-account --seed=934893 "$wrapped_token" | grep 'Creating account' | awk '{ print $3 }')
echo "Created wrapped token account $wrapped_account"

# Do lock transactions
while : ; do
# Uncomment for simulated debugging transactions
Expand Down

0 comments on commit 13f79a9

Please sign in to comment.