Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
rename packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Haykhovhannisyan1 committed Oct 16, 2024
1 parent 3b3edf3 commit 363e0d0
Show file tree
Hide file tree
Showing 147 changed files with 6,986 additions and 5,400 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
647 changes: 647 additions & 0 deletions chains/evm/solidity/contracts/HashedTimeLockERC20.sol

Large diffs are not rendered by default.

559 changes: 559 additions & 0 deletions chains/evm/solidity/contracts/HashedTimeLockEther.sol

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions chains/evm/solidity/contracts/MessengerContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

interface IMessenger {
function notify(
bytes32 commitId,
bytes32 hashlock,
string memory dstChain,
string memory dstAsset,
string memory dstAddress,
string memory srcAsset,
address payable sender,
address payable srcReciever,
uint256 amount,
uint256 timelock,
address tokenContract
) external;
}

contract SimpleMessenger is IMessenger {
event NotificationReceived(
bytes32 indexed lockId,
bytes32 commitId,
bytes32 hashlock,
string dstChain,
string dstAsset,
string dstAddress,
string srcAsset,
address payable sender,
address payable srcReciever,
uint256 amount,
uint256 timelock,
address tokenContract
);

function notify(
bytes32 commitId,
bytes32 hashlock,
string memory dstChain,
string memory dstAsset,
string memory dstAddress,
string memory srcAsset,
address payable sender,
address payable srcReciever,
uint256 amount,
uint256 timelock,
address tokenContract
) public override {
emit NotificationReceived(
hashlock,
commitId,
hashlock,
dstChain,
dstAsset,
dstAddress,
srcAsset,
sender,
srcReciever,
amount,
timelock,
tokenContract
);
}
}
File renamed without changes.
57 changes: 57 additions & 0 deletions chains/evm/solidity/scripts/signHTLC.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const ethers = require("ethers");
require("dotenv").config();

async function signHTLC() {
const domain = {
name: "LayerswapV8",
version: "1",
chainId: 421614,
verifyingContract: "0x3E3Abe0752A588e78b6F8926631bBb453d2bddCa",
salt: "0x2e4ff7169d640efc0d28f2e302a56f1cf54aff7e127eededda94b3df0946f5c0"
};

// Use ethers.js to encode the domain and compute the domain separator
const domainSeparator = ethers.keccak256(
ethers.AbiCoder.defaultAbiCoder().encode(
['bytes32', 'bytes32', 'bytes32', 'uint256', 'address', 'bytes32'],
[
ethers.keccak256(ethers.toUtf8Bytes('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)')),
ethers.keccak256(ethers.toUtf8Bytes(domain.name)),
ethers.keccak256(ethers.toUtf8Bytes(domain.version)),
domain.chainId,
domain.verifyingContract,
domain.salt
]
)
);

console.log('Computed Domain Separator:', domainSeparator);

const types = {
lockCommitmentMsg: [
{ name: "hashlock", type: "bytes32" },
{ name: "timelock", type: "uint256" },
],
};

const message = {
hashlock: "0x928a260e1022cffc1b90018ab7f80ed5b2aef0b25d8c7c6825348811c30c7b8a",
timelock: 1724673591,
};

const privateKey = '0xe9ac8d073f52df4c776f16915460806dc5c28c9bc9b510ad074c275c8cff89e9';
const wallet = new ethers.Wallet(privateKey);

const signature = await wallet.signTypedData(domain, types, message);

console.log("Signature:", signature);

const sig = ethers.Signature.from(signature);
console.log({
r: sig.r,
s: sig.s,
v: sig.v
});
}

signHTLC().catch(console.error);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions chains/solana/sol/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[programs.devnet]
native = "DuHWoXCyDCQBa7oMkZBhvPBJYsPKbuUmusZBeK8vdBtN"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "devnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions chains/solana/sol/programs/sol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "sol"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "sol"


[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
idl-build = ["anchor-lang/idl-build"]

[dependencies]
anchor-lang = { version = "0.30.0" }
num_enum = "0.5.4"
sha2 = "0.10.2"
hex = "0.4.3"
Loading

0 comments on commit 363e0d0

Please sign in to comment.